Przeglądaj źródła

巡点检配置提交

LAPTOP-16IUEB3P\Lenovo 3 lat temu
rodzic
commit
50c8b7034f

+ 1030 - 0
src/components/addPatrolConfigDialog/index.vue

@@ -0,0 +1,1030 @@
+<template>
+  <el-dialog
+    :title="dialogTitle"
+    :visible.sync="addPatrolConfigDialog"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    v-loading="addDialogLoading"
+    width="80%"
+  >
+    <div class="dialog_body">
+      <el-form
+        :model="addForm"
+        ref="addFormRef"
+        :rules="addFormRules"
+        label-width="120px"
+      >
+        <el-row>
+<!--          <el-col :span="8">
+            <el-form-item label="计划配置单号" prop="planRuleCode">
+              <el-input
+                v-model="addForm.planRuleCode"
+                size="small"
+                placeholder="自动带出"
+                disabled
+              ></el-input>
+            </el-form-item>
+          </el-col> -->
+          <el-col :span="8">
+            <el-form-item label="计划配置名称" prop="planRuleName">
+              <el-input
+                v-model="addForm.planRuleName"
+                size="small"
+                placeholder="请输入"
+                :disabled="isBindPlan"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="自动派单" prop="isSyncBill">
+              <el-select
+                v-model="addForm.isSyncBill"
+                size="small"
+                style="width: 100%"
+                :disabled="isBindPlan"
+              >
+                <el-option :value="true" label="是"></el-option>
+                <el-option :value="false" label="否"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="规则名称" prop="ruleId">
+              <el-select
+                v-model="addForm.ruleId"
+                size="small"
+                style="width: 100%"
+                @change="handleRuleNameChange"
+                 :disabled="isBindPlan"
+              >
+                <el-option
+                  v-for="item in ruleNameList"
+                  :key="item.id"
+                  :value="item.id"
+                  :label="item.name"
+                  @click.native="addForm.ruleName = item.name"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="计划完成时长" prop="duration">
+              <div style="display: flex">
+                <el-input
+                  v-model="addForm.duration"
+                  size="small"
+                  placeholder="请输入"
+                   :disabled="isBindPlan"
+                >
+                  <template #suffix>分钟</template>
+                </el-input>
+              </div>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="设备分类" prop="bizTypeId">
+              <el-select
+                v-model="addForm.bizTypeId"
+                size="small"
+                style="width: 100%"
+                 :disabled="isBindPlan"
+              >
+                <el-option
+                  v-for="item in equipmentList"
+                  :key="item.id"
+                  :value="item.id"
+                  :label="item.name"
+                  @click.native="handleEquipmentClassChange(item)"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="审核人" prop="verifyUserId">
+              <el-select
+                v-model="addForm.verifyUserId"
+                size="small"
+                clearable
+                style="width: 100%"
+                 :disabled="isBindPlan"
+              >
+                <el-option
+                  v-for="item in uerList"
+                  :key="item.userId"
+                  :value="item.userId"
+                  :label="item.trueName"
+                  @click.native="addForm.verifyUserName = item.trueName"
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8" v-if="addForm.isSyncBill">
+            <el-form-item :label="formLabel + '部门'" prop="executorDeptCode">
+				<ele-tree-select
+				    clearable
+				    :data="treeData"
+				    v-model="addForm.executorDeptCode"
+				    placeholder="请选择"
+				    default-expand-all
+				    labelKey="name"
+				    valueKey="id"
+				/>
+             <!-- <el-input
+                v-model="addForm.executorDeptCode"
+                v-show="false"
+                 :disabled="isBindPlan"
+              ></el-input>
+              <SelectTree
+                class="form-input"
+                ref="searchTree"
+                :options="deptList"
+                :value="addForm.executorDeptCode"
+                :props="{
+                  value: 'code',
+                  label: 'name',
+                  children: 'children'
+                }"
+                :isBindPlan="isBindPlan"
+                @getValue="searchDeptNodeClick"
+              /> -->
+            </el-form-item>
+          </el-col>
+          <el-col :span="8" v-if="addForm.isSyncBill">
+            <el-form-item :label="formLabel + '人员'" prop="executorId">
+              <el-select
+                v-model="addForm.executorId"
+                size="small"
+                style="width: 100%"
+                 :disabled="isBindPlan"
+              >
+                <el-option
+                  v-for="item in executorList"
+                  :key="item.userId"
+                  :value="item.userId"
+                  :label="item.trueName"
+                  @click.native="
+                    {
+                      addForm.executorName = item.trueName
+                      addForm.executorPhone = item.mobile
+                    }
+                  "
+                ></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="状态" prop="status">
+              <el-switch
+                v-model="addForm.status"
+                active-color="#157a2c"
+                inactive-color="#999"
+                active-text="开"
+                inactive-text="关"
+                :active-value="true"
+                :inactive-value="false"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="16">
+            <el-form-item label="备注" prop="remark">
+              <el-input
+                type="textarea"
+                resize="none"
+                v-model="addForm.remark"
+                :rows="2"
+                placeholder="请详细说明"
+                size="small"
+                 :disabled="isBindPlan"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <!-- 设备分类 -->
+      <div class="equipment_box">
+        <div class="left_aside">
+          <div class="equipment_list_title">设备列表</div>
+          <div class="equipment_tree">
+            <el-tree
+              :data="addForm.planRuleEquiList"
+              :props="defaultProps"
+              ref="planRuleEquiList"
+              highlight-current
+              node-key="id"
+              @node-click="handleNodeClick"
+               :disabled="isBindPlan"
+            ></el-tree>
+          </div>
+        </div>
+        <div class="right_aside">
+          <div class="equipment_info">
+            <div class="item_info">
+              <span class="item_label">设备编码</span>
+              <span class="item_value">{{ equipmentInfo.equiCode }}</span>
+            </div>
+            <div class="item_info">
+              <span class="item_label">设备名称</span>
+              <span class="item_value">{{ equipmentInfo.equiName }}</span>
+            </div>
+            <div class="item_info">
+              <span class="item_label">设备型号</span>
+              <span class="item_value">{{ equipmentInfo.equiModel }}</span>
+            </div>
+            <div class="item_info">
+              <span class="item_label">设备位置</span>
+              <span class="item_value">{{ equipmentInfo.equiLocation }}</span>
+            </div>
+          </div>
+          <!-- 添加操作事项 -->
+          <div>
+            <el-button type="text" @click="addOperationItems"  :disabled="isBindPlan"
+              >添加操作事项</el-button
+            >
+            <el-table
+              :data="addForm.planRuleEquiList[currentEquItemIndex] && addForm.planRuleEquiList[currentEquItemIndex].itemJson"
+              border
+            >
+              <el-table-column label="序号" align="center" width="60">
+                <template slot-scope="scope">
+                  <span>{{ scope.$index + 1 }}</span>
+                </template>
+              </el-table-column>
+              <el-table-column label="事项" align="center" prop="name">
+              </el-table-column>
+              <el-table-column label="内容" align="center" prop="content">
+              </el-table-column>
+              <el-table-column label="标准" align="center" prop="norm">
+              </el-table-column>
+              <el-table-column label="操作" align="center" width="70">
+                <template slot-scope="scope">
+                  <el-button
+                    type="text"
+                    @click="handleDeleteOperationItem(scope.$index)"
+                     :disabled="isBindPlan"
+                    >删除</el-button
+                  >
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+
+          <!-- 添加备品备件  -->
+          <div v-if="dialogTitle.includes('保养')">
+            <el-button type="text" @click="addSpareItems"  :disabled="isBindPlan"
+              >添加备品备件</el-button
+            >
+            <el-table
+              :data="addForm.planRuleEquiList[currentEquItemIndex]&&addForm.planRuleEquiList[currentEquItemIndex].partJson"
+              height="300"
+              :key='currentEquItemIndex'
+              border
+            >
+              <el-table-column label="序号" align="center" width="60">
+                <template slot-scope="scope">
+                  <span>{{ scope.$index + 1 }}</span>
+                </template>
+              </el-table-column>
+              <el-table-column label="备件名称" align="center" prop="name">
+              </el-table-column>
+              <el-table-column label="规格型号" align="center" prop="model">
+              </el-table-column>
+              <el-table-column label="所需数量" align="center" prop="num">
+                <template slot-scope="scope">
+                  <el-input
+                    v-model.number="scope.row.num"
+                    size="small"
+                    oninput="value=value.replace(/[^\d]/g,'')"
+                    style="width: 100%"
+                    placeholder="输入数量"
+                    @input="changeNum"
+                  ></el-input>
+                </template>
+              </el-table-column>
+              <el-table-column label="单位" align="center" prop="measuringUnit">
+              </el-table-column>
+              <el-table-column label="费用" align="center">
+                  <template slot-scope="scope">
+                     {{scope.row.num*scope.row.amount}}{{scope.row.unit=='wanyuan'?'万元':'元'}}
+                  </template>
+              </el-table-column>
+              <el-table-column label="操作" align="center" width="70">
+                <template slot-scope="scope">
+                  <el-button
+                    type="text"
+                    @click="handleDeleteSpareItem(scope.$index)"
+                     :disabled="isBindPlan"
+                    >删除</el-button
+                  >
+                </template>
+              </el-table-column>
+            </el-table>
+            <div style="text-align: center">备件总费用:
+              {{addForm.planRuleEquiList[currentEquItemIndex]&&addForm.planRuleEquiList[currentEquItemIndex].totalCost?addForm.planRuleEquiList[currentEquItemIndex].totalCost:'-'}}
+              元
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+    <div slot="footer" class="dialog_footer">
+      <el-button size="small" type="primary" @click="submit">提交</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+<!--    <RuleItemSelection
+      ref="ruleItemSelectionRef"
+      :ruleItem="matterRulesList"
+      :selectedMatter="selectedMatter"
+      :labelTitle="formLabel"
+      @submit="ruleItemSelectionSubmit"
+    />
+    <AddSpareDialog
+      ref="addSpareDialogRef"
+      :selectedSpare="selectedSpare"
+      @submit="spareItemSelectSubmit"
+    /> -->
+  </el-dialog>
+</template>
+
+<script>
+// import planRules from '@/api/planRules/patrolConfig'
+// import contentConfig from '@/api/maintenance/patrol/ruleConfig'
+// import { getAssetsList } from '@/api/ledgerAssets/booksList'
+// import user from '@/api/main/user'
+// import dept from '@/api/main/dept'
+// import SelectTree from '@/components/selectTree'
+// import RuleItemSelection from '@/components/ruleItemSelection'
+// import AddSpareDialog from '@/components/addSpareDialog'
+// import { mapGetters } from 'vuex'
+// import { getRuleNameList } from '@/api/stockManagement/stocking'
+import {deepClone} from "@/utils"
+export default {
+  name: 'addPatrolConfigDialog',
+  // components: { SelectTree, RuleItemSelection, AddSpareDialog },
+  props: {
+    dialogTitle: {
+      type: String,
+      default: () => {
+        return '新增巡点检计划配置'
+      }
+    },
+    isBindPlan: {
+      type: Boolean,
+      default: function () {
+        return false
+      }
+    },
+    // queryId: {
+    //   type: Number,
+    //   default: function () {
+    //     return 0
+    //   }
+    // },
+  },
+  data () {
+    return {
+      defaultProps: {
+        label: 'showName'
+      },
+      addPatrolConfigDialog: false,
+      matterRulesList: [], // 选择规则名称的时候,获取的事项
+      equipmentInfo: {},
+      clickedTreeNode: false,
+      selectedMatter: [],
+      selectedSpare: [],
+      uerList: [],
+      deptList: [],
+      executorList: [],
+      currentEquItemIndex: 0,
+      formLabel: '',
+      planRuleTypeObj: {
+        1: 'PATROL',
+        2: 'MAINTAIN',
+        4: 'INVENTORY'
+      },
+	  treeData:[],
+      addForm: {
+        // planRuleCode: getRuleNo('PL'), // 计划配置单号
+        planRuleName: '', // 计划配置名称
+        isSyncBill: true, // 自动派单
+        ruleId: '', // 规则id
+        ruleName: '', // 规则名称
+        duration: null, // 计划完成时长
+        bizTypeId: '', // 设备分类id
+        bizTypeName: '', // 设备分类name
+        verifyUserId: '', // 审核人id
+        verifyUserName: '', // 审核人name
+        executorDeptCode: '', // 巡点检部门code
+        executorDeptName: '', // 巡点检部门name
+        executorId: '', // 巡点检人员id
+        executorName: '', // 巡点检人员name
+        executorPhone: '',
+        status: true, // 状态
+        remark: '', // 备注
+        planRuleType: 'PATROL', // 计划规则类型 巡点检: 'PATROL', 保养: 'MAINTAIN', 盘点: 'INVENTORY'
+        // 计划规则设备列表
+        planRuleEquiList: [
+          {
+            equiTypeId: '', // 设备分类Id
+            equiTypeName: '', // 设备分类名字
+            equiCode: '', // 设备编码 equCode
+            equiName: '', // 设备名称 name
+            equiModel: '', // 设备型号 specifications
+            equiLocation: '', // 设备位置
+            equiLocationCode: '', // 设备位置code
+            // 设备事项
+            itemJson: [
+              // {
+              //   name: '', // 事项名称
+              //   content: '', // 事项内容
+              //   norm: '' // 事项标准
+              // }
+            ],
+            // 设备备品备件 - 巡点检不需要备品备件,保养需要
+            partJson: [
+              //   {
+              //     code: '', // 备品备件code
+              //     name: '', // 备品备件name
+              //     model: '', // 备品备件型号
+              //     num: '', // 所需数量
+              //     unit: '', // 单位
+              //     amount: '', // 费用
+              //   }
+            ],
+            totalCost:0,
+          }
+        ]
+      },
+      addFormRules: {
+        planRuleName: [
+          { required: true, message: '请输入计划配置名称', trigger: 'blur' }
+        ],
+        isSyncBill: [
+          { required: true, message: '请选择是否自动派单', trigger: 'change' }
+        ],
+        ruleId: [
+          { required: true, message: '请选择规则名称', trigger: 'change' }
+        ],
+        duration: [
+          { required: true, message: '请输入计划完成时长', trigger: 'blur' }
+        ],
+        bizTypeId: [
+          { required: true, message: '请选择设备分类', trigger: 'change' }
+        ],
+        verifyUserId: [
+          { required: false, message: '请选择审核人', trigger: 'change' }
+        ],
+        executorDeptCode: [
+          { required: true, message: '请选择选择巡点检部门', trigger: 'change' }
+        ],
+        executorId: [
+          { required: true, message: '请选择选择巡点检人员', trigger: 'change' }
+        ]
+      },
+      ruleNameList:[],
+	  addDialogLoading:false,
+	  
+	  equipmentList:[]
+    }
+  },
+  computed: {
+    // ...mapGetters([
+    //   'equipmentList',
+    //   // 'ruleNameList',
+    //   'planRulesDetails',
+    //   'addDialogLoading'
+    // ])
+  },
+  watch: {
+    addPatrolConfigDialog (val) {
+      if (val) {
+        this.formLabel = this.dialogTitle.includes('巡点检')
+          ? '巡点检'
+          : this.dialogTitle.includes('保养')
+          ? '保养'
+          : '盘点'
+        const planRuleTypeObj = {
+          巡点检: 'PATROL',
+          保养: 'MAINTAIN',
+          盘点: 'INVENTORY'
+        }
+        this.addForm.planRuleType = planRuleTypeObj[this.formLabel]
+        // 获取审核人列表数据
+        this.getUserList()
+        // 获取部门
+        this.getDeptList()
+        // 获取规则名称
+        this._getRuleNameList()
+      }
+    },
+    async planRulesDetails (val) {
+       if (!this.addPatrolConfigDialog) return
+      const tempPlanRuleEquiList = val.planRuleEquiList
+      this.addForm = val
+      delete this.addForm.createTime
+      delete this.addForm.updateTime
+      this.clickedTreeNode = true
+      // 编辑弹窗需要重新获取规则下面的事项
+      this._getMatterRulesDetails(val.ruleId)
+      // 设备分类回显需要将id转成string
+      this.addForm.bizTypeId = String(val.bizTypeId)
+      // 根据部门回显人员
+      const params = { deptCode: val.executorDeptCode, status: 1 }
+      this.getUserList(params)
+      // 回显设备事项
+      await this._getEquipmentList(val.bizTypeId)
+      const item = this.addForm.planRuleEquiList[0]
+      console.log('item',item)
+      // 默认选中列表第一条树节点
+      this.$nextTick(() => {
+        this.$refs.planRuleEquiList.setCurrentKey(item.id)
+      })
+      const { equiLocation, equiLocationCode } = this.getEquiLocation(item)
+      this.equipmentInfo = {
+        equiCode: item.code,
+        equiName: item.name,
+        equiModel: item.modelType,
+        equiLocation: equiLocation,
+        equiLocationCode: equiLocationCode
+      }
+      this.currentEquItemIndex = 0
+      this.addForm.planRuleEquiList[0]['equiLocation'] = equiLocation
+      this.addForm.planRuleEquiList[0]['equiLocationCode'] = equiLocationCode
+      // 对比详情返回的数据和设备分类下面所有的设备列表,将itemJson同步过去
+      for (let i = 0; i < this.addForm.planRuleEquiList.length; i++) {
+        for (let j = 0; j < tempPlanRuleEquiList.length; j++) {
+          if (
+            this.addForm.planRuleEquiList[i].code ===
+            tempPlanRuleEquiList[j].equiCode
+          ) {
+            this.addForm.planRuleEquiList[i]['itemJson'] =
+              tempPlanRuleEquiList[j]['itemJson']
+            this.addForm.planRuleEquiList[i]['partJson'] =
+              tempPlanRuleEquiList[j]['partJson']
+            break
+          }
+        }
+      }
+    }
+  },
+  created(){
+  },
+  methods: {
+    handleClose () {
+      this.addPatrolConfigDialog = false
+      this.$refs.addFormRef.resetFields()
+      if (this.$refs.searchTree) {
+        this.$refs.searchTree.clearHandle()
+      }
+      this.currentEquItemIndex = 0
+      this.equipmentInfo = {}
+      this.addForm = {
+        // planRuleCode: getRuleNo('PL'), // 计划配置单号
+        planRuleName: '', // 计划配置名称
+        isSyncBill: true, // 自动派单
+        ruleId: '', // 规则id
+        duration: null, // 计划完成时长
+        bizTypeId: '', // 设备分类
+        bizTypeName: '', // 设备分类
+        verifyUserId: '', // 审核人id
+        verifyUserName: '', // 审核人name
+        executorDeptCode: '', // 巡点检部门code
+        executorDeptName: '', // 巡点检部门name
+        executorId: '', // 巡点检人员id
+        executorName: '', // 巡点检人员name
+        executorPhone: '',
+        status: true, // 状态
+        remark: '', // 备注
+        planRuleType: 'PATROL', // 计划规则类型 巡点检: 'PATROL', 保养: 'MAINTAIN', 盘点: 'INVENTORY'
+        // 计划规则设备列表
+        planRuleEquiList: [
+          {
+            equiTypeId: '', // 设备分类Id
+            equiTypeName: '', // 设备分类名字
+            equiCode: '', // 设备编码 equCode
+            equiName: '', // 设备名称 name
+            equiModel: '', // 设备型号 specifications
+            equiLocation: '', // 设备位置
+            equiLocationCode: '', // 设备位置 code
+            // 设备事项
+            itemJson: [
+              // {
+              //   name: '', // 事项名称
+              //   content: '', // 事项内容
+              //   norm: '' // 事项标准
+              // }
+            ],
+            // 设备备品备件 - 巡点检不需要备品备件,保养需要
+            partJson: [
+              //   {
+              //     code: '', // 备品备件code
+              //     name: '', // 备品备件name
+              //     model: '', // 备品备件型号
+              //     num: '', // 所需数量
+              //     unit: '', // 单位
+              //     amount: '', // 费用
+              //   }
+            ],
+            totalCost:0
+          }
+        ]
+      }
+    },
+    // 设备分类选择
+    async handleEquipmentClassChange (item) {
+      this.clickedTreeNode = true
+      this.addForm.bizTypeName = item.name
+      this.equipmentInfo = {}
+      this._getEquipmentList(item.id)
+    },
+    // 封装 - 获取设备分类列表
+    async _getEquipmentList (val) {
+      const params = { page: 1, size: 99999 }
+      const data = { classificationId: parseInt(val)}
+      try {
+        const res = await getAssetsList(params, data)
+        // console.log('设备列表:', res)
+        this.addForm.planRuleEquiList = res.data.records
+        this.addForm.planRuleEquiList.map(item=>{
+            item.showName = item.name+'('+item.code+')'
+        })
+        this.currentEquItemIndex = 0
+        const item = this.addForm.planRuleEquiList[0]
+        const { equiLocation, equiLocationCode } = this.getEquiLocation(item)
+        this.$nextTick(() => {
+          this.$refs.planRuleEquiList.setCurrentKey(item.id)
+          this.equipmentInfo = {
+            equiTypeId: this.addForm.bizTypeId,
+            equiTypeName: this.addForm.bizTypeName,
+            // equiCode: item.equCode,
+            equiCode: item.code,
+            equiName: item.name,
+            equiModel: item.specifications,
+            equiLocation: equiLocation,
+            equiLocationCode: equiLocationCode
+          }
+          this.currentEquItemIndex = 0
+          this.addForm.planRuleEquiList[0]['equiLocation'] = equiLocation
+          this.addForm.planRuleEquiList[0]['equiLocationCode'] = equiLocationCode
+          // if(this.addForm.planRuleEquiList[this.currentEquItemIndex].partJson){
+          //    this.tableList = this.addForm.planRuleEquiList[this.currentEquItemIndex].partJson
+          // }else{
+          //   this.tableList = []
+          // }
+        })
+      } catch (error) {
+        this.addForm.planRuleEquiList = []
+      }
+    },
+
+    // 获取审核人列表、巡点检人员
+    async getUserList (params) {
+      try {
+        let data = { status: 1, page: 1, size: 999999 }
+        // 如果传了参数就是获取巡点检人员数据
+        if (params) {
+          data = Object.assign(data, params)
+        }
+        const res = await user.list(data)
+        if (params) {
+          this.executorList = res.data.items
+        } else {
+          this.uerList = res.data.items
+        }
+      } catch (error) {}
+    },
+    // 获取部门列表数据
+    async getDeptList () {
+      try {
+        let tree = await dept.tree()
+        this.deptList = tree.data
+      } catch (error) {}
+    },
+    //选择部门(搜索)
+    searchDeptNodeClick (info) {
+      if (info) {
+        this.addForm.executorDeptCode = info.code
+        this.addForm.executorDeptName = info.name
+        // 根据部门获取人员
+        const params = { deptCode: info.code, status: 1 }
+        this.getUserList(params)
+      } else {
+        this.addForm.executorDeptCode = null
+      }
+    },
+    // 封装 - 获取设备位置名称和code方法
+    getEquiLocation(data) {
+      // 设备位置名称
+      const positionWorkshop = data.positionWorkshop ? data.positionWorkshop + '-' : ''
+      const positionFarm = data.positionFarm ? data.positionFarm + '-' : ''
+      const positionLine = data.positionLine ? data.positionLine + '-' : ''
+      const positionFactory = data.positionFactory ? data.positionFactory : ''
+      const equiLocation = positionWorkshop + positionFarm + positionLine + positionFactory
+      // 设备位置编码
+      const positionWorkshopCode = data.positionWorkshopCode ? data.positionWorkshopCode + '-' : ''
+      const positionFarmCode = data.positionFarmCode ? data.positionFarmCode + '-' : ''
+      const positionLineCode = data.positionLineCode ? data.positionLineCode + '-' : ''
+      const positionFactoryCode = data.positionFactoryCode ? data.positionFactoryCode : ''
+      const equiLocationCode = positionWorkshopCode + positionFarmCode + positionLineCode + positionFactoryCode
+      return { equiLocation, equiLocationCode }
+    },
+    // 设备列表树点击
+    handleNodeClick (data, node) {
+      // console.log(data)
+      const { equiLocation, equiLocationCode } = this.getEquiLocation(data)
+      this.equipmentInfo = {
+        equiCode: data.code,
+        equiName: data.name,
+        equiId: data.id,
+        equiModel: data.modelType,
+        equiLocation: equiLocation,
+        equiLocationCode: equiLocationCode
+      }
+      // 保存当前点击的设备列表某节点的index,在添加操作事项的时候,可以将事项list放到对应的节点对象中,以及切换节点的时候回显事项list
+      this.currentEquItemIndex = this.addForm.planRuleEquiList.findIndex(
+         item => item.code ===  data.code
+      )
+      this.clickedTreeNode = true
+      this.addForm.planRuleEquiList[this.currentEquItemIndex]['equiLocation'] = equiLocation
+      this.addForm.planRuleEquiList[this.currentEquItemIndex]['equiLocationCode'] = equiLocationCode
+    },
+    // 获取规则名列表
+    async _getRuleNameList () {
+      if(this.dialogTitle==='新增保养计划配置'||this.dialogTitle==='编辑保养计划配置'){
+          // console.log('保养计划')
+          const res = await getRuleNameList({ruleTypeEm:'MAINTAIN'})
+          if (res?.success) {
+            this.ruleNameList = res.data || []
+          }
+      }
+      if (this.dialogTitle==='新增巡点检计划配置'||this.dialogTitle==='编辑巡点检计划配置'){
+          console.log('巡点检计划')
+          const res = await getRuleNameList({ruleTypeEm:'PATROL'})
+          if (res?.success) {
+            this.ruleNameList = res.data || []
+          }
+      }
+    },
+    // 规则名称下拉触发
+    handleRuleNameChange (val) {
+      this._getMatterRulesDetails(val)
+    },
+    // 封装 - 获取规则下面的详情数据及事项
+    async _getMatterRulesDetails (val) {
+      const res = await contentConfig.getInfoNew(val)
+      if (res.success) {
+        this.matterRulesList = res.data.ruleDetailList
+        // console.log('事项规则:', this.matterRulesList)
+      }
+    },
+
+    // 从事项弹窗将数据丢到事项配置
+    ruleItemSelectionSubmit (list) {
+      if (
+        !this.addForm.planRuleEquiList[this.currentEquItemIndex]['itemJson']
+      ) {
+        this.addForm.planRuleEquiList[this.currentEquItemIndex]['itemJson'] = []
+      }
+      this.addForm.planRuleEquiList[this.currentEquItemIndex]['itemJson'] =
+        list.map(item => {
+          return {
+            id: item.id,
+            name: item.name,
+            content: item.content,
+            norm: item.norm
+          }
+        })
+      this.$forceUpdate()
+    },
+    // 添加操作事项
+    addOperationItems () {
+      if (!this.clickedTreeNode) {
+        return this.$message.warning('请选择设备分类!')
+      }
+      if (!this.addForm.ruleId) {
+        return this.$message.warning('请选择规则名称!')
+      }
+      this.$refs.ruleItemSelectionRef.open()
+      if (this.addForm.planRuleEquiList[this.currentEquItemIndex]['itemJson']) {
+        this.selectedMatter =
+          this.addForm.planRuleEquiList[this.currentEquItemIndex]['itemJson']
+      } else {
+        this.selectedMatter = []
+      }
+    },
+
+    // 删除操作事项
+    handleDeleteOperationItem (index) {
+      this.addForm.planRuleEquiList[this.currentEquItemIndex][
+        'itemJson'
+      ].splice(index, 1)
+    },
+
+    // 添加备品备件
+    addSpareItems () {
+      if (!this.clickedTreeNode) {
+        return this.$message.warning('请选择设备分类!')
+      }
+      if (!this.addForm.ruleId) {
+        return this.$message.warning('请选择规则名称!')
+      }
+      this.$refs.addSpareDialogRef.open()
+      if (this.addForm.planRuleEquiList[this.currentEquItemIndex]['partJson']) {
+        this.selectedSpare =
+          this.addForm.planRuleEquiList[this.currentEquItemIndex]['partJson']
+      } else {
+        this.selectedSpare = []
+      }
+    },
+
+    // 从备品备件弹窗将数据丢到备品备件配置
+    spareItemSelectSubmit (list) {
+      console.log('list',list)
+       this.addForm.planRuleEquiList[this.currentEquItemIndex]['partJson'] = list.map(item => {
+          return {
+              name: item.informationName,
+              model: item.modelType,
+              num: item.num,
+              unit: item.univalenceUnit,
+              amount: item.univalence,
+              measuringUnit:item.measuringUnit,
+              informationCode:item.informationCode
+          }
+      })
+      // this.addForm.planRuleEquiList[this.currentEquItemIndex]['partJson'] = [
+      //   ...deepClone(list)
+      // ]
+      // this.tableList = this.addForm.planRuleEquiList[this.currentEquItemIndex]['partJson']
+      this.$forceUpdate()
+    },
+
+    // 删除备品备件
+    handleDeleteSpareItem (index) {
+      this.addForm.planRuleEquiList[this.currentEquItemIndex][
+        'partJson'
+      ].splice(index, 1)
+      this.changeNum()
+    },
+
+    // 改变input数据重新计算总费用
+    changeNum(){
+        let applayList = this.addForm.planRuleEquiList[this.currentEquItemIndex].partJson
+        let total = 0
+        applayList.map(item=>{
+           if(item.hasOwnProperty('num')&&item.num!=''){
+              switch (item.unit) {
+                case 'wanyuan': {
+                  item.chengs = 10000
+                  break;
+                }
+                case 'yuan': {
+                  item.chengs = 1
+                  break;
+                }
+                default:
+                  break;
+              }
+              total = total + item.num*item.amount*item.chengs
+           }
+        })
+        this.$set(this.addForm.planRuleEquiList[this.currentEquItemIndex],'totalCost',total)
+    },
+
+    // 提交
+    submit () {
+      this.$refs.addFormRef.validate(async valid => {
+        if (valid) {
+          try {
+			// this.addForm.planRuleEquiList =
+            //          this.addForm.planRuleEquiList.filter(item => item.itemJson)
+            this.addForm.planRuleEquiList = this.addForm.planRuleEquiList.map(
+              item => {
+                return {
+                  equiTypeId: this.addForm.bizTypeId,
+                  equiTypeName: this.addForm.bizTypeName,
+                  equiCode: item.code,
+                  equiName: item.name,
+                  equiId: item.id,
+                  equiModel: item.modelType,
+                  equiLocation: item.equiLocation,
+                  equiLocationCode: item.equiLocationCode,
+                  itemJson: item.itemJson?item.itemJson:[],
+                  partJson: item.partJson?item.partJson:[],
+                }
+              }
+            )
+              if (this.addForm.planRuleType instanceof Object) {
+                this.addForm.planRuleType =
+                  this.planRuleTypeObj[this.addForm.planRuleType.code]
+              }
+              if(this.addForm.planRuleEquiList.length==0){
+                 this.$message.info('请添加操作事项')
+                  return
+              }
+              let arr = []
+              this.addForm.planRuleEquiList.map((item)=>{
+                  if(item.itemJson.length||item.partJson.length){
+                    arr.push(item)
+                  }
+              })
+              this.addForm.planRuleEquiList = arr
+              let newArr = JSON.parse(JSON.stringify(this.addForm.planRuleEquiList))
+              for (let i = 0; i < newArr.length; i++) {
+                  for (let j = 0; j < newArr[i].partJson.length; j++) {
+                      // delete newArr[i].partJson[j].createTime
+                      // delete newArr[i].partJson[j].id
+                      newArr[i].partJson[j].equipmentCode = newArr[i].equiCode
+                  }
+              }
+              this.addForm.planRuleEquiList = newArr
+              const res = await planRules.handleSaveOrUpdate(this.addForm)
+              if (res.success) {
+                const type = this.dialogTitle.includes('新增') ? '新增' : '编辑'
+                this.handleClose()
+                this.$message.success(type + '成功!')
+                this.$emit('refreshList')
+              }
+
+          } catch (error) {}
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+::v-deep .el-form {
+  .el-form-item {
+    margin-bottom: 14px;
+  }
+  .el-form-item__error {
+    padding-top: 0;
+  }
+}
+.equipment_box {
+  display: flex;
+  .left_aside {
+    width: 300px;
+    border: 1px solid #797979;
+    margin-right: 5px;
+    .equipment_list_title {
+      height: 24px;
+      line-height: 24px;
+      text-align: center;
+      background-color: #d7d7d7;
+      color: #000;
+      font-weight: 700;
+    }
+    .equipment_tree {
+      height: 510px;
+      overflow: auto;
+    }
+    ::v-deep .el-tree-node__expand-icon.el-icon-caret-right {
+      padding: 0;
+    }
+    ::v-deep
+      .el-tree--highlight-current
+      .el-tree-node.is-current
+      > .el-tree-node__content {
+      background-color: #d7f1fd !important;
+    }
+  }
+  .right_aside {
+    flex: 1;
+    border: 1px solid #797979;
+    padding: 10px;
+    .equipment_info {
+      display: flex;
+      flex-wrap: wrap;
+      border: 1px solid #ddd;
+      .item_info {
+        width: 33%;
+        height: 24px;
+        line-height: 24px;
+        display: flex;
+        .item_label {
+          width: 90px;
+          text-align: center;
+          background-color: #f2f2f2;
+          font-weight: 700;
+        }
+        .item_value {
+          border-bottom: 1px solid #f2f2f2;
+          flex: 1;
+          padding-left: 5px;
+        }
+        &:last-child {
+          width: 100%;
+          .item_value {
+            border: 0;
+          }
+        }
+      }
+    }
+  }
+}
+.dialog_footer {
+  text-align: center;
+}
+</style>

+ 7 - 0
src/views/rulesManagement/matterRules/components/matter-search.vue

@@ -103,3 +103,10 @@
     }
   };
 </script>
+<style lang="scss" scoped>
+    .ele-form-actions{
+		display:flex;
+		align-items: center;
+		justify-content: flex-end;
+	}
+</style>

+ 114 - 0
src/views/rulesManagement/planRules/MaintainConfig/components/maintain-search.vue

@@ -0,0 +1,114 @@
+<!-- 搜索表单 -->
+<template>
+  <el-form
+    label-width="100px"
+    class="ele-form-search"
+    @keyup.enter.native="search"
+    @submit.native.prevent
+  >
+    <el-row :gutter="15">
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="计划配置单号:">
+          <el-input clearable v-model="where.code" placeholder="请输入" />
+        </el-form-item>
+		<el-form-item label="规则名称:">
+			<el-input clearable v-model="where.name" placeholder="请输入" />
+		</el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="计划配置名称:">
+          <el-input clearable v-model="where.name" placeholder="请输入" />
+        </el-form-item>
+        <el-form-item label="状态:">
+          <DictSelection dictName="规则状态" clearable v-model="where.staus">
+          </DictSelection>
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="巡点检部门:">
+          <el-input clearable v-model="where.dep" placeholder="请输入" />
+        </el-form-item>
+		<el-form-item label="创建时间:">
+			<el-date-picker
+				v-model="where.time"
+				type="daterange"
+				range-separator="至"
+				start-placeholder="开始日期"
+				end-placeholder="结束日期"
+				value-format="yyyy-MM-dd HH:mm:ss"
+				:default-time="['00:00:00', '23:59:59']"
+			  >
+			</el-date-picker>
+		</el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="设备分类:">
+          <el-input clearable v-model="where.texture" placeholder="请输入" />
+        </el-form-item>
+		<div class="ele-form-actions">
+			<el-button
+				type="primary"
+				icon="el-icon-search"
+				class="ele-btn-icon"
+				@click="search"
+				size="small"
+			>
+				查询
+			</el-button>
+			 <el-button @click="reset"
+				 icon="el-icon-refresh-left"
+				 size="small"
+				 type="primary"
+			 >重置</el-button>
+		</div>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+  import { login } from '@/api/login';
+  export default {
+    data() {
+      // 默认表单数据
+      const defaultWhere = {
+        name: '',
+        code: '',
+        fixCode:'',
+        ownershipGroupId:''
+      };
+      return {
+        // 表单数据
+        where: { ...defaultWhere },
+        treeData:[]
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    created(){
+    },
+    methods: {
+      /* 搜索 */
+      search() {
+        console.log(this.where);
+        this.$emit('search', this.where);
+      },
+      /*  重置 */
+      reset() {
+        this.where = { ...this.defaultWhere };
+        this.search();
+      }
+    }
+  };
+</script>
+<style lang="scss" scoped>
+    .ele-form-actions{
+		display:flex;
+		align-items: center;
+		justify-content: flex-end;
+	}
+</style>

+ 229 - 0
src/views/rulesManagement/planRules/MaintainConfig/index.vue

@@ -0,0 +1,229 @@
+<template>
+  <div class="ele-body">
+     <el-card shadow="never" v-loading="loading">
+	   <maintain-search @search="reload">
+	   </maintain-search>
+	   <!-- 数据表格 -->
+	   <ele-pro-table
+	     ref="table"
+	     :columns="columns"
+	     :datasource="datasource"
+	     cache-key="systemRoleTable"
+	   >
+	     <!-- 表头工具栏 -->
+	     <template v-slot:toolbar>
+	       <el-button
+	         size="small"
+	         type="primary"
+	         icon="el-icon-plus"
+	         class="ele-btn-icon"
+	         @click="openEdit()"
+	       >
+	         新建
+	       </el-button>
+		   <el-button
+		     size="small"
+		     type="primary"
+		     class="ele-btn-icon"
+		     @click="goDetail()"
+		   >
+		     详情
+		   </el-button>
+	     </template>
+<!-- 	     <template v-slot:enable="{ row }">
+	       <el-switch
+	         v-model="row.enable"
+	         active-color="#13ce66"
+	         inactive-color="#ff4949"
+	         :active-value="1"
+	         :inactive-value="0"
+	         @change="changeEnable(row)"
+	       >
+	       </el-switch>
+	     </template> -->
+	     <!-- 操作列 -->
+	     <template v-slot:action="{ row }">
+	       <el-link
+	         type="primary"
+	         :underline="false"
+	         icon="el-icon-edit"
+	         @click="openEdit(row)"
+	       >
+	         修改
+	       </el-link>
+	       <el-popconfirm
+	         class="ele-action"
+	         title="确定要删除此角色吗?"
+	         @confirm="remove(row)"
+	       >
+	         <template v-slot:reference>
+	           <el-link type="danger" :underline="false" icon="el-icon-delete">
+	             删除
+	           </el-link>
+	         </template>
+	       </el-popconfirm>
+	     </template>
+	   </ele-pro-table>
+     </el-card>
+	 
+	 <!-- 新建或编辑弹窗 -->
+    <AddPatrolConfigDialog
+      ref="addPatrolConfigDialogRef"
+      :dialogTitle="dialogTitle"
+      :isBindPlan="isBindPlan"
+    />
+  </div>
+</template>
+
+<script>
+  import AddPatrolConfigDialog from '@/components/addPatrolConfigDialog'
+  import MaintainSearch from './components/maintain-search.vue';
+  import { pageRoles } from '@/api/system/role'; 
+  export default {
+    components: {
+      MaintainSearch,
+	    AddPatrolConfigDialog
+    },
+    data () {
+      return {
+		// 表格列配置
+		columns: [
+		  {
+		    columnKey: 'index',
+		    label: '序号',
+		    type: 'index',
+		    width: 55,
+		    align: 'center',
+		    showOverflowTooltip: true,
+		    fixed: 'left'
+		  },
+		  {
+		    prop: 'code',
+		    label: '计划配置单号',
+		    align: 'center',	
+		    showOverflowTooltip: true,
+		    minWidth: 110
+		  },
+		  {
+		    prop: 'groupId',
+		    label: '计划配置名称',
+		    align: 'center',
+		    showOverflowTooltip: true,
+		    minWidth: 110
+		  },
+		  {
+		    prop: 'enable',
+		    label: '巡点检部门',
+		    align: 'center',	
+		    showOverflowTooltip: true,
+		    slot: 'enable',
+		    minWidth: 110
+		  },
+		  {
+		    prop: 'name',
+		    label: '设备分类',
+		    align: 'center',	
+		    showOverflowTooltip: true,
+		    minWidth: 110
+		  },
+		  {
+		    prop: 'cycle',
+		    label: '规则名称',
+		    align: 'center',	
+		    showOverflowTooltip: true,
+		    minWidth: 110
+		  },
+			{
+			  prop: 'auto',
+			  label: '自动派单',
+			  align: 'center',	
+			  showOverflowTooltip: true,
+			  minWidth: 110
+			},
+			{
+			  prop: 'status',
+			  label: '状态',
+			  align: 'center',	
+			  showOverflowTooltip: true,
+			  minWidth: 110
+			},
+		  {
+		    prop: 'creater',
+		    label: '创建人',
+		    align: 'center',	
+		    showOverflowTooltip: true,
+		    minWidth: 110
+		  },
+		  {
+		    prop: 'createTime',
+		    label: '创建时间',
+		    align: 'center',
+		    showOverflowTooltip: true,
+		    minWidth: 110,
+		    formatter: (_row, _column, cellValue) => {
+		      return this.$util.toDateString(cellValue);
+		    }
+		  },
+		  {
+		    columnKey: 'action',
+		    label: '操作',
+		    width: 230,
+		    align: 'center',
+		    resizable: false,
+		    slot: 'action',
+		    showOverflowTooltip: true
+		  }
+		],
+        // 加载状态
+        loading: false,
+        pageType: 'add',
+        dialogTitle: '',
+		isBindPlan:false,
+      };
+    },
+    computed: {
+
+    },
+    methods: {
+      /* 表格数据源 */
+      datasource({ page, limit, where, order }) {
+        return pageRoles({ pageNum: page, size: limit, ...where });
+      },
+      async changeEnable(row) {
+        const res = await putRoles(row);
+        if (res.code == 0) {
+          this.$message({
+            type: 'success',
+            message: '修改成功',
+            customClass: 'ele-message-border'
+          });
+          this.reload();
+        }
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ page: 1, where });
+      },
+	  
+	  openEdit(row){
+		  this.isBindPlan = false
+		  this.$refs.addPatrolConfigDialogRef.addPatrolConfigDialog = true
+		  this.dialogTitle = '新增巡点检计划配置'
+	  },
+	  
+	  goDetail(){
+		  this.$router.push({
+		    path: '/rulesManagement/planRules/PatrolConfig/detail',
+		    // query: {
+		    //   id
+		    // }
+		  })
+	  }
+	  
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 114 - 0
src/views/rulesManagement/planRules/PatrolConfig/components/patrol-search.vue

@@ -0,0 +1,114 @@
+<!-- 搜索表单 -->
+<template>
+  <el-form
+    label-width="100px"
+    class="ele-form-search"
+    @keyup.enter.native="search"
+    @submit.native.prevent
+  >
+    <el-row :gutter="15">
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="计划配置单号:">
+          <el-input clearable v-model="where.code" placeholder="请输入" />
+        </el-form-item>
+		<el-form-item label="规则名称:">
+			<el-input clearable v-model="where.name" placeholder="请输入" />
+		</el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="计划配置名称:">
+          <el-input clearable v-model="where.name" placeholder="请输入" />
+        </el-form-item>
+        <el-form-item label="状态:">
+          <DictSelection dictName="规则状态" clearable v-model="where.staus">
+          </DictSelection>
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="巡点检部门:">
+          <el-input clearable v-model="where.dep" placeholder="请输入" />
+        </el-form-item>
+		<el-form-item label="创建时间:">
+			<el-date-picker
+				v-model="where.time"
+				type="daterange"
+				range-separator="至"
+				start-placeholder="开始日期"
+				end-placeholder="结束日期"
+				value-format="yyyy-MM-dd HH:mm:ss"
+				:default-time="['00:00:00', '23:59:59']"
+			  >
+			</el-date-picker>
+		</el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="设备分类:">
+          <el-input clearable v-model="where.texture" placeholder="请输入" />
+        </el-form-item>
+		<div class="ele-form-actions">
+			<el-button
+				type="primary"
+				icon="el-icon-search"
+				class="ele-btn-icon"
+				@click="search"
+				size="small"
+			>
+				查询
+			</el-button>
+			 <el-button @click="reset"
+				 icon="el-icon-refresh-left"
+				 size="small"
+				 type="primary"
+			 >重置</el-button>
+		</div>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+  import { login } from '@/api/login';
+  export default {
+    data() {
+      // 默认表单数据
+      const defaultWhere = {
+        name: '',
+        code: '',
+        fixCode:'',
+        ownershipGroupId:''
+      };
+      return {
+        // 表单数据
+        where: { ...defaultWhere },
+        treeData:[]
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    created(){
+    },
+    methods: {
+      /* 搜索 */
+      search() {
+        console.log(this.where);
+        this.$emit('search', this.where);
+      },
+      /*  重置 */
+      reset() {
+        this.where = { ...this.defaultWhere };
+        this.search();
+      }
+    }
+  };
+</script>
+<style lang="scss" scoped>
+    .ele-form-actions{
+		display:flex;
+		align-items: center;
+		justify-content: flex-end;
+	}
+</style>

+ 262 - 0
src/views/rulesManagement/planRules/PatrolConfig/detail.vue

@@ -0,0 +1,262 @@
+<template>
+  <div class="patrol_config_detail" v-loading="detailsLoading">
+<!--    <div class="detail_title">
+      <span>详情</span>
+      <el-button size="small" @click="$router.go(-1)">关闭</el-button>
+    </div> -->
+    <div class="main_content">
+      <!-- 基本信息 -->
+      <div class="base_info">
+        <div class="base_info_title">
+          <span>基本信息</span>
+        </div>
+        <el-row class="base_info_content">
+          <el-col :span="6">
+            <span>计划单号:</span>
+            <span>{{ detailsForm.planRuleCode }}</span>
+          </el-col>
+          <el-col :span="6">
+            <span>巡点检名称:</span>
+            <span>{{ detailsForm.planRuleName }}</span>
+          </el-col>
+          <el-col :span="6">
+            <span>巡点检部门:</span>
+            <span>{{ detailsForm.executorDeptName }}</span>
+          </el-col>
+          <el-col :span="6">
+            <span>巡点检人员:</span>
+            <span>{{ detailsForm.executorName }}</span>
+          </el-col>
+          <el-col :span="6">
+            <span>计划完成时长:</span>
+            <span>{{ detailsForm.duration }}分钟</span>
+          </el-col>
+          <el-col :span="6">
+            <span>设备分类:</span>
+            <span>{{ detailsForm.equiTypeName }}</span>
+          </el-col>
+          <el-col :span="6">
+            <span>规则名称:</span>
+            <span>{{ detailsForm.ruleName }}</span>
+          </el-col>
+          <el-col :span="6">
+            <span>创建部门:</span>
+            <span>{{ detailsForm.createOrgName }}</span>
+          </el-col>
+          <el-col :span="6">
+            <span>创建人:</span>
+            <span>{{ detailsForm.createUserName }}</span>
+          </el-col>
+          <el-col :span="6">
+            <span>创建时间:</span>
+            <span>{{ detailsForm.createTime }}</span>
+          </el-col>
+          <el-col :span="6">
+            <span>审核人:</span>
+            <span>{{ detailsForm.verifyUserName }}</span>
+          </el-col>
+          <el-col :span="24">
+            <span>备注:</span>
+            <span>{{ detailsForm.remark }}</span>
+          </el-col>
+        </el-row>
+      </div>
+      <!-- 巡点检设备 -->
+      <div class="patrol_equipment_info">
+        <div class="patrol_equipment_info_title">
+          <span>巡点检设备</span>
+        </div>
+        <div class="patrol_equipment_info_content">
+          <div
+            class="equipment_item"
+            v-for="item in detailsForm.planRuleEquiList"
+            :key="item.id"
+          >
+            <div class="equipment_info">
+              <div class="item_info">
+                <span class="item_label">设备编码</span>
+                <span class="item_value">{{ item.equiCode }}</span>
+              </div>
+              <div class="item_info">
+                <span class="item_label">设备名称</span>
+                <span class="item_value">{{ item.equiName }}</span>
+              </div>
+              <div class="item_info">
+                <span class="item_label">设备型号</span>
+                <span class="item_value">{{ item.equiModel }}</span>
+              </div>
+              <div class="item_info">
+                <span class="item_label">设备位置</span>
+                <span class="item_value">{{ item.equiLocation }}</span>
+              </div>
+            </div>
+            <p>操作事项</p>
+            <div class="matter_info">
+              <el-table :data="item.itemJson" border>
+                <el-table-column label="序号" align="center" width="80">
+                  <template slot-scope="scope">
+                    <span>{{ scope.$index + 1 }}</span>
+                  </template>
+                </el-table-column>
+                <el-table-column label="事项" prop="name" />
+                <el-table-column label="内容" prop="content" />
+                <el-table-column label="标准" prop="norm" />
+              </el-table>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+// import planRules from '@/api/planRules/patrolConfig'
+// import { mapGetters } from 'vuex'
+
+export default {
+  name: 'patrolConfigDetail',
+  data () {
+    return {
+      detailsLoading: false,
+      detailsForm: {}
+    }
+  },
+  mounted () {
+    // this.getDetailsData(this.$route.query.id)
+  },
+  computed: {
+    // ...mapGetters(['equipmentList', 'ruleNameList'])
+  },
+  methods: {
+    // 获取详情数据
+    getDetailsData (id) {
+      this.detailsLoading = true
+      planRules
+        .getPlanRulesDetails(id)
+        .then(res => {
+          // console.log(res.data)
+          this.detailsLoading = false
+          this.detailsForm = res.data
+          this.detailsForm['equiTypeName'] = this.equipmentList.filter(item => item.id == this.detailsForm.bizTypeId)[0].name
+          this.detailsForm['ruleName'] = this.ruleNameList.filter(item => item.id == this.detailsForm.ruleId)[0].name
+          this.detailsForm.planRuleEquiList = this.detailsForm.planRuleEquiList.filter(item => item.itemJson != null)
+        })
+        .catch(() => {
+          this.detailsLoading = false
+        })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.patrol_config_detail {
+  padding: 5px 0;
+  .detail_title {
+    display: flex;
+    height: 40px;
+    align-items: center;
+    justify-content: space-between;
+    > span {
+      background-color: #fff;
+      line-height: 40px;
+      width: 90px;
+      text-align: center;
+      border-top: 4px solid #157a2c;
+    }
+  }
+  .main_content {
+    background-color: #fff;
+    padding: 20px 40px;
+    .base_info {
+      .base_info_title {
+        border-bottom: 1px solid #1890ff;
+        padding-bottom: 3px;
+        margin-bottom: 20px;
+        > span {
+          display: inline-block;
+          line-height: 16px;
+          border-left: 6px solid #1890ff;
+          padding-left: 6px;
+        }
+      }
+      .base_info_content {
+        padding: 0 100px;
+        font-size: 14px;
+        ::v-deep .el-col {
+          margin-bottom: 20px;
+          > span:first-child {
+            font-weight: 700;
+          }
+        }
+      }
+    }
+    .patrol_equipment_info {
+      .patrol_equipment_info_title {
+        border-bottom: 1px solid #1890ff;
+        padding-bottom: 3px;
+        margin-bottom: 20px;
+        > span {
+          display: inline-block;
+          line-height: 16px;
+          border-left: 6px solid #1890ff;
+          padding-left: 6px;
+        }
+      }
+      .patrol_equipment_info_content {
+        padding: 0 30px;
+        .equipment_item {
+          border: 1px solid #ccc;
+          font-size: 14px;
+          padding: 15px;
+          margin-bottom: 30px;
+          .equipment_info {
+            display: flex;
+            flex-wrap: wrap;
+            border: 1px solid #ddd;
+            .item_info {
+              width: 33.33%;
+              height: 24px;
+              line-height: 24px;
+              display: flex;
+              .item_label {
+                width: 90px;
+                text-align: center;
+                background-color: #f2f2f2;
+                font-weight: 700;
+              }
+              .item_value {
+                border-bottom: 1px solid #f2f2f2;
+                flex: 1;
+                padding-left: 5px;
+              }
+              &:last-child {
+                width: 100%;
+                .item_value {
+                  border: 0;
+                }
+              }
+            }
+          }
+          > p {
+            margin-top: 20px;
+            color: #797979;
+          }
+          .matter_info {
+            ::v-deep .el-table {
+              th.el-table__cell {
+                background-color: #f2f2f2;
+                padding: 0;
+              }
+              td.el-table__cell {
+                padding: 0;
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
+</style>

+ 229 - 0
src/views/rulesManagement/planRules/PatrolConfig/index.vue

@@ -0,0 +1,229 @@
+<template>
+  <div class="ele-body">
+     <el-card shadow="never" v-loading="loading">
+	   <patrol-search @search="reload">
+	   </patrol-search>
+	   <!-- 数据表格 -->
+	   <ele-pro-table
+	     ref="table"
+	     :columns="columns"
+	     :datasource="datasource"
+	     cache-key="systemRoleTable"
+	   >
+	     <!-- 表头工具栏 -->
+	     <template v-slot:toolbar>
+	       <el-button
+	         size="small"
+	         type="primary"
+	         icon="el-icon-plus"
+	         class="ele-btn-icon"
+	         @click="openEdit()"
+	       >
+	         新建
+	       </el-button>
+		   <el-button
+		     size="small"
+		     type="primary"
+		     class="ele-btn-icon"
+		     @click="goDetail()"
+		   >
+		     详情
+		   </el-button>
+	     </template>
+<!-- 	     <template v-slot:enable="{ row }">
+	       <el-switch
+	         v-model="row.enable"
+	         active-color="#13ce66"
+	         inactive-color="#ff4949"
+	         :active-value="1"
+	         :inactive-value="0"
+	         @change="changeEnable(row)"
+	       >
+	       </el-switch>
+	     </template> -->
+	     <!-- 操作列 -->
+	     <template v-slot:action="{ row }">
+	       <el-link
+	         type="primary"
+	         :underline="false"
+	         icon="el-icon-edit"
+	         @click="openEdit(row)"
+	       >
+	         修改
+	       </el-link>
+	       <el-popconfirm
+	         class="ele-action"
+	         title="确定要删除此角色吗?"
+	         @confirm="remove(row)"
+	       >
+	         <template v-slot:reference>
+	           <el-link type="danger" :underline="false" icon="el-icon-delete">
+	             删除
+	           </el-link>
+	         </template>
+	       </el-popconfirm>
+	     </template>
+	   </ele-pro-table>
+     </el-card>
+	 
+	 <!-- 新建或编辑弹窗 -->
+    <AddPatrolConfigDialog
+      ref="addPatrolConfigDialogRef"
+      :dialogTitle="dialogTitle"
+      :isBindPlan="isBindPlan"
+    />
+  </div>
+</template>
+
+<script>
+  import AddPatrolConfigDialog from '@/components/addPatrolConfigDialog'
+  import PatrolSearch from './components/patrol-search.vue';
+  import { pageRoles } from '@/api/system/role'; 
+  export default {
+    components: {
+      PatrolSearch,
+	  AddPatrolConfigDialog
+    },
+    data () {
+      return {
+		// 表格列配置
+		columns: [
+		  {
+		    columnKey: 'index',
+		    label: '序号',
+		    type: 'index',
+		    width: 55,
+		    align: 'center',
+		    showOverflowTooltip: true,
+		    fixed: 'left'
+		  },
+		  {
+		    prop: 'code',
+		    label: '计划配置单号',
+		    align: 'center',	
+		    showOverflowTooltip: true,
+		    minWidth: 110
+		  },
+		  {
+		    prop: 'groupId',
+		    label: '计划配置名称',
+		    align: 'center',
+		    showOverflowTooltip: true,
+		    minWidth: 110
+		  },
+		  {
+		    prop: 'enable',
+		    label: '巡点检部门',
+		    align: 'center',	
+		    showOverflowTooltip: true,
+		    slot: 'enable',
+		    minWidth: 110
+		  },
+		  {
+		    prop: 'name',
+		    label: '设备分类',
+		    align: 'center',	
+		    showOverflowTooltip: true,
+		    minWidth: 110
+		  },
+		  {
+		    prop: 'cycle',
+		    label: '规则名称',
+		    align: 'center',	
+		    showOverflowTooltip: true,
+		    minWidth: 110
+		  },
+			{
+			  prop: 'auto',
+			  label: '自动派单',
+			  align: 'center',	
+			  showOverflowTooltip: true,
+			  minWidth: 110
+			},
+			{
+			  prop: 'status',
+			  label: '状态',
+			  align: 'center',	
+			  showOverflowTooltip: true,
+			  minWidth: 110
+			},
+		  {
+		    prop: 'creater',
+		    label: '创建人',
+		    align: 'center',	
+		    showOverflowTooltip: true,
+		    minWidth: 110
+		  },
+		  {
+		    prop: 'createTime',
+		    label: '创建时间',
+		    align: 'center',
+		    showOverflowTooltip: true,
+		    minWidth: 110,
+		    formatter: (_row, _column, cellValue) => {
+		      return this.$util.toDateString(cellValue);
+		    }
+		  },
+		  {
+		    columnKey: 'action',
+		    label: '操作',
+		    width: 230,
+		    align: 'center',
+		    resizable: false,
+		    slot: 'action',
+		    showOverflowTooltip: true
+		  }
+		],
+        // 加载状态
+        loading: false,
+        pageType: 'add',
+        dialogTitle: '',
+		isBindPlan:false,
+      };
+    },
+    computed: {
+
+    },
+    methods: {
+      /* 表格数据源 */
+      datasource({ page, limit, where, order }) {
+        return pageRoles({ pageNum: page, size: limit, ...where });
+      },
+      async changeEnable(row) {
+        const res = await putRoles(row);
+        if (res.code == 0) {
+          this.$message({
+            type: 'success',
+            message: '修改成功',
+            customClass: 'ele-message-border'
+          });
+          this.reload();
+        }
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ page: 1, where });
+      },
+	  
+	  openEdit(row){
+		  this.isBindPlan = false
+		  this.$refs.addPatrolConfigDialogRef.addPatrolConfigDialog = true
+		  this.dialogTitle = '新增巡点检计划配置'
+	  },
+	  
+	  goDetail(){
+		  this.$router.push({
+		    path: '/rulesManagement/planRules/PatrolConfig/detail',
+		    // query: {
+		    //   id
+		    // }
+		  })
+	  }
+	  
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+
+</style>