From 20913c80c3f5fc8e533cb92b90e6f20bcd68e032 Mon Sep 17 00:00:00 2001 From: 石广澎 <shiguangpeng@163.com> Date: 星期三, 29 十一月 2023 17:49:32 +0800 Subject: [PATCH] feat: 1、优化导入 2、部门物品台账查询对接 --- admin-web/src/views/foundation/store/person.vue | 78 +++++++++++++++++++++++++-------------- 1 files changed, 50 insertions(+), 28 deletions(-) diff --git a/admin-web/src/views/foundation/store/person.vue b/admin-web/src/views/foundation/store/person.vue index 040a042..dc647b3 100644 --- a/admin-web/src/views/foundation/store/person.vue +++ b/admin-web/src/views/foundation/store/person.vue @@ -1,5 +1,5 @@ <template> - <win-md :title="setting.title" @close="close" :width="'800px'"> + <win-md :title="setting.title" @close="close" :width="'800px'" :loading="loading"> <div class="section-container"> <div class="section-left"> <div class="header-row"><span class="title">閫夋嫨浜哄憳锛�</span></div> @@ -7,7 +7,7 @@ <el-tree ref="tree" :data="treeData" node-key="id" :props="defaultProps" default-expand-all> <template slot-scope="{ node, data }"> <div v-if="data.type != 'user'">{{ data.name }}</div> - <div v-else class="leaf-node" :class="data.checked ? 'checked' : ''" @click="handleCheckItem(node, data)"> + <div v-else class="leaf-node" :class="data.checked ? 'checked' : ''" @click="handleCheckItem(data)"> {{ data.name }} </div> </template> @@ -35,11 +35,9 @@ </template> <script> -import { departmentListAll } from '@/api/system/deptment'; -import { userSelectDepartment, warehouseManagerAdd, warehouseManagerList } from '@/api/foudation/store'; +import {userSelectDepartment, warehouseManagerList} from '@/api/foudation/store'; import winMd from '@/components/win/win-md'; import myButton from '@/components/myButton/myButton'; -import * as finsystenant from '@/api/baseSetting/finsystenant'; export default { name: 'person', @@ -52,6 +50,8 @@ }, data() { return { + loading:true, + loadingText:'鍔犺浇涓�', selectdSections: [], treeData: [], formData: {}, @@ -59,6 +59,7 @@ children: 'children', label: 'name', }, + key: Math.random(), }; }, computed: { @@ -67,22 +68,42 @@ }, }, created() { - console.log(this.setting); if (this.setting.info) { this.formData = Object.assign({}, JSON.parse(this.setting.info)); } - this.initTree(); + this.init(); warehouseManagerList({ warehouseId: this.formData.id }).then((res) => { - console.log(res); + this.selectdSections = res.map((item) => { + item.name = item.managerName; + item.id = item.managerId; + return item; + }); + this.key = Math.random(); + this.loading = false }); }, methods: { - initTree() { - userSelectDepartment({ agencyId: this.formData.agencyId }).then((res) => { - this.treeData = [res]; + async init() { + let managerRes = await warehouseManagerList({ warehouseId: this.formData.id }); + this.managerListStr = JSON.stringify(managerRes); + const res = await userSelectDepartment({ agencyId: this.formData.agencyId }); + this.treeData = this.deepList([res]); + }, + deepList(list) { + return list.map((item) => { + if (item.children && item.children.length) { + this.deepList(item.children); + } else { + if (this.managerListStr.includes(item.id)) { + item.checked = true; + } else { + item.checked = false; + } + } + return item; }); }, - handleCheckItem(node, data) { + handleCheckItem(data) { this.selectdSections = []; this.treeData[0].children.forEach((item, index) => { if (item.children) { @@ -96,14 +117,13 @@ }); } }); - console.log(this.treeData); }, handleDel(item) { - this.handleCheckItem({}, item); + this.handleCheckItem(item); }, handleClear() { this.selectdSections.forEach((item) => { - this.handleCheckItem({}, item); + this.handleCheckItem(item); }); this.selectdSections = []; }, @@ -111,24 +131,26 @@ this.$emit('close'); }, save() { - let params = []; + let params = { + warehouseId: this.setting.id, + warehouseManagerInfoList: [], + }; this.selectdSections.forEach((item) => { - params.push({ + params.warehouseManagerInfoList.push({ managerId: item.id, managerName: item.name, - baseWarehouseId: this.setting.id, }); }); - debugger; - warehouseManagerAdd(params).then((res) => { - if (res) { - this.$message.success('淇濆瓨鎴愬姛锛�'); - this.close(); - this.$emit('search'); - } else { - this.$message.error('淇濆瓨澶辫触'); - } - }); + setTimeout(()=>{ + this.$message.success('淇濆瓨鎴愬姛锛�'); + this.close(); + this.$emit('search'); + },6000) + // warehouseManagerAdd(params).then((res) => { + // this.$message.success('淇濆瓨鎴愬姛锛�'); + // this.close(); + // this.$emit('search'); + // }); }, }, }; -- Gitblit v1.9.1