From a56c7f5fbe4b171a82561dce3b3b0ff6c5c30386 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期一, 22 一月 2024 17:30:58 +0800 Subject: [PATCH] 可用字符集,前后缀,应用,可以用字符集接口下拉和正则接口提交 --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleCharacterService.java | 19 + Source/UBCS-WEB/src/views/ruleBasic/delimiterConfig.vue | 4 Source/UBCS-WEB/src/views/code/code.vue | 174 ++++++++++----- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeFixedValueController.java | 3 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeFixedValueServiceImpl.java | 3 Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue | 53 ++-- Source/UBCS-WEB/vue.config.js | 4 Source/UBCS-WEB/src/views/ruleBasic/paddingCharacter.vue | 6 Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue | 289 +++++++++++++------------ Source/UBCS-WEB/src/api/code/codeCharcter.js | 16 + Source/UBCS-WEB/src/views/ruleBasic/usableCharacter.vue | 4 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleCharacterServiceImpl.java | 46 +++ Source/UBCS-WEB/src/views/ruleBasic/prefixConfig.vue | 10 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleCharacterController.java | 23 ++ 14 files changed, 412 insertions(+), 242 deletions(-) diff --git a/Source/UBCS-WEB/src/api/code/codeCharcter.js b/Source/UBCS-WEB/src/api/code/codeCharcter.js index 3dd0f56..27dbabb 100644 --- a/Source/UBCS-WEB/src/api/code/codeCharcter.js +++ b/Source/UBCS-WEB/src/api/code/codeCharcter.js @@ -10,13 +10,23 @@ }) } -export const gridCodeRule = (params) => { +export const getRegexStr = (params) => { return request({ - url: '/api/ubcs-code/mdmRule/gridCodeRule', + url: '/api/ubcs-code/codeRuleCharacterController/getRegexStr', method: 'get', params: { ...params, - }, + } + }) +} + +export const getSelectList = (params) => { + return request({ + url: '/api/ubcs-code/codeRuleCharacterController/selectList', + method: 'get', + params: { + ...params, + } }) } diff --git a/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue b/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue index d161011..cedd531 100644 --- a/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue +++ b/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue @@ -6,7 +6,9 @@ append-to-body class="avue-dialog avue-dialog--top" title="鍒嗙被鎺堟潈" - top="-45px" @close="closeDialog"> + top="-45px" + @close="closeDialog" + > <el-table :key="itemKey" ref="dataTable" @@ -20,10 +22,7 @@ @select-all="handleSelectionAll" @selection-change="handleSelectionChange" > - <el-table-column - type="selection" - width="55" - ></el-table-column> + <el-table-column type="selection" width="55"></el-table-column> <el-table-column v-for="(item, index) in classifyAuthHeader" v-if="classifyAuthHeader.length !== 0" @@ -39,7 +38,7 @@ v-if="item.type === 'select'" slot="prepend" v-model="row[item.prop]" - @change="selectChange(row.roleData,row)" + @change="selectChange(row.roleData, row)" > <el-option v-for="optionItem in roleList" @@ -59,26 +58,43 @@ <el-checkbox v-if="item.type === 'checkbox'" v-model="row[item.prop]" - :disabled="row.allDisabled ? true :row[item.code]"> + :disabled="row.authButton.allDisabled ? true : row.authButton[item.code]" + > </el-checkbox> </template> </el-table-column> </el-table> <div slot="footer" class="dialog-footer"> <el-button plain type="info" @click="selectAllButton">鎸夐挳鍏ㄩ��</el-button> - <el-button class="el-icon-plus" plain type="success" @click="addClassifyAuth"></el-button> - <el-button class="el-icon-minus" plain type="warning" @click="subClassifyAuth"></el-button> + <el-button + class="el-icon-plus" + plain + type="success" + @click="addClassifyAuth" + ></el-button> + <el-button + class="el-icon-minus" + plain + type="warning" + @click="subClassifyAuth" + ></el-button> <el-button plain type="primary" @click="submit">鎻� 浜�</el-button> - <el-button plain type="danger" @click="isShowDialog = false">鍏� 闂�</el-button> + <el-button plain type="danger" @click="isShowDialog = false" + >鍏� 闂�</el-button + > </div> </el-dialog> </template> <script> -import {getButtonByParentCode} from "@/api/system/menu" -import {getPage} from "@/api/system/role" -import {saveOrUpdate, getClassifyAuthList, getButtonsByRoleId} from "@/api/system/classifyAuth" -import {v4 as uuidv4} from 'uuid'; +import { getButtonByParentCode } from "@/api/system/menu"; +import { getPage } from "@/api/system/role"; +import { + saveOrUpdate, + getClassifyAuthList, + getButtonsByRoleId, +} from "@/api/system/classifyAuth"; +import { v4 as uuidv4 } from "uuid"; export default { name: "classifyAuthDialog.vue", @@ -98,7 +114,7 @@ // 瀵硅瘽妗嗘樉绀烘帶鍒� isShowDialog: this.visible, isLoading: false, - tableHeight: 'calc(100vh - 550px)', + tableHeight: "calc(100vh - 550px)", classifyAuthData: [], //鍒楀ご classifyAuthHeader: [], @@ -108,62 +124,65 @@ roleList: [], //褰撳墠閫変腑鐨勮〃鏍艰 selectList: [], - itemKey: '', + itemKey: "", addIndex: Number, - currentRow: {} + currentRow: {}, }; }, computed: {}, - mounted() { - }, - created() { - }, + mounted() {}, + created() {}, watch: { // 鐩戝惉鐖剁粍浠朵紶鐨勭獥鍙f樉绀洪殣钘忕殑鍊� visible() { if (this.visible) { this.isShowDialog = this.visible; return new Promise((resolve, reject) => { - getButtonByParentCode({code: "classifyTree"}).then(res => { - // 璁板綍鎸夐挳鏁版嵁 - this.classifyAuthButton = res.data.data; - const list = res.data.data; - let tempData = []; - // 瑙掕壊鍒� - tempData.push({ - label: "瑙掕壊", - prop: "roleData", - type: "select", - width: 150, - }); - // 缂栫爜椤瑰垎绫绘巿鏉� - tempData.push({ - label: "缂栫爜椤瑰垎绫绘巿鏉�", - prop: "classifyItem", - type: "text", - width: 180, - }); - list.forEach(item => { - let columnItem = { - label: item.name, - prop: item.id, - code: item.code, - type: "checkbox", + getButtonByParentCode({ code: "classifyTree" }) + .then((res) => { + // 璁板綍鎸夐挳鏁版嵁 + this.classifyAuthButton = res.data.data; + const list = res.data.data; + let tempData = []; + // 瑙掕壊鍒� + tempData.push({ + label: "瑙掕壊", + prop: "roleData", + type: "select", + width: 150, + }); + // 缂栫爜椤瑰垎绫绘巿鏉� + tempData.push({ + label: "缂栫爜椤瑰垎绫绘巿鏉�", + prop: "classifyItem", + type: "text", width: 180, - }; - tempData.push(columnItem); + }); + list.forEach((item) => { + let columnItem = { + label: item.name, + prop: item.id, + code: item.code, + type: "checkbox", + width: 180, + }; + tempData.push(columnItem); + }); + this.classifyAuthHeader = tempData; + resolve(); }) - this.classifyAuthHeader = tempData; - resolve(); - }).catch(err => { - reject(err) - }); + .catch((err) => { + reject(err); + }); // 鑾峰彇瑙掕壊鍒楄〃 - getPage(1, -1, null).then(res => { + getPage(1, -1, null).then((res) => { this.roleList = res.data.data.records; }); // 鑾峰彇璇ュ垎绫讳笅宸叉巿鏉冪殑鍒嗙被鎺堟潈淇℃伅 - getClassifyAuthList({classifyId: this.classifyData.oid, authType: "classify_auth"}).then(res => { + getClassifyAuthList({ + classifyId: this.classifyData.oid, + authType: "classify_auth", + }).then((res) => { //console.log(res.data.data); let authDatas = res.data.data; if (authDatas.length > 0) { @@ -172,18 +191,19 @@ oid: authData.oid, roleData: authData.roleId, classifyItem: this.classifyData.label, + authButton:{}, index: index, - uuid: uuidv4(),//鐢熸垚鍞竴鐨刬d - } + uuid: uuidv4(), //鐢熸垚鍞竴鐨刬d + }; //灏嗘寜閽缃繘鍘� - authData.buttonIdList.forEach(data => { + authData.buttonIdList.forEach((data) => { Vue.set(item, data, true); }); this.classifyAuthData.push(item); this.addIndex = this.classifyAuthData.length - 1; //娣诲姞琛屼笅鏍囩瓑浜巆lassifyAuthData鐨勯暱搴�-1 - this.roleHandlerMethods(authData.roleId, 'create', index) + this.roleHandlerMethods(authData.roleId, "create", index); // console.log('index', index) - }) + }); } }); }); @@ -196,87 +216,77 @@ return; } - getButtonsByRoleId({roleId: id, code: 'classifyTree'}).then(res => { + getButtonsByRoleId({ roleId: id, code: "classifyTree" }).then((res) => { // 鎵惧埌this.classifyAuthButton涓病鏈夊搴旂殑灞炴�� - const filteredItems = this.classifyAuthButton.filter(item => { - return !res.data.data.find(x => x.id === item.id); + const filteredItems = this.classifyAuthButton.filter((item) => { + return !res.data.data.find((x) => x.id === item.id); }); - // console.log('绂佺敤鎸夐挳',filteredItems) - // console.log('涓嶇鐢ㄦ寜閽�',res.data.data) - //鎷胯〃鏍煎垪澶村惊鐜拰娌℃湁瀵瑰簲鐨勫睘鎬ц繘琛屾瘮杈� + this.classifyAuthHeader.forEach((item) => { - const isMatched = filteredItems.some(x => x.id === item.prop); - if (isMatched) { - this.$nextTick(() => { - if (this.classifyAuthData[index]) { + const isMatched = filteredItems.some((x) => x.id === item.prop); + this.$nextTick(() => { + if (this.classifyAuthData[index]) { + if (isMatched) { Object.keys(this.classifyAuthData[index]).forEach((key) => { - - if (this.classifyAuthData[index].classify_view) { - this.$set(this.classifyAuthData[index], item.code, true); - } else { - this.classifyAuthData[index][item.code] = false; - } - // console.log(item.code) - // this.$set(this.classifyAuthData[index], item.code, true); - + this.$set(this.classifyAuthData[index].authButton,item.code,true); + }); + } else { + Object.keys(this.classifyAuthData[index]).forEach((key) => { + this.$set(this.classifyAuthData[index].authButton,item.code,false); }); } - }) - } else { - this.$nextTick(() => { - if (this.classifyAuthData[index]) { - Object.keys(this.classifyAuthData[index]).forEach((key) => { - if (item.prop === key) { - this.$set(this.classifyAuthData[index], item.code, false); - } - }); - } - }) - } + } + }); }); //娣诲姞 鈥滄煡鐪嬪叏閮ㄧ鐢ㄦ潯浠垛�� - this.classifyAuthData.forEach((classkey, classIndex) => { - if (classkey.classify_view) { - this.$set(this.classifyAuthData[classIndex], 'allDisabled', true) - } else { - this.classifyAuthData[classIndex].allDisabled = false; - } - }); - // console.log('classifyAuthData',this.classifyAuthData) + if (this.classifyAuthData.authButton) { + this.classifyAuthData.forEach((classkey, classIndex) => { + if (classkey.authButton.classify_view) { + this.$set(this.classifyAuthData[classIndex].authButton,"allDisabled",true); + } else { + this.classifyAuthData[classIndex].authButton.allDisabled = false; + } + }); + } + //寮哄埗鍒锋柊琛ㄦ牸 this.itemKey = uuidv4(); - }) + }); }, async selectChange(row, currentRow) { try { this.currentRow = currentRow; - const res = await getButtonsByRoleId({roleId: row, code: 'classifyTree'}); - - const filteredItems = this.classifyAuthButton.filter(item => { - return !res.data.data.find(x => x.id === item.id); + const res = await getButtonsByRoleId({ + roleId: row, + code: "classifyTree", }); - this.classifyAuthHeader.forEach(item => { - const isMatched = filteredItems.some(x => x.id === item.prop); + const filteredItems = this.classifyAuthButton.filter((item) => { + return !res.data.data.find((x) => x.id === item.id); + }); + + this.classifyAuthHeader.forEach((item) => { + const isMatched = filteredItems.some((x) => x.id === item.prop); this.$nextTick(() => { if (currentRow) { if (isMatched) { - Object.keys(currentRow).forEach(key => { - currentRow[item.code] = item.prop === key ? false : true; - if (!currentRow.classify_view) { - currentRow.allDisabled = false; + Object.keys(currentRow).forEach((key) => { + currentRow.authButton[item.code] = true; + if (!currentRow.authButton.classify_view) { + currentRow.authButton.allDisabled = false; } }); } else { - Object.keys(currentRow).forEach(key => { - currentRow[item.code] = item.prop === key ? true : false; - if (!currentRow.classify_view) { - currentRow.allDisabled = false; + Object.keys(currentRow).forEach((key) => { + currentRow.authButton[item.code] = false; + if (!currentRow.authButton.classify_view) { + currentRow.authButton.allDisabled = false; } }); } } + this.itemKey = uuidv4(); // 寮哄埗鍒锋柊琛ㄦ牸 }); }); @@ -286,7 +296,7 @@ }, // 鍏抽棴瀵硅瘽妗� closeDialog() { - this.$emit('update:visible', false); + this.$emit("update:visible", false); this.classifyAuthData = []; }, // 澧炲姞琛� @@ -300,20 +310,23 @@ let item = { roleData: this.roleList[0].id, classifyItem: this.classifyData.label, + authButton:{}, index: this.addIndex, - uuid: uuidv4(),//鐢熸垚鍞竴鐨刬d - } + uuid: uuidv4(), //鐢熸垚鍞竴鐨刬d + }; //灏嗘寜閽缃繘鍘� - this.classifyAuthButton.forEach(data => { + this.classifyAuthButton.forEach((data) => { Vue.set(item, data.id, false); - }) + }); this.classifyAuthData.push(item); - this.roleHandlerMethods(this.roleList[0].id, 'add', this.addIndex) + this.roleHandlerMethods(this.roleList[0].id, "add", this.addIndex); }, // 鍒犻櫎琛� subClassifyAuth() { for (let item of this.selectList) { - let index = this.classifyAuthData.findIndex(data => data.index === item.index); + let index = this.classifyAuthData.findIndex( + (data) => data.index === item.index + ); if (index !== -1) { this.classifyAuthData.splice(index, 1); } @@ -335,7 +348,7 @@ // 淇濆瓨鍒嗙被鎺堟潈淇℃伅 submit() { if (this.classifyAuthData.length <= 0) { - this.$message.warning('鎺堟潈鍒楄〃涓虹┖锛�') + this.$message.warning("鎺堟潈鍒楄〃涓虹┖锛�"); return; } let isRepeat = false; @@ -358,7 +371,7 @@ } let form = []; let flag = false; - this.classifyAuthData.forEach(item => { + this.classifyAuthData.forEach((item) => { let itemButtonList = []; //绛涢�夊嚭鎸夐挳鍕鹃�変负true鐨勫垪 for (let key in item) { @@ -378,24 +391,27 @@ classifyId: this.classifyData.oid, buttonIds: itemButtonList.join(","), authType: "classify_auth", - } + }; form.push(data); }); if (flag) { - this.$message.warning('鏈夋湭鍕鹃�夋搷浣滅殑鏉冮檺锛屼笉鍏佽鎺堟潈') + this.$message.warning("鏈夋湭鍕鹃�夋搷浣滅殑鏉冮檺锛屼笉鍏佽鎺堟潈"); return; } // console.log(form) // 璋冪敤淇濆瓨鍒嗙被鎺堟潈鐨勬帴鍙� - saveOrUpdate(form).then(res => { - this.$message({ - type: "success", - message: res.data.msg, - }); - // this.isShowDialog = false - }, (error) => { - window.console.log(error); - }) + saveOrUpdate(form).then( + (res) => { + this.$message({ + type: "success", + message: res.data.msg, + }); + // this.isShowDialog = false + }, + (error) => { + window.console.log(error); + } + ); }, // 鍏ㄩ�夋寜閽� selectAllButton() { @@ -403,7 +419,7 @@ this.$message.warning("璇峰彧閫夋嫨涓�琛岄渶瑕佸叏閫夌殑鎸夐挳鐨勬暟鎹锛�"); return; } - this.classifyAuthButton.forEach(item => { + this.classifyAuthButton.forEach((item) => { //console.log("item",item); Vue.set(this.selectList[0], item.id, true); }); @@ -414,7 +430,6 @@ </script> <style lang="scss" scoped> - // 婊氬姩鏉℃牱寮忎慨鏀� // 婊氬姩鏉$殑瀹藉害 /deep/ .el-table__body-wrapper::-webkit-scrollbar { @@ -422,7 +437,6 @@ background: white; border: white; width: 10px; - } // 婊氬姩鏉$殑婊戝潡 @@ -435,5 +449,4 @@ /deep/ .el-table__body-wrapper { height: calc(100% - 50px) !important; } - </style> diff --git a/Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue b/Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue index d4a3eec..334cab8 100644 --- a/Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue +++ b/Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue @@ -60,7 +60,7 @@ <el-checkbox v-if="item.type === 'checkbox'" v-model="row[item.prop]" - :disabled="row.allDisabled ? true :row[item.code]"> + :disabled="row.authButton.allDisabled ? true : row.authButton[item.code]"> </el-checkbox> </template> </el-table-column> @@ -172,6 +172,7 @@ roleData: authData.roleId, classifyItem: this.classifyData.label, index: index, + authButton:{}, uuid: uuidv4(),//鐢熸垚鍞竴鐨刬d } //灏嗘寜閽缃繘鍘� @@ -179,7 +180,7 @@ Vue.set(item, data, true); }); this.classifyAuthData.push(item); - this.addIndex = this.classifyAuthData.length - 1; //娣诲姞琛屼笅鏍囩瓑浜巆lassifyAuthData鐨勯暱搴�-1 + this.addIndex = this.classifyAuthData.length - 1; //娣诲姞琛屼笅鏍囩瓑浜巆lassifyAuthData鐨勯暱搴�-1 this.roleHandlerMethods(authData.roleId, 'create', index) }) } @@ -209,26 +210,33 @@ !res.data.data.some(x => x.id === item.id) ); //鍜岃〃鏍煎垪杩涜瀵规瘮 - this.classifyAuthHeader.forEach(item => { - const isMatched = filteredItems.some(x => x.id === item.prop); + this.classifyAuthHeader.forEach((item) => { + const isMatched = filteredItems.some((x) => x.id === item.prop); this.$nextTick(() => { - if (this.classifyAuthData[index] && item.prop in this.classifyAuthData[index]) { + if (this.classifyAuthData[index]) { if (isMatched) { - this.$set(this.classifyAuthData[index], item.code, this.classifyAuthData[index].classify_view); + Object.keys(this.classifyAuthData[index]).forEach((key) => { + this.$set(this.classifyAuthData[index].authButton,item.code,true); + }); } else { - this.$set(this.classifyAuthData[index], item.code, false); + Object.keys(this.classifyAuthData[index]).forEach((key) => { + this.$set(this.classifyAuthData[index].authButton,item.code,false); + }); } } }); }); + //娣诲姞鈥樻煡鐪嬧�欑鐢� - this.classifyAuthData.forEach((classkey, classIndex) => { - if (classkey.classify_view) { - this.$set(this.classifyAuthData[classIndex], 'allDisabled', true); - } else { - this.$set(this.classifyAuthData[classIndex], 'allDisabled', false); - } - }); + if (this.classifyAuthData.authButton) { + this.classifyAuthData.forEach((classkey, classIndex) => { + if (classkey.authButton.classify_view) { + this.$set(this.classifyAuthData[classIndex].authButton,"allDisabled",true); + } else { + this.classifyAuthData[classIndex].authButton.allDisabled = false; + } + }); + } //寮哄埗鍒锋柊琛ㄦ牸 this.itemKey = uuidv4(); }); @@ -248,17 +256,17 @@ this.$nextTick(() => { if (currentRow) { if (isMatched) { - Object.keys(currentRow).forEach(key => { - currentRow[item.code] = item.prop === key ? false : true; - if (!currentRow.classify_view) { - currentRow.allDisabled = false; + Object.keys(currentRow).forEach((key) => { + currentRow.authButton[item.code] = true; + if (!currentRow.authButton.classify_view) { + currentRow.authButton.allDisabled = false; } }); } else { - Object.keys(currentRow).forEach(key => { - currentRow[item.code] = item.prop === key ? true : false; - if (!currentRow.classify_view) { - currentRow.allDisabled = false; + Object.keys(currentRow).forEach((key) => { + currentRow.authButton[item.code] = false; + if (!currentRow.authButton.classify_view) { + currentRow.authButton.allDisabled = false; } }); } @@ -280,6 +288,7 @@ let item = { roleData: this.roleList[0].id, classifyItem: this.classifyData.label, + authButton:{}, uuid: uuidv4(),//鐢熸垚鍞竴鐨刬d, index: this.addIndex, } diff --git a/Source/UBCS-WEB/src/views/code/code.vue b/Source/UBCS-WEB/src/views/code/code.vue index 652c87d..8847b03 100644 --- a/Source/UBCS-WEB/src/views/code/code.vue +++ b/Source/UBCS-WEB/src/views/code/code.vue @@ -404,9 +404,7 @@ margin-top: 20px; display: flex; align-items: center; - justify-content: center; - " - > + justify-content: center;"> <el-button class="button" icon="el-icon-circle-plus" @@ -642,19 +640,35 @@ <el-form-item :label-width="leftFormLabelWidth" label="鍓嶇紑:"> - <el-input + <!-- <el-input v-model="form.prefixCode" :readonly="basicSecOnlyRead" - ></el-input> + ></el-input> --> + <el-select v-model="form.prefixCode" :disabled="basicSecOnlyRead"> + <el-option + v-for="(option, index) in preFixOrSuffixChars" + :key="index" + :label="option.label" + :value="option.value"> + </el-option> + </el-select> </el-form-item> <el-form-item :label-width="leftFormLabelWidth" label="鍚庣紑:"> - <el-input + <!-- <el-input v-model="form.suffixCode" :readonly="basicSecOnlyRead"> - </el-input> + </el-input> --> + <el-select v-model="form.suffixCode" :disabled="basicSecOnlyRead"> + <el-option + v-for="(option, index) in preFixOrSuffixChars" + :key="index" + :label="option.label" + :value="option.value"> + </el-option> + </el-select> </el-form-item> <el-form-item :label-width="leftFormLabelWidth" label="鎻忚堪:"> @@ -838,13 +852,12 @@ :disabled="basicSecOnlyRead" filterable placeholder="璇烽�夋嫨" - @blur="inputSelectBlur" > <el-option v-for="item in enumParam.codeFillSeparator" - :key="item.dictKey" - :label="item.dictValue" - :value="item.dictValue" + :key="item.lable" + :label="item.lable" + :value="item.value" > </el-option> </el-select> @@ -1144,13 +1157,12 @@ :disabled="basicSecOnlyRead" filterable placeholder="璇烽�夋嫨" - @blur="inputSelectBlur" > <el-option v-for="item in enumParam.codeFillSeparator" - :key="item.dictKey" - :label="item.dictValue" - :value="item.dictValue" + :key="item.lable" + :label="item.lable" + :value="item.value" > </el-option> </el-select> @@ -1333,8 +1345,9 @@ deleteCodeClassifyValue, saveCodeClassifyValueOrder, } from "@/api/code/codeClassifyValue"; +import { getSelectList, getRegexStr } from "@/api/code/codeCharcter" import {getDictionary} from "@/api/omd/enum"; -import {getDictionaryBiz} from "@/api/system/dictbiz"; +// import {getDictionaryBiz} from "@/api/system/dictbiz"; import optionBasic from "@/const/code/codebasic"; import optionRule from "@/const/code/mdmrule"; import attrOption from "@/const/code/selectAttrOptionDialog"; @@ -1682,6 +1695,9 @@ //寮曠敤鐮佹涓弬鐓ч厤缃粍浠剁浉鍏冲弬鏁� referConfigOption: {}, referConfigVisble: false, + + preFixOrSuffixChars: [], //鍓嶅悗缂�瀛楃鍒楄〃 + }; }, computed: { @@ -2001,9 +2017,12 @@ this.codeFixdForm.codeFixedSecOid = row.codefixedsecoid; }, /** 鏂板鐮佸��*/ - addCodeSecValue(condition) { + async addCodeSecValue(condition) { if (condition === "codefixedsec") { if (!this.tipsCodeSecValueMessage(this.codeFixdForm.id)) { + return; + } + if(!await this.regexCharacter(this.codeFixdForm.id)){ return; } this.codeFixdForm.codeFixedSecOid = this.codefixedsecOrCodeclassifysec.oid; @@ -2028,6 +2047,9 @@ if (!this.tipsCodeSecValueMessage(this.codeClassifyForm.id)) { return; } + if(!await this.regexCharacter(this.codeClassifyForm.id)){ + return; + } this.codeClassifyForm.codeClassifySecOid = this.codefixedsecOrCodeclassifysec.oid; addSaveCodeClassifyValue(this.codeClassifyForm).then( @@ -2050,39 +2072,13 @@ ); } }, - /** 娓呯┖鐮佸�艰〃鍗� */ - clearFixedOrClassifyForm(condition) { - //鐐瑰嚮鍙栨秷鏃舵竻绌鸿〃鍗曚笌褰撳墠閫変腑鐨勭爜鍊硷紝骞剁鐢ㄦ寜閽� - this.selectedFixedOrCodeclassifyValue = ""; - if (condition === "close") { - this.codeFixdForm = this.$options.data().codeFixdForm; - this.codeClassifyForm = this.$options.data().codeClassifyForm; - } - if (condition === "codefixedsec") { - this.codeFixdForm.description = ""; - this.codeFixdForm.codeFixedSecOid = ""; - } else { - this.codeClassifyForm = this.$options.data().codeClassifyForm; - } - }, - /** 娣诲姞鎴栦慨鏀圭爜鍊间箣鍓嶅鐮佸�奸暱搴︽牴鎹鍒欒繘琛屾牎楠� */ - tipsCodeSecValueMessage(id) { - if (id.trim() == "") { - this.$message.warning("鐮佸�间笉鑳戒负绌猴紒"); - return false; - } - if (id.trim().length > this.codefixedsecOrCodeclassifysec.codeSecLength) { - this.$message.warning( - "鐮佸�奸暱搴︿笉鑳藉ぇ浜�" + this.codefixedsecOrCodeclassifysec.codeSecLength - ); - return false; - } - return true; - }, /** 淇敼鐮佸�� */ - editCodeSecValue(condition) { + async editCodeSecValue(condition) { if (condition == "codefixedsec") { if (!this.tipsCodeSecValueMessage(this.codeFixdForm.id)) { + return; + } + if(!await this.regexCharacter(this.codeFixdForm.id)){ return; } //浠ュ墠鏄洿鎺ユ妸褰撳墠閫変腑琛岀殑鎵�鏈夋暟鎹兘杩涜鎻愪氦锛屼絾鍏跺疄鍙渶瑕佷紶杈撲竴浜涘繀瑕佸弬鏁板嵆鍙紝杩欏効鍋氫簡淇敼锛岄渶瑕佷紶鍏朵粬鍙傛暟鐨勮鑷娣诲姞 @@ -2112,6 +2108,9 @@ if (!this.tipsCodeSecValueMessage(this.codeClassifyForm.id)) { return; } + if(!await this.regexCharacter(this.codeFixdForm.id)){ + return; + } this.codeClassifyForm.oid = this.selectedFixedOrCodeclassifyValue.attributes.oid; // 鍒嗙被鐮佹锛屽瓙鍒嗙被鍜岀埗鍒嗙被涔嬮棿涓嶈兘鐩镐簰鏇存敼 @@ -2139,6 +2138,54 @@ } ); } + }, + /** + * 鍙敤瀛楃闆嗙爜鍊兼鍒欐牎楠� + * @return true:婊¤冻闄愬埗锛宖alse锛氫笉婊¤冻闄愬埗 + */ + async regexCharacter(str){ + var regex = null; + // 鑾峰彇鍒伴厤缃ソ鐨勫彲鐢ㄥ瓧绗︽鍒� + await getRegexStr({codeRuleId: this.selectionList[0].oid,chartType: "charset"}).then(res=>{ + // console.log(res.data.data); + regex = new RegExp(res.data.data); + }); + // console.log(regex); + // console.log(regex.test(str)); + if(regex != "" && !regex.test(str)){ + this.$message.warning("娣诲姞鐨勭爜鍊兼湭鍦ㄥ彲鐢ㄥ瓧绗﹂泦涓厤缃紒"); + return false; + } + return true; + }, + /** 娓呯┖鐮佸�艰〃鍗� */ + clearFixedOrClassifyForm(condition) { + //鐐瑰嚮鍙栨秷鏃舵竻绌鸿〃鍗曚笌褰撳墠閫変腑鐨勭爜鍊硷紝骞剁鐢ㄦ寜閽� + this.selectedFixedOrCodeclassifyValue = ""; + if (condition === "close") { + this.codeFixdForm = this.$options.data().codeFixdForm; + this.codeClassifyForm = this.$options.data().codeClassifyForm; + } + if (condition === "codefixedsec") { + this.codeFixdForm.description = ""; + this.codeFixdForm.codeFixedSecOid = ""; + } else { + this.codeClassifyForm = this.$options.data().codeClassifyForm; + } + }, + /** 娣诲姞鎴栦慨鏀圭爜鍊间箣鍓嶅鐮佸�奸暱搴︽牴鎹鍒欒繘琛屾牎楠� */ + tipsCodeSecValueMessage(id) { + if (id.trim() == "") { + this.$message.warning("鐮佸�间笉鑳戒负绌猴紒"); + return false; + } + if (id.trim().length > this.codefixedsecOrCodeclassifysec.codeSecLength) { + this.$message.warning( + "鐮佸�奸暱搴︿笉鑳藉ぇ浜�" + this.codefixedsecOrCodeclassifysec.codeSecLength + ); + return false; + } + return true; }, /** 鍒犻櫎鐮佸�� */ delCodeSecValue(condition) { @@ -2335,7 +2382,6 @@ }, /** 涓婄Щ涓嬬Щ绛夋搷浣滅殑淇濆瓨*/ async saveCodeFixedOrClassifyValueOption(condition, editOrderNumdata) { - //淇濆瓨瀵瑰浐瀹氱爜娈电爜鍊肩殑涓婄Щ涓嬬Щ绉诲嚭绛夋搷浣� if (condition == "fixedValue") { let data = { @@ -2810,7 +2856,18 @@ //console.log(this.form); //涓篺orm缁戝畾鍊� this.changeSectypeFormItems(condition == "add" ? null : row); + // 鑾峰彇鍓嶅悗缂�鍙敤瀛楃 + this.loadPreOrSuffixChars(); + // 琛ヤ綅鏃跺瓧绗� + // this.loadCodeFillSeparator(); this.addBasicCodeSettingBox = true; + }, + /** 鑾峰彇鍓嶅悗缂�瀛楃 */ + loadPreOrSuffixChars(){ + getSelectList({codeRuleId: this.selectionList[0].oid,chartType: "prefix"}).then(res=>{ + this.preFixOrSuffixChars = res.data.data; + // console.log(this.preFixOrSuffixChars); + }) }, /** 鏂板鍩虹鐮佹*/ async saveOrEditBasicCode() { @@ -3343,12 +3400,12 @@ this.form.referConfig = ""; } }, - /** 琛ヤ綅鏃剁殑瀛楃锛屽疄鐜板彲杈撳彲閫�*/ - inputSelectBlur(e) { + /** 琛ヤ綅鏃剁殑瀛楃锛屽疄鐜板彲杈撳彲閫� TODO:鍥犱负澧炲姞浜嗗彲鐢ㄥ瓧绗﹂泦鎺у埗锛屾墍浠ヨ繖鍎垮純鐢ㄤ簡鍙敤瀛楃闆嗙殑鏁堟灉*/ + /*inputSelectBlur(e) { if (e.target.value) { this.form.codeFillSeparator = e.target.value; } - }, + },*/ /** 鐮佹绫诲瀷鏀瑰彉鏃讹紝澧炲姞瀵瑰簲鐨刦orm琛ㄥ崟涓殑灞炴��*/ changeSectypeFormItems(row) { //console.log(row) @@ -3541,7 +3598,7 @@ if (enumCach == null) { getDictionary({code: enumKey}).then((res) => { enumCach = res.data.data; - localStorage.setItem(enumKey, JSON.stringify(res.data.data)); + localStorage.setItem(enumKey, JSON.stringify(enumCach)); }); } return enumCach; @@ -3551,7 +3608,7 @@ this.loadCodeSecType(); this.loadCodeSecLength(); this.loadCodeFillType(); - this.loadCodeFillSeparator(); + // this.loadCodeFillSeparator(); this.loadCodeLevelType(); this.loadCodeCutType(); this.loadCodeGetValueType(); @@ -3570,15 +3627,14 @@ loadCodeFillSeparator() { //let enumCach = JSON.parse(localStorage.getItem("codeFillSeparator")); //if (enumCach == null) { - getDictionaryBiz({code: "codeFillSeparator"}).then((res) => { + getSelectList({codeRuleId: this.selectionList[0].oid,chartType: "fillerChar"}).then((res) => { this.enumParam.codeFillSeparator = res.data.data; //console.log(this.enumParam.codeFillSeparator); - localStorage.setItem( - "codeFillSeparator", - JSON.stringify(res.data.data) - ); + // localStorage.setItem( + // "codeFillSeparator", + // JSON.stringify(res.data.data) + // ); }); - //} }, loadCodeLevelType() { this.enumParam.codeLevelType = this.getLocalStorageEnum("codeLevelType") || []; diff --git a/Source/UBCS-WEB/src/views/ruleBasic/delimiterConfig.vue b/Source/UBCS-WEB/src/views/ruleBasic/delimiterConfig.vue index fe02374..0e5fb46 100644 --- a/Source/UBCS-WEB/src/views/ruleBasic/delimiterConfig.vue +++ b/Source/UBCS-WEB/src/views/ruleBasic/delimiterConfig.vue @@ -132,7 +132,7 @@ <script> import {getList, addSave, editSave, deleteSave} from "@/api/code/codeCharcter" -import {gridCodeRule} from "@/api/code/codeCharcter" +import {gridCodeRule} from "@/api/code/mdmrule" export default { name: "usableCharacter", @@ -195,7 +195,7 @@ async getCodeRule() { try { // 缂栫爜瑙勫垯宸插彂甯冩暟鎹簮 - const res = await gridCodeRule({["conditionMap" + "[lcStatus_like]"]: "Released"}); + const res = await gridCodeRule(1,-1); this.characterReleasedList = res.data.data.records; this.queryReleasedList = this.characterReleasedList; this.select = this.characterReleasedList[0].oid; diff --git a/Source/UBCS-WEB/src/views/ruleBasic/paddingCharacter.vue b/Source/UBCS-WEB/src/views/ruleBasic/paddingCharacter.vue index 2786221..74897c3 100644 --- a/Source/UBCS-WEB/src/views/ruleBasic/paddingCharacter.vue +++ b/Source/UBCS-WEB/src/views/ruleBasic/paddingCharacter.vue @@ -132,7 +132,7 @@ <script> import {getList, addSave, editSave, deleteSave} from "@/api/code/codeCharcter" -import {gridCodeRule} from "@/api/code/codeCharcter" +import {gridCodeRule} from "@/api/code/mdmrule" export default { name: "usableCharacter", @@ -195,7 +195,7 @@ async getCodeRule() { try { // 缂栫爜瑙勫垯宸插彂甯冩暟鎹簮 - const res = await gridCodeRule({["conditionMap" + "[lcStatus_like]"]: "Released"}); + const res = await gridCodeRule(1,-1); this.characterReleasedList = res.data.data.records; this.queryReleasedList = this.characterReleasedList; this.select = this.characterReleasedList[0].oid; @@ -227,7 +227,7 @@ // const targetObject = this.characterReleasedList.find(obj => obj.oid === this.selectValue); // const chartValue = targetObject.name; getList({codeRuleId: this.select, chartType: "fillerChar", chartValue: this.characterValue}).then(res => { - console.log(res.data.data); + // console.log(res.data.data); this.tableData = res.data.data; this.loading = false; }); diff --git a/Source/UBCS-WEB/src/views/ruleBasic/prefixConfig.vue b/Source/UBCS-WEB/src/views/ruleBasic/prefixConfig.vue index 7291218..9d83440 100644 --- a/Source/UBCS-WEB/src/views/ruleBasic/prefixConfig.vue +++ b/Source/UBCS-WEB/src/views/ruleBasic/prefixConfig.vue @@ -8,7 +8,7 @@ @change="selectHandler"> <el-option v-for="(item,index) in queryReleasedList" :key="item.oid" - :label="item.name" + :label="item.name + ' (' + item.id + ')'" :value="item.oid"></el-option> </el-select> </div> @@ -132,7 +132,7 @@ <script> import {getList, addSave, editSave, deleteSave} from "@/api/code/codeCharcter" -import {gridCodeRule} from "@/api/code/codeCharcter" +import {gridCodeRule} from "@/api/code/mdmrule" export default { name: "usableCharacter", @@ -194,8 +194,8 @@ }, async getCodeRule() { try { - // 缂栫爜瑙勫垯宸插彂甯冩暟鎹簮 - const res = await gridCodeRule({["conditionMap" + "[lcStatus_like]"]: "Released"}); + // 缂栫爜瑙勫垯宸插彂甯冿紙TODO:2024/1/22鏀癸細鎸夌収闇�姹傚簲璇ユ槸閮芥煡璇級鏁版嵁婧� + const res = await gridCodeRule(1,-1); this.characterReleasedList = res.data.data.records; this.queryReleasedList = this.characterReleasedList; this.select = this.characterReleasedList[0].oid; @@ -227,7 +227,7 @@ // const targetObject = this.characterReleasedList.find(obj => obj.oid === this.selectValue); // const chartValue = targetObject.name; getList({codeRuleId: this.select, chartType: "prefix", chartValue: this.characterValue}).then(res => { - console.log(res.data.data); + // console.log(res.data.data); this.tableData = res.data.data; this.loading = false; }); diff --git a/Source/UBCS-WEB/src/views/ruleBasic/usableCharacter.vue b/Source/UBCS-WEB/src/views/ruleBasic/usableCharacter.vue index d832be8..5be2861 100644 --- a/Source/UBCS-WEB/src/views/ruleBasic/usableCharacter.vue +++ b/Source/UBCS-WEB/src/views/ruleBasic/usableCharacter.vue @@ -70,7 +70,7 @@ <script> import {getList, addSave, editSave, deleteSave} from "@/api/code/codeCharcter" -import {gridCodeRule} from "@/api/code/codeCharcter" +import {gridCodeRule} from "@/api/code/mdmrule" export default { name: "usableCharacter", @@ -136,7 +136,7 @@ async getCodeRule() { try { // 缂栫爜瑙勫垯宸插彂甯冩暟鎹簮 - const res = await gridCodeRule({["conditionMap" + "[lcStatus_like]"]: "Released"}); + const res = await gridCodeRule(1,-1); this.characterReleasedList = res.data.data.records; this.queryReleasedList = this.characterReleasedList; this.select = this.characterReleasedList[0].oid; diff --git a/Source/UBCS-WEB/vue.config.js b/Source/UBCS-WEB/vue.config.js index 76553ee..7b17b10 100644 --- a/Source/UBCS-WEB/vue.config.js +++ b/Source/UBCS-WEB/vue.config.js @@ -26,9 +26,9 @@ proxy: { '/api': { //鏈湴鏈嶅姟鎺ュ彛鍦板潃 - // target: 'http://127.0.0.1:37000', + target: 'http://127.0.0.1:37000', // target: 'http://192.168.1.51:37000', - target: 'http://dev.vci-tech.com:37000', + // target: 'http://dev.vci-tech.com:37000', //yxc // target: 'http:// 192.168.43.131:37000', //ldc diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeFixedValueController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeFixedValueController.java index 9b44d22..67b2d73 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeFixedValueController.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeFixedValueController.java @@ -14,6 +14,7 @@ import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; @@ -126,7 +127,7 @@ @PostMapping("/saveOrder") public R batchSave4Order(@RequestBody Map<String,Object> param){ JSONArray json = JSONArray.parseArray(String.valueOf(param.get("dtoList"))); - List<CodeFixedValueDTO> dtoList = new ArrayList<>(); + List<CodeFixedValueDTO> dtoList = new ArrayList<>(); for (int i = 0; i < json.size(); i++) { CodeFixedValueDTO codeFixedValueDTO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(json.get(i))), CodeFixedValueDTO.class); dtoList.add(codeFixedValueDTO); diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleCharacterController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleCharacterController.java index 138f53a..8cac5e8 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleCharacterController.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleCharacterController.java @@ -6,6 +6,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.rmi.ServerException; import java.util.List; import java.util.Map; @@ -17,6 +18,7 @@ @RestController @RequestMapping("/codeRuleCharacterController") public class CodeRuleCharacterController { + @Resource private ICodeRuleCharacterService iCodeRuleCharacterService; @@ -28,6 +30,26 @@ @GetMapping("/list") public R<List<Map<String,String>>> getDataByOid(@RequestParam("codeRuleId")String codeRuleId,@RequestParam("chartType")String chartType){ return R.data(iCodeRuleCharacterService.getDataByRuleId(codeRuleId,chartType)); + } + + /** + * 浣跨敤缂栫爜瑙勫垯oid鑾峰彇鏁版嵁涓嬫媺鏁版嵁婧� + * @param codeRuleId 瑙勫垯oid + * @return 鏁版嵁鍐呭 + */ + @GetMapping("/selectList") + public R<List<Map<String, String>>> getSelectListByRuleId(@RequestParam("codeRuleId")String codeRuleId,@RequestParam("chartType")String chartType) throws ServerException { + return R.data(iCodeRuleCharacterService.getSelectListByRuleId(codeRuleId,chartType)); + } + + /** + * 浣跨敤缂栫爜瑙勫垯oid鑾峰彇鏁版嵁涓嬫媺鏁版嵁婧� + * @param codeRuleId 瑙勫垯oid + * @return 鏁版嵁鍐呭 + */ + @GetMapping("/getRegexStr") + public R<String> getRegexStrByCodeRuleId(@RequestParam("codeRuleId")String codeRuleId,@RequestParam("chartType")String chartType) throws ServerException { + return R.data(iCodeRuleCharacterService.getRegexStrByCodeRuleId(codeRuleId,chartType)); } /** @@ -59,4 +81,5 @@ public R delete(@RequestBody CodeRuleCharacterVO codeRuleCharacterVO){ return iCodeRuleCharacterService.saveOrUpdate(codeRuleCharacterVO,3); } + } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleCharacterService.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleCharacterService.java index f91c7cd..3c6c6dd 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleCharacterService.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeRuleCharacterService.java @@ -10,6 +10,7 @@ import com.vci.ubcs.starter.exception.VciBaseException; import org.springblade.core.tool.api.R; +import java.rmi.ServerException; import java.util.List; import java.util.Map; @@ -29,6 +30,24 @@ */ List<Map<String,String>> getDataByRuleId(String codeRuleId,String chartType)throws VciBaseException; + /** + * 涓嬫媺鏁版嵁婧� + * @param codeRuleId + * @param chartType + * @return + * @throws VciBaseException + */ + List<Map<String, String>> getSelectListByRuleId(String codeRuleId,String chartType) throws ServerException; + + /** + * 瀛楃闆嗘鍒欐嫾瑁� + * @param codeRuleId + * @param chartType + * @return + * @throws VciBaseException + */ + String getRegexStrByCodeRuleId(String codeRuleId,String chartType) throws ServerException; + /*** * 淇濆瓨缂栫爜瑙勫垯瀛楃闆� * @param codeRuleCharacterVO diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeFixedValueServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeFixedValueServiceImpl.java index c26a219..e46394a 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeFixedValueServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeFixedValueServiceImpl.java @@ -343,6 +343,9 @@ List<CodeFixedValue> doList = codeFixedValueMapper.selectList(Wrappers.<CodeFixedValue>query() .lambda().eq(CodeFixedValue::getCodeFixedSecOid,codefixedsecoid) ); + if(doList.isEmpty()){ + return false; + } boolean resBoolean = codeFixedValueMapper.deleteBatchIds(doList.stream().map(CodeFixedValue::getOid).collect(Collectors.toList())) > 0; return resBoolean; } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleCharacterServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleCharacterServiceImpl.java index edff3be..bdd4be6 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleCharacterServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeRuleCharacterServiceImpl.java @@ -1,6 +1,5 @@ package com.vci.ubcs.code.service.impl; -import com.alibaba.nacos.common.utils.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -10,14 +9,15 @@ import com.vci.ubcs.code.service.ICodeRuleCharacterService; import com.vci.ubcs.code.vo.pagemodel.CodeRuleCharacterVO; import com.vci.ubcs.starter.exception.VciBaseException; -import com.vci.ubcs.starter.poi.bo.SheetRowData; import com.vci.ubcs.starter.util.DefaultAttrAssimtUtil; import com.vci.ubcs.starter.web.util.VciBaseUtil; +import lombok.AllArgsConstructor; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.rmi.ServerException; import java.util.*; import java.util.stream.Collectors; @@ -27,10 +27,11 @@ * @date 2023-11-30 */ @Service +@AllArgsConstructor public class CodeRuleCharacterServiceImpl extends ServiceImpl<CodeRuleCharacterMapper, CodeRuleCharacter> implements ICodeRuleCharacterService { - @Autowired - private CodeRuleCharacterMapper codeRuleCharacterMapper; + private final CodeRuleCharacterMapper codeRuleCharacterMapper; + /*** * 浣跨敤缂栫爜瑙勫垯oid鑾峰彇鏁版嵁 * @param codeRuleId @@ -57,9 +58,44 @@ charValueList.add(chartMap); } } - return charValueList; } + + /*** + * 浣跨敤缂栫爜瑙勫垯oid鑾峰彇鏁版嵁 + * @param codeRuleId + * @param chartType + * @return + * @throws VciBaseException + */ + @Override + public List<Map<String, String>> getSelectListByRuleId(String codeRuleId,String chartType) throws ServerException { + List<Map<String, String>> charValueMap = new ArrayList<>(); + CodeRuleCharacter codeRuleCharacter=codeRuleCharacterMapper.selectOne(Wrappers.<CodeRuleCharacter>query().lambda().eq(CodeRuleCharacter::getCodeRuleId,codeRuleId).eq(CodeRuleCharacter::getChartType,chartType)); + if(codeRuleCharacter!=null&&StringUtils.isNotBlank(codeRuleCharacter.getOid())){ + List<Character> characterList=codeRuleCharacter.getChartValue().chars().mapToObj(c -> (char) c).collect(Collectors.toList()); + characterList.stream().forEach(item->{ + Map<String, String> map = new HashMap<>(); + map.put("lable",item.toString()); + map.put("value",item.toString()); + charValueMap.add(map); + }); + } + return charValueMap; + } + + @Override + public String getRegexStrByCodeRuleId(String codeRuleId, String chartType) throws ServerException { + StringBuilder regexStr = new StringBuilder(); + CodeRuleCharacter codeRuleCharacter=codeRuleCharacterMapper.selectOne(Wrappers.<CodeRuleCharacter>query().lambda().eq(CodeRuleCharacter::getCodeRuleId,codeRuleId).eq(CodeRuleCharacter::getChartType,chartType)); + if(codeRuleCharacter!=null&&StringUtils.isNotBlank(codeRuleCharacter.getOid())){ + regexStr.append("^["); + regexStr.append(codeRuleCharacter.getChartValue()); + regexStr.append("]+$"); + } + return regexStr.toString(); + } + /*** * 瀛楃闆嗘暟鎹繚瀛� * @param codeRuleCharacterVO -- Gitblit v1.9.3