Sfoglia il codice sorgente

添加系统位号对应值设置

yuhan 5 mesi fa
parent
commit
a12b11b048

+ 79 - 7
src/views/module_interLock/baseInterLock/modules/BaseInterLockModal.vue

@@ -54,6 +54,33 @@
               </a-select>
               <!-- :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" -->
           </a-form-model-item>
+          <a-divider orientation="left"> <span style="font-size: 12px;">状态值设置</span> </a-divider>
+          <a-form-model-item label="输入卡件状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inputStatus">
+            <!-- <j-dict-select-tag v-model="model.inputStatus"  placeholder="请设置状态" dictCode="system_value_set" @change="change"/> -->
+            <a-select v-model="model.inputStatus" placeholder="请设置状态" @change="change">
+              <a-select-option v-for="(item) in systemValueOptions" :key="item.value" :value="item.value">{{ item.label }}</a-select-option>
+            </a-select>
+          </a-form-model-item>
+          <a-form-model-item label="输出卡件状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="outputStatus">
+            <a-select v-model="model.outputStatus" placeholder="请设置状态" @change="change">
+              <a-select-option v-for="(item) in systemValueOptions" :key="item.value" :value="item.value">{{ item.label }}</a-select-option>
+            </a-select>
+          </a-form-model-item>
+          <a-form-model-item label="MP状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="mpStatus">
+            <a-select v-model="model.mpStatus" placeholder="请设置状态" @change="change">
+              <a-select-option v-for="(item) in systemValueOptions" :key="item.value" :value="item.value">{{ item.label }}</a-select-option>
+            </a-select>
+          </a-form-model-item>
+          <a-form-model-item label="旁路状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bypassStatus">
+            <a-select v-model="model.bypassStatus" placeholder="请设置状态" @change="change">
+              <a-select-option v-for="(item) in systemValueOptions" :key="item.value" :value="item.value">{{ item.label }}</a-select-option>
+            </a-select>
+          </a-form-model-item>
+          <a-form-model-item label="仪表状态(位号读取)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="instrumentStatus">
+            <a-select v-model="model.instrumentStatus" placeholder="请设置状态" @change="change">
+              <a-select-option v-for="(item) in systemValueOptions" :key="item.value" :value="item.value">{{ item.label }}</a-select-option>
+            </a-select>
+          </a-form-model-item>
         </template>
         
       </a-form-model>
@@ -75,7 +102,12 @@
         width:800,
         visible: false,
         model:{
-          interlockType: '0'
+          interlockType: '0',
+          inputStatus: '0',
+          outputStatus: '0',
+          mpStatus: '0',
+          bypassStatus: '0',
+          instrumentStatus: '0',
         },
         labelCol: {
           xs: { span: 24 },
@@ -91,24 +123,61 @@
           interlockType: [{required: true, message: '请选择类型'}],
           interlockName: [{required: true, message: '请输入名称'}],
           pid: [{required: true, message: '请选择上级'}],
+          inputStatus: [{required: true, message: '请设置状态'}],
+          outputStatus: [{required: true, message: '请设置状态'}],
+          mpStatus: [{required: true, message: '请设置状态'}],
+          bypassStatus: [{required: true, message: '请设置状态'}],
+          instrumentStatus: [{required: true, message: '请设置状态'}],
         },
         url: {
           add: "/base/interlockBase/add",
           edit: "/base/interlockBase/edit",
           lever12: '/base/interlockBase/lever12',
           interLockSelect: '/sys/dict/loadTreeData',
+          getSystemValue: '/sys/dict/getDictItems/system_value_set',
         },
         expandedRowKeys:[],
         pidField:"pid",
         // 装置和系统树
         interlockTwoTree: [],
+        // 系统点位值列表
+        systemValueOptions: [],
       }
     },
     created () {
-       //备份model原始值
-       this.modelDefault = JSON.parse(JSON.stringify(this.model));
+      //备份model原始值
+      this.modelDefault = JSON.parse(JSON.stringify(this.model));
     },
     methods: {
+      // 获取系统点位值设置数据
+      getSystemValue(){
+        getAction(this.url.getSystemValue).then(res => {
+          if(res.success){
+            this.systemValueOptions = res.result
+          }
+        })
+      },
+      change(e){
+        console.log(e)
+        var index = this.systemValueOptions.findIndex(item => item.value === e)
+        console.log(this.separateNumbersAndSymbols(this.systemValueOptions[index].label))
+      },
+      // 拆分数字和文字方法
+      separateNumbersAndSymbols(input) {
+        let numbers = [];
+        let words = [];
+        // 使用正则表达式分割字符串
+        let parts = input.split(/(\d+)/)
+        // 循环处理分割结果
+        parts.forEach(part => {
+          if (part.match(/\d+/)) { // 匹配数字
+            numbers.push(Number(part));
+          } else if (part) { // 匹配非数字符号
+            words.push(part);
+          }
+        });
+        return { numbers, words };
+      },
       // getInterlockTwoTree(){
       //   getAction(this.url.lever12).then(res => {
       //     console.log(res)
@@ -135,12 +204,14 @@
       add (obj) {
         // this.getInterlockTwoTree()
         this.getData('0', 'interlockTwoTree')
+        this.getSystemValue()
         this.modelDefault.pid=''
         this.edit(Object.assign(this.modelDefault , obj));
-      },
-      edit (record) {
-        // this.getInterlockTwoTree()
-        this.getData('0', 'interlockTwoTree')
+        },
+        edit (record) {
+          // this.getInterlockTwoTree()
+          this.getData('0', 'interlockTwoTree')
+          this.getSystemValue()
         this.model = Object.assign({}, record);
         this.visible = true;
       },
@@ -152,6 +223,7 @@
       handleOk () {
         const that = this;
         // 触发表单验证
+        console.log(this.model)
        this.$refs.form.validate(valid => {
           if (valid) {
             that.confirmLoading = true;