xiongchao 3 年之前
父节点
当前提交
3ed4c15600

+ 8 - 2
src/views/sb/info/SbInfo.vue

@@ -189,13 +189,18 @@ export default {
     filter: {
       type: Number,
       default: -1
+    },
+    useType: {
+      type: Number,
+      default: null
     }
   },
   data () {
     return {
       // 查询参数
       queryParam: {
-        filter: this.filter
+        filter: this.filter,
+        useType: this.useType
       },
       depreciationTypeMap: {},
       visible: true,
@@ -476,7 +481,8 @@ export default {
     },
     resetSearchForm () {
       this.queryParam = {
-        filter: this.filter
+        filter: this.filter,
+        useType: this.useType
       }
       this.visible = true
       this.$refs.table.refresh(true)

+ 8 - 504
src/views/sb/info/SpecialSbInfo.vue

@@ -1,513 +1,17 @@
 <template>
-  <a-card :bordered="false">
-    <a-row :gutter="8" v-show="visible">
-      <a-col :span="4">
-        <a-tree
-          @expand="onExpand"
-          :expandedKeys="expandedKeys"
-          :autoExpandParent="true"
-          @select="onSelect"
-          :selectedKeys="selectedKeys"
-          :treeData="treeData"
-        />
-      </a-col>
-      <a-col :span="20">
-        <div>
-          <div class="table-page-search-wrapper">
-            <a-form layout="inline">
-              <a-row :gutter="48">
-                <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="6" :sm="24">
-                  <a-form-item label="设备旧号">
-                    <a-input v-model="queryParam.zbh" placeholder="请输入设备旧号"/>
-                  </a-form-item>
-                </a-col>
-                <a-col :md="8" :sm="24">
-                  <a-form-item label="设备状态">
-                    <a-select @change="handleDeptChange" v-model="queryParam.status" placeholder="请选择">
-                      <a-select-option
-                        v-for="(label,value) in statusMap"
-                        :key="value"
-                        :label="label"
-                        :value="parseInt(value)">{{ label }}
-                      </a-select-option>
-                    </a-select>
-                  </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('sb-infos-add')" type="primary" icon="plus" @click="handleAdd">新增</a-button>
-            <a-button style="margin-left: 8px" v-if="$auth('sb-infos-export')" type="primary" icon="download" @click="doExport">导出</a-button>
-            <a-button style="margin-left: 8px" v-if="$auth('sb-infos-export')" type="primary" icon="upload" @click="doImport">初始化导入</a-button>
-            <a-button style="margin-left: 8px" v-if="$auth('sb-infos-export')" type="primary" icon="upload" @click="doImportDe">折旧导入</a-button>
-            <a-button style="margin-left: 8px" v-if="$auth('sb-infos-export')" type="primary" icon="upload" @click="printQcode()">打印</a-button>
-            <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('sb-infos-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"
-            :widthSpace="true"
-            :columns="columns"
-            :data="loadData"
-            :alert="options.alert"
-            :rowSelection="options.rowSelection"
-            :scroll="{x: BaseTool.Constant.scrollX, y: BaseTool.Constant.scrollY }"
-            showPagination="auto"
-          >
-            <span slot="action" slot-scope="record">
-              <template>
-                <div>
-                  <!--<a-divider type="vertical" />
-                    <a-popconfirm v-if="$auth('sb-infos-del')" title="是否要删除该设备?" @confirm="batchDelete(record.id)">
-                      <a>删除</a>
-                    </a-popconfirm>
-                    <a-divider type="vertical" />
-                    <a @click="handleCopy(record)">复制</a>-->
-                  <a-dropdown>
-                    <a-menu slot="overlay">
-                      <a-menu-item key="0">
-                        <a @click="handleView(record)">查看</a>
-                      </a-menu-item>
-                      <a-menu-item key="1">
-                         <a v-if="$auth('sb-infos-edit')" @click="handleEdit(record)">修改</a>
-                      </a-menu-item>
-                      <a-menu-item v-if="record.status != 2" key="2">
-                         <a-popconfirm  title="是否要启用该设备?" @confirm="handleStart(record)">
-                          <a>启用</a>
-                        </a-popconfirm>
-                      </a-menu-item>
-                      <a-menu-item v-if="record.status != 7"  key="3">
-                         <a-popconfirm title="是否要停用该设备?" @confirm="handleStop(record)">
-                          <a>停用</a>
-                        </a-popconfirm>
-                      </a-menu-item>
-                       <a-menu-item key="4">
-                         <a @click="printQcode(record)">打印</a>
-                      </a-menu-item>
-                    </a-menu>
-                    <a-button> 操作 <a-icon type="down" /> </a-button>
-                  </a-dropdown>
-                </div>
-              </template>
-            </span>
-            <span slot="status" slot-scope="text">
-              <badge
-                :status="DictCache.COLOR.SB_INFO_STATUS[text]"
-                :text="statusMap[text]" />
-            </span>
-            <span slot="wbFile" slot-scope="record">
-              <template>
-                <a @click="handleRepairFilePreview(record)">预览</a>
-                <a-divider type="vertical" />
-                <a @click="handleRepairFileDownload(record)">下载</a>
-              </template>
-            </span>
-            <span slot="useFile" slot-scope="record">
-              <template>
-                <a @click="handleUseFilePreview(record)">预览</a>
-                <a-divider type="vertical" />
-                <a @click="handleUseFileDownload(record)">下载</a>
-              </template>
-            </span>
-            <span slot="checkFile" slot-scope="record">
-              <template>
-                <a @click="handleCheckFilePreview(record)">预览</a>
-                <a-divider type="vertical" />
-                <a @click="handleCheckFileDownload(record)">下载</a>
-              </template>
-            </span>
-          </s-table>
-        </div>
-
-      </a-col>
-    </a-row>
-    <base-form ref="baseModal" :useType="5" @ok="handleOk"/>
-    <detail ref="detailModal" @ok="handleOk"/>
-    <download-modal ref="downloadModal"/>
-    <preview-modal ref="previewModal"/>
-    <import-form-add ref="importModal" @ok="handleOk"/>
-    <print-sb-code ref="printSbCode"/>
-  </a-card>
-
+  <SbInfo :use-type="5"/>
 </template>
 
 <script>
-import { STable, Ellipsis } from '@/components'
-import BaseForm from './modules/BaseForm'
-import Detail from './modules/Detail'
-import DownloadModal from '@/views/download/DownloadModal'
-import PreviewModal from '@/views/preview/PreviewModal'
-import { updateSbInfo, getSbInfoPage, deleteSbInfos, fetchSbInfo, exportSbInfo } from '@/api/sb/info'
-import { queryDept, getDeptsAllByParentId } from '@/api/upms/dept'
-import BaseTool from '../../../utils/tool'
-import { fetchSbTypeTree } from '@/api/sb/type'
-import ImportFormAdd from './modules/ImportFormAdd'
-import PrintSbCode from '@/views/sb/info/modules/PrintSbCode'
-
+import SbInfo from './SbInfo'
 export default {
-  name: 'SpecialSbInfoList',
+  name: 'MySbInfo',
   components: {
-    STable,
-    Ellipsis,
-    BaseForm,
-    Detail,
-    DownloadModal,
-    PreviewModal,
-    PrintSbCode,
-    ImportFormAdd
-  },
-  props: {
-    filter: {
-      type: Number,
-      default: -1
-    }
-  },
-  data () {
-    return {
-      // 查询参数
-      queryParam: {
-        filter: this.filter,
-        useType: this.DictCache.VALUE.SB_USE_TYPE.TZSB
-      },
-      depreciationTypeMap: {},
-      visible: true,
-      levelMap: {},
-      unitMap: {},
-      areaList: {},
-      companyList: {},
-      projectList: {},
-      deptList: {},
-      useTypeMap: {},
-      statusMap: {},
-      expandedKeys: [],
-      selectedKeys: [],
-      sourceTypeMap: {},
-      treeData: [],
-      // 表头
-      columns: [
-        {
-          title: '序号',
-          dataIndex: 'index',
-          checked: true,
-          customRender: (text, record, index) => {
-            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
-          }
-        },
-        {
-          title: '设备名称',
-          checked: true,
-          dataIndex: 'name'
-        },
-        {
-          title: '设备编号',
-          dataIndex: 'no',
-          checked: true
-        },
-        {
-          title: '设备类型',
-          checked: true,
-          dataIndex: 'type',
-          customRender: (text, record, index) => {
-            return record.typeName
-          }
-        },
-        {
-          title: '设备等级',
-          checked: true,
-          dataIndex: 'level',
-          customRender: (text, record, index) => {
-            return this.BaseTool.Object.getField(this.levelMap, text)
-          }
-        },
-        {
-          title: '设备原值',
-          dataIndex: 'initialValue',
-          customRender: (text, record, index) => {
-            return this.BaseTool.Amount.formatter(text)
-          }
-        },
-        {
-          title: '购置日期',
-          dataIndex: 'buyDate'
-        },
-        {
-          title: '投用日期',
-          dataIndex: 'startDate'
-        },
-        {
-          title: '下次检定日期',
-          dataIndex: 'nextCheckDate'
-        },
-
-        {
-          title: '状态',
-          checked: true,
-          dataIndex: 'status',
-          scopedSlots: { customRender: 'status' }
-        },
-        {
-          title: '操作',
-          key: 'action',
-          checked: true,
-          align: 'center',
-          width: '300',
-          scopedSlots: { customRender: 'action' }
-        }
-      ],
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        parameter = {
-          ...parameter,
-          ...this.queryParam,
-          dataScope: {
-            sortBy: 'desc',
-            sortName: 'update_time'
-          }
-        }
-        return getSbInfoPage(Object.assign(parameter, this.queryParam))
-          .then(res => {
-            return res.data
-          })
-      },
-      selectedRowKeys: [],
-      selectedRows: [],
-
-      options: {
-        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
-        rowSelection: {
-          selectedRowKeys: this.selectedRowKeys,
-          onChange: this.onSelectChange
-        }
-      },
-      optionAlertShow: false
-    }
-  },
-  created () {
-    this.tableOption()
-    this.depreciationTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_DEPRECIATIONTYPE)
-    this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_LEVEL)
-    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
-    this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
-    this.sourceTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBTYPE_SOURCETYPE)
-    this.useTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_USE_TYPE)
-  },
-  methods: {
-    tableOption () {
-      this.setTree()
-      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]
-      }
-      deleteSbInfos(ids).then(res => {
-        this.$message.info('删除成功')
-        this.handleOk()
-        this.$refs.table.clearSelected()
-      })
-    },
-    handleEdit (record) {
-      fetchSbInfo({ id: record.id }).then(res => {
-        this.visible = false
-        const modal = this.$refs.baseModal
-        modal.base(res.data)
-      })
-    },
-    printQcode (record) {
-      let recordList = []
-      console.log(record, this.selectedRows)
-      if (this.BaseTool.String.isBlank(record)) {
-        const length = this.selectedRows.length
-        if (length === 0) {
-          this.$message.info('请选择要打印的记录')
-          return
-        }
-        recordList = this.selectedRows
-      } else {
-        recordList = [record]
-      }
-      this.$refs.printSbCode.base(recordList)
-    },
-    handleStart (record) {
-      record.status = 2
-      updateSbInfo(record).then(res => {
-        this.$message.info('已启用')
-      })
-    },
-    handleStop (record) {
-      record.status = 7
-      updateSbInfo(record).then(res => {
-        this.$message.info('已停用')
-      })
-    },
-    handleAdd () {
-      this.visible = false
-      this.$refs.baseModal.base()
-    },
-    handleView (record) {
-      fetchSbInfo({ id: record.id }).then(res => {
-        this.visible = false
-        const modal = this.$refs.detailModal
-        modal.base(res.data)
-      })
-    },
-    handleAreaChange (value) {
-      getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.FEN_GONG_SI }).then(res => {
-        this.companyList = res.data
-      })
-    },
-    handleCompanyChange (value) {
-      getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.XIANG_MU_BU }).then(res => {
-        this.projectList = res.data
-      })
-    },
-    handleProjectChange (value) {
-      getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.BU_MEN }).then(res => {
-        this.deptList = res.data
-      })
-    },
-    handleDeptChange (value) {
-      getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.BAN_ZU }).then(res => {
-        this.groupList = res.data
-      })
-    },
-    handleCopy (record) {
-      this.visible = false
-      fetchSbInfo({ id: record.id }).then(res => {
-        const modal = this.$refs.baseModal
-        res.data.id = null
-        modal.base(res.data)
-      })
-    },
-    handleOk () {
-      this.visible = true
-      this.setTree()
-      this.$refs.table.refresh()
-    },
-    onSelectChange (selectedRowKeys, selectedRows) {
-      this.selectedRowKeys = selectedRowKeys
-      this.selectedRows = selectedRows
-    },
-    resetSearchForm () {
-      this.queryParam = {
-        filter: this.filter
-      }
-      this.visible = true
-      this.$refs.table.refresh(true)
-    },
-    doExport () {
-      const parameter = {
-        ...this.queryParam
-      }
-      exportSbInfo(parameter).then(file => {
-        this.BaseTool.UPLOAD.downLoadExportExcel(file)
-      })
-    },
-    setTree (record = {}) {
-      queryDept({ nature: this.DictCache.VALUE.SYS_DEPT_NATURE.JITUAN }).then(res => {
-        this.areaList = res.data
-      })
-      fetchSbTypeTree().then(res => {
-        this.treeData = res.data
-      })
-    },
-    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
-    },
-    handleRepairFilePreview (record) {
-      console.log(record, 87878)
-      this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE)
-    },
-    handleRepairFileDownload (record) {
-      // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE, getDownloadUrl(record.id))
-    },
-    handleUseFilePreview (record) {
-      this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_USEFILE)
-    },
-    handleUseFileDownload (record) {
-      // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_USEFILE, getDownloadUrl(record.id))
-    },
-    handleCheckFilePreview (record) {
-      this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_RECHECKFILE)
-    },
-    handleCheckFileDownload (record) {
-      // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_RECHECKFILE, getDownloadUrl(record.id))
-    },
-    doImport () {
-      if (this.queryParam.useCompany == null) {
-        this.$message.error('请先选择公司')
-        return
-      }
-      if (this.queryParam.useProject == null) {
-        this.$message.error('请先选择项目部')
-        return
-      }
-      this.$refs.importModal.base(this.queryParam.useCompany, this.queryParam.useProject)
-    },
-    doImportDe () {
-      this.queryParam.useCompany = null
-      this.queryParam.useProject = null
-      this.$refs.importModal.base()
-    }
+    SbInfo
   }
 }
 </script>
+
+<style scoped>
+
+</style>

+ 1 - 1
src/views/sb/info/modules/BaseForm.vue

@@ -185,7 +185,7 @@
       <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
         <a-col :lg="12" :md="24" :sm="24">
           <a-form-item
-            label="房间"
+            label="使用位置"
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >

+ 7 - 36
src/views/sb/modelbom/modules/BaseFormSpare.vue

@@ -14,7 +14,9 @@
       <a-form-item v-show="false" >
         <a-input v-decorator="['modelId']" type="hidden"/>
       </a-form-item>
-
+      <a-form-item v-show="false" >
+        <a-input v-decorator="['sbId']" type="hidden"/>
+      </a-form-item>
       <a-form-item v-show="false" >
         <a-input v-decorator="['spareId']" type="hidden"/>
       </a-form-item>
@@ -109,6 +111,7 @@ export default {
     return {
       confirmLoading: false,
       modelId: null,
+      sbId: null,
       spareId: null,
       modalTitle: null,
       form: this.$form.createForm(this),
@@ -157,6 +160,7 @@ export default {
       this.$nextTick(() => {
         setFieldsValue(Object.assign(pick(record, [
           'id',
+          'sbId',
           'modelId',
           'model',
           'name',
@@ -175,7 +179,7 @@ export default {
       this.confirmLoading = false
       this.form.resetFields()
       if (this.BaseTool.Object.isNotBlank(values)) {
-        this.$emit('ok', values)
+        this.$emit('selected', values)
       }
     },
 
@@ -187,25 +191,9 @@ export default {
           this.confirmLoading = false
           return
         }
-        if (this.BaseTool.String.isBlank(values.id)) {
-          addSbModelBom(values)
-            .then((response) => {
-              this.$message.info('添加成功')
-              this.handleCancel(values)
-            }).catch(() => {
-              this.confirmLoading = false
-            })
-        } else {
-          updateSbModelBom(values)
-            .then(() => {
-              this.handleCancel(values)
-            }).catch(() => {
-              this.confirmLoading = false
-            })
-        }
+        this.handleCancel(values)
       })
     },
-
     handleSbSelect () {
       this.$refs.sbInfoSelectModal.base()
     },
@@ -221,24 +209,7 @@ export default {
           'name': row.name
         }))
       })
-    },
-    handleDel () {
-      const data = [...this.data]
-      let ids = []
-      ids = this.selectedRows.map(item => item.bomId)
-
-      // 调取删除接口,批量删除
-      this.confirmLoading = true
-      deleteSbModelBoms(ids)
-        .then(() => {
-          this.data = data.filter(item => !this.selectedRowKeys.includes(item.id))
-          this.handleCancel(values)
-          this.$message.info('删除成功')
-        }).catch(() => {
-          this.confirmLoading = false
-        })
     }
-
   }
 }
 </script>

+ 76 - 29
src/views/sqarepartmanage/sparepartinfo/SparePartInfo.vue

@@ -1,7 +1,7 @@
 <template>
   <a-card :bordered="false">
     <a-row :gutter="8" v-show="visible">
-      <a-col :span="4">
+      <!--      <a-col :span="4">
         <a-tree
           @expand="onExpand"
           :expandedKeys="expandedKeys"
@@ -10,8 +10,8 @@
           :selectedKeys="selectedKeys"
           :treeData="spareTypeTreeData"
         />
-      </a-col>
-      <a-col :span="20">
+      </a-col>-->
+      <a-col :span="24">
         <div class="table-page-search-wrapper">
           <a-form layout="inline">
             <a-row :gutter="48">
@@ -20,6 +20,20 @@
                   <a-input v-model="queryParam.keyword" placeholder="请输入名称/编码"/>
                 </a-form-item>
               </a-col>
+              <a-col :md="8" :sm="24">
+                <a-form-item label="类型">
+                  <a-tree-select
+                    style="width: 100%"
+                    :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
+                    :treeData="spareTypeTreeData"
+                    :treeNodeFilterProp="'title'"
+                    :showSearch="true"
+                    v-model="queryParam.typeId"
+                    placeholder="请选择"
+                  >
+                  </a-tree-select>
+                </a-form-item>
+              </a-col>
               <a-col :md="8" :sm="24">
                 <a-form-item label="规格型号">
                   <a-input v-model="queryParam.ggxh" placeholder="模糊查询"/>
@@ -31,13 +45,13 @@
                 </a-form-item>
               </a-col>
               <a-col :md="8" :sm="24">
-                <a-form-item label="生产商名称">
-                  <a-input v-model="queryParam.producerName" placeholder="模糊查询"/>
+                <a-form-item label="生产商">
+                  <a-input v-model="queryParam.producerName" placeholder="名称模糊查询"/>
                 </a-form-item>
               </a-col>
               <a-col :md="8" :sm="24">
-                <a-form-item label="供应商名称">
-                  <a-input v-model="queryParam.supplierName" placeholder="模糊查询"/>
+                <a-form-item label="供应商">
+                  <a-input v-model="queryParam.supplierName" placeholder="名称模糊查询"/>
                 </a-form-item>
               </a-col>
               <a-col :md="8" :sm="24">
@@ -98,6 +112,7 @@
           rowKey="id"
           :columns="columns"
           :data="loadData"
+          :scroll="{x: 1500, y: BaseTool.Constant.scrollY}"
           :alert="options.alert"
           :rowSelection="options.rowSelection"
           showPagination="auto"
@@ -116,8 +131,8 @@
               </a-popconfirm>
               <a-divider type="vertical" />
               <a @click="handleCopy(record)">复制</a>
-               <a-divider type="vertical" />
-              <a @click="handleDetailBom(record)">BOM信息</a>
+<!--              <a-divider type="vertical" />
+              <a @click="handleDetailBom(record)">BOM信息</a>-->
             </template>
           </span>
         </s-table>
@@ -174,36 +189,40 @@ export default {
       },
       // 表头
       columns: [
-        // {
-        //  title: '备件ID',
-        //  dataIndex: 'id'
-        // },
- /*       {
+        /** {
+          title: '备件ID',
+          dataIndex: 'id'
+         },
+        {
           title: '备件编码',
           dataIndex: 'no'
-        },*/
-        // {
-        //  title: '备件类别',
-        //  dataIndex: 'typeId',
-        //  customRender: (text, record, index) => {
-        //    return record.typeName
-        //  }
-        // },
-     /*   {
-          title: '原厂编号',
-          dataIndex: 'initNo'
-        },*/
+        },**/
+        {
+          title: '备件类别',
+          dataIndex: 'typeId',
+          checked: true,
+          width: '150px',
+          customRender: (text, record, index) => {
+            return record.typeName
+          }
+        },
         {
           title: '备件名称',
-          dataIndex: 'name'
+          dataIndex: 'name',
+          checked: true,
+          width: '150px',
         },
         {
           title: '规格型号',
+          checked: true,
+          width: '150px',
           dataIndex: 'ggxh'
         },
         {
           title: '备件价值',
           dataIndex: 'initialValue',
+          checked: true,
+          width: '150px',
           customRender: (text, record, index) => {
             return this.BaseTool.Amount.formatter(text)
           }
@@ -215,18 +234,26 @@ export default {
         // },
         {
           title: '计量单位',
+          checked: true,
+          width: '150px',
           dataIndex: 'unit'
         },
-        /** {
+        {
           title: '最高库存',
+          checked: true,
+          width: '150px',
           dataIndex: 'maxStock'
         },
         {
           title: '最低库存',
+          checked: true,
+          width: '150px',
           dataIndex: 'minStock'
         },
         {
           title: '等级',
+          checked: true,
+          width: '150px',
           dataIndex: 'level',
           customRender: (text, record, index) => {
             return this.BaseTool.Object.getField(this.levelMap, text)
@@ -234,6 +261,8 @@ export default {
         },
         {
           title: '生产商',
+          checked: true,
+          width: '150px',
           dataIndex: 'producerId',
           customRender: (text, record, index) => {
             return record.producerName
@@ -241,14 +270,20 @@ export default {
         },
         {
           title: '英文名称',
+          checked: true,
+          width: '150px',
           dataIndex: 'englishName'
         },
         {
           title: '助记码',
+          checked: true,
+          width: '150px',
           dataIndex: 'zjm'
         },
         {
           title: '产地',
+          checked: true,
+          width: '150px',
           dataIndex: 'cd',
           customRender: (text, record, index) => {
             return this.BaseTool.Object.getField(this.cdMap, text)
@@ -256,6 +291,8 @@ export default {
         },
         {
           title: '用途',
+          checked: true,
+          width: '150px',
           dataIndex: 'yt',
           customRender: (text, record, index) => {
             return this.BaseTool.Object.getField(this.ytMap, text)
@@ -263,14 +300,21 @@ export default {
         },
         {
           title: '备注',
+          checked: true,
+          width: '150px',
           dataIndex: 'remark'
         },
         {
           title: '创建日期',
+          checked: true,
+          width: '200px',
           dataIndex: 'createdTime'
-        },**/
+        },
         {
           title: '操作',
+          checked: true,
+          width: '250px',
+          fixed: 'right',
           key: 'action',
           align: 'center',
           scopedSlots: { customRender: 'action' }
@@ -367,6 +411,7 @@ export default {
       })
     },
     handleEdit (record) {
+      this.visible = false
       fetchSparePartInfo({ id: record.id }).then(res => {
         const modal = this.$refs.baseModal
         modal.base(res.data)
@@ -378,6 +423,7 @@ export default {
       modal.base(record)
     },
     handleCopy (record) {
+      this.visible = false
       fetchSparePartInfo({ id: record.id }).then(res => {
         const modal = this.$refs.baseModal
         res.data.id = null
@@ -406,6 +452,7 @@ export default {
       })
     },
     handleAdd (record) {
+      this.visible = false
       this.$refs.baseModal.base()
     },
     handleView (record) {

+ 162 - 48
src/views/sqarepartmanage/sparepartinfo/modules/BaseForm.vue

@@ -1,18 +1,14 @@
 <template>
-  <a-modal
-    :title="modalTitle"
-    :width="900"
-    :visible="visible"
-    :confirmLoading="confirmLoading"
-    @cancel="handleCancel">
-<!--    <a-row :gutter="48" slot="extra">
+  <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-row>
     <a-form :form="form">
 
       <a-form-item v-show="false" >
@@ -32,7 +28,7 @@
       <a-form-item v-show="false">
         <a-input v-decorator="['supplierId']" />
       </a-form-item>
-      <title-divider title="类型设置" width="150px"></title-divider>
+      <title-divider title="基础信息" width="100px"></title-divider>
       <row-list :col="2">
         <row-item>
           <a-form-item
@@ -274,7 +270,7 @@
               v-decorator="['minStock']" />
           </a-form-item>
         </row-item>
-        <row-item  v-show="isAdd">
+        <row-item v-show="isAdd">
           <a-form-item
             label="初始库位"
             :labelCol="BaseTool.Constant.labelCol"
@@ -350,18 +346,56 @@
             </a-upload>
           </a-form-item>
         </row-item>
+        <row-item>
+          <a-form-item
+            label="参数"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-textarea
+              v-decorator="['params']" />
+          </a-form-item>
+        </row-item>
         <row-item>
           <a-form-item
             label="备注"
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
-            <a-input
-              v-decorator="['remark', {rules: [{required: false, message: '备注不能为空'}]}]" />
+            <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>
     <p style="color: red">仓库数量初始化注意事项:<br/>
       1:初始化库存仅能选择一个库位入库<br/>
       2:初始化库存仅能新增,如需要修改请在仓库管理->仓库库存中修改数量<br/>
@@ -372,7 +406,9 @@
     <firm-producer-select-modal ref="producerSelectModal" @selected="handleProducerSelected"/>
     <supplier-select-modal ref="supplierSelectModal" @selected="handleSupplierSelected"/>
     <store-select-modal ref="storeSelectModal" @selected="handleStoreSelected"/>
-  </a-modal>
+    <sb-info-select-modal :type="'checkbox'" ref="sbInfoSelectModal" @selected="handleSbSelected"/>
+    <base-form-spare ref="baseModal" @selected="handleDetailSelected"/>
+  </a-card>
 </template>
 
 <script>
@@ -388,20 +424,30 @@ import StoreSelectModal from '@/views/store/store/modules/StoreSelectModal'
 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'
+import BaseFormSpare from '@/views/sb/modelbom/modules/BaseFormSpare'
 export default {
   name: 'BaseSparePartInfo',
   components: {
     FirmProducerSelectModal,
     SupplierSelectModal,
     UploadSpareFile,
-    StoreSelectModal
+    StoreSelectModal,
+    SbInfoSelectModal,
+    BaseFormSpare
   },
   data () {
     return {
       isAdd: false,
       unitName: null,
       unitNameBz: null,
+      rowSelection: {
+        onChange: (selectedRowKeys, selectedRows) => {
+          this.selectedRowKeys = selectedRowKeys
+          this.selectedRows = selectedRows
+        }
+      },
       gg: null,
       storeTreeDate: [],
       uploadUrl: uploadUrl,
@@ -413,6 +459,7 @@ export default {
       visible: false,
       // 下拉框map
       levelMap: {},
+      periodTypeMap: {},
       unitMap: {},
       cdMap: {},
       ytMap: {},
@@ -427,52 +474,50 @@ export default {
       // 表头
       columns: [
         {
-          title: '集团统一编号',
-          dataIndex: 'uniteNo'
+          title: '号',
+          dataIndex: 'model'
         },
         {
-          title: '一级类别',
-          dataIndex: 'parentName'
-        },
-        {
-          title: '一级编码',
-          dataIndex: 'parentNo'
-        },
-        {
-          title: '二级类别',
-          dataIndex: 'middleName'
-        },
-        {
-          title: '二级编码',
-          dataIndex: 'middleNo'
-        },
-        {
-          title: '三级类别',
-          dataIndex: 'childName'
+          title: '名称',
+          dataIndex: 'name'
         },
         {
-          title: '三级编码',
-          dataIndex: 'childNo'
+          title: '新号',
+          dataIndex: 'no'
         },
         {
-          title: '名称',
-          dataIndex: 'name'
+          title: '旧号',
+          dataIndex: 'zbh'
         },
         {
-          title: '名称编码',
-          dataIndex: 'nameNo'
+          title: '更换周期',
+          dataIndex: 'period',
+          customRender: (text, record, index) => {
+            return text + this.BaseTool.Table.getMapText(this.periodTypeMap, record.periodType)
+          }
         },
         {
-          title: '规格',
-          dataIndex: 'ggxh'
+          title: '数量',
+          dataIndex: 'num'
         },
         {
-          title: '规格编码',
-          dataIndex: 'ggNo'
+          title: '操作',
+          key: 'action',
+          checked: true,
+          align: 'center',
+          // fixed: 'right',
+          scopedSlots: { customRender: 'action' }
         }
       ],
       data: [],
-      sbId: null
+      sbId: null,
+      selectedRowKeys: [],
+      selectedRows: [],
+      options: {
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys
+        }
+      }
     }
   },
   props: {
@@ -483,6 +528,7 @@ export default {
     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) {
@@ -500,6 +546,9 @@ export default {
       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)
@@ -565,6 +614,7 @@ export default {
           return
         }
         values.applicationFileList = this.applicationFileList
+        values.detailList = this.data
         // 日期处理
         if (this.BaseTool.String.isBlank(values.id)) {
           addSparePartInfo(values)
@@ -632,12 +682,12 @@ export default {
       fetchSpareTypeTree({ }).then(res => {
         this.spareTypeData = res.data
       })
-      /*querySpareType({ filter: 2, parentId: record.parentTypeId }).then(res => {
+      /* 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
       })
@@ -682,6 +732,58 @@ export default {
         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 ***
@@ -751,6 +853,18 @@ export default {
         }))
       })
     },
+    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 ***

+ 58 - 2
src/views/sqarepartmanage/sparepartinfo/modules/Detail.vue

@@ -36,6 +36,7 @@
       <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>
@@ -52,6 +53,16 @@
         暂无
       </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>
@@ -60,6 +71,7 @@
 
 <script>
 import DetailList from '@/components/tools/DetailList'
+import { selectSbModelListBySpareId } from '@/api/sb/modelbom'
 const DetailListItem = DetailList.Item
 
 export default {
@@ -101,6 +113,7 @@ export default {
         'applicationFileList': [],
         'minStock': null,
         'initStock': null,
+        'params': null,
         'remark': null,
         'createdUserId': null,
         'updateUserId': null,
@@ -108,8 +121,47 @@ export default {
         '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 () {
@@ -118,12 +170,16 @@ export default {
     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

+ 1 - 1
src/views/store/instoreform/modules/BaseForm.vue

@@ -95,7 +95,7 @@
             <a-icon type="plus"/>
             添加
           </a-button>
-        <a-button class="margin-left8" size="small" type="danger" @click="handleDel">
+          <a-button class="margin-left8" size="small" type="danger" @click="handleDel">
             <a-icon type="delete"/>
             删除
           </a-button>

+ 9 - 10
src/views/store/instoreform/modules/Detail.vue

@@ -62,8 +62,8 @@ export default {
       model: {
         'inNo': null,
         'type': null,
-        'storeId':null,
-        'storeName':null,
+        'storeId': null,
+        'storeName': null,
         'totalPrice': null,
         'remark': null,
         'createdUserId': null,
@@ -81,13 +81,13 @@ export default {
             return index + 1
           }
         },
-       // {
-         // title: '入库仓库',
-          //dataIndex: 'storeId',
-          //customRender: (text, record, index) => {
-           // return record.storeName
-          //}
-       // },
+        // {
+        // title: '入库仓库',
+        // dataIndex: 'storeId',
+        // customRender: (text, record, index) => {
+        // return record.storeName
+        // }
+        // },
         {
           title: '备件名称',
           dataIndex: 'spareId',
@@ -133,7 +133,6 @@ export default {
     // 下拉框map
     this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.IN_STORE_FORM_TYPE)
     this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.IN_STORE_FORM_STATUS)
-
   },
   methods: {
     base (record) {