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

perf: 优化业务管理

parent 65bb590a
<template>
<a-table
:columns="columns"
:data-source="data"
:bordered="bordered"
:defaultExpandAllRows="DefaultExpandAllRows"
:expandRowByClick="ExpandRowByClick"
:showHeader="ShowHeader"
:pagination="Pagination"
:rowKey="rowKey"
@change="handleTableChange"
v-bind="$attrs"
v-on="$listeners"
>
<template
slot-scope="text, record, index"
:slot="slot"
v-for="slot in Object.keys($scopedSlots).filter(
(key) => key !== 'expandedRowRender'
)"
>
<slot :name="slot" v-bind="{ text, record, index }"></slot>
</template>
<template :slot="slot" v-for="slot in Object.keys($slots)">
<slot :name="slot"></slot>
</template>
<template
slot-scope="record, index, indent, expanded"
:slot="$scopedSlots.expandedRowRender ? 'expandedRowRender' : ''"
>
<slot
v-bind="{ record, index, indent, expanded }"
:name="$scopedSlots.expandedRowRender ? 'expandedRowRender' : ''"
></slot>
</template>
</a-table>
</template>
<script>
export default {
props: {
columns: {
required: true,
type: Array,
default: () => [],
},
data: {
required: true,
type: Array,
default: () => [],
},
pageSize: {
required: true,
type: Number,
default: 10,
},
current: {
required: true,
type: Number,
default: 1,
},
total: {
required: true,
type: Number,
default: 0,
},
bordered: {
type: Boolean,
default: true,
},
defaultExpandAllRows: {
type: Boolean,
default: false,
},
expandRowByClick: {
type: Boolean,
default: false,
},
showHeader: {
type: Boolean,
default: true,
},
rowKey: {
type: [String, Function],
default: "id",
},
pagination: {
type: Object,
default: () => {},
},
pageSizeOptions: {
type: Array,
default: () => ["10", "30", "50", "100", "200"],
},
},
data() {
return {};
},
computed: {
Bordered() {
return !!this.bordered;
},
DefaultExpandAllRows() {
return !!this.defaultExpandAllRows;
},
ExpandRowByClick() {
return !!this.expandRowByClick;
},
ShowHeader() {
return !!this.showHeader;
},
PageSize: {
get() {
return this.pageSize;
},
set(value) {
this.$emit("update:pageSize", value);
},
},
Current: {
get() {
return this.current;
},
set(value) {
this.$emit("update:current", value);
},
},
Pagination() {
return {
showTotal: (total) => `共 ${total} 条`,
total: this.total,
current: this.Current,
pageSize: this.pageSize,
showSizeChanger: true,
showQuickJumper: true,
pageSizeOptions: this.pageSizeOptions,
...this.pagination,
};
},
},
methods: {
handleTableChange(pagination, filters, sorter, { currentDataSource }) {
let { current, pageSize } = pagination;
this.Current = current;
this.PageSize = pageSize;
if (this.$listeners.changePagination) {
this.$listeners.changePagination();
}
this.$emit("change", pagination, filters, sorter, { currentDataSource });
},
},
};
</script>
<style lang="less" scoped></style>
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<div> <div>
<a-space size="middle"> <a-space size="middle">
<a-button type="primary" @click="showModal"> 新增业务 </a-button> <a-button type="primary" @click="showModal"> 新增业务 </a-button>
<a-button type="danger" @click="handleDelAll"> <a-button type="danger" @click="handleBatchDelSiteBusiness">
批量移除 批量移除
</a-button> </a-button>
</a-space> </a-space>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
placeholder="请输入业务名称搜索" placeholder="请输入业务名称搜索"
enter-button="搜索" enter-button="搜索"
v-model="serchSiteBusiness" v-model="serchSiteBusiness"
@search="onSearchLeft" @search="onSiteBusinessSearch"
allowClear allowClear
/> />
</div> </div>
...@@ -25,61 +25,38 @@ ...@@ -25,61 +25,38 @@
</div> </div>
<div class="table-content"> <div class="table-content">
<!-- 表格 --> <!-- 表格 -->
<a-table <y-table
bordered :columns="siteBusinessTable.columns"
:loading="leftLoading" :expandIconColumnIndex="2"
:data="siteBusinessTable.data"
:pageSize.sync="siteBusinessTable.size"
:current.sync="siteBusinessTable.current"
:total="siteBusinessTable.total"
:loading="siteBusinessTable.loading"
size="middle" size="middle"
:scroll="{ y: 550 }" :scroll="{ y: 550 }"
:pagination="{
showTotal: (total) => `共 ${total} 条`,
current: leftCurrent,
total: leftTotal,
pageSize: leftSize,
showSizeChanger: true,
showQuickJumper: true,
pageSizeOptions: pageSizeOptions,
onChange: changeLeft,
onShowSizeChange: showSizeChange,
}"
:columns="leftColumns"
:expandIconColumnIndex="2"
:data-source="businessData"
:row-selection="{ :row-selection="{
selectedRowKeys: selectedLeftRowKeys, selectedRowKeys: selectedLeftRowKeys,
onChange: onSelectChange, onChange: onSelectSiteBusiness,
onSelect: onSelectLeftRow, onSelect: onSelectLeftRow,
}" }"
:rowKey="(record) => record.id" @changePagination="getSiteBusinessData"
>
<template
slot="num"
v-if="record.parentId === 0"
slot-scope="text, record, index"
> >
<span> <template slot="action" slot-scope="{ record }">
{{ (leftCurrent - 1) * leftSize + index + 1 }}
</span>
</template>
<template slot="businessName" slot-scope="text">
{{ text.businessName }}
</template>
<template slot="action" slot-scope="text">
<a-space size="middle"> <a-space size="middle">
<span <span
href="javascript:;"
class="primary pointer" class="primary pointer"
@click="handleEdit(text)" @click="handleEditSiteBusiness(record)"
>编辑</span >编辑</span
> >
<span <span
href="javascript:;"
class="delete pointer" class="delete pointer"
@click="handleDel(text.id, text)" @click="handleDelSiteBusiness(record.id, record)"
>删除</span >删除</span
> >
</a-space> </a-space>
</template> </template>
</a-table> </y-table>
</div> </div>
</div> </div>
<!-- 右 --> <!-- 右 -->
...@@ -88,7 +65,9 @@ ...@@ -88,7 +65,9 @@
<div class="titel">一体化业务列表</div> <div class="titel">一体化业务列表</div>
<div class="control pdr6"> <div class="control pdr6">
<div> <div>
<a-button type="primary" @click="handleAddAll"> 批量加入 </a-button> <a-button type="primary" @click="handleBatchJoin">
批量加入
</a-button>
</div> </div>
<div class="business-control"> <div class="business-control">
<a-input-search <a-input-search
...@@ -103,57 +82,36 @@ ...@@ -103,57 +82,36 @@
</div> </div>
<div class="table-content"> <div class="table-content">
<!-- 表格 --> <!-- 表格 -->
<a-table <y-table
bordered :columns="businessTable.columns"
:scroll="{ y: 550 }"
:loading="rightLoading"
:pagination="{
showTotal: (total) => `共 ${total} 条`,
current: rightCurrent,
total: rightTotal,
pageSize: rightSize,
showSizeChanger: true,
showQuickJumper: true,
pageSizeOptions: pageSizeOptions,
onChange: changeRight,
onShowSizeChange: showSizeChangeRight,
}"
size="middle"
:expandIconColumnIndex="2" :expandIconColumnIndex="2"
:data="businessTable.data"
:pageSize.sync="businessTable.size"
:current.sync="businessTable.current"
:total="businessTable.total"
:loading="businessTable.loading"
size="middle"
:scroll="{ y: 550 }"
:row-selection="{ :row-selection="{
selectedRowKeys: selectedRowKeys, selectedRowKeys: selectedRowKeys,
onChange: onRightSelectChange, onChange: onRightSelectChange,
onSelect: onSelectLeftRow,
}" }"
:columns="rightColumns" @changePagination="getBusinessListData"
:data-source="businessDataList"
:rowKey="(record) => record.id"
>
<template
v-if="record.parentId === 0"
slot="num"
slot-scope="text, record, index"
> >
<span> <template slot="action" slot-scope="{ record }">
{{ (rightCurrent - 1) * rightSize + index + 1 }}
</span>
</template>
<template slot="name" slot-scope="text">
{{ text.name }}
</template>
<template slot="action" slot-scope="text">
<a-space size="middle"> <a-space size="middle">
<span class="primary pointer" @click="handleIn(text.id)" <span class="primary pointer" @click="handleIn(record.id)"
>加入</span >加入</span
> >
<span <span
href="javascript:;"
class="delete pointer" class="delete pointer"
@click="handleDelRight(+text.id)" @click="handleDelBusiness(+record.id)"
>删除</span >删除</span
> >
</a-space> </a-space>
</template> </template>
</a-table> </y-table>
</div> </div>
</div> </div>
<!-- 新增对话框 --> <!-- 新增对话框 -->
...@@ -161,7 +119,7 @@ ...@@ -161,7 +119,7 @@
ref="addprofession" ref="addprofession"
:visible.sync="visible" :visible.sync="visible"
:title="title" :title="title"
@newBusiness="AddSuccess" @success="AddSuccess"
></addprofession> ></addprofession>
</div> </div>
</template> </template>
...@@ -169,29 +127,47 @@ ...@@ -169,29 +127,47 @@
<script> <script>
import addprofession from "../group/addprofession.vue"; import addprofession from "../group/addprofession.vue";
import local from "@/utils/local"; import local from "@/utils/local";
import { pageSizeOptions } from "@/config/pageConfig.js"; import YTable from "@/components/YTable.vue";
import { import {
getBusinessList, businessList,
delSiteBusiness, delSiteBusiness,
addInBusiness, addInBusiness,
getSiteBusinessList, siteBusinessList,
businessDel, businessDel,
getBusinessInfo, businessInfo,
getBusinessMatterList, businessMatterList,
delBusinessMatter, delBusinessMatter,
} from "@/services/business"; } from "@/services/business";
const leftColumns = [
export default {
components: {
addprofession,
YTable,
},
data() {
return {
title: "新增业务",
// 站点业务表格
siteBusinessTable: {
columns: [
{ {
title: "序号", title: "序号",
width: "50px", width: "50px",
scopedSlots: { customRender: "num" }, customRender: (text, record, index) => {
if (record.parentId === 0) {
return (
(this.siteBusinessTable.current - 1) *
this.siteBusinessTable.size +
index +
1
);
}
},
}, },
{ {
title: "业务名称", title: "业务名称",
align: "left", align: "left",
scopedSlots: { dataIndex: "businessName",
customRender: "businessName",
},
}, },
{ {
title: "操作", title: "操作",
...@@ -200,20 +176,33 @@ const leftColumns = [ ...@@ -200,20 +176,33 @@ const leftColumns = [
customRender: "action", customRender: "action",
}, },
}, },
]; ],
const rightColumns = [ total: 0,
current: 1,
size: 10,
data: [],
},
// 一体化业务表格
businessTable: {
columns: [
{ {
title: "序号", title: "序号",
key: "id", key: "id",
width: "50px", width: "50px",
scopedSlots: { customRender: "num" }, customRender: (text, record, index) => {
if (record.parentId === 0) {
return (
(this.businessTable.current - 1) * this.businessTable.size +
index +
1
);
}
},
}, },
{ {
title: "业务名称", title: "业务名称",
align: "left", align: "left",
scopedSlots: { dataIndex: "name",
customRender: "name",
},
}, },
{ {
title: "操作", title: "操作",
...@@ -222,19 +211,12 @@ const rightColumns = [ ...@@ -222,19 +211,12 @@ const rightColumns = [
customRender: "action", customRender: "action",
}, },
}, },
]; ],
total: 0,
export default { current: 1,
components: { size: 10,
addprofession, data: [],
}, },
data() {
return {
title: "新增业务",
leftColumns,
rightColumns,
leftLoading: false,
rightLoading: false,
// businessType: 0, // 业务类型 // businessType: 0, // 业务类型
selectedRowKeys: [], selectedRowKeys: [],
selectedLeftRowKeys: [], selectedLeftRowKeys: [],
...@@ -242,13 +224,6 @@ export default { ...@@ -242,13 +224,6 @@ export default {
businessDataList: [], //业务列表数据 businessDataList: [], //业务列表数据
deleteData: "", // 批量删除数据 deleteData: "", // 批量删除数据
visible: false, visible: false,
leftCurrent: 1,
rightCurrent: 1,
leftTotal: 0,
rightTotal: 0,
leftSize: 10,
rightSize: 10,
pageSizeOptions,
serchData: "", serchData: "",
siteId: local.getLocal("siteId"), // 站点id siteId: local.getLocal("siteId"), // 站点id
businessIds: "", // 业务id businessIds: "", // 业务id
...@@ -278,44 +253,53 @@ export default { ...@@ -278,44 +253,53 @@ export default {
}, },
// 获取站点业务列表 // 获取站点业务列表
async getSiteBusinessData(search = {}) { async getSiteBusinessData(search = {}) {
this.leftLoading = true; this.siteBusinessTable.loading = true;
let res = await getSiteBusinessList({ let res = await siteBusinessList({
page: this.leftCurrent, page: this.siteBusinessTable.current,
size: this.leftSize, size: this.siteBusinessTable.size,
siteId: this.siteId, siteId: this.siteId,
businessName: `%${this.serchSiteBusiness}%`, businessName: `%${this.serchSiteBusiness}%`,
...search, ...search,
}); });
let { code, data } = res.data; let { code, data } = res.data;
if (code === 1) { if (code === 1) {
this.leftTotal = data.pageInfo.totalResult; if (!data.data.length && this.siteBusinessTable.current > 1) {
this.businessData = this.delChildren(data.data); this.siteBusinessTable.current -= 1;
this.leftLoading = false; this.getSiteBusinessData();
}
this.siteBusinessTable.total = data.pageInfo.totalResult;
this.siteBusinessTable.data = this.delChildren(data.data);
} }
this.siteBusinessTable.loading = false;
}, },
// 获取一体化业务列表 // 获取一体化业务列表
async getBusinessListData() { async getBusinessListData() {
this.rightLoading = true; this.businessTable.loading = true;
let res = await getBusinessList({ let res = await businessList({
page: this.rightCurrent, page: this.businessTable.current,
size: this.rightSize, 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) {
this.businessDataList = data.data; if (!data.data.length && this.businessTable.current > 1) {
this.rightTotal = data.pageInfo.totalResult; this.businessTable.current -= 1;
this.businessDataList = this.delChildren(this.businessDataList); this.getBusinessListData();
this.rightLoading = false; }
this.businessTable.total = data.pageInfo.totalResult;
this.businessTable.data = this.delChildren(data.data);
} }
this.businessTable.loading = false;
}, },
onSearchLeft() {
this.leftCurrent = 1; // 站点业务搜索
onSiteBusinessSearch() {
this.siteBusinessTable.current = 1;
this.getSiteBusinessData(); this.getSiteBusinessData();
}, },
// 删除 // 删除站点业务
handleDel(num, data) { handleDelSiteBusiness(id, data) {
let _this = this; let _this = this;
this.$confirm({ this.$confirm({
title: "系统提示", title: "系统提示",
...@@ -327,7 +311,7 @@ export default { ...@@ -327,7 +311,7 @@ export default {
icon: "exclamation-circle", icon: "exclamation-circle",
maskClosable: true, maskClosable: true,
async onOk() { async onOk() {
let res = await delSiteBusiness({ id: num }); let res = await delSiteBusiness({ id });
let { code, msg } = res.data; let { code, msg } = res.data;
if (code === 1) { if (code === 1) {
_this.$message.success(msg); _this.$message.success(msg);
...@@ -342,7 +326,7 @@ export default { ...@@ -342,7 +326,7 @@ export default {
}, },
}); });
}, },
//新增业务 //新增站点业务
showModal() { showModal() {
if (!this.siteId) { if (!this.siteId) {
this.$message.warning("请先选择站点"); this.$message.warning("请先选择站点");
...@@ -352,8 +336,8 @@ export default { ...@@ -352,8 +336,8 @@ export default {
this.$refs.addprofession.onAdd(); this.$refs.addprofession.onAdd();
this.visible = true; this.visible = true;
}, },
// 左边选中 // 站点业务选中
onSelectChange(key, rows) { onSelectSiteBusiness(key, rows) {
this.selectedLeftRowKeys = key; this.selectedLeftRowKeys = key;
const res = new Map(); const res = new Map();
this.deleteData = [...this.deleteData, ...rows] this.deleteData = [...this.deleteData, ...rows]
...@@ -364,7 +348,7 @@ export default { ...@@ -364,7 +348,7 @@ export default {
return this.selectedLeftRowKeys.some((val) => v.id == val); return this.selectedLeftRowKeys.some((val) => v.id == val);
}); });
}, },
// 左边选中父默认勾选子 // 站点业务选中父默认勾选子
onSelectLeftRow(record, selected) { onSelectLeftRow(record, selected) {
if (selected && record.children && record.children.length) { if (selected && record.children && record.children.length) {
record.children.forEach((v) => { record.children.forEach((v) => {
...@@ -382,15 +366,15 @@ export default { ...@@ -382,15 +366,15 @@ export default {
}); });
} }
}, },
// 批量删除 // 批量删除站点业务
handleDelAll() { handleBatchDelSiteBusiness() {
if (this.deleteData.length <= 0) { if (this.deleteData.length <= 0) {
this.$message.warning("请先勾选数据"); this.$message.warning("请先勾选数据");
return; return;
} else { } else {
let arr = [...this.deleteData]; let arr = [...this.deleteData];
arr = arr.map((v) => v.id).join(","); arr = arr.map((v) => v.id).join(",");
this.handleDel(arr, this.deleteData); this.handleDelSiteBusiness(arr, this.deleteData);
} }
}, },
// 获取批量加入id // 获取批量加入id
...@@ -399,7 +383,7 @@ export default { ...@@ -399,7 +383,7 @@ export default {
this.businessIds = data.map((v) => v.id).join(","); this.businessIds = data.map((v) => v.id).join(",");
}, },
// 批量加入 // 批量加入
handleAddAll() { handleBatchJoin() {
if (this.businessIds) { if (this.businessIds) {
this.handleIn(this.businessIds); this.handleIn(this.businessIds);
} else { } else {
...@@ -407,42 +391,21 @@ export default { ...@@ -407,42 +391,21 @@ export default {
return; return;
} }
}, },
// 左翻页
changeLeft(num) { // 编辑站点业务
this.leftCurrent = num; async handleEditSiteBusiness(row) {
this.getSiteBusinessData(); let res = await businessInfo({ id: row.businessId });
},
// 左边改变每页显示数量
showSizeChange(current, size) {
this.leftCurrent = current;
this.leftSize = size;
this.getSiteBusinessData();
},
// 右翻页
changeRight(num) {
this.rightCurrent = num;
this.getBusinessListData();
},
// 右边改变显示数量
showSizeChangeRight(current, size) {
this.rightCurrent = current;
this.rightSize = size;
this.getBusinessListData();
},
// 编辑
async handleEdit(row) {
let res = await getBusinessInfo({ id: row.businessId });
let { data } = res.data; let { data } = res.data;
this.visible = true; this.visible = true;
this.title = "编辑业务"; this.title = "编辑业务";
this.$refs.addprofession.onEdit(data, row.siteId); this.$refs.addprofession.onEdit(data, row.siteId);
}, },
// 搜索 // 搜索一体化业务
async onSearch() { async onSearch() {
this.rightCurrent = 1; this.businessTable.current = 1;
this.getBusinessListData(); this.getBusinessListData();
}, },
// 加入 // 一体化业务加入站点
async handleIn(businessId) { async handleIn(businessId) {
if (!this.siteId) { if (!this.siteId) {
this.$message.warning("请先选择站点"); this.$message.warning("请先选择站点");
...@@ -460,8 +423,8 @@ export default { ...@@ -460,8 +423,8 @@ export default {
this.businessIds = ""; this.businessIds = "";
} }
}, },
// 删除-右 // 删除一体化业务
handleDelRight(val) { handleDelBusiness(val) {
let _this = this; let _this = this;
this.$confirm({ this.$confirm({
title: "系统提示", title: "系统提示",
...@@ -485,7 +448,7 @@ export default { ...@@ -485,7 +448,7 @@ export default {
}, },
}); });
}, },
// 删除业务事项关联 // 删除业务事项关联函数
async businessLinkage(matterId) { async businessLinkage(matterId) {
let result = await delBusinessMatter({ let result = await delBusinessMatter({
id: matterId, id: matterId,
...@@ -495,39 +458,39 @@ export default { ...@@ -495,39 +458,39 @@ export default {
console.log("删除成功"); console.log("删除成功");
} }
}, },
// 删除业务联动删除业务事项关联 // 删除站点业务联动删除业务事项关联
async delBusinessMatterLinkage(row) { async delBusinessMatterLinkage(row) {
let str = []; let ids;
if (Array.isArray(row)) { if (Array.isArray(row)) {
let arr = row.map((v) => v.businessId); let arr = row.map((v) => v.businessId);
let num = 0; let count = 0;
let delData = async () => { let delData = async () => {
if (num > arr.length - 1) { if (count > arr.length - 1) {
str = str.map((v) => v.id).join(","); ids = ids.map((v) => v.id).join(",");
this.businessLinkage(str); this.businessLinkage(ids);
return; return;
} }
let res = await getBusinessMatterList({ let res = await businessMatterList({
siteBusinessId: arr[num], siteBusinessId: arr[count],
siteId: this.siteId, siteId: this.siteId,
}); });
let { code, data } = res.data; let { code, data } = res.data;
if (code === 1) { if (code === 1) {
num++; count++;
str = [...str, ...data.data]; ids = [...ids, ...data.data];
} }
delData(); delData();
}; };
delData(); delData();
} else { } else {
let res = await getBusinessMatterList({ let res = await businessMatterList({
siteBusinessId: row.businessId, siteBusinessId: row.businessId,
siteId: this.siteId, siteId: this.siteId,
}); });
let { code, data } = res.data; let { code, data } = res.data;
if (code === 1 && data.data.length) { if (code === 1 && data.data.length) {
str = data.data.map((v) => v.id).join(","); ids = data.data.map((v) => v.id).join(",");
this.businessLinkage(str); this.businessLinkage(ids);
} }
} }
}, },
......
...@@ -270,7 +270,7 @@ import { ...@@ -270,7 +270,7 @@ import {
delSiteMatter, delSiteMatter,
delMatter, delMatter,
} from "@/services/matter"; } from "@/services/matter";
import { getBusinessMatterList, delBusinessMatter } from "@/services/business"; import { businessMatterList, delBusinessMatter } from "@/services/business";
import { getDeptList } from "@/services/dept"; import { getDeptList } from "@/services/dept";
import EditSiteMatter from "../group/EditSiteMatter.vue"; import EditSiteMatter from "../group/EditSiteMatter.vue";
import { pageSizeOptions } from "@/config/pageConfig.js"; import { pageSizeOptions } from "@/config/pageConfig.js";
...@@ -607,7 +607,7 @@ export default { ...@@ -607,7 +607,7 @@ export default {
this.businessLinkage(str); this.businessLinkage(str);
return; return;
} }
let res = await getBusinessMatterList({ let res = await businessMatterList({
matterId: arr[num], matterId: arr[num],
siteId: this.siteId, siteId: this.siteId,
}); });
...@@ -620,7 +620,7 @@ export default { ...@@ -620,7 +620,7 @@ export default {
}; };
delData(); delData();
} else { } else {
let res = await getBusinessMatterList({ let res = await businessMatterList({
matterId: row.matterId, matterId: row.matterId,
siteId: this.siteId, siteId: this.siteId,
}); });
......
...@@ -283,9 +283,9 @@ import { getSiteMatterList } from "@/services/matter"; ...@@ -283,9 +283,9 @@ import { getSiteMatterList } from "@/services/matter";
import { pageSizeOptions } from "@/config/pageConfig.js"; import { pageSizeOptions } from "@/config/pageConfig.js";
import { getDeptList } from "@/services/dept"; import { getDeptList } from "@/services/dept";
import { import {
getSiteBusinessList, siteBusinessList,
// addBusinessMatter, // addBusinessMatter,
getBusinessMatterList, businessMatterList,
delBusinessMatter, delBusinessMatter,
getBusinesslistData, getBusinesslistData,
addBatchSave, addBatchSave,
...@@ -440,12 +440,12 @@ export default { ...@@ -440,12 +440,12 @@ export default {
// 获取站点业务关联-事项列表 // 获取站点业务关联-事项列表
async getMatterlistData(search = {}) { async getMatterlistData(search = {}) {
let res = await getBusinessMatterList(search); let res = await businessMatterList(search);
this.unboundMatterData = res.data.data.data; this.unboundMatterData = res.data.data.data;
}, },
// 获取站点业务列表 // 获取站点业务列表
async getSiteBusinessData(search = {}) { async getSiteBusinessData(search = {}) {
let res = await getSiteBusinessList({ let res = await siteBusinessList({
siteId: this.siteId, siteId: this.siteId,
page: 1, page: 1,
size: -1, size: -1,
...@@ -564,7 +564,7 @@ export default { ...@@ -564,7 +564,7 @@ export default {
if (num > arr.length - 1) { if (num > arr.length - 1) {
return; return;
} }
let res = await getBusinessMatterList({ let res = await businessMatterList({
siteId: this.siteId, siteId: this.siteId,
siteBusinessId: arr[num], siteBusinessId: arr[num],
}); });
......
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
<a-modal <a-modal
:title="title" :title="title"
:visible="visibleAll" :visible="visibleAll"
:confirm-loading="confirmLoading"
@cancel="handleCancel" @cancel="handleCancel"
:maskClosable="false" :maskClosable="false"
> >
<a-button slot="footer" @click="handleReset">重置</a-button> <a-button slot="footer" @click="handleReset">重置</a-button>
<a-button slot="footer" type="primary" @click="handleOk">确定</a-button> <a-button slot="footer" type="primary" @click="handleOk" :loading="loading"
>确定</a-button
>
<a-form-model <a-form-model
:model="form" :model="form"
ref="formData" ref="formData"
...@@ -83,9 +84,9 @@ import local from "@/utils/local"; ...@@ -83,9 +84,9 @@ import local from "@/utils/local";
import YSwitch from "@/components/yswitch/YSwitch.vue"; import YSwitch from "@/components/yswitch/YSwitch.vue";
import { import {
saveBusiness, saveBusiness,
// getBusinessList, // businessList,
addInBusiness, addInBusiness,
getSiteBusinessList, siteBusinessList,
} from "@/services/business"; } from "@/services/business";
export default { export default {
components: { components: {
...@@ -94,6 +95,7 @@ export default { ...@@ -94,6 +95,7 @@ export default {
data() { data() {
return { return {
siteId: local.getLocal("siteId"), siteId: local.getLocal("siteId"),
loading: false,
form: { form: {
isBusiness: "", isBusiness: "",
parentId: undefined, parentId: undefined,
...@@ -107,7 +109,6 @@ export default { ...@@ -107,7 +109,6 @@ export default {
businessType: 1, businessType: 1,
}, },
parentBusiness: [], //下拉框数据 parentBusiness: [], //下拉框数据
confirmLoading: false,
rules: { rules: {
isBusiness: [ isBusiness: [
{ required: true, message: "请选择业务等级", trigger: "change" }, { required: true, message: "请选择业务等级", trigger: "change" },
...@@ -129,11 +130,21 @@ export default { ...@@ -129,11 +130,21 @@ export default {
type: String, type: String,
}, },
}, },
computed: {
visibleAll: {
get() {
return this.visible;
},
set(val) {
this.$emit("update:visible", val);
},
},
},
created() {}, created() {},
methods: { methods: {
// 获取业务列表 // 获取业务列表
async getBusinessData() { async getBusinessData() {
let res = await getSiteBusinessList({ let res = await siteBusinessList({
page: 1, page: 1,
size: -1, size: -1,
siteId: this.siteId, siteId: this.siteId,
...@@ -146,12 +157,12 @@ export default { ...@@ -146,12 +157,12 @@ export default {
}, },
// 关闭窗口 // 关闭窗口
handleCancel() { handleCancel() {
this.visibleAll = false;
this.$refs.formData.resetFields(); this.$refs.formData.resetFields();
this.visibleAll = false;
}, },
// 新增 // 新增
onAdd() { async onAdd() {
this.getBusinessData(); await this.getBusinessData();
Object.assign(this.form, this.$options.data().form); Object.assign(this.form, this.$options.data().form);
this.form.id && this.$delete(this.form, "id"); this.form.id && this.$delete(this.form, "id");
}, },
...@@ -181,9 +192,8 @@ export default { ...@@ -181,9 +192,8 @@ export default {
// 确定 // 确定
handleOk() { handleOk() {
this.$refs.formData.validate(async (valid) => { this.$refs.formData.validate(async (valid) => {
console.log(this.form.parentId);
if (valid) { if (valid) {
this.confirmLoading = true; this.loading = true;
let res = await saveBusiness({ let res = await saveBusiness({
...this.form, ...this.form,
parentId: this.form.parentId == undefined ? 0 : this.form.parentId, parentId: this.form.parentId == undefined ? 0 : this.form.parentId,
...@@ -197,20 +207,18 @@ export default { ...@@ -197,20 +207,18 @@ export default {
siteId: this.siteId, siteId: this.siteId,
}); });
if (result.data.code === 1) { if (result.data.code === 1) {
this.visibleAll = false;
this.$message.success(msg); this.$message.success(msg);
this.getBusinessData(); this.getBusinessData();
this.$refs.formData.resetFields(); this.$emit("success");
this.$emit("newBusiness"); this.handleCancel();
} }
} else { } else {
this.visibleAll = false;
this.$message.success(msg); this.$message.success(msg);
this.getBusinessData(); this.getBusinessData();
this.$refs.formData.resetFields(); this.$emit("success");
this.$emit("newBusiness"); this.handleCancel();
} }
this.confirmLoading = false; this.loading = false;
} }
} }
}); });
...@@ -223,16 +231,6 @@ export default { ...@@ -223,16 +231,6 @@ export default {
); );
}, },
}, },
computed: {
visibleAll: {
get() {
return this.visible;
},
set(val) {
this.$emit("update:visible", val);
},
},
},
}; };
</script> </script>
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
onChange: changePage, onChange: changePage,
}" }"
:columns="columns" :columns="columns"
:data-source="siteBusinessList" :data-source="siteBusinessData"
:rowKey="(record) => record.businessId" :rowKey="(record) => record.businessId"
:row-selection="{ :row-selection="{
selectedRowKeys: rowKeys, selectedRowKeys: rowKeys,
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
</template> </template>
<script> <script>
import { getSiteBusinessList } from "@/services/business"; import { siteBusinessList } from "@/services/business";
import { addBusinessToWindow } from "@/services/dept"; import { addBusinessToWindow } from "@/services/dept";
// import { extractTree } from "@/utils/util"; // import { extractTree } from "@/utils/util";
import local from "@/utils/local"; import local from "@/utils/local";
...@@ -110,7 +110,7 @@ export default { ...@@ -110,7 +110,7 @@ export default {
size: -1, size: -1,
page: 1, page: 1,
total: 0, total: 0,
siteBusinessList: [], // 站点业务列表 siteBusinessData: [], // 站点业务列表
businessName: "", businessName: "",
rowKeys: [], rowKeys: [],
formData: { formData: {
...@@ -134,7 +134,7 @@ export default { ...@@ -134,7 +134,7 @@ export default {
methods: { methods: {
// 获取窗口信息 // 获取窗口信息
async getWindowInfo(info) { async getWindowInfo(info) {
await this.getSiteBusinessList(); await this.siteBusinessList();
this.formData = info; this.formData = info;
if (info.businessIds.length) { if (info.businessIds.length) {
this.rowKeys = info.businessIds; this.rowKeys = info.businessIds;
...@@ -156,7 +156,7 @@ export default { ...@@ -156,7 +156,7 @@ export default {
// 获取站点业务列表 // 获取站点业务列表
async getSiteBusinessList() { async getSiteBusinessList() {
this.loading = true; this.loading = true;
let res = await getSiteBusinessList({ let res = await siteBusinessList({
page: this.page, page: this.page,
size: this.size, size: this.size,
siteId: this.siteId, siteId: this.siteId,
...@@ -166,7 +166,7 @@ export default { ...@@ -166,7 +166,7 @@ export default {
if (res.data.code === 1) { if (res.data.code === 1) {
let { data, total } = res.data.data; let { data, total } = res.data.data;
this.total = total; this.total = total;
this.siteBusinessList = this.delChildren(data); this.siteBusinessData = this.delChildren(data);
} }
}, },
// 搜索 // 搜索
......
...@@ -418,7 +418,7 @@ export default { ...@@ -418,7 +418,7 @@ export default {
}, },
// 获取站点业务数据 // 获取站点业务数据
// async getBusinessData(obj = {}) { // async getBusinessData(obj = {}) {
// let res = await getSiteBusinessList({ // let res = await siteBusinessList({
// page: 1, // page: 1,
// size: -1, // size: -1,
// siteId: this.siteId, // siteId: this.siteId,
......
...@@ -585,16 +585,23 @@ export default { ...@@ -585,16 +585,23 @@ export default {
pmWorkEndTime, pmWorkEndTime,
logoPath, logoPath,
} = (this.formInfo = data); } = (this.formInfo = data);
this.areaInfo.areaID = areaID; this.areaInfo.areaID = areaID;
this.areaInfo.areaCode = areaCode; this.areaInfo.areaCode = areaCode;
this.areaInfo.areaName = areaName; this.areaInfo.areaName = areaName;
this.cityData = [proCode, cityCode, districtCode]; this.cityData = [proCode, cityCode, districtCode];
this.formInfo.modelIds = modelIds.map(Number); this.formInfo.modelIds = modelIds.map(Number);
this.formInfo.amWorkStartTime = String(amWorkStartTime); [
this.formInfo.amWorkEndTime = String(amWorkEndTime); this.formInfo.amWorkStartTime,
this.formInfo.pmWorkStartTime = String(pmWorkStartTime); this.formInfo.amWorkEndTime,
this.formInfo.pmWorkEndTime = String(pmWorkEndTime); this.formInfo.pmWorkStartTime,
this.formInfo.pmWorkEndTime,
] = [
amWorkStartTime,
amWorkEndTime,
pmWorkStartTime,
pmWorkEndTime,
].map(String);
if (logoPath) { if (logoPath) {
this.fileList = [ this.fileList = [
{ {
...@@ -633,16 +640,17 @@ export default { ...@@ -633,16 +640,17 @@ export default {
}, },
// 上传限制 // 上传限制
beforeUpload(file) { beforeUpload(file) {
let restrict = 10; // 限制文件大小MB
const isJpgOrPng = const isJpgOrPng =
file.type === "image/jpeg" || file.type === "image/png"; file.type === "image/jpeg" || file.type === "image/png";
if (!isJpgOrPng) { if (!isJpgOrPng) {
this.$message.error("请上传jpeg或者png图片!"); this.$message.error("请上传jpeg或者png图片!");
} }
const isLt10M = file.size / 1024 / 1024 < 10; const isExceed = file.size / 1024 / 1024 <= restrict;
if (!isLt10M) { if (!isExceed) {
this.$message.error("图片大小不能超过10MB!"); this.$message.error(`图片大小不能超过${restrict}MB!`);
} }
return isJpgOrPng && isLt10M; return isJpgOrPng && isExceed;
}, },
// 上传图片 // 上传图片
handleChange({ file, fileList }) { handleChange({ file, fileList }) {
......
import { import { business, sitebusiness, businessmatter } from "@/services/basicsetApi";
business,sitebusiness,businessmatter
} from '@/services/basicsetApi'
import {request, METHOD} from '@/utils/request' import { request, METHOD } from "@/utils/request";
/** /**
* 一体化业务 * 一体化业务
*/ */
// 查看业务 // 查看业务
export async function getBusinessInfo(data) { export async function businessInfo(data) {
return request(business.info, METHOD.GET, data) return request(business.info, METHOD.GET, data);
} }
//获取业务列表 //获取业务列表
export async function getBusinessList(data) { export async function businessList(data) {
return request(business.list, METHOD.POST, data) return request(business.list, METHOD.POST, data);
} }
//保存更新业务 //保存更新业务
export async function saveBusiness(data) { export async function saveBusiness(data) {
return request(business.save, METHOD.POST, data) return request(business.save, METHOD.POST, data);
} }
//删除业务 //删除业务
export async function businessDel(data) { export async function businessDel(data) {
return request(business.delete, METHOD.GET, data) return request(business.delete, METHOD.GET, data);
} }
// 添加业务到站点 // 添加业务到站点
export async function addInBusiness(data) { export async function addInBusiness(data) {
return request(business.addBusinessToSite, METHOD.POST, data) return request(business.addBusinessToSite, METHOD.POST, data);
} }
/** /**
* 站点业务 * 站点业务
*/ */
// 查看站点业务列表 // 查看站点业务列表
export async function getSiteBusinessList(data) { export async function siteBusinessList(data) {
return request(sitebusiness.list, METHOD.POST, data) return request(sitebusiness.list, METHOD.POST, data);
} }
// 新增站点业务 // 新增站点业务
export async function addSite(data) { export async function addSite(data) {
return request(sitebusiness.save, METHOD.POST, data) return request(sitebusiness.save, METHOD.POST, data);
} }
// 编辑站点业务 // 编辑站点业务
export async function editSiteBusiness(data) { export async function editSiteBusiness(data) {
return request(sitebusiness.edit, METHOD.GET, data) return request(sitebusiness.edit, METHOD.GET, data);
} }
//删除站点业务 //删除站点业务
export async function delSiteBusiness(data) { export async function delSiteBusiness(data) {
return request(sitebusiness.delete, METHOD.GET, data) return request(sitebusiness.delete, METHOD.GET, data);
} }
/** /**
...@@ -56,26 +53,26 @@ export async function delSiteBusiness(data) { ...@@ -56,26 +53,26 @@ export async function delSiteBusiness(data) {
*/ */
// 保存业务关联事项 // 保存业务关联事项
export async function addBusinessMatter(data) { export async function addBusinessMatter(data) {
return request(businessmatter.save, METHOD.POST, data) return request(businessmatter.save, METHOD.POST, data);
} }
// 获取业务关联事项列表 // 获取业务关联事项列表
export async function getBusinessMatterList(data) { export async function businessMatterList(data) {
return request(businessmatter.list, METHOD.POST, data) return request(businessmatter.list, METHOD.POST, data);
} }
// 删除业务事项关联 // 删除业务事项关联
export async function delBusinessMatter(data) { export async function delBusinessMatter(data) {
return request(businessmatter.delete, METHOD.GET, data) return request(businessmatter.delete, METHOD.GET, data);
} }
// 业务关联列表 // 业务关联列表
export async function getBusinesslistData(data) { export async function getBusinesslistData(data) {
return request(businessmatter.businesslist, METHOD.POST, data) return request(businessmatter.businesslist, METHOD.POST, data);
} }
// 事项关联列表 // 事项关联列表
export async function getMatterlistData(data) { export async function getMatterlistData(data) {
return request(businessmatter.matterlist, METHOD.POST, data) return request(businessmatter.matterlist, METHOD.POST, data);
} }
// 批量关联业务事项 // 批量关联业务事项
export async function addBatchSave(data) { export async function addBatchSave(data) {
return request(businessmatter.batchSave, METHOD.POST, data) return request(businessmatter.batchSave, METHOD.POST, data);
} }
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