Commit 5fe0b31b authored by “yiyousong”'s avatar “yiyousong”

perf: 优化业务事项关联

parent 2190e71d
...@@ -252,14 +252,13 @@ export default { ...@@ -252,14 +252,13 @@ export default {
}); });
}, },
// 获取站点业务列表 // 获取站点业务列表
async getSiteBusinessData(search = {}) { async getSiteBusinessData() {
this.siteBusinessTable.loading = true; this.siteBusinessTable.loading = true;
let res = await siteBusinessList({ let res = await siteBusinessList({
page: this.siteBusinessTable.current, page: this.siteBusinessTable.current,
size: this.siteBusinessTable.size, size: this.siteBusinessTable.size,
siteId: this.siteId, siteId: this.siteId,
businessName: `%${this.serchSiteBusiness}%`, businessName: `%${this.serchSiteBusiness}%`,
...search,
}); });
let { code, data } = res.data; let { code, data } = res.data;
if (code === 1) { if (code === 1) {
...@@ -279,7 +278,7 @@ export default { ...@@ -279,7 +278,7 @@ export default {
page: this.businessTable.current, page: this.businessTable.current,
size: this.businessTable.size, size: this.businessTable.size,
name: `%${this.serchData}%`, name: `%${this.serchData}%`,
businessType: 0, // businessType: 0, //一体化业务
}); });
let { code, data } = res.data; let { code, data } = res.data;
if (code === 1) { if (code === 1) {
......
...@@ -59,7 +59,6 @@ ...@@ -59,7 +59,6 @@
<!-- 表格 --> <!-- 表格 -->
<y-table <y-table
:columns="siteMatterTable.columns" :columns="siteMatterTable.columns"
:expandIconColumnIndex="2"
:data="siteMatterTable.data" :data="siteMatterTable.data"
:pageSize.sync="siteMatterTable.size" :pageSize.sync="siteMatterTable.size"
:current.sync="siteMatterTable.current" :current.sync="siteMatterTable.current"
...@@ -176,7 +175,6 @@ ...@@ -176,7 +175,6 @@
<!-- 表格 --> <!-- 表格 -->
<y-table <y-table
:columns="baseMatterTable.columns" :columns="baseMatterTable.columns"
:expandIconColumnIndex="2"
:data="baseMatterTable.data" :data="baseMatterTable.data"
:pageSize.sync="baseMatterTable.size" :pageSize.sync="baseMatterTable.size"
:current.sync="baseMatterTable.current" :current.sync="baseMatterTable.current"
...@@ -384,22 +382,19 @@ export default { ...@@ -384,22 +382,19 @@ export default {
methods: { methods: {
...mapMutations("site", ["SET_matterDict"]), ...mapMutations("site", ["SET_matterDict"]),
// 获取部门列表 // 获取部门列表
async getDeptListData(obj = {}) { async getDeptListData() {
this.deptLoading = true;
let res = await getDeptList({ let res = await getDeptList({
siteId: this.siteId, siteId: this.siteId,
page: 1, page: 1,
size: -1, size: -1,
...obj,
}); });
this.deptLoading = false;
let { code, data } = res.data; let { code, data } = res.data;
if (code === 1) { if (code === 1) {
this.deptList = data.data; this.deptList = data.data;
} }
}, },
// 获取站点事项 // 获取站点事项
async getMatterSiteData(search = {}) { async getMatterSiteData() {
this.siteMatterTable.loading = true; this.siteMatterTable.loading = true;
let res = await getSiteMatterList({ let res = await getSiteMatterList({
page: this.siteMatterTable.current, page: this.siteMatterTable.current,
...@@ -408,7 +403,6 @@ export default { ...@@ -408,7 +403,6 @@ export default {
source: this.siteMatterTable.search.source, source: this.siteMatterTable.search.source,
matterName: `%${this.siteMatterTable.search.matterName}%`, matterName: `%${this.siteMatterTable.search.matterName}%`,
deptCode: this.siteMatterTable.search.deptCode, deptCode: this.siteMatterTable.search.deptCode,
...search,
}); });
if (res.data.code == 1) { if (res.data.code == 1) {
let { pageInfo, data } = res.data.data; let { pageInfo, data } = res.data.data;
...@@ -422,7 +416,7 @@ export default { ...@@ -422,7 +416,7 @@ export default {
this.siteMatterTable.loading = false; this.siteMatterTable.loading = false;
}, },
// 获取一体化事项列表 // 获取一体化事项列表
async getMatterListData(search = {}) { async getMatterListData() {
this.baseMatterTable.loading = true; this.baseMatterTable.loading = true;
let res = await getMatterListSubList({ let res = await getMatterListSubList({
siteId: this.siteId, siteId: this.siteId,
...@@ -431,7 +425,6 @@ export default { ...@@ -431,7 +425,6 @@ export default {
matterName: `%${this.baseMatterTable.search.matterName}%`, matterName: `%${this.baseMatterTable.search.matterName}%`,
source: this.baseMatterTable.search.source, source: this.baseMatterTable.search.source,
deptCode: this.baseMatterTable.search.deptCode, deptCode: this.baseMatterTable.search.deptCode,
...search,
}); });
if (res.data.code === 1) { if (res.data.code === 1) {
let { pageInfo, data, dict } = res.data.data; let { pageInfo, data, dict } = res.data.data;
......
...@@ -5,14 +5,16 @@ ...@@ -5,14 +5,16 @@
<div class="titel">站点业务列表</div> <div class="titel">站点业务列表</div>
<div class="header-bottom pdr6"> <div class="header-bottom pdr6">
<div class="left-btn"> <div class="left-btn">
<a-button type="danger" @click="handleDelAll"> 批量解除 </a-button> <a-button type="danger" @click="batchDelSiteBusiness">
批量解除
</a-button>
</div> </div>
<div class="search-box"> <div class="search-box">
<a-input-search <a-input-search
placeholder="请输入业务名称搜索" placeholder="请输入业务名称搜索"
v-model="leftSearchVal" v-model="siteBusinessTable.search.siteBusinessName"
enter-button="搜索" enter-button="搜索"
@search="onSearchLeft" @search="onSiteBusinessSearch"
allowClear allowClear
/> />
</div> </div>
...@@ -20,43 +22,35 @@ ...@@ -20,43 +22,35 @@
</div> </div>
<div class="table-content"> <div class="table-content">
<!-- 表格 --> <!-- 表格 -->
<a-table <y-table
bordered :columns="siteBusinessTable.columns"
:data="siteBusinessTable.data"
:pageSize.sync="siteBusinessTable.size"
:current.sync="siteBusinessTable.current"
:total="siteBusinessTable.total"
:loading="siteBusinessTable.loading"
size="middle" size="middle"
:loading="Leftloading"
:pagination="{
showTotal: (total) => `共 ${total} 条`,
current: leftCurrent,
total: leftTotal,
pageSize: leftSize,
showSizeChanger: true,
showQuickJumper: true,
pageSizeOptions: pageSizeOptions,
onChange: changeLeft,
onShowSizeChange: showSizeChange,
}"
:scroll="{ y: 550 }" :scroll="{ y: 550 }"
:columns="leftColumns" :row-selection="{
:data-source="businessMatterData" onChange: onSelectChange,
:row-selection="{ onChange: onSelectChange }" }"
:rowKey="(record) => record.id" @changePagination="getBusinessMatterData"
> >
<template slot="num" slot-scope="text, record, index"> <template slot="action" slot-scope="{ record }">
<span>
{{ (leftCurrent - 1) * leftSize + index + 1 }}
</span>
</template>
<template slot="action" slot-scope="text">
<a-space> <a-space>
<span class="primary pointer" @click="handleisUnbound(true, text)" <span
class="primary pointer"
@click="handleisUnbound(true, record)"
>关联详情</span >关联详情</span
> >
<span class="delete pointer" @click="handleisUnbound(false, text)" <span
class="delete pointer"
@click="handleisUnbound(false, record)"
>解除</span >解除</span
> >
</a-space> </a-space>
</template> </template>
</a-table> </y-table>
</div> </div>
</div> </div>
<!-- 右 --> <!-- 右 -->
...@@ -72,7 +66,7 @@ ...@@ -72,7 +66,7 @@
<a-select <a-select
showSearch showSearch
style="min-width: 120px" style="min-width: 120px"
v-model="deptSearch" v-model="siteMatterTable.search.deptCode"
class="select-department" class="select-department"
placeholder="全部部门" placeholder="全部部门"
optionFilterProp="label" optionFilterProp="label"
...@@ -88,10 +82,10 @@ ...@@ -88,10 +82,10 @@
</a-select-option> </a-select-option>
</a-select> </a-select>
<a-input-search <a-input-search
v-model="rightSearchVal" v-model="siteMatterTable.search.matterName"
placeholder="请输入事项名称搜索" placeholder="请输入事项名称搜索"
enter-button="搜索" enter-button="搜索"
@search="onSearchRight" @search="onSearchSiteMatter"
allowClear allowClear
/> />
</a-space> </a-space>
...@@ -100,60 +94,35 @@ ...@@ -100,60 +94,35 @@
</div> </div>
<div class="table-content"> <div class="table-content">
<!-- 表格 --> <!-- 表格 -->
<a-table <y-table
bordered :columns="siteMatterTable.columns"
:pagination="{ :data="siteMatterTable.data"
showTotal: (total) => `共 ${total} 条`, :pageSize.sync="siteMatterTable.size"
current: rightCurrent, :current.sync="siteMatterTable.current"
total: rightTotal, :total="siteMatterTable.total"
pageSize: rightSize, :loading="siteMatterTable.loading"
showSizeChanger: true,
showQuickJumper: true,
pageSizeOptions: pageSizeOptions,
onChange: changeRight,
onShowSizeChange: showSizeChangeRight,
}"
:scroll="{ y: 550 }"
:loading="rightloading"
size="middle" size="middle"
:scroll="{ y: 550 }"
:row-selection="{ :row-selection="{
selectedRowKeys: selectedRowKeys, selectedRowKeys: selectedRowKeys,
onChange: onRightSelectChange, onChange: onRightSelectChange,
}" }"
:columns="rightColumns" @changePagination="getMatterSiteData"
:data-source="SiteMatterData"
:rowKey="(record) => record.id"
> >
<template slot="num" slot-scope="text, record, index">
<span>
{{ (rightCurrent - 1) * rightSize + index + 1 }}
</span>
</template>
<!-- 部门 -->
<template slot="deptName" slot-scope="text">
{{ text.deptName ? text.deptName : "--" }}
</template>
<!-- 事项名称 --> <!-- 事项名称 -->
<template slot="matterName" slot-scope="text"> <template slot="matterName" slot-scope="{ record }">
<a-tooltip placement="topLeft"> <a-tooltip placement="topLeft">
<template slot="title"> <template slot="title">
{{ text.matterName }} {{ record.matterName }}
</template> </template>
<div class="matter-name">{{ text.matterName }}</div> <div class="matter-name">{{ record.matterName }}</div>
</a-tooltip> </a-tooltip>
<!-- <a-tag v-if="text.source === 0" color="green"> 一体化添加 </a-tag>
<a-tag v-else color="blue"> 手动添加 </a-tag> -->
</template> </template>
<!-- 操作 --> <!-- 操作 -->
<template slot="action" slot-scope="text"> <template slot="action" slot-scope="record">
<span <span class="primary pointer" @click="handleIn(record)">关联</span>
href="javascript:;"
class="primary pointer"
@click="handleIn(text)"
>关联</span
>
</template> </template>
</a-table> </y-table>
</div> </div>
</div> </div>
<!-- 关联 --> <!-- 关联 -->
...@@ -280,7 +249,6 @@ ...@@ -280,7 +249,6 @@
<script> <script>
import { getSiteMatterList } from "@/services/matter"; import { getSiteMatterList } from "@/services/matter";
import { pageSizeOptions } from "@/config/pageConfig.js";
import { getDeptList } from "@/services/dept"; import { getDeptList } from "@/services/dept";
import { import {
siteBusinessList, siteBusinessList,
...@@ -292,13 +260,36 @@ import { ...@@ -292,13 +260,36 @@ import {
// getMatterlistData, // getMatterlistData,
} from "@/services/business"; } from "@/services/business";
import local from "@/utils/local"; import local from "@/utils/local";
const leftColumns = [ import YTable from "@/components/YTable.vue";
export default {
components: { YTable },
data() {
return {
SiteBusinessData: [], // 站点业务
SiteMatterData: [], //站点事项
// 站点业务表格
siteBusinessTable: {
loading: false,
data: [],
total: 0,
size: 10,
current: 1,
search: {
siteBusinessName: "", // 站点业务名称
},
columns: [
{ {
title: "序号", title: "序号",
dataIndex: "id",
key: "id",
width: "50px", width: "50px",
scopedSlots: { customRender: "num" }, customRender: (text, record, index) => {
return (
(this.siteBusinessTable.current - 1) *
this.siteBusinessTable.size +
index +
1
);
},
}, },
{ {
title: "业务名称", title: "业务名称",
...@@ -313,28 +304,42 @@ const leftColumns = [ ...@@ -313,28 +304,42 @@ const leftColumns = [
customRender: "action", customRender: "action",
}, },
}, },
]; ],
const rightColumns = [ },
// 站点事项表格
siteMatterTable: {
loading: false,
data: [],
total: 0,
size: 10,
current: 1,
search: {
deptCode: undefined, // 部门编码
matterName: "", // 事项名称
},
columns: [
{ {
title: "序号", title: "序号",
dataIndex: "id",
width: "50px", width: "50px",
scopedSlots: { customRender: "num" }, customRender: (text, record, index) => {
return (
(this.siteMatterTable.current - 1) * this.siteMatterTable.size +
index +
1
);
},
}, },
{ {
title: "部门", title: "部门",
width: "20%", width: "20%",
scopedSlots: { ellipsis: true,
customRender: "deptName", dataIndex: "deptName",
},
}, },
{ {
title: "事项名称", title: "事项名称",
// ellipsis: true, ellipsis: true,
align: "left", align: "left",
scopedSlots: { dataIndex: "matterName",
customRender: "matterName",
},
}, },
{ {
title: "操作", title: "操作",
...@@ -343,37 +348,16 @@ const rightColumns = [ ...@@ -343,37 +348,16 @@ const rightColumns = [
customRender: "action", customRender: "action",
}, },
}, },
]; ],
},
export default {
data() {
return {
leftColumns,
rightColumns,
Leftloading: false,
rightloading: false,
leftSearchVal: "", // 左边搜索
deptSearch: undefined, // 右边
rightSearchVal: "", // 右边搜索
SiteBusinessData: [], // 站点业务
SiteMatterData: [], //站点事项
selectedRowKeys: [], selectedRowKeys: [],
isCorrelation: false, isCorrelation: false,
isUnbound: false, isUnbound: false,
visible: false, visible: false,
isUnboundAll: false, //批量解除框 isUnboundAll: false, //批量解除框
iscConfirmLoading: false, // 关联loading iscConfirmLoading: false, // 关联loading
leftCurrent: 1,
rightCurrent: 1,
leftTotal: 0,
rightTotal: 0,
leftSize: 10,
rightSize: 10,
pageSizeOptions,
siteId: local.getLocal("siteId"), // 站点id siteId: local.getLocal("siteId"), // 站点id
matterIds: "", // 业务id
deptList: [], // 站点部门 deptList: [], // 站点部门
rightSearch: "", // 事项搜索
businessMatterData: [], // 业务关联事项列表数据 businessMatterData: [], // 业务关联事项列表数据
unboundBusinessData: {}, // 解除-业务数据 unboundBusinessData: {}, // 解除-业务数据
unboundMatterData: [], // 解除-事项数据 unboundMatterData: [], // 解除-事项数据
...@@ -404,38 +388,36 @@ export default { ...@@ -404,38 +388,36 @@ export default {
methods: { methods: {
// 获取部门列表 // 获取部门列表
async getDeptListData(obj = {}) { async getDeptListData() {
this.deptLoading = true;
let res = await getDeptList({ let res = await getDeptList({
siteId: this.siteId, siteId: this.siteId,
page: 1, page: 1,
size: -1, size: -1,
...obj,
}); });
this.deptLoading = false;
let { code, data } = res.data; let { code, data } = res.data;
if (code === 1) { if (code === 1) {
this.deptList = data.data; this.deptList = data.data;
} }
}, },
// 获取站点业务关联列表 // 获取站点业务关联列表
async getBusinessMatterData(search = {}) { async getBusinessMatterData() {
this.Leftloading = true; this.siteBusinessTable.loading = true;
let res = await getBusinesslistData({ let res = await getBusinesslistData({
page: this.leftCurrent, page: this.siteBusinessTable.current,
size: this.leftSize, size: this.siteBusinessTable.size,
siteId: Number(this.siteId), siteId: Number(this.siteId),
siteBusinessName: `%${this.leftSearchVal}%`, siteBusinessName: `%${this.siteBusinessTable.search.siteBusinessName}%`,
...search,
}); });
if (res.data.code == 1) {
let { total, data } = res.data.data; let { total, data } = res.data.data;
if (!data.length && this.leftCurrent > 1) { if (!data.length && this.siteBusinessTable.current > 1) {
this.leftCurrent -= 1; this.siteBusinessTable.current -= 1;
this.getBusinessMatterData(); this.getBusinessMatterData();
} }
this.leftTotal = total; this.siteBusinessTable.total = total;
this.businessMatterData = data; this.siteBusinessTable.data = data;
this.Leftloading = false; }
this.siteBusinessTable.loading = false;
}, },
// 获取站点业务关联-事项列表 // 获取站点业务关联-事项列表
...@@ -444,12 +426,11 @@ export default { ...@@ -444,12 +426,11 @@ export default {
this.unboundMatterData = res.data.data.data; this.unboundMatterData = res.data.data.data;
}, },
// 获取站点业务列表 // 获取站点业务列表
async getSiteBusinessData(search = {}) { async getSiteBusinessData() {
let res = await siteBusinessList({ let res = await siteBusinessList({
siteId: this.siteId, siteId: this.siteId,
page: 1, page: 1,
size: -1, size: -1,
...search,
}); });
let { data } = res.data.data; let { data } = res.data.data;
this.SiteBusinessData = data this.SiteBusinessData = data
...@@ -473,33 +454,34 @@ export default { ...@@ -473,33 +454,34 @@ export default {
}, },
// 获取站点事项 // 获取站点事项
async getMatterSiteData(search = {}) { async getMatterSiteData() {
this.rightloading = true; this.siteMatterTable.loading = true;
let res = await getSiteMatterList({ let res = await getSiteMatterList({
page: this.rightCurrent, page: this.siteMatterTable.current,
size: this.rightSize, size: this.siteMatterTable.size,
matterName: `%${this.rightSearchVal}%`, matterName: `%${this.siteMatterTable.search.matterName}%`,
siteId: this.siteId, siteId: this.siteId,
deptCode: this.deptSearch, deptCode: this.siteMatterTable.search.deptCode,
...search,
}); });
if (res.data.code == 1) {
let { pageInfo, data } = res.data.data; let { pageInfo, data } = res.data.data;
if (!data.length && this.rightCurrent > 1) { if (!data.length && this.siteMatterTable.current > 1) {
this.rightCurrent -= 1; this.siteMatterTable.current -= 1;
this.getMatterSiteData(); this.getMatterSiteData();
} }
this.rightTotal = pageInfo.totalResult; this.siteMatterTable.total = pageInfo.totalResult;
this.SiteMatterData = data; this.siteMatterTable.data = data;
this.rightloading = false; }
this.siteMatterTable.loading = false;
}, },
// 左边搜索 // 站点关联业务列表搜索
async onSearchLeft() { async onSiteBusinessSearch() {
this.leftCurrent = 1; this.siteBusinessTable.current = 1;
this.getBusinessMatterData(); this.getBusinessMatterData();
}, },
// 左边解除按钮 // 站点业务解除关联
handleisUnbound(isCheck, data) { handleisUnbound(isCheck, data) {
this.checkFlag = isCheck; this.checkFlag = isCheck;
this.unboundBusinessData = data; this.unboundBusinessData = data;
...@@ -585,7 +567,7 @@ export default { ...@@ -585,7 +567,7 @@ export default {
}, },
// 批量解除按钮 // 批量解除按钮
handleDelAll() { batchDelSiteBusiness() {
if (this.businessMatterAll.length > 0) { if (this.businessMatterAll.length > 0) {
this.isUnboundAll = true; this.isUnboundAll = true;
} else { } else {
...@@ -633,31 +615,9 @@ export default { ...@@ -633,31 +615,9 @@ export default {
return; return;
} }
}, },
// 左翻页 // 站点事项搜索
changeLeft(num) { onSearchSiteMatter() {
this.leftCurrent = num; this.siteMatterTable.current = 1;
this.getBusinessMatterData();
},
// 左边改变每页显示数量
showSizeChange(current, size) {
this.leftCurrent = current;
this.leftSize = size;
this.getBusinessMatterData();
},
// 右翻页
changeRight(num) {
this.rightCurrent = num;
this.getMatterSiteData();
},
// 右边改变显示数量
showSizeChangeRight(current, size) {
this.rightCurrent = current;
this.rightSize = size;
this.getMatterSiteData();
},
// 右搜索
onSearchRight() {
this.rightCurrent = 1;
this.getMatterSiteData(); this.getMatterSiteData();
}, },
// 关联 // 关联
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment