From ed6c6350015d52ea1cb033c7558f72b721ece84a Mon Sep 17 00:00:00 2001 From: WangHan <wwh_work@126,com> Date: 星期四, 19 十二月 2024 19:58:55 +0800 Subject: [PATCH] 打包名称修改,去除错误输出 --- admin-web/src/views/foundation/store/person.vue | 96 +++++++++++++++++++++++++++--------------------- 1 files changed, 54 insertions(+), 42 deletions(-) diff --git a/admin-web/src/views/foundation/store/person.vue b/admin-web/src/views/foundation/store/person.vue index 1a4e5dc..d86ae94 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> @@ -8,7 +8,9 @@ <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(data)"> - {{ data.name }} + <div>{{ data.name }}</div> + <i style="font-size: 18px;font-weight: bold;color: #0d997c;margin-right: 10px" + class="el-icon-check"></i> </div> </template> </el-tree> @@ -28,30 +30,31 @@ </div> </div> <div slot="footer" align="center" class="dialog-footer"> - <my-button name="鍙栨秷" site="form" @click="close" /> - <my-button name="淇濆瓨" site="form" @click="save" /> + <my-button name="鍙栨秷" site="form" @click="close"/> + <my-button name="淇濆瓨" site="form" @click="save"/> </div> </win-md> </template> <script> -import { departmentListAll } from '@/api/system/deptment'; -import { userSelectDepartment, warehouseManagerAdd, warehouseManagerList } from '@/api/foudation/store'; +import {userSelectDepartment, warehouseManagerList, warehouseManagerAdd} 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', - components: { winMd, myButton }, + components: {winMd, myButton}, props: { setting: { type: Object, - default: () => {}, + default: () => { + }, }, }, data() { return { + loading: true, + loadingText: '鍔犺浇涓�', selectdSections: [], treeData: [], formData: {}, @@ -64,59 +67,53 @@ }, computed: { checkedKeys() { - console.log( - 1111, - this.selectdSections.map((v) => v.id), - ); return this.selectdSections.map((v) => v.id); }, }, created() { - console.log(this.setting); if (this.setting.info) { this.formData = Object.assign({}, JSON.parse(this.setting.info)); } this.init(); - warehouseManagerList({ warehouseId: this.formData.id }).then((res) => { - this.selectdSections = res.map((item) => { - item.name = item.managerName; - item.id = item.managerId; - return item; - }); - this.key = Math.random(); - }); }, methods: { async init() { - let managerRes = await warehouseManagerList({ warehouseId: this.formData.id }); - this.managerListStr = JSON.stringify(managerRes); - const res = await userSelectDepartment({ agencyId: this.formData.agencyId }); + let managerRes = await warehouseManagerList({warehouseId: this.formData.id}); + this.selectdSections = managerRes.map((item) => { + item.name = item.managerName; + item.id = item.managerId; + item.checked = true + return item; + }); + const res = await userSelectDepartment({agencyId: this.formData.agencyId}); this.treeData = this.deepList([res]); + this.key = Math.random(); + this.loading = false }, 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; - } + item.checked = this.selectdSections.some(s=>item.id===s.id) } return item; }); }, handleCheckItem(data) { - this.selectdSections = []; + if (!data.checked) { + this.selectdSections.push(data); + } else { + let idx = this.selectdSections.findIndex(item => item.id === data.id) + if (idx !== -1) { + this.selectdSections.splice(idx, 1) + } + } this.treeData[0].children.forEach((item, index) => { if (item.children) { item.children.forEach((child, childIndex) => { if (child.id == data.id) { this.$set(this.treeData[0].children[index].children[childIndex], 'checked', !child.checked); - } - if (child.checked) { - this.selectdSections.push(child); } }); } @@ -135,6 +132,10 @@ this.$emit('close'); }, save() { + if(this.selectdSections.length===0){ + this.$message.error('璇烽�夋嫨搴撶鍛橈紒'); + return + } let params = { warehouseId: this.setting.id, warehouseManagerInfoList: [], @@ -145,7 +146,6 @@ managerName: item.name, }); }); - debugger; warehouseManagerAdd(params).then((res) => { this.$message.success('淇濆瓨鎴愬姛锛�'); this.close(); @@ -160,12 +160,14 @@ height: 400px; display: flex; justify-content: space-between; + ::v-deep { .el-tree-node__expand-icon.is-leaf { display: none; } } } + .section-left, .section-right { width: calc((100% - 20px) / 2); @@ -176,10 +178,12 @@ border-radius: 4px; overflow-y: auto; } + .header-row { display: flex; align-items: center; justify-content: space-between; + .title { color: #3d3d3d; font-size: 14px; @@ -187,9 +191,11 @@ font-weight: 400; } } + .section-body { margin-top: 20px; } + .section-right { .btn { display: inline-block; @@ -204,11 +210,13 @@ background: rgba($color: #0d997c, $alpha: 0.1); cursor: pointer; } + .del-btn { color: #f9675b; border: 1px solid #f9675b; background: rgba($color: #f9675b, $alpha: 0.1); } + .section-item { width: 44%; margin: 0 auto; @@ -218,20 +226,24 @@ margin-bottom: 10px; } } + .leaf-node { width: 100%; height: 26px; line-height: 26px; padding-left: 10px; - &:hover { - background: #f5f7fa; + display: flex; + justify-content: space-between; + align-items: center; + + i { + display: none; } } + .checked { - width: 100%; - background: #f5f7fa; - height: 26px; - line-height: 26px; - box-sizing: border-box; + i { + display: inline-flex; + } } </style> -- Gitblit v1.9.1