From c092522971add0ae88926eafe8adc906b9d9391c Mon Sep 17 00:00:00 2001 From: ludc Date: 星期五, 14 七月 2023 09:50:43 +0800 Subject: [PATCH] 代码提交 --- Source/UBCS-WEB/src/views/code/code.vue | 963 ++++++++++++++++++++++++++++++-------------------------- 1 files changed, 514 insertions(+), 449 deletions(-) diff --git a/Source/UBCS-WEB/src/views/code/code.vue b/Source/UBCS-WEB/src/views/code/code.vue index 275d740..b0facfa 100644 --- a/Source/UBCS-WEB/src/views/code/code.vue +++ b/Source/UBCS-WEB/src/views/code/code.vue @@ -227,6 +227,27 @@ <el-button @click="cloneOtherCodeRuleSettingBox = false">鍙� 娑�</el-button> </div> </el-dialog> + + <!-- 缂栫爜瑙勫垯,杞Щ鎵�鏈夎�呭璇濇 --> + <el-dialog + :visible.sync="escapeOwnerVisible" + append-to-body + title="杞Щ鎵�鏈夎��" + width="30%"> + <el-select v-model="ruleOwner" placeholder="璇烽�夋嫨" class="selects"> + <el-option + v-for="item in ruleAdminUserList" + :key="item.VALUE" + :label="item.LABLE" + :value="item.VALUE" + class="seloption"> + </el-option> + </el-select> + <span slot="footer" class="dialog-footer"> + <el-button @click="escapeOwnerVisible = false">鍙� 娑�</el-button> + <el-button type="primary" @click="escapeOwnerConfirm">纭� 瀹�</el-button> + </span> + </el-dialog> <!-- 鍩虹鐮佹灞曠ず鍖哄煙 --> <basic-container class="code-basicsec-container"> @@ -690,11 +711,11 @@ </span> </el-form> </div> - <!-- 绗竴灞傚璇濇鐨勬寜閽拰锛岀嚎鏉� --> + <!-- 绗竴灞傚璇濇鐨勬寜閽拰鍒嗛殧绾挎潯 --> <el-divider class="horizontal-line" direction="horizontal"></el-divider> <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="saveOrEditBasicCode" v-show="showbtn">淇� 瀛�</el-button> - <el-button @click="addBasicCodeSettingBox = false" v-show="showbtn">鍙� 娑�</el-button> + <el-button type="primary" @click="saveOrEditBasicCode" :disabled="!showbtn">淇� 瀛�</el-button> + <el-button @click="addBasicCodeSettingBox = false">鍙� 娑�</el-button> </div> <!-- 绗簩灞傚璇濇,灞炴�х爜娈碉紝灞炴�ч�夋嫨瀵硅瘽妗� --> @@ -832,7 +853,7 @@ import fixedValueOption from "@/const/code/fixedValueMgrDialog"; import {mapGetters} from "vuex"; import func from "@/util/func"; - import {MasterTable} from "@/api/GetItem"; + import {getByRoleUserList} from "@/api/system/user"; export default { data() { @@ -866,6 +887,10 @@ cloneBasicOption: cloneBasicOption, cloneCodeRuleOption: cloneCodeRuleOption, selectionOtherCloneCodeBasicList: [], // 褰撳墠閫変腑鐨勫熀纭�鐮佹 + /** 杞Щ鎵�鏈夎�呭璇濇 */ + escapeOwnerVisible: false, + ruleAdminUserList: [], //瑙勫垯绠$悊鍛樺垪琛� + ruleOwner: '', // 褰撳墠瑕佽浆绉荤粰鍝釜瑙勫垯绠$悊鍛樼殑ID /*浣跨敤鑼冨洿瀵硅瘽妗嗘樉绀烘帶鍒�*/ codeRangeSettingBox: false, @@ -1108,6 +1133,37 @@ }, methods: { + /** 杞Щ瑙勫垯鎵�鏈夎�呭璇濇 */ + escapeOwner(){ + if (this.selectionList.length === 0) { + this.$message.warning("璇烽�夋嫨涓�鏉$紪鐮佽鍒欙紒"); + return; + } + this.escapeOwnerVisible = true; + getByRoleUserList("瑙勫垯绠$悊鍛�").then(res=>{ + this.ruleAdminUserList = res.data.data; + }); + }, + /** 纭杞Щ鎵�鏈夎�� */ + escapeOwnerConfirm(){ + if(!this.ruleOwner){ + this.$message.warning("璇烽�夋嫨鎮ㄨ杞Щ鐨勮鍒欑鐞嗗憳锛�"); + return; + } + this.selectionList[0].owner = this.ruleOwner; + let data = this.selectionList[0]; + update(data).then(() => { + this.onLoad(this.page); + this.$message({ + type: "success", + message: "瑙勫垯杞Щ鎴愬姛!" + }); + this.escapeOwnerVisible = false; + }, error => { + console.log(error); + }); + }, + /** 楂樼骇鏌ヨ瀵硅瘽妗嗙粍浠�,缁勪欢杩斿洖鐨勫�兼槸condtionMap[field]褰㈠紡鐨勬煡璇㈡潯浠讹紝淇濈暀浜嗗拰涔嬪墠涓�鏍风殑鏂瑰紡 */ echoSeniorContionMap(conditionMaps){ //console.log(conditionMaps); @@ -1133,7 +1189,6 @@ //杞崲鎴怞SON瀛楃涓茶繘琛岀埗缁勪欢鍥炴樉 let submitFormJson = JSON.stringify(content); this.form.referConfig = submitFormJson || ''; - this.form.referValueInfo = submitFormJson || ''; }, /** 寮曠敤鐮佹涓恒�愬弬鐓у紩鐢ㄧ殑涓氬姟绫诲瀷銆戦�夊彇鍊间箣鍚庣殑鍐呭鍥炴樉鏃惰皟鐢� */ echoReferBtmType(content){ @@ -1643,434 +1698,6 @@ return currentRowClassOid!=updateClassOid; }, - - /** 鍩虹鐮佹鐩稿叧鏂规硶 */ - //闃叉鎵撳紑杩囩紪杈戠獥鍙d箣鍚庤〃鍗曚腑瀛樺湪鍊硷紝鎵�浠ラ渶瑕佹竻绌�,骞跺垵濮嬪寲form琛ㄥ崟灞炴�� - clearBasicAddForm(){ - this.form = this.$options.data().form; - // this.changeSectypeFormItems(null); - }, - // 鎵撳紑鏂板绐楀彛 - openAddBasicCodeSec(){ - if(!this.tipsMessage(this.selectionList)){ - return; - } - if(this.selectionList[0].lcStatus != 'Editing'){ - this.$message.warning('缂栫爜瑙勫垯鐘舵�佷笉鏄�"缂栬緫涓�"锛屼笉鍏佽缂栬緫鐮佹!'); - return; - } - this.openBasicDialog('add',null); - this.loadCodeSecType(); - }, - // 鎵撳紑鏂板鎴栫紪杈戝熀纭�鐮佹瀵硅瘽妗� - openBasicDialog(condition,row){ - //console.log(row); - if(condition == 'add') { - this.basicSecDialogTitle = '娣诲姞鐮佹淇℃伅'; - this.showbtn = true; - this.basicSecOnlyRead = false; - }else if(condition == 'edit'){ - if(this.selectionList.length!=1){ - this.$message.warning('璇烽�夋嫨涓�鏉$紪鐮佽鍒欐暟鎹�!'); - return; - } - this.basicSecDialogTitle = '淇敼鐮佹淇℃伅'; - this.showbtn = true; - this.basicSecOnlyRead = false; - //涓篺orm缁戝畾鍊� - }else{ - this.basicSecDialogTitle = '鏌ョ湅鐮佹淇℃伅'; - this.showbtn = false; - this.basicSecOnlyRead = true; - } - //console.log(this.form); - this.changeSectypeFormItems(condition == 'add' ? null:row); - this.addBasicCodeSettingBox = true; - }, - // 鏂板鍩虹鐮佹 - async saveOrEditBasicCode(){ - if(this.selectionList[0].oid == null || this.selectionList[0].oid == ''){ - this.$message.warning('缂哄け蹇呰鍙傛暟锛岃閲嶆柊閫夋嫨缂栫爜瑙勫垯鍚庡啀璇�!'); - return; - } - this.form.pkCodeRule = this.selectionList[0].oid; - if(this.form.oid == '' || this.form.oid == null){ - if(this.checkForm()){ - await addSave(this.form).then(() => { - this.$message({ - type: "success", - message: "鎿嶄綔鎴愬姛!" - }); - }, error => { - window.console.log(error); - }); - // 鍏抽棴瀵硅瘽妗� - this.addBasicCodeSettingBox = false - } - // 鐐瑰嚮鏂板鍩虹鐮佹,鍏抽棴绐楀彛涔嬪悗瑙﹀彂閲嶆柊鍔犺浇 - this.loadBasic(this.selectionList[0]); - }else{ - // 鍙兘鍙傜収寮曠敤鐨勪笟鍔$被鍨嬩細鍙戠敓鏀瑰彉鎵�浠ヨ繖鍎跨洿鎺ュreferConfig鐨刯son杩涜鏀瑰彉 - if(this.form.referConfig === "coderefersec" || this.form.referConfig != undefined){ - let referConfig = JSON.parse(this.form.referConfig); - referConfig.referType = this.form.referBtmId; - referConfig.referTypeName = this.form.referBtmName; - this.form.referConfig = JSON.stringify(referConfig); - let referValueInfo = JSON.parse(this.form.referValueInfo); - referValueInfo.referType = this.form.referBtmId; - } - editSave(this.form).then(() => { - this.$message({ - type: "success", - message: "鎿嶄綔鎴愬姛!" - }); - }, error => { - window.console.log(error); - }); - this.loadBasic(this.selectionList[0]); - // 鍏抽棴瀵硅瘽妗� - this.addBasicCodeSettingBox = false - } - }, - // 鍥犱负elementui鐨勮〃鍗曟牎楠岃缃笉涓婃墍浠ラ噰鐢ㄥ垽鏂殑鏂瑰紡鏉ュ仛琛ㄥ崟妫�楠屾柟寮� - checkForm(){ - let form = this.form; - //console.log(form); - const regNumber = /^[0-9]+\.{0,1}[0-9]*$/; //鏁板瓧鎴栧皬鏁版鍒欐牎楠� - const regPos = /^[0-9]*[1-9][0-9]*$/; //闈炶礋鏁存暟姝e垯鏍¢獙 - const tipsMsg = "蹇呭~椤逛笉鑳戒负绌�"; - if(form.id == ''){ - this.$message.warning("(鐮佹缂栧彿)"+tipsMsg); - this.$refs.id.$el.querySelector('input').focus(); - return false; - } - if(form.name == ''){ - this.$message.warning("(鐮佹鍚嶇О)"+tipsMsg); - this.$refs.name.$el.querySelector('input').focus(); - return false; - } - if(form.secType == ''){ - this.$message.warning("(鐮佹绫诲瀷)"+tipsMsg); - this.$refs.secType.$el.querySelector('select').focus(); - return false; - } - if(form.secType==='codefixedsec'){ - //鍥哄畾鐮佹 - if(form.codeSecLengthType == ''){ - this.$message.warning("(鐮佹闀垮害绫诲瀷)"+tipsMsg); - // this.$refs.codeSecLengthType.$el.querySelector('select').focus(); - return false; - } - if(form.codeSecLength == ''){ - this.$message.warning("(鐮佹闀垮害)"+tipsMsg); - this.$refs.codeSecLength.$el.querySelector('input').focus(); - return false; - } - if(!regNumber.test(form.codeSecLength)){ - this.$message.warning("鐮佹鐨勯暱搴﹀繀椤讳负鏁板瓧鍊�"); - this.$refs.codeSecLength.$el.querySelector('input').focus(); - return false; - } - }else if(this.form.secType==='codeattrsec'){ - //灞炴�х爜娈� - if(form.referAttributeId == ''){ - this.$message.warning('(灞炴��)'+tipsMsg); - this.$refs.referAttributeId.$el.querySelector('input').focus(); - return false; - } - }else if(this.form.secType==='codeserialsec'){ - //console.log(form.codeFillType); - //娴佹按鐮佹 - if(form.codeSecLength == ''){ - this.$message.warning('(鐮佹鐨勯暱搴�)'+tipsMsg); - this.$refs.seriaCodeSecLength.$el.querySelector('input').focus(); - return false; - } - if(!regNumber.test(form.codeSecLength)){ - this.$message.warning('鐮佹鐨勯暱搴﹀繀椤讳负鏁板瓧鍊�'); - this.$refs.seriaCodeSecLength.$el.querySelector('input').focus(); - return false; - } - if(!regNumber.test(form.serialStart)){ - this.$message.warning('娴佹按鍙风殑璧峰鍊煎繀椤讳负鏁板瓧鍊�'); - this.$refs.serialStart.$el.querySelector('input').focus(); - return false; - } - if(!regNumber.test(form.serialStep)){ - this.$message.warning('娴佹按鐨勬闀垮繀椤讳负鏁板瓧鍊�'); - this.$refs.serialStep.$el.querySelector('input').focus(); - return false; - } - if(form.codeFillType == ''){ - this.$message.warning('(缂栫爜琛ヤ綅鏂瑰紡)'+tipsMsg); - return false; - } - if(form.codeFillType != '涓嶈ˉ浣�' && form.codeFillSeparator == ''){ - this.$message.warning('褰撹ˉ浣嶆柟寮忎负宸﹁ˉ浣嶆垨鑰呭彸琛ヤ綅鐨勬椂鍊欙紝琛ヤ綅瀛楃涓嶈兘涓虹┖'); - return false; - } - if(form.codeFillLength == ''){ - this.$message.warning('濉厖闀垮害涓嶈兘涓虹┖'); - this.$refs.codeFillLength.$el.querySelector('input').focus(); - return false; - } - if(!regNumber.test(form.codeFillLength)){ - this.$message.warning('濉厖闀垮害蹇呴』涓烘暟瀛楀��'); - this.$refs.codeFillLength.$el.querySelector('input').focus(); - return false; - } - if(form.codeFillLimit == ''){ - this.$message.warning('(娴佹按涓婇檺)'+tipsMsg); - this.$refs.codeFillLimit.$el.querySelector('input').focus(); - return false; - } - if(!regNumber.test(form.codeFillLimit)){ - this.$message.warning('娴佹按涓婇檺蹇呴』涓烘暟瀛楀��'); - this.$refs.codeFillLimit.$el.querySelector('input').focus(); - return false; - } - // if(form.codeFillFlag == '' || ){ - // this.$message.warning('(娴佹按鏄惁琛ョ爜)'+tipsMsg); - // return false; - // } - }else if(this.form.secType==='codelevelsec'){ - //灞傜骇鐮佹 - if(form.codeLevelType == ''){ - this.$message.warning('(灞傜骇绫诲瀷)'+tipsMsg); - return false; - } - if(form.codeLevelType != 'code_level_min'&& !regNumber.test(form.codeLevelValue)){ - this.$message.warning('(灞傜骇鐨勫��)鍙兘濉啓鏁板瓧'); - this.$refs.codeLevelValue.$el.querySelector('input').focus(); - return false; - } - if(form.valueCutType == ''){ - this.$message.warning('(瀛楃鎴彇绫诲瀷)'+tipsMsg); - // this.$refs.valueCutType.$el.querySelector('select').focus(); - return false; - } - if(form.valueCutType != 'code_cut_none' && !regPos.test(form.valueCutLength)){ - this.$message.warning('(鍊兼埅鍙栭暱搴�)鍙兘濉啓姝f暣鏁�'); - this.$refs.valueCutLength.$el.querySelector('input').focus(); - return false; - } - }else if(this.form.secType==='coderefersec'){ - //寮曠敤鐮佹 - if(form.referBtmId == ''){ - this.$message.warning('(鍙傜収寮曠敤鐨勪笟鍔$被鍨�)'+tipsMsg); - this.$refs.referBtmId.$el.querySelector('input').focus(); - return false; - } - if(form.referConfig == ''){ - this.$message.warning('(鍙傜収閰嶇疆)'+tipsMsg); - this.$refs.referConfig.$el.querySelector('input').focus(); - return false; - } - }else if(this.form.secType==='codedatesec'){ - //鏃ユ湡鐮佹 - if(form.codeDateFormatStr == ''){ - this.$message.warning('(鏃ユ湡鏍煎紡)'+tipsMsg); - this.$refs.codeDateFormatStr.$el.querySelector('input').focus(); - return false; - } - }else if(this.form.secType==='codeclassifysec'){ - //鍒嗙被鐮佹 - if(form.codeSecLengthType == ''){ - this.$message.warning('(鐮佹闀垮害绫诲瀷)'+tipsMsg); - return false; - } - if(form.codeSecLength == ''){ - this.$message.warning('(鐮佹闀垮害)'+tipsMsg); - this.$refs.classCodeSecLength.$el.querySelector('input').focus(); - return false; - } - if(!regNumber.test(form.codeSecLength)){ - this.$message.warning('鐮佹鐨勯暱搴﹀繀椤讳负鏁板瓧鍊�'); - this.$refs.classCodeSecLength.$el.querySelector('input').focus(); - return false; - } - }else if(this.form.secType==='codevariablesec'){ - //鍙彉鐮佹 - if(form.codeSecLength == ''){ - this.$message.warning('(鐮佹闀垮害)'+tipsMsg); - this.$refs.varCodeSecLength.$el.querySelector('input').focus(); - return false; - } - if(!regNumber.test(form.codeSecLength)){ - this.$message.warning('鐮佹鐨勯暱搴﹀繀椤讳负鏁板瓧鍊�'); - this.$refs.classCodeSecLength.$el.querySelector('input').focus(); - return false; - } - if(form.codeFillType == ''){ - this.$message.warning('(缂栫爜琛ヤ綅鏂瑰紡)'+tipsMsg); - return false; - } - // console.log(form); - if(form.codeFillType != 'code_fill_none' && form.codeFillSeparator == ''){ - this.$message.warning('褰撹ˉ浣嶆柟寮忎负宸﹁ˉ浣嶆垨鑰呭彸琛ヤ綅鐨勬椂鍊欙紝琛ヤ綅瀛楃涓嶈兘涓虹┖'); - return false; - } - } - return true; - }, - // 鍒ゆ柇鏁版嵁鏄惁閫夋嫨浠ュ強鍙兘閫夋嫨鍗曟潯鏁版嵁 - tipsMessage(list){ - if(list.length != 1){ - this.$message.warning("璇烽�夋嫨涓�鏉$紪鐮佽鍒欐暟鎹�!"); - return false; - } - return true; - }, - // 鍩虹鐮佹鍒犻櫎 - deleteBasicCode(){ - if(!this.tipsMessage(this.selectionBasicList)){ - return; - } - let oid = this.selectionBasicList[0].oid; - this.$confirm("鏄惁鍒犻櫎杩欐潯鏁版嵁锛熷鏋滆寮曠敤灏嗕笉鑳借鍒犻櫎锛�", { - confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", - type: "warning" - }) - .then(() => { - let ts = new Date(this.selectionBasicList[0].ts).getTime(); - return deleteData({"oid": oid,"ts": ts}); - }) - .then(() => { - this.loadBasic({"oid":this.currentCodeRuleOid == null || this.currentCodeRuleOid == '' ? this.selectionList[0].oid:this.currentCodeRuleOid}); - this.$message({ - type: "success", - message: "鎿嶄綔鎴愬姛!" - }); - this.$refs.crudBasic.toggleSelection(); - }); - }, - // 鐐瑰嚮瑙﹀彂鍔犺浇鍩虹鐮佹淇℃伅 - loadBasic(row){ - if(this.cloneSettingBox){ - this.cloneTableLoading = true; - }else{ - this.loadingBasic = true; - } - // console.log(row.oid); - //瀛樺偍褰撳墠鍏宠仈鐨勭紪鐮佽鍒欑浉鍏充俊鎭� - if(row!='' || row!=null){ - this.currentCodeRuleOid = row.oid; - this.currentRuleLcStatus = row.lcStatus; - this.sendGridCodeBasicSec({"pkCodeRule":row.oid},false); - } - }, - // 鍙戦�佸姞杞藉熀纭�鐮佹鐨勮姹� - sendGridCodeBasicSec(condition,isAdancedQuery/** 鏄惁楂樼骇鏌ヨ */){ - // 濡傛灉褰撳墠鍩虹鐮佹琛ㄤ腑鐨勬悳绱㈡寜閽闅愯棌锛屽氨闇�瑕佸湪姝ゅ紑鍚� - if(this.selectionList.length>=0 && !this.$refs.crudBasic.option.column[0].search){ - this.hideBasicTable(true); - } - let conditionMaps = {}; - if(condition && !isAdancedQuery){ - Object.keys(condition).forEach(key=>{ - conditionMaps['conditionMap['+key+']'] = condition[key].trim(); - }); - } - if(isAdancedQuery){ - condition['conditionMap[pkCodeRule]'] = this.currentCodeRuleOid == null || this.currentCodeRuleOid == '' - ? this.selectionList[0].oid:this.currentCodeRuleOid; - } - gridCodeBasicSec(1, -1,isAdancedQuery ? condition:conditionMaps).then(res => { - const data = res.data.data; - if(this.cloneSettingBox){ - this.cloneData = data.records; - // console.log(tihs.cloneData); - this.cloneTableLoading = false; - }else { - this.basicData = data.records; - // console.log(this.basicData); - this.loadingBasic = false; - } - }); - }, - // 鍩虹鐮佹閫変腑鏃惰Е鍙� - selectionBasicChange(list) { - this.selectionBasicList = list; - this.$refs.crudBasic.setCurrentRow(this.selectionBasicList[list.length-1]); - //console.log(this.selectionBasicList); - }, - // 鍩虹鐮佹琚崟鍑昏〃鏍艰鏃惰Е鍙� - codeBasicSecRowClick(row){ - this.$refs.crudBasic.toggleSelection(); - this.selectionBasicList = row; - this.$refs.crudBasic.setCurrentRow(row); - this.$refs.crudBasic.toggleRowSelection(row); //閫変腑褰撳墠琛� - }, - basicSearchChange(params, done){ - //console.log(this.$refs.crudBasic); - this.sendGridCodeBasicSec(Object.assign(params,{"pkCodeRule":this.selectionList[this.selectionList.length-1].oid}),false); - done(); - }, - basicSearchReset(){ - this.sendGridCodeBasicSec({"pkCodeRule":this.selectionList[this.selectionList.length-1].oid},false); - }, - // 涓婄Щ涓嬬Щ鍩虹鐮佹 - async upOrderNum(row){ - if(!this.tipsMessage(this.selectionList)){ - return; - } - if (this.selectionList[0].lcStatus != 'Editing') { - this.$message.warning("鍙湁缂栫爜瑙勫垯鐨勭姸鎬佹槸 [缂栬緫涓璢 鐨勬椂鍊欙紝鎵嶈兘璋冩暣鐮佹椤哄簭!"); - return; - } - if(row.oid==null || row.oid==''){ - this.$message.warning("鏈幏鍙栧埌蹇呭~鍙傛暟!"); - return; - } - await upOrderNum(row.oid).then(() => { - this.loadBasic(this.selectionList[0]); - this.$message({ - type: "success", - message: "鎿嶄綔鎴愬姛!" - }); - }) - }, - downOrderNum(row){ - //console.log(row.oid); - if(!this.tipsMessage(this.selectionList)){ - return; - } - let codeRuleOid = this.selectionList[0].oid; - //console.log(this.selectionList); - if (this.selectionList[0].lcStatus != 'Editing') { - this.$message.warning("鍙湁缂栫爜瑙勫垯鐨勭姸鎬佹槸 [缂栬緫涓璢 鐨勬椂鍊欙紝鎵嶈兘璋冩暣鐮佹椤哄簭!"); - return; - } - if(row.oid==null || row.oid==''){ - this.$message.warning("鏈幏鍙栧埌蹇呭~鍙傛暟!"); - return; - } - downOrderNum(row.oid).then(() => { - this.loadBasic({"oid":codeRuleOid}); - this.$message({ - type: "success", - message: "鎿嶄綔鎴愬姛!" - }); - }) - }, - // 鍩虹鐮佹鍒锋柊鏃舵煡璇� - refreshChangeBasicSec(){ - this.loadBasic(this.selectionList.at(-1)); - }, - // 鎿嶄綔鍩虹鐮佹涓悳绱㈡竻绌虹瓑鎸夐挳鐨勬樉绀�/闅愯棌 - hideBasicTable(hideBoolean){ - this.$refs.crudBasic.option.refreshBtn = hideBoolean; - this.$refs.crudBasic.option.columnBtn = hideBoolean; - this.$refs.crudBasic.option.column[0].search = hideBoolean; - this.$refs.crudBasic.option.column[1].search = hideBoolean; - if(!hideBoolean){ - this.selectionList = []; - this.basicData = []; - } - }, - - /** 缂栫爜瑙勫垯鐩稿叧鏂规硶 */ // 鎵撳紑楂樼骇鏌ヨ绐楀彛 openAdvancedQuery(condition){ @@ -2424,15 +2051,6 @@ this.loadBasic(this.selectionList[list.length-1]); } }, - changeCutType(value){ - if (value != 'code_cut_none'){ - if(this.form.valueCutLength == ''){ - this.form.valueCutLength = 1; - } - }else{ - this.form.valueCutLength = ''; - } - }, // 鍗曞嚮缂栫爜瑙勫垯瀹炵幇琛岄�夋嫨 codeRuleRowClick (row) { // console.log(this.currentRuleLcStatus); @@ -2480,6 +2098,442 @@ }); }, + + /** 鍩虹鐮佹鐩稿叧鏂规硶 */ + //闃叉鎵撳紑杩囩紪杈戠獥鍙d箣鍚庤〃鍗曚腑瀛樺湪鍊硷紝鎵�浠ラ渶瑕佹竻绌�,骞跺垵濮嬪寲form琛ㄥ崟灞炴�� + clearBasicAddForm(){ + this.form = this.$options.data().form; + // this.changeSectypeFormItems(null); + }, + // 鎵撳紑鏂板绐楀彛 + openAddBasicCodeSec(){ + if(!this.tipsMessage(this.selectionList)){ + return; + } + if(this.selectionList[0].lcStatus != 'Editing'){ + this.$message.warning('缂栫爜瑙勫垯鐘舵�佷笉鏄�"缂栬緫涓�"锛屼笉鍏佽缂栬緫鐮佹!'); + return; + } + this.openBasicDialog('add',null); + this.loadCodeSecType(); + }, + // 鎵撳紑鏂板鎴栫紪杈戝熀纭�鐮佹瀵硅瘽妗� + openBasicDialog(condition,row){ + //console.log(row); + if(condition == 'add') { + this.basicSecDialogTitle = '娣诲姞鐮佹淇℃伅'; + this.showbtn = true; + this.basicSecOnlyRead = false; + }else if(condition == 'edit'){ + if(this.selectionList.length!=1){ + this.$message.warning('璇烽�夋嫨涓�鏉$紪鐮佽鍒欐暟鎹�!'); + return; + } + this.basicSecDialogTitle = '淇敼鐮佹淇℃伅'; + this.showbtn = true; + this.basicSecOnlyRead = false; + //涓篺orm缁戝畾鍊� + }else{ + this.basicSecDialogTitle = '鏌ョ湅鐮佹淇℃伅'; + this.showbtn = false; + this.basicSecOnlyRead = true; + } + //console.log(this.form); + this.changeSectypeFormItems(condition == 'add' ? null:row); + this.addBasicCodeSettingBox = true; + }, + // 鏂板鍩虹鐮佹 + async saveOrEditBasicCode(){ + if(this.selectionList[0].oid == null || this.selectionList[0].oid == ''){ + this.$message.warning('缂哄け蹇呰鍙傛暟锛岃閲嶆柊閫夋嫨缂栫爜瑙勫垯鍚庡啀璇�!'); + return; + } + this.form.pkCodeRule = this.selectionList[0].oid; + if(this.form.oid == '' || this.form.oid == null){ + if(this.checkForm()){ + await addSave(this.form).then(() => { + this.$message({ + type: "success", + message: "鎿嶄綔鎴愬姛!" + }); + }, error => { + window.console.log(error); + }); + // 鍏抽棴瀵硅瘽妗� + this.addBasicCodeSettingBox = false + } + // 鐐瑰嚮鏂板鍩虹鐮佹,鍏抽棴绐楀彛涔嬪悗瑙﹀彂閲嶆柊鍔犺浇 + this.loadBasic(this.selectionList[0]); + }else{ + // 鍙兘鍙傜収寮曠敤鐨勪笟鍔$被鍨嬩細鍙戠敓鏀瑰彉鎵�浠ヨ繖鍎跨洿鎺ュreferConfig鐨刯son杩涜鏀瑰彉 + if(this.form.referConfig === "coderefersec" || this.form.referConfig != undefined){ + let referConfig = JSON.parse(this.form.referConfig); + referConfig.referType = this.form.referBtmId; + referConfig.referTypeName = this.form.referBtmName; + this.form.referConfig = JSON.stringify(referConfig); + // let referValueInfo = JSON.parse(this.form.referValueInfo); + // referValueInfo.referType = this.form.referBtmId; + } + editSave(this.form).then(() => { + this.$message({ + type: "success", + message: "鎿嶄綔鎴愬姛!" + }); + }, error => { + window.console.log(error); + }); + this.loadBasic(this.selectionList[0]); + // 鍏抽棴瀵硅瘽妗� + this.addBasicCodeSettingBox = false + } + }, + // 鍥犱负elementui鐨勮〃鍗曟牎楠岃缃笉涓婃墍浠ラ噰鐢ㄥ垽鏂殑鏂瑰紡鏉ュ仛琛ㄥ崟妫�楠屾柟寮� + checkForm(){ + let form = this.form; + //console.log(form); + const regNumber = /^[0-9]+\.{0,1}[0-9]*$/; //鏁板瓧鎴栧皬鏁版鍒欐牎楠� + const regPos = /^[0-9]*[1-9][0-9]*$/; //闈炶礋鏁存暟姝e垯鏍¢獙 + const tipsMsg = "蹇呭~椤逛笉鑳戒负绌�"; + if(form.id == ''){ + this.$message.warning("(鐮佹缂栧彿)"+tipsMsg); + this.$refs.id.$el.querySelector('input').focus(); + return false; + } + if(form.name == ''){ + this.$message.warning("(鐮佹鍚嶇О)"+tipsMsg); + this.$refs.name.$el.querySelector('input').focus(); + return false; + } + if(form.secType == ''){ + this.$message.warning("(鐮佹绫诲瀷)"+tipsMsg); + this.$refs.secType.$el.querySelector('select').focus(); + return false; + } + if(form.secType==='codefixedsec'){ + //鍥哄畾鐮佹 + if(form.codeSecLengthType == ''){ + this.$message.warning("(鐮佹闀垮害绫诲瀷)"+tipsMsg); + // this.$refs.codeSecLengthType.$el.querySelector('select').focus(); + return false; + } + if(form.codeSecLength == ''){ + this.$message.warning("(鐮佹闀垮害)"+tipsMsg); + this.$refs.codeSecLength.$el.querySelector('input').focus(); + return false; + } + if(!regNumber.test(form.codeSecLength)){ + this.$message.warning("鐮佹鐨勯暱搴﹀繀椤讳负鏁板瓧鍊�"); + this.$refs.codeSecLength.$el.querySelector('input').focus(); + return false; + } + }else if(this.form.secType==='codeattrsec'){ + //灞炴�х爜娈� + if(form.referAttributeId == ''){ + this.$message.warning('(灞炴��)'+tipsMsg); + this.$refs.referAttributeId.$el.querySelector('input').focus(); + return false; + } + }else if(this.form.secType==='codeserialsec'){ + //console.log(form.codeFillType); + //娴佹按鐮佹 + if(form.codeSecLength == ''){ + this.$message.warning('(鐮佹鐨勯暱搴�)'+tipsMsg); + this.$refs.seriaCodeSecLength.$el.querySelector('input').focus(); + return false; + } + if(!regNumber.test(form.codeSecLength)){ + this.$message.warning('鐮佹鐨勯暱搴﹀繀椤讳负鏁板瓧鍊�'); + this.$refs.seriaCodeSecLength.$el.querySelector('input').focus(); + return false; + } + if(!regNumber.test(form.serialStart)){ + this.$message.warning('娴佹按鍙风殑璧峰鍊煎繀椤讳负鏁板瓧鍊�'); + this.$refs.serialStart.$el.querySelector('input').focus(); + return false; + } + if(!regNumber.test(form.serialStep)){ + this.$message.warning('娴佹按鐨勬闀垮繀椤讳负鏁板瓧鍊�'); + this.$refs.serialStep.$el.querySelector('input').focus(); + return false; + } + if(form.codeFillType == ''){ + this.$message.warning('(缂栫爜琛ヤ綅鏂瑰紡)'+tipsMsg); + return false; + } + if(form.codeFillType != '涓嶈ˉ浣�' && form.codeFillSeparator == ''){ + this.$message.warning('褰撹ˉ浣嶆柟寮忎负宸﹁ˉ浣嶆垨鑰呭彸琛ヤ綅鐨勬椂鍊欙紝琛ヤ綅瀛楃涓嶈兘涓虹┖'); + return false; + } + if(form.codeFillLength == ''){ + this.$message.warning('濉厖闀垮害涓嶈兘涓虹┖'); + this.$refs.codeFillLength.$el.querySelector('input').focus(); + return false; + } + if(!regNumber.test(form.codeFillLength)){ + this.$message.warning('濉厖闀垮害蹇呴』涓烘暟瀛楀��'); + this.$refs.codeFillLength.$el.querySelector('input').focus(); + return false; + } + if(form.codeFillLimit == ''){ + this.$message.warning('(娴佹按涓婇檺)'+tipsMsg); + this.$refs.codeFillLimit.$el.querySelector('input').focus(); + return false; + } + if(!regNumber.test(form.codeFillLimit)){ + this.$message.warning('娴佹按涓婇檺蹇呴』涓烘暟瀛楀��'); + this.$refs.codeFillLimit.$el.querySelector('input').focus(); + return false; + } + // if(form.codeFillFlag == '' || ){ + // this.$message.warning('(娴佹按鏄惁琛ョ爜)'+tipsMsg); + // return false; + // } + }else if(this.form.secType==='codelevelsec'){ + //灞傜骇鐮佹 + if(form.codeLevelType == ''){ + this.$message.warning('(灞傜骇绫诲瀷)'+tipsMsg); + return false; + } + if(form.codeLevelType != 'code_level_min'&& !regNumber.test(form.codeLevelValue)){ + this.$message.warning('(灞傜骇鐨勫��)鍙兘濉啓鏁板瓧'); + this.$refs.codeLevelValue.$el.querySelector('input').focus(); + return false; + } + if(form.valueCutType == ''){ + this.$message.warning('(瀛楃鎴彇绫诲瀷)'+tipsMsg); + // this.$refs.valueCutType.$el.querySelector('select').focus(); + return false; + } + if(form.valueCutType != 'code_cut_none' && !regPos.test(form.valueCutLength)){ + this.$message.warning('(鍊兼埅鍙栭暱搴�)鍙兘濉啓姝f暣鏁�'); + this.$refs.valueCutLength.$el.querySelector('input').focus(); + return false; + } + }else if(this.form.secType==='coderefersec'){ + //寮曠敤鐮佹 + if(form.referBtmId == ''){ + this.$message.warning('(鍙傜収寮曠敤鐨勪笟鍔$被鍨�)'+tipsMsg); + this.$refs.referBtmId.$el.querySelector('input').focus(); + return false; + } + if(form.referConfig == ''){ + this.$message.warning('(鍙傜収閰嶇疆)'+tipsMsg); + this.$refs.referConfig.$el.querySelector('input').focus(); + return false; + } + }else if(this.form.secType==='codedatesec'){ + //鏃ユ湡鐮佹 + if(form.codeDateFormatStr == ''){ + this.$message.warning('(鏃ユ湡鏍煎紡)'+tipsMsg); + this.$refs.codeDateFormatStr.$el.querySelector('input').focus(); + return false; + } + }else if(this.form.secType==='codeclassifysec'){ + //鍒嗙被鐮佹 + if(form.codeSecLengthType == ''){ + this.$message.warning('(鐮佹闀垮害绫诲瀷)'+tipsMsg); + return false; + } + if(form.codeSecLength == ''){ + this.$message.warning('(鐮佹闀垮害)'+tipsMsg); + this.$refs.classCodeSecLength.$el.querySelector('input').focus(); + return false; + } + if(!regNumber.test(form.codeSecLength)){ + this.$message.warning('鐮佹鐨勯暱搴﹀繀椤讳负鏁板瓧鍊�'); + this.$refs.classCodeSecLength.$el.querySelector('input').focus(); + return false; + } + }else if(this.form.secType==='codevariablesec'){ + //鍙彉鐮佹 + if(form.codeSecLength == ''){ + this.$message.warning('(鐮佹闀垮害)'+tipsMsg); + this.$refs.varCodeSecLength.$el.querySelector('input').focus(); + return false; + } + if(!regNumber.test(form.codeSecLength)){ + this.$message.warning('鐮佹鐨勯暱搴﹀繀椤讳负鏁板瓧鍊�'); + this.$refs.classCodeSecLength.$el.querySelector('input').focus(); + return false; + } + if(form.codeFillType == ''){ + this.$message.warning('(缂栫爜琛ヤ綅鏂瑰紡)'+tipsMsg); + return false; + } + // console.log(form); + if(form.codeFillType != 'code_fill_none' && form.codeFillSeparator == ''){ + this.$message.warning('褰撹ˉ浣嶆柟寮忎负宸﹁ˉ浣嶆垨鑰呭彸琛ヤ綅鐨勬椂鍊欙紝琛ヤ綅瀛楃涓嶈兘涓虹┖'); + return false; + } + } + return true; + }, + // 鍒ゆ柇鏁版嵁鏄惁閫夋嫨浠ュ強鍙兘閫夋嫨鍗曟潯鏁版嵁 + tipsMessage(list){ + if(list.length != 1){ + this.$message.warning("璇烽�夋嫨涓�鏉$紪鐮佽鍒欐暟鎹�!"); + return false; + } + return true; + }, + // 鍩虹鐮佹鍒犻櫎 + deleteBasicCode(){ + if(!this.tipsMessage(this.selectionBasicList)){ + return; + } + let oid = this.selectionBasicList[0].oid; + this.$confirm("鏄惁鍒犻櫎杩欐潯鏁版嵁锛熷鏋滆寮曠敤灏嗕笉鑳借鍒犻櫎锛�", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + let ts = new Date(this.selectionBasicList[0].ts).getTime(); + return deleteData({"oid": oid,"ts": ts}); + }) + .then(() => { + this.loadBasic({"oid":this.currentCodeRuleOid == null || this.currentCodeRuleOid == '' ? this.selectionList[0].oid:this.currentCodeRuleOid}); + this.$message({ + type: "success", + message: "鎿嶄綔鎴愬姛!" + }); + this.$refs.crudBasic.toggleSelection(); + }); + }, + // 鐐瑰嚮瑙﹀彂鍔犺浇鍩虹鐮佹淇℃伅 + loadBasic(row){ + if(this.cloneSettingBox){ + this.cloneTableLoading = true; + }else{ + this.loadingBasic = true; + } + // console.log(row.oid); + //瀛樺偍褰撳墠鍏宠仈鐨勭紪鐮佽鍒欑浉鍏充俊鎭� + if(row!='' || row!=null){ + this.currentCodeRuleOid = row.oid; + this.currentRuleLcStatus = row.lcStatus; + this.sendGridCodeBasicSec({"pkCodeRule":row.oid},false); + } + }, + // 鍙戦�佸姞杞藉熀纭�鐮佹鐨勮姹� + sendGridCodeBasicSec(condition,isAdancedQuery/** 鏄惁楂樼骇鏌ヨ */){ + // 濡傛灉褰撳墠鍩虹鐮佹琛ㄤ腑鐨勬悳绱㈡寜閽闅愯棌锛屽氨闇�瑕佸湪姝ゅ紑鍚� + if(this.selectionList.length>=0 && !this.$refs.crudBasic.option.column[0].search){ + this.hideBasicTable(true); + } + let conditionMaps = {}; + if(condition && !isAdancedQuery){ + Object.keys(condition).forEach(key=>{ + conditionMaps['conditionMap['+key+']'] = condition[key].trim(); + }); + } + if(isAdancedQuery){ + condition['conditionMap[pkCodeRule]'] = this.currentCodeRuleOid == null || this.currentCodeRuleOid == '' + ? this.selectionList[0].oid:this.currentCodeRuleOid; + } + gridCodeBasicSec(1, -1,isAdancedQuery ? condition:conditionMaps).then(res => { + const data = res.data.data; + if(this.cloneSettingBox){ + this.cloneData = data.records; + // console.log(tihs.cloneData); + this.cloneTableLoading = false; + }else { + this.basicData = data.records; + // console.log(this.basicData); + this.loadingBasic = false; + } + }); + }, + // 鍩虹鐮佹閫変腑鏃惰Е鍙� + selectionBasicChange(list) { + this.selectionBasicList = list; + this.$refs.crudBasic.setCurrentRow(this.selectionBasicList[list.length-1]); + //console.log(this.selectionBasicList); + }, + // 鍩虹鐮佹琚崟鍑昏〃鏍艰鏃惰Е鍙� + codeBasicSecRowClick(row){ + this.$refs.crudBasic.toggleSelection(); + this.selectionBasicList = row; + this.$refs.crudBasic.setCurrentRow(row); + this.$refs.crudBasic.toggleRowSelection(row); //閫変腑褰撳墠琛� + }, + basicSearchChange(params, done){ + //console.log(this.$refs.crudBasic); + this.sendGridCodeBasicSec(Object.assign(params,{"pkCodeRule":this.selectionList[this.selectionList.length-1].oid}),false); + done(); + }, + basicSearchReset(){ + this.sendGridCodeBasicSec({"pkCodeRule":this.selectionList[this.selectionList.length-1].oid},false); + }, + // 涓婄Щ涓嬬Щ鍩虹鐮佹 + async upOrderNum(row){ + if(!this.tipsMessage(this.selectionList)){ + return; + } + if (this.selectionList[0].lcStatus != 'Editing') { + this.$message.warning("鍙湁缂栫爜瑙勫垯鐨勭姸鎬佹槸 [缂栬緫涓璢 鐨勬椂鍊欙紝鎵嶈兘璋冩暣鐮佹椤哄簭!"); + return; + } + if(row.oid==null || row.oid==''){ + this.$message.warning("鏈幏鍙栧埌蹇呭~鍙傛暟!"); + return; + } + await upOrderNum(row.oid).then(() => { + this.loadBasic(this.selectionList[0]); + this.$message({ + type: "success", + message: "鎿嶄綔鎴愬姛!" + }); + }) + }, + downOrderNum(row){ + //console.log(row.oid); + if(!this.tipsMessage(this.selectionList)){ + return; + } + let codeRuleOid = this.selectionList[0].oid; + //console.log(this.selectionList); + if (this.selectionList[0].lcStatus != 'Editing') { + this.$message.warning("鍙湁缂栫爜瑙勫垯鐨勭姸鎬佹槸 [缂栬緫涓璢 鐨勬椂鍊欙紝鎵嶈兘璋冩暣鐮佹椤哄簭!"); + return; + } + if(row.oid==null || row.oid==''){ + this.$message.warning("鏈幏鍙栧埌蹇呭~鍙傛暟!"); + return; + } + downOrderNum(row.oid).then(() => { + this.loadBasic({"oid":codeRuleOid}); + this.$message({ + type: "success", + message: "鎿嶄綔鎴愬姛!" + }); + }) + }, + // 鍩虹鐮佹鍒锋柊鏃舵煡璇� + refreshChangeBasicSec(){ + this.loadBasic(this.selectionList.at(-1)); + }, + // 鎿嶄綔鍩虹鐮佹涓悳绱㈡竻绌虹瓑鎸夐挳鐨勬樉绀�/闅愯棌 + hideBasicTable(hideBoolean){ + this.$refs.crudBasic.option.refreshBtn = hideBoolean; + this.$refs.crudBasic.option.columnBtn = hideBoolean; + this.$refs.crudBasic.option.column[0].search = hideBoolean; + this.$refs.crudBasic.option.column[1].search = hideBoolean; + if(!hideBoolean){ + this.selectionList = []; + this.basicData = []; + } + }, + changeCutType(value){ + if (value != 'code_cut_none'){ + if(this.form.valueCutLength == ''){ + this.form.valueCutLength = 1; + } + }else{ + this.form.valueCutLength = ''; + } + }, + /** 绗竴灞傚璇濇鐩稿叧鏂规硶 */ // 鎵撳紑浜屽眰瀵硅瘽妗嗘柟娉� openAttrSelectOrGetValue(condition){ @@ -2506,14 +2560,21 @@ // 褰撳墠宸插瓨鍦ㄧ紪杈戣繃鐨勫弬鐓ч厤缃紝鎵�浠ョ洿鎺ユ墦寮�鍙傜収閰嶇疆鐣岄潰 openReconfigInterFace(preReferConfigForm){ - // console.log(preReferConfigForm); + const form = preReferConfigForm; + // 缂栬緫鐮佹鏃秗eferConfig鍙兘浼氬湪涓恒�愬弬鐓у紩鐢ㄧ殑涓氬姟绫诲瀷銆戦�夊彇鍊间箣鍚庢敼鍙� + let referConfigValue =JSON.parse(form.referConfig); + if(referConfigValue.referType != form.referBtmId){ + referConfigValue.referType = form.referBtmId || ''; + referConfigValue.referTypeName = form.referBtmName || form.referBtmId; + this.form.referConfig = JSON.stringify(referConfigValue); + } + let data = { + referTypeName: form.referBtmName, + referType: form.referBtmId, + referConfig: this.form.referConfig, + } this.$refs.referConfigFormDialog.isShowReferConfigForm = true; - let value = { - referTypeName: preReferConfigForm.referBtmName, - referType: preReferConfigForm.referBtmId, - referConfig: preReferConfigForm.referConfig, - } - this.$refs.referConfigFormDialog.initPageData(value); + this.$refs.referConfigFormDialog.initPageData(data); }, // 鎵撳紑鑷畾涔夊弬鐓ч厤缃垨鐩存帴閫夋嫨鍙傜収閰嶇疆鐨勬彁绀烘 openTipsChooseOrCust(){ @@ -2865,4 +2926,8 @@ padding: 5px 10px 10px; } + .seloption{ + margin-left: 10px; +} + </style> -- Gitblit v1.9.3