瀏覽代碼

巡检计划、路线、工单

yuhan 1 年之前
父節點
當前提交
502e6157d2

+ 8 - 1
src/components/module_ems/UModal/UModal.vue

@@ -18,6 +18,9 @@
         <a-col class="left-title">
           <slot name="title">{{ title }}</slot>
         </a-col>
+        <a-col class="center-content">
+          <slot name="centerContent"></slot>
+        </a-col>
         <!-- <a-col v-if="switchFullscreen" class="right" @click="toggleFullscreen">
           <a-button class="ant-modal-close ant-modal-close-x" ghost type="link" :icon="fullscreenButtonIcon"/>
         </a-col> -->
@@ -112,6 +115,7 @@ export default {
         // 内容展现形式:居中活全屏
         isContentFull: null,
         isModalFull: false,
+        isHasTab: false,
       }
     },
     computed: {
@@ -192,7 +196,7 @@ export default {
           this.isModalFull = newV
         },
         immediate: true
-      }
+      },
     },
     methods: {
 
@@ -292,6 +296,9 @@ export default {
           //   }
           // }
         }
+        .center-content{
+          line-height: 60px;
+        }
       }
       // 内容区域
       .ant-modal-body{

+ 213 - 0
src/views/module_cmms/inspect/InspectList.vue

@@ -0,0 +1,213 @@
+<template>
+  <a-card :bordered="false">
+    <!-- 查询区域 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline" @keyup.enter.native="searchQuery">
+        <a-row :gutter="24">
+        </a-row>
+      </a-form>
+    </div>
+    <!-- 查询区域-END -->
+
+    <!-- 操作按钮区域 -->
+    <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-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
+        <a-button type="primary" icon="import">导入</a-button>
+      </a-upload> -->
+      <!-- 高级查询区域 -->
+      <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>
+        </a-menu>
+        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
+      </a-dropdown> -->
+    </div>
+
+    <!-- table区域-begin -->
+    <div>
+      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
+        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
+        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
+      </div>
+
+      <a-table
+        ref="table"
+        size="middle"
+        :scroll="{x:true}"
+        bordered
+        rowKey="id"
+        :columns="columns"
+        :dataSource="dataSource"
+        :pagination="ipagination"
+        :loading="loading"
+        class="j-table-force-nowrap"
+        @change="handleTableChange">
+        <!-- :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" -->
+
+        <template slot="htmlSlot" slot-scope="text">
+          <div v-html="text"></div>
+        </template>
+        <template slot="imgSlot" slot-scope="text,record">
+          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
+          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
+        </template>
+        <template slot="fileSlot" slot-scope="text">
+          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
+          <a-button
+            v-else
+            :ghost="true"
+            type="primary"
+            icon="download"
+            size="small"
+            @click="downloadFile(text)">
+            下载
+          </a-button>
+        </template>
+
+        <span slot="action" slot-scope="text, record">
+          <a @click="handleEdit(record)">巡检</a>
+
+          <a-divider type="vertical" />
+          <a-dropdown>
+            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
+            <a-menu slot="overlay">
+              <a-menu-item>
+                <a @click="handleDetail(record)">详情</a>
+              </a-menu-item>
+              <!-- <a-menu-item>
+                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
+                  <a>删除</a>
+                </a-popconfirm>
+              </a-menu-item> -->
+            </a-menu>
+          </a-dropdown>
+        </span>
+
+      </a-table>
+    </div>
+
+    <inspect-modal ref="modalForm" @ok="modalFormOk"></inspect-modal>
+  </a-card>
+</template>
+
+<script>
+
+  import '@/assets/less/TableExpand.less'
+  import { mixinDevice } from '@/utils/mixin'
+  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+  import InspectModal from './modules/InspectModal'
+
+  export default {
+    name: 'InspectList',
+    mixins:[JeecgListMixin, mixinDevice],
+    components: {
+      InspectModal
+    },
+    data () {
+      return {
+        description: '巡检工单管理页面',
+        // 表头
+        columns: [
+          {
+            title: '序号',
+            dataIndex: '',
+            key:'rowIndex',
+            width:60,
+            align:"center",
+            customRender:function (t,r,index) {
+              return parseInt(index)+1;
+            }
+          },
+          {
+            title:'工单编号',
+            align:"center",
+            dataIndex: 'inspectcode'
+          },
+          {
+            title:'工单名称',
+            align:"center",
+            dataIndex: 'inspectname'
+          },
+          {
+            title:'任务类型:单次任务、周期任务',
+            align:"center",
+            dataIndex: 'tasktype'
+          },
+          {
+            title:'状态',
+            align:"center",
+            dataIndex: 'status_dict'
+          },
+          {
+            title:'巡检细项',
+            align:"center",
+            dataIndex: 'inspectdetail'
+          },
+          {
+            title:'巡检计划ID',
+            align:"center",
+            dataIndex: 'inspectplanid'
+          },
+          {
+            title:'待办人',
+            align:"center",
+            dataIndex: 'chargeruser'
+          },
+          {
+            title:'备注',
+            align:"center",
+            dataIndex: 'remark'
+          },
+          {
+            title: '操作',
+            dataIndex: 'action',
+            align:"center",
+            fixed:"right",
+            width:147,
+            scopedSlots: { customRender: 'action' }
+          }
+        ],
+        url: {
+          list: "/cmmsInspect/cmmsInspect/list",
+          delete: "/cmmsInspect/cmmsInspect/delete",
+          deleteBatch: "/cmmsInspect/cmmsInspect/deleteBatch",
+          exportXlsUrl: "/cmmsInspect/cmmsInspect/exportXls",
+          importExcelUrl: "cmmsInspect/cmmsInspect/importExcel",
+          
+        },
+        dictOptions:{},
+        superFieldList:[],
+      }
+    },
+    created() {
+    this.getSuperFieldList();
+    },
+    computed: {
+      importExcelUrl: function(){
+        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
+      },
+    },
+    methods: {
+      initDictConfig(){
+      },
+      getSuperFieldList(){
+        let fieldList=[];
+        fieldList.push({type:'string',value:'remark',text:'备注',dictCode:''})
+        fieldList.push({type:'string',value:'inspectcode',text:'工单编号',dictCode:''})
+        fieldList.push({type:'string',value:'inspectname',text:'工单名称',dictCode:''})
+        fieldList.push({type:'string',value:'tasktype',text:'任务类型:单次任务、周期任务',dictCode:''})
+        fieldList.push({type:'string',value:'status',text:'状态:0待处理、1处理中、2已完成',dictCode:''})
+        fieldList.push({type:'string',value:'inspectdetail',text:'巡检细项',dictCode:''})
+        fieldList.push({type:'string',value:'inspectplanid',text:'巡检计划ID',dictCode:''})
+        fieldList.push({type:'string',value:'chargeruser',text:'待办人',dictCode:''})
+        this.superFieldList = fieldList
+      }
+    }
+  }
+</script>
+<style scoped>
+  @import '~@assets/less/common.less';
+</style>

+ 386 - 0
src/views/module_cmms/inspect/modules/InspectForm.vue

@@ -0,0 +1,386 @@
+<template>
+  <a-spin :spinning="confirmLoading">
+    <j-form-container :disabled="formDisabled">
+      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
+        <a-row class="inspect-order-layout">
+          <a-col :span="8" class="inspect-tree">
+            <a-tree
+              :tree-data="treeData"
+              show-icon
+              default-expand-all
+              showLine
+              :selected-keys="selectedKeys"
+              :replaceFields="replaceFields"
+              @select="onSelect"
+            >
+              <a-icon slot="switcherIcon" type="down" />
+              <a-icon slot="smile" type="smile-o" />
+              <a-icon slot="meh" type="smile-o" />
+              <template slot="custom" slot-scope="{ selected }">
+                <a-icon :type="selected ? 'frown' : 'frown-o'" />
+              </template>
+            </a-tree>
+          </a-col>
+          <a-col :span="16" class="itemList-table">
+            <a-button @click="handleFeedback">提交反馈</a-button>
+            <a-table
+              ref="table"
+              size="middle"
+              :scroll="{x:true}"
+              bordered
+              rowKey="id"
+              :columns="columns"
+              :dataSource="model.itemList"
+              :pagination="false"
+              class="j-table-force-nowrap">
+              <template slot="iresult" slot-scope="text, record,index">
+                <a-form-model-item :prop="'itemList.'+index+'.iresult'" :rules="validatorRules.iresult" style="margin-bottom: 0px;">
+                  <a-radio-group name="radioGroup" v-model="record.iresult">
+                    <a-radio value="0">
+                      正常
+                    </a-radio>
+                    <a-radio value="1">
+                      异常
+                    </a-radio>
+                  </a-radio-group>
+                </a-form-model-item>
+              </template>
+              <template slot="iremark" slot-scope="text, record,index">
+                <a-form-model-item :prop="'itemList.'+index+'.iremark'" :rules="validatorRules.iremark" style="margin-bottom: 0px;">
+                  <a-input v-model="record.iremark" placeholder="请输入点检备注"></a-input>
+                </a-form-model-item>
+              </template>
+            </a-table>
+          </a-col>
+        </a-row>
+      </a-form-model>
+    </j-form-container>
+  </a-spin>
+</template>
+
+<script>
+
+const treeData = [
+  {
+    title: '测试123456',
+    key: '1111111111111',
+    type: '巡检路线',
+    children: [
+      {
+        title: '测试巡检点的修改NO1',
+        key: '12223333333',
+        type: '巡检点',
+        children: [
+          {
+            title: '半自动立钻Z5180C',
+            key: '55555555555',
+            type: '巡检内容',
+            ItemList: [
+              // 巡检项相关信息
+            ]
+          },
+        ],
+      },
+    ],
+  },
+  {
+    title: '测试巡检点的修改NO2',
+    key: '456293324552',
+    type: '巡检点',
+    children: [
+      {
+        title: '半自动立钻Z5180D',
+        key: '1335633666666',
+        type: '巡检内容',
+        ItemList: [
+          // 巡检项相关信息
+        ]
+      },
+    ],
+  },
+];
+
+  import { httpAction, getAction, putAction } from '@/api/manage'
+  import { validateDuplicateValue } from '@/utils/util'
+
+  export default {
+    name: 'InspectForm',
+    components: {
+    },
+    props: {
+      //表单禁用
+      disabled: {
+        type: Boolean,
+        default: false,
+        required: false
+      }
+    },
+    data () {
+      return {
+        model: {
+          itemList: []
+        },
+        labelCol: {
+          xs: { span: 24 },
+          sm: { span: 5 },
+        },
+        wrapperCol: {
+          xs: { span: 24 },
+          sm: { span: 16 },
+        },
+        confirmLoading: false,
+        validatorRules: {
+          result: [
+            { required: true, message: '请输入点检结果!'},
+          ],
+        },
+        url: {
+          add: "/cmmsInspect/cmmsInspect/add",
+          edit: "/cmmsInspect/cmmsInspect/edit",
+          queryById: "/cmmsInspect/cmmsInspect/queryById",
+          queryTreeById: "/cmmsInspect/cmmsInspect/queryTreeById",
+          queryItemByCountId: "/cmmsInspect/cmmsInspect/queryItemByCountId",
+          feedback: "/cmmsInspect/cmmsInspect/feedback",
+        },
+        treeData: [],
+        selectedKeys: [], // (受控)设置选中的树节点
+        replaceFields: {
+          children:'children',
+          title:'title',
+          key:'id'
+        },
+        columns: [
+          // {
+          //   title: '#',
+          //   dataIndex: '',
+          //   key:'rowIndex',
+          //   width:60,
+          //   align:"center",
+          //   customRender:function (t,r,index) {
+          //     return parseInt(index)+1;
+          //   }
+          // },
+          {
+            title:'巡检项编号',
+            align:"center",
+            dataIndex: 'itemcode'
+          },
+          {
+            title:'巡检项名称',
+            align:"center",
+            dataIndex: 'itemname'
+          },
+          {
+            title:'标准',
+            align:"center",
+            dataIndex: 'inspectionstandards',
+          },
+          {
+            title:'巡检结果',
+            align:"center",
+            dataIndex: 'iresult',
+            scopedSlots: { customRender: 'iresult' }
+          },
+          {
+            title:'巡检备注',
+            align:"center",
+            dataIndex: 'iremark',
+            scopedSlots: { customRender: 'iremark' }
+          }
+        ],
+      }
+    },
+    computed: {
+      formDisabled(){
+        return this.disabled
+      },
+    },
+    created () {
+       //备份model原始值
+      this.modelDefault = JSON.parse(JSON.stringify(this.model));
+    },
+    methods: {
+      add () {
+        this.edit(this.modelDefault);
+      },
+      edit (record) {
+        // this.model = Object.assign({}, record);
+        this.visible = true;
+        this.confirmLoading = true
+        // getAction(this.url.queryById, {id: record.id}).then((res) => {
+        //   console.log(res)
+        //   this.model = res.result
+        //   // console.log(res.result.planList)
+        //   var planList = res.result.planList
+        //   var orderData = []
+        //   if(planList.length>0){
+        //     for (let p = 0; p < planList.length; p++) {
+        //       // 巡检路线
+        //       const planItem = planList[p];
+        //       planItem.children = []
+        //       if(planItem.inspectLineVo){
+        //         for (let s = 0; s < planItem.inspectLineVo.detailList.length; s++) {
+        //           // 巡检点
+        //           const spotItem = planItem.inspectLineVo.detailList[s];
+        //           spotItem.children = []
+        //           if(spotItem.inspectContentList){
+        //             for (let i = 0; i < spotItem.inspectContentList.length; i++) {
+        //               const contentItem = spotItem.inspectContentList[i];
+        //               console.log(spotItem, contentItem)
+        //               // 巡检内容数据
+        //               if(contentItem){
+        //                 var contentNode = {
+        //                   key: contentItem.id,
+        //                   title: contentItem.equipmentname,
+        //                   slots: {
+        //                     icon: 'smile',
+        //                   },
+        //                   inspectTcontentItemList: contentItem.inspectTcontentItemList
+        //                 }
+        //                 spotItem.children.push(contentNode)
+        //               }
+        //             }
+        //           }
+        //           // 巡检点数据
+        //           var spotNode = {
+        //             key: spotItem.id,
+        //             title: spotItem.contentname,
+        //             slots: {
+        //               icon: 'smile',
+        //             },
+        //             children: spotItem.children,
+        //           }
+        //           planItem.children.push(spotNode)
+        //         }
+        //         // 路线数据
+        //         var planNode = {
+        //           key: planItem.inspectLineVo.id,
+        //           title: planItem.inspectLineVo.linename,
+        //           slots: {
+        //             icon: planItem.tasktype? 'smile': 'smile',
+        //           },
+        //           children: planItem.children,
+        //         }
+        //         orderData.push(planNode)
+        //       }
+        //     }
+        //   }
+        //   console.log(orderData)
+        //   this.treeData = orderData
+        //   // if(planList.length>0){
+        //   //   planList.map(item => {
+        //   //     var spotList = item.detailList
+        //   //     if(spotList.length > 0){
+        //   //       spotList.map(spot => {
+        //   //         var 
+        //   //         return {
+        //   //           key: item.id,
+        //   //           title: item.linename,
+        //   //           slots: {
+        //   //             icon: 'smile',
+        //   //           },
+        //   //           children: item.inspectLineVo,
+        //   //         }
+        //   //       })
+        //   //     }
+        //   //     return {
+        //   //       key: item.id,
+        //   //       title: item.linename,
+        //   //       slots: {
+        //   //         icon: 'smile',
+        //   //       },
+        //   //       children: item.inspectLineVo,
+        //   //     }
+        //   //   })
+        //   // }
+        //   this.confirmLoading = false
+        // })
+        getAction(this.url.queryTreeById, {id: record.id}).then((res) => {
+          console.log(res)
+          this.model = res.result
+          // this.model.itemList = []
+          this.treeData = res.result.children
+          this.confirmLoading = false
+        })
+      },
+      onSelect(selectedKeys, info) {
+        //  二次点击树节点时selectedKeys为空,直接return中断执行
+        if (selectedKeys.length === 0) return
+        this.selectedKeys = selectedKeys
+        // console.log('selected', selectedKeys, info);
+        // console.log(info.selectedNodes[0].data.props.inspectTcontentItemList)
+        var props = info.selectedNodes[0].data.props
+        if(props.type === '巡检内容'){
+          this.model.itemList = props.inspectTcontentItemList
+          this.$forceUpdate()
+          // this.getItemList(props.id)
+        }
+      },
+      getItemList(id){
+        getAction(this.url.queryItemByCountId, {countId: id, inspectId: this.model.id}).then((res) => {
+          console.log(res)
+          this.model.itemList = res.result
+          console.log(this.model)
+          this.$forceUpdate()
+        })
+      },
+      handleFeedback(){
+        console.log(this.model.itemList)
+        this.confirmLoading = true
+        putAction(this.url.feedback, this.model.itemList).then((res) => {
+          if(res.success){
+            this.$message.success(res.message);
+            this.edit(this.model)
+          }else{
+            this.$message.warning(res.message);
+          }
+        }).finally(() => {
+          this.confirmLoading = false;
+        })
+      },
+      submitForm () {
+        const that = this;
+        // 触发表单验证
+        this.$refs.form.validate(valid => {
+          if (valid) {
+            that.confirmLoading = true;
+            let httpurl = '';
+            let method = '';
+            if(!this.model.id){
+              httpurl+=this.url.add;
+              method = 'post';
+            }else{
+              httpurl+=this.url.edit;
+               method = 'put';
+            }
+            httpAction(httpurl,this.model,method).then((res)=>{
+              if(res.success){
+                that.$message.success(res.message);
+                that.$emit('ok');
+              }else{
+                that.$message.warning(res.message);
+              }
+            }).finally(() => {
+              that.confirmLoading = false;
+            })
+          }
+         
+        })
+      },
+    }
+  }
+</script>
+<style lang="less" scoped>
+  .inspect-order-layout{
+    height: calc(100vh - 150px);
+    overflow: hidden;
+    .inspect-tree{
+      height: calc(100vh - 150px);
+      overflow: auto;
+    }
+    .itemList-table{
+      height: calc(100vh - 150px);
+      overflow: auto;
+    }
+  }
+</style>

+ 84 - 0
src/views/module_cmms/inspect/modules/InspectModal.Style#Drawer.vue

@@ -0,0 +1,84 @@
+<template>
+  <a-drawer
+    :title="title"
+    :width="width"
+    placement="right"
+    :closable="false"
+    @close="close"
+    destroyOnClose
+    :visible="visible">
+    <inspect-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></inspect-form>
+    <div class="drawer-footer">
+      <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
+      <a-button v-if="!disableSubmit"  @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
+    </div>
+  </a-drawer>
+</template>
+
+<script>
+
+  import InspectForm from './InspectForm'
+
+  export default {
+    name: 'InspectModal',
+    components: {
+      InspectForm
+    },
+    data () {
+      return {
+        title:"操作",
+        width:800,
+        visible: false,
+        disableSubmit: false
+      }
+    },
+    methods: {
+      add () {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.add();
+        })
+      },
+      edit (record) {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.edit(record);
+        });
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+      },
+      submitCallback(){
+        this.$emit('ok');
+        this.visible = false;
+      },
+      handleOk () {
+        this.$refs.realForm.submitForm();
+      },
+      handleCancel () {
+        this.close()
+      }
+    }
+  }
+</script>
+
+<style lang="less" scoped>
+/** Button按钮间距 */
+  .ant-btn {
+    margin-left: 30px;
+    margin-bottom: 30px;
+    float: right;
+  }
+  .drawer-footer{
+    position: absolute;
+    bottom: -8px;
+    width: 100%;
+    border-top: 1px solid #e8e8e8;
+    padding: 10px 16px;
+    text-align: right;
+    left: 0;
+    background: #fff;
+    border-radius: 0 0 2px 2px;
+  }
+</style>

+ 57 - 0
src/views/module_cmms/inspect/modules/InspectModal.vue

@@ -0,0 +1,57 @@
+<template>
+  <u-modal
+    :title="title"
+    :visible.sync="visible"
+    contentFull
+    @ok="handleOk"
+    @cancel="handleCancel">
+    <inspect-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></inspect-form>
+  </u-modal>
+</template>
+
+<script>
+
+  import InspectForm from './InspectForm'
+  export default {
+    name: 'InspectModal',
+    components: {
+      InspectForm
+    },
+    data () {
+      return {
+        title:'',
+        width:800,
+        visible: false,
+        disableSubmit: false
+      }
+    },
+    methods: {
+      add () {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.add();
+        })
+      },
+      edit (record) {
+        this.visible=true
+        this.$nextTick(()=>{
+          this.$refs.realForm.edit(record);
+        })
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+      },
+      handleOk () {
+        this.$refs.realForm.submitForm();
+      },
+      submitCallback(){
+        this.$emit('ok');
+        this.visible = false;
+      },
+      handleCancel () {
+        this.close()
+      }
+    }
+  }
+</script>

+ 16 - 1
src/views/module_cmms/inspectLine/modules/InspectLineForm.vue

@@ -2,6 +2,7 @@
   <a-spin :spinning="confirmLoading">
     <j-form-container :disabled="formDisabled">
       <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
+        <div class="cmms-dialog-item-title">巡检路线基本信息</div>
         <a-row>
           <a-col :span="24">
             <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
@@ -19,7 +20,12 @@
             </a-form-model-item>
           </a-col>
         </a-row>
+        <div class="cmms-dialog-item-title u-flex-jab">
+          <div>巡检项目设置</div>
+          <div @click="addInspectContent"><a-icon type="plus"/>巡检项目</div>
+        </div>
       </a-form-model>
+      <inspect-line-modal-add ref="addSpotRef" :equipmentId="model.equipmentid" :selectData="model.cmmsInspectSpotItemList" @ok="handleOk"></inspect-line-modal-add>
     </j-form-container>
   </a-spin>
 </template>
@@ -28,10 +34,12 @@
 
   import { httpAction, getAction } from '@/api/manage'
   import { validateDuplicateValue } from '@/utils/util'
+  import InspectLineModalAdd from './InspectLineModalAdd.vue'
 
   export default {
     name: 'InspectLineForm',
     components: {
+      InspectLineModalAdd,
     },
     props: {
       //表单禁用
@@ -76,6 +84,10 @@
       add () {
         this.edit(this.modelDefault);
       },
+      addInspectContent(){
+        this.$refs.addSpotRef.add();
+        this.$refs.addSpotRef.title = "选择巡检点";
+      },
       edit (record) {
         this.model = Object.assign({}, record);
         this.visible = true;
@@ -111,4 +123,7 @@
       },
     }
   }
-</script>
+</script>
+<style scoped>
+  @import '~@/assets/less/uStyle.less';
+</style>

+ 4 - 8
src/views/module_cmms/inspectLine/modules/InspectLineModal.vue

@@ -1,15 +1,11 @@
 <template>
-  <j-modal
+  <u-modal
     :title="title"
-    :width="width"
-    :visible="visible"
-    switchFullscreen
+    :visible.sync="visible"
     @ok="handleOk"
-    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
-    @cancel="handleCancel"
-    cancelText="关闭">
+    @cancel="handleCancel">
     <inspect-line-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></inspect-line-form>
-  </j-modal>
+  </u-modal>
 </template>
 
 <script>

+ 150 - 0
src/views/module_cmms/inspectLine/modules/InspectLineModalAdd.vue

@@ -0,0 +1,150 @@
+<template>
+  <j-modal
+  :title="title"
+  :width="width"
+  :visible="visible"
+  @ok="handleOk"
+  @cancel="handleCancel"
+  cancelText="关闭">
+    <a-table
+      ref="table"
+      size="middle"
+      :scroll="{x:true}"
+      bordered
+      rowKey="id"
+      :columns="columns"
+      :dataSource="dataSource"
+      :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
+      :pagination="false"
+      class="j-table-force-nowrap">
+    </a-table>
+  </j-modal>
+</template>
+
+<script>
+  import { httpAction, getAction } from '@/api/manage'
+  
+  export default {
+    name: 'InspectLineModalAdd',
+    components: {
+        
+    },
+    props: {
+      //表单禁用
+      equipmentId: {
+        type: String,
+        default: ''
+      },
+      selectData: {
+        type: Array,
+        default: function(){
+          return [] // 使用工厂函数返回默认值
+        }
+      },
+    },
+    data () {
+      return {
+        title:'',
+        width: 1000,
+        visible: false,
+        type: '',
+        /* table选中keys*/
+        selectedRowKeys: [],
+        /* table选中records*/
+        selectionRows: [],
+        columns: [
+          // {
+          //   title: '',
+          //   dataIndex: '',
+          //   key:'rowIndex',
+          //   width:60,
+          //   align:"center",
+          //   customRender:function (t,r,index) {
+          //     return parseInt(index)+1;
+          //   }
+          // },
+          {
+            title:'巡检项ID',
+            align:"center",
+            dataIndex: 'id'
+          },
+          {
+            title:'巡检项编号',
+            align:"center",
+            dataIndex: 'itemcode'
+          },
+          {
+            title:'巡检项名称',
+            align:"center",
+            dataIndex: 'itemname'
+          },
+          {
+            title:'标准',
+            align:"center",
+            dataIndex: 'inspectionstandards',
+          },
+          {
+            title:'备注',
+            align:"center",
+            dataIndex: 'remark'
+          }
+        ],
+        dataSource: [],
+        url: {
+          getList: "/cmmsInspectItem/cmmsInspectItem/getItemByEqId",
+          itemList: "/cmmsInspectItem/cmmsInspectItem/list",
+        },
+      }
+    },
+    methods: {
+      add () {
+        this.visible = true;
+        if(this.type === '1'){
+          getAction(this.url.getList, {eqid: this.equipmentId}).then((res) => {
+            this.dataSource = res.result
+          })
+        } else {
+          getAction(this.url.itemList, {classification: this.type}).then((res) => {
+            this.dataSource = res.result.records
+          })
+        }
+        this.selectList()
+      },
+      // 将以选中的值重新在列表中选中
+      selectList() {
+        this.selectionRows = this.selectData
+        console.log(this.selectData)
+        this.selectedRowKeys = this.selectData.map((res) => {
+          return res.id
+        })
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+        this.onClearSelected()
+        this.selectionRows = this.selectData
+        this.selectedRowKeys = this.selectData.map((res) => {
+          return res.id
+        })
+        this.dataSource = []
+      },
+      handleOk () {
+        console.log(this.selectionRows)
+        this.$emit('ok', this.selectionRows);
+        this.visible = false;
+      },
+      handleCancel () {
+        this.close()
+      },
+      onSelectChange(selectedRowKeys, selectionRows) {
+        this.selectedRowKeys = selectedRowKeys;
+        this.selectionRows = selectionRows;
+        console.log(this.selectedRowKeys,this.selectionRows)
+      },
+      onClearSelected() {
+        this.selectedRowKeys = [];
+        this.selectionRows = [];
+      },
+    }
+  }
+</script>

+ 6 - 6
src/views/module_cmms/inspectPlan/InspectPlanList.vue

@@ -112,7 +112,7 @@
         // 表头
         columns: [
           {
-            title: '#',
+            title: '序号',
             dataIndex: '',
             key:'rowIndex',
             width:60,
@@ -122,11 +122,6 @@
             }
           },
           {
-            title:'备注',
-            align:"center",
-            dataIndex: 'remark'
-          },
-          {
             title:'巡检计划编号',
             align:"center",
             dataIndex: 'plancode'
@@ -206,6 +201,11 @@
             dataIndex: 'ifnotice'
           },
           {
+            title:'备注',
+            align:"center",
+            dataIndex: 'remark'
+          },
+          {
             title: '操作',
             dataIndex: 'action',
             align:"center",

src/views/module_cmms/inspectPlan/modules/InspectPlanForm.vue → src/views/module_cmms/inspectPlan/modules/InspectPlanFormList.vue


+ 174 - 0
src/views/module_cmms/inspectPlan/modules/InspectPlanFormSet.vue

@@ -0,0 +1,174 @@
+<template>
+  <a-spin :spinning="confirmLoading">
+    <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="remark">
+              <a-input v-model="model.remark" placeholder="请输入备注"  ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="巡检计划编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="plancode">
+              <a-input v-model="model.plancode" placeholder="请输入巡检计划编号"  ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="巡检计划名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="planname">
+              <a-input v-model="model.planname" placeholder="请输入巡检计划名称"  ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="是否开启时间设置:Y是、N否" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="iftimeset">
+              <a-input v-model="model.iftimeset" placeholder="请输入是否开启时间设置:Y是、N否"  ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="开始时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="begintime">
+              <j-date placeholder="请选择开始时间" v-model="model.begintime"  style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="重复" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repeatnum">
+              <a-input-number v-model="model.repeatnum" placeholder="请输入重复" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="重复类型:年、月、周、日、时、分" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repeattype">
+              <a-input v-model="model.repeattype" placeholder="请输入重复类型:年、月、周、日、时、分"  ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="提前通知时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="noticenum">
+              <a-input-number v-model="model.noticenum" placeholder="请输入提前通知时间" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="提前通知类型:天、时、分" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="noticetype">
+              <a-input v-model="model.noticetype" placeholder="请输入提前通知类型:天、时、分"  ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="状态(0启用 1停用)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status">
+              <a-input v-model="model.status" placeholder="请输入状态(0启用 1停用)"  ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="待办人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="chargeruser">
+              <a-input v-model="model.chargeruser" placeholder="请输入待办人"  ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="下次执行时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="nexttime">
+              <j-date placeholder="请选择下次执行时间" v-model="model.nexttime"  style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="任务数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tasknum">
+              <a-input-number v-model="model.tasknum" placeholder="请输入任务数量" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="下次通知时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="noticetime">
+              <j-date placeholder="请选择下次通知时间" v-model="model.noticetime"  style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="是否已通知:是/否" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ifnotice">
+              <a-input v-model="model.ifnotice" placeholder="请输入是否已通知:是/否"  ></a-input>
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+      </a-form-model>
+    </j-form-container>
+  </a-spin>
+</template>
+
+<script>
+
+  import { httpAction, getAction } from '@/api/manage'
+  import { validateDuplicateValue } from '@/utils/util'
+
+  export default {
+    name: 'InspectPlanForm',
+    components: {
+    },
+    props: {
+      //表单禁用
+      disabled: {
+        type: Boolean,
+        default: false,
+        required: false
+      }
+    },
+    data () {
+      return {
+        model:{
+         },
+        labelCol: {
+          xs: { span: 24 },
+          sm: { span: 5 },
+        },
+        wrapperCol: {
+          xs: { span: 24 },
+          sm: { span: 16 },
+        },
+        confirmLoading: false,
+        validatorRules: {
+        },
+        url: {
+          add: "/cmmsInspectPlan/cmmsInspectPlan/add",
+          edit: "/cmmsInspectPlan/cmmsInspectPlan/edit",
+          queryById: "/cmmsInspectPlan/cmmsInspectPlan/queryById"
+        }
+      }
+    },
+    computed: {
+      formDisabled(){
+        return this.disabled
+      },
+    },
+    created () {
+       //备份model原始值
+      this.modelDefault = JSON.parse(JSON.stringify(this.model));
+    },
+    methods: {
+      add () {
+        this.edit(this.modelDefault);
+      },
+      edit (record) {
+        this.model = Object.assign({}, record);
+        this.visible = true;
+      },
+      submitForm () {
+        const that = this;
+        // 触发表单验证
+        this.$refs.form.validate(valid => {
+          if (valid) {
+            that.confirmLoading = true;
+            let httpurl = '';
+            let method = '';
+            if(!this.model.id){
+              httpurl+=this.url.add;
+              method = 'post';
+            }else{
+              httpurl+=this.url.edit;
+               method = 'put';
+            }
+            httpAction(httpurl,this.model,method).then((res)=>{
+              if(res.success){
+                that.$message.success(res.message);
+                that.$emit('ok');
+              }else{
+                that.$message.warning(res.message);
+              }
+            }).finally(() => {
+              that.confirmLoading = false;
+            })
+          }
+         
+        })
+      },
+    }
+  }
+</script>

+ 3 - 3
src/views/module_cmms/inspectPlan/modules/InspectPlanModal.Style#Drawer.vue

@@ -7,7 +7,7 @@
     @close="close"
     destroyOnClose
     :visible="visible">
-    <inspect-plan-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></inspect-plan-form>
+    <inspect-plan-form-set ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></inspect-plan-form-set>
     <div class="drawer-footer">
       <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
       <a-button v-if="!disableSubmit"  @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
@@ -17,12 +17,12 @@
 
 <script>
 
-  import InspectPlanForm from './InspectPlanForm'
+  import InspectPlanFormSet from './InspectPlanFormSet'
 
   export default {
     name: 'InspectPlanModal',
     components: {
-      InspectPlanForm
+      InspectPlanFormSet
     },
     data () {
       return {

+ 39 - 13
src/views/module_cmms/inspectPlan/modules/InspectPlanModal.vue

@@ -1,34 +1,46 @@
 <template>
-  <j-modal
+  <u-modal
     :title="title"
-    :width="width"
-    :visible="visible"
-    switchFullscreen
+    :visible.sync="visible"
+    contentFull
     @ok="handleOk"
-    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
-    @cancel="handleCancel"
-    cancelText="关闭">
-    <inspect-plan-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></inspect-plan-form>
-  </j-modal>
+    @cancel="handleCancel">
+    <template slot="centerContent">
+      <div class="tabs">
+        <span v-for="(item, index) in tabs" :key="index" @click="handleTab(item.key)" class="item" :class="item.key === chooseTab ? 'choose':''">{{ item.name }}</span>
+      </div>
+    </template>
+    <inspect-plan-form-set v-if="chooseTab==='set'" ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></inspect-plan-form-set>
+    <div v-if="chooseTab==='list'" ></div>
+  </u-modal>
 </template>
 
 <script>
 
-  import InspectPlanForm from './InspectPlanForm'
+  import InspectPlanFormSet from './InspectPlanFormSet'
   export default {
     name: 'InspectPlanModal',
     components: {
-      InspectPlanForm
+      InspectPlanFormSet
     },
     data () {
       return {
         title:'',
         width:800,
         visible: false,
-        disableSubmit: false
+        disableSubmit: false,
+        tabs: [
+          { name: '计划设置', key: 'set' },
+          { name: '计划内容', key: 'list' },
+        ],
+        chooseTab: 'set'
       }
     },
     methods: {
+      handleTab(key){
+        console.log(key)
+        this.chooseTab = key
+      },
       add () {
         this.visible=true
         this.$nextTick(()=>{
@@ -57,4 +69,18 @@
       }
     }
   }
-</script>
+</script>
+<style lang="less" scoped>
+  .tabs{
+    .item{
+      font-size: 15px;
+      cursor: pointer;
+    }
+    .item:first-child{
+      margin-right: 16px;
+    }
+    .choose{
+      color: #1890FF;
+    }
+  }
+</style>