Files
cmanager/src/views/manage/company/companyList.vue

1168 lines
32 KiB
Vue
Raw Normal View History

2024-02-02 15:04:47 +08:00
<template>
<basic-container>
<avue-crud
:option="option"
:table-loading="loading "
:data="data"
ref="crud"
v-model="form"
:permission="permissionList"
:before-open="beforeOpen"
:before-close="beforeClose"
:page.sync="page"
@row-update="rowUpdate"
@row-save="rowSave"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
:upload-before="uploadBefore"
>
<template slot="menuLeft">
<el-button
v-if="vaildData(permission.manage_compan_companyList_addUser, false)"
size="small"
@click.stop="handleAddUser"
type="primary"
:disabled="selectionList.length === 0"
>添加账号</el-button
>
<el-button
v-if="vaildData(permission.manage_compan_companyList_config, false)"
size="small"
@click.stop="handleConfig"
type="primary"
:disabled="selectionList.length === 0"
>服务设置</el-button
>
<el-button
v-if="vaildData(permission.manage_compan_companyList_check, false)"
size="small"
@click.stop="handleCheck"
type="primary"
:disabled="selectionList.length === 0"
>审核</el-button
>
</template>
<template slot-scope="scope" slot="menu">
<el-button
type="text"
size="small"
@click.stop="rowStop(scope.row.id)"
v-if="
scope.row.status == 0 &&
vaildData(permission.manage_compan_companyList_stop, false)
"
>终止合作</el-button
><!--只有已审核的企业才显示终止合作按钮-->
<el-button
type="text"
size="small"
@click.stop="rowStart(scope.row.id)"
v-if="
scope.row.status === 9 &&
vaildData(permission.manage_compan_companyList_start, false)
"
>合作恢复</el-button
>
</template>
<template slot="cityIdForm" slot-scope="{ disabled }">
<jl-city-cascader
:disabled="disabled"
v-model="form.cityId"
></jl-city-cascader>
</template>
<template slot="authUrlIdImgForm">
<el-image
style="width: 100px; height: 100px"
:src="form.authUrlId"
:preview-src-list="[form.authUrlId]"
>
</el-image>
</template>
<template slot="identityUrl4IdImgForm">
<el-image
style="width: 100px; height: 100px"
:src="form.identityUrl4Id"
:preview-src-list="[form.identityUrl4Id]"
></el-image>
</template>
<template slot="identityUrl5IdImgForm">
<el-image
style="width: 100px; height: 100px"
:src="form.identityUrl5Id"
:preview-src-list="[form.identityUrl5Id]"
></el-image>
</template>
<template slot="signSrcUrlForm">
<el-image
style="width: 100px; height: 100px"
:src="form.signSrcUrl"
:preview-src-list="[form.signSrcUrl]"
></el-image>
</template>
<template slot="letterOfAttorneyUrlForm">
<el-image
style="width: 100px; height: 100px"
:src="form.letterOfAttorneyUrl"
:preview-src-list="[form.letterOfAttorneyUrl]"
></el-image>
</template>
<template slot="motoleyUrlImgForm">
<div v-if="imgList.length>0">
<span v-for="(item,index) in imgList" :key="index" class="motoley-img">
<el-image
style="width: 100px; height: 100px"
:src="item.url"
:preview-src-list="[item.url]"
></el-image>
</span>
</div>
<div class="el-image__error" style="width: 100px; height: 100px" v-else>加载失败</div>
</template>
<template slot="recordForm" slot-scope="{ row }">
<company-record :data="row"></company-record>
</template>
<template slot="motoleyUrlForm">
<el-upload
class="companyList-upload"
list-type="picture-card"
:auto-upload="true"
:file-list="imgList"
:limit="5"
:action="mutiPutFile"
:on-preview="handlePictureCardPreview"
:on-exceed="handleImgLimit"
:on-success="handleImgSuccess"
:on-remove="handleImgRemove"
:before-remove="beforeRemove"
:before-upload="beforeAvatarUpload"
>
<i slot="default" class="el-icon-plus avue-upload__icon"></i>
</el-upload>
</template>
<!--服务费-->
<template slot="serveCost" slot-scope="{ row }">
<span v-if="row.serveCost != -1 && row.serveCost">{{
moneyFormat(row.serveCost)
}}</span>
<span v-else>-</span>
</template>
<!--商报状态搜索栏-->
<!-- <template slot="insuranceOnSearch">
<el-select
v-model="query.insuranceOn"
placeholder="商保状态"
@change="selectInsureTyepChange"
>
<el-option
v-for="(item, index) in insureTypeList"
:key="index"
:label="item.label"
:value="item.value"
>{{ item.label }}</el-option
>
</el-select>
</template> -->
<!--保证金状态搜索栏trialOn-->
<template slot="trialOnSearch">
<el-select
v-model="query.trialOn"
placeholder="保证金"
@change="selectTrailTyepChange"
>
<el-option
v-for="(item, index) in bondList"
:key="index"
:label="item.label"
:value="item.value"
>{{ item.label }}</el-option
>
</el-select>
</template>
</avue-crud>
<add-account ref="addUser"></add-account>
<company-config ref="config" @success="refreshChange"></company-config>
<company-check ref="check" @success="refreshChange"></company-check>
</basic-container>
</template>
<script>
import {
getList,
getDetail,
add,
update,
stop,
start,
} from "@/api/manage/company";
import { getStationDic } from "@/api/manage/station";
import { getTradeDic } from "@/api/manage/trade";
import { mapGetters } from "vuex";
import addAccount from "./addAccount";
import companyConfig from "./companyConfig";
import companyCheck from "./companyCheck";
import { putFile } from "@/api/resource/oss";
import { check18IdCardNo } from "@/util/validate";
import { moneyFormat } from "@/util/money";
import companyRecord from "./companyRecord";
import { companyStatus } from "@/const/company";
const accept = [
"image/png",
"image/jpeg",
"image/svg+xml",
"image/gif",
"image/x-photoshop",
];
function getPath(path) {
const arr = path.split(",");
return arr[arr.length - 1];
}
export default {
components: { addAccount, companyConfig, companyCheck, companyRecord },
name: "manage_compan_companyList",
data() {
const validateTradeId=(rule,value,callback)=>{
if(value==''){
callback(new Error('请选择所属行业'));
}else{
callback();
}
}
return {
insureTypeList:[//商保下拉框
{
label: "停用",
value: 0,
},
{
label: "启用",
value: 1,
},
],
bondList:[//保证金
{
label: "已缴",
value: 0,
},
{
label: "未缴",
value: 1,
},
{
label: "免缴",
value: 2,
},
],
mutiPutFile:putFile,
imgList:[],
form: {},
selectionList: [],
query: {},
loading: true,
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
option: {
height: "auto",
tip: false,
searchShow: true,
searchMenuSpan: 4,
border: true,
index: true,
indexLabel: "序号",
selection: true,
viewBtn: true,
addBtn: true,
editBtn:true,
addBtnText: "企业开户",
addTitle: "新增企业",
delBtn: false,
menuWidth: 300,
labelWidth: 151,
dialogClickModal: false,
dialogType: "drawer",
dialogFullscreen: true,
column: [
{
label: "创建日期",
prop: "createTime",
type: "datetime",
format: "yyyy-MM-dd",
display: false,
},
{
label: "审核日期",
prop: "reviewTime",
type: "datetime",
format: "yyyy-MM-dd",
display: false,
},
{
label: "公司名称",
prop: "companyName",
search: true,
searchSpan: 5,
display: false,
},
{
type: "tree",
label: "所属市场",
prop: "stationId",
span: 12,
display: false,
search: true,
searchSpan: 4,
searchLabelWidth: 87,
dicUrl: getStationDic(),
props: {
label: "stationName",
value: "stationId",
},
},
{
label: "企业状态",
prop: "status",
type: "select",
search: true,
dicData: companyStatus,
display: false,
span: 24,
searchSpan: 4,
},
{
label: "商保状态",
prop: "insuranceOn",
type: "select",
search: true,
searchslot:false,
searchSpan: 4,
dicData: [
{
label: "停用",
value: 0,
},
{
label: "启用",
value: 1,
}
],
display: false,
},
{
label: "先开票",
prop: "invoiceOn",
type: "select",
dicData: [
{
label: "停用",
value: 0,
},
{
label: "启用",
value: 1,
},
{
label: "-",
value: -1,
},
],
display: false,
},
{
label: "银联代发",
prop: "payType",
type: "select",
dicData: [
{
label: "停用",
value: 0,
},
{
label: "启用",
value: 1,
},
{
label: "-",
value: -1,
},
],
display: false,
},
{
label: "保证金",
prop: "trialOn",
type: "select",
search: true,
searchslot:false,
searchLabelWidth: 66,
searchSpan: 5,
dicData: [
{
label: "已缴",
value: 0,
},
{
label: "未缴",
value: 1,
},
{
label: "免缴",
value: 2,
}
],
display: false,
},
{
label: "签订合同",
prop: "isSign",
dicData: [
{
label: "未签",
value: 0,
},
{
label: "已签",
value: 1,
},
],
display: false,
},
{
label:'电子合同',
prop:'contractOn',
type:'select',
dicData:[
{
label:'关闭',
value:0
},
{
label:'开启',
value:1
}
],
display:false,
},
{
label: "服务费",
prop: "serveCost",
slot: true,
display: false,
},
{
label: "驳回原因",
prop: "remarks",
display: false,
},
],
group: [
{
label: "",
column: [
{
type: "tree",
label: "所属市场",
size: "small",
prop: "stationId",
rules: [
{
required: true,
message: "请选择所属市场",
},
],
filterable: true,
dicUrl: getStationDic(),
props: {
label: "stationName",
value: "stationId",
},
dicFormatter(resp) {
return resp.data;
},
},
{
type: "select",
label: "所属行业",
size: "small",
prop: "tradeId",
rules: [
{
required:true,validator:validateTradeId,trigger:'blur'
}
],
filterable: true,
dicUrl: getTradeDic(),
props: {
label: "name",
value: "id",
},
dicFormatter(resp) {
var result=[];
resp.data.forEach(ele => {
if(ele.name!="1"){
result.push(ele)
}
});
return result;
},
},
{
type: "input",
label: "统一信用代码",
span: 12,
display: true,
editDisabled: true,
size: "small",
prop: "companyTid",
rules: [
{
required: true,
whitespace: true,
message: "请输入统一信用代码",
},
],
placeholder: "18位统一社会信用代码",
},
{
type: "input",
label: "企业名称",
span: 12,
display: true,
size: "small",
prop: "companyName",
rules: [
{
required: true,
whitespace: true,
message: "请输入企业名称",
},
],
},
{
type: "input",
label: "法人姓名",
span: 12,
display: true,
size: "small",
prop: "masterName",
rules: [
{
required: true,
whitespace: true,
message: "请输入法人姓名",
},
],
},
{
type: "input",
label: "法人身份证号",
span: 12,
display: true,
size: "small",
prop: "masterIdentity",
rules: [
{
required: true,
whitespace: true,
message: "请输入法人身份证号",
},
{
validator: (rule, value, callback) => {
if (check18IdCardNo(value)) {
callback();
} else {
callback(new Error("身份证格式不正确"));
}
},
},
],
},
{
type: "input",
label: "所在地区",
span: 12,
display: true,
prop: "cityId",
formslot: true,
rules: [
{
required: true,
message: "请选择所在地区",
},
],
},
{
type: "input",
label: "详细地址",
span: 12,
display: true,
size: "small",
prop: "companyAddress",
rules: [
{
required: true,
whitespace: true,
message: "请输入详细地址",
},
],
},
// 图片上传
{
type: "upload",
label: "法人身份证(人像)",
span: 12,
showFileList: false,
listType: "picture-img",
multiple: false,
propsHttp: {
res: "data",
url: "link",
},
canvasOption: {},
headers: [],
data: [],
accept,
size: "small",
prop: "identityUrl4Id",
action: putFile,
viewDisplay: false,
rules: [
{
required: true,
message: "请上传法人身份证(人像)",
},
],
// tip:'上传图片大小限制2M以内',
},
{
type: "upload",
label: "法人身份证(国徽)",
span: 12,
showFileList: false,
listType: "picture-img",
multiple: false,
propsHttp: {
res: "data",
url: "link",
},
canvasOption: {},
headers: [],
data: [],
accept,
size: "small",
prop: "identityUrl5Id",
action: putFile,
viewDisplay: false,
rules: [
{
required: true,
message: "请上传法人身份证(国徽)",
},
],
// tip:'上传图片大小限制2M以内',
},
{
type: "upload",
label: "营业执照",
span: 12,
showFileList: false,
listType: "picture-img",
multiple: false,
propsHttp: {
res: "data",
url: "link",
},
accept,
canvasOption: {},
headers: [],
data: [],
size: "small",
prop: "authUrlId",
action: putFile,
viewDisplay: false,
rules: [
{
required: true,
message: "请上传营业执照照片",
},
],
// tip:'上传图片大小限制2M以内',
},
{
type: "upload",
label: "电子签章申请表",
span: 12,
showFileList: false,
listType: "picture-img",
multiple: false,
propsHttp: {
res: "data",
url: "link",
},
accept,
canvasOption: {},
headers: [],
data: [],
size: "small",
prop: "signSrcUrl",
action: putFile,
viewDisplay: false,
rules: [
{
required: true,
message: "请上传电子签章申请表",
},
],
// tip:'上传图片大小限制2M以内',
},
{
type: "upload",
label: "授权委托书",
span: 24,
showFileList: false,
listType: "picture-img",
multiple: false,
propsHttp: {
res: "data",
url: "link",
},
canvasOption: {},
headers: [],
data: [],
accept,
size: "small",
prop: "letterOfAttorneyUrl",
action: putFile,
viewDisplay: false,
rules: [
{
required: true,
message: "请上传授权委托书",
},
],
// tip:'上传图片大小限制2M以内',
},
{
label: "招聘简章",
formslot:true,
span:24,
prop:'motoleyUrl',
rules: [
{
required: true,
message: "请上传招聘简章",
},
],
viewDisplay: false,
},
// 图片预览
{
label: "法人身份证(人像)",
span: 12,
prop: "identityUrl4IdImg",
formslot: true,
editDisplay: false,
addDisplay: false,
viewDisplay: true,
},
{
label: "法人身份证(国徽)",
span: 12,
prop: "identityUrl5IdImg",
formslot: true,
editDisplay: false,
addDisplay: false,
viewDisplay: true,
},
{
label: "营业执照照片",
span: 12,
prop: "authUrlIdImg",
formslot: true,
editDisplay: false,
addDisplay: false,
viewDisplay: true,
},
{
label: "电子签章申请表",
span: 12,
prop: "signSrcUrl",
formslot: true,
editDisplay: false,
addDisplay: false,
viewDisplay: true,
},
{
label: "授权委托书",
span: 12,
prop: "letterOfAttorneyUrl",
formslot: true,
editDisplay: false,
addDisplay: false,
viewDisplay: true,
},
{
label: "招聘简章",
span: 24,
prop: "motoleyUrlImg",
formslot: true,
editDisplay: false,
addDisplay: false,
viewDisplay: true,
},
{
label: "操作记录",
prop: "record",
labelPosition: "top",
span: 24,
formslot: true,
editDisplay: false,
addDisplay: false,
viewDisplay: true,
},
],
}
],
},
data: [],
};
},
computed: {
...mapGetters(["userInfo", "permission"]),
permissionList() {
return {
addBtn: this.vaildData(
this.permission.manage_compan_companyList_add,
false
),
viewBtn: this.vaildData(
this.permission.manage_compan_companyList_view,
false
),
editBtn: this.vaildData(
this.permission.manage_compan_companyList_edit,
false
),
};
},
ids() {
let ids = [];
this.selectionList.forEach((ele) => {
ids.push(ele.id);
});
return ids;
},
},
methods: {
// uploadBefore(file, done, loading) {
// const isLt2M = file.size / 1024 / 1024 < 2;
// if (!isLt2M) {
// this.$message.error("上传图片大小不能超过 2MB!");
// loading();
// return;
// }
// done();
// },
// uploadBefore(done) {
// done();
// },
initData() {
this.onLoad(this.page, this.query);
},
handleCheck() {
if (this.ids.length !== 1) {
this.$message.closeAll();
this.$message({
type: "warning",
message: "请选择一条数据",
});
return;
}
/*已审核的*/
let flags = true;
this.data.forEach((ele) => {
if (ele.status == 0 && ele.id == this.ids[0]) {
flags = false;
}
});
if (!flags) {
this.$message.closeAll(); //只显示一个提示
this.$message.error("该企业信息已经审核,不用重复操作");
return;
}
this.$refs.check.open(this.ids[0]);
},
handleAddUser() {
if (this.ids.length !== 1) {
this.$message({
type: "warning",
message: "请选择一条数据",
});
return;
}
const selected = this.selectionList[0];
this.$refs.addUser.open(selected);
},
handleConfig() {
if (this.ids.length !== 1) {
this.$message({
type: "warning",
message: "请选择一条数据",
});
return;
}
const selected = this.selectionList[0];
this.$refs.config.open(selected.id, selected.tenantId);
},
rowSave(row, done, loading) {
row.authUrlId = getPath(row.authUrlId);
row.identityUrl4Id = getPath(row.identityUrl4Id);
row.identityUrl5Id = getPath(row.identityUrl5Id);
add(row).then(
() => {
this.onLoad(this.page);
// 获取新增数据的相关字段
this.$message({
type: "success",
message: "操作成功!",
});
// 数据回调进行刷新
done(row);
},
(error) => {
window.console.log(error);
loading();
}
);
},
rowUpdate(row, index, done, loading) {
row.authUrlId = getPath(row.authUrlId);
row.identityUrl4Id = getPath(row.identityUrl4Id);
row.identityUrl5Id = getPath(row.identityUrl5Id);
update(row).then(
() => {
this.onLoad(this.page);
this.$message({
type: "success",
message: "操作成功!",
});
// 数据回调进行刷新
done(row);
},
(error) => {
window.console.log(error);
loading();
}
);
},
rowStop(id) {
let h = this.$createElement;
this.$confirm(
h("p", { style: "color: #F56C6C" }, "一旦终止合作企业将无法操作系统"),
"您确定要终止与此公司的合作吗?",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
center: true,
}
)
.then(() => {
this.loading = true;
stop(id)
.then((resp) => {
this.$message({
type: "success",
message: resp.data.msg,
});
this.onLoad(this.page, this.query);
})
.catch(() => {
this.loading = false;
});
})
.catch(() => {});
},
rowStart(id) {
let h = this.$createElement;
this.$confirm(
h("p", { style: "color: #F56C6C" }, "一旦恢复合作企业所有账号均可使用"),
"您确定要恢复与此公司的合作吗?",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
center: true,
}
)
.then(() => {
this.loading = true;
start(id)
.then((resp) => {
this.$message({
type: "success",
message: resp.data.msg,
});
this.onLoad(this.page, this.query);
})
.catch(() => {
this.loading = false;
});
})
.catch(() => {});
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
//(this.query,params);
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
selectionChange(list) {
this.selectionList = list;
},
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
beforeOpen(done, type) {
if (["add", "edit"].includes(type)) {
this.imgList=[];
this.initData();
done();
}
if (["edit", "view"].includes(type)) {
this.imgList=[];
this.loading = true;
getDetail(this.form.id).then((res) => {
this.loading = false;
this.form = res.data.data;
if(this.form.motoleyUrl!=""){
var strList=this.form.motoleyUrl.split(',');
for(var i in strList){
this.imgList.push({url:strList[i]})
}
}
if(this.form.tradeId==1){
this.form.tradeId='';
}
done();
});
}
},
beforeClose(done) {
done();
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
refreshChange() {
this.onLoad(this.page, this.query);
},
onLoad(page, params = {}) {
this.loading = true;
getList(
page.currentPage,
page.pageSize,
Object.assign(this.query, params)
).then((res) => {
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
this.loading = false;
});
},
moneyFormat,
/*多张图片上传*/
handleImgLimit(){
this.$message.warning('当前最多上传5张图片');
},
handleImgSuccess(res){
if(res.code==200){
this.imgList.push({url:res.data.link});
var str="";
for(var i=0;i<this.imgList.length;i++){
str+=this.imgList[i]['url']+",";
}
if(str.length>0){
str=str.substr(0,str.length-1);
}
this.form.motoleyUrl=str;
}
else{
this.$message.error('上传失败');
}
},
handleImgRemove(file){
let index=0;
for(let i in this.imgList){
if(this.imgList[i]['uid']==file.uid){
index=i;
break;
}
}
this.imgList.splice(index,1);
var str="";
for(var i=0;i<this.imgList.length;i++){
str+=this.imgList[i]['url']+",";
}
if(str.length>0){
str=str.substr(0,str.length-1);
}
this.form.motoleyUrl=str;
},
selectInsureTyepChange(val){
this.query.insuranceOn=val
},
selectTrailTyepChange(val){
this.query.trialOn=val;
},
},
watch: {},
};
</script>
<style>
.companyList-upload .el-upload--picture-card{
width: 178px;
height: 178px;
background-color: #ffffff;
}
.companyList-upload .el-input__inner{
border: 1px solid #DCDFE6;
}
.companyList-upload .el-upload-list--picture-card .el-upload-list__item{
width: 178px;
height: 178px;
}
.motoley-img{
margin-right: 10px;
}
</style>