xiongchao 4 years ago
parent
commit
549aef7854

+ 54 - 30
src/views/check/checkstandard/modules/BaseForm.vue

@@ -11,6 +11,7 @@
       <a-form-item v-show="false">
         <a-input v-decorator="['id']" type="hidden"/>
         <a-input v-decorator="['sbId']" type="hidden"/>
+        <a-input v-decorator="['part']" type="hidden"/>
       </a-form-item>
 
       <row-list :col="2">
@@ -27,7 +28,7 @@
         </row-item>
         <row-item>
           <a-form-item
-            label="标准名称"
+            label="任务名称"
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
@@ -37,35 +38,29 @@
         </row-item>
         <row-item>
           <a-form-item
-            label="执行人"
+            label="检查部位"
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
-            <a-select v-decorator="['checkUserId']" placeholder="请选择">
-              <a-select-option
-                v-for="({userId, realName}) in userList"
-                :key="userId"
-                :label="realName"
-                :value="userId">{{ realName }}
-              </a-select-option>
-            </a-select>
+            <a-input
+              disabled
+              style="width: 80%"
+              v-decorator="['partName', {rules: [{required: false, message: '检查部位不能为空'}]}]"/>
+            <a-button type="primary" style="width: 20%" @click="handlePartSelect">选择</a-button>
           </a-form-item>
         </row-item>
         <row-item>
           <a-form-item
-            label="检查类型"
+            label="执行人"
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
-            <a-select
-              disabled
-              v-decorator="['type', {initialValue:checkType,rules: [{required: true, message: '检查类型不能为空'}]}]"
-              placeholder="请选择">
+            <a-select v-decorator="['checkUserId']" placeholder="请选择">
               <a-select-option
-                v-for="(label,value) in typeMap"
-                :key="value"
-                :label="label"
-                :value="parseInt(value)">{{ label }}
+                v-for="({userId, realName}) in userList"
+                :key="userId"
+                :label="realName"
+                :value="userId">{{ realName }}
               </a-select-option>
             </a-select>
           </a-form-item>
@@ -77,10 +72,6 @@
             :wrapperCol="BaseTool.Constant.wrapperCol"
             style="margin-bottom:0;"
           >
-            <!-- 解决校验问题 -->
-            <a-input-number
-              v-show="false"
-              v-decorator="['require1', {initialValue: 111, rules: [{required: true}]}]" />
             <a-form-item :style="{ display: 'inline-block', width: '70%' }">
               <a-input-number
                 style="width: 100%"
@@ -123,15 +114,18 @@
         </row-item>
         <row-item>
           <a-form-item
-            label="是否启用"
+            label="检查类型"
             :labelCol="BaseTool.Constant.labelCol"
+            v-show="false"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
             <a-select
-              v-decorator="['enable', {initialValue:1,rules: [{required: true, message: '是否启用不能为空'}]}]"
+              disabled
+              v-show="false"
+              v-decorator="['type', {initialValue:checkType,rules: [{required: true, message: '检查类型不能为空'}]}]"
               placeholder="请选择">
               <a-select-option
-                v-for="(label,value) in enableMap"
+                v-for="(label,value) in typeMap"
                 :key="value"
                 :label="label"
                 :value="parseInt(value)">{{ label }}
@@ -141,14 +135,25 @@
         </row-item>
         <row-item>
           <a-form-item
-            label="检查部位"
+            v-show="false"
+            label="是否启用"
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
-            <a-input
-              v-decorator="['part']"/>
+            <a-select
+              v-show="false"
+              v-decorator="['enable', {initialValue:1,rules: [{required: true, message: '是否启用不能为空'}]}]"
+              placeholder="请选择">
+              <a-select-option
+                v-for="(label,value) in enableMap"
+                :key="value"
+                :label="label"
+                :value="parseInt(value)">{{ label }}
+              </a-select-option>
+            </a-select>
           </a-form-item>
         </row-item>
+
       </row-list>
       <row-list :col="1">
         <row-item>
@@ -341,6 +346,7 @@
     <template slot="footer">
       <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
     </template>
+    <part-info-select-modal ref="partInfoSelectModal" @selected="handlePartSelected"/>
   </a-modal>
 </template>
 
@@ -350,12 +356,14 @@ import { STable, Ellipsis } from '@/components'
 import { addCheckStandard, updateCheckStandard } from '@/api/check/checkstandard'
 import BaseTool from '../../../../utils/tool'
 import { queryUser } from '@/api/upms/user'
+import PartInfoSelectModal from '@/views/part/info/modules/PartInfoSelectModal'
 
 export default {
   name: 'BaseCheckStandard',
   components: {
     STable,
-    Ellipsis
+    Ellipsis,
+    PartInfoSelectModal
   },
   data () {
     return {
@@ -492,6 +500,7 @@ export default {
           'type',
           'period',
           'part',
+          'partName',
           'checkUserId',
           'periodType',
           'actionType',
@@ -634,6 +643,21 @@ export default {
       this.editingKey = newParam.id
       console.log(newParam, 'newparam')
       return newParam
+    },
+    handlePartSelect () {
+      const sbId = this.form.getFieldValue('sbId')
+      this.$refs.partInfoSelectModal.base({ sbId })
+    },
+    handlePartSelected (keys, rows) {
+      const [ key ] = keys
+      const [ row ] = rows
+      const { form: { setFieldsValue } } = this
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign({
+          'part': key,
+          'partName': row.name
+        }))
+      })
     }
   }
 }

+ 8 - 11
src/views/check/checkstandard/modules/DetailSbCheck.vue

@@ -7,7 +7,7 @@
         </span>
       </a-col>
     </a-row>
-    <title-divider title="型号信息" width="90px"></title-divider>
+    <title-divider title="设备信息" width="90px"></title-divider>
     <detail-list title="" :col="3">
       <detail-list-item term="设备新号">{{ model.no }}</detail-list-item>
       <detail-list-item term="设备旧号">{{ model.zbh }}</detail-list-item>
@@ -107,7 +107,7 @@ export default {
         },
         {
           title: '检查部位',
-          dataIndex: 'part'
+          dataIndex: 'partName'
         },
         {
           title: '周期',
@@ -160,17 +160,14 @@ export default {
       modal.base(null, this.model.id)
     },
     handleEdit (record) {
-      fetchCheckStandard({ id: record.id }).then(res => {
-        const modal = this.$refs.baseModal
-        modal.base(res.data)
-      })
+      const modal = this.$refs.baseModal
+      modal.base(record)
     },
     handleCopy (record) {
-      fetchCheckStandard({ id: record.id }).then(res => {
-        const modal = this.$refs.baseModal
-        res.data.id = null
-        modal.base(res.data)
-      })
+      const modal = this.$refs.baseModal
+      const data = record
+      data.id = null
+      modal.base(data)
     },
     handleCancel () {
       this.visible = false

+ 21 - 113
src/views/part/info/modules/BaseForm.vue

@@ -11,6 +11,7 @@
 
       <a-form-item v-show="false" >
         <a-input v-decorator="['id']" type="hidden"/>
+        <a-input v-decorator="['sbId']" type="hidden"/>
       </a-form-item>
 
       <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
@@ -72,29 +73,6 @@
           </a-form-item>
         </a-col>
       </a-row>
-
-        <a-col :lg="12" :md="24" :sm="24">
-          <a-form-item
-            label="所属设备"
-            :labelCol="BaseTool.Constant.labelCol"
-            :wrapperCol="BaseTool.Constant.wrapperCol"
-          >
-            <a-tree-select
-              allowClear
-              :disabled="type === 2"
-              style="width: 100%"
-              :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
-              :treeData="sbInfoTreeData"
-              :treeNodeFilterProp="'title'"
-              :showSearch="true"
-              v-decorator="['sbId', {rules: [{required: false, message: '所属设备不能为空'}]}]"
-              placeholder="请选择"
-            >
-            </a-tree-select>
-          </a-form-item>
-        </a-col>
-      </a-row>
-
       <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
         <a-col :lg="12" :md="24" :sm="24">
           <a-form-item
@@ -106,31 +84,23 @@
               v-decorator="['remark', {rules: [{required: false, message: '备注不能为空'}]}]" />
           </a-form-item>
         </a-col>
-      </a-row></a-form>
+      </a-row>
+    </a-form>
     <template slot="footer">
       <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
     </template>
-    <firm-producer-select-modal ref="producerSelectModal" @selected="handleProducerSelected"/>
-    <sb-guige-select-modal ref="guigeSelectModal" @selected="handleGuigeSelected"/>
   </a-modal>
 </template>
 
 <script>
 import pick from 'lodash.pick'
 import { addPartInfo, updatePartInfo } from '@/api/part/info'
-import { getSbInfoTree } from '@/api/sb/info'
 import { fetchPartTypeTree } from '@/api/part/type'
-import { fetchProducerOptions } from '@/api/firm/producer'
-import { fetchSbGuigeOptions } from '@/api/sb/guige'
-import FirmProducerSelectModal from '@/views/firm/producer/modules/FirmProducerSelectModal'
-import SbGuigeSelectModal from '@/views/sb/guige/modules/SbGuigeSelectModal'
 import BaseTool from '../../../../utils/tool'
 
 export default {
   name: 'BasePartInfo',
   components: {
-    FirmProducerSelectModal,
-    SbGuigeSelectModal
   },
   data () {
     return {
@@ -140,54 +110,47 @@ export default {
       visible: false,
       type: 1,
       sbTypeTreeData: [],
-      sbInfoTreeData: [],
       producers: [],
       statusMap: {},
       unitMap: {},
       levelMap: {},
       sourceTypeMap: {},
-      guiges: []
+      guiges: [],
+      sbId: null
     }
   },
   props: {
   },
   created () {
     this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PART_STATUS)
-    this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
     this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PART_LEVEL)
-    this.sourceTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBTYPE_SOURCETYPE)
     this.setOptions()
     this.setTree()
   },
   methods: {
     base (record, type) {
       this.visible = true
+      // 1新增,2复制
       this.type = type == null ? 1 : 2
       const { form: { setFieldsValue } } = this
-
+      this.sbId = record.sbId
       // 如果是空标识添加
-      if (this.BaseTool.Object.isNotBlank(record) && this.BaseTool.Object.isBlank(record.id) &&
-        this.BaseTool.Object.isNotBlank(record.sbId)) {
-        this.$nextTick(() => {
-          setFieldsValue(Object.assign(pick(record, [
-            'sbId'
-          ])))
-        })
-      }
-      if (this.BaseTool.Object.isBlank(record) || this.BaseTool.Object.isBlank(record.id)) {
-        this.modalTitle = '添加'
-        return
-      }
-      this.modalTitle = '编辑'
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign(pick(record, [
+          'sbId'
+        ])))
+      })
       if (this.BaseTool.Object.isBlank(record.id)) {
-        this.modalTitle = '复制'
+        if (type === 1) {
+          this.modalTitle = '添加'
+          return
+        } else {
+          this.modalTitle = '复制'
+        }
+      }
+      if (this.BaseTool.Object.isNotBlank(record.id)) {
+        this.modalTitle = '修改'
       }
-      // 日期处理
-      record.buyDate = BaseTool.Moment(record.buyDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
-      record.startDate = BaseTool.Moment(record.startDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
-      record.nextCheckDate = BaseTool.Moment(record.nextCheckDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
-      record.guaranteeDate = BaseTool.Moment(record.guaranteeDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
-      record.retirementDate = BaseTool.Moment(record.retirementDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
       this.$nextTick(() => {
         setFieldsValue(Object.assign(pick(record, [
           'id',
@@ -195,21 +158,8 @@ export default {
           'name',
           'typeId',
           'level',
-          'producerId',
-          'producerName',
-          'guigeName',
-          'sourceType',
-          'sourceSbId',
           'sbId',
           'unit',
-          'guigeId',
-          'buyDate',
-          'startDate',
-          'nextCheckDate',
-          'guaranteeDate',
-          'workYear',
-          'retirementDate',
-          'sbImage',
           'status',
           'remark'
         ])))
@@ -223,12 +173,6 @@ export default {
           this.confirmLoading = false
           return
         }
-        // 日期数据的处理
-        values.buyDate = BaseTool.Date.formatter(values.buyDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
-        values.startDate = BaseTool.Date.formatter(values.startDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
-        values.nextCheckDate = BaseTool.Date.formatter(values.nextCheckDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
-        values.guaranteeDate = BaseTool.Date.formatter(values.guaranteeDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
-        values.retirementDate = BaseTool.Date.formatter(values.retirementDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
         if (this.BaseTool.String.isBlank(values.id)) {
           addPartInfo(values)
             .then(() => {
@@ -258,45 +202,9 @@ export default {
       fetchPartTypeTree().then(res => {
         this.sbTypeTreeData = res.data
       })
-      getSbInfoTree().then(res => {
-        this.sbInfoTreeData = res.data
-      })
     },
     setOptions () {
-      fetchProducerOptions().then(res => {
-        this.producers = res.data
-      })
-      fetchSbGuigeOptions().then(res => {
-        this.guiges = res.data
-      })
-    },
-    handleProducerSelect () {
-      const modal = this.$refs.producerSelectModal
-      modal.base()
-    },
-    handleProducerSelected (record, selectedRowKeys, selectedRow) {
-      const { form: { setFieldsValue } } = this
-      const [ key ] = selectedRowKeys
-      const [ row ] = selectedRow
-      setFieldsValue({
-        'producerId': key,
-        'producerName': row.name
-      })
-    },
-    handleGuigeSelect () {
-      const modal = this.$refs.guigeSelectModal
-      modal.base()
-    },
-    handleGuigeSelected (record, selectedRowKeys, selectedRow) {
-      const { form: { setFieldsValue } } = this
-      const [ key ] = selectedRowKeys
-      const [ row ] = selectedRow
-      setFieldsValue({
-        'guigeId': key,
-        'guigeName': row.name
-      })
     }
-
   }
 }
 </script>

+ 4 - 103
src/views/part/info/modules/PartInfoList.vue

@@ -28,7 +28,7 @@
       </div>
 
       <div class="table-operator">
-        <a-button v-if="$auth('sb-part-infos-add')" type="primary" icon="plus" @click="$refs.baseModal.base(dataParam,2)">新增</a-button>
+        <a-button v-if="$auth('sb-part-infos-add')" type="primary" icon="plus" @click="$refs.baseModal.base(dataParam,1)">新增</a-button>
         <a-button style="margin-left: 8px" v-if="$auth('sb-part-infos-export')" type="primary" icon="download" @click="doExport">导出</a-button>
         <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('sb-part-infos-del')">
           <a-menu slot="overlay">
@@ -106,9 +106,7 @@ export default {
       visible: false,
       dataParam: {},
       statusMap: {},
-      unitMap: {},
       levelMap: {},
-      sourceTypeMap: {},
       // 表头
       columns: [
         {
@@ -119,12 +117,6 @@ export default {
             return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
           }
         },
-        {
-          title: '部件编号',
-          checked: true,
-          dataIndex: 'no',
-          width: 200
-        },
         {
           title: '部件名称',
           dataIndex: 'name',
@@ -148,89 +140,6 @@ export default {
             return this.BaseTool.Object.getField(this.levelMap, text)
           }
         },
-        {
-          title: '生产商',
-          dataIndex: 'producerId',
-          width: 300,
-          customRender: (text, record, index) => {
-            return record.producerName
-          }
-        },
-        {
-          title: '设备来源方式',
-          dataIndex: 'sourceType',
-          width: 300,
-          customRender: (text, record, index) => {
-            return this.BaseTool.Object.getField(this.sourceTypeMap, text)
-          }
-        },
-        {
-          title: '来源设备',
-          dataIndex: 'sourceSbId',
-          width: 300,
-          customRender: (text, record, index) => {
-            return record.sourceSbName
-          }
-        },
-        {
-          title: '所属设备',
-          dataIndex: 'sbId',
-          width: 300,
-          customRender: (text, record, index) => {
-            return record.sbName
-          }
-        },
-        {
-          title: '计量单位',
-          dataIndex: 'unit',
-          width: 300,
-          customRender: (text, record, index) => {
-            return this.BaseTool.Object.getField(this.unitMap, text)
-          }
-        },
-        {
-          title: '规格型号',
-          dataIndex: 'guigeId',
-          width: 300,
-          customRender: (text, record, index) => {
-            return record.guigeName
-          }
-        },
-        {
-          title: '购置日期',
-          dataIndex: 'buyDate',
-          width: 300
-        },
-        {
-          title: '投用日期',
-          dataIndex: 'startDate',
-          width: 300
-        },
-        {
-          title: '下次检定日期',
-          dataIndex: 'nextCheckDate',
-          width: 300
-        },
-        {
-          title: '保修截至日期',
-          dataIndex: 'guaranteeDate',
-          width: 300
-        },
-        {
-          title: '预计工作年限',
-          dataIndex: 'workYear',
-          width: 300
-        },
-        {
-          title: '预计报废日期',
-          dataIndex: 'retirementDate',
-          width: 300
-        },
-        {
-          title: '设备图片',
-          dataIndex: 'sbImage',
-          width: 300
-        },
         {
           title: '备注',
           dataIndex: 'remark',
@@ -241,13 +150,6 @@ export default {
           dataIndex: 'createdTime',
           width: 300
         },
-        {
-          title: '状态',
-          checked: true,
-          dataIndex: 'status',
-          width: 100,
-          scopedSlots: { customRender: 'status' }
-        },
         {
           title: '操作',
           key: 'action',
@@ -275,7 +177,7 @@ export default {
       },
       selectedRowKeys: [],
       selectedRows: [],
-
+      sbId: null,
       options: {
         alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
         rowSelection: {
@@ -289,9 +191,7 @@ export default {
   },
   created () {
     this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PART_STATUS)
-    this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
     this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PART_LEVEL)
-    this.sourceTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBTYPE_SOURCETYPE)
   },
   methods: {
     tableOption () {
@@ -322,6 +222,7 @@ export default {
       this.visible = true
       this.modalTitle = '部件列表'
       this.queryParam = queryParam
+      this.sbId = queryParam.sbId
       this.dataParam = dataParam
       if (this.isCreated) {
         this.$refs.table.clearSelected()
@@ -353,7 +254,7 @@ export default {
     handleEdit (record) {
       fetchPartInfo({ id: record.id }).then(res => {
         const modal = this.$refs.baseModal
-        modal.base(res.data, 2)
+        modal.base(res.data)
       })
     },
     handleView (record) {

+ 0 - 14
src/views/part/info/modules/PartInfoSelectModal.vue

@@ -148,20 +148,6 @@ export default {
             return record.sbName
           }
         },
-        {
-          title: '规格型号',
-          dataIndex: 'guigeId',
-          width: 300,
-          customRender: (text, record, index) => {
-            return record.guigeName
-          }
-        },
-        {
-          title: '状态',
-          dataIndex: 'status',
-          width: 300,
-          scopedSlots: { customRender: 'status' }
-        },
         {
           title: '操作',
           key: 'action',

+ 9 - 1
src/views/sb/info/modules/Detail.vue

@@ -6,6 +6,7 @@
           <span class="table-page-search-submitButtons" style="float: right">
             <a-button style="margin-left: 8px" type="primary" @click="handleViewBom()">备件BOM</a-button>
             <a-button style="margin-left: 8px" type="primary" @click="handleViewCheck()">保养项目</a-button>
+            <a-button style="margin-left: 8px" type="primary" @click="partInfoListView()">设备部位</a-button>
             <a-button style="margin-left: 8px" @click="handleCancel()">返回</a-button>
           </span>
         </a-col>
@@ -103,6 +104,7 @@
     </div>
     <detail-sb-bom ref="detailSbBomModal" @ok="handleOk"/>
     <detail-sb-check ref="detailSbCheckModal" @ok="handleOk"/>
+    <part-info-list ref="partInfoList" />
   </a-card>
 </template>
 
@@ -117,6 +119,7 @@ import SbRunFillPageTable from '@/views/sb/run-fill/modules/SbRunFillPageTable'
 import SbInspectionFillPageTable from '@/views/sb/inspection-fill/modules/SbInspectionFillPageTable'
 import DetailSbBom from '@/views/sb/modelbom/modules/DetailSbBom'
 import DetailSbCheck from '@/views/check/checkstandard/modules/DetailSbCheck'
+import PartInfoList from '@/views/part/info/modules/PartInfoList'
 const DetailListItem = DetailList.Item
 
 export default {
@@ -131,7 +134,8 @@ export default {
     SbRunFillPageTable,
     SbInspectionFillPageTable,
     DetailSbBom,
-    DetailSbCheck
+    DetailSbCheck,
+    PartInfoList
   },
   data () {
     return {
@@ -308,6 +312,10 @@ export default {
     },
     handleOk () {
       this.visible = true
+    },
+    partInfoListView () {
+      const modal = this.$refs.partInfoList
+      modal.base({ sbId: this.model.id }, { sbId: this.model.id })
     }
   }
 }