xiongchao 3 роки тому
батько
коміт
adcf371abe

+ 16 - 0
src/api/sb/modelbom.js

@@ -64,6 +64,22 @@ export function selectSpareInfoListBySbId (parameter) {
   })
 }
 
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function selectSpareInfoPageListBySbId (parameter) {
+  return axios({
+    url: '/sb/model-spare-boms/sbpage/' + parameter.sbId,
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
 /**
  * page func
  * parameter: { }

+ 1 - 0
src/views/Login.vue

@@ -3,6 +3,7 @@
     <div class="fh-login">
       <div class="fh-login-left">
         <h2 style='padding-bottom: 0px'>CNTHB</h2>
+        <h2 style='padding-bottom: 0px'>HITACHI ABB</h2>
         <h2 style='font-size:30px'>设备管理系统</h2>
       </div>
       <div class="fh-login-right">

+ 39 - 14
src/views/check/checkjob/CheckJob.vue

@@ -72,6 +72,7 @@
         size="default"
         rowKey="id"
         :columns="columns"
+        :scroll="{x: 1, y: BaseTool.Constant.scrollY }"
         :data="loadData"
         :alert="options.alert"
         :rowSelection="options.rowSelection"
@@ -158,12 +159,20 @@ export default {
           customRender: (text, record, index) => {
             return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
           },
-          checked: true
+          checked: true,
+          width: '100px'
+        },
+        {
+          title: '设备新号',
+          dataIndex: 'sbNo',
+          checked: true,
+          width: '150px'
         },
         {
-          title: '设备',
+          title: '设备名称',
           dataIndex: 'sbName',
-          checked: true
+          checked: true,
+          width: '200px'
         },
         // {
         // title: '计划单号',
@@ -173,12 +182,14 @@ export default {
         {
           title: '任务名称',
           dataIndex: 'name',
-          checked: true
+          checked: true,
+          width: '200px'
         },
         {
           title: '计划周期',
           dataIndex: 'period',
           checked: true,
+          width: '150px',
           customRender: (text, record, index) => {
             return text + this.BaseTool.Table.getMapText(this.periodTypeMap, record.periodType)
           }
@@ -191,7 +202,8 @@ export default {
         {
           title: '负责人',
           dataIndex: 'checkUserName',
-          checked: true
+          checked: true,
+          width: '150px'
         },
 
         // {
@@ -202,32 +214,44 @@ export default {
         {
           title: '执行日期',
           dataIndex: 'startTime',
-          checked: true
+          checked: true,
+          width: '200px'
         },
-        {
+      /*  {
           title: '截至日期',
           dataIndex: 'endTime',
-          checked: true
-        },
+          checked: true,
+          width: '200px'
+        },*/
         {
           title: '标准工时',
-          dataIndex: 'standardHours'
+          dataIndex: 'standardHours',
+          checked: true,
+          width: '200px'
         },
         {
           title: '实际工时',
-          dataIndex: 'realHours'
+          dataIndex: 'realHours',
+          checked: true,
+          width: '200px'
         },
         {
           title: '实际开始时间',
-          dataIndex: 'actualStartTime'
+          dataIndex: 'actualStartTime',
+          checked: true,
+          width: '200px'
         },
         {
           title: '实际结束时间',
-          dataIndex: 'actualEndTime'
+          dataIndex: 'actualEndTime',
+          checked: true,
+          width: '200px'
         },
         {
           title: '任务状态',
           dataIndex: 'status',
+          width: '100px',
+          fixed: 'right',
           checked: true,
           scopedSlots: { customRender: 'status' }
         },
@@ -249,7 +273,8 @@ export default {
         {
           title: '操作',
           key: 'action',
-          width: '200px',
+          width: '150px',
+          fixed: 'right',
           align: 'center',
           scopedSlots: { customRender: 'action' },
           checked: true

+ 16 - 4
src/views/check/checkstandard/CheckStandard.vue

@@ -142,34 +142,46 @@ export default {
           title: '序号',
           dataIndex: 'index',
           width: '100px',
+          checked: true,
           customRender: (text, record, index) => {
             return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
           }
         },
+        {
+          title: '设备新号',
+          dataIndex: 'sbNo',
+          checked: true,
+          width: '100px'
+        },
         {
           title: '设备名称',
           dataIndex: 'sbName',
+          checked: true,
           width: '150px'
         },
         {
           title: '设备新号',
           dataIndex: 'sbNo',
+          checked: true,
           width: '150px'
         },
         {
           title: '部位',
           dataIndex: 'partName',
+          checked: true,
           width: '200px'
         },
         {
           title: '标准名称',
           dataIndex: 'name',
+          checked: true,
           width: '250px'
         },
         {
           title: '计划周期',
           dataIndex: 'period',
           width: '100px',
+          checked: true,
           fixed: 'right',
           customRender: (text, record, index) => {
             return text + this.BaseTool.Table.getMapText(this.periodTypeMap, record.periodType)
@@ -204,12 +216,14 @@ export default {
         {
           title: '创建时间',
           dataIndex: 'createdTime',
+          checked: true,
           width: '250px'
         },
         {
           title: '操作',
           key: 'action',
           width: '250px',
+          checked: true,
           fixed: 'right',
           align: 'center',
           scopedSlots: { customRender: 'action' }
@@ -307,10 +321,8 @@ export default {
       })
     },
     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)
     },
     handleView (record) {
       fetchCheckStandard({ id: record.id }).then(res => {

+ 170 - 314
src/views/check/checkstandard/modules/BaseForm.vue

@@ -15,7 +15,7 @@
       </a-form-item>
 
       <row-list :col="2">
-        <row-item>
+        <!--        <row-item>
           <a-form-item
             label="编码"
             :labelCol="BaseTool.Constant.labelCol"
@@ -25,10 +25,23 @@
               disabled
               v-decorator="['no', {rules: [{required: false, message: '编码不能为空'}]}]"/>
           </a-form-item>
+        </row-item>-->
+        <row-item>
+          <a-form-item
+            label="设备编号"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              disabled
+              style="width: 80%"
+              v-decorator="['sbNo', {rules: [{required: false, message: '请选择设备'}]}]"/>
+            <a-button type="primary" style="width: 20%" @click="handleSbSelect">选择</a-button>
+          </a-form-item>
         </row-item>
         <row-item>
           <a-form-item
-            label="任务名称"
+            label="标准名称"
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
@@ -45,7 +58,7 @@
             <a-input
               disabled
               style="width: 80%"
-              v-decorator="['partName', {rules: [{required: false, message: '检查部位不能为空'}]}]"/>
+              v-decorator="['partName']"/>
             <a-button type="primary" style="width: 20%" @click="handlePartSelect">选择</a-button>
           </a-form-item>
         </row-item>
@@ -101,7 +114,8 @@
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
             <a-input
-              v-decorator="['standardHours']" suffix="分钟"/>
+              v-decorator="['standardHours']"
+              suffix="分钟"/>
           </a-form-item>
         </row-item>
         <row-item>
@@ -111,11 +125,11 @@
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
             <a-input-number
-              :step='1'
+              :step="1"
               v-decorator="['sort', {initialValue: 1,rules: [{required: true, message: '排序不能为空'}]}]"/>
           </a-form-item>
         </row-item>
-<!--        <row-item>
+        <!--        <row-item>
           <a-form-item
             label="动作类型"
             :labelCol="BaseTool.Constant.labelCol"
@@ -237,193 +251,69 @@
         </row-item>
       </row-list>
     </a-form>
-<!--    <a-tabs type="card" default-active-key="1">
-      <a-tab-pane key="1" tab="点检标准参数">
-        <div class="table-operator">
-          <a-button size="small" type="primary" @click="handleAdd">
-            <a-icon type="plus"/>
-            添加
-          </a-button>
-          <a-button class="margin-left8" size="small" type="danger" @click="handleDel">
-            <a-icon type="delete"/>
-            删除
-          </a-button>
+    <title-divider title="关联备件" width="100px"></title-divider>
+    <div class="table-operator">
+      <a-button style="margin-left:8px;" type="primary" @click="handleSpareSelect">
+        <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
+      ref="table"
+      tableLayout="auto"
+      :row-selection="rowSelection"
+      rowKey="bomId">
+      <template slot="num" slot-scope="text, record">
+        <div class="editable-cell-input-wrapper">
+          <a-input :value="text" :id="record.spareId + ',num'" @change="$event => onQuantityChange($event, record.id, 'num')" />
         </div>
-        <a-table
-          bordered
-          :data-source="data"
-          :columns="columns"
-          tableLayout="auto"
-          rowKey="id"
-          :row-selection="rowSelection">
-          <template
-            slot="name"
-            slot-scope="text, record, index"
-          >
-            <div>
-              <a-input
-                class="my-form-item-required"
-                v-if="record.editable"
-                style="margin: -5px 0"
-                :value="text"
-                @change="e => handleChange(e.target.value, record.id, 'name')"
-              />
-              <template v-else>
-                {{ text }}
-              </template>
-            </div>
-          </template>
-
-          <template
-            slot="type"
-            slot-scope="text, record, index"
-          >
-            <div>
-              <a-select
-                v-if="record.editable"
-                style="width: 80px"
-                :defaultValue="1"
-                @change="e => handleChange(e, record.id, 'type')"
-                placeholder="请选择">
-                <a-select-option
-                  v-for="(label,value) in paramTypeMap"
-                  :key="value"
-                  :label="label"
-                  :value="parseInt(value)">{{ label }}
-                </a-select-option>
-              </a-select>
-              <template v-else>
-                {{ BaseTool.Table.getMapText(paramTypeMap, text) }}
-              </template>
-            </div>
-          </template>
-
-          <template
-            slot="upperLimit"
-            slot-scope="text, record, index"
-          >
-            <div>
-              <a-input
-                v-if="record.editable"
-                style="margin: -5px 0"
-                :value="text"
-                @change="e => handleChange(e.target.value, record.id, 'upperLimit')"
-              />
-              <template v-else>
-                {{ text }}
-              </template>
-            </div>
-          </template>
-
-          <template
-            slot="lowerrLimit"
-            slot-scope="text, record, index"
-          >
-            <div>
-              <a-input
-                v-if="record.editable"
-                style="margin: -5px 0"
-                :value="text"
-                @change="e => handleChange(e.target.value, record.id, 'lowerrLimit')"
-              />
-              <template v-else>
-                {{ text }}
-              </template>
-            </div>
-          </template>
-
-          <template
-            slot="referenceValue"
-            slot-scope="text, record, index"
-          >
-            <div>
-              <a-input
-                v-if="record.editable"
-                style="margin: -5px 0"
-                :value="text"
-                @change="e => handleChange(e.target.value, record.id, 'referenceValue')"
-              />
-              <template v-else>
-                {{ text }}
-              </template>
-            </div>
-          </template>
-
-          <template
-            slot="normalSelection"
-            slot-scope="text, record, index"
-          >
-            <div>
-              <a-input
-                v-if="record.editable"
-                style="margin: -5px 0"
-                :value="text"
-                @change="e => handleChange(e.target.value, record.id, 'normalSelection')"
-              />
-              <template v-else>
-                {{ text }}
-              </template>
-            </div>
-          </template>
-
-          <template
-            slot="instruction"
-            slot-scope="text, record, index"
-          >
-            <div>
-              <a-input
-                v-if="record.editable"
-                style="margin: -5px 0"
-                :value="text"
-                @change="e => handleChange(e.target.value, record.id, 'instruction')"
-              />
-              <template v-else>
-                {{ text }}
-              </template>
-            </div>
-          </template>
-
-          <template slot="operation" slot-scope="text, record, index">
-            <div class="editable-row-operations">
-              <span v-if="record.editable">
-                <a @click="() => saveParam(record.id)">保存</a>
-                <a-divider type="vertical"/>
-                <a-popconfirm title="确定取消吗?" @confirm="() => cancel(record.id)">
-                  <a>取消</a>
-                </a-popconfirm>
-              </span>
-              <span v-else>
-                <a :disabled="editingKey !== ''" @click="() => edit(record.id)">编辑</a>
-              </span>
-            </div>
-          </template>
-        </a-table>
-      </a-tab-pane>
-    </a-tabs>-->
+      </template>
+      <span slot="action" slot-scope="record">
+        <template>
+<!--          <a @click="handleDetailSelect(record)">修改</a>
+          <a-divider type="vertical" />-->
+          <a-popconfirm title="是否要删除该条数据?" @confirm="handleDelOne(record)">
+            <a>删除</a>
+          </a-popconfirm>
+        </template>
+      </span>
+    </a-table>
     <template slot="footer">
       <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
     </template>
     <part-info-select-modal ref="partInfoSelectModal" @selected="handlePartSelected"/>
+    <sb-info-select-modal ref="sbInfoSelectModal" @selected="handleSbSelectd"/>
+    <spare-part-info-select-modal-sb-info :type="'checkbox'" ref="spareSelectModal" @selected="handleSpareSelected"/>
   </a-modal>
 </template>
 
 <script>
 import pick from 'lodash.pick'
 import { STable, Ellipsis } from '@/components'
-import { addCheckStandard, updateCheckStandard } from '@/api/check/checkstandard'
-import BaseTool from '../../../../utils/tool'
+import { addCheckStandard, fetchCheckStandard, updateCheckStandard } from '@/api/check/checkstandard'
 import { queryUser } from '@/api/upms/user'
 import { uploadUrl } from '@/api/upms/file'
 import PartInfoSelectModal from '@/views/part/info/modules/PartInfoSelectModal'
 import Vue from 'vue'
 import { ACCESS_TOKEN } from '@/store/mutation-types'
+import SparePartInfoSelectModalSbInfo from '@/views/sqarepartmanage/sparepartinfo/modules/SparePartInfoSelectModalSbInfo'
+import SbInfoSelectModal from '@/views/sb/info/modules/SbInfoSelectModal'
 
 export default {
   name: 'BaseCheckStandard',
   components: {
     STable,
     Ellipsis,
-    PartInfoSelectModal
+    SbInfoSelectModal,
+    PartInfoSelectModal,
+    SparePartInfoSelectModalSbInfo
   },
   data () {
     return {
@@ -431,6 +321,7 @@ export default {
       modalTitle: null,
       form: this.$form.createForm(this),
       visible: false,
+      sbId: null,
       // 下拉框map
       typeMap: {},
       actionTypeMap: {},
@@ -455,53 +346,27 @@ export default {
       },
       // 表头
       columns: [
-        {
-          title: '序号',
-          dataIndex: 'index',
-          customRender: (text, record, index) => {
-            return index + 1
-          }
-        },
         {
           title: '名称',
-          dataIndex: 'name',
-          scopedSlots: { customRender: 'name' }
+          dataIndex: 'spareName'
         },
         {
-          title: '类型',
-          dataIndex: 'type',
-          scopedSlots: { customRender: 'type' }
+          title: '规格型号',
+          dataIndex: 'ggxh'
         },
         {
-          title: '上限',
-          dataIndex: 'upperLimit',
-          scopedSlots: { customRender: 'upperLimit' }
-        },
-        {
-          title: '下限',
-          dataIndex: 'lowerrLimit',
-          scopedSlots: { customRender: 'lowerrLimit' }
-        },
-        {
-          title: '参考值',
-          dataIndex: 'referenceValue',
-          scopedSlots: { customRender: 'referenceValue' }
-        },
-        {
-          title: '正常选型',
-          dataIndex: 'normalSelection',
-          scopedSlots: { customRender: 'normalSelection' }
-        },
-        {
-          title: '说明',
-          dataIndex: 'instruction',
-          scopedSlots: { customRender: 'instruction' }
+          title: '数量',
+          dataIndex: 'num',
+          width: 150,
+          scopedSlots: { customRender: 'num' }
         },
         {
           title: '操作',
-          dataIndex: 'operation',
-          width: 150,
-          scopedSlots: { customRender: 'operation' }
+          key: 'action',
+          checked: true,
+          align: 'center',
+          // fixed: 'right',
+          scopedSlots: { customRender: 'action' }
         }
       ],
       data: [],
@@ -535,6 +400,9 @@ export default {
   methods: {
     base (record, sbId) {
       this.visible = true
+      this.selectedRowKeys = []
+      this.selectedRows = []
+      this.form.resetFields()
       queryUser({}).then(res => {
         this.userList = res.data
       })
@@ -544,6 +412,7 @@ export default {
         this.data = []
         this.cacheData = []
         if (sbId != null) {
+          this.sbId = sbId
           const { form: { setFieldsValue } } = this
           // 日期处理
           this.$nextTick(() => {
@@ -556,33 +425,40 @@ export default {
       if (this.BaseTool.Object.isBlank(record.id)) {
         this.modalTitle = '复制'
       }
+      this.sbId = record.sbId
+      // 查询列表
+      fetchCheckStandard({ id: record.id }).then(res => {
+        this.data = res.data.detailList
+      })
       this.checkImgList = record.checkImgList
       this.checkFileList = record.checkFileList
-      this.defaultCheckImgList = this.BaseTool.UPLOAD.transImg(this.checkImgList)
-      this.defaultCheckFileList = this.BaseTool.UPLOAD.transImg(this.checkFileList)
+      if (this.checkImgList == null) {
+        this.defaultCheckImgList = this.BaseTool.UPLOAD.transImg(this.checkImgList)
+      }
+      if (this.checkImgList == null) {
+        this.defaultCheckFileList = this.BaseTool.UPLOAD.transImg(this.checkFileList)
+      }
       const { form: { setFieldsValue } } = this
       // 日期处理
       this.$nextTick(() => {
         setFieldsValue(Object.assign(pick(record, [
           'id',
           'sbId',
+          'sbNo',
           'name',
-          'no',
-          'type',
+          // 'no',
+          // 'type',
           'period',
           'part',
           'partName',
           'checkUserId',
           'periodType',
-          'actionType',
-          'enable',
+          // 'actionType',
+          // 'enable',
           'requirement',
           'remark'
         ])))
       })
-      this.data = BaseTool.Object.copy(record.paramList)
-      this.cacheData = BaseTool.Object.copy(record.paramList)
-      this.editingKey = ''
     },
     save () {
       const { form: { validateFieldsAndScroll } } = this
@@ -592,10 +468,11 @@ export default {
           this.confirmLoading = false
           return
         }
-        values.paramList = this.data
         // 上传文件
         values.checkImgList = this.checkImgList
         values.checkFileList = this.checkFileList
+        // 备件列表
+        values.detailList = this.data
         if (this.BaseTool.String.isBlank(values.id)) {
           addCheckStandard(values)
             .then(() => {
@@ -615,111 +492,36 @@ export default {
     },
     handleCancel (values) {
       this.visible = false
+      this.data = []
       this.confirmLoading = false
+      this.selectedRowKeys = []
+      this.selectedRows = []
       this.form.resetFields()
       if (this.BaseTool.Object.isNotBlank(values)) {
         this.$emit('ok', values)
       }
     },
-    handleChange (value, key, column) {
-      const newData = [...this.data]
-      const target = newData.filter(item => key === item.id)[0]
-      if (target) {
-        target[column] = value
-        this.data = newData
-      }
-    },
-    edit (key) {
-      const newData = [...this.data]
-      const target = newData.filter(item => key === item.id)[0]
-      this.editingKey = key
-      if (target) {
-        target.editable = true
-        this.data = newData
-      }
-    },
-    saveParam (key) {
-      const newData = [...this.data]
-      const newCacheData = [...this.cacheData]
-      const target = newData.filter(item => key === item.id)[0]
-      // 校验数据
-      if (!this.checkParams(target)) {
-        return false
-      }
-      const targetCache = newCacheData.filter(item => key === item.id)[0]
-      console.log(targetCache, 686688)
-      if (target && targetCache) {
-        delete target.editable
-        this.data = newData
-        Object.assign(targetCache, target)
-        this.cacheData = newCacheData
-      }
-      this.editingKey = ''
+    handleSbSelect () {
+      this.$refs.sbInfoSelectModal.base()
     },
-    checkParams (param) {
-      if (BaseTool.Object.isBlank(param.name)) {
-        this.$message.error('参数名称不能为空')
-        return false
-      }
-      return true
-    },
-    cancel (key) {
-      const newData = [...this.data]
-      const target = newData.filter(item => key === item.id)[0]
-      this.editingKey = ''
-      if (!this.checkParams(target)) {
-        const data = [...this.data]
-        const cacheData = [...this.cacheData]
-        this.data = data.filter(item => item.id !== key)
-        this.cacheData = cacheData.filter(item => item.id !== key)
-        return
-      }
-      if (target) {
-        Object.assign(target, this.cacheData.filter(item => key === item.id)[0])
-        console.log(target, 'target')
-        delete target.editable
-        this.data = newData
-      }
-    },
-    handleAdd () {
-      if (this.editingKey !== '') {
-        this.$message.error('请保存后再添加')
-        return false
-      }
-      const { data, cacheData } = this
-      console.log(this.data, this.cacheData)
-      const newParam = this.getNewParam()
-      const newCache = { ...newParam }
-      data.push(newParam)
-      cacheData.push(newCache)
-    },
-    handleDel () {
-      const data = [...this.data]
-      const cacheData = [...this.cacheData]
-      this.data = data.filter(item => !this.selectedRowKeys.includes(item.id))
-      this.cacheData = cacheData.filter(item => !this.selectedRowKeys.includes(item.id))
-      if (this.selectedRowKeys.includes(this.editingKey)) {
-        this.editingKey = ''
-      }
-    },
-    getNewParam () {
-      const newParam = {
-        name: '',
-        type: '1',
-        upperLimit: '',
-        lowerrLimit: '',
-        referenceValue: '',
-        normalSelection: '',
-        instruction: ''
-      }
-      newParam.id = new Date().getTime()
-      newParam.editable = true
-      this.editingKey = newParam.id
-      console.log(newParam, 'newparam')
-      return newParam
+    handleSbSelectd (keys, rows) {
+      const [ key ] = keys
+      const [ row ] = rows
+      const { form: { setFieldsValue } } = this
+      this.sbId = key
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign({
+          'sbId': key,
+          'sbNo': row.no
+        }))
+      })
     },
     handlePartSelect () {
       const sbId = this.form.getFieldValue('sbId')
+      if (this.BaseTool.Object.isBlank(sbId)) {
+        this.$message.error('请先选择设备')
+      }
       this.$refs.partInfoSelectModal.base({ sbId })
     },
     handlePartSelected (keys, rows) {
@@ -752,6 +554,60 @@ export default {
         this.$message.error('上传失败')
         return null
       }
+    },
+    handleSpareSelect () {
+      this.$refs.spareSelectModal.base(null, { sbId: this.sbId })
+    },
+    handleSpareSelected (record, keys, rows) {
+      const addData = []
+      for (let i = 0; i < rows.length; i++) {
+        addData.push({ sbId: this.sbId, spareId: rows[i].id, spareName: rows[i].name, num: 1 })
+      }
+      const { data } = this
+      for (let i = 0; i < rows.length; i++) {
+        let find = false
+        for (let j = 0; j < data.length; j++) {
+          if (rows[i].spareId === data[j].spareId) {
+            find = true
+            break
+          }
+        }
+        if (!find) {
+          const selectData = {}
+          selectData.spareId = rows[i].spareId
+          selectData.spareName = rows[i].name
+          selectData.ggxh = rows[i].ggxh
+          selectData.sbId = this.sbId
+          selectData.bomId = rows[i].id
+          selectData.num = 1
+          data.push(selectData)
+        }
+      }
+    },
+    handleDel () {
+      const data = [...this.data]
+      if (this.selectedRowKeys.length === 0) {
+        this.$message.error('请至少选择一条数据')
+        return
+      }
+      this.data = data.filter(item => !this.selectedRowKeys.includes(item.bomId))
+    },
+    handleDelOne (record) {
+      const data = [...this.data]
+      this.data = data.filter(item => record.bomId !== item.bomId)
+    },
+    onQuantityChange (e, id, attr) {
+      const value = e.target.value
+      console.log(value)
+      if (value !== 0 && !value) {
+        return
+      }
+      const data = [...this.data]
+      const target = data.find(item => item.id === id)
+      if (target) {
+        target[attr] = value
+        this.data = data
+      }
     }
   }
 }

+ 16 - 32
src/views/check/checkstandard/modules/Detail.vue

@@ -58,6 +58,14 @@
         </a-table>
       </a-tab-pane>
     </a-tabs>-->
+    <title-divider title="关联备件" width="90px"></title-divider>
+    <a-table
+      :data-source="data"
+      :columns="columns"
+      bordered
+      tableLayout="auto"
+      rowKey="bomId">
+    </a-table>
     <template slot="footer">
       <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">返回</a-button>
     </template>
@@ -110,41 +118,17 @@ export default {
       columns: [
         {
           title: '名称',
-          dataIndex: 'name',
-          scopedSlots: { customRender: 'name' }
+          dataIndex: 'spareName'
         },
         {
-          title: '类型',
-          dataIndex: 'type',
-          scopedSlots: { customRender: 'type' }
-          // customRender: (text, record, index) => {
-          //   return this.BaseTool.Table.getMapText(this.typeMap, text)
-          // }
+          title: '规格型号',
+          dataIndex: 'ggxh'
         },
         {
-          title: '上限',
-          dataIndex: 'upperLimit',
-          scopedSlots: { customRender: 'upperLimit' }
-        },
-        {
-          title: '下限',
-          dataIndex: 'lowerrLimit',
-          scopedSlots: { customRender: 'lowerrLimit' }
-        },
-        {
-          title: '参考值',
-          dataIndex: 'referenceValue',
-          scopedSlots: { customRender: 'referenceValue' }
-        },
-        {
-          title: '正常选型',
-          dataIndex: 'normalSelection',
-          scopedSlots: { customRender: 'normalSelection' }
-        },
-        {
-          title: '说明',
-          dataIndex: 'instruction',
-          scopedSlots: { customRender: 'instruction' }
+          title: '数量',
+          dataIndex: 'num',
+          width: 150,
+          scopedSlots: { customRender: 'num' }
         }
       ],
       data: [],
@@ -179,7 +163,7 @@ export default {
       this.visible = true
       this.modalTitle = '详情'
       this.model = record
-      this.data = record.paramList
+      this.data = record.detailList
     },
     handleCancel () {
       this.visible = false

+ 2 - 1
src/views/check/checkstandard/modules/DetailSbCheck.vue

@@ -196,7 +196,8 @@ export default {
     handleEdit (record) {
       fetchCheckStandard({ id: record.id }).then(res => {
         const modal = this.$refs.baseModal
-        modal.base(res.data)
+        res.data.sbNo = this.model.no
+        modal.base(res.data, this.model.id)
       })
     },
     handleCopy (record) {

+ 3 - 7
src/views/sqarepartmanage/sparepartinfo/modules/SparePartInfoSelectModal.vue

@@ -139,10 +139,10 @@ export default {
             return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
           }
         },
-  /*      {
-          title: '编',
+        {
+          title: '编',
           dataIndex: 'no'
-        },*/
+        },
         {
           title: '名称',
           dataIndex: 'name'
@@ -162,10 +162,6 @@ export default {
           title: '计量单位',
           dataIndex: 'unit'
         },
-        {
-          title: '自编号',
-          dataIndex: 'zbh'
-        },
         {
           title: '操作',
           key: 'action',

+ 319 - 0
src/views/sqarepartmanage/sparepartinfo/modules/SparePartInfoSelectModalSbInfo.vue

@@ -0,0 +1,319 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="1000"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    class="ant-modal2"
+    @cancel="handleCancel"
+  >
+    <a-card :bordered="false">
+      <a-row :gutter="8">
+        <a-col :span="5">
+          <a-tree
+            @expand="onExpand"
+            :expandedKeys="expandedKeys"
+            :autoExpandParent="true"
+            @select="onSelect"
+            :selectedKeys="selectedKeys"
+            :treeData="spareTypeTreeData"
+          />
+        </a-col>
+        <a-col :span="19">
+          <div class="table-page-search-wrapper">
+            <a-form layout="inline">
+              <a-row :gutter="48">
+                <a-col :md="6 || 24" :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">
+                  <a-form-item label="">
+                    <a-input v-model="queryParam.ggxh" placeholder="规格型号"/>
+                  </a-form-item>
+                </a-col>
+                <a-col :md="6 || 24" :sm="24">
+                  <a-form-item label="">
+                    <a-input v-model="queryParam.initNo" 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">
+          </div>
+
+          <s-table
+            ref="table"
+            size="default"
+            rowKey="id"
+            :columns="columns"
+            :data="loadData"
+            :alert="options.alert"
+            :customRow="options.customRow"
+            :rowSelection="options.rowSelection"
+            showPagination="auto"
+          >
+            <span slot="action" slot-scope="record">
+              <template>
+                <a @click="handleView(record)">查看</a>
+              </template>
+            </span>
+          </s-table>
+        </a-col>
+      </a-row>
+      <detail ref="detailModal"/>
+    </a-card>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">取消</a-button>
+      <a-button :loading="confirmLoading" type="primary" @click="handleSelect()">选择</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import Detail from './Detail'
+import { selectSpareInfoPageListBySbId } from '@/api/sb/modelbom'
+import { fetchSparePartInfo } from '@/api/sqarepartmanage/sparepartinfo'
+import { fetchSpareTypeTree } from '@/api/sqarepartmanage/sparetype'
+
+export default {
+  name: 'SparePartInfoSelectModal',
+  components: {
+    STable,
+    Ellipsis,
+    Detail
+  },
+  props: {
+    type: {
+      type: String,
+      default: 'radio'
+    },
+    typeName: {
+      type: String,
+      default: ''
+    },
+    selectedRowKey: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    selectedRow: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    }
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      record: null,
+      spareTypeTreeData: [],
+      expandedKeys: [],
+      selectedKeys: [],
+      // 查询参数
+      queryParam: {
+      },
+      extraQueryParam: {
+      },
+      // 表头
+
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '名称',
+          dataIndex: 'name'
+        },
+        {
+          title: '规格型号',
+          dataIndex: 'ggxh'
+        },
+        {
+          title: '备件价值',
+          dataIndex: 'initialValue',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Amount.formatter(text)
+          }
+        },
+        {
+          title: '计量单位',
+          dataIndex: 'unit'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          ...this.extraQueryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'name'
+          }
+        }
+        return selectSpareInfoPageListBySbId(Object.assign(parameter, this.queryParam))
+          .then(res => {
+            if (res.data.total === 0) {
+              this.$message.info('该设备无bom信息,请先添加后关联保养标准')
+            }
+            return res.data
+          })
+      },
+      selectedRowKeys: [],
+      selectedRows: [],
+
+      options: {
+        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: false,
+      isCreated: false
+    }
+  },
+  created () {
+    // 下拉框map
+    this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SPARE_PART_INFO_LEVEL)
+    this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
+  },
+  methods: {
+    tableOption () {
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+          rowSelection: {
+            selectedRowKeys: this.selectedRowKeys,
+            onChange: this.onSelectChange,
+            type: this.type,
+            getCheckboxProps: record => ({
+              props: {
+                disabled: false,
+                name: record.id
+              }
+            })
+          },
+          customRow: (record) => {
+            return {
+              on: { // 事件
+                click: (event) => { // 点击行
+                  // 选择对象
+                  this.mySelect([record.id], [record])
+                },
+                dblclick: (event) => {
+                  this.mySelect([record.id], [record])
+                  this.handleSelect()
+                }
+              }
+            }
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    handleView (record) {
+      fetchSparePartInfo({ id: record.id }).then(res => {
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+    handleOk () {
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm () {
+      this.queryParam = {
+      }
+      this.$refs.table.refresh(true)
+    },
+    base (record, queryParam = {}) {
+      console.log(queryParam)
+      this.visible = true
+      this.modalTitle = '选择信息'
+      this.queryParam = queryParam
+      this.record = record
+      if (!this.BaseTool.Object.isBlank(queryParam.typeName)) {
+        fetchSpareTypeTree({ name: queryParam.typeName }).then(res => {
+          this.spareTypeTreeData = res.data
+        })
+      } else {
+        fetchSpareTypeTree().then(res => {
+          this.spareTypeTreeData = res.data
+        })
+      }
+      if (this.isCreated) {
+        this.$refs.table.clearSelected()
+        this.options.rowSelection.type = this.type
+        this.handleOk()
+      } else {
+        this.tableOption()
+        this.isCreated = true
+      }
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+    },
+    handleSelect () {
+      if (this.selectedRowKeys.length === 0) {
+        this.$message.warn('请至少选择一项信息')
+      } else {
+        this.confirmLoading = true
+        this.$emit('selected', this.record, this.selectedRowKeys, this.selectedRows)
+        this.confirmLoading = false
+        this.visible = false
+      }
+    },
+    mySelect (selectedRowKeys, selectedRows) {
+      this.$refs.table.updateSelect(selectedRowKeys, selectedRows)
+      this.$refs.table.rowSelection.onChange(selectedRowKeys, selectedRows)
+    },
+    onSelect: function (selectedKeys, info) {
+      this.selectedKeys = selectedKeys
+      this.queryParam.typeId = selectedKeys.length > 0 ? selectedKeys[0] : ''
+      this.queryParam.typeName = ''
+      this.$refs.table.refresh(true)
+    },
+    onExpand (expandedKeys) {
+      this.expandedKeys = expandedKeys
+      this.autoExpandParent = false
+    }
+  }
+}
+</script>

+ 1 - 1
src/views/store/instoreform/MyInStoreForm.vue

@@ -1,5 +1,5 @@
 <template>
-  <InStoreForm :filter="0"/>
+  <InStoreForm :filter="-1"/>
 </template>
 
 <script>

+ 1 - 1
src/views/store/outstoreform/MyOutStoreForm.vue

@@ -1,5 +1,5 @@
 <template>
-  <OutStoreForm :filter="0"/>
+  <OutStoreForm :filter="-1"/>
 </template>
 
 <script>

+ 1 - 1
src/views/store/sparepickform/MySparePickForm.vue

@@ -1,5 +1,5 @@
 <template>
-  <SparePickForm :filter="0"/>
+  <SparePickForm :filter="-1"/>
 </template>
 
 <script>