From 8bf8713da9f9ebf844af7ceefd462c2966070128 Mon Sep 17 00:00:00 2001 From: jinlin <jinlin> Date: 星期一, 15 七月 2024 08:34:37 +0800 Subject: [PATCH] 修改 --- web/src/views/modules/basicInfo/ProductModelTree.vue | 37 +++- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java | 174 +++++++++++++++++++++++- web/src/views/modules/basicInfo/XhProductModel.vue | 55 ++++--- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java | 31 +++ web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue | 22 +- web/src/views/modules/taskReliability/TaskPhase.vue | 4 web/src/views/modules/basicInfo/ParamData.vue | 42 +++--- web/src/views/modules/taskReliability/Task.vue | 7 modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/XhProductModel.java | 2 9 files changed, 289 insertions(+), 85 deletions(-) diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java index 989116c..f2df87c 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/controller/XhProductModelController.java @@ -11,10 +11,13 @@ import com.zt.common.validator.group.AddGroup; import com.zt.common.validator.group.DefaultGroup; import com.zt.common.validator.group.UpdateGroup; +import com.zt.life.core.service.ZtProductService; +import com.zt.life.dto.ImportErrDto; import com.zt.life.modules.mainPart.basicInfo.model.ProductImg; import com.zt.life.modules.mainPart.basicInfo.model.XhProductModel; import com.zt.life.modules.mainPart.basicInfo.service.XhProductModelService; import com.zt.life.modules.mainPart.sysPictureBase.service.SysPictureBaseService; +import com.zt.life.util.ImportUtil; import com.zt.modules.oss.service.SysOssService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -22,9 +25,12 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import springfox.documentation.annotations.ApiIgnore; +import javax.annotation.Resource; import java.util.List; +import java.util.Map; /** @@ -40,9 +46,6 @@ @Autowired private XhProductModelService xhProductModelService; - - @Autowired - private SysOssService sysOssService; @Autowired private SysPictureBaseService sysPictureBaseService; @@ -60,8 +63,8 @@ } @GetMapping("tree") - public Result<List<XhProductModel>> getTreeList(Boolean showXdy) { - List<XhProductModel> list = xhProductModelService.getAllTree(showXdy); + public Result<List<XhProductModel>> getTreeList(Boolean showXdy,Integer ztShow) { + List<XhProductModel> list = xhProductModelService.getAllTree(showXdy,ztShow); return Result.ok(list); } @@ -94,6 +97,24 @@ return Result.ok(list); } + @PostMapping("importProductExcel") + @ApiOperation("瀵煎叆浜у搧妯″瀷") + @LogOperation("瀵煎叆浜у搧妯″瀷") + public Result importProductExcel(MultipartFile file, String progressId,Long pid) { + Result<List<ImportErrDto>> result = Result.ok(); + try { + List<Map<String, Object>> importResults = xhProductModelService.importProductExcel(file,progressId,pid); + StringBuilder str = new StringBuilder(); + ImportUtil.importResult(result, importResults, str); + ImportUtil.ImportErrResult(result, importResults, str); + + } catch (Exception e) { + e.printStackTrace(); + } + return result; + } + + @PostMapping @ApiOperation("鏂板") @LogOperation("鏂板") diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/XhProductModel.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/XhProductModel.java index 1dcbd36..2f9e5d9 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/XhProductModel.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/model/XhProductModel.java @@ -27,6 +27,8 @@ @ApiModelProperty(value = "涓婄骇ID") private Long pid; + @ApiModelProperty(value = "鎬讳綋ID") + private Long shipId; @ApiModelProperty(value = "婧怚D") private Long srcId; @ApiModelProperty(value = "鍚嶇О") diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java index 5bb44b6..ad9d5a7 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java @@ -3,14 +3,35 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.zt.common.constant.Constant; import com.zt.common.service.BaseService; +import com.zt.common.utils.CacheUtils; +import com.zt.common.utils.CommonUtils; import com.zt.common.utils.TreeUtils; +import com.zt.common.utils.UUIDUtil; +import com.zt.core.shiro.ImportUtil; +import com.zt.life.core.model.ZtProduct; import com.zt.life.modules.mainPart.basicInfo.dao.XhProductModelDao; +import com.zt.life.modules.mainPart.basicInfo.model.ParamData; import com.zt.life.modules.mainPart.basicInfo.model.ProductImg; import com.zt.life.modules.mainPart.basicInfo.model.XhProductModel; +import com.zt.modules.sys.dto.DictTypeDto; +import com.zt.modules.sys.model.SysDictData; +import com.zt.modules.sys.model.SysDictType; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.zt.common.db.query.QueryFilter; +import org.springframework.web.multipart.MultipartFile; -import java.util.List; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.regex.Pattern; +import java.util.stream.Collectors; /** @@ -21,7 +42,7 @@ */ @Service public class XhProductModelService extends BaseService<XhProductModelDao, XhProductModel> { - + @Autowired ParamDataService paramDataService; /** * 鍒嗛〉鏌ヨ * @@ -42,14 +63,22 @@ super.deleteLogic(ids); } - public List<XhProductModel> getAllTree(Boolean showXdy) { - List<XhProductModel> productList; + public List<XhProductModel> getAllTree(Boolean showXdy, Integer ztShow) { + List<XhProductModel> productList = null; if (showXdy) { productList = baseDao.selectList(new QueryWrapper<XhProductModel>().eq(Constant.TableColumn.IS_DELETE, Constant.Bool.NO).gt("product_type", 1).orderByAsc(Constant.TableColumn.SORT)); } else { - productList = baseDao.selectList(new QueryWrapper<XhProductModel>().eq(Constant.TableColumn.IS_DELETE, - Constant.Bool.NO).gt("product_type", 1).ne("product_type", 10).orderByAsc(Constant.TableColumn.SORT)); + if (ztShow == 1) { + productList = baseDao.selectList(new QueryWrapper<XhProductModel>().eq(Constant.TableColumn.IS_DELETE, + Constant.Bool.NO).gt("product_type", 1).ne("product_type", 10).orderByAsc(Constant.TableColumn.SORT)); + } else if (ztShow == 2) { + productList = baseDao.selectList(new QueryWrapper<XhProductModel>().eq(Constant.TableColumn.IS_DELETE, + Constant.Bool.NO).gt("product_type", 2).ne("product_type", 10).orderByAsc(Constant.TableColumn.SORT)); + } else if (ztShow == 3) { + productList = baseDao.selectList(new QueryWrapper<XhProductModel>().eq(Constant.TableColumn.IS_DELETE, + Constant.Bool.NO).gt("product_type", 3).ne("product_type", 10).orderByAsc(Constant.TableColumn.SORT)); + } } return TreeUtils.build(productList); @@ -59,7 +88,7 @@ if (baseDao.getNo(pid, productType) == null) { return 0; } - return baseDao.getNo(pid,productType); + return baseDao.getNo(pid, productType); } public List<XhProductModel> getProductList() { @@ -68,12 +97,139 @@ } public List<ProductImg> getProduct(Long productId) { - XhProductModel model =this.get(productId); + XhProductModel model = this.get(productId); Long parentId = model.getPid(); - return baseDao.getProduct(productId,parentId); + return baseDao.getProduct(productId, parentId); } public List<XhProductModel> getTaskProductList() { return baseDao.getTaskProductList(); } + + public List<Map<String, Object>> importProductExcel(MultipartFile mutFile, String progressId, Long shipId) { + int count = 0; + Date beginDate = new Date(); + List<Map<String, Object>> list = new ArrayList<>();//瀛樺偍鎵�鏈夌殑瀵煎叆鐘舵�� + Map<String, Object> map;//瀛樺偍姣忎竴琛岀殑鐘舵�� + Integer sum = 0; // 鎬诲叡鐨勬潯鏁� + Integer suc = 0; // 鎴愬姛鐨勬潯鏁� + Integer err = 0; // 澶辫触鐨勬潯鏁� + int row1 = 0; + Map<String, Object> errMap = new HashMap<>(); + Map<String, Integer> reliabType = new HashMap<>(); + reliabType.put("鎸囨暟鍒嗗竷", 1); + reliabType.put("浜岄」鍒嗗竷", 2); + reliabType.put("濞佸竷灏斿垎甯�", 3); + Map<String, Integer> repairType = new HashMap<>(); + repairType.put("鎸囨暟鍒嗗竷", 1); + repairType.put("濞佸竷灏斿垎甯�", 2); + Map<String, Integer> isOrNot = new HashMap<>(); + isOrNot.put("鏄�", 1); + isOrNot.put("鍚�", 2); + try { + // 鑾峰彇瀵煎叆鏂囦欢鐨勫悗缂�鍚� + String fileName = mutFile.getOriginalFilename(); + Workbook workbook = null; + //瑙e喅excel鐗堟湰闂 + if (fileName != null && fileName.endsWith(".xls")) { + workbook = new HSSFWorkbook(mutFile.getInputStream()); + } else if (fileName != null && fileName.endsWith(".xlsx")) { + workbook = new XSSFWorkbook(mutFile.getInputStream()); + } + assert workbook != null; //鏂█濡傛灉[boolean琛ㄨ揪寮廬涓簍rue锛屽垯绋嬪簭缁х画鎵ц銆� 濡傛灉涓篺alse锛屽垯绋嬪簭鎶涘嚭AssertionError锛屽苟缁堟鎵ц銆� + int sheets = workbook.getNumberOfSheets(); + + //List<LifeManagement> lifeManagementList = new ArrayList<LifeManagement>(); + String xt = null; + String fxt = null; + if (sheets == 1) { + for (int i = 0; i < sheets; i++) { + Sheet sheet = workbook.getSheetAt(i); + int num = sheet.getLastRowNum(); // 涓�鍏辨湁澶氬皯琛� + for (int j = 1; j <= num; j++) { + CacheUtils.put(progressId, "speed", CommonUtils.getPercent(j, num)); + CacheUtils.put(progressId, "msg", "鍏�" + num + "琛岋紝宸插畬鎴愮" + j + "琛�"); + DictTypeDto lifeManagement = new DictTypeDto(); + boolean isErr = false; + row1 = j + 1; + String pattern = "yyyy-MM-dd"; + Row row = sheet.getRow(row1); + String sort = com.zt.core.shiro.ImportUtil.getCellValue(row, 0, pattern); //搴忓彿 + if (com.zt.core.shiro.ImportUtil.getCellValue(row, 1, pattern) != null) { + xt = com.zt.core.shiro.ImportUtil.getCellValue(row, 1, pattern); //绯荤粺 + } + if (com.zt.core.shiro.ImportUtil.getCellValue(row, 2, pattern) != null) { + fxt = com.zt.core.shiro.ImportUtil.getCellValue(row, 2, pattern); //鍒嗙郴缁� + } + String sb = com.zt.core.shiro.ImportUtil.getCellValue(row, 3, pattern); //璁惧 + String reliabDistribType = com.zt.core.shiro.ImportUtil.getCellValue(row, 4, pattern); //鍙潬鎬у垎甯冪被鍨� + String basicJoinCompute = com.zt.core.shiro.ImportUtil.getCellValue(row, 5, pattern); //鍙傚姞璁$畻 + String basicMtbfRegulate = com.zt.core.shiro.ImportUtil.getCellValue(row, 6, pattern); //mtbf + String basicMtbfRegulSuccRate = com.zt.core.shiro.ImportUtil.getCellValue(row, 7, pattern); //鎴愬姛鐜� + String basicMtbfOperatingRatio = com.zt.core.shiro.ImportUtil.getCellValue(row, 8, pattern); //杩愯姣� + String taskMtbcfRegulate = com.zt.core.shiro.ImportUtil.getCellValue(row, 9, pattern); //mtbcf + String taskMtbcfOtherParams2 = com.zt.core.shiro.ImportUtil.getCellValue(row, 10, pattern); //mtbcf鍏朵粬鍙傛暟2 + String taskMtbcfOtherParams3 = com.zt.core.shiro.ImportUtil.getCellValue(row, 11, pattern); //mtbcf鍏朵粬鍙傛暟3 + String taskMtbcfRegulSuccRate = com.zt.core.shiro.ImportUtil.getCellValue(row, 12, pattern); //mtbcf鎴愬姛鐜� + String taskMtbcfOperatingRatio = com.zt.core.shiro.ImportUtil.getCellValue(row, 13, pattern); //mtbcf杩愯姣� + String repairable = com.zt.core.shiro.ImportUtil.getCellValue(row, 14, pattern); //鏄惁鍙淮淇� + String repairDistribType = com.zt.core.shiro.ImportUtil.getCellValue(row, 15, pattern); //缁翠慨鍙戝竷绫诲瀷 + String repairMttcr = com.zt.core.shiro.ImportUtil.getCellValue(row, 16, pattern); //mttcr + String repairMttcrOtherParams2 = com.zt.core.shiro.ImportUtil.getCellValue(row, 17, pattern); //mttcr鍏朵粬鍙傛暟2 + String repairMttcrOtherParams3 = com.zt.core.shiro.ImportUtil.getCellValue(row, 18, pattern); //mttcr鍏朵粬鍙傛暟3 + + XhProductModel xhProductModel = new XhProductModel(); + xhProductModel.setShipId(shipId); + Long id =UUIDUtil.generateId(); + xhProductModel.setId(id); + xhProductModel.setName(xt); + xhProductModel.setProductType("3"); + this.insert(xhProductModel); + + //瀵煎叆棰勮鍙傛暟 + ParamData itemEntity = new ParamData(); + //缁戝畾璁惧ID + itemEntity.setProductId(id); + itemEntity.setName(sb); + itemEntity.setReliabDistribType(reliabType.get(reliabDistribType)); + itemEntity.setBasicJoinCompute(isOrNot.get(basicJoinCompute)); + itemEntity.setBasicMtbfRegulate(basicMtbfRegulate); + itemEntity.setBasicMtbfRegulSuccRate(basicMtbfRegulSuccRate); + itemEntity.setBasicMtbfOperatingRatio(basicMtbfOperatingRatio); + itemEntity.setTaskMtbcfRegulate(taskMtbcfRegulate); + itemEntity.setTaskMtbcfOtherParams(taskMtbcfOtherParams2 + "," + taskMtbcfOtherParams3); + itemEntity.setTaskMtbcfRegulSuccRate(taskMtbcfRegulSuccRate); + itemEntity.setTaskMtbcfOperatingRatio(taskMtbcfOperatingRatio); + itemEntity.setRepairable(isOrNot.get(repairable)); + itemEntity.setRepairDistribType(repairType.get(repairDistribType)); + itemEntity.setRepairMttcr(repairMttcr); + itemEntity.setRepairMttcrOtherParams(repairMttcrOtherParams2 + "," + repairMttcrOtherParams3); + paramDataService.insert(itemEntity); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + ImportUtil.updateErrMap(errMap, "瀵煎叆寮傚父" + e.getMessage(), "", row1); + //err++; + } + /* if (batchList.size() > 0 && err == 0) { + super.insertBatch(batchList, 100); + baseDao.updateOldId(); + } + if (batchUpdateList.size() > 0) { + super.updateBatch(batchUpdateList, 100); + }*/ + Date nowDate = new Date(); + String msg = "浜у搧妯″瀷瀵煎叆鏃堕棿锛�" + CommonUtils.getDatePoor(nowDate, beginDate) + "\r\n"; + System.out.println(msg); + suc = sum - err; + map = new HashMap<>(); + map.put("sum", sum + ""); // 鎵�鏈夊鍏ョ殑鏉℃暟 + map.put("suc", suc + ""); // 鎴愬姛鐨勬潯鏁� + map.put("err", err + ""); // 澶辫触鐨勬潯鏁� + list.add(map); + list.add(errMap); + return list; + } } diff --git a/web/src/views/modules/basicInfo/ParamData.vue b/web/src/views/modules/basicInfo/ParamData.vue index 052c79d..f90d815 100644 --- a/web/src/views/modules/basicInfo/ParamData.vue +++ b/web/src/views/modules/basicInfo/ParamData.vue @@ -46,7 +46,7 @@ <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='2'" prop="reliabDistribType" label="鍙潬鎬у垎甯冪被鍨�" :key="27" - width="100"> + > <template v-slot="{ row }"> <el-select v-if="row.isEdit" v-model="row.reliabDistribType" placeholder="璇烽�夋嫨"> @@ -78,7 +78,7 @@ <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='2'" :key="5" label="鍩烘湰鍙潬鎬ц绠�"> <!-- <zt-table-column-dict prop="joinCompute" :keys="6" label="鍙傚姞璁$畻" width="100" dict="is_or_not"/>--> - <el-table-column prop="basicJoinCompute" label="鍙傚姞璁$畻" :key="6"> + <el-table-column prop="basicJoinCompute" label="鍙傚姞璁$畻" :key="6" width="100"> <template v-slot="{ row }"> <el-select v-if="row.isEdit" v-model="row.basicJoinCompute" placeholder="鍙傚姞璁$畻"> @@ -93,30 +93,30 @@ :typeColor="typeColor" :size="size" :effect="effect" :hit="hit"/> </template> </el-table-column> - <el-table-column prop="basicMtbfRegulate" :key="7" label="瑙勫畾MTBF"> + <el-table-column prop="basicMtbfRegulate" :key="7" label="MTBF"> <template slot-scope="scope"> <el-input v-if="scope.row.isEdit" v-model="scope.row.basicMtbfRegulate"></el-input> <span v-else v-text="scope.row.basicMtbfRegulate"></span> </template> </el-table-column> - <el-table-column prop="basicMtbfAccept" :key="8" label="鍙帴鍙楃殑MTBF" width="100"> + <!--<el-table-column prop="basicMtbfAccept" :key="8" label="鍙帴鍙楃殑MTBF" width="100"> <template slot-scope="scope"> <el-input v-if="scope.row.isEdit" v-model="scope.row.basicMtbfAccept"></el-input> <span v-else v-text="scope.row.basicMtbfAccept"></span> </template> - </el-table-column> - <el-table-column prop="basicMtbfRegulSuccRate" :key="9" label="MTBF瑙勫畾鎴愬姛鐜�"> + </el-table-column>--> + <el-table-column prop="basicMtbfRegulSuccRate" :key="9" label="MTBF鎴愬姛鐜�" > <template slot-scope="scope"> <el-input v-if="scope.row.isEdit" v-model="scope.row.basicMtbfRegulSuccRate"></el-input> <span v-else v-text="scope.row.basicMtbfRegulSuccRate"></span> </template> </el-table-column> - <el-table-column prop="basicMtbfAcceptSuccRate" :key="10" label="MTBF鍙帴鍙楁垚鍔熺巼" width="140"> + <!-- <el-table-column prop="basicMtbfAcceptSuccRate" :key="10" label="MTBF鍙帴鍙楁垚鍔熺巼" width="120"> <template slot-scope="scope"> <el-input v-if="scope.row.isEdit" v-model="scope.row.basicMtbfAcceptSuccRate"></el-input> <span v-else v-text="scope.row.basicMtbfAcceptSuccRate"></span> </template> - </el-table-column> + </el-table-column>--> <el-table-column prop="basicUnitNum" label="鍗曞厓鏁伴噺" :key="11" width="100"> <template slot-scope="scope"> <el-input v-if="scope.row.isEdit" v-model="scope.row.basicUnitNum"></el-input> @@ -129,13 +129,13 @@ <span v-else v-text="scope.row.basicRunsNum"></span> </template> </el-table-column> - <el-table-column prop="basicMtbfOperatingRatio" :key="13" label="MTBF杩愯姣�" width="80"> + <el-table-column prop="basicMtbfOperatingRatio" :key="13" label="MTBF杩愯姣�" > <template slot-scope="scope"> <el-input v-if="scope.row.isEdit" v-model="scope.row.basicMtbfOperatingRatio"></el-input> <span v-else v-text="scope.row.basicMtbfOperatingRatio"></span> </template> </el-table-column> - <el-table-column prop="basicSingleRunTime" :key="14" label="杩愯鏃堕棿" width="100"> + <el-table-column prop="basicSingleRunTime" :key="14" label="杩愯鏃堕棿" > <template slot-scope="scope"> <el-input v-if="scope.row.isEdit" v-model="scope.row.basicSingleRunTime"></el-input> <span v-else v-text="scope.row.basicSingleRunTime"></span> @@ -164,37 +164,37 @@ <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='2'" :key="15" label="浠诲姟鍙潬鎬ц绠�"> - <el-table-column prop="taskMtbcfRegulate" :key="16" label="瑙勫畾MTBCF" width="100"> + <el-table-column prop="taskMtbcfRegulate" :key="16" label="MTBCF" width="100"> <template slot-scope="scope"> <el-input v-if="scope.row.isEdit" v-model="scope.row.taskMtbcfRegulate"></el-input> <span v-else v-text="scope.row.taskMtbcfRegulate"></span> </template> </el-table-column> - <el-table-column prop="taskMtbcfAccept" :key="17" label="鍙帴鍙楃殑MTBCF" width="100"> + <!--<el-table-column prop="taskMtbcfAccept" :key="17" label="鍙帴鍙楃殑MTBCF" width="100"> <template slot-scope="scope"> <el-input v-if="scope.row.isEdit" v-model="scope.row.taskMtbcfAccept"></el-input> <span v-else v-text="scope.row.taskMtbcfAccept"></span> </template> - </el-table-column> - <el-table-column prop="taskMtbcfRegulSuccRate" :key="18" label="MTBCF瑙勫畾鎴愬姛鐜�" width="120"> + </el-table-column>--> + <el-table-column prop="taskMtbcfRegulSuccRate" :key="18" label="MTBCF鎴愬姛鐜�" > <template slot-scope="scope"> <el-input v-if="scope.row.isEdit" v-model="scope.row.taskMtbcfRegulSuccRate"></el-input> <span v-else v-text="scope.row.taskMtbcfRegulSuccRate"></span> </template> </el-table-column> - <el-table-column prop="taskMtbcfAcceptSuccRate" :key="19" label="MTBCF鍙帴鍙楁垚鍔熺巼" width="140"> + <!-- <el-table-column prop="taskMtbcfAcceptSuccRate" :key="19" label="MTBCF鍙帴鍙楁垚鍔熺巼" width="100"> <template slot-scope="scope"> <el-input v-if="scope.row.isEdit" v-model="scope.row.taskMtbcfAcceptSuccRate"></el-input> <span v-else v-text="scope.row.taskMtbcfAcceptSuccRate"></span> </template> - </el-table-column> - <el-table-column prop="taskMtbcfOperatingRatio" :key="20" label="MTBCF杩愯姣�" width="100"> + </el-table-column>--> + <el-table-column prop="taskMtbcfOperatingRatio" :key="20" label="MTBCF杩愯姣�"> <template slot-scope="scope"> <el-input v-if="scope.row.isEdit" v-model="scope.row.taskMtbcfOperatingRatio"></el-input> <span v-else v-text="scope.row.taskMtbcfOperatingRatio"></span> </template> </el-table-column> - <el-table-column prop="taskMtbcfOtherParams" :key="21" label="MTBCF鍏朵粬鍙傛暟"> + <el-table-column prop="taskMtbcfOtherParams" :key="21" label="MTBCF鍏朵粬鍙傛暟" > <template slot-scope="scope"> <el-input v-if="scope.row.isEdit" v-model="scope.row.taskMtbcfOtherParams"></el-input> <span v-else v-text="scope.row.taskMtbcfOtherParams"></span> @@ -203,7 +203,7 @@ </el-table-column> <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='2'" :key="22" label="缁翠慨鍒嗗竷"> <!-- <zt-table-column-dict prop="repairable" :keys="23" label="鍙淮淇�" dict="is_or_not"/>--> - <el-table-column prop="repairable" label="鍙淮淇�" :key="23"> + <el-table-column prop="repairable" label="鍙淮淇�" :key="23" width="80"> <template v-slot="{ row }"> <el-select v-if="row.isEdit" v-model="row.repairable" placeholder="璇烽�夋嫨"> @@ -219,7 +219,7 @@ </template> </el-table-column> <!-- <zt-table-column-dict prop="repairDistribType" :keys="24" label="缁翠慨鍒嗗竷绫诲瀷" width="140" dict="RepairDistribType"/>--> - <el-table-column prop="repairDistribType" label="缁翠慨鍒嗗竷绫诲瀷" :key="24" width="100"> + <el-table-column prop="repairDistribType" label="缁翠慨鍒嗗竷绫诲瀷" :key="24" width="130"> <template v-slot="{ row }"> <el-select v-if="row.isEdit" v-model="row.repairDistribType" placeholder="璇烽�夋嫨"> @@ -240,7 +240,7 @@ <span v-else v-text="scope.row.repairMttcr"></span> </template> </el-table-column> - <el-table-column prop="repairMttcrOtherParams" :key="26" label="MTTCR鍏朵粬鍙傛暟" width="120"> + <el-table-column prop="repairMttcrOtherParams" :key="26" label="MTTCR鍏朵粬鍙傛暟" > <template slot-scope="scope"> <el-input v-if="scope.row.isEdit" v-model="scope.row.repairMttcrOtherParams"></el-input> <span v-else v-text="scope.row.repairMttcrOtherParams"></span> diff --git a/web/src/views/modules/basicInfo/ProductModelTree.vue b/web/src/views/modules/basicInfo/ProductModelTree.vue index a8edb11..5949b1d 100644 --- a/web/src/views/modules/basicInfo/ProductModelTree.vue +++ b/web/src/views/modules/basicInfo/ProductModelTree.vue @@ -7,7 +7,7 @@ size="small" clearable ></el-input> - <el-button type="primary" @click="add()" style="margin: 10px 0 0 10px;padding: 9px 18px !important;">鏂板</el-button> + <el-button 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" @@ -15,6 +15,8 @@ :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" @@ -35,12 +37,17 @@ type: Boolean, default: true }, + basic: { + type: Number, + default: 1 + }, }, data() { return { filterText: '', productList: [], + defaultId: '', defaultProps: { children: 'children', label: 'name' @@ -60,30 +67,38 @@ , mounted() { this.getProductList() - } - , + }, methods: { // 鑾峰彇绯荤粺鍒楄〃 async getProductList() { let params = { - showXdy:this.showXdy + showXdy: this.showXdy, + ztShow: this.basic } - let res = await this.$http.get('/basicInfo/XhProductModel/tree',{params:params}) + let res = await this.$http.get('/basicInfo/XhProductModel/tree', {params: params}) this.productList = res.data + if (this.basic) { + if (this.productList && this.productList[0].children) { + this.defaultId = this.productList[0].children[0].id + console.log(this.defaultId, 'this.defaultID') + 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: 'tree'}) - } - , + 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) - } + }, } } </script> diff --git a/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue b/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue index 361ed3c..f48641b 100644 --- a/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue +++ b/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue @@ -1,7 +1,7 @@ <template> <zt-dialog ref="dialog" @confirm="formSubmit"> <el-form :model="dataForm" ref="dataForm" :disabled="dataForm.disabled" label-width="120px"> - <zt-form-item label="涓婄骇绯荤粺" prop="pid" v-if="isTree"> + <zt-form-item label="涓婄骇绯荤粺" prop="pid" v-if="isShow"> <zt-combo-tree v-model="dataForm.pid" :datas="productList"/> </zt-form-item> <zt-form-item label="鍚嶇О" prop="name" rules="required"> @@ -33,7 +33,6 @@ return { disabled: false, url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getSvgImage?token=${Cookies.get('token')}&id=`, - isTree: false, isShow: true, fileId: '', productList: [], @@ -54,9 +53,13 @@ }, methods: { init(id, params) { - if (params.type === 'tree') { - this.isTree = true + if (params.type === 'xh') { this.isShow = false + this.dataForm.pid = null + this.dataForm.productType = 5 + } else if (params.type === 'zt') { + this.dataForm.pid = params.pid + this.dataForm.productType = 4 this.getProductList() } else { this.dataForm.pid = params.pid @@ -65,7 +68,6 @@ if (this.dataForm.productType === 10 && id == null) { this.getDefaultImg(this.dataForm.productType) } - this.disabled = !!id; }, // 鑾峰彇绯荤粺鍒楄〃 async getProductList() { @@ -101,18 +103,12 @@ // 琛ㄥ崟鎻愪氦 async formSubmit() { let flag = true - if (this.isTree) { - if (this.dataForm.productType !== '5' || this.dataForm.productType !== '4') { - this.$alert("涓嶆敮鎸佹柊澧炴鑺傜偣") - flag = false - } - } else { - if (this.dataForm.productType === '5' || this.dataForm.productType === '4') { + if (this.isShow) { + if (this.dataForm.productType === '5') { this.$alert("涓嶆敮鎸佹柊澧炴鑺傜偣") flag = false } } - if (!flag) { return } diff --git a/web/src/views/modules/basicInfo/XhProductModel.vue b/web/src/views/modules/basicInfo/XhProductModel.vue index b1444f6..640b5b5 100644 --- a/web/src/views/modules/basicInfo/XhProductModel.vue +++ b/web/src/views/modules/basicInfo/XhProductModel.vue @@ -8,7 +8,7 @@ </el-col> <el-col :span="19"> <div class="mod-basicInfo-xhProductModel fa-card-a" style="margin-left: 5px;"> - <zt-table-wraper ref="tableObj" defaultNotQuery="true" query-url="/basicInfo/XhProductModel/page" + <zt-table-wraper ref="tableObj" defaultNotQuery="true" query-url="/basicInfo/XhProductModel/page" delete-url="/basicInfo/XhProductModel/ " :paging='false' v-slot="{ table }"> @@ -35,11 +35,18 @@ </template> </el-table-column> <el-table-column prop="sort" label="鎺掑簭" width="100px"/> - <zt-table-column-handle :table="table" width="150px"/> + <zt-table-column-handle :table="table" width="180px"> + <template v-slot="{ row }"> + <zt-table-button v-if="productType==='5'" size="small" type="primary" + @click="importData(row)">瀵煎叆 + </zt-table-button> + </template> + </zt-table-column-handle> </el-table> <!-- 寮圭獥, 鏂板 / 淇敼 --> <add-or-update @refreshDataList="refreshData" ref="AddOrUpdate"/> <select-ty-model @refreshDataList="refreshData" ref="SelectTyModel"/> + <product-import @refreshDataList="refreshData" ref="ProductImport" /> </zt-table-wraper> </div> </el-col> @@ -53,6 +60,7 @@ import ProductModelTree from "./ProductModelTree"; import Cookies from "js-cookie"; import TyProductModel from "./TyProductModel-AddOrUpdate"; + import ProductImport from "./ProductImport"; export default { data() { @@ -61,13 +69,14 @@ productType: '', dataForm: { name: '', - type:'', + type: '', pid: '', - srcId:'', + srcId: '', } } }, components: { + ProductImport, TyProductModel, ProductModelTree, AddOrUpdate, @@ -75,31 +84,30 @@ }, methods: { add() { - this.dataForm.type=this.productType - if (this.dataForm.type !== '3') { - console.log(1111) - console.log(this.dataForm.type,'add() {') - this.dataForm.type = this.dataForm.type - 1 - } else if (this.dataForm.type === '3') { - console.log(2222) - console.log(this.dataForm.type,'add() {') - this.dataForm.type = this.dataForm.type - 2 - }else if (this.dataForm.type === '0'){ - console.log(this.dataForm.type,'add() {') - this.$alert("褰撳墠鑺傜偣涓嶅彲鏂板瀛愯妭鐐癸紝璇烽噸鏂拌缃�") - return + this.dataForm.type = this.productType + if (this.dataForm.type !== '5') { + if (this.dataForm.type !== '3') { + this.dataForm.type = this.dataForm.type - 1 + } else if (this.dataForm.type === '3') { + this.dataForm.type = this.dataForm.type - 2 + } else if (this.dataForm.type === '0') { + this.$alert("褰撳墠鑺傜偣涓嶅彲鏂板瀛愯妭鐐癸紝璇烽噸鏂拌缃�") + return + } + this.$refs.SelectTyModel.$refs.dialog.init(null, {type: this.dataForm.type, id: this.dataForm.pid}) + } else { + this.$refs.AddOrUpdate.$refs.dialog.init(null, {id: null, type: 'zt', pid: this.dataForm.pid}) } - this.$refs.SelectTyModel.$refs.dialog.init(null,{type:this.dataForm.type,id:this.dataForm.pid}) }, - addCell(){ - this.$refs.AddOrUpdate.$refs.dialog.init(null,{type:10,pid:this.dataForm.pid}) + addCell() { + this.$refs.AddOrUpdate.$refs.dialog.init(null, {type: 10, pid: this.dataForm.pid}) }, cellStyle({column}) { if (column.label === '鍚嶇О') { return 'text-align: left !important;' } }, - refreshData(){ + refreshData() { this.$refs.tableObj.query() this.$refs.ProductModelTree.getProductList() }, @@ -108,9 +116,12 @@ this.dataForm.pid = data.id this.dataForm.type = data.productType this.productType = data.productType - if(data.productType!=='10'){ + if (data.productType !== '10') { this.$refs.tableObj.query() } + }, + importData(row) { + this.$refs.ProductImport.$refs.dialog.init(row.id) } } } diff --git a/web/src/views/modules/taskReliability/Task.vue b/web/src/views/modules/taskReliability/Task.vue index fb627c9..c539733 100644 --- a/web/src/views/modules/taskReliability/Task.vue +++ b/web/src/views/modules/taskReliability/Task.vue @@ -19,15 +19,18 @@ @row-click="selectTask" @selection-change="table.selectionChangeHandle"> <el-table-column type="selection" width="40" align="center"/> - <el-table-column prop="taskName" label="浠诲姟鍚嶇О" align="center"/> + <el-table-column prop="taskName" label="浠诲姟鍚嶇О" align="center" width="120"/> <!--<el-table-column prop="taskSort" label="浠诲姟椤哄簭" align="center"/>--> <el-table-column prop="taskDuration" label="浠诲姟鎬绘椂闀�" align="right" width="120"/> + <el-table-column prop="taskStaus" label="鐘舵��" align="center" width="75"> + + </el-table-column> <zt-table-column-handle :table="table" delete-perm="taskReliability::delete"/> </el-table> <!-- 寮圭獥, 鏂板 / 淇敼 --> <add-or-update @refreshDataList="table.query" ref="AddOrUpdate"/> - <task-bino-param ref="taskBinoParam"></task-bino-param> + <task-bino-param ref="taskBinoParam"></task-bino-param> </zt-table-wraper> </div> </template> diff --git a/web/src/views/modules/taskReliability/TaskPhase.vue b/web/src/views/modules/taskReliability/TaskPhase.vue index b2915f7..f28e47f 100644 --- a/web/src/views/modules/taskReliability/TaskPhase.vue +++ b/web/src/views/modules/taskReliability/TaskPhase.vue @@ -1,12 +1,12 @@ <template> <div> <el-row :gutter="5"> - <el-col :span="7"> + <el-col :span="8"> <div class="fa-card-a" style="margin-right: 5px;"> <task @onTaskSelected="onTaskSelected" ref="task"/> </div> </el-col> - <el-col :span="11"> + <el-col :span="10"> <div class="mod-taskReliability-taskPhase fa-card-a" style="margin-left: 5px;margin-right: 5px;"> <zt-table-wraper ref="tableObj" defaultNotQuery="true" query-url="/taskReliability/TaskPhase/page" delete-url="/taskReliability/TaskPhase/" -- Gitblit v1.9.1