Переглянути джерело

基础库和联锁新增页面

yuhan 9 місяців тому
батько
коміт
b343629b15

+ 1 - 1
src/views/module_interLock/InterlockSummary/InterlockSummaryList.vue

@@ -140,7 +140,7 @@
         // 表头
         columns: [
           {
-            title: '#',
+            title: '序号',
             dataIndex: '',
             key:'rowIndex',
             width:60,

+ 538 - 0
src/views/module_interLock/InterlockSummary/modules/InterlockConditionForm.vue

@@ -0,0 +1,538 @@
+<template>
+  <j-vxe-table
+    ref="vTable"
+    toolbar
+    :height="500"
+    :loading="loading"
+    :dataSource="dataSource"
+    :columns="columns"
+    style="margin-top: 8px;"
+    @valueChange="handleValueChange"
+    >
+    <!-- row-number  -->
+    <!-- row-selection -->
+    <!-- drag-sort 移动上下行 -->
+    <!-- keep-source 啥? -->
+    <!-- :scroll-y="{enabled:false}" -->
+
+    <!--  -->
+    <template v-slot:currentValueTag="props">
+      <a-cascader
+        v-model="props.row.currentValueTag"
+        :options="dianweiOptions"
+        :display-render="displayRender"
+        expand-trigger="hover"
+        placeholder="请选择点位"
+        @change="onChange"
+        />
+    </template>
+
+    <!-- <template v-slot:toolbarSuffix>
+      <a-button @click="handleTableCheck">表单验证</a-button>
+      <a-tooltip placement="top" title="获取值,忽略表单验证" :autoAdjustOverflow="true">
+        <a-button @click="handleTableGet">获取值</a-button>
+      </a-tooltip>
+      <a-tooltip placement="top" title="模拟加载1000条数据" :autoAdjustOverflow="true">
+        <a-button @click="handleTableSet">设置值</a-button>
+      </a-tooltip>
+    </template> -->
+
+    <!-- 仪表状态 -->
+    <template  v-slot:instrumentStatus="props">
+      <!-- <div @click="dianjiCeshi(props)">点击了{{props.row.ceshi}}</div> -->
+      <a-radio-group name="radioGroup" v-model="props.row.instrumentStatusJuge">
+        <!--  :default-value="props.row.ceshi" -->
+        <a-radio :value="1"> 位号读取 </a-radio>
+        <a-radio :value="2"> 高低限判断 </a-radio>
+        <a-radio :value="3"> 突变超限判断 </a-radio>
+      </a-radio-group>
+      <div v-if="props.row.instrumentStatusJuge === 1">
+        <a-cascader
+          v-model="props.row.currentValueTag"
+          :options="dianweiOptions"
+          :display-render="displayRender"
+          expand-trigger="hover"
+          placeholder="请选择点位"
+          @change="onChange"/>
+      </div>
+      <div v-if="props.row.instrumentStatusJuge === 2">
+        <a-cascader
+        v-model="props.row.ysmnlTag"
+        :options="dianweiOptions"
+        :display-render="displayRender"
+        expand-trigger="hover"
+        placeholder="请选择原始模拟量位号"
+        @change="onChange"/>
+        <div>
+          高限<a-input v-model="props.row.upperLimit" placeholder="请输入高限"></a-input>
+        </div>
+        <div>
+          低限<a-input v-model="props.row.lowerLimit" placeholder="请输入低限"></a-input>
+        </div>
+      </div>
+      <div v-if="props.row.instrumentStatusJuge === 3">
+        <a-cascader
+        v-model="props.row.ysmnlTag"
+        :options="dianweiOptions"
+        :display-render="displayRender"
+        expand-trigger="hover"
+        placeholder="请选择原始模拟量位号"
+        @change="onChange"/>
+        <div>
+          时间<a-input v-model="props.row.thresholdTime" placeholder="请输入时间"></a-input>
+        </div>
+        <div>
+          阈值<a-input v-model="props.row.thresholdValue" placeholder="请输入阈值"></a-input>
+        </div>
+      </div>
+    </template>
+    <!-- 是否旁路 -->
+    <template  v-slot:ifBypass="props">
+      <a-radio-group name="radioGroup" v-model="props.row.ifBypass">
+        <!--  :default-value="props.row.ceshi" -->
+        <a-radio :value="0"> 否 </a-radio>
+        <a-radio :value="1"> 是 </a-radio>
+      </a-radio-group>
+      <!-- <div v-if="props.row.ifBypass === 0">
+        无旁路
+      </div> -->
+      <div v-if="props.row.ifBypass === 1">
+        <!-- <a-cascader
+          v-model="props.row.ifBypassTag"
+          :options="dianweiOptions"
+          :display-render="displayRender"
+          expand-trigger="hover"
+          placeholder="请选择点位"
+          @change="onChange"/> -->
+        <a-tree-select
+          v-model="props.row.ifBypassTag"
+          style="width: 100%"
+          :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
+          :tree-data="dianweiOptions"
+          placeholder="请选择"
+          tree-default-expand-all
+        >
+          <!-- <span v-if="key === '0-0-1'" slot="title" slot-scope="{ key, value }" style="color: #08c">
+            Child Node1 {{ value }}
+          </span> -->
+        </a-tree-select>
+      </div>
+    </template>
+    <template v-slot:action="props">
+      <a @click="handleCK(props)">查看</a>
+      <a-divider type="vertical"/>
+      <a-popconfirm title="确定删除吗?" @confirm="handleDL(props)">
+        <a>删除</a>
+      </a-popconfirm>
+    </template>
+
+  </j-vxe-table>
+</template>
+
+<script>
+  var dianweiOptions = [
+    {
+      key: 'zhejiang',
+      value: 'zhejiang',
+      title: 'Zhejiang',
+      label: 'Zhejiang',
+      children: [
+        {
+          key: 'hangzhou',
+          value: 'hangzhou',
+          title: 'Hangzhou',
+          label: 'Hangzhou',
+          children: [
+            {
+              key: 'xihu',
+              value: 'xihu',
+              title: 'West Lake',
+              label: 'West Lake',
+            },
+          ],
+        },
+      ],
+    },
+    {
+      key: 'jiangsu',
+      value: 'jiangsu',
+      title: 'Jiangsu',
+      label: 'Jiangsu',
+      children: [
+        {
+          key: 'nanjing',
+          value: 'nanjing',
+          title: 'Nanjing',
+          label: 'Nanjing',
+          children: [
+            {
+              key: 'zhonghuamen',
+              value: 'zhonghuamen',
+              title: 'Zhong Hua Men',
+              label: 'Zhong Hua Men',
+            },
+          ],
+        },
+      ],
+    },
+  ]
+  import moment from 'moment'
+  import { pushIfNotExist, randomNumber, randomUUID } from '@/utils/util'
+  import { JVXETypes } from '@/components/jeecg/JVxeTable'
+
+  export default {
+    name: 'JVxeDemo1',
+    data() {
+      return {
+        loading: false,
+        dianweiOptions: dianweiOptions,
+        columns: [
+          // {
+          //   title: '联锁条件',
+          //   key: 'normal',
+          //   type: JVXETypes.normal,
+          //   width: '180px',
+          //   // fixed: 'left',
+          //   defaultValue: 'normal-new',
+          // },
+          {
+            title: '联锁条件',
+            key: 'interlockCondition',
+            type: JVXETypes.input,
+            width: '180px',
+            defaultValue: '',
+            placeholder: '请输入${title}',
+            validateRules: [
+              {
+                required: true, // 必填
+                message: '请输入${title}' // 显示的文本
+              },
+              {
+                pattern: /^[a-z|A-Z][a-z|A-Z\d_-]*$/, // 正则
+                message: '${title}必须以字母开头,可包含数字、下划线、横杠'
+              },
+              {
+                unique: true,
+                message: '${title}不能重复'
+              },
+              {
+                handler({cellValue, row, column}, callback, target) {
+                  // cellValue 当前校验的值
+                  // callback(flag, message) 方法必须执行且只能执行一次
+                  //          flag = 是否通过了校验,不填写或者填写 null 代表不进行任何操作
+                  //          message = 提示的类型,默认使用配置的 message
+                  // target 行编辑的实例对象
+                  if (cellValue === 'abc') {
+                    callback(false, '${title}不能是abc')  // false = 未通过校验
+                  } else {
+                    callback(true) // true = 通过验证
+                  }
+                },
+                message: '${title}默认提示'
+              }
+            ]
+          },
+          {
+            title: '仪表状态',
+            key: 'ceshi',
+            type: JVXETypes.slot,
+            // fixed: 'right',
+            minWidth: '400px',
+            align: 'center',
+            slotName: 'instrumentStatus',
+          },
+          {
+            title: '描述',
+            key: 'description',
+            type: JVXETypes.textarea,
+            width: '200px',
+          },
+          {
+            title: '联锁设定值',
+            key: 'interlockSetValue',
+            type: JVXETypes.inputNumber,
+            width: '120px',
+            defaultValue: 32,
+            // 【统计列】sum = 求和、average = 平均值
+            // statistics: ['sum', 'average'],
+          },
+          {
+            title: '当前值',
+            key: 'currentValueTag',
+            type: JVXETypes.slot,
+            // fixed: 'right',
+            minWidth: '180px',
+            align: 'center',
+            slotName: 'currentValueTag',
+          },
+          {
+            title: '是否旁路',
+            key: 'ifBypass',
+            type: JVXETypes.slot,
+            // fixed: 'right',
+            minWidth: '180px',
+            align: 'center',
+            slotName: 'ifBypass',
+          },
+          // {
+          //   title: '下拉框_搜索',
+          //   key: 'select_search',
+          //   type: JVXETypes.selectSearch,
+          //   width: '180px',
+          //   options: [
+          //     {title: 'String', value: 'string'},
+          //     {title: 'Integer', value: 'int'},
+          //     {title: 'Double', value: 'double'},
+          //     {title: 'Boolean', value: 'boolean'}
+          //   ],
+          // },
+          // {
+          //   title: '联锁输出值',
+          //   key: 'interlockOutValueTag',
+          //   type: JVXETypes.select,
+          //   width: '180px',
+          //   // 下拉选项
+          //   options: [
+          //     {title: 'String', value: 'string'},
+          //     {title: 'Integer', value: 'int'},
+          //     {title: 'Double', value: 'double'},
+          //     {title: 'Boolean', value: 'boolean'}
+          //   ],
+          //   allowInput: true,
+          //   placeholder: '请选择'
+          // },
+          {
+            title: '输入卡件状态',
+            key: 'inputStatusTag',
+            type: JVXETypes.select,
+            width: '180px',
+            // 下拉选项
+            options: [
+              {title: 'String', value: 'string'},
+              {title: 'Integer', value: 'int'},
+              {title: 'Double', value: 'double'},
+              {title: 'Boolean', value: 'boolean'}
+            ],
+            allowInput: true,
+            placeholder: '请选择'
+          },
+          {
+            title: '输出卡件状态',
+            key: 'outputStatusTag',
+            type: JVXETypes.select,
+            width: '180px',
+            // 下拉选项
+            options: [
+              {title: 'String', value: 'string'},
+              {title: 'Integer', value: 'int'},
+              {title: 'Double', value: 'double'},
+              {title: 'Boolean', value: 'boolean'}
+            ],
+            allowInput: true,
+            placeholder: '请选择'
+          },
+          {
+            title: 'MP状态',
+            key: 'mpStatusTag',
+            type: JVXETypes.select,
+            width: '180px',
+            // 下拉选项
+            options: [
+              {title: 'String', value: 'string'},
+              {title: 'Integer', value: 'int'},
+              {title: 'Double', value: 'double'},
+              {title: 'Boolean', value: 'boolean'}
+            ],
+            allowInput: true,
+            placeholder: '请选择'
+          },
+          // {
+          //   title: '下拉框_字典',
+          //   key: 'select_dict',
+          //   type: JVXETypes.select,
+          //   width: '180px',
+          //   options: [],
+          //   dictCode: 'sex',
+          //   placeholder: '请选择',
+          // },
+          // {
+          //   title: '下拉框_多选',
+          //   key: 'select_multiple',
+          //   type: JVXETypes.selectMultiple,
+          //   width: '205px',
+          //   options: [
+          //     {title: 'String', value: 'string'},
+          //     {title: 'Integer', value: 'int'},
+          //     {title: 'Double', value: 'double'},
+          //     {title: 'Boolean', value: 'boolean'}
+          //   ],
+          //   defaultValue: ['int', 'boolean'], // 多个默认项
+          //   // defaultValue: 'string,double,int', // 也可使用这种方式
+          //   placeholder: '多选',
+          // },
+          // {
+          //   title: '日期时间',
+          //   key: 'datetime',
+          //   type: JVXETypes.datetime,
+          //   width: '200px',
+          //   defaultValue: '2019-4-30 14:52:22',
+          //   placeholder: '请选择',
+          // },
+          // {
+          //   title: '复选框',
+          //   key: 'checkbox',
+          //   type: JVXETypes.checkbox,
+          //   width: '100px',
+          //   customValue: ['Y', 'N'], // true ,false
+          //   defaultChecked: false,
+          // },
+          // {
+          //   title: '操作',
+          //   key: 'action',
+          //   type: JVXETypes.slot,
+          //   // fixed: 'right',
+          //   minWidth: '100px',
+          //   align: 'center',
+          //   slotName: 'action',
+          // },
+        ],
+        dataSource: [],
+      }
+
+    },
+
+    created() {
+      this.randomPage(0, 20, true)
+    },
+    methods: {
+      onChange(value) {
+        console.log(value);
+      },
+      displayRender({ labels }) {
+        return labels[labels.length - 1];
+      },
+      handleCK(props) {
+        this.$message.success('请在控制台查看输出')
+        // 参数介绍:
+        // props.value          当前单元格的值
+        // props.row            当前行的数据
+        // props.rowId          当前行ID
+        // props.rowIndex       当前行下标
+        // props.column         当前列的配置
+        // props.columnIndex    当前列下标
+        // props.$table         vxe实例,可以调用vxe内置方法
+        // props.target         JVXE实例,可以调用JVXE内置方法
+        // props.caseId         JVXE实例唯一ID
+        // props.scrolling      是否正在滚动
+        // props.triggerChange  触发change事件,用于更改slot的值
+        console.log('查看: ', {props})
+      },
+
+      handleDL(props) {
+        // 调用删除方法
+        props.target.removeRows(props.row)
+      },
+
+      handleValueChange(event) {
+        console.log('handleValueChange.event: ', event)
+      },
+
+      /** 表单验证 */
+      handleTableCheck() {
+        this.$refs.vTable.validateTable().then(errMap => {
+          if (errMap) {
+            console.log('表单验证未通过:', {errMap})
+            this.$message.error('验证未通过,请在控制台查看详细')
+          } else {
+            this.$message.success('验证通过')
+          }
+        })
+      },
+
+      /** 获取值,忽略表单验证 */
+      handleTableGet() {
+        const values = this.$refs.vTable.getTableData()
+        console.log('获取值:', {values})
+        this.$message.success('获取值成功,请看控制台输出')
+      },
+
+      /** 模拟加载1000条数据 */
+      handleTableSet() {
+        this.randomPage(1, 10, true)
+      },
+
+      /* 随机生成数据 */
+      randomPage(current, pageSize, loading = false) {
+        if (loading) {
+          this.loading = true
+        }
+
+        let randomDatetime = () => {
+          let time = randomNumber(1000, 9999999999999)
+          return moment(new Date(time)).format('YYYY-MM-DD HH:mm:ss')
+        }
+
+        let limit = (current - 1) * pageSize
+
+        let options = ['string', 'int', 'double', 'boolean']
+
+        let begin = Date.now()
+        let values = []
+        for (let i = 0; i < pageSize; i++) {
+          values.push({
+            id: randomUUID(),
+            normal: `normal-${(limit + i) + 1}`,
+            input: `text-${(limit + i) + 1}`,
+            textarea: `textarea-${(limit + i) + 1}`,
+            number: randomNumber(0, 233),
+            select: options[randomNumber(0, 3)],
+            select_dict: randomNumber(1, 2).toString(),
+            select_multiple: (() => {
+              let length = randomNumber(1, 4)
+              let arr = []
+              for (let j = 0; j < length; j++) {
+                pushIfNotExist(arr, options[randomNumber(0, 3)])
+              }
+              return arr
+            })(),
+            select_search: options[randomNumber(0, 3)],
+            datetime: randomDatetime(),
+            checkbox: ['Y', 'N'][randomNumber(0, 1)],
+            instrumentStatusJuge: 1,
+            instrumentStatusTag: [],
+            ysmnlTag: [],
+            upperLimit: '',
+            lowerLimit: '',
+            thresholdValue: '',
+            thresholdTime: '',
+            interlockCondition: '',
+            description: '',
+            interlockSetValue: '',
+            currentValueTag: ['zhejiang', 'hangzhou', 'xihu'],
+            ifBypass: '',
+            ifBypassTag: 'xihu',
+            interlockOutValueTag: [],
+            inputStatusTag: [],
+            outputStatusTag: [],
+            mpStatusTag: [],
+          })
+        }
+
+        this.dataSource = values
+        let end = Date.now()
+        let diff = end - begin
+
+        if (loading && diff < pageSize) {
+          setTimeout(() => {
+            this.loading = false
+          }, pageSize - diff)
+        }
+
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>

+ 84 - 24
src/views/module_interLock/InterlockSummary/modules/InterlockSummaryForm.vue

@@ -3,65 +3,121 @@
     <j-form-container :disabled="formDisabled">
       <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
         <a-row>
-          <a-col :span="24">
-            <a-form-model-item label="联锁名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="interlockName">
-              <a-input v-model="model.interlockName" placeholder="请输入联锁名称"  ></a-input>
+          <a-col :span="12">
+            <a-form-model-item label="装置" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="interlockApparatusId">
+              <a-input v-model="model.interlockApparatusId" placeholder="请选择装置"></a-input>
             </a-form-model-item>
           </a-col>
-          <a-col :span="24">
-            <a-form-model-item label="系统id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="interlockSystemId">
-              <a-input v-model="model.interlockSystemId" placeholder="请输入系统id"  ></a-input>
+          <a-col :span="12">
+            <a-form-model-item label="系统" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="interlockSystemId">
+              <a-input v-model="model.interlockSystemId" placeholder="请选择系统"></a-input>
             </a-form-model-item>
           </a-col>
-          <a-col :span="24">
-            <a-form-model-item label="装置id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="interlockApparatusId">
-              <a-input v-model="model.interlockApparatusId" placeholder="请输入装置id"  ></a-input>
+          <a-col :span="12">
+            <a-form-model-item label="联锁名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="interlockName">
+              <a-input v-model="model.interlockName" placeholder="请输入联锁名称"  ></a-input>
             </a-form-model-item>
           </a-col>
-          <a-col :span="24">
+          <!-- <a-col :span="24">
             <a-form-model-item label="联锁状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="interlockStatus">
               <a-input v-model="model.interlockStatus" placeholder="请输入联锁状态"  ></a-input>
             </a-form-model-item>
-          </a-col>
-          <a-col :span="24">
+          </a-col> -->
+          <!-- <a-col :span="24">
             <a-form-model-item label="回路健康级别" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="loopHealthLevel">
               <a-input v-model="model.loopHealthLevel" placeholder="请输入回路健康级别"  ></a-input>
             </a-form-model-item>
-          </a-col>
-          <a-col :span="24">
+          </a-col> -->
+          <a-col :span="12">
             <a-form-model-item label="逻辑关系" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ljgx">
-              <a-input v-model="model.ljgx" placeholder="请输入逻辑关系"  ></a-input>
+              <a-input v-model="model.ljgx" placeholder="请选择逻辑关系"></a-input>
             </a-form-model-item>
           </a-col>
-          <a-col :span="24">
+          <!-- <a-col :span="24">
             <a-form-model-item label="联锁输出值" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="interlockOutValue">
               <a-input v-model="model.interlockOutValue" placeholder="请输入联锁输出值"  ></a-input>
             </a-form-model-item>
-          </a-col>
-          <a-col :span="24">
+          </a-col> -->
+          <a-col :span="12">
             <a-form-model-item label="联锁输出值点位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="interlockOutValueTag">
-              <a-input v-model="model.interlockOutValueTag" placeholder="请输入联锁输出值点位"  ></a-input>
+              <!-- <a-input v-model="model.interlockOutValueTag" placeholder="请选择联锁输出值点位"></a-input> -->
+              <a-cascader
+                v-model="model.interlockOutValueTag"
+                :options="dianweiOptions"
+                :display-render="displayRender"
+                expand-trigger="hover"
+                placeholder="请选择点位"
+                />
+                <!-- @change="onChange" -->
             </a-form-model-item>
           </a-col>
-          <a-col :span="24">
+          <a-col :span="12">
             <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
-              <a-input v-model="model.remark" placeholder="请输入备注"  ></a-input>
+              <a-input v-model="model.remark" placeholder="请输入备注"></a-input>
             </a-form-model-item>
           </a-col>
         </a-row>
+        <interlock-condition-form></interlock-condition-form>
       </a-form-model>
     </j-form-container>
   </a-spin>
 </template>
 
 <script>
-
+  var dianweiOptions = [
+    {
+      key: 'zhejiang',
+      value: 'zhejiang',
+      title: 'Zhejiang',
+      label: 'Zhejiang',
+      children: [
+        {
+          key: 'hangzhou',
+          value: 'hangzhou',
+          title: 'Hangzhou',
+          label: 'Hangzhou',
+          children: [
+            {
+              key: 'xihu',
+              value: 'xihu',
+              title: 'West Lake',
+              label: 'West Lake',
+            },
+          ],
+        },
+      ],
+    },
+    {
+      key: 'jiangsu',
+      value: 'jiangsu',
+      title: 'Jiangsu',
+      label: 'Jiangsu',
+      children: [
+        {
+          key: 'nanjing',
+          value: 'nanjing',
+          title: 'Nanjing',
+          label: 'Nanjing',
+          children: [
+            {
+              key: 'zhonghuamen',
+              value: 'zhonghuamen',
+              title: 'Zhong Hua Men',
+              label: 'Zhong Hua Men',
+            },
+          ],
+        },
+      ],
+    },
+  ]
   import { httpAction, getAction } from '@/api/manage'
   import { validateDuplicateValue } from '@/utils/util'
+  import InterlockConditionForm from './InterlockConditionForm.vue'
 
   export default {
     name: 'InterlockSummaryForm',
     components: {
+        InterlockConditionForm
     },
     props: {
       //表单禁用
@@ -74,7 +130,7 @@
     data () {
       return {
         model:{
-         },
+        },
         labelCol: {
           xs: { span: 24 },
           sm: { span: 5 },
@@ -90,7 +146,8 @@
           add: "/summary/interlockSummary/add",
           edit: "/summary/interlockSummary/edit",
           queryById: "/summary/interlockSummary/queryById"
-        }
+        },
+        dianweiOptions: dianweiOptions,
       }
     },
     computed: {
@@ -103,6 +160,9 @@
       this.modelDefault = JSON.parse(JSON.stringify(this.model));
     },
     methods: {
+      displayRender({ labels }) {
+        return labels[labels.length - 1];
+      },
       add () {
         this.edit(this.modelDefault);
       },

+ 6 - 4
src/views/module_interLock/baseInterLock/BaseInterLockList.vue

@@ -39,12 +39,12 @@
     <!-- 操作按钮区域 -->
     <div class="table-operator">
       <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
-      <a-button type="primary" icon="download" @click="handleExportXls('联锁基础表')">导出</a-button>
+      <!-- <a-button type="primary" icon="download" @click="handleExportXls('联锁基础表')">导出</a-button>
       <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
         <a-button type="primary" icon="import">导入</a-button>
-      </a-upload>
+      </a-upload> -->
       <!-- 高级查询区域 -->
-      <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
+      <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> -->
       <a-dropdown v-if="selectedRowKeys.length > 0">
         <a-menu slot="overlay">
           <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
@@ -99,7 +99,7 @@
           <a-dropdown>
             <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
             <a-menu slot="overlay">
-              <a-menu-item>
+              <a-menu-item v-if="record.interlockType !== '2'">
                 <a @click="handleAddChild(record)">添加下级</a>
               </a-menu-item>
               <a-menu-item>
@@ -326,9 +326,11 @@
         }
       },
       handleAddChild(record){
+        console.log(record)
         this.loadParent = true
         let obj = {}
         obj[this.pidField] = record['id']
+        obj.interlockType = String(Number(record.interlockType) + 1)
         this.$refs.modalForm.add(obj);
       },
       handleDeleteNode(id) {

+ 35 - 16
src/views/module_interLock/baseInterLock/modules/BaseInterLockModal.vue

@@ -11,23 +11,37 @@
     <a-spin :spinning="confirmLoading">
       <a-form-model ref="form" :model="model" :rules="validatorRules">
         <a-form-model-item label="类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="interlockType">
-          <j-dict-select-tag type="list" v-model="model.interlockType"  dictCode="interlock_type" placeholder="请选择类型" />
+          <j-dict-select-tag
+            type="radio"
+            v-model="model.interlockType"  dictCode="interlock_type"
+            placeholder="请选择类型"/>
         </a-form-model-item>
         <a-form-model-item label="名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="interlockName">
           <a-input v-model="model.interlockName" placeholder="请输入名称" ></a-input>
         </a-form-model-item>
-        <a-form-model-item label="父级节点" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pid">
-          <j-tree-select
-            ref="treeSelect"
-            placeholder="请选择父级节点"
-            v-model="model.pid"
-            dict="interlock_base,interlock_name,id"
-            pidField="pid"
-            pidValue="0"
-            hasChildField="has_child"
-            >
-          </j-tree-select>
-        </a-form-model-item>
+        <template v-if="model.interlockType !== '0'">
+          <a-form-model-item label="父级节点" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pid">
+            <!-- <j-tree-select
+              ref="treeSelect"
+              placeholder="请选择父级节点"
+              v-model="model.pid"
+              :maxLevel="'1'"
+              dict="interlock_base,interlock_name,id"
+              pidField="pid"
+              pidValue="0"
+              hasChildField="has_child"
+              >
+            </j-tree-select> -->
+            <a-tree-select
+              v-model="model.pid"
+              style="width: 100%"
+              :tree-data="interlockTwoTree"
+              placeholder="请选择"
+              tree-default-expand-all
+              ></a-tree-select>
+              <!-- :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" -->
+          </a-form-model-item>
+        </template>
         
       </a-form-model>
     </a-spin>
@@ -48,7 +62,8 @@
         width:800,
         visible: false,
         model:{
-         },
+          interlockType: '0'
+        },
         labelCol: {
           xs: { span: 24 },
           sm: { span: 5 },
@@ -60,14 +75,18 @@
 
         confirmLoading: false,
         validatorRules: {
+          interlockType: [{required: true, message: '请选择类型'}],
+          interlockName: [{required: true, message: '请输入名称'}],
+          pid: [{required: true, message: '请选择上级'}],
         },
         url: {
           add: "/base/interlockBase/add",
           edit: "/base/interlockBase/edit",
         },
         expandedRowKeys:[],
-        pidField:"pid"
-     
+        pidField:"pid",
+        // 装置和系统树
+        interlockTwoTree: [],
       }
     },
     created () {