408249787 2 years ago
parent
commit
eae99baf09

+ 16 - 1
src/api/sb/info.js

@@ -387,6 +387,21 @@ export function getPartInfoPositionPage (parameter) {
   })
 }
 
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getChangeLogs (parameter) {
+  return axios({
+    url: '/sb/change-logs/page?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
 /**
  * add batch func
  * parameter: { }
@@ -461,4 +476,4 @@ export function auditProcess (parameter) {
     method: 'PUT',
     data: parameter
   })
-}
+}

+ 17 - 1
src/api/sb/measurelog.js

@@ -34,7 +34,23 @@ export function addCheckStandard (parameter) {
     data: parameter
   })
 }
-
+/**
+ * add func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function addCheckStandardBatch (parameter) {
+  return axios({
+    url: '/sb/measure-logs/batch ',
+    method: 'POST',
+    headers: {
+      'Accept': 'application/json',
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    data: parameter
+  })
+}
 /**
  * update func
  * parameter: { }

+ 9 - 0
src/views/sb/info/SbInfo.vue

@@ -135,6 +135,7 @@
                 修改导入
               </a-button>-->
               <a-button style="margin-left: 8px" type="primary" icon="printer" @click="handlePrintBatch()">批量打印</a-button>
+              <a-button style="margin-left: 8px" type="primary" icon="reload" @click="handleMeasureBatch()">批量检定</a-button>
               <a-button style="margin-left: 8px" v-if="$auth('sb-infos-generate-code-all')" :loading="confirmLoading" type="primary" @click="batchGenerate()">重新生成二维码</a-button>
               <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('sb-infos-del')">
                 <a-menu slot="overlay">
@@ -219,12 +220,15 @@
     <import-form-update ref="importModalUpdate" @ok="handleOk"/>
     <print-sb-code ref="printSbCode"/>
     <print-in-sb-info-batch ref="printInSbInfoBatch" @ok="handleOk"/>
+    <detail-sb-measure ref="detailSbMeasureModal" @ok="handleOk"/>
+
   </div>
 </template>
 
 <script>
 import { STable, Ellipsis } from '@/components'
 import BaseForm from './modules/BaseForm'
+import DetailSbMeasure from '@/views/sb/measurelog/modules/DetailSbCheckBatch'
 import BaseFormStatusLog from '@/views/sb/status-log/modules/BaseForm'
 import Detail from './modules/Detail'
 import DownloadModal from '@/views/download/DownloadModal'
@@ -246,6 +250,7 @@ export default {
     STable,
     Ellipsis,
     BaseForm,
+    DetailSbMeasure,
     Detail,
     DownloadModal,
     PreviewModal,
@@ -603,6 +608,10 @@ export default {
         modal.base([res.data])
       })
     },
+    handleMeasureBatch () {
+      const modal = this.$refs.detailSbMeasureModal
+      modal.base()
+    },
     handlePrintBatch () {
       this.visible = false
       let ids = []

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

@@ -28,7 +28,7 @@
               v-decorator="['no', {rules: [{required: true, message: '不能为空'}]}]" />
           </a-form-item>
         </a-col>
-<!--        <a-col :lg="12" :md="24" :sm="24">
+        <!--        <a-col :lg="12" :md="24" :sm="24">
           <a-form-item
             label="设备(旧号)"
             :labelCol="BaseTool.Constant.labelCol"
@@ -109,7 +109,7 @@
               :step="0.01"
               :formatter="BaseTool.Amount.formatter"
               :parser="BaseTool.Amount.parser"
-              v-decorator="['initialValue', {rules: [{required: true, message: '设备原值不能为空'}]}]" />
+              v-decorator="['initialValue']" />
           </a-form-item>
         </a-col>
       </a-row>
@@ -191,16 +191,16 @@
       </a-row>
 
       <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
-        <!--        <a-col :lg="12" :md="24" :sm="24">
+        <a-col :lg="12" :md="24" :sm="24">
           <a-form-item
-            label="使用位置"
+            label="检定单位"
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
             <a-input
-              v-decorator="['cph']" />
+              v-decorator="['dph', {rules: [{required: true, message: '检定单位不能为空'}]}]" />
           </a-form-item>
-        </a-col>-->
+        </a-col>
         <a-col :lg="12" :md="24" :sm="24">
           <a-form-item
             label="生产商"
@@ -275,7 +275,7 @@
             </a-tree-select>
           </a-form-item>
         </a-col>
-<!--        <a-col :lg="12" :md="24" :sm="24">
+        <!--        <a-col :lg="12" :md="24" :sm="24">
           <a-form-item
             label="是否显示"
             :labelCol="BaseTool.Constant.labelCol"
@@ -292,7 +292,7 @@
           </a-form-item>
         </a-col>-->
       </a-row>
-<!--      <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+      <!--      <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
         <a-col :lg="12" :md="24" :sm="24">
           <a-form-item
             label="水平位置"
@@ -341,7 +341,7 @@
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
-            <a-select v-decorator="['saveUser', {rules: [{required: true, message: '项目部不能为空'}]}]" placeholder="请选择">
+            <a-select v-decorator="['saveUser']" placeholder="请选择">
               <a-select-option
                 v-for="({userId, realName}) in userList"
                 :key="userId"
@@ -512,7 +512,7 @@
               v-decorator="['workYear', {rules: [{required: true, message: '不能为空'}]}]" />
           </a-form-item>
         </a-col>
-<!--        <a-col :lg="12" :md="24" :sm="24">
+        <!--        <a-col :lg="12" :md="24" :sm="24">
           <a-form-item
             label="关联维修部门"
             :labelCol="BaseTool.Constant.labelCol"
@@ -652,7 +652,7 @@
       </div>
       <title-divider v-show="useType == 4" title="计量信息" width="90px"></title-divider>
       <div v-show="useType == 4" >
-<!--        <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
+        <!--        <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
           <a-col :lg="12" :md="24" :sm="24">
             <a-form-item
               label="计量设备编号"
@@ -744,7 +744,7 @@
 
         </a-row>-->
         <a-row class="form-row" :gutter="BaseTool.Constant.row.gutter">
-            <a-col :lg="12" :md="24" :sm="24">
+          <a-col :lg="12" :md="24" :sm="24">
             <a-form-item
               label="上次检定日期"
               :labelCol="BaseTool.Constant.labelCol"

+ 96 - 0
src/views/sb/info/modules/ChangeLogsDetail.vue

@@ -0,0 +1,96 @@
+<template>
+  <a-modal
+    title="维修记录"
+    :width="1300"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    @cancel="handleCancel"
+  >
+    <s-table
+      ref="table"
+      size="default"
+      rowKey="id"
+      bordered
+      :columns="columns"
+      :data="loadData"
+      showPagination="auto"
+    >
+    </s-table>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">确定</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import { getChangeLogs } from '@/api/sb/info'
+import { STable } from '@/components'
+
+export default {
+  name: 'SbModelBomImportForm',
+  components: {
+    STable
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      visible: false,
+      model: {},
+      columns: [
+        {
+          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: 'createdUserName',
+          width: '120px'
+        },
+        {
+          title: '修改时间',
+          dataIndex: 'createdTime',
+          width: '120px'
+        },
+        {
+          title: '修改内容',
+          dataIndex: 'updateJson',
+          width: 120
+        }
+      ],
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          objId: this.model.id,
+          dataScope: {
+            sortBy: 'asc',
+            sortName: 'created_time'
+          }
+        }
+        console.log(parameter)
+        return getChangeLogs(parameter)
+          .then(res => {
+            return res.data
+          })
+      }
+    }
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      console.log(record)
+      this.model = record
+      this.$refs.table.refresh()
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+      this.model = {}
+      this.$emit('ok')
+    }
+  }
+}
+</script>

+ 15 - 2
src/views/sb/info/modules/Detail.vue

@@ -22,7 +22,7 @@
                 <a-button style="margin-left: 20px" type="default" @click="handleViewCheckJob2(1)">点检任务</a-button>
               </a-badge>
 
-<!--              <a-badge :count="numCheckStandard2" title="保养标准" :number-style="{ backgroundColor: '#52c41a' }">
+              <!--              <a-badge :count="numCheckStandard2" title="保养标准" :number-style="{ backgroundColor: '#52c41a' }">
                 <a-button style="margin-left: 20px" type="default" @ok="handleOk" @click="handleViewCheck(2)">保养标准</a-button>
               </a-badge>
               <a-badge :count="numCheckjob2" title="保养任务" :number-style="{ backgroundColor: '#52c41a' }">
@@ -59,6 +59,11 @@
             :height="297"></img-code>
           <a-divider style="background: #D6D6D6" />
           <a-row type="flex" justify="space-between" :gutter="[16,16]">
+            <a-col :span="10">
+              <a-button shape="round" @click="changeLogs()" block>
+                修改记录
+              </a-button>
+            </a-col>
             <a-col :span="10">
               <a-button shape="round" @click="handleRouter(1)" block>
                 配件记录
@@ -102,7 +107,7 @@
                 检点日历
               </a-button>
             </a-col>
-<!--            <a-col :span="10">
+            <!--            <a-col :span="10">
               <a-button shape="round" @click="handleTuiCalendar(2)" block>
                 保养日历
               </a-button>
@@ -271,6 +276,7 @@
       </a-layout>
     </div>
     <base-form ref="baseModal" @ok="handleOk"/>
+    <change-logs-detail ref="changeLogsDetail" @ok="handleOk" />
     <detail-sb-bom ref="detailSbBomModal" @ok="handleOk"/>
     <detail-sb-check ref="detailSbCheckModal" @ok="handleOk"/>
     <detail-sb-check-job ref="detailSbCheckJobModal" @ok="handleOk"/>
@@ -284,6 +290,7 @@
 
 <script>
 import BaseForm from './BaseForm'
+import ChangeLogsDetail from './ChangeLogsDetail'
 import DetailList from '@/components/tools/DetailList'
 import RepairApplicationFormTable from '@/views/repair/application-form/modules/RepairApplicationFormTable'
 import CheckJobTable from '@/views/check/checkjob/modules/CheckJobTable'
@@ -315,6 +322,7 @@ export default {
   name: 'SbInfoDetail',
   components: {
     BaseForm,
+    ChangeLogsDetail,
     DetailList,
     DetailListItem,
     RepairApplicationFormTable,
@@ -520,6 +528,11 @@ export default {
       const routeUrl = this.$router.resolve({ path: '/check-run-job', query: { id: this.model.id, checkType: type } })
       window.open(routeUrl.href, '_blank')
     },
+    changeLogs () {
+      // this.visible = false
+      const modal = this.$refs.changeLogsDetail
+      modal.base(this.model)
+    },
     // 根据keyNum路由相关页面
     handleRouter (keyNum) {
       const id = this.model.id

+ 245 - 0
src/views/sb/measurelog/modules/DetailSbCheckBatch.vue

@@ -0,0 +1,245 @@
+<template>
+  <a-modal
+    title="添加"
+    :width="1200"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    @cancel="handleCancel"
+  >
+    <a-form :form="form">
+      <row-list :col="2">
+        <row-item>
+          <a-form-item
+            label="检定设备"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            {{ sbIds.length }}台
+            <a-button style="width: 30% ;float: right;" type="primary" @click="handleSbSelect">选择</a-button>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="检定日期"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-date-picker
+              style="width: 100%"
+              :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
+              v-decorator="['lastDate', {rules: [{required: true, message: '检定日期不能为空'}]}]" />
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="检定人"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['name']"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="检定单位"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['requirement', {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
+              v-decorator="['remark']" />
+          </a-form-item>
+        </row-item>
+      </row-list>
+      <row-list :col="2">
+        <row-item>
+          <a-form-item
+            label="图片"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-upload
+              :action="uploadUrl"
+              :multiple="false"
+              list-type="picture"
+              accept="image/*"
+              :file-list="this.defaultCheckImgList"
+              @change="handleCheckImgChange"
+              :headers="headers"
+            >
+              <a-button> <a-icon type="upload" /> 选择上传图片 </a-button>
+            </a-upload>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="文件"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-upload
+              :action="uploadUrl"
+              :multiple="true"
+              :file-list="this.defaultCheckFileList"
+              @change="handleCheckFileChange"
+              :headers="headers"
+            >
+              <a-button> <a-icon type="upload" /> 选择上传文件 </a-button>
+            </a-upload>
+          </a-form-item>
+        </row-item>
+      </row-list>
+    </a-form>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
+    </template>
+    <sb-info-select-modal ref="sbInfoSelectModal" :userType="DictCache.VALUE.SB_USE_TYPE.BGCL" type="checkbox" @selected="handleSbSelectd"/>
+
+  </a-modal>
+</template>
+
+<script>
+import { addCheckStandardBatch } from '@/api/sb/measurelog'
+import BaseTool from '../../../../utils/tool'
+import { uploadUrl } from '@/api/upms/file'
+import SbInfoSelectModal from './SbInfoSelectModal'
+import Vue from 'vue'
+import { ACCESS_TOKEN } from '@/store/mutation-types'
+
+export default {
+  name: 'BaseCheckStandard',
+  components: {
+    SbInfoSelectModal
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      form: this.$form.createForm(this),
+      visible: false,
+      sbIds: [],
+      // 下拉框map
+      checkImgList: [], // 图片
+      checkFileList: [], // 文档
+      defaultCheckImgList: [],
+      defaultCheckFileList: [],
+      uploadUrl: uploadUrl,
+      editingKey: '',
+      headers: {
+        Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
+      },
+      cacheData: []
+    }
+  },
+  props: {
+    type: {
+      type: Number,
+      default: 1
+    }
+  },
+  created () {
+    // 下拉框map
+  },
+  methods: {
+    base () {
+      this.visible = true
+    },
+    handleSbSelect () {
+      this.$refs.sbInfoSelectModal.base({}, {})
+    },
+    handleSbSelectd (keys, rows) {
+      console.log(keys)
+      this.sbIds = keys
+    },
+    save () {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        } else if (this.sbIds.length === 0) {
+          console.log(values)
+          this.$message.error('巡检设备不能为空!')
+          return
+        }
+        values.type = this.type
+        values.sbIds = this.sbIds
+        // 上传文件
+        values.checkImgList = this.checkImgList
+        values.checkFileList = this.checkFileList
+        // 日期数据的处理
+        values.lastDate = BaseTool.Date.formatter(values.lastDate, BaseTool.Date.PICKER_NORM_DATE_PATTERN)
+        console.log(values)
+        addCheckStandardBatch(values)
+          .then(() => {
+            this.handleCancel()
+          }).catch(() => {
+            this.confirmLoading = false
+          })
+      })
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      this.$emit('ok')
+    },
+    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
+      }
+    },
+    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
+      }
+    },
+    handleCheckImgChange (info) {
+      this.defaultCheckImgList = info.fileList
+      this.checkImgList = this.setFileList(info, 31)
+    },
+    handleCheckFileChange (info) {
+      this.defaultCheckFileList = info.fileList
+      this.checkFileList = this.setFileList(info, 32)
+    },
+    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 null
+      }
+    }
+  }
+}
+</script>

+ 314 - 0
src/views/sb/measurelog/modules/SbInfoSelectModal.vue

@@ -0,0 +1,314 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="1300"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    class="ant-modal2"
+    @cancel="handleCancel"
+  >
+    <a-card :bordered="false">
+      <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.trim="queryParam.keyword" placeholder="请输入名称/编码"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="8 || 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" style="margin-bottom: 8px;">
+      </div>
+
+      <s-table
+        ref="table"
+        size="default"
+        rowKey="id"
+        :columns="columns"
+        :data="loadData"
+        :alert="options.alert"
+        :customRow="options.customRow"
+        :rowSelection="options.rowSelection"
+        :scroll="{ x: 1300, y: BaseTool.Constant.scrollY }"
+        showPagination="auto"
+      >
+        <span slot="status" slot-scope="text">
+          <badge :status="DictCache.COLOR.SB_INFO_STATUS[text]" :text="statusMap[text]" />
+        </span>
+      </s-table>
+    </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 { getSbInfoPage, getSbInfoTree } from '@/api/sb/info'
+
+export default {
+  name: 'SbInfoSelectModal',
+  components: {
+    STable,
+    Ellipsis
+  },
+  props: {
+    type: {
+      type: String,
+      default: 'radio'
+    },
+    useType: {
+      type: Number,
+      default: 4
+    },
+    selectedRowKey: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    selectedRow: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    }
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      // 查询参数
+      queryParam: {
+      },
+      extraQueryParam: {
+      },
+      depreciationTypeMap: {},
+      levelMap: {},
+      statusMap: {},
+      unitMap: {},
+      useTypeMap: {},
+      sourceTypeMap: {},
+      treeData: [],
+      // 表头
+      columns: [
+        {
+          title: '设备名称',
+          checked: true,
+          dataIndex: 'name'
+        },
+        {
+          title: '设备编号',
+          dataIndex: 'no',
+          checked: true
+        },
+        {
+          title: '型号',
+          checked: true,
+          dataIndex: 'model'
+        },
+        {
+          title: '设备类型',
+          dataIndex: 'type',
+          checked: true,
+          width: 200,
+          customRender: (text, record, index) => {
+            return record.typeName
+          }
+        },
+        {
+          title: '设备等级',
+          dataIndex: 'level',
+          checked: true,
+          width: 200,
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.levelMap, text)
+          }
+        },
+        {
+          title: '检定周期',
+          checked: true,
+          width: 200,
+          dataIndex: 'checkPeriod',
+          customRender: (text, record, index) => {
+            if (record.checkPeriod == null) {
+              return '未知'
+            } else {
+              return text + '月'
+            }
+          }
+        },
+        {
+          title: '状态',
+          dataIndex: 'status',
+          checked: true,
+          width: 200,
+          scopedSlots: { customRender: 'status' }
+        },
+        {
+          title: '备注',
+          dataIndex: 'remark',
+          width: 200
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          fixed: 'right',
+          scopedSlots: { width: 200, customRender: 'action' }
+        }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          ...this.extraQueryParam,
+          useType: this.useType,
+          dataScope: {
+            sortBy: 'asc',
+            sortName: 'no'
+          }
+        }
+        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: true,
+      isCreated: 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_UES_TYPE)
+  },
+  methods: {
+    tableOption () {
+      this.setTree()
+      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
+      }
+    },
+    handleOk () {
+      this.setTree()
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = Array.from(new Set([...selectedRowKeys, ...this.selectedRowKeys]))
+      this.selectedRows = Array.from(new Set([...selectedRows, ...this.selectedRows]))
+    },
+    resetSearchForm () {
+      this.queryParam = {
+      }
+      this.$refs.table.refresh(true)
+    },
+    /**
+     * 设置设备类型树
+     */
+    setTree (record = {}) {
+      getSbInfoTree({ id: record.id }).then(res => {
+        this.treeData = res.data
+      })
+    },
+    base (record, queryParam = {}) {
+      this.visible = true
+      this.modalTitle = '选择设备'
+      this.extraQueryParam = queryParam
+      if (this.isCreated) {
+        console.log(this.$refs.table)
+        this.$refs.table.clearSelected()
+        this.options.rowSelection.type = this.type
+        this.handleOk()
+      } else {
+        this.tableOption()
+        this.isCreated = true
+      }
+      // this.mySelect(this.selectedRowKeys, this.selectedRows)
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+    },
+    handleSelect () {
+      if (this.selectedRowKeys.length === 0) {
+        this.$message.warn('请至少选择一项信息')
+      } else {
+        this.confirmLoading = true
+        this.$emit('selected', this.selectedRowKeys, this.selectedRows)
+        this.confirmLoading = false
+        this.visible = false
+        this.selectedRowKeys = []
+        this.selectedRows = []
+      }
+    },
+    mySelect (selectedRowKeys, selectedRows) {
+      this.$refs.table.updateSelect([...selectedRowKeys, ...this.selectedRowKeys], [...selectedRows, ...this.selectedRows])
+      this.$refs.table.rowSelection.onChange(selectedRowKeys, selectedRows)
+    }
+  }
+}
+</script>