From 3a4536445096cdb80d586a67df3c00ab4a0faecb Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期一, 22 七月 2024 16:46:38 +0800
Subject: [PATCH] 修改

---
 web/src/views/modules/basicInfo/ProductModelTree.vue                       |    1 
 web/public/产品结构树导入模板.xlsx                                                  |    0 
 web/src/views/modules/basicInfo/XhProductModel.vue                         |   26 ++++++--
 modules/mainPart/src/main/resources/mapper/basicInfo/TyProductModelDao.xml |   35 +++++------
 web/src/views/modules/taskReliability/ModelRbd.vue                         |    6 +
 web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue             |    6 +
 web/src/views/modules/baseReliability/ParamDataBasic.vue                   |   43 +++++++-------
 web/src/views/modules/taskReliability/OperatCondit.vue                     |   10 +--
 web/src/views/modules/basicInfo/ParamData.vue                              |   46 +++++++++------
 9 files changed, 95 insertions(+), 78 deletions(-)

diff --git a/modules/mainPart/src/main/resources/mapper/basicInfo/TyProductModelDao.xml b/modules/mainPart/src/main/resources/mapper/basicInfo/TyProductModelDao.xml
index a8ab5de..344618a 100644
--- a/modules/mainPart/src/main/resources/mapper/basicInfo/TyProductModelDao.xml
+++ b/modules/mainPart/src/main/resources/mapper/basicInfo/TyProductModelDao.xml
@@ -4,34 +4,29 @@
 <mapper namespace="com.zt.life.modules.mainPart.basicInfo.dao.TyProductModelDao">
 
     <select id="getList" resultType="com.zt.life.modules.mainPart.basicInfo.model.TyProductModel">
-        select *
-        from product_model_common
-        where is_delete = 0
+        SELECT PMC.*
+        FROM product_model_common PMC
+                 JOIN (SELECT product_type, src_id
+                       FROM product_model
+                       WHERE id = ${pid} AND is_delete = 0) AS PM ON TRUE
+        WHERE PMC.is_delete = 0
           AND (
-            -- 濡傛灉瀛愭煡璇㈣繑鍥炵粨鏋滀负绌猴紝鍒欐鏌.pid鏄惁涓虹┖
-                    (SELECT src_id FROM product_model WHERE id = ${pid}  AND is_delete = 0) IS NULL
-                    AND pid IS NULL
-                OR
-                -- 鍚﹀垯锛屾鏌.pid鏄惁鍦ㄥ瓙鏌ヨ缁撴灉涓�
-                    pid IN (
-                        SELECT src_id
-                        FROM product_model
-                        WHERE id = ${pid}
-                          AND is_delete = 0
-                    )
+                    PM.product_type = 3
+                    AND (CASE WHEN pm.src_id IS NULL THEN node_type > 3 ELSE pid IN (src_id) END)
+                OR (
+                            PM.product_type != 3
+                            AND (CASE WHEN pm.src_id IS NULL THEN pid IS NULL ELSE pid IN (src_id) END)
+                        )
             )
-        and ((node_type &gt; ${nodeType}) or ( id not in (select src_id from product_model where pid =
-        ${pid} and is_delete=0)))
-        ORDER BY
-            node_type,sort
+        ORDER BY PMC.node_type,
+                 PMC.sort;
     </select>
     <select id="getProductList" resultType="com.zt.life.modules.mainPart.basicInfo.model.TyProductModel">
         select a.name, a.id
         from product_model_common a
         where a.is_delete = 0
           and a.node_type &lt;&gt; 1
-        ORDER BY
-            node_type,sort
+        ORDER BY node_type, sort
     </select>
     <select id="getNo" resultType="java.lang.Integer">
         SELECT COUNT(*)
diff --git "a/web/public/\344\272\247\345\223\201\347\273\223\346\236\204\346\240\221\345\257\274\345\205\245\346\250\241\346\235\277.xlsx" "b/web/public/\344\272\247\345\223\201\347\273\223\346\236\204\346\240\221\345\257\274\345\205\245\346\250\241\346\235\277.xlsx"
new file mode 100644
index 0000000..c86c0e1
--- /dev/null
+++ "b/web/public/\344\272\247\345\223\201\347\273\223\346\236\204\346\240\221\345\257\274\345\205\245\346\250\241\346\235\277.xlsx"
Binary files differ
diff --git a/web/src/views/modules/baseReliability/ParamDataBasic.vue b/web/src/views/modules/baseReliability/ParamDataBasic.vue
index cab88f5..60146b6 100644
--- a/web/src/views/modules/baseReliability/ParamDataBasic.vue
+++ b/web/src/views/modules/baseReliability/ParamDataBasic.vue
@@ -112,29 +112,30 @@
         })
       },
       cellStyle({row, column, rowIndex, columnIndex}) {
-        let warningColor = false;
-        //   console.log(row, column, rowIndex, columnIndex);
-        //console.log(row, "row");
-        Object.keys(row).forEach((key, index) => {
-          //閬嶅巻姣忚涓瘡涓暟鎹殑state
-          if (key === "repairMttcr" || key === "basicMtbfRegulate") {
-            //console.log(key, "row key");
-            let val = row[key]
-            const numM = Number(val).toFixed(5);
-            if (numM.substring(0, numM.length - 1) === '0.0000' && val > 0) {
-              //瀹氫綅璇ユ暟鎹殑鍧愭爣
-              if (columnIndex === 2) {
-                warningColor = true;
-              }
-            }
-          }
-        });
-
-        if (warningColor) {
-          // red涓烘兂鍙樻垚鐨勫崟鍏冩牸鏍峰紡
+        const numM1 = Number(row.repairMttcr).toFixed(5);
+        const numM2 = Number(row.basicMtbfRegulate).toFixed(5);
+        console.log(numM1,numM2,'234')
+        if (numM1.substring(0, numM1.length - 1) === '0.0000' && row.repairMttcr > 0 && column.property ==="repairMttcr") {
           return 'color : red'
+        } else if (numM2.substring(0, numM1.length - 1) === '0.0000' && row.basicMtbfRegulate > 0 && column.property ==="basicMtbfRegulate") {
+          return 'color : red'
+        }else {
+          return ''
         }
-        return "";
+        // Object.keys(row).forEach((key, index) => {
+        //   //閬嶅巻姣忚涓瘡涓暟鎹殑state
+        //   if (key === "repairMttcr" || key === "basicMtbfRegulate") {
+        //     //console.log(key, "row key");
+        //     let val = row[key]
+        //     const numM = Number(val).toFixed(5);
+        //     if (numM.substring(0, numM.length - 1) === '0.0000' && val > 0) {
+        //       //瀹氫綅璇ユ暟鎹殑鍧愭爣
+        //       if (columnIndex === 2) {
+        //         warningColor = true;
+        //       }
+        //     }
+        //   }
+        // });
       },
     }
   }
diff --git a/web/src/views/modules/basicInfo/ParamData.vue b/web/src/views/modules/basicInfo/ParamData.vue
index 4bba40e..fed2bcb 100644
--- a/web/src/views/modules/basicInfo/ParamData.vue
+++ b/web/src/views/modules/basicInfo/ParamData.vue
@@ -3,7 +3,7 @@
     <el-row :gutter="5">
       <el-col :span="4">
         <div class="fa-card-a" style="margin-right: 5px;height: calc(100vh - 123px)">
-          <product-model-tree @on-selected="onProductSelected" showXdy="false" :isShow="false"/>
+          <product-model-tree @on-selected="onProductSelected" @on-default="onDefault" showXdy="false" :isShow="false"/>
         </div>
       </el-col>
       <el-col :span="20">
@@ -37,7 +37,7 @@
               </el-form-item>
             </el-form>
             <el-tabs v-model="activeName" @tab-click="handleClick">
-              <el-tab-pane label="鍩烘湰鍙潬鎬�" name="first" >
+              <el-tab-pane label="鍩烘湰鍙潬鎬�" name="first">
                 <el-table v-loading="table.dataLoading" :data="table.dataList" height="100px"
                           v-adaptive="{bottomOffset:30}"
                           :header-cell-style="{'text-align':'center'}"
@@ -63,7 +63,8 @@
                                    :hit="hit"/>
                     </template>
                   </el-table-column>
-                  <el-table-column v-if="dataForm.productType==='2'" :key="3" prop="baseOperatRatio" label="鍩烘湰鍙潬鎬ц繍琛屾瘮" align="right">
+                  <el-table-column v-if="dataForm.productType==='2'" :key="3" prop="baseOperatRatio" label="鍩烘湰鍙潬鎬ц繍琛屾瘮"
+                                   align="right">
                     <template slot-scope="scope">
                       <el-input v-if="scope.row.isEdit" v-model="scope.row.baseOperatRatio"></el-input>
                       <span v-else v-text="scope.row.baseOperatRatio"></span>
@@ -80,7 +81,7 @@
                   <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='4'" :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"  width="100" align="center">
+                    <el-table-column prop="basicJoinCompute" label="鍙傚姞璁$畻" :key="6" width="100" align="center">
                       <template v-slot="{ row }">
                         <el-select v-if="row.isEdit" v-model="row.basicJoinCompute"
                                    placeholder="鍙傚姞璁$畻">
@@ -98,7 +99,7 @@
                     <el-table-column prop="basicMtbfRegulate" :key="7" label="MTBF" align="right" width="110">
                       <template slot-scope="scope">
                         <el-input v-if="scope.row.isEdit" v-model="scope.row.basicMtbfRegulate"></el-input>
-                        <span v-else >{{scope.row.basicMtbfRegulate | keepNumber}}</span>
+                        <span v-else>{{scope.row.basicMtbfRegulate | keepNumber}}</span>
                       </template>
                     </el-table-column>
                     <!--<el-table-column prop="basicMtbfAccept" :key="8" label="鍙帴鍙楃殑MTBF" width="100">
@@ -113,12 +114,12 @@
                         <span v-else v-text="scope.row.basicMtbfRegulSuccRate"></span>
                       </template>
                     </el-table-column>
-                   <!-- <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 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 prop="basicUnitNum" label="鍗曞厓鏁伴噺" :key="11" width="100" align="center">
                       <template slot-scope="scope">
                         <el-input v-if="scope.row.isEdit" v-model="scope.row.basicUnitNum"></el-input>
@@ -185,12 +186,12 @@
                         <span v-else v-text="scope.row.taskMtbcfRegulSuccRate"></span>
                       </template>
                     </el-table-column>
-                   <!-- <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="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杩愯姣�" align="right">
                       <template slot-scope="scope">
                         <el-input v-if="scope.row.isEdit" v-model="scope.row.taskMtbcfOperatingRatio"></el-input>
@@ -210,7 +211,8 @@
                       </template>
                     </el-table-column>
                   </el-table-column>
-                  <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='4'" :key="22" label="缁翠慨鍒嗗竷" align="center">
+                  <el-table-column v-if="dataForm.productType==='3'||dataForm.productType==='4'" :key="22" label="缁翠慨鍒嗗竷"
+                                   align="center">
                     <!--                <zt-table-column-dict prop="repairable" :keys="23" label="鍙淮淇�" dict="is_or_not"/>-->
                     <el-table-column prop="repairable" label="鍙淮淇�" :key="23" width="80" align="center">
                       <template v-slot="{ row }">
@@ -246,7 +248,7 @@
                     <el-table-column prop="repairMttcr" label="MTTCR" :key="25" width="100" align="right">
                       <template slot-scope="scope">
                         <el-input v-if="scope.row.isEdit" v-model="scope.row.repairMttcr"></el-input>
-                        <span v-else >{{scope.row.repairMttcr | keepNumber}}</span>
+                        <span v-else>{{scope.row.repairMttcr | keepNumber}}</span>
                       </template>
                     </el-table-column>
                     <el-table-column prop="repairMttcrOtherParams2" :key="26" label="MTTCR鍏朵粬鍙傛暟2" align="right">
@@ -447,6 +449,12 @@
           this.$refs.tableObj.query()
         })
       },
+      onDefault(defaultId) {
+        this.dataForm.srcId = defaultId
+        this.dataForm.productType = 2
+        this.activeName = 'first'
+        this.$refs.tableObj.query()
+      },
       dataLoaded(data) {
         this.dataList = data
         for (let dataList of data) {
diff --git a/web/src/views/modules/basicInfo/ProductModelTree.vue b/web/src/views/modules/basicInfo/ProductModelTree.vue
index 0688faf..9f59fb1 100644
--- a/web/src/views/modules/basicInfo/ProductModelTree.vue
+++ b/web/src/views/modules/basicInfo/ProductModelTree.vue
@@ -84,7 +84,6 @@
         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); //涓�瀹氳鍔犺繖涓�変腑浜嗗惁鍒欐牱寮忔病鏈夊嚭鏉�
             });
diff --git a/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue b/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
index e67cf17..cf6daf8 100644
--- a/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
+++ b/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
@@ -84,8 +84,10 @@
           productType: selected
         }
         let res = await this.$http.get(`/sysPictureBase/getDefaultImg`, {params: params})
-        this.dataForm.operatImgName = res.data.name
-        this.dataForm.operatImg = res.data.id
+        if (res.data){
+          this.dataForm.operatImgName = res.data.name
+          this.dataForm.operatImg = res.data.id
+        }
       },
       selectPicture() {
         this.$refs.pictureSelect.$refs.dialog.init(this.dataForm.productType)
diff --git a/web/src/views/modules/basicInfo/XhProductModel.vue b/web/src/views/modules/basicInfo/XhProductModel.vue
index c0a06ae..c5155b1 100644
--- a/web/src/views/modules/basicInfo/XhProductModel.vue
+++ b/web/src/views/modules/basicInfo/XhProductModel.vue
@@ -3,7 +3,8 @@
     <el-row :gutter="5">
       <el-col :span="5">
         <div class="fa-card-a" style="margin-right: 5px;height: calc(100vh - 123px)">
-          <product-model-tree @on-selected="onProductSelected" showXdy="true" ref="ProductModelTree"/>
+          <product-model-tree @on-selected="onProductSelected" @on-default="onDefault" showXdy="true"
+                              ref="ProductModelTree"/>
         </div>
       </el-col>
       <el-col :span="19">
@@ -19,6 +20,8 @@
               <el-form-item>
                 <zt-button v-if="productType && productType!=='10'" type="query" @click="table.query()"/>
                 <zt-button v-if="productType && productType!=='10'" type="add" @click="add()"/>
+                <zt-button v-if="productType==='1'" size="small" type="primary" @click="exportProduct()">瀵煎嚭妯℃澘
+                </zt-button>
                 <zt-button v-if="productType==='3'" type="primary" @click="addCell()">鏂板铏氬崟鍏�</zt-button>
                 <zt-button v-if="productType && productType!=='10'" type="delete" @click="table.deleteHandle()"/>
               </el-form-item>
@@ -27,7 +30,7 @@
                       row-key="id"
                       @selection-change="table.selectionChangeHandle"
                       :header-cell-style="{'text-align':'center'}">
-              <el-table-column prop="name" label="鍚嶇О" />
+              <el-table-column prop="name" label="鍚嶇О"/>
               <zt-table-column-dict prop="productType" label="鑺傜偣绫诲瀷" dict="product"/>
               <el-table-column prop="operatImg" label="杩愯鍥剧墖" align="center">
                 <template v-slot="{ row }">
@@ -46,7 +49,7 @@
             <!-- 寮圭獥, 鏂板 / 淇敼 -->
             <add-or-update @refreshDataList="refreshData" ref="AddOrUpdate"/>
             <select-ty-model @refreshDataList="refreshData" ref="SelectTyModel"/>
-            <product-import @refreshDataList="refreshData" ref="ProductImport" />
+            <product-import @refreshDataList="refreshData" ref="ProductImport"/>
           </zt-table-wraper>
         </div>
       </el-col>
@@ -104,19 +107,28 @@
         this.$refs.ProductModelTree.getProductList()
       },
       onProductSelected(data) {
-        console.log(data,'onProductSelected')
+        console.log(data, 'onProductSelected')
         this.dataForm.pid = data.id
         this.dataForm.type = data.productType
         this.productType = data.productType
         if (data.productType !== '10') {
           this.$refs.tableObj.query()
         }
-        console.log(data.productType,' data.productType')
-        console.log(this.productType,' data.productType')
+        console.log(data.productType, ' data.productType')
+        console.log(this.productType, ' data.productType')
       },
       importData(row) {
         this.$refs.ProductImport.$refs.dialog.init(row)
-      }
+      },
+      exportProduct() {
+        window.location.href = './浜у搧缁撴瀯鏍戝鍏ユā鏉�.xlsx'
+      },
+      onDefault(defaultId) {
+        this.dataForm.pid = defaultId
+        this.dataForm.type = 2
+        this.productType = 2
+        this.$refs.tableObj.query()
+      },
     }
   }
 </script>
diff --git a/web/src/views/modules/taskReliability/ModelRbd.vue b/web/src/views/modules/taskReliability/ModelRbd.vue
index 61fde75..2a29278 100644
--- a/web/src/views/modules/taskReliability/ModelRbd.vue
+++ b/web/src/views/modules/taskReliability/ModelRbd.vue
@@ -3,7 +3,7 @@
     <el-row :gutter="5">
       <el-col :span="5">
         <div class="fa-card-a" style="margin-right: 5px;height: calc(100vh - 123px)">
-          <product-model-tree @on-selected="onProductSelected" showXdy="true" :isShow="false"/>
+          <product-model-tree @on-selected="onProductSelected" @on-default="onDefault" showXdy="true" :isShow="false"/>
         </div>
       </el-col>
       <el-col :span="19">
@@ -88,6 +88,10 @@
         console.log(data, 'onProductSelected(data)')
         this.$refs.tableObj.query()
       },
+      onDefault(defaultId){
+        this.dataForm.productId = defaultId
+        this.$refs.tableObj.query()
+      },
       drawRBD(row) {
         this.dialogVisible2 = true
         this.$nextTick(() => {
diff --git a/web/src/views/modules/taskReliability/OperatCondit.vue b/web/src/views/modules/taskReliability/OperatCondit.vue
index a55d99a..e0f9934 100644
--- a/web/src/views/modules/taskReliability/OperatCondit.vue
+++ b/web/src/views/modules/taskReliability/OperatCondit.vue
@@ -66,7 +66,6 @@
       OperaConditModel,
       AddOrUpdate
     },
-
     methods: {
       add() {
         this.$refs.AddOrUpdate.$refs.dialog.init(null, {productId: this.dataForm.productId})
@@ -79,6 +78,7 @@
         let res = await this.$http.get('/basicInfo/XhProductModel/getTaskProductList')
         this.productList = res.data
         console.log(this.productList, ' async getTaskProductList()')
+        this.onProductSelected(this.productList[0])
       },
       selectOperatCondit(row) {
         if (this.$refs.model.isChange) {
@@ -93,12 +93,8 @@
         }
         this.$refs.model.init(param)
       },
-      tableRowClassName(
-        {
-          row,
-          rowIndex
-        }) {
-        if (row.id == this.currentId) {
+      tableRowClassName({row, rowIndex}) {
+        if (row.id === this.currentId) {
           return 'select-row';
         } else {
           return 'not-select-row';

--
Gitblit v1.9.1