修复选择企业回显记忆性问题

xuhongjie
许宏杰 3 months ago
parent f7cc4264be
commit 46c4dc6c39

@ -1,12 +1,12 @@
import request from "@/utils/request" import request from "@/utils/request";
// 分页查询企业基础信息 // 分页查询企业基础信息
export function getEnterList(params) { export function getEnterList(params) {
return request({ return request({
url: "/system/enterpriseBasicInfo/list", url: "/system/enterpriseBasicInfo/list",
method: "get", method: "get",
params params,
}) });
} }
// 新增企业基础信息 // 新增企业基础信息
@ -14,8 +14,8 @@ export function enterpriseBasicInfoNew(data) {
return request({ return request({
url: "/system/enterpriseBasicInfo", url: "/system/enterpriseBasicInfo",
method: "post", method: "post",
data data,
}) });
} }
// 修改企业基础信息 // 修改企业基础信息
@ -23,8 +23,8 @@ export function enterpriseBasicInfoChange(data) {
return request({ return request({
url: "/system/enterpriseBasicInfo/edit", url: "/system/enterpriseBasicInfo/edit",
method: "post", method: "post",
data data,
}) });
} }
// 根据主键查询企业基础信息 // 根据主键查询企业基础信息
@ -32,7 +32,7 @@ export function enterpriseBasicInfoId(id) {
return request({ return request({
url: "/system/enterpriseBasicInfo/" + id, url: "/system/enterpriseBasicInfo/" + id,
method: "get", method: "get",
}) });
} }
// 删除企业基础信息 // 删除企业基础信息
@ -40,8 +40,8 @@ export function enterpriseBasicInfoDel(params) {
return request({ return request({
url: "/system/enterpriseBasicInfo" + id, url: "/system/enterpriseBasicInfo" + id,
method: "post", method: "post",
params params,
}) });
} }
// 分页查询联络人列表 // 分页查询联络人列表
@ -49,6 +49,13 @@ export function getjContacts(params) {
return request({ return request({
url: "/jjh/jContacts", url: "/jjh/jContacts",
method: "get", method: "get",
params params,
}) });
}
export function getenterpriseByName(data) {
return request({
url: "/system/templateRecord/searchEntCodeToInfo",
method: "post",
data,
});
} }

@ -216,7 +216,10 @@ section::-webkit-scrollbar {
// display: none; // display: none;
// } // }
// //
.honor-dialog,.collectDialog-dialog,.headquarterEnterprise-dialog,.serviceIndustry-dialog { .honor-dialog,
.collectDialog-dialog,
.headquarterEnterprise-dialog,
.serviceIndustry-dialog {
section { section {
div::-webkit-scrollbar { div::-webkit-scrollbar {
display: block; display: block;
@ -402,3 +405,7 @@ section::-webkit-scrollbar {
} }
} }
} }
.tablecell .el-checkbox__label {
display: none !important;
}

@ -1,4 +1,12 @@
<template> <template>
<el-dialog
title="企业自选列表"
:visible.sync="activeEnterpriseView"
width="1200px"
append-to-body
destroy-on-close
:close-on-click-modal="false"
>
<div class="L-public-main" id="L-size-main"> <div class="L-public-main" id="L-size-main">
<div class="L-main" style="padding: 0"> <div class="L-main" style="padding: 0">
<header id="L-header"> <header id="L-header">
@ -43,11 +51,17 @@
@click="handleQuery('queryFrom')" @click="handleQuery('queryFrom')"
>查询</el-button >查询</el-button
> >
<el-button size="mini" type="primary" @click="ConfirmSelct()"
>确定勾选</el-button
>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-form> </el-form>
</header> </header>
<section> <section>
<!-- @selection-change="handleSelectionChange"
row-key="tyshxydm" -->
<el-checkbox-group v-model="selectList" @change="CheckboxChange">
<el-table <el-table
ref="multipleTable" ref="multipleTable"
v-loading="loading" v-loading="loading"
@ -55,9 +69,13 @@
:row-class-name="tableRowClassName" :row-class-name="tableRowClassName"
:height="tabHeader" :height="tabHeader"
:max-height="tabHeader" :max-height="tabHeader"
@selection-change="handleSelectionChange" cell-class-name="tablecell"
> >
<el-table-column type="selection" align="center" width="50" /> <el-table-column width="45" center>
<template slot-scope="scope">
<el-checkbox :label="scope.row.tyshxydm"> </el-checkbox>
</template>
</el-table-column>
<el-table-column label="企业名称" prop="qymc" /> <el-table-column label="企业名称" prop="qymc" />
<el-table-column label="统一社会信用代码" prop="tyshxydm" /> <el-table-column label="统一社会信用代码" prop="tyshxydm" />
<!-- <el-table-column label="法定代表人" prop="policyLevel" /> <!-- <el-table-column label="法定代表人" prop="policyLevel" />
@ -75,6 +93,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-checkbox-group>
<my-pagination <my-pagination
id="L-pagination" id="L-pagination"
:total="total" :total="total"
@ -86,6 +105,7 @@
</section> </section>
</div> </div>
</div> </div>
</el-dialog>
</template> </template>
<script> <script>
import myPagination from "@/views/components/Pagination/index.vue"; import myPagination from "@/views/components/Pagination/index.vue";
@ -96,8 +116,10 @@ import {
enterpriseBasicInfoChange, enterpriseBasicInfoChange,
enterpriseBasicInfoId, enterpriseBasicInfoId,
enterpriseBasicInfoDel, enterpriseBasicInfoDel,
getenterpriseByName,
} from "@/api/jin_ji_hu/enterList"; } from "@/api/jin_ji_hu/enterList";
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import { Checkbox } from "element-ui";
export default { export default {
components: { myPagination }, components: { myPagination },
dicts: ["jjh_project_type"], dicts: ["jjh_project_type"],
@ -106,6 +128,7 @@ export default {
}, },
data() { data() {
return { return {
activeEnterpriseView: false,
rowList: [], rowList: [],
userType: this.$store.state.user.userType, userType: this.$store.state.user.userType,
roles: this.$store.state.user.roles, roles: this.$store.state.user.roles,
@ -167,14 +190,15 @@ export default {
uploadList: [], uploadList: [],
// //
exportLoading: false, exportLoading: false,
selectList: [],
}; };
}, },
watch: { watch: {
value: { value: {
handler(val) { handler(val) {
console.log("监听", val.length);
if (val) { if (val) {
this.rowList = val; this.selectList = val.map((it) => it.creditCode);
console.log("监听", this.selectList.length);
} }
}, },
deep: true, deep: true,
@ -188,57 +212,22 @@ export default {
this.formInline.qymc = this.$route.params.enterpriseName; this.formInline.qymc = this.$route.params.enterpriseName;
this.pagination = { ...this.pagination, ...this.formInline }; this.pagination = { ...this.pagination, ...this.formInline };
} }
this.getList();
}, },
destroyed() { destroyed() {
window.removeEventListener("resize", this.cancalDebounce); window.removeEventListener("resize", this.cancalDebounce);
}, },
methods: { methods: {
// // showDialog() {
toggleSelection() { this.getList();
if (this.rowList.length > 0) { this.activeEnterpriseView = true;
this.rowList.map((row) => {
const newItem = this.tableData.filter(
(item) => item.tyshxydm == row.creditCode
);
if (newItem.length > 0) {
this.$refs.multipleTable.toggleRowSelection(newItem[0]);
}
});
} else {
this.$refs.multipleTable.clearSelection();
}
}, },
// /** async ConfirmSelct() {
// * let res = await getenterpriseByName(this.selectList);
// */ this.$emit("input", res.data);
handleSelectionChange(val) { this.activeEnterpriseView = false;
const combinedArray = [ },
...val, CheckboxChange() {
...this.rowList.map((item) => ({ console.log(this.selectList);
qymc: item.enterpriseName,
tyshxydm: item.creditCode,
})),
];
const uniqueArray = Array.from(
combinedArray
.reduce((map, item) => {
if (!map.has(item.tyshxydm)) {
map.set(item.tyshxydm, item);
}
return map;
}, new Map())
.values()
);
const list = uniqueArray.map((item) => {
return {
enterpriseName: item.qymc,
creditCode: item.tyshxydm,
};
});
this.$emit("input", list);
}, },
// //
getList() { getList() {
@ -247,12 +236,9 @@ export default {
this.loading = false; this.loading = false;
this.total = res.data.total; this.total = res.data.total;
this.tableData = res.data.records; this.tableData = res.data.records;
this.$nextTick(() => {
this.toggleSelection();
});
}); });
}, },
// //
getPagination(pages) { getPagination(pages) {
this.pagination.current = pages.page; this.pagination.current = pages.page;
@ -375,7 +361,7 @@ export default {
// //
handleDelete(index) { handleDelete(index) {
this.fileList.splice(index, 1); this.fileList.splice(index, 1);
this.$emit("input", this.listToString(this.fileList)); // this.$emit("input", this.listToString(this.fileList));
}, },
// //
getFileName(name) { getFileName(name) {
@ -416,3 +402,5 @@ export default {
}, },
}; };
</script> </script>
<style lang="scss" scoped></style>

@ -410,7 +410,7 @@
<el-col :span="24" v-if="form.isFrame == 2"> <el-col :span="24" v-if="form.isFrame == 2">
<el-form-item label="已选企业" prop="enterpriseDirectoryList"> <el-form-item label="已选企业" prop="enterpriseDirectoryList">
<div class="active-enterprise"> <div class="active-enterprise">
<div class="enterprise-name"> <div class="enterprise-name" @click="lookentErprise()">
<div <div
v-if=" v-if="
form.enterpriseDirectoryList && form.enterpriseDirectoryList &&
@ -498,6 +498,7 @@
<el-col :span="24"> <el-col :span="24">
<el-form-item label="短信内容" prop="smsInfo"> <el-form-item label="短信内容" prop="smsInfo">
<el-input <el-input
:disabled="isReplace"
v-model="form.smsInfo" v-model="form.smsInfo"
type="textarea" type="textarea"
placeholder="请输入短信内容" placeholder="请输入短信内容"
@ -559,15 +560,10 @@
</el-dialog> </el-dialog>
<!-- 企业自选弹出层 --> <!-- 企业自选弹出层 -->
<el-dialog <activeEnterpriseList
title="企业自选列表" ref="activeEnterpriseList"
:visible.sync="activeEnterpriseView" v-model="form.enterpriseDirectoryList"
width="1200px" />
append-to-body
:close-on-click-modal="false"
>
<activeEnterpriseList v-model="form.enterpriseDirectoryList" />
</el-dialog>
</div> </div>
</template> </template>
@ -741,6 +737,12 @@ export default {
this.getTemplateList(); this.getTemplateList();
}, },
methods: { methods: {
//
lookentErprise() {
this.viewVisible = true;
this.businessList = this.form.enterpriseDirectoryList;
},
/** /**
* 企业名录维护方式变化 * 企业名录维护方式变化
*/ */
@ -752,7 +754,7 @@ export default {
* 打开企业自选列表 * 打开企业自选列表
*/ */
handlerEnterpriseOption() { handlerEnterpriseOption() {
this.activeEnterpriseView = true; this.$refs.activeEnterpriseList.showDialog();
}, },
getDataList() { getDataList() {

Loading…
Cancel
Save