From aee67ef5bf2e57a148bfded1cb986378e35e7e01 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期四, 18 四月 2024 00:49:22 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/UBCS-WEB/src/views/integration/vciAttribute.vue | 195 ++++++++++++++++++++++++++++++++++-------------- 1 files changed, 137 insertions(+), 58 deletions(-) diff --git a/Source/UBCS-WEB/src/views/integration/vciAttribute.vue b/Source/UBCS-WEB/src/views/integration/vciAttribute.vue index 940d3ab..33230eb 100644 --- a/Source/UBCS-WEB/src/views/integration/vciAttribute.vue +++ b/Source/UBCS-WEB/src/views/integration/vciAttribute.vue @@ -4,21 +4,52 @@ @size-change="sizeChange" @row-dblclick="handleRowClick" @row-update="handleUpdate" @selection-change="selectChange"> <template slot="menuLeft"> - <el-button plain size="small" type="success" @click="savaHandler">淇濆瓨</el-button> - <el-button plain size="small" type="primary" @click="syncHandler">鍚屾</el-button> + <el-button v-if="permissionList.saveBtn" plain size="small" type="success" @click="savaHandler">淇濆瓨</el-button> + <el-button v-if="permissionList.syncBtn" plain size="small" type="primary" @click="syncHandler">鍚屾</el-button> + <span style="width: 200px;display: inline-block"> + <el-select slot="prepend" v-model="searchSelect" placeholder="璇烽�夋嫨" size="small"> + <el-option v-for="item in searchData" :key="item.prop" :label="item.label" :value="item.prop" + ></el-option> + </el-select> + </span> + <span style="margin-left: 5px"> + <el-input v-model="searchValue" class="attrSearch" clearable placeholder="璇疯緭鍏ュ唴瀹�" + prefix-icon="el-icon-search" + size="small" type="text"></el-input> + <el-button v-if="permissionList.searchBtn" icon="el-icon-search" plain size="small" type="primary" + @click="searchHandler"> 鎼滅储</el-button> + </span> </template> </avue-crud> </basic-container> </template> <script> -import {getGroupAttrPoolALlList, editGroupAttr,syncGroupAttrMapping} from '@/api/vciAttrbute' +import {getGroupAttrPoolALlList, editGroupAttr, syncGroupAttrMapping} from '@/api/vciAttrbute' import {getPage} from "@/api/omd/OmdAttribute"; +import {mapGetters} from "vuex"; export default { name: "vciAttribute", data() { return { + searchSelect: "groupAttrKey", + searchValue: '', + searchData: [ + { + label: "闆嗗洟灞炴�х紪鍙�", + prop: "groupAttrKey", + align: "left", + display: false, + width: 200, + required: true + }, { + label: "闆嗗洟灞炴�у悕绉�", + prop: "groupAttrName", + align: "left", + display: false + } + ], data: [], options: { height: 'auto', @@ -55,6 +86,12 @@ type: 'select', cell: true, filterable: true, + change: (val) => { + if (!this.ChangeStatus) { + this.ChangeName = val.value + this.status = true; + } + }, props: { label: 'codeMetaAttrName', value: 'codeMetaAttrOid', @@ -68,32 +105,47 @@ currentPage: 1, total: 0 }, - selectList: [] + selectList: [], + ChangeName: '', + ChangeStatus: false } }, created() { - const params = { - 'conditionMap[groupAttrKey_like]': 'RY_', - page: this.page.currentPage, - limit: this.page.pageSize - } - this.onLoad(params) + this.onLoad() this.codeColumnOnload() }, computed: { codeMetaColumn() { return this.options.column.find(column => column.prop === 'codeMetaAttrName'); - } + }, + ...mapGetters(["permission"]), + permissionList() { + return { + saveBtn: this.vaildData(this.permission.vciAttribute.attribute_save, false), + syncBtn: this.vaildData(this.permission.vciAttribute.attribute_sync, false), + searchBtn: this.vaildData(this.permission.vciAttribute.attribute_search, false), + } + }, }, methods: { + searchHandler() { + console.log(this.searchSelect) + const params = { + [`conditionMap[${this.searchSelect}_like]`]: this.searchValue, + page: this.page.currentPage, + limit: this.page.pageSize + } + getGroupAttrPoolALlList(params).then(res => { + const data = res.data.data; + this.data = data.records; + this.page.total = data.total; + }) + }, codeMetaDis() { for (const item of this.data) { if (item.codeMetaAttrOid && item.codeMetaAttrKey && item.codeMetaAttrName) { - console.log(this.codeMetaColumn) - console.log(this.codeMetaColumn.dicData) if (this.codeMetaColumn.dicData.length >= 1) { const targetObject = this.codeMetaColumn.dicData.find(obj => obj.codeMetaAttrName === item.codeMetaAttrName); - console.log(targetObject) } // targetObject.disabled = true; } @@ -102,7 +154,11 @@ selectChange(list) { this.selectList = list; }, - async onLoad(params) { + async onLoad() { + const params = { + page: this.page.currentPage, + limit: this.page.pageSize + } getGroupAttrPoolALlList(params).then(res => { const data = res.data.data; this.data = data.records; @@ -132,12 +188,28 @@ done(); return; } + // row.codeMetaAttrName鍥犱负涓嬫媺妗唙alue鍊煎師鍥犵粦瀹氫负codeMetaAttrOid - const updataList = this.codeMetaColumn.dicData.find(item => item.codeMetaAttrOid === row.codeMetaAttrName) + let updataList = [] + // console.log(this.ChangeName) + // console.log(row.codeMetaAttrName) + // if (this.ChangeName && this.ChangeName === row.codeMetaAttrName) { + // updataList = this.codeMetaColumn.dicData.find(item => item.codeMetaAttrOid === row.codeMetaAttrOid) + // } else { + // console.log('2') + // updataList = this.codeMetaColumn.dicData.find(item => item.codeMetaAttrOid === row.codeMetaAttrName) + // } + updataList = this.codeMetaColumn.dicData.find(item => item.codeMetaAttrOid === row.codeMetaAttrName) // 鍥犱负row閲岄潰鐨勫�兼槸涓嶆纭殑 閲嶆柊璧嬪�间竴閬� - const {codeMetaAttrOid, codeMetaAttrKey, codeMetaAttrName} = updataList; - Object.assign(row, {codeMetaAttrOid, codeMetaAttrKey, codeMetaAttrName}); + if (updataList) { + const {codeMetaAttrOid, codeMetaAttrKey, codeMetaAttrName} = updataList; + Object.assign(row, { + codeMetaAttrOid: codeMetaAttrOid, + codeMetaAttrKey: codeMetaAttrKey.toLowerCase(), + codeMetaAttrName: codeMetaAttrName + }); + } const objet = { oid: row.oid, @@ -147,8 +219,9 @@ codeMetaAttrKey: row.codeMetaAttrKey, codeMetaAttrName: row.codeMetaAttrName } + const response = await editGroupAttr([objet]) - if (response.data.data.success) { + if (response.data.success) { this.$message.success('淇濆瓨鎴愬姛锛�') } done() @@ -159,35 +232,47 @@ } else { const hasTrueValue = this.selectList.some(item => !item.$cellEdit); if (hasTrueValue) { - this.$message.warning('璇峰紑鍚紪杈戝悗淇濆瓨锛�') - } else { - let saveList = [] - for (const item of this.selectList) { - const updataList = this.codeMetaColumn.dicData.find(p => p.codeMetaAttrOid === item.codeMetaAttrName); - const {codeMetaAttrOid, codeMetaAttrKey, codeMetaAttrName} = updataList; - Object.assign(item, {codeMetaAttrOid, codeMetaAttrKey, codeMetaAttrName}); - - item.$cellEdit = false; - saveList.push({ - oid: item.oid, - groupAttrKey: item.groupAttrKey, - groupAttrName: item.groupAttrName, - codeMetaAttrOid: item.codeMetaAttrOid, - codeMetaAttrKey: item.codeMetaAttrKey, - codeMetaAttrName: item.codeMetaAttrName - }) - } - const response = await editGroupAttr(saveList) - if (response.data.data.success) { - this.$message.success('淇濆瓨鎴愬姛锛�') - } + this.$message.warning('璇峰紑鍚紪杈戝悗杩涜淇濆瓨锛�') + return } + const codeMetaInput = this.selectList.some(item => item.codeMetaAttrName === ""); + if (codeMetaInput) { + this.$message.warning('璇锋鏌ュ凡鍕鹃�夋暟鎹腑鏄惁瀛樺湪鏈�夋嫨鐨勯」锛�'); + return + } + let saveList = [] + for (const item of this.selectList) { + const updataList = this.codeMetaColumn.dicData.find(column => column.codeMetaAttrOid === item.codeMetaAttrName); + if (updataList) { + const {codeMetaAttrOid, codeMetaAttrKey, codeMetaAttrName} = updataList; + Object.assign(item, { + codeMetaAttrOid: codeMetaAttrOid, + codeMetaAttrKey: codeMetaAttrKey.toLowerCase(), + codeMetaAttrName: codeMetaAttrName + }); + } + item.$cellEdit = false; + saveList.push({ + oid: item.oid, + groupAttrKey: item.groupAttrKey, + groupAttrName: item.groupAttrName, + codeMetaAttrOid: item.codeMetaAttrOid, + codeMetaAttrKey: item.codeMetaAttrKey, + codeMetaAttrName: item.codeMetaAttrName + }) + } + const response = await editGroupAttr(saveList) + if (response.data.success) { + this.$message.success('淇濆瓨鎴愬姛锛�') + await this.onLoad() + } + } }, - async syncHandler(){ - if(this.selectList.length <= 0){ + async syncHandler() { + if (this.selectList.length <= 0) { this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹繘琛屽悓姝ワ紒') - }else { + } else { const syncList = []; for (const item of this.selectList) { syncList.push({ @@ -196,28 +281,22 @@ }) } const response = await syncGroupAttrMapping(syncList) - if(response.data.success){ - this.$message.success(response.data.msg) + if (response.data.success) { + this.$message.success(response.data.msg); + + await this.onLoad() } } }, currentChange(currentPage) { this.page.currentPage = currentPage; - const params = { - 'conditionMap[groupAttrKey_like]': 'RY_', - page: this.page.currentPage, - limit: this.page.pageSize - } - this.onLoad(params) + + this.onLoad() }, sizeChange(pageSize) { this.page.pageSize = pageSize; - const params = { - 'conditionMap[groupAttrKey_like]': 'RY_', - page: this.page.currentPage, - limit: this.page.pageSize - } - this.onLoad(params) + + this.onLoad() }, } } -- Gitblit v1.9.3