Commit d9cbb94e authored by “yiyousong”'s avatar “yiyousong”

perf: 优化窗口板块

parent ae1ef8cb
...@@ -114,19 +114,19 @@ ...@@ -114,19 +114,19 @@
} }
// 带按钮搜索框 // 带按钮搜索框
.search { // .search {
input { // input {
font-size: @fz14; // font-size: @fz14;
color: #BFBFBF; // color: #BFBFBF;
} // }
.chaxun { // .chaxun {
color: @clfff; // color: @clfff;
border: 1px solid #5ab6ff; // border: 1px solid #5ab6ff;
padding: 0 14px; // padding: 0 14px;
background: @addbg; // background: @addbg;
} // }
} // }
// 按钮 // 按钮
.btn { .btn {
......
...@@ -42,6 +42,17 @@ ...@@ -42,6 +42,17 @@
}" }"
@changePagination="getSiteBusinessData" @changePagination="getSiteBusinessData"
> >
<!-- 序号 -->
<template slot="index" slot-scope="{ record, index }">
<span v-if="record.parentId === 0">
{{
(siteBusinessTable.page - 1) * siteBusinessTable.size +
index +
1
}}
</span>
</template>
<template slot="action" slot-scope="{ record }"> <template slot="action" slot-scope="{ record }">
<a-space size="middle"> <a-space size="middle">
<span <span
...@@ -99,6 +110,13 @@ ...@@ -99,6 +110,13 @@
}" }"
@changePagination="getBusinessListData" @changePagination="getBusinessListData"
> >
<!-- 序号 -->
<template slot="index" slot-scope="{ record, index }">
<span v-if="record.parentId === 0">
{{ (businessTable.page - 1) * businessTable.size + index + 1 }}
</span>
</template>
<template slot="action" slot-scope="{ record }"> <template slot="action" slot-scope="{ record }">
<a-space size="middle"> <a-space size="middle">
<span class="primary pointer" @click="handleIn(record.id)" <span class="primary pointer" @click="handleIn(record.id)"
...@@ -153,15 +171,8 @@ export default { ...@@ -153,15 +171,8 @@ export default {
{ {
title: "序号", title: "序号",
width: "50px", width: "50px",
customRender: (text, record, index) => { scopedSlots: {
if (record.parentId === 0) { customRender: "index",
return (
(this.siteBusinessTable.page - 1) *
this.siteBusinessTable.size +
index +
1
);
}
}, },
}, },
{ {
...@@ -189,14 +200,8 @@ export default { ...@@ -189,14 +200,8 @@ export default {
title: "序号", title: "序号",
key: "id", key: "id",
width: "50px", width: "50px",
customRender: (text, record, index) => { scopedSlots: {
if (record.parentId === 0) { customRender: "index",
return (
(this.businessTable.page - 1) * this.businessTable.size +
index +
1
);
}
}, },
}, },
{ {
......
...@@ -71,6 +71,11 @@ ...@@ -71,6 +71,11 @@
}" }"
@changePagination="getMatterSiteData" @changePagination="getMatterSiteData"
> >
<!-- 序号 -->
<template slot="index" slot-scope="{ index }">{{
(siteMatterTable.page - 1) * siteMatterTable.size + index + 1
}}</template>
<!-- 事项名称 --> <!-- 事项名称 -->
<template slot="matterName" slot-scope="{ record }"> <template slot="matterName" slot-scope="{ record }">
<a-tooltip placement="topLeft"> <a-tooltip placement="topLeft">
...@@ -188,6 +193,11 @@ ...@@ -188,6 +193,11 @@
}" }"
@changePagination="getMatterListData" @changePagination="getMatterListData"
> >
<!-- 序号 -->
<template slot="index" slot-scope="{ index }">{{
(baseMatterTable.page - 1) * baseMatterTable.size + index + 1
}}</template>
<!-- 事项名称 --> <!-- 事项名称 -->
<template slot="matterName" slot-scope="{ record }"> <template slot="matterName" slot-scope="{ record }">
<a-tooltip placement="topLeft"> <a-tooltip placement="topLeft">
...@@ -280,12 +290,8 @@ export default { ...@@ -280,12 +290,8 @@ export default {
{ {
title: "序号", title: "序号",
width: "50px", width: "50px",
customRender: (text, record, index) => { scopedSlots: {
return ( customRender: "index",
(this.siteMatterTable.page - 1) * this.siteMatterTable.size +
index +
1
);
}, },
}, },
{ {
...@@ -332,12 +338,8 @@ export default { ...@@ -332,12 +338,8 @@ export default {
{ {
title: "序号", title: "序号",
width: "50px", width: "50px",
customRender: (text, record, index) => { scopedSlots: {
return ( customRender: "index",
(this.baseMatterTable.page - 1) * this.baseMatterTable.size +
index +
1
);
}, },
}, },
{ {
......
...@@ -36,6 +36,11 @@ ...@@ -36,6 +36,11 @@
}" }"
@changePagination="getBusinessMatterData" @changePagination="getBusinessMatterData"
> >
<!-- 序号 -->
<template slot="index" slot-scope="{ index }">{{
(siteBusinessTable.page - 1) * siteBusinessTable.size + index + 1
}}</template>
<template slot="action" slot-scope="{ record }"> <template slot="action" slot-scope="{ record }">
<a-space> <a-space>
<span <span
...@@ -109,6 +114,11 @@ ...@@ -109,6 +114,11 @@
}" }"
@changePagination="getMatterSiteData" @changePagination="getMatterSiteData"
> >
<!-- 序号 -->
<template slot="index" slot-scope="{ index }">{{
(siteMatterTable.page - 1) * siteMatterTable.size + index + 1
}}</template>
<!-- 事项名称 --> <!-- 事项名称 -->
<template slot="matterName" slot-scope="{ record }"> <template slot="matterName" slot-scope="{ record }">
<a-tooltip placement="topLeft"> <a-tooltip placement="topLeft">
...@@ -282,13 +292,8 @@ export default { ...@@ -282,13 +292,8 @@ export default {
{ {
title: "序号", title: "序号",
width: "50px", width: "50px",
customRender: (text, record, index) => { scopedSlots: {
return ( customRender: "index",
(this.siteBusinessTable.page - 1) *
this.siteBusinessTable.size +
index +
1
);
}, },
}, },
{ {
...@@ -321,12 +326,8 @@ export default { ...@@ -321,12 +326,8 @@ export default {
{ {
title: "序号", title: "序号",
width: "50px", width: "50px",
customRender: (text, record, index) => { scopedSlots: {
return ( customRender: "index",
(this.siteMatterTable.page - 1) * this.siteMatterTable.size +
index +
1
);
}, },
}, },
{ {
......
...@@ -77,6 +77,11 @@ ...@@ -77,6 +77,11 @@
}" }"
@changePagination="getMatterSiteData" @changePagination="getMatterSiteData"
> >
<!-- 序号 -->
<template slot="index" slot-scope="{ index }">{{
(searchForm.page - 1) * searchForm.size + index + 1
}}</template>
<!-- 事项名称 --> <!-- 事项名称 -->
<template slot="matterName" slot-scope="{ text }"> <template slot="matterName" slot-scope="{ text }">
<a-tooltip placement="topLeft"> <a-tooltip placement="topLeft">
...@@ -168,10 +173,8 @@ export default { ...@@ -168,10 +173,8 @@ export default {
{ {
title: "序号", title: "序号",
width: "50px", width: "50px",
customRender: (text, record, index) => { scopedSlots: {
return ( customRender: "index",
(this.searchForm.page - 1) * this.searchForm.size + index + 1
);
}, },
}, },
{ {
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<a-input-search <a-input-search
placeholder="请输入事项名称搜索" placeholder="请输入事项名称搜索"
enter-button="搜索" enter-button="搜索"
v-model="winMatterTable.searchForm.matterName"
allowClear allowClear
@search="onSearch" @search="onSearch"
/> />
...@@ -28,62 +29,47 @@ ...@@ -28,62 +29,47 @@
</div> </div>
<!-- 表格 --> <!-- 表格 -->
<div class="table-content"> <div class="table-content">
<a-table <y-table
bordered :columns="winMatterTable.columns"
:loading="isLoading" :data="winMatterTable.data"
:pageSize.sync="winMatterTable.size"
:page.sync="winMatterTable.page"
:total="winMatterTable.total"
:loading="winMatterTable.loading"
:scroll="{ y: 500 }" :scroll="{ y: 500 }"
size="middle"
:pagination="{
showTotal: (total) => `共 ${total} 条`,
current: Current,
total: total,
pageSize: size,
size: 'middle',
showSizeChanger: true,
showQuickJumper: true,
pageSizeOptions: pageSizeOptions,
onChange: changePagination,
onShowSizeChange: showSizeChange,
}"
:columns="leftColumns"
:data-source="tableData"
:rowKey="(record) => record.id"
:row-selection="{ onChange: onSelectChange }" :row-selection="{ onChange: onSelectChange }"
@changePagination="getWindowmatterData"
> >
<template slot="num" slot-scope="text, record, index"> <!-- 序号 -->
<span> <template slot="index" slot-scope="{ index }">{{
{{ (Current - 1) * size + index + 1 }} (winMatterTable.page - 1) * winMatterTable.size + index + 1
</span> }}</template>
</template>
<!-- 排序 --> <!-- 排序 -->
<template slot="sort" slot-scope="text"> <template slot="sort" slot-scope="{ record }">
<span v-if="!text.isEdit">{{ text.sort }}</span> <span v-if="!record.isEdit">{{ record.sort }}</span>
<a-input v-else v-model="text.sort"></a-input> <a-input v-else v-model="record.sort"></a-input>
</template> </template>
<!-- 是否显示 --> <!-- 是否显示 -->
<template slot="isShow" slot-scope="text"> <template slot="isShow" slot-scope="{ record }">
<!-- <a-tag v-if="text.isShow" color="green"></a-tag> <y-switch
<a-tag v-else color="red"></a-tag> --> v-model="record.isShow"
<y-switch v-model="text.isShow" :disabled="!text.isEdit"></y-switch> :disabled="!record.isEdit"
></y-switch>
</template> </template>
<template slot="action" slot-scope="text"> <template slot="action" slot-scope="{ record }">
<a-space size="middle"> <a-space size="middle">
<span <span
href="javascript:;"
class="pointer" class="pointer"
:class="text.isEdit ? 'edit' : 'primary'" :class="record.isEdit ? 'edit' : 'primary'"
@click="handleEdit(text)" @click="handleEdit(record)"
>{{ text.isEdit ? "保存" : "编辑" }}</span >{{ record.isEdit ? "保存" : "编辑" }}</span
> >
<span <span @click="handleDel(+record.id)" class="delete pointer"
href="javascript:;"
@click="handleDel(+text.id)"
class="delete pointer"
>删除</span >删除</span
> >
</a-space> </a-space>
</template> </template>
</a-table> </y-table>
</div> </div>
</div> </div>
<!-- 新增窗口事项 --> <!-- 新增窗口事项 -->
...@@ -97,13 +83,6 @@ ...@@ -97,13 +83,6 @@
<a-button @click="handleReset">重置</a-button> <a-button @click="handleReset">重置</a-button>
<a-button type="primary" @click="handleOk">确定</a-button> <a-button type="primary" @click="handleOk">确定</a-button>
</template> </template>
<!-- <div class="form-isShow">
<span>是否显示:</span><y-switch v-model="formData.isShow"></y-switch>
</div>
<div class="form-isShow">
<span>排序:</span>
<a-input-number v-model="formData.sort" :min="0" />
</div> -->
<div class="color_title flex jcb"> <div class="color_title flex jcb">
<span>站点事项列表:</span> <span>站点事项列表:</span>
<div> <div>
...@@ -111,7 +90,7 @@ ...@@ -111,7 +90,7 @@
<a-select <a-select
style="width: 120px" style="width: 120px"
allowClear allowClear
v-model="source" v-model="siteMatterTable.searchForm.source"
class="select-department" class="select-department"
placeholder="事项来源" placeholder="事项来源"
> >
...@@ -124,48 +103,33 @@ ...@@ -124,48 +103,33 @@
enter-button="搜索" enter-button="搜索"
allowClear allowClear
@search="onSearchMatter" @search="onSearchMatter"
v-model="matterNameSearch" v-model="siteMatterTable.searchForm.matterName"
/> />
</a-space> </a-space>
</div> </div>
</div> </div>
<div style="margin-top: 10px"> <div style="margin-top: 10px">
<a-table <y-table
bordered
:loading="matterLoading"
:scroll="{ y: 350 }"
size="small" size="small"
:pagination="{ :columns="siteMatterTable.columns"
showTotal: (total) => `共 ${total} 条`, :data="siteMatterTable.data"
current: page, :pageSize.sync="siteMatterTable.size"
pageSize: matterSize, :page.sync="siteMatterTable.page"
total: matterTotal, :total="siteMatterTable.total"
size: 'small', :loading="siteMatterTable.loading"
onChange: changeMatter, :scroll="{ y: 500 }"
showSizeChanger: true, @changePagination="getSiteMatterData"
showQuickJumper: true,
pageSizeOptions: pageSizeOptions,
onShowSizeChange: sizeChange,
}"
:columns="matterColumns"
:data-source="siteMatterData"
:rowKey="(record) => record.matterId"
:row-selection="{
selectedRowKeys: matterKeys,
onChange: handleChange,
}"
> >
<template slot="num" slot-scope="text, record, index"> <!-- 序号 -->
<span> <template slot="index" slot-scope="{ index }">{{
{{ (page - 1) * 10 + index + 1 }} (siteMatterTable.page - 1) * siteMatterTable.size + index + 1
</span> }}</template>
</template>
<!-- 来源 --> <!-- 来源 -->
<template slot="source" slot-scope="text"> <template slot="source" slot-scope="{ text }">
<a-tag v-if="text.source == 0" color="green"> 一体化事项 </a-tag> <a-tag v-if="text == 0" color="green"> 一体化事项 </a-tag>
<a-tag v-else color="blue"> 自建事项 </a-tag> <a-tag v-else color="blue"> 自建事项 </a-tag>
</template> </template>
</a-table> </y-table>
</div> </div>
</a-modal> </a-modal>
</div> </div>
...@@ -173,7 +137,6 @@ ...@@ -173,7 +137,6 @@
<script> <script>
import { getSiteMatterList } from "@/services/matter"; import { getSiteMatterList } from "@/services/matter";
import { pageSizeOptions } from "@/config/pageConfig.js";
import { import {
saveWindowbatch, saveWindowbatch,
getWindowmatterList, getWindowmatterList,
...@@ -182,105 +145,108 @@ import { ...@@ -182,105 +145,108 @@ import {
} from "@/services/dept"; } from "@/services/dept";
import YSwitch from "@/components/yswitch/YSwitch.vue"; import YSwitch from "@/components/yswitch/YSwitch.vue";
import TabHeader from "@/components/TabHeader"; import TabHeader from "@/components/TabHeader";
const leftColumns = [
{ import YTable from "@/components/YTable.vue";
title: "序号",
dataIndex: "id",
key: "id",
width: "6%",
scopedSlots: { customRender: "num" },
},
{
title: "部门名称",
dataIndex: "deptName",
width: "15%",
},
{
title: "事项名称",
dataIndex: "matterName",
ellipsis: true,
},
{
title: "排序",
width: "6%",
scopedSlots: {
customRender: "sort",
},
},
{
title: "是否显示",
width: "10%",
scopedSlots: {
customRender: "isShow",
},
},
{
title: "操作",
width: "110px",
scopedSlots: {
customRender: "action",
},
},
];
const matterColumns = [
{
title: "序号",
key: "id",
width: "10%",
scopedSlots: { customRender: "num" },
},
{
title: "部门",
dataIndex: "deptName",
width: "20%",
},
{
title: "事项名称",
dataIndex: "matterName",
},
{
title: "来源",
width: "15%",
scopedSlots: { customRender: "source" },
},
];
export default { export default {
components: { components: {
YSwitch, YSwitch,
TabHeader, TabHeader,
YTable,
}, },
data() { data() {
return { return {
source: undefined,
leftColumns,
matterColumns,
visible: false, visible: false,
isLoading: false,
modalTile: "新增窗口事项", modalTile: "新增窗口事项",
Current: 1, // 窗口事项表格
size: 10, winMatterTable: {
total: 0, page: 1,
pageSizeOptions, size: 10,
tableData: [], total: 0,
data: [],
searchForm: {
matterName: "",
},
columns: [
{
title: "序号",
width: "6%",
scopedSlots: { customRender: "index" },
},
{
title: "部门名称",
dataIndex: "deptName",
width: "15%",
},
{
title: "事项名称",
dataIndex: "matterName",
ellipsis: true,
},
{
title: "排序",
width: "6%",
scopedSlots: {
customRender: "sort",
},
},
{
title: "是否显示",
width: "10%",
scopedSlots: {
customRender: "isShow",
},
},
{
title: "操作",
width: "110px",
scopedSlots: {
customRender: "action",
},
},
],
},
// 站点事项表格
siteMatterTable: {
page: 1,
size: 10,
total: 0,
data: [],
searchForm: {
matterName: "",
source: undefined,
},
columns: [
{
title: "序号",
width: "10%",
scopedSlots: { customRender: "index" },
},
{
title: "部门",
dataIndex: "deptName",
width: "20%",
},
{
title: "事项名称",
dataIndex: "matterName",
},
{
title: "来源",
width: "15%",
dataIndex: "source",
scopedSlots: { customRender: "source" },
},
],
},
siteMatterData: [], // 站点事项列表 siteMatterData: [], // 站点事项列表
matterTotal: 0,
page: 1,
matterSize: 10,
matterLoading: false,
matterKeys: [], matterKeys: [],
matterRows: [], matterRows: [],
matterNameSearch: "", // 事项名称搜索
allDel: "", // 批量删除id allDel: "", // 批量删除id
windowInfo: {}, windowInfo: {},
formData: { formData: {
isShow: 1, isShow: 1,
sort: 0, sort: 0,
}, },
// rules: {
// siteMatterId: [
// { required: true, message: "事项不能为空", trigger: "change" },
// ],
// },
}; };
}, },
created() { created() {
...@@ -307,57 +273,48 @@ export default { ...@@ -307,57 +273,48 @@ export default {
}, },
// 获取站点事项 // 获取站点事项
async getSiteMatterData() { async getSiteMatterData() {
this.matterLoading = true; this.siteMatterTable.loading = true;
let res = await getSiteMatterList({ let res = await getSiteMatterList({
page: this.page, page: this.page,
size: this.matterSize, size: this.matterSize,
siteId: this.windowInfo.siteId, siteId: this.windowInfo.siteId,
matterName: `%${this.matterNameSearch}%`, matterName: `%${this.siteMatterTable.searchForm.matterName}%`,
source: this.source, source: this.siteMatterTable.searchForm.source,
// deptId: this.windowInfo.deptId,
}); });
let { data, total } = res.data.data; if (res.data.code == 1) {
this.siteMatterData = data; let { data, total } = res.data.data;
this.matterTotal = total; this.siteMatterTable.data = data;
this.matterLoading = false; this.siteMatterTable.total = total;
}, }
// 站点事项翻页 this.siteMatterTable.loading = false;
changeMatter(cur) {
this.page = cur;
this.getSiteMatterData();
},
// 站点事项改变每页显示数量
sizeChange(current, size) {
console.log(current, size);
this.page = current;
this.matterSize = size;
this.getSiteMatterData();
}, },
// 站点事项搜索 // 站点事项搜索
onSearchMatter() { onSearchMatter() {
this.page = 1; this.siteMatterTable.page = 1;
this.getSiteMatterData(); this.getSiteMatterData();
}, },
// 获取窗口事项列表 // 获取窗口事项列表
async getWindowmatterData(search = {}) { async getWindowmatterData() {
this.isLoading = true; this.winMatterTable.loading = true;
let res = await getWindowmatterList({ let res = await getWindowmatterList({
page: this.Current, page: this.winMatterTable.page,
size: this.size, size: this.winMatterTable.size,
windowId: this.$route.query.windowId, windowId: this.$route.query.windowId,
...search, matterName: `%${this.winMatterTable.searchForm.matterName}%`,
}); });
let { total, data } = res.data.data; if (res.data.code == 1) {
if (!data.length && this.Current > 1) { let { total, data } = res.data.data;
this.Current -= 1; if (!data.length && this.winMatterTable.page > 1) {
this.getWindowmatterData(); this.winMatterTable.page -= 1;
this.getWindowmatterData();
}
data.forEach((v) => {
v.isEdit = false;
});
this.winMatterTable.total = total;
this.winMatterTable.data = data;
} }
data.forEach((v) => { this.winMatterTable.loading = false;
v.isEdit = false;
});
this.total = total;
this.tableData = data;
this.isLoading = false;
}, },
// 打开新增窗口 // 打开新增窗口
addWindowMatter() { addWindowMatter() {
...@@ -370,19 +327,8 @@ export default { ...@@ -370,19 +327,8 @@ export default {
this.visible = true; this.visible = true;
}, },
// 搜索 // 搜索
onSearch(val) { onSearch() {
this.Current = 1; this.winMatterTable.page = 1;
this.getWindowmatterData({ matterName: `%${val}%` });
},
// 翻页
changePagination(num) {
this.Current = num;
this.getWindowmatterData();
},
// 改变每页显示数量
showSizeChange(current, size) {
this.Current = current;
this.size = size;
this.getWindowmatterData(); this.getWindowmatterData();
}, },
// 保存 // 保存
......
...@@ -134,7 +134,7 @@ export default { ...@@ -134,7 +134,7 @@ export default {
methods: { methods: {
// 获取窗口信息 // 获取窗口信息
async getWindowInfo(info) { async getWindowInfo(info) {
await this.siteBusinessList(); await this.getSiteBusinessList();
this.formData = info; this.formData = info;
if (info.businessIds.length) { if (info.businessIds.length) {
this.rowKeys = info.businessIds; this.rowKeys = info.businessIds;
......
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
<a-input-search <a-input-search
placeholder="请输入窗口编号搜索" placeholder="请输入窗口编号搜索"
v-model="windowSearch" v-model="windowSearchForm.fromnum"
allowClear allowClear
enter-button="搜索" enter-button="搜索"
style="width: 250px" style="width: 250px"
...@@ -124,30 +124,21 @@ ...@@ -124,30 +124,21 @@
<div class="department_right_tab"> <div class="department_right_tab">
<div class="table-content"> <div class="table-content">
<!-- 表格 --> <!-- 表格 -->
<a-table <y-table
:scroll="{ y: 550 }"
:loading="loading"
bordered
:columns="columns" :columns="columns"
:data-source="windowData" :data="windowData"
:pagination="{ :pageSize.sync="windowSearchForm.size"
showTotal: (total) => `共 ${total} 条`, :page.sync="windowSearchForm.page"
current: page, :total="total"
total: total, :loading="loading"
pageSize: size, :scroll="{ y: 550 }"
showSizeChanger: true, @changePagination="getWindowListData"
showQuickJumper: true,
pageSizeOptions: pageSizeOptions,
onChange: onPage,
onShowSizeChange: showSizeChange,
}"
class="department_right_table"
:rowKey="(record) => record.id"
> >
<a slot="name" slot-scope="text">{{ text }}</a> <!-- 序号 -->
<span slot="number" slot-scope="text, record, index">{{ <template slot="index" slot-scope="{ index }">{{
(page - 1) * size + index + 1 (windowSearchForm.page - 1) * windowSearchForm.size + index + 1
}}</span> }}</template>
<!-- 工作人员 --> <!-- 工作人员 -->
<template slot="workmanList" slot-scope="text"> <template slot="workmanList" slot-scope="text">
<span v-if="text.workmanList && text.workmanList.length">{{ <span v-if="text.workmanList && text.workmanList.length">{{
...@@ -155,40 +146,28 @@ ...@@ -155,40 +146,28 @@
}}</span> }}</span>
<span v-else>--</span> <span v-else>--</span>
</template> </template>
<!-- 所属楼栋 -->
<template slot="building" slot-scope="text">
<span>{{ text.building ? text.building + "" : "--" }}</span>
</template>
<!-- 所属楼层 -->
<template slot="level" slot-scope="text">
<span>{{ text.level ? text.level + "" : "--" }}</span>
</template>
<!-- 备注 -->
<template slot="summary" slot-scope="text">
<span>{{ text.summary ? text.summary : "--" }}</span>
</template>
<!-- 创建时间 --> <!-- 创建时间 -->
<template slot="createTime" slot-scope="text"> <template slot="createTime" slot-scope="{ text }">
{{ text.createTime | dateFormat }} {{ text | dateFormat }}
</template> </template>
<!-- 操作 --> <!-- 操作 -->
<div slot="action" slot-scope="text"> <div slot="action" slot-scope="{ record }">
<div class="flex jcb flexwrap"> <div class="flex jcb flexwrap">
<span class="primary pointer" @click="workModal(text)" <span class="primary pointer" @click="workModal(record)"
>业务</span >业务</span
> >
<span class="primary pointer" @click="addWindowMatter(text)" <span class="primary pointer" @click="addWindowMatter(record)"
>事项</span >事项</span
> >
<span class="primary pointer" @click="editModal(text)" <span class="primary pointer" @click="editModal(record)"
>编辑</span >编辑</span
> >
<span class="delete pointer" @click="delWindow(text.id)" <span class="delete pointer" @click="delWindow(record.id)"
>删除</span >删除</span
> >
</div> </div>
</div> </div>
</a-table> </y-table>
</div> </div>
</div> </div>
</div> </div>
...@@ -219,11 +198,11 @@ ...@@ -219,11 +198,11 @@
<script> <script>
import { Empty } from "ant-design-vue"; import { Empty } from "ant-design-vue";
import { pageSizeOptions } from "@/config/pageConfig.js";
import adddepartment from "./components/adddepartment.vue"; import adddepartment from "./components/adddepartment.vue";
import addwindow from "./components/addwindow.vue"; import addwindow from "./components/addwindow.vue";
import addWindowBusiness from "./components/addWindowBusiness.vue"; import addWindowBusiness from "./components/addWindowBusiness.vue";
import TabHeader from "@/components/TabHeader"; import TabHeader from "@/components/TabHeader";
import YTable from "@/components/YTable.vue";
import local from "@/utils/local"; import local from "@/utils/local";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { import {
...@@ -240,79 +219,82 @@ export default { ...@@ -240,79 +219,82 @@ export default {
addwindow, addwindow,
addWindowBusiness, addWindowBusiness,
TabHeader, TabHeader,
YTable,
}, },
data() { data() {
const columns = [ return {
{ columns: [
title: "序号", {
width: "6%", title: "序号",
scopedSlots: { width: "6%",
customRender: "number", scopedSlots: {
customRender: "index",
},
}, },
}, {
{ title: "窗口名称",
title: "窗口名称", dataIndex: "name",
dataIndex: "name", width: "10%",
width: "10%",
},
{
title: "编号",
width: "10%",
customRender: (text) => {
return text.fromnum || "--";
}, },
}, {
{ title: "编号",
title: "所属部门", width: "10%",
width: "10%", dataIndex: "fromnum",
customRender: (text) => {
return text.deptName || "--";
}, },
}, {
{ title: "所属部门",
title: "工作人员", width: "10%",
width: "10%", dataIndex: "deptName",
scopedSlots: {
customRender: "workmanList",
}, },
}, {
{ title: "工作人员",
title: "所属楼栋", width: "10%",
width: "6%", dataIndex: "workmanList",
scopedSlots: { scopedSlots: {
customRender: "building", customRender: "workmanList",
},
}, },
}, {
{ title: "所属楼栋",
title: "所属楼层", width: "6%",
width: "6%", dataIndex: "building",
scopedSlots: { customRender: (text) => {
customRender: "level", if (text) {
return text + "";
}
},
}, },
}, {
{ title: "所属楼层",
title: "备注", width: "6%",
ellipsis: true, dataIndex: "level",
scopedSlots: {
customRender: "summary", customRender: (text) => {
if (text) {
return text + "";
}
},
}, },
}, {
{ title: "备注",
title: "创建时间", ellipsis: true,
scopedSlots: { dataIndex: "summary",
customRender: "createTime",
}, },
}, {
{ title: "创建时间",
title: "操作", dataIndex: "createTime",
width: "100px", scopedSlots: {
scopedSlots: { customRender: "createTime",
customRender: "action", },
}, },
}, {
]; title: "操作",
return { width: "100px",
spinning: false, scopedSlots: {
customRender: "action",
},
},
],
api: process.env.VUE_APP_API_BASE_URL + "/", api: process.env.VUE_APP_API_BASE_URL + "/",
loading: false, loading: false,
deptLoading: false, deptLoading: false,
...@@ -321,22 +303,24 @@ export default { ...@@ -321,22 +303,24 @@ export default {
WindowTitle: "新增窗口", WindowTitle: "新增窗口",
siteId: local.getLocal("siteId"), // 站点id siteId: local.getLocal("siteId"), // 站点id
business: [], // 站点业务数据 business: [], // 站点业务数据
windowSearch: "", // 窗口搜索 // 窗口搜索
windowSearchForm: {
page: 1,
size: 10,
fromnum: "", // 窗口编号
deptId: "", // 部门id
},
deptSearchVal: "", // 部门搜索 deptSearchVal: "", // 部门搜索
deptId: "", // 部门搜索窗口
active: undefined, // 部门激活 active: undefined, // 部门激活
// isRelevancy: false, // isRelevancy: false,
columns,
formVisible: false, formVisible: false,
visibleWork: false, visibleWork: false,
visibleAdd: false, visibleAdd: false,
department: [], // 部门列表 department: [], // 部门列表
deptTotal: 0, // 部门总数 deptTotal: 0, // 部门总数
windowData: [], // 窗口列表数据 windowData: [], // 窗口列表数据
page: 1, total: 0, // 窗口总数
size: 10,
total: 0,
pageSizeOptions,
// businessPage: 1, // 站点业务翻页 // businessPage: 1, // 站点业务翻页
// businessTotal: 0, // 站点业务总数 // businessTotal: 0, // 站点业务总数
rules: { rules: {
...@@ -347,6 +331,7 @@ export default { ...@@ -347,6 +331,7 @@ export default {
}; };
}, },
filters: { filters: {
// 过滤展示最近登录用户
workmanList(arr) { workmanList(arr) {
if (arr.length) { if (arr.length) {
let workerList = [...arr]; let workerList = [...arr];
...@@ -401,13 +386,12 @@ export default { ...@@ -401,13 +386,12 @@ export default {
}); });
}, },
// 获取部门列表 // 获取部门列表
async getDeptListData(obj = {}) { async getDeptListData() {
this.deptLoading = true; 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; this.deptLoading = false;
let { code, data } = res.data; let { code, data } = res.data;
...@@ -454,20 +438,20 @@ export default { ...@@ -454,20 +438,20 @@ export default {
}, },
// 切换部门 // 切换部门
changeDept(id, index) { changeDept(id, index) {
if (this.deptId === id) { if (this.windowSearchForm.deptId === id) {
this.deptId = ""; this.windowSearchForm.deptId = "";
this.active = undefined; this.active = undefined;
this.page = 1; this.windowSearchForm.page = 1;
this.getWindowListData(); this.getWindowListData();
} else { } else {
this.deptId = id; this.windowSearchForm.deptId = id;
this.active = index; this.active = index;
this.page = 1; this.windowSearchForm.page = 1;
this.getWindowListData(); this.getWindowListData();
} }
}, },
// 删除部门 // 删除部门
delDepartment(num) { delDepartment(id) {
let _this = this; let _this = this;
this.$confirm({ this.$confirm({
title: "系统提示", title: "系统提示",
...@@ -478,10 +462,10 @@ export default { ...@@ -478,10 +462,10 @@ export default {
centered: true, centered: true,
maskClosable: true, maskClosable: true,
async onOk() { async onOk() {
let res = await delDept({ id: num }); let res = await delDept({ id });
let { code, msg } = res.data; let { code, msg } = res.data;
if (code === 1) { if (code === 1) {
_this.getDeptListData(_this.siteId); _this.getDeptListData();
_this.$message.success(msg); _this.$message.success(msg);
} }
}, },
...@@ -491,22 +475,23 @@ export default { ...@@ -491,22 +475,23 @@ export default {
}); });
}, },
// 窗口列表 // 窗口列表
async getWindowListData(obj = {}) { async getWindowListData() {
this.loading = true; this.loading = true;
let res = await getWindowList({ let res = await getWindowList({
siteId: this.siteId, siteId: this.siteId,
page: this.page, ...this.windowSearchForm,
size: this.size, fromnum: `%${this.windowSearchForm.fromnum}%`,
fromnum: `%${this.windowSearch}%`,
deptId: this.deptId,
...obj,
}); });
let { code, data } = res.data; let { code, data } = res.data;
if (code === 1) { if (code === 1) {
if (!data.data.length && this.windowSearchForm.page > 1) {
this.windowSearchForm.page -= 1;
this.getWindowListData();
}
this.total = data.pageInfo.totalResult; this.total = data.pageInfo.totalResult;
this.windowData = data.data; this.windowData = data.data;
this.loading = false;
} }
this.loading = false;
}, },
// 新增窗口 // 新增窗口
addModal() { addModal() {
...@@ -525,7 +510,7 @@ export default { ...@@ -525,7 +510,7 @@ export default {
this.$refs.addwindow.onEdit(data); this.$refs.addwindow.onEdit(data);
}, },
// 删除窗口 // 删除窗口
delWindow(num) { delWindow(id) {
let _this = this; let _this = this;
this.$confirm({ this.$confirm({
title: "系统提示", title: "系统提示",
...@@ -536,10 +521,10 @@ export default { ...@@ -536,10 +521,10 @@ export default {
centered: true, centered: true,
maskClosable: true, maskClosable: true,
async onOk() { async onOk() {
let res = await delWindow({ id: num }); let res = await delWindow({ id });
let { code, msg } = res.data; let { code, msg } = res.data;
if (code === 1) { if (code === 1) {
_this.getWindowListData(_this.siteId); _this.getWindowListData();
_this.$message.success(msg); _this.$message.success(msg);
} }
}, },
...@@ -548,40 +533,29 @@ export default { ...@@ -548,40 +533,29 @@ export default {
}, },
}); });
}, },
// 翻页 // 部门搜索
onPage(num) {
this.page = num;
this.getWindowListData();
},
// 改变每页显示数量
showSizeChange(current, size) {
this.page = current;
this.size = size;
this.getWindowListData();
},
// 左边搜索
onSearch(value) { onSearch(value) {
this.getDeptListData({ name: `%${value}%` }); this.getDeptListData({ name: `%${value}%` });
}, },
// 右边搜索 // 窗口搜索
onSearchRight() { onSearchRight() {
this.page = 1; this.windowSearchForm.page = 1;
this.getWindowListData(); this.getWindowListData();
}, },
// 窗口业务 // 窗口业务
workModal(data) { workModal(data) {
let obj = { let form = {
windowName: data.name, windowName: data.name,
windowId: data.id, windowId: data.id,
fromnum: data.fromnum, fromnum: data.fromnum,
}; };
if (data.windowBusinessList) { if (data.windowBusinessList) {
obj.businessIds = data.windowBusinessList.map((v) => v.siteBusinessId); form.businessIds = data.windowBusinessList.map((v) => v.siteBusinessId);
} else { } else {
obj.businessIds = []; form.businessIds = [];
} }
this.visibleWork = true; this.visibleWork = true;
this.$refs.addWindowBusiness.getWindowInfo(obj); this.$refs.addWindowBusiness.getWindowInfo(form);
}, },
// 重置业务窗口 // 重置业务窗口
...@@ -614,7 +588,7 @@ export default { ...@@ -614,7 +588,7 @@ export default {
}, },
// 导入窗口 // 导入窗口
handleChange({ file }) { handleChange({ file }) {
this.spinning = true; this.loading = true;
if (file.status === "done") { if (file.status === "done") {
let { code, msg } = file.response; let { code, msg } = file.response;
if (code == 1) { if (code == 1) {
...@@ -623,7 +597,7 @@ export default { ...@@ -623,7 +597,7 @@ export default {
} else { } else {
this.$message.error(msg); this.$message.error(msg);
} }
this.spinning = false; this.loading = false;
} }
}, },
}, },
......
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