From de1b6284b3cb6349575938782ee34d2ad0349735 Mon Sep 17 00:00:00 2001
From: wente <329538422@qq.com>
Date: 星期四, 14 三月 2024 18:04:19 +0800
Subject: [PATCH] 表决数量

---
 web/src/views/modules/taskReliability/RBD-edit-img.vue     |   53 +++-----
 web/src/views/modules/taskReliability/ConfigNode/index.vue |  269 +++++++++++++++++++++++++++++---------------
 web/src/views/modules/taskReliability/ModelRbd.vue         |    4 
 3 files changed, 196 insertions(+), 130 deletions(-)

diff --git a/web/src/views/modules/taskReliability/ConfigNode/index.vue b/web/src/views/modules/taskReliability/ConfigNode/index.vue
index d8d41d0..0ba5b6f 100644
--- a/web/src/views/modules/taskReliability/ConfigNode/index.vue
+++ b/web/src/views/modules/taskReliability/ConfigNode/index.vue
@@ -3,31 +3,79 @@
   <el-card style="height: 100%">
     <el-tabs v-model="activeName" id="tabPane">
       <el-tab-pane label="灞炴��"  name="first">
-        <el-row :gutter="5" v-show="shape!=='custom-circle1'"  align="middle" style="margin-top:20px">
-          <el-col :span=8 style="font-size: 16px;line-height: 32px">鑺傜偣鍚嶇О</el-col>
-          <el-col :span=16 >
+        <el-form :model="globalGridAttr">
+          <el-form-item v-show="shape!=='custom-circle1'" label="鑺傜偣鍚嶇О" prop="nodeText" label-width="80px">
             <el-input  v-model="globalGridAttr.nodeText" style="width:100%" @change="onTextChange"></el-input>
-          </el-col>
-        </el-row>
-        <el-row :gutter="5" v-show="nodeType=='node'" align="middle" style="margin-top:20px;">
-          <el-col :span=8 style="font-size: 16px;line-height: 32px">杩炴帴鍏崇郴</el-col>
-          <el-col :span=16>
+          </el-form-item>
+          <el-form-item v-show="nodeType=='node'" label="杩炴帴鍏崇郴" prop="nodeTypeExt" label-width="80px">
             <el-select style="width: 100%" v-model="globalGridAttr.nodeTypeExt" @change="onNodeTypeExtChange">
               <el-option
-                v-for="item in options"
-                :key="item.value"
-                :label="item.label"
-                :value="item.value">
+                  v-for="item in options"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value">
               </el-option>
             </el-select>
-          </el-col>
-        </el-row>
-        <el-row :gutter="5" v-show="nodeType=='node' && showNumberInput" align="middle" style="margin-top:20px;">
-          <el-col :span=8 style="font-size: 16px;line-height: 32px">鏁伴噺</el-col>
-          <el-col :span=16>
-            <el-input type="number" v-model="globalGridAttr.numberInputValue" @change="onNumberInputValue"  placeholder="璇疯緭鍏ユ暟瀛�"></el-input>
-          </el-col>
-        </el-row>
+          </el-form-item>
+          <el-form-item v-show="nodeType=='vote' || (nodeType=='node' && showNumberInput)" label="琛ㄥ喅鏁伴噺" prop="voteNum" label-width="80px">
+            <el-input type="number" v-model="globalGridAttr.voteNum" @change="onNumberInputValue"  placeholder="璇疯緭鍏ユ暟瀛�"></el-input>
+          </el-form-item>
+          <el-form-item v-show="nodeType=='node'" label="鍙潬鎬у垎甯冪被鍨�" prop="reliabDistribType" label-width="125px">
+            <zt-dict style="width: 100%" v-model="globalGridAttr.reliabDistribType" @input="onReliabDistribType" dict="ReliabDistribType" placeholder="鍙潬鎬у垎甯冪被鍨�" clearable/>
+          </el-form-item>
+          <el-form-item v-show="nodeType=='node'" label="MTBCF" prop="taskMtbcf" label-width="80px">
+            <el-input  v-model="globalGridAttr.taskMtbcf" @change="onTaskMtbcfChange"></el-input>
+          </el-form-item>
+          <el-form-item v-show="nodeType=='node'" label="鍙傛暟2" prop="taskMtbcfOther" label-width="80px">
+            <el-input  v-model="globalGridAttr.taskMtbcfOther" @change="onTaskMtbcfOtherChange"></el-input>
+          </el-form-item>
+          <el-form-item v-show="nodeType=='node'" label="鏄惁鍙淮淇�" prop="isRepair" label-width="100px">
+            <el-select style="width: 100%" v-model="globalGridAttr.isRepair" @change="onIsRepairChange">
+              <el-option
+                  v-for="item in isRepair"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value">
+              </el-option>
+            </el-select>
+          </el-form-item>
+          <div v-show="nodeType=='node' && showRepairInput">
+            <el-form-item label="鍙淮淇�у垎甯冪被鍨�" prop="repairDistribType" label-width="140px">
+              <zt-dict v-model="globalGridAttr.repairDistribType" dict="RepairDistribType" @input="onRepairDistribTypeChange" placeholder="缁翠慨鎬у垎甯冪被鍨�" clearable/>
+            </el-form-item>
+            <el-form-item label="MTTCR" prop="repairMttcr" label-width="80px">
+              <el-input  v-model="globalGridAttr.repairMttcr" @change="onRepairMttcrChange"></el-input>
+            </el-form-item>
+            <el-form-item label="鍙傛暟2" prop="repairMttcrOther" label-width="80px">
+              <el-input  v-model="globalGridAttr.repairMttcrOther" @change="onRepairMttcrOtherChange"></el-input>
+            </el-form-item>
+          </div>
+        </el-form>
+<!--        <el-row :gutter="5" v-show="shape!=='custom-circle1'"  align="middle" style="margin-top:20px">-->
+<!--          <el-col :span=8 style="font-size: 16px;line-height: 32px">鑺傜偣鍚嶇О</el-col>-->
+<!--          <el-col :span=16 >-->
+<!--            <el-input  v-model="globalGridAttr.nodeText" style="width:100%" @change="onTextChange"></el-input>-->
+<!--          </el-col>-->
+<!--        </el-row>-->
+<!--        <el-row :gutter="5" v-show="nodeType=='node'" align="middle" style="margin-top:20px;">-->
+<!--          <el-col :span=8 style="font-size: 16px;line-height: 32px">杩炴帴鍏崇郴</el-col>-->
+<!--          <el-col :span=16>-->
+<!--            <el-select style="width: 100%" v-model="globalGridAttr.nodeTypeExt" @change="onNodeTypeExtChange">-->
+<!--              <el-option-->
+<!--                v-for="item in options"-->
+<!--                :key="item.value"-->
+<!--                :label="item.label"-->
+<!--                :value="item.value">-->
+<!--              </el-option>-->
+<!--            </el-select>-->
+<!--          </el-col>-->
+<!--        </el-row>-->
+<!--        <el-row :gutter="5" v-show="nodeType=='node' && showNumberInput" align="middle" style="margin-top:20px;">-->
+<!--          <el-col :span=8 style="font-size: 16px;line-height: 32px">琛ㄥ喅鏁伴噺</el-col>-->
+<!--          <el-col :span=16>-->
+<!--            <el-input type="number" v-model="globalGridAttr.voteNum" @change="onNumberInputValue"  placeholder="璇疯緭鍏ユ暟瀛�"></el-input>-->
+<!--          </el-col>-->
+<!--        </el-row>-->
 <!--        <el-row :gutter="5" v-show="nodeType=='node'" align="middle" style="margin-top:20px;">-->
 <!--          <el-col :span=8 style="font-size: 16px;line-height: 32px">鐘舵��</el-col>-->
 <!--          <el-col :span=16>-->
@@ -41,57 +89,57 @@
 <!--            </el-select>-->
 <!--          </el-col>-->
 <!--        </el-row>-->
-        <el-row :gutter="5" v-show="nodeType=='node'" align="middle" style="margin-top:20px;">
-          <el-col :span=8 style="font-size: 16px;line-height: 32px">鍙潬鎬у垎甯冪被鍨�</el-col>
-          <el-col :span=16>
-            <zt-dict v-model="globalGridAttr.reliabDistribType" @input="onReliabDistribType" dict="ReliabDistribType" placeholder="鍙潬鎬у垎甯冪被鍨�" clearable/>
-          </el-col>
-        </el-row>
-        <el-row :gutter="5" v-show="nodeType=='node'" align="middle" style="margin-top:20px;">
-          <el-col :span=8 style="font-size: 16px;line-height: 32px">MTBCF</el-col>
-          <el-col :span=16>
-            <el-input  type="number" v-model="globalGridAttr.taskMtbcf" @change="onTaskMtbcfChange"></el-input>
-          </el-col>
-        </el-row>
-        <el-row :gutter="5" v-show="nodeType=='node'" align="middle" style="margin-top:20px;">
-          <el-col :span=8 style="font-size: 16px;line-height: 32px">鍙傛暟2</el-col>
-          <el-col :span=16>
-            <el-input  v-model="globalGridAttr.taskMtbcfOther" @change="onTaskMtbcfOtherChange"></el-input>
-          </el-col>
-        </el-row>
-        <el-row :gutter="5" v-show="nodeType=='node'" align="middle" style="margin-top:20px;">
-          <el-col :span=8 style="font-size: 16px;line-height: 32px">鏄惁鍙淮淇�</el-col>
-          <el-col :span=16>
-            <el-select style="width: 100%" v-model="globalGridAttr.isRepair" @change="onIsRepairChange">
-              <el-option
-                  v-for="item in isRepair"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value">
-              </el-option>
-            </el-select>
-          </el-col>
-        </el-row>
-        <div v-show="nodeType=='node' && showRepairInput">
-          <el-row :gutter="5"  align="middle" style="margin-top:20px;">
-            <el-col :span=8 style="font-size: 16px;line-height: 32px">鍙淮淇�у垎甯冪被鍨�</el-col>
-            <el-col :span=16>
-              <zt-dict v-model="globalGridAttr.repairDistribType" dict="RepairDistribType" @input="onRepairDistribTypeChange" placeholder="缁翠慨鎬у垎甯冪被鍨�" clearable/>
-            </el-col>
-          </el-row>
-          <el-row :gutter="5"  align="middle" style="margin-top:20px;">
-            <el-col :span=8 style="font-size: 16px;line-height: 32px">MTTCR</el-col>
-            <el-col :span=16>
-              <el-input  type="number" v-model="globalGridAttr.repairMttcr" @change="onRepairMttcrChange"></el-input>
-            </el-col>
-          </el-row>
-          <el-row :gutter="5"  align="middle" style="margin-top:20px;">
-            <el-col :span=8 style="font-size: 16px;line-height: 32px">鍙傛暟2</el-col>
-            <el-col :span=16>
-              <el-input  v-model="globalGridAttr.repairMttcrOther" @change="onRepairMttcrOtherChange"></el-input>
-            </el-col>
-          </el-row>
-        </div>
+<!--        <el-row :gutter="5" v-show="nodeType=='node'" align="middle" style="margin-top:20px;">-->
+<!--          <el-col :span=8 style="font-size: 16px;line-height: 32px">鍙潬鎬у垎甯冪被鍨�</el-col>-->
+<!--          <el-col :span=16>-->
+<!--            <zt-dict v-model="globalGridAttr.reliabDistribType" @input="onReliabDistribType" dict="ReliabDistribType" placeholder="鍙潬鎬у垎甯冪被鍨�" clearable/>-->
+<!--          </el-col>-->
+<!--        </el-row>-->
+<!--        <el-row :gutter="5" v-show="nodeType=='node'" align="middle" style="margin-top:20px;">-->
+<!--          <el-col :span=8 style="font-size: 16px;line-height: 32px">MTBCF</el-col>-->
+<!--          <el-col :span=16>-->
+<!--            <el-input  v-model="globalGridAttr.taskMtbcf" @change="onTaskMtbcfChange"></el-input>-->
+<!--          </el-col>-->
+<!--        </el-row>-->
+<!--        <el-row :gutter="5" v-show="nodeType=='node'" align="middle" style="margin-top:20px;">-->
+<!--          <el-col :span=8 style="font-size: 16px;line-height: 32px">鍙傛暟2</el-col>-->
+<!--          <el-col :span=16>-->
+<!--            <el-input  v-model="globalGridAttr.taskMtbcfOther" @change="onTaskMtbcfOtherChange"></el-input>-->
+<!--          </el-col>-->
+<!--        </el-row>-->
+<!--        <el-row :gutter="5" v-show="nodeType=='node'" align="middle" style="margin-top:20px;">-->
+<!--          <el-col :span=8 style="font-size: 16px;line-height: 32px">鏄惁鍙淮淇�</el-col>-->
+<!--          <el-col :span=16>-->
+<!--            <el-select style="width: 100%" v-model="globalGridAttr.isRepair" @change="onIsRepairChange">-->
+<!--              <el-option-->
+<!--                  v-for="item in isRepair"-->
+<!--                  :key="item.value"-->
+<!--                  :label="item.label"-->
+<!--                  :value="item.value">-->
+<!--              </el-option>-->
+<!--            </el-select>-->
+<!--          </el-col>-->
+<!--        </el-row>-->
+<!--        <div v-show="nodeType=='node' && showRepairInput">-->
+<!--          <el-row :gutter="5"  align="middle" style="margin-top:20px;">-->
+<!--            <el-col :span=8 style="font-size: 16px;line-height: 32px">鍙淮淇�у垎甯冪被鍨�</el-col>-->
+<!--            <el-col :span=16>-->
+<!--              <zt-dict v-model="globalGridAttr.repairDistribType" dict="RepairDistribType" @input="onRepairDistribTypeChange" placeholder="缁翠慨鎬у垎甯冪被鍨�" clearable/>-->
+<!--            </el-col>-->
+<!--          </el-row>-->
+<!--          <el-row :gutter="5"  align="middle" style="margin-top:20px;">-->
+<!--            <el-col :span=8 style="font-size: 16px;line-height: 32px">MTTCR</el-col>-->
+<!--            <el-col :span=16>-->
+<!--              <el-input  v-model="globalGridAttr.repairMttcr" @change="onRepairMttcrChange"></el-input>-->
+<!--            </el-col>-->
+<!--          </el-row>-->
+<!--          <el-row :gutter="5"  align="middle" style="margin-top:20px;">-->
+<!--            <el-col :span=8 style="font-size: 16px;line-height: 32px">鍙傛暟2</el-col>-->
+<!--            <el-col :span=16>-->
+<!--              <el-input  v-model="globalGridAttr.repairMttcrOther" @change="onRepairMttcrOtherChange"></el-input>-->
+<!--            </el-col>-->
+<!--          </el-row>-->
+<!--        </div>-->
       </el-tab-pane>
       <el-tab-pane label="鏍峰紡"  name="second">
         <el-row :gutter="5" align="middle" style="margin-top:20px">
@@ -249,11 +297,11 @@
     },
     // 琛ㄥ喅鏁伴噺
     onNumberInputValue(e){
-      this.globalGridAttr.voteSum = e
-      let voteSum={
-        voteSum:this.globalGridAttr.voteSum
+      this.globalGridAttr.voteNum = e
+      let voteNum={
+        voteNum:this.globalGridAttr.voteNum
       }
-      this.curCel.setData(voteSum)
+      this.curCel.setData(voteNum)
       this.curCel = this.nodeOpt(this.id,this.globalGridAttr)
     },
     // 鍙潬鎬у垎甯冪被鍨�
@@ -267,21 +315,34 @@
     },
     // mtbf
     onTaskMtbcfChange(e){
-      this.globalGridAttr.taskMtbcf =e
-      let taskMtbcf={
-        taskMtbcf:this.globalGridAttr.taskMtbcf
+      const numberRegex = /^-?\d+(\.\d+)?$/
+      if(numberRegex.test(e)){
+          this.globalGridAttr.taskMtbcf =e
+          let taskMtbcf={
+              taskMtbcf:this.globalGridAttr.taskMtbcf
+          }
+          this.curCel.setData(taskMtbcf)
+          this.curCel = this.nodeOpt(this.id,this.globalGridAttr)
+      }else {
+        this.$message.error('杈撳叆鏍煎紡鏈夎锛岃杈撳叆瀹炴暟')
       }
-      this.curCel.setData(taskMtbcf)
-      this.curCel = this.nodeOpt(this.id,this.globalGridAttr)
+
     },
     // 鍙傛暟2
     onTaskMtbcfOtherChange(e){
-      this.globalGridAttr.taskMtbcfOther = e
-      let taskMtbcfOther={
-        taskMtbcfOther:this.globalGridAttr.taskMtbcfOther
+      const numberRegex = /^-?\d+(\.\d+)?$/
+      console.log(e,'eeeee')
+      if(numberRegex.test(e)){
+        this.globalGridAttr.taskMtbcfOther = e
+        let taskMtbcfOther={
+          taskMtbcfOther:this.globalGridAttr.taskMtbcfOther
+        }
+        this.curCel.setData(taskMtbcfOther)
+        this.curCel = this.nodeOpt(this.id,this.globalGridAttr)
+      }else {
+        this.$message.error('杈撳叆鏍煎紡鏈夎锛岃杈撳叆瀹炴暟')
       }
-      this.curCel.setData(taskMtbcfOther)
-      this.curCel = this.nodeOpt(this.id,this.globalGridAttr)
+
     },
     // 鏄惁鍙淮淇�
     onIsRepairChange(e){
@@ -304,21 +365,32 @@
     },
     // Mttcr
     onRepairMttcrChange(e){
-      this.globalGridAttr.repairMttcr = e
-      let repairMttcr={
-        repairMttcr:this.globalGridAttr.repairMttcr
+      const numberRegex = /^-?\d+(\.\d+)?$/
+      if(numberRegex.test(e)){
+        this.globalGridAttr.repairMttcr = e
+        let repairMttcr={
+          repairMttcr:this.globalGridAttr.repairMttcr
+        }
+        this.curCel.setData(repairMttcr)
+        this.curCel = this.nodeOpt(this.id,this.globalGridAttr)
+      }else {
+        this.$message.error('杈撳叆鏍煎紡鏈夎锛岃杈撳叆瀹炴暟')
       }
-      this.curCel.setData(repairMttcr)
-      this.curCel = this.nodeOpt(this.id,this.globalGridAttr)
+
     },
     // 鍙淮淇�у垎甯冪被鍨� 鍙傛暟2
     onRepairMttcrOtherChange(e){
-      this.globalGridAttr.repairMttcrOther = e
-      let repairMttcrOther={
-        repairMttcrOther:this.globalGridAttr.repairMttcrOther
+      const numberRegex = /^-?\d+(\.\d+)?$/
+      if(numberRegex.test(e)) {
+        this.globalGridAttr.repairMttcrOther = e
+        let repairMttcrOther = {
+          repairMttcrOther: this.globalGridAttr.repairMttcrOther
+        }
+        this.curCel.setData(repairMttcrOther)
+        this.curCel = this.nodeOpt(this.id, this.globalGridAttr)
+      }else {
+        this.$message.error('杈撳叆鏍煎紡鏈夎锛岃杈撳叆瀹炴暟')
       }
-      this.curCel.setData(repairMttcrOther)
-      this.curCel = this.nodeOpt(this.id,this.globalGridAttr)
     },
     onStatusImgChange(e){
       this.globalGridAttr.statusImg = e
@@ -361,6 +433,7 @@
         if (!cell || !cell.isNode()) {
           return
         }
+        this.showNumberInput = false
         this.curCel = cell
         globalGridAttr.nodeStroke = cell.attr('body/stroke')
         globalGridAttr.nodeStrokeWidth = cell.attr('body/strokeWidth')
@@ -387,6 +460,12 @@
         globalGridAttr.taskMtbcf = cell.getData().taskMtbcf
         globalGridAttr.taskMtbcfOther = cell.getData().taskMtbcfOther
         globalGridAttr.isRepair = cell.getData().isRepair
+        globalGridAttr.voteNum = cell.getData().voteNum
+        console.log(cell.getData().voteNum,'cell.getData().voteNum')
+        if(cell.getData().voteNum!==undefined ||  this.globalGridAttr.nodeTypeExt === 'vote' || this.nodeType==='vote'){
+          this.showNumberInput = true
+        }
+        console.log(this.showNumberInput,'this.showNumberInput')
         this.showRepairInput = cell.getData().isRepair
         cell.removeTools()
         cell.addTools([
diff --git a/web/src/views/modules/taskReliability/ModelRbd.vue b/web/src/views/modules/taskReliability/ModelRbd.vue
index ec99f55..60c5652 100644
--- a/web/src/views/modules/taskReliability/ModelRbd.vue
+++ b/web/src/views/modules/taskReliability/ModelRbd.vue
@@ -19,7 +19,7 @@
                 <zt-button type="delete" @click="table.deleteHandle()"/>
               </el-form-item>
             </el-form>
-            <el-table v-loading="table.dataLoading" :data="table.dataList" height="100px" v-adaptive="{bottomOffset:70}"
+            <el-table v-loading="table.dataLoading" :data="table.dataList" height="100px" v-adaptive="{bottomOffset:30}"
                       border @selection-change="table.selectionChangeHandle">
               <el-table-column type="selection" width="40" align="center"/>
               <el-table-column prop="modelName" label="妯″瀷鍚嶇О"/>
@@ -31,7 +31,7 @@
               <zt-table-column-handle :table="table"
                                       delete-perm="taskReliability::delete" :has-view="false" width="180px">
                 <template v-slot="{ row }">
-                  <el-button  @click="drawRBD(row)">妯″瀷璁捐</el-button>
+                  <zt-table-button  @click="drawRBD(row)">妯″瀷璁捐</zt-table-button>
                 </template>
               </zt-table-column-handle>
             </el-table>
diff --git a/web/src/views/modules/taskReliability/RBD-edit-img.vue b/web/src/views/modules/taskReliability/RBD-edit-img.vue
index b9acbcf..ac65af8 100644
--- a/web/src/views/modules/taskReliability/RBD-edit-img.vue
+++ b/web/src/views/modules/taskReliability/RBD-edit-img.vue
@@ -184,7 +184,7 @@
         id: '',
         graph: null,
         globalGridAttr: {
-          voteSum: '',
+          voteNum: '',
           repairMttcr: '',
           repairMttcrOther: '',
           repairDistribType: '',
@@ -372,15 +372,13 @@
           grid: {
             visible: true,
           },
-          onToolItemCreated({tool}) {
-            const handle = tool
-            const options = handle.options
-            if (options && options.index % 2 === 1) {
-              tool.setAttrs({fill: 'red'})
-            }
-          },
           autoResize: true,
-          history: true,
+            history: {
+                enabled: true,
+                ignoreAdd: true,
+                ignoreRemove: true,
+                ignoreChange: true,
+            },
           // panning: {
           //   enabled: true,
           // },
@@ -450,6 +448,12 @@
                     }
                   }
                 }],
+                tools: {
+                  name: 'vertices',
+                  args: {
+                    attrs: { fill: '#666' },
+                  },
+                },
                 zIndex: 0,
               })
             },
@@ -532,7 +536,8 @@
             data: {
               dataId: '',
               nodeType: item.nodeType,
-              nodeTypeExt: ''
+              nodeTypeExt: '',
+              voteNum:''
             },
             attrs: {
               text: {
@@ -564,7 +569,7 @@
             width: 60,
             height: 60,
             data: {
-              isRepair: false,
+              isRepair: item.isRepair,
               dataId: item.dataId,
               nodeType: item.nodeType,
               nodeTypeExt: item.nodeTypeExt,
@@ -576,9 +581,9 @@
               repairMttcrOther: item.repairMttcrOther,
               taskMtbcf: item.taskMtbcf,
               taskMtbcfOther: item.taskMtbcfOther,
-              voteSum: '',
               imgHeight: item.imgHeight,
-              imgWidth: item.imgWidth
+              imgWidth: item.imgWidth,
+              voteNum:'',
             },
             attrs: {
               text: {
@@ -799,28 +804,10 @@
           this.showPorts(ports, false)
         })
 
-        this.graph.on('edge:mouseenter', ({cell, view}) => {
+        this.graph.on('edge:mouseenter', ({cell}) => {
           // alert(123)
-          cell.addTools([
-            {
-              name: 'source-arrowhead',
-            },
-            {
-              name: 'target-arrowhead',
-              args: {
-                attrs: {
-                  fill: 'red',
-                },
-              },
-            },
-          ])
           cell.addTools(
-            [
-              {
-                name: 'segments',
-                args: {snapRadius: 20, attrs: {fill: '#444'}}
-              }
-            ]
+              ['vertices', 'segments']
           )
         })
 

--
Gitblit v1.9.1