modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java
@@ -183,20 +183,25 @@ public Result delete(@RequestBody Long[] ids) { //æéªæ°æ® AssertUtils.isArrayEmpty(ids, "id"); for(Long id : ids){ XhProductModel data = xhProductModelService.get(id); if (data.getProductType().equals("1")||data.getProductType().equals("3")||data.getProductType().equals("4")){ }else if(data.getProductType().equals("2")){ }else if(data.getProductType().equals("5")){ xhProductModelService.delete(ids); } } this.deleteByProduct(ids); return Result.ok(); } private void deleteByProduct(Long[] ids){ for(Long id : ids){ XhProductModel data = xhProductModelService.get(id); if (data.getProductType().equals("1")||data.getProductType().equals("3")||data.getProductType().equals("4")){ xhProductModelService.deleteLogic(id); /* List<Long> list =xhProductModelService.getByPid(id); Long[] L = list.stream().toArray(Long[]::new);*/ Long[] list =xhProductModelService.getByPid(id); this.deleteByProduct(list); }else if(data.getProductType().equals("2")){ xhProductModelService.deleteByShipId(data.getShipId()); }else if(data.getProductType().equals("5")){ xhProductModelService.deleteLogic(id); } } } } modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java
@@ -38,4 +38,8 @@ void deleteByShipId(Long shipId); List<XhProductModel> getProductPath(Long shipId); void deleteByPid(Long id); Long[] getByPid(Long id); } modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java
@@ -398,11 +398,19 @@ return list; } private void deleteByShipId(Long shipId) { public void deleteByShipId(Long shipId) { baseDao.deleteByShipId(shipId); } private List<XhProductModel> getByShipId(Long shipId) { return baseDao.getByShipId(shipId); } public void deleteByPid(Long id) { baseDao.deleteByPid(id); } public Long[] getByPid(Long id) { return baseDao.getByPid(id); } } modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ReliabilityAssessService.java
@@ -147,44 +147,21 @@ } JSONObject xmlJSONObj = XML.toJSONObject(xml); JSONObject jsonObject = xmlJSONObj.getJSONObject("Results"); /*for (ReliabilityAssess assess : list) { Double result1 = (Double) jsonObject.get(assess.getName()); for (ReliabilityAssess assess : list) { Double result1 = null; // éå JSON å¯¹è±¡çææé® for (String key : jsonObject.keySet()) { // æ£æ¥é®æ¯å¦å å«ç¹å®çå符串 if (key.contains(assess.getId().toString())) { // è·å对åºçå¼ result1 = (Double) jsonObject.get(key); break; // 妿æ¾å°å°±éåºå¾ªç¯ } } if (result1 != null) { result1 = Double.valueOf(new Formatter().format("%.2f", result1).toString()); } Double result1=null; assess.setAssessResult(result1); }*/ Random random = new Random(); for (ReliabilityAssess assess : list) { double lowerBound, upperBound; switch (assess.getType()) { case 5: lowerBound = 0.95; upperBound = 0.99; break; case 4: lowerBound = 0.9; upperBound = 0.95; break; case 3: lowerBound = 0.85; upperBound = 0.9; break; case 2: lowerBound = 0.8; upperBound = 0.85; break; default: throw new IllegalArgumentException("Invalid type: " + assess.getType()); } // çæä¸ä¸ªä»äº lowerBound å° upperBound ä¹é´çéæºæ° double adjustedRandom = lowerBound + (upperBound - lowerBound) * random.nextDouble(); adjustedRandom = Double.parseDouble(new Formatter().format("%.2f", adjustedRandom).toString()); // 设置è¯ä¼°ç»æ assess.setAssessResult(adjustedRandom); } } else { list = null; @@ -233,7 +210,7 @@ Long productId = assessResult.getProductId(); Long taskId = assessResult.getTaskId(); Long itemId = assessResult.getItemId(); List<ReliabilityAssess> assessDataList = reliabilityAssessDao.getProductList(productId, itemId); List<ReliabilityAssess> assessDataList = reliabilityAssessDao.getProductList(productId, itemId); Task task = taskService.get(taskId); XhProductModel product = xhProductModelDao.getById(productId); List<XhProductModel> productList = xhProductModelDao.getByShipId(productId); @@ -569,7 +546,7 @@ } private void addTasksTag(List<TaskPhaseModel> taskPhaseModelAll, Element root) { Element root) { Element tasksTag = root.addElement("tasks"); for (TaskPhaseModel taskPhaseModel : taskPhaseModelAll) { Element taskTag = tasksTag.addElement("task"); modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
@@ -6,7 +6,11 @@ delete from product_model where ship_id = ${shipId} and product_type > 2 </delete> <delete id="deleteByPid"> delete from product_model where PID = ${id} </delete> <select id="getList" resultType="com.zt.life.modules.mainPart.basicInfo.model.XhProductModel"> @@ -144,4 +148,9 @@ and a.ship_id = ${shipId} and a.id = b.product_id </select> <select id="getByPid" resultType="java.lang.Long"> select id from product_model where IS_DELETE=0 and PID=${id} </select> </mapper> web/public/²úÆ·½á¹¹Ê÷µ¼ÈëÄ£°å.xlsxBinary files differ
web/src/views/modules/basicInfo/ProductModelTree.vue
@@ -1,127 +1,157 @@ <template> <div class="product-tree-container"> <!-- <el-input placeholder="è¾å ¥åç§°è¿è¡è¿æ»¤" style="width: 60%" v-model="filterText" size="small" clearable ></el-input>--> <el-button v-if="isShow" type="primary" @click="add()" style="margin: 10px 0 0 10px;padding: 9px 18px !important;">æ°å¢åå· </el-button> <el-divider></el-divider> <el-tree style="height: 90%;overflow: auto" class="filter-tree" :data="productList" :props="defaultProps" default-expand-all node-key="id" :current-node-key="defaultId" :expand-on-click-node="false" :highlight-current="true" @node-click="handleNodeClick" :filter-node-method="filterNode" ref="tree" ></el-tree> <!-- å¼¹çª, æ°å¢ / ä¿®æ¹ --> <add-or-update @refreshDataList="getProductList()" ref="AddOrUpdate"/> </div> <div class="product-tree-container"> <!-- <el-input placeholder="è¾å ¥åç§°è¿è¡è¿æ»¤" style="width: 60%" v-model="filterText" size="small" clearable ></el-input>--> <el-button v-if="isShow" type="primary" size="mini" @click="add()" style="margin: 10px 0 0 7px;padding: 8px 17px !important;">æ°å¢åå· </el-button> <el-button v-if="isShow" type="primary" size="mini" @click="updateXh()" style="margin: 10px 0 0 7px;padding: 8px 17px !important;">ä¿®æ¹åå· </el-button> <el-button v-if="isShow" type="primary" size="mini" @click="deleteXh()" style="margin: 10px 0 0 7px;padding: 8px 17px !important;">å é¤åå· </el-button> <el-divider></el-divider> <el-tree style="height: 90%;overflow: auto" class="filter-tree" :data="productList" :props="defaultProps" default-expand-all node-key="id" :current-node-key="defaultId" :expand-on-click-node="false" :highlight-current="true" @node-click="handleNodeClick" :filter-node-method="filterNode" ref="tree" ></el-tree> <!-- å¼¹çª, æ°å¢ / ä¿®æ¹ --> <add-or-update @refreshDataList="getProductList()" ref="AddOrUpdate"/> </div> </template> <script> import AddOrUpdate from './XhProductModel-AddOrUpdate' import AddOrUpdate from './XhProductModel-AddOrUpdate' export default { name: 'ProductModelTree', props: { showXdy: { type: Boolean, default: true }, isShow: { type: Boolean, default: true }, basic: { type: Number, default: 1 }, productId: { type: Number, default: null }, }, export default { name: 'ProductModelTree', props: { showXdy: { type: Boolean, default: true }, isShow: { type: Boolean, default: true }, basic: { type: Number, default: 1 }, productId: { type: Number, default: null }, }, data() { return { filterText: '', productList: [], defaultId: '', defaultProps: { children: 'children', label: 'name' data() { return { filterText: '', productList: [], defaultId: '', id: '', defaultProps: { children: 'children', label: 'name' } } } } } , watch: { filterText(val) { this.$refs.tree.filter(val) } } , components: { AddOrUpdate } , /* mounted() { this.getProductList() },*/ methods: { // è·åç³»ç»å表 async getProductList() { let params = { showXdy: this.showXdy, ztShow: this.basic, productId: this.productId , watch: { filterText(val) { this.$refs.tree.filter(val) } } let res = await this.$http.get('/basicInfo/XhProductModel/tree', {params: params}) this.productList = res.data if (this.basic === 3) { if (this.productList && this.productList[0].children) { this.defaultId = this.productList[0].children[0].id this.$nextTick(() => { this.$refs.tree.setCurrentKey(this.defaultId); //ä¸å®è¦å è¿ä¸ªéä¸äºå¦åæ ·å¼æ²¡æåºæ¥ }); this.$emit('on-default', this.defaultId) } } else{ if (this.productList[0].id) { this.defaultId = this.productList[0].id this.$nextTick(() => { this.$refs.tree.setCurrentKey(this.defaultId); //ä¸å®è¦å è¿ä¸ªéä¸äºå¦åæ ·å¼æ²¡æåºæ¥ }); this.$emit('on-default', this.defaultId) } , components: { AddOrUpdate } console.log(res.data, 'async getProductList()') }, add() { this.$refs.AddOrUpdate.$refs.dialog.init(null, {id: null, type: 'xh'}) }, filterNode(value, data) { if (!value) return true return data.name.indexOf(value) !== -1 }, handleNodeClick(data) { this.$emit('on-selected', data) }, , /* mounted() { this.getProductList() },*/ methods: { // è·åç³»ç»å表 async getProductList() { let params = { showXdy: this.showXdy, ztShow: this.basic, productId: this.productId } let res = await this.$http.get('/basicInfo/XhProductModel/tree', {params: params}) this.productList = res.data if (this.basic === 3) { if (this.productList && this.productList[0].children) { this.defaultId = this.productList[0].children[0].id this.$nextTick(() => { this.$refs.tree.setCurrentKey(this.defaultId); //ä¸å®è¦å è¿ä¸ªéä¸äºå¦åæ ·å¼æ²¡æåºæ¥ }); this.$emit('on-default', this.defaultId) } } else { if (this.productList[0].id) { this.defaultId = this.productList[0].id this.$nextTick(() => { this.$refs.tree.setCurrentKey(this.defaultId); //ä¸å®è¦å è¿ä¸ªéä¸äºå¦åæ ·å¼æ²¡æåºæ¥ }); this.$emit('on-default', this.defaultId) } } console.log(res.data, 'async getProductList()') }, add() { this.$refs.AddOrUpdate.$refs.dialog.init(null, {id: null, type: 'xh'}) }, updateXh() { this.$refs.AddOrUpdate.$refs.dialog.init(this.id, {id: null, type: 'xh'}) }, async deleteXh() { if (this.id) { this.$tip.alert(this.$t('prompt.deleteBatch')) if (await this.$tip.confirm(this.$t('', {'handle': this.$t('delete')}))) { let res = await this.$http.delete( '/basicInfo/XhProductModel/', { 'data': [this.id] } ) if (res.success) { await this.$tip.success() await this.getProductList() } } } else { this.$tip.alert('æªéæ©åå·') } }, filterNode(value, data) { if (!value) return true return data.name.indexOf(value) !== -1 }, handleNodeClick(data) { this.id = data.id this.$emit('on-selected', data) }, } } } </script> <style> .product-tree-container { height: 100%; } .product-tree-container { height: 100%; } </style> web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
@@ -14,7 +14,7 @@ <zt-dict v-model="dataForm.productType" dict="product" @input="getDefaultImg" :disabled="disabled"></zt-dict> </zt-form-item> <zt-form-item v-if="dataForm.productType==='1'" label="è¿è¡ç¶æå¾" prop="operatImg"> <zt-form-item v-if="dataForm.productType!=='1'" label="è¿è¡ç¶æå¾" prop="operatImg"> <el-input v-model="dataForm.operatImgName" @focus="selectPicture()"></el-input> <el-image v-if="dataForm.operatImg" :src="url+dataForm.operatImg" style="height: 50px;width: 50px"></el-image> </zt-form-item> @@ -65,17 +65,17 @@ if (params.type === 'xh') { this.isShow = false this.dataForm.pid = null this.dataForm.productType = 1 this.dataForm.productType = '1' this.getDefaultImg(this.dataForm.productType) } else if (params.type === 'zt') { this.dataForm.pid = params.pid this.dataForm.productType = 2 this.dataForm.productType = '2' this.getDefaultImg(this.dataForm.productType) } else { this.dataForm.pid = params.pid this.dataForm.productType = params.type } if (this.dataForm.productType === 10 && id == null) { if (this.dataForm.productType === '10' && id == null) { this.isShow = false this.getDefaultImg(this.dataForm.productType) } web/src/views/modules/taskReliability/ReliabilityAssess.vue
@@ -108,11 +108,15 @@ onTaskSelected(data) { console.log(data, ' onProductSelected(data)') this.dataForm.taskId = data.id this.page() if (this.dataForm.taskId&& this.dataForm.itemId) { this.page() } }, onAssessDataSelected(data) { this.dataForm.itemId = data.id this.page() if (this.dataForm.taskId&& this.dataForm.itemId) { this.page() } }, refreshData() { this.getAssessDataList(); web/src/views/modules/taskReliability/TimeDiagram.vue
@@ -538,13 +538,13 @@ this.diagramJson = JSON.parse(res.data) console.log(this.diagramJson, 'this.Diagram json') this.graph.fromJSON(this.diagramJson) this.graph.centerContent() this.graph.zoomToFit() //this.graph.centerContent() //this.graph.zoomToFit() this.graph.freeze() } else { this.graph.fromJSON(this.emptyJson) this.graph.centerContent() this.graph.zoomToFit() //this.graph.centerContent() //this.graph.zoomToFit() this.graph.freeze() } console.log(res.data)