xiongchao il y a 3 ans
Parent
commit
8edd1028f3

+ 168 - 0
src/api/sb/scrap.js

@@ -0,0 +1,168 @@
+import { axios } from '@/utils/request'
+import { stringify } from 'qs'
+
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getScrapPage (parameter) {
+  return axios({
+    url: '/sb/scraps/page?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * add func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function addScrap (parameter) {
+  return axios({
+    url: '/sb/scraps',
+    method: 'POST',
+    headers: {
+      'Accept': 'application/json',
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    data: parameter
+  })
+}
+
+/**
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function updateScrap (parameter) {
+  return axios({
+    url: '/sb/scraps/' + parameter.id,
+    method: 'PUT',
+    data: parameter
+  })
+}
+
+/**
+ * submit func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function submit (parameter) {
+  return axios({
+    url: '/sb/scraps/' + parameter.id + '/submit',
+    method: 'PUT'
+  })
+}
+
+/**
+ * audit func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function audit (parameter) {
+  return axios({
+    url: '/sb/scraps/' + parameter.id + '/audit',
+    method: 'PUT',
+    data: parameter
+  })
+}
+
+/**
+ * close func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function close (parameter) {
+  return axios({
+    url: '/sb/scraps/' + parameter.id + '/close',
+    method: 'PUT',
+    data: parameter
+  })
+}
+
+/**
+ * fetch single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function fetchScrap (parameter) {
+  return axios({
+    url: '/sb/scraps/' + parameter.id,
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * query list func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function queryScrap (parameter) {
+  return axios({
+    url: '/sb/scraps?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * delete batch func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function deleteScraps (parameter) {
+  return axios({
+    url: '/sb/scraps',
+    method: 'DELETE',
+    data: parameter
+  })
+}
+
+/**
+ * delete single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function deleteScrap (parameter) {
+  return axios({
+    url: '/sb/scraps/' + parameter.id,
+    method: 'DELETE',
+    data: parameter
+  })
+}
+
+/**
+ * export file
+ * parameter: { }
+ * @param parameter :
+ * @returns {*}
+ */
+export function exportScrap (parameter) {
+  return axios({
+    url: '/sb/scraps/export?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    responseType: 'blob'
+  })
+}

+ 43 - 17
src/views/check/checkstandard/CheckStandard.vue

@@ -3,12 +3,22 @@
     <div class="table-page-search-wrapper">
       <a-form layout="inline">
         <a-row :gutter="48">
-          <a-col :md="8" :sm="24">
-            <a-form-item label="工作名称">
-              <a-input v-model="queryParam.keyword" placeholder="请输入工作名称"/>
+          <a-col :md="6" :sm="24">
+            <a-form-item label="标准名称">
+              <a-input v-model="queryParam.keyword" placeholder="请输入标准名称"/>
             </a-form-item>
           </a-col>
-          <a-col :md="8 || 24" :sm="24">
+          <a-col :md="6" :sm="24">
+            <a-form-item label="设备新号">
+              <a-input v-model="queryParam.sbNo" placeholder="请输入设备新号"/>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-form-item label="设备名称">
+              <a-input v-model="queryParam.sbName" placeholder="请输入设备名称"/>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6 || 24" :sm="24">
             <span class="table-page-search-submitButtons">
               <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
               <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
@@ -56,6 +66,7 @@
       size="default"
       rowKey="id"
       :columns="columns"
+      :scroll="{x: 1, y: BaseTool.Constant.scrollY }"
       :data="loadData"
       :alert="options.alert"
       :rowSelection="options.rowSelection"
@@ -130,33 +141,45 @@ export default {
         {
           title: '序号',
           dataIndex: 'index',
+          width: '100px',
           customRender: (text, record, index) => {
             return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
           }
         },
         {
-          title: '名称',
-          dataIndex: 'name'
+          title: '设备名称',
+          dataIndex: 'sbName',
+          width: '150px'
+        },
+        {
+          title: '设备新号',
+          dataIndex: 'sbNo',
+          width: '150px'
         },
-        // {
-        //  title: '编码',
-        // dataIndex: 'no'
-        // },
         {
           title: '部位',
-          dataIndex: 'part'
+          dataIndex: 'partName',
+          width: '200px'
         },
         {
-          title: '内容',
-          dataIndex: 'requirement'
+          title: '标准名称',
+          dataIndex: 'name',
+          width: '250px'
         },
         {
           title: '计划周期',
           dataIndex: 'period',
+          width: '100px',
+          fixed: 'right',
           customRender: (text, record, index) => {
             return text + this.BaseTool.Table.getMapText(this.periodTypeMap, record.periodType)
           }
         },
+        /*{
+          title: '内容',
+          dataIndex: 'requirement',
+          width: '200px'
+        },
         {
           title: '动作类型',
           dataIndex: 'actionType',
@@ -166,7 +189,8 @@ export default {
         },
         {
           title: '备注',
-          dataIndex: 'remark'
+          dataIndex: 'remark',
+          width: '200px'
         },
         {
           title: '是否启用',
@@ -176,15 +200,17 @@ export default {
         {
           title: '创建人名称',
           dataIndex: 'createdUserName'
-        },
+        },*/
         {
           title: '创建时间',
-          dataIndex: 'createdTime'
+          dataIndex: 'createdTime',
+          width: '250px'
         },
         {
           title: '操作',
           key: 'action',
-          width: '200px',
+          width: '250px',
+          fixed: 'right',
           align: 'center',
           scopedSlots: { customRender: 'action' }
         }

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

@@ -24,6 +24,10 @@
         <a-icon type="plus"/>
         复制
       </a-button>
+      <a-button style="margin-left:8px;" type="primary" @click="doImport">
+        <a-icon type="upload"/>
+        新增导入
+      </a-button>
       <!--      <a-button style="margin-left: 8px" type="primary" icon="download" @click="doExport">导出</a-button>-->
     </div>
     <a-table
@@ -51,7 +55,7 @@
     <base-form-insert ref="baseModalInsert" @ok="handleOk"/>
     <detail ref="detailModal"/>
     <sb-info-select-modal :type="'radio'" ref="sbInfoSelectModal" @selected="handleSbSelected"/>
-
+    <import-form-add ref="importModal" @ok="handleOk"/>
   </div>
 </template>
 
@@ -62,13 +66,13 @@ import {
   deleteCheckStandards,
   exportCheckStandard,
   fetchCheckStandard,
-  copy,
-  generateJobByCheckStandard
+  copy
 } from '@/api/check/checkstandard'
 import BaseForm from './BaseForm'
 import BaseFormInsert from './BaseFormInsert'
 import Detail from './Detail'
 import SbInfoSelectModal from '@/views/sb/info/modules/SbInfoSelectModal'
+import ImportFormAdd from '@/views/check/checkstandard/modules/ImportFormAdd'
 const DetailListItem = DetailList.Item
 
 export default {
@@ -79,7 +83,8 @@ export default {
     BaseForm,
     Detail,
     SbInfoSelectModal,
-    BaseFormInsert
+    BaseFormInsert,
+    ImportFormAdd
   },
   props: {
     /**
@@ -118,6 +123,10 @@ export default {
             return index + 1
           }
         },
+        {
+          title: '检查部位',
+          dataIndex: 'partName'
+        },
         {
           title: '名称',
           dataIndex: 'name',
@@ -130,10 +139,6 @@ export default {
             return record.period + this.BaseTool.Table.getMapText(this.periodTypeMap, text)
           }
         },
-        {
-          title: '检查部位',
-          dataIndex: 'partName'
-        },
    /*     {
           title: '动作类型',
           dataIndex: 'actionType',
@@ -234,6 +239,9 @@ export default {
         this.BaseTool.UPLOAD.downLoadExportExcel(file)
       })
     },
+    doImport () {
+      this.$refs.importModal.base(this.model.no)
+    },
     handleSbSelect () {
       this.$refs.sbInfoSelectModal.base()
     },

+ 5 - 4
src/views/check/checkstandard/modules/ImportFormAdd.vue

@@ -18,8 +18,8 @@
       </a-form-item>
     </a-form>
     <p style="color: red">注意事项:<br/>
-      1:请确保对应设备新号已经设置<br/>
-      2:请确保对应设备使用机台、维修员均已经设置<br/>
+      1:请确保文件中对应设备新号已经设置<br/>
+      2:请确保保养对应的设备部位、指定的人员员均已在系统中设置<br/>
       3:导入如出现问题,请及时联系<br/>
     </p>
     <template slot="footer">
@@ -37,6 +37,7 @@ export default {
     return {
       confirmLoading: false,
       modalTitle: null,
+      sbId: null,
       form: this.$form.createForm(this),
       visible: false,
       type: null,
@@ -44,8 +45,9 @@ export default {
     }
   },
   methods: {
-    base (useCompany, useProject) {
+    base (sbId) {
       this.visible = true
+      this.sbId = sbId
       this.modalTitle = '保养标准导入'
       this.type = 1
     },
@@ -87,7 +89,6 @@ export default {
           return
         }
         const formData = new FormData()
-       // formData.append('type', this.type)
         formData.append('file', this.fileList[0])
         importCheckStandard(formData)
           .then((res) => {

+ 276 - 0
src/views/sb/secondscrap/Scrap.vue

@@ -0,0 +1,276 @@
+<template>
+  <a-card :bordered="false">
+    <a-row :gutter="8" v-show="visible">
+      <a-col :span="24">
+        <div class="table-page-search-wrapper">
+          <a-form layout="inline">
+            <a-row :gutter="48">
+              <a-col :md="8" :sm="24">
+                <a-form-item label="关键字">
+                  <a-input v-model="queryParam.keyword" placeholder="请输入名称"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6 || 24" :sm="24">
+                <span class="table-page-search-submitButtons">
+                  <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+                  <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
+                </span>
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
+
+        <div class="table-operator">
+          <a-button v-if="$auth('sqarepartmanage-spare-part-info-add')" type="primary" icon="plus" @click="handleAdd">新增</a-button>
+          <a-button style="margin-left: 8px" v-if="$auth('sqarepartmanage-spare-part-info-export')" type="primary" icon="download" @click="doExport">导出</a-button>
+          <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('sqarepartmanage-spare-part-info-del')">
+            <a-menu slot="overlay">
+              <a-popconfirm title="是否要删除所选数据?" @confirm="batchDelete()">
+                <a-menu-item key="1"><a-icon type="delete" /><a>删除</a></a-menu-item>
+              </a-popconfirm>
+            </a-menu>
+            <a-button style="margin-left: 8px">
+              批量操作 <a-icon type="down" />
+            </a-button>
+          </a-dropdown>
+        </div>
+
+        <s-table
+          ref="table"
+          size="default"
+          rowKey="id"
+          :columns="columns"
+          :data="loadData"
+          :scroll="{x: 1500, y: BaseTool.Constant.scrollY}"
+          :alert="options.alert"
+          :rowSelection="options.rowSelection"
+          showPagination="auto"
+        >
+          <span slot="status" slot-scope="text">
+            <badge
+              :status="DictCache.COLOR.SB_SCRAP_STATUS[text]"
+              :text="statusMap[text]" />
+          </span>
+          <span slot="action" slot-scope="record">
+            <template>
+              <a @click="handleView(record)">查看</a>
+              <a-divider type="vertical" />
+              <a @click="handleEdit(record)">修改</a>
+              <a-divider type="vertical" />
+              <a-popconfirm title="是否要删除该条数据?" @confirm="batchDelete(record.id)">
+                <a>删除</a>
+              </a-popconfirm>
+            </template>
+          </span>
+        </s-table>
+      </a-col>
+    </a-row>
+    <base-form ref="baseModal" @ok="handleOk"/>
+    <detail ref="detailModal" @ok="handleOk"/>
+  </a-card>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import BaseForm from './modules/BaseForm'
+import Detail from './modules/Detail'
+import { getScrapPage, deleteScraps, fetchScrap, exportScrap } from '@/api/sb/scrap'
+
+export default {
+  name: 'SparePartInfoList',
+  components: {
+    STable,
+    Ellipsis,
+    BaseForm,
+    Detail
+  },
+  data () {
+    return {
+      // 查询参数
+      queryParam: {
+      },
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          width: 100,
+          checked: true,
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '名称',
+          dataIndex: 'name',
+          checked: true,
+          width: '150px'
+        },
+        {
+          title: '创建日期',
+          checked: true,
+          width: '200px',
+          dataIndex: 'createdTime'
+        },
+        {
+          title: '更新日期',
+          checked: true,
+          width: '200px',
+          dataIndex: 'updateTime'
+        },
+        {
+          title: '状态',
+          checked: true,
+          width: '150px',
+          dataIndex: 'status',
+          fixed: 'right',
+          scopedSlots: { customRender: 'status' }
+        },
+        {
+          title: '操作',
+          checked: true,
+          width: '250px',
+          fixed: 'right',
+          key: 'action',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'name'
+          }
+        }
+        return getScrapPage(Object.assign(parameter, this.queryParam))
+          .then(res => {
+            return res.data
+          })
+      },
+      selectedRowKeys: [],
+      selectedRows: [],
+      expandedKeys: [],
+      selectedKeys: [],
+      statusMap: {},
+      id: null,
+      visible: true,
+      spareTypeTreeData: [],
+      options: {
+        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: false
+    }
+  },
+  created () {
+    // 下拉框map
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_SCRAP_STATUS)
+    this.tableOption()
+  },
+  methods: {
+    tableOption () {
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+          rowSelection: {
+            selectedRowKeys: this.selectedRowKeys,
+            onChange: this.onSelectChange,
+            getCheckboxProps: record => ({
+              props: {
+                disabled: false,
+                name: record.id
+              }
+            })
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    batchDelete (id) {
+      let ids = []
+      if (this.BaseTool.String.isBlank(id)) {
+        const length = this.selectedRows.length
+        if (length === 0) {
+          this.$message.info('请选择要删除的记录')
+          return
+        }
+        ids = this.selectedRows.map(item => item.id)
+      } else {
+        ids = [id]
+      }
+      deleteScraps(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleEdit (record) {
+      this.visible = false
+      fetchScrap({ id: record.id }).then(res => {
+        const modal = this.$refs.baseModal
+        modal.base(res.data)
+      })
+    },
+    handleDetailBom (record) {
+      this.visible = false
+      const modal = this.$refs.detailBomModal
+      modal.base(record)
+    },
+    handleAdd (record) {
+      this.visible = false
+      this.$refs.baseModal.base()
+    },
+    handleView (record) {
+      this.visible = false
+      fetchScrap({ id: record.id }).then(res => {
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+    handleOk () {
+      this.visible = true
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm () {
+      this.queryParam = {
+      }
+      this.$refs.table.refresh(true)
+    },
+    onSelect: function (selectedKeys, info) {
+      this.selectedKeys = selectedKeys
+      this.queryParam.typeId = selectedKeys.length > 0 ? selectedKeys[0] : ''
+      this.$refs.table.refresh(true)
+    },
+    onExpand (expandedKeys) {
+      this.expandedKeys = expandedKeys
+      this.autoExpandParent = false
+    },
+    doExport () {
+      this.$message.info('数据正在处理,耐心等待,请勿重复点击')
+      const parameter = {
+        ...this.queryParam
+      }
+      exportScrap(parameter).then(file => {
+        this.BaseTool.UPLOAD.downLoadExportExcel(file)
+      })
+    }
+  }
+}
+</script>

+ 544 - 0
src/views/sb/secondscrap/modules/BaseForm.vue

@@ -0,0 +1,544 @@
+<template>
+  <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
+
+    <a-row :gutter="48" slot="extra">
+      <a-col :md="48" :sm="48">
+        <span class="table-page-search-submitButtons" style="float: right" >
+          <a-button style="margin-left: 8px" type="primary" @click="save()">保存</a-button>
+          <a-button style="margin-left: 8px" @click="handleCancel()">返回列表</a-button>
+        </span>
+      </a-col>
+    </a-row>
+    <a-form :form="form">
+
+      <a-form-item v-show="false" >
+        <a-input v-decorator="['id']" type="hidden"/>
+      </a-form-item>
+      <title-divider title="基础信息" width="100px"></title-divider>
+      <row-list :col="2">
+        <row-item>
+          <a-form-item
+            label="名称"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['name', {rules: [{required: true, message: '名称不能为空'}]}]" />
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="备注"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-textarea
+              v-decorator="['remark']" />
+          </a-form-item>
+        </row-item>
+      </row-list>
+    </a-form>
+    <title-divider title="设备信息" width="100px"></title-divider>
+    <div class="table-operator">
+      <a-button style="margin-left:8px;" type="primary" @click="handleSbSelect">
+        <a-icon type="plus"/>
+        添加
+      </a-button>
+      <a-button class="margin-left8" size="small" type="danger" @click="handleDel">
+        <a-icon type="delete"/>
+        删除
+      </a-button>
+    </div>
+    <a-table
+      :data-source="data"
+      :columns="columns"
+      bordered
+      tableLayout="auto"
+      :row-selection="rowSelection"
+      rowKey="id">
+      <span slot="action" slot-scope="record">
+        <template>
+          <a v-if="$auth('sb-infos-edit')" @click="handleDetailSelect(record)">修改</a>
+          <a-divider type="vertical" />
+          <a-popconfirm v-if="$auth('sb-infos-del')" title="是否要删除该条数据?" @confirm="handleDelOne(record.id)">
+            <a>删除</a>
+          </a-popconfirm>
+        </template>
+      </span>
+    </a-table>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
+    </template>
+    <sb-info-select-modal :type="'checkbox'" ref="sbInfoSelectModal" @selected="handleSbSelected"/>
+  </a-card>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import { addSparePartInfo, querySparePartInfo, updateSparePartInfo } from '@/api/sqarepartmanage/sparepartinfo'
+import { querySpareType, fetchSpareTypeTree } from '@/api/sqarepartmanage/sparetype'
+import { fetchSbGuigeOptions } from '@/api/sb/guige'
+import Vue from 'vue'
+import { uploadUrl } from '@/api/upms/file'
+import { ACCESS_TOKEN } from '@/store/mutation-types'
+import { fetchStoreTree } from '@/api/store/store'
+import { selectSbModelListBySpareId } from '@/api/sb/modelbom'
+import SbInfoSelectModal from '@/views/sb/info/modules/SbInfoSelectModal'
+
+export default {
+  name: 'BaseScrap',
+  components: {
+    SbInfoSelectModal
+  },
+  data () {
+    return {
+      isAdd: false,
+      unitName: null,
+      unitNameBz: null,
+      rowSelection: {
+        onChange: (selectedRowKeys, selectedRows) => {
+          this.selectedRowKeys = selectedRowKeys
+          this.selectedRows = selectedRows
+        }
+      },
+      uploadUrl: uploadUrl,
+      defaultApplicationFileList: [],
+      applicationFileList: [], // 备件图片
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false,
+      // 下拉框map
+      levelMap: {},
+      periodTypeMap: {},
+      headers: {
+        Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
+      },
+      // 表头
+      columns: [
+        {
+          title: '型号',
+          dataIndex: 'model'
+        },
+        {
+          title: '名称',
+          dataIndex: 'name'
+        },
+        {
+          title: '新号',
+          dataIndex: 'no'
+        },
+        {
+          title: '旧号',
+          dataIndex: 'zbh'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          checked: true,
+          align: 'center',
+          // fixed: 'right',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      data: [],
+      sbId: null,
+      selectedRowKeys: [],
+      selectedRows: [],
+      options: {
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys
+        }
+      }
+    }
+  },
+  props: {
+  },
+  created () {
+    // 下拉框map
+    this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SPARE_PART_INFO_LEVEL)
+    this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
+    this.cdMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PRODUCER_AREA)
+    this.ytMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SPARE_USE_TYPE)
+    this.periodTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_PLAN_PERIOD_TYPE)
+  },
+  methods: {
+    base (record, sbId) {
+      this.setTree(record)
+      this.visible = true
+      this.sbId = sbId
+      console.log('sbId: ', sbId)
+      // 如果是空标识添加
+      if (this.BaseTool.Object.isBlank(record)) {
+        this.modalTitle = '添加'
+        this.isAdd = true
+        return
+      }
+      this.modalTitle = '编辑'
+      if (this.BaseTool.Object.isBlank(record.id)) {
+        this.modalTitle = '复制'
+      }
+      selectSbModelListBySpareId({ id: record.id }).then(res => {
+        this.data = res.data
+      })
+      const { form: { setFieldsValue } } = this
+      this.applicationFileList = record.applicationFileList
+      this.defaultApplicationFileList = this.BaseTool.UPLOAD.transImg(this.applicationFileList)
+      this.unitName = record.unit
+      this.unitNameBz = record.unitBz
+      this.gg = record.ggxh
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign(pick(record, [
+          'id',
+          'no',
+          'sbId',
+          'initNo',
+          'uniteNo',
+          'nameNo',
+          'ggNo',
+          'name',
+          'parentTypeId',
+          'middleTypeId',
+          'childTypeId',
+          'typeId',
+          'level',
+          'initialValue',
+          'producerId',
+          'producerName',
+          'supplierId',
+          'supplierName',
+          'unit',
+          'unitBz',
+          'unitRate',
+          'englishName',
+          'childNo',
+          'parentNo',
+          'parentName',
+          'childName',
+          'typeName',
+          'middleNo',
+          'middleName',
+          'cd',
+          'ggxh',
+          // 'yt',
+          'zjm',
+          'zbh',
+          'maxStock',
+          'minStock',
+          'initStock',
+          'remark'
+        ])))
+      })
+    },
+    save () {
+      const { form: { validateFieldsAndScroll, setFieldsValue } } = this
+      this.confirmLoading = true
+      console.log('sbId: ' + this.sbId)
+      setFieldsValue({
+        'unit': this.unitName,
+        'unitBz': this.unitNameBz,
+        'sbId': this.sbId
+      })
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        values.applicationFileList = this.applicationFileList
+        values.detailList = this.data
+        // 日期处理
+        if (this.BaseTool.String.isBlank(values.id)) {
+          addSparePartInfo(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+              this.confirmLoading = false
+            })
+        } else {
+          updateSparePartInfo(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+              this.confirmLoading = false
+            })
+        }
+      })
+    },
+    handleProducerSelect () {
+      this.$refs.producerSelectModal.base({}, { type: 3 })
+    },
+    handleProducerSelected (record, selectedRowKeys, selectedRow) {
+      const { form: { setFieldsValue } } = this
+      const [ key ] = selectedRowKeys
+      const [ row ] = selectedRow
+      setFieldsValue({
+        'producerId': key,
+        'producerName': row.name
+      })
+    },
+    handleSupplierSelect () {
+      this.$refs.supplierSelectModal.base()
+    },
+    handleSupplierSelected (record, selectedRowKeys, selectedRow) {
+      const { form: { setFieldsValue } } = this
+      const [ key ] = selectedRowKeys
+      const [ row ] = selectedRow
+      setFieldsValue({
+        'supplierId': key,
+        'supplierName': row.name
+      })
+    },
+    handleCancel (values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      this.unitName = null
+      this.unitNameBz = null
+      this.gg = null
+      this.isAdd = true
+      this.data = []
+      if (this.BaseTool.Object.isNotBlank(values)) {
+        this.$emit('ok', values)
+      } else {
+        this.$emit('ok')
+      }
+    },
+    /**
+     * 设置备件类别树
+     */
+    setTree (record = {}) {
+      fetchStoreTree({ id: record.id }).then(res => {
+        this.storeTreeDate = res.data
+      })
+      fetchSpareTypeTree({ }).then(res => {
+        this.spareTypeData = res.data
+      })
+      /* querySpareType({ filter: 2, parentId: record.parentTypeId }).then(res => {
+        this.spareTypeDataMiddle = res.data
+      })
+      querySpareType({ filter: 2, parentId: record.middleTypeId }).then(res => {
+        this.spareTypeDataChild = res.data
+      }) */
+      fetchSbGuigeOptions().then(res => {
+        this.ggList = res.data
+      })
+    },
+
+    checkSpareNo () {
+      const { form: { getFieldValue } } = this
+      const typeId = getFieldValue('typeId')
+      const name = getFieldValue('name')
+      // const ggxh = getFieldValue('ggxh')
+      if (typeId == null) {
+        this.$message.error('请先设置大小类型')
+        return
+      }
+      querySparePartInfo({
+        typeId: typeId,
+        name: name,
+        dataScope: {
+          sortBy: 'desc',
+          sortName: 'name'
+        }
+      }).then(res => {
+        this.data = res.data
+      })
+    },
+    /**
+     * @function 任务类型文本框的值变化时的回调
+     * @author ***
+     * @time 2020-08-17
+     **/
+    handleSearch (value) {
+      this.handleChange(value)
+    },
+    /**
+     * @function 任务类型改变时的回调
+     * @author ***
+     * @time 2020-08-17
+     **/
+    handleChange (value) {
+      this.unitName = (!isNaN(value) && value !== '') ? this.BaseTool.Object.getField(this.unitMap, value) : value
+      if (isNaN(this.unitName) || this.unitName === '') {
+        this.unitName = value
+      }
+    },
+    /**
+     * @function 修改设备关联
+     * @author ***
+     * @time 2020-08-17
+     **/
+    handleDetailSelect (record) {
+      const modal = this.$refs.baseModal
+      modal.base(record)
+    },
+    handleDetailSelected (values) {
+      const newData = [...this.data]
+      for (let j = 0; j < newData.length; j++) {
+        if (values.sbId === newData[j].sbId) {
+          newData[j].num = values.num
+          newData[j].period = values.period
+          newData[j].periodType = values.periodType
+          break
+        }
+      }
+      this.data = newData
+    },
+    /**
+     * @function 添加关联设备
+     * @author ***
+     * @time 2020-08-17
+     **/
+    handleSbSelect () {
+      const modal = this.$refs.sbInfoSelectModal
+      modal.base()
+    },
+    handleSbSelected (keys, rows) {
+      const { data } = this
+      for (let i = 0; i < rows.length; i++) {
+        var find = false
+        for (let j = 0; j < data.length; j++) {
+          if (rows[i].id === data[j].sbId) {
+            find = true
+            break
+          }
+        }
+        if (!find) {
+          const sbId = rows[i].id
+          const selectData = rows[i]
+          selectData.num = 1
+          selectData.sbId = sbId
+          selectData.id = null
+          selectData.period = 1
+          selectData.periodType = 1
+          data.push(selectData)
+        }
+      }
+    },
+    /**
+     * @function 任务类型失焦事件
+     * @author ***
+     * @time 2020-08-17
+     **/
+    handleBlur (value) {
+      this.unitName = value
+    },
+    /**
+     * @function 任务类型文本框的值变化时的回调
+     * @author ***
+     * @time 2020-08-17
+     **/
+    handleSearchBz (value) {
+      this.handleChange(value)
+    },
+    /**
+     * @function 任务类型改变时的回调
+     * @author ***
+     * @time 2020-08-17
+     **/
+    handleChangeBz (value) {
+      this.unitNameBz = (!isNaN(value) && value !== '') ? this.BaseTool.Object.getField(this.unitMap, value) : value
+      if (isNaN(this.unitNameBz) || this.unitNameBz === '') {
+        this.unitNameBz = value
+      }
+    },
+    /**
+     * @function 任务类型失焦事件
+     * @author ***
+     * @time 2020-08-17
+     **/
+    handleBlurBz (value) {
+      this.unitNameBz = value
+    },
+    /**
+     * @function 任务类型文本框的值变化时的回调
+     * @author ***
+     * @time 2020-08-17
+     **/
+    handleSearchG (value) {
+      this.handleChangeG(value)
+    },
+    /**
+     * @function 任务类型改变时的回调
+     * @author ***
+     * @time 2020-08-17
+     **/
+    handleChangeG (value) {
+      this.gg = (!isNaN(this.ggList[value]) && this.ggList[value] !== '') ? this.ggList[value].label : value
+      if (isNaN(this.gg) || this.gg === '') {
+        this.gg = value
+      }
+    },
+    handleStoreSelect () {
+      this.$refs.storeSelectModal.base()
+    },
+    handleStoreSelected (record, keys, rows) {
+      const [ key ] = keys
+      const [ row ] = rows
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign({
+          'storeId': key,
+          'storeName': row.name
+        }))
+      })
+    },
+    handleDel (id) {
+      const data = [...this.data]
+      if (this.selectedRowKeys.length === 0) {
+        this.$message.error('请至少选择一条数据')
+        return
+      }
+      this.data = data.filter(item => !this.selectedRowKeys.includes(item.id))
+    },
+    handleDelOne (id) {
+      const data = [...this.data]
+      this.data = data.filter(item => id !== item.id)
+    },
+    /**
+     * @function 任务类型失焦事件
+     * @author ***
+     * @time 2020-08-17
+     **/
+    handleBlurG (value) {
+      this.gg = value
+    },
+    parentChange (val, option) {
+      querySpareType({ parentId: val, filter: 2 }).then(res => {
+        this.spareTypeDataMiddle = res.data
+      })
+      const { form: { setFieldsValue } } = this
+      setFieldsValue({ parentNo: option.data.key, typeId: val, middleTypeId: null, middleNo: null, childTypeId: null, childNo: null })
+    },
+    middleChange (val, option) {
+      querySpareType({ parentId: val, filter: 2 }).then(res => {
+        this.spareTypeDataChild = res.data
+      })
+      const { form: { setFieldsValue } } = this
+      setFieldsValue({ middleNo: option.data.key, typeId: val, childTypeId: null, childNo: null })
+    },
+    childChange (val, option) {
+      const { form: { setFieldsValue } } = this
+      setFieldsValue({ childNo: option.data.key, typeId: val, childTypeId: val })
+    },
+    handleApplicationFileChange (info) {
+      this.defaultApplicationFileList = info.fileList
+      this.applicationFileList = this.setFileList(info, 14)
+    },
+    setFileList (info, type) {
+      const file = info.file
+      const fileList = info.fileList
+      if (file.status === 'done') {
+        return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
+      } else if (file.status === 'removed') {
+        return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
+      } else if (file.status === 'error') {
+        this.$message.error('上传失败')
+        return []
+      }
+    }
+  }
+}
+</script>

+ 212 - 0
src/views/sb/secondscrap/modules/Detail.vue

@@ -0,0 +1,212 @@
+<template>
+  <a-card :bordered="false" :title="modalTitle" v-show="visible">
+    <a-row :gutter="48" slot="extra">
+      <a-col :md="48" :sm="48">
+        <span class="table-page-search-submitButtons" style="float: right">
+          <a-button style="margin-left: 8px" @click="handleCancel()">返回</a-button>
+        </span>
+      </a-col>
+    </a-row>
+    <title-divider title="基础信息" width="90px"></title-divider>
+    <detail-list title="" :col="3">
+      <detail-list-item term="id">{{ model.id }}</detail-list-item>
+      <detail-list-item term="集团统一编码">{{ model.uniteNo }}</detail-list-item>
+      <detail-list-item term="自编号">{{ model.zbh }}</detail-list-item>
+      <detail-list-item term="备件编码">{{ model.no }}</detail-list-item>
+      <detail-list-item term="备件名称">{{ model.name }}</detail-list-item>
+      <detail-list-item term="名称编码">{{ model.nameNo }}</detail-list-item>
+      <detail-list-item term="规格型号">{{ model.ggxh }}</detail-list-item>
+      <detail-list-item term="规格编码">{{ model.ggNo }}</detail-list-item>
+      <detail-list-item term="备件类别">{{ model.typeName }}</detail-list-item>
+      <detail-list-item term="备件等级">{{ BaseTool.Object.getField(levelMap,model.level) }}</detail-list-item>
+      <detail-list-item term="备件价值">{{ BaseTool.Amount.formatter(model.initialValue) }}</detail-list-item>
+      <detail-list-item term="生产商">{{ model.producerName }}</detail-list-item>
+      <detail-list-item term="供应商">{{ model.supplierName }}</detail-list-item>
+      <detail-list-item term="原厂编号">{{ model.initNo }}</detail-list-item>
+      <detail-list-item term="计量单位">{{ model.unit }}</detail-list-item>
+      <detail-list-item term="包装单位">{{ model.unitBz }}</detail-list-item>
+      <detail-list-item term="折算系数">{{ model.unitRate }}</detail-list-item>
+      <detail-list-item term="当前库存">{{ model.currentStock }}</detail-list-item>
+      <detail-list-item term="采购周期">{{ model.purchasePeriod }}</detail-list-item>
+      <detail-list-item term="使用周期">{{ model.usePeriod }}</detail-list-item>
+      <detail-list-item term="最高库存">{{ model.maxStock }}</detail-list-item>
+      <detail-list-item term="最低库存">{{ model.minStock }}</detail-list-item>
+      <detail-list-item term="初始库存">{{ model.initStock }}</detail-list-item>
+      <detail-list-item term="英文名称">{{ model.englishName }}</detail-list-item>
+      <detail-list-item term="助记码">{{ model.zjm }}</detail-list-item>
+      <detail-list-item term="产地">{{ BaseTool.Object.getField(cdMap,model.cd) }}</detail-list-item>
+      <!--<detail-list-item term="用途">{{ BaseTool.Object.getField(ytMap,model.yt) }}</detail-list-item>-->
+      <detail-list-item term="参数">{{ model.params }}</detail-list-item>
+      <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
+      <detail-list-item term="创建人">{{ model.createdUserName }}</detail-list-item>
+      <detail-list-item term="更新人">{{ model.updateUserName }}</detail-list-item>
+      <detail-list-item term="更新日期">{{ model.updateTime }}</detail-list-item>
+    </detail-list>
+    <title-divider title="图片信息" width="90px"></title-divider>
+    <detail-list title="" :col="1">
+      <detail-list-item term="" v-if="model.applicationFileList != null && model.applicationFileList.length > 0">
+        <viewer :images="model.applicationFileList" @inited="inited" ref="viewer" :index="1" >
+          <img v-for="item in model.applicationFileList" :src="item.url" :key="item.id" class="image">
+        </viewer>
+      </detail-list-item>
+      <detail-list-item term="" v-if="model.applicationFileList == null || model.applicationFileList.length === 0">
+        暂无
+      </detail-list-item>
+    </detail-list>
+    <title-divider title="设备信息" width="100px"></title-divider>
+    <div class="table-operator">
+    </div>
+    <a-table
+      :data-source="data"
+      :columns="columns"
+      bordered
+      tableLayout="auto"
+      rowKey="id">
+    </a-table>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">返回</a-button>
+    </template>
+  </a-card>
+</template>
+
+<script>
+import DetailList from '@/components/tools/DetailList'
+import { selectSbModelListBySpareId } from '@/api/sb/modelbom'
+const DetailListItem = DetailList.Item
+
+export default {
+  name: 'SparePartInfoDetail',
+  components: {
+    DetailList,
+    DetailListItem
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      // 下拉框map
+      levelMap: {},
+      unitMap: {},
+      cdMap: {},
+      ytMap: {},
+      model: {
+        'no': null,
+        'name': null,
+        'ggxh': null,
+        'typeId': null,
+        'level': null,
+        'initialValue': null,
+        'producerId': null,
+        'producerName': null,
+        'supplierId': null,
+        'supplierName': null,
+        'unit': null,
+        'unitBz': null,
+        'unitRate': null,
+        'currentStock': null,
+        'purchasePeriod': null,
+        'usePeriod': null,
+        'maxStock': null,
+        'qrCode': null,
+        'applicationFileList': [],
+        'minStock': null,
+        'initStock': null,
+        'params': null,
+        'remark': null,
+        'createdUserId': null,
+        'updateUserId': null,
+        'updateTime': null,
+        'createdUserName': null,
+        'updateUserName': null,
+        'typeName': null
+      },
+      periodTypeMap: {},
+      // 表头
+      columns: [
+        {
+          title: '型号',
+          dataIndex: 'model'
+        },
+        {
+          title: '名称',
+          dataIndex: 'name'
+        },
+        {
+          title: '新号',
+          dataIndex: 'no'
+        },
+        {
+          title: '旧号',
+          dataIndex: 'zbh'
+        },
+        {
+          title: '更换周期',
+          dataIndex: 'period',
+          customRender: (text, record, index) => {
+            return text + this.BaseTool.Table.getMapText(this.periodTypeMap, record.periodType)
+          }
+        },
+        {
+          title: '数量',
+          dataIndex: 'num'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          checked: true,
+          align: 'center',
+          // fixed: 'right',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      data: []
+    }
+  },
+  created () {
+    // 下拉框map
+    this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SPARE_PART_INFO_LEVEL)
+    this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
+    this.cdMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PRODUCER_AREA)
+    this.ytMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SPARE_USE_TYPE)
+    this.periodTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_PLAN_PERIOD_TYPE)
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      this.modalTitle = '详情'
+      this.model = record
+      selectSbModelListBySpareId({ id: record.id }).then(res => {
+        this.data = res.data
+      })
+    },
+    inited (viewer) {
+      this.$viewer = viewer
+      // this.$viewer.index = 0
+      // // 不要他的按钮
+      // this.$viewer.options.button = false
+      // // 不要他的底部缩略图
+      // this.$viewer.options.navbar = false
+      // // 不要他的底部标题
+      // this.$viewer.options.title = false
+      // // 不要他的底部工具栏
+      // this.$viewer.options.toolbar = false
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+      this.$emit('ok')
+    }
+
+  }
+}
+</script>
+<style scoped>
+.image {
+  width: calc(20% - 10px);
+  cursor: pointer;
+  margin: 5px;
+  display: inline-block;
+}
+</style>