From ea73e6f6c84d27357170168bdf70902a01b5560b Mon Sep 17 00:00:00 2001 From: ludc Date: 星期一, 10 七月 2023 15:45:01 +0800 Subject: [PATCH] Merge branch 'master' of http://dev.vci-tech.com:1065/r/ubcs --- Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/AttributeController.java | 4 Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/AttributeMapper.xml | 8 ++ Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue | 2 Source/UBCS-WEB/src/components/BatchImport/ShowImportData.vue | 100 ++++++++++++++++++++---- Source/UBCS-WEB/src/mixins/codeApply.js | 8 - Source/UBCS-WEB/src/components/BatchImport/index.vue | 1 Source/UBCS-WEB/src/views/modeling/originalAdd.vue | 18 +++ Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/AttributeMapper.java | 8 ++ Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java | 32 +++++-- 9 files changed, 141 insertions(+), 40 deletions(-) diff --git a/Source/UBCS-WEB/src/components/BatchImport/ShowImportData.vue b/Source/UBCS-WEB/src/components/BatchImport/ShowImportData.vue index 1deb7f5..8347d10 100644 --- a/Source/UBCS-WEB/src/components/BatchImport/ShowImportData.vue +++ b/Source/UBCS-WEB/src/components/BatchImport/ShowImportData.vue @@ -6,17 +6,6 @@ append-to-body top="5vh" > - <!-- <div> - <FormTemplate - v-if="type === 'batchApplyCode'" - type="add" - :selfColumnType="selfColumnType" - :selfColumnConfig="selfColumnConfig" - ref="CodeApply" - @getFormData="getCodeApplyFormData" - @referConfigDataUpdate="referConfigDataUpdate" - ></FormTemplate> - </div> --> <div class="flex_box"> <div class="left" @@ -75,10 +64,21 @@ v-if="cloNamesList.length > 1" > <el-table-column + v-if="type !== 'batchApplyCode'" type="selection" width="100px" align="center" ></el-table-column> + <el-table-column + v-else + type="operate" + width="100px" + align="center" + > + <template> + <el-button type="text">閲嶆柊缂栬緫</el-button> + </template> + </el-table-column> <el-table-column type="index" label="搴忓彿" @@ -134,9 +134,17 @@ </div> </el-tab-pane> <el-tab-pane :label="tab2Name" name="tab2"> - <el-table border :data="tab2Table" height="600px"> + <el-table + border + :data="tab2Table" + :height=" + type === 'batchApplyCode' && tab2Table.length > 0 + ? '400px' + : '700px' + " + > <el-table-column - v-for="item in cloNamesList" + v-for="item in successTableColumns" :key="item.field" :prop="item.field" :label="item.title" @@ -145,6 +153,23 @@ > </el-table-column> </el-table> + <el-card + style="min-height: 200px; margintop: 10px" + v-if="type === 'batchApplyCode' && tab2Table.length > 0" + > + <div slot="header" class="clearfix"> + <h4>缂栫爜鐢宠</h4> + </div> + <FormTemplate + v-if="type === 'batchApplyCode'" + type="add" + :selfColumnType="selfColumnType" + :selfColumnConfig="selfColumnConfig" + ref="CodeApply" + @getFormData="getCodeApplyFormData" + @referConfigDataUpdate="referConfigDataUpdate" + ></FormTemplate> + </el-card> </el-tab-pane> </el-tabs> </div> @@ -183,7 +208,7 @@ export default { name: "ShowImportData", components: { ResembleQuery, FormTemplate }, - // mixins: [codeApply], + mixins: [codeApply], props: { title: { type: String, @@ -221,6 +246,13 @@ this.$emit("update:visible", val); }, }, + successTableColumns() { + if (this.type === "batchApplyCode") { + return this.cloNamesList.slice(1); + } else { + return this.cloNamesList; + } + }, }, data() { return { @@ -236,6 +268,7 @@ activeTab: "tab1", cloNamesList: [], //鍒楄〃澶撮儴瀛楁 localCodeClassifyOid: "", + codeRuleOid: '', resembleColumList: [], //鐩镐技椤规煡鍑烘潵鐨勫垪琛ㄥ瓧娈� currentSelectedResemble: [], currentSelectedResembleRow: { @@ -245,6 +278,7 @@ formTemplateVisible: false, }, secVOList: [], + batchApplyCodeTableData: {}, }; }, @@ -261,23 +295,55 @@ } this.isExpand = !this.isExpand; }, - treeNodeClick(data) { + async treeNodeClick(data) { console.log(data); this.localCodeClassifyOid = data.codeClassifyOid; this.cloNamesList = data.cloNamesList; this.templateOid = data.oid; + if (this.type === "batchApplyCode") { + this.codeRuleOid = data.codeRuleOid + if (!this.batchApplyCodeTableData[data.codeRuleOid]) { + this.batchApplyCodeTableData[data.codeRuleOid] = {}; + } else { + console.log(this.$refs.CodeApply, 'this.$refs.CodeApply'); + if (this.$refs.CodeApply) { + console.log(this.$refs.CodeApply.validate(), 'this.$refs.CodeApply.validate()'); + if (!(await this.$refs.CodeApply.validate())) { + this.$message.warning('璇峰~鍐欎究缂栫爜鐢宠锛�') + return false + } + } + // 鏍¢獙 + } + } getResembleTable({ - codeClassifyOid: this.templateOid, + codeClassifyOid: + this.type === "batchApplyCode" ? data.codeRuleOid : this.templateOid, redisOid: this.redisOid + "-resemble", }).then((res) => { this.tab1Table = res.data.data; + if (this.type === "batchApplyCode" && this.tab1Table.length > 0) { + this.batchApplyCodeTableData[data.codeRuleOid]["tab1"] = + res.data.data; + + } }); // 鑾峰彇姝g‘鏁版嵁 getSuccessTable({ - codeClassifyOid: this.templateOid, + codeClassifyOid: + this.type === "batchApplyCode" ? data.codeRuleOid : this.templateOid, redisOid: this.redisOid + "-ok", }).then((res) => { this.tab2Table = res.data.data; + if (this.tab2Table.length > 0 && this.type === "batchApplyCode") { + this.batchApplyCodeTableData[data.codeRuleOid]["codeApply"] = {} + this.batchApplyCodeTableData[data.codeRuleOid]["tab2"] = + res.data.data; + if (this.$refs.CodeApply) { + this.$refs.CodeApply.loading = true; + } + this.getCodeRule(); + } }); getFormTemplate({ templateOid: data.oid, diff --git a/Source/UBCS-WEB/src/components/BatchImport/index.vue b/Source/UBCS-WEB/src/components/BatchImport/index.vue index c7a1d41..b951e11 100644 --- a/Source/UBCS-WEB/src/components/BatchImport/index.vue +++ b/Source/UBCS-WEB/src/components/BatchImport/index.vue @@ -271,6 +271,7 @@ cloNamesList: item.cloNamesList, oid: item.codeTemplateOid, codeClassifyOid: item.codeClassifyOid, + codeRuleOid: item.codeRuleOid, name: item.codeRuleVO.name } } else { diff --git a/Source/UBCS-WEB/src/mixins/codeApply.js b/Source/UBCS-WEB/src/mixins/codeApply.js index 4b84617..4ed57d6 100644 --- a/Source/UBCS-WEB/src/mixins/codeApply.js +++ b/Source/UBCS-WEB/src/mixins/codeApply.js @@ -41,15 +41,10 @@ codeApplyForm: {}, } }, - created() { - if (this.type === 'batchImportApply') { - this.getCodeRule() - } - }, methods: { // 鑾峰彇鐮佸�肩敵璇锋暟鎹� getCodeRule() { - getCodeRule({ codeClassifyOid: this.codeClassifyOid }).then((res) => { + getCodeRule({ codeClassifyOid: this.localCodeClassifyOid }).then((res) => { if (res.data && res.data.code === 200) { const typeList = [ "codefixedsec", @@ -73,6 +68,7 @@ }, getCodeApplyFormData(codeApplyForm) { this.codeApplyForm = codeApplyForm; + this.batchApplyCodeTableData[this.codeRuleOid]["codeApply"] = codeApplyForm }, getType(item) { console.log(item.secType, 'item.secType'); diff --git a/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue b/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue index 38699eb..cf1f1f7 100644 --- a/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue +++ b/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue @@ -374,7 +374,7 @@ }, // 灞炴�ф睜妫�绱� attrRefSearch(form,done){ - this.attrRef.key = form.key; + this.attrRef.key = form.id; this.attrRefOnLoad(); done(); this.attrRef.key = null; diff --git a/Source/UBCS-WEB/src/views/modeling/originalAdd.vue b/Source/UBCS-WEB/src/views/modeling/originalAdd.vue index d15e51b..14cea7e 100644 --- a/Source/UBCS-WEB/src/views/modeling/originalAdd.vue +++ b/Source/UBCS-WEB/src/views/modeling/originalAdd.vue @@ -39,14 +39,14 @@ </el-form-item> <el-tabs v-model="activeName" @tab-click="handleClick" stretch="true"> <el-tab-pane label="鍙傜収" name="referTab"> - <el-form-item label="鍙傜収绫诲瀷" label-width="100px"> + <el-form-item label="鍙傜収绫诲瀷" label-width="100px" class="referTypeForm"> <el-select v-model="attribute.referTypeKey" @change="referTypeSelectChange"> <el-option v-for="item in btmRefer.referTypeList" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select> </el-form-item> - <el-form-item label="鍙傜収鍚嶇О" label-width="100px"> + <el-form-item label="鍙傜収鍚嶇О" label-width="100px" class="referNameForm"> <el-input v-model="attribute.referToName" @focus="openReferConfig" clearable="true" :disabled="referToFlag" @clear="clearReferTo"> <i slot="suffix" class="el-input__icon el-icon-search"></i> @@ -486,4 +486,16 @@ .attributeForm>.el-form-item>.el-form-item__content>.el-select>.el-input>.el-input__inner { width: 200px; -}</style> +} +.attributeForm>.el-form-item>.el-form-item__content{ + width :190px; +} + +.referTypeForm > .el-form-item__content > .el-select > .el-input>.el-input__inner { + width: 200px; +} + +.referNameForm > .el-form-item__content > .el-input > .el-input__inner { + width: 200px; +} +</style> diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/AttributeController.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/AttributeController.java index eccc60d..90674ee 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/AttributeController.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/controller/AttributeController.java @@ -95,8 +95,8 @@ @GetMapping("/query-page") @ApiImplicitParams({ - @ApiImplicitParam(name = "key",value = "灞炴�у悕妯$硦",paramType = "query",dataType = "string"), - @ApiImplicitParam(name = "notIn",value = "灞炴�у悕鎺掗櫎",paramType = "query",dataType = "string") + @ApiImplicitParam(name = "key",value = "灞炴�х紪鍙锋ā绯�",paramType = "query",dataType = "string"), + @ApiImplicitParam(name = "notIn",value = "灞炴�х紪鍙锋帓闄�",paramType = "query",dataType = "string") }) @ApiOperationSupport(order = 6) @ApiOperation(value = "鏌ヨ鍒楄〃",notes = "浼犲叆鏌ョ殑鍊煎拰涓嶆煡鐨勫��") diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/AttributeMapper.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/AttributeMapper.java index f54419c..d95b5c6 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/AttributeMapper.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/mapper/AttributeMapper.java @@ -28,4 +28,12 @@ * @return */ List<BtmType> selectApplyRange(String oid); + + /** + * 妫�楠屽睘鎬х紪鍙锋槸鍚﹀凡缁忓瓨鍦� + * @param id 灞炴�х紪鍙� + * @param oid 鏁版嵁涓婚敭 + * @return 鏉℃暟 + */ + Long checkIdExist(String id, String oid); } diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java index f2b24c1..143545b 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/service/impl/AttributeServiceImpl.java @@ -27,10 +27,7 @@ import org.springframework.util.CollectionUtils; import javax.validation.constraints.NotEmpty; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -77,13 +74,9 @@ @Override public boolean submit(AttributeDTO dto) { VciBaseUtil.alertNotNull(dto.getId(),"灞炴�х紪鍙�",dto.getName(),"灞炴�у悕绉�",dto.getTypeKey(),"灞炴�х被鍨�",dto.getMaxLength(),"灞炴�ч暱搴�"); - if (!Pattern.compile(REGEXP).matcher(dto.getId()).matches()){ - throw new VciBaseException("灞炴�х紪鍙穥0}鍙兘鏄嫳鏂�",new Object[]{dto.getId()}); - } - LambdaQueryWrapper<Attribute> wrapper = Wrappers.<Attribute>query().lambda().eq(Attribute::getId, dto.getId()); - Long count = baseMapper.selectCount((Func.isEmpty(dto.getOid())) ? wrapper : wrapper.notIn(Attribute::getOid, dto.getOid())); - if (count > 0L) { - throw new ServiceException("灞炴�х紪鍙峰凡瀛樺湪!"); + String msg = checkAttributeId(dto.getId(),dto.getOid()); + if (StringUtils.isNotBlank(msg)){ + throw new VciBaseException(msg); } Attribute attribute = AttributeWrapper.build().copyBeforeSave(dto); CacheUtil.clear(OmdCacheConstant.ATTR_CACHE); @@ -91,6 +84,23 @@ } /** + * 鍏冩暟鎹殑ID鏍¢獙 + * @param id 缂栧彿鍊� + * @param oid 鏁版嵁涓婚敭 + * @return 鏍¢獙缁撴灉 + */ + private String checkAttributeId(String id, String oid) { + if (!Pattern.compile(REGEXP).matcher(id).matches()){ + return "灞炴�х紪鍙�"+id+"鍙兘鏄嫳鏂�"; + } + Long count = baseMapper.checkIdExist(id.toLowerCase(Locale.ROOT),oid); + if (count > 0L) { + return "灞炴�х紪鍙�"+id+"(涓嶅尯鍒嗗ぇ灏忓啓)宸插瓨鍦�!"; + } + return null; + } + + /** * 鍒犻櫎 * * @param oids 涓婚敭闆嗗悎 diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/AttributeMapper.xml b/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/AttributeMapper.xml index 15d3763..6aaa387 100644 --- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/AttributeMapper.xml +++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/resources/mapper/AttributeMapper.xml @@ -58,4 +58,12 @@ where attr.oid = #{oid} </select> + <select id="checkIdExist" resultType="java.lang.Long"> + select COUNT(*) FROM + <include refid="tableName"/> + where LOWER(ID) = #{id} + <if test="oid != null"> + and OID != #{oid} + </if> + </select> </mapper> -- Gitblit v1.9.3