From e7e36855180394b3004a610d70f92f7239925bbc Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期五, 01 十二月 2023 18:42:54 +0800 Subject: [PATCH] 规则基础配置模块代码上传 --- Source/UBCS-WEB/src/views/ruleBasic/usableCharacter.vue | 213 ++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 147 insertions(+), 66 deletions(-) diff --git a/Source/UBCS-WEB/src/views/ruleBasic/usableCharacter.vue b/Source/UBCS-WEB/src/views/ruleBasic/usableCharacter.vue index 0ac88fd..fc533eb 100644 --- a/Source/UBCS-WEB/src/views/ruleBasic/usableCharacter.vue +++ b/Source/UBCS-WEB/src/views/ruleBasic/usableCharacter.vue @@ -4,7 +4,8 @@ <el-header> <div style="margin-bottom: 15px"> 缂栫爜瑙勫垯锛� - <el-select v-model="select" filterable :filter-method="filterValue" placeholder="璇烽�夋嫨" size="small" @click="selectHandler"> + <el-select v-model="select" :filter-method="filterValue" filterable placeholder="璇烽�夋嫨" size="small" + @change="selectHandler"> <el-option v-for="(item,index) in queryReleasedList" :key="item.oid" :label="item.name" @@ -14,6 +15,7 @@ </el-header> <el-main> <el-table + v-loading="loading" :data="tableData" :header-cell-style="{background:'#FAFAFA',color:'#505050'}" border @@ -22,79 +24,79 @@ <el-table-column align="center" label="1" - prop="aa" + prop="1" > </el-table-column> <el-table-column align="center" label="2" - prop="b" + prop="2" > </el-table-column> <el-table-column align="center" label="3" - prop="c"> + prop="3"> </el-table-column> <el-table-column align="center" label="4" - prop="d"> + prop="4"> </el-table-column> <el-table-column align="center" label="5" - prop="e"> + prop="5"> </el-table-column> <el-table-column align="center" label="6" - prop="f"> + prop="6"> </el-table-column> <el-table-column align="center" label="7" - prop="g"> + prop="7"> </el-table-column> <el-table-column align="center" label="8" - prop="h"> + prop="8"> </el-table-column> <el-table-column align="center" label="9" - prop="i"> + prop="9"> </el-table-column> <el-table-column align="center" label="10" - prop="j"> + prop="10"> </el-table-column> <el-table-column align="center" label="11" - prop="k"> + prop="11"> </el-table-column> <el-table-column align="center" label="12" - prop="l"> + prop="12"> </el-table-column> <el-table-column align="center" label="13" - prop="m"> + prop="13"> </el-table-column> <el-table-column align="center" label="14" - prop="n"> + prop="14"> </el-table-column> <el-table-column align="center" label="15" - prop="o"> + prop="15"> </el-table-column> </el-table> </el-main> @@ -105,83 +107,63 @@ </div> </el-footer> <div style="margin-bottom: 10px;text-align: center"> - <el-button icon="el-icon-plus" plain size="small" type="success">娣诲姞</el-button> - <el-button icon="el-icon-edit" plain size="small" type="primary">淇敼</el-button> - <el-button icon="el-icon-delete" plain size="small" type="danger">鍒犻櫎</el-button> + <el-button icon="el-icon-plus" plain size="small" type="success" @click="addSaveHandler">娣诲姞</el-button> + <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editSaveHandler">淇敼</el-button> + <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delSaveHandler">鍒犻櫎</el-button> </div> </basic-container> </template> <script> -import {getList} from "@/api/code/codeCharcter" +import {getList, addSave, editSave, deleteSave} from "@/api/code/codeCharcter" import {gridCodeRule} from "@/api/code/codeCharcter" export default { name: "usableCharacter", data() { return { + loading: false, //涓嬫媺妗嗘暟缁� - queryReleasedList:[], + queryReleasedList: [], //涓嬫媺妗嗗垵濮嬫暟鎹暟缁� characterReleasedList: [], characterValue: "", - tableData: [ - { - aa: 'a1', - b: 'b1', - c: 'c1', - d: 'd1', - e: 'e1', - f: 'f1', - g: 'b1', - h: 'c1', - i: 'd1', - j: 'e1', - k: 'f1', - l: 'a1', - m: 'b1', - n: 'c1', - o: 'd1', - }, - { - aa: 'a2', - b: 'b2', - c: 'c2', - d: 'd2', - e: 'e2', - f: 'f2' - }, - ], + characterEditOldValue: "", + tableData: [], select: "", + selectValue: "" } }, - watch:{ - select:{ - handler(newV){ + watch: { + select: { + handler(newV) { // console.log(newV) } } }, created() { - getList({codeRuleId:"1717377846655193088",chartType:"charset",chartValue:"鏍囧噯瑙勫垯"}).then(res=>{ - console.log(res) - }) - this.getCodeRule() + this.getCodeRule(); }, methods: { cellClickHandler(row, column) { - console.log(row) - console.log(column) - console.log(row[column.property]) - this.characterValue = row[column.property] + this.characterValue = row[column.property]; + this.characterEditOldValue = row[column.property] }, - getCodeRule() { - //缂栫爜瑙勫垯宸插彂甯冩暟鎹簮 - gridCodeRule({["conditionMap" + "[lcStatus_like]"]: "Released"}).then(res => { + async getCodeRule() { + try { + // 缂栫爜瑙勫垯宸插彂甯冩暟鎹簮 + const res = await gridCodeRule({["conditionMap" + "[lcStatus_like]"]: "Released"}); this.characterReleasedList = res.data.data.records; this.queryReleasedList = this.characterReleasedList; - this.select = this.characterReleasedList[0].name; - }) + this.select = this.characterReleasedList[0].oid; + this.loading = true; + const res2 = await getList({codeRuleId: this.select, chartType: "charset", chartValue: this.characterValue}); + this.tableData = res2.data.data; + this.loading = false; + // console.log("this.tableData", this.tableData); + } catch (error) { + this.$message.warning(error) + } }, //缂栫爜瑙勫垯涓嬫媺妗嗘悳绱� filterValue(query) { @@ -194,8 +176,107 @@ this.queryReleasedList = this.characterReleasedList; } }, - selectHandler(val){ - console.log(1) + selectHandler(val) { + this.selectValue = val; + this.characterValue = "" + this.getTableData() + }, + getTableData() { + this.loading = true; + // const targetObject = this.characterReleasedList.find(obj => obj.oid === this.selectValue); + // const chartValue = targetObject.name; + getList({codeRuleId: this.select, chartType: "charset", chartValue: this.characterValue}).then(res => { + console.log(res.data.data); + this.tableData = res.data.data; + this.loading = false; + }); + }, + addSaveHandler() { + if (!this.characterValue) { + this.$message.warning('璇峰~鍐欒娣诲姞鐨勫�硷紒'); + return; // 鍒ゆ柇杈撳叆鍊� + } + + const targetObject = this.characterReleasedList.find(obj => obj.oid === this.select); + if (!targetObject) { + return; // 鏌ユ壘瀵瑰簲typeText + } + + const codeRuleCharacterVO = { + codeRuleId: this.select, + chartType: "charset", + chartValue: this.characterValue, + chartTypeText: targetObject.name + }; + + addSave(codeRuleCharacterVO) + .then(res => { + this.$message.success(res.data.msg); + this.characterValue = ""; + this.getTableData(); + }).catch(error => { + this.$message.error('娣诲姞澶辫触'); + }); + }, + editSaveHandler() { + if (this.characterEditOldValue === "") { + this.$message.warning('璇烽�夋嫨淇敼鐨勫�硷紒'); + return; // 鍒ゆ柇閫夋嫨鍊� + } + + if (this.characterValue === "") { + this.$message.warning('璇峰~鍐欒淇敼鐨勫�硷紒'); + return; // 鍒ゆ柇杈撳叆鍊� + } + + const targetObject = this.characterReleasedList.find(obj => obj.oid === this.select); + if (!targetObject) { + return; // 鏌ユ壘瀵瑰簲typeText + } + + const codeRuleCharacterVO = { + codeRuleId: this.select, + chartType: "charset", + chartValue: this.characterValue, + oldChartValue: this.characterEditOldValue, + chartTypeText: targetObject.name + }; + + editSave(codeRuleCharacterVO) + .then(res => { + this.$message.success(res.data.msg); + this.characterValue = ""; + this.getTableData(); + }).catch(error => { + this.$message.error('淇敼澶辫触'); + }); + }, + delSaveHandler() { + //鍒ゆ柇閫夋嫨鏁版嵁characterEditOldValue + if (this.characterEditOldValue === "" || this.characterValue === "") { + this.$message.warning('璇烽�夋嫨瑕佸垹闄ょ殑鍊�'); + return; + } + + const targetObject = this.characterReleasedList.find(obj => obj.oid === this.select); + if (!targetObject) { + return; // 鏌ユ壘瀵瑰簲typeText + } + const codeRuleCharacterVO = { + codeRuleId: this.select, + chartType: "charset", + chartValue: this.characterValue, + chartTypeText: targetObject.name + }; + + deleteSave(codeRuleCharacterVO) + .then(res => { + this.$message.success(res.data.msg); + this.characterValue = ""; + this.getTableData(); + }).catch(error => { + this.$message.error('鍒犻櫎澶辫触'); + }); } } } -- Gitblit v1.9.3