guarantee-lsq 2 years ago
parent
commit
afd70aa70c

+ 3 - 2
src/utils/dict.js

@@ -357,12 +357,13 @@ DictCache.VALUE = {
    */
   CUSTOM_TEMPLATE_SB_REMARK: {
     SB_SCRAP_FORM: 'sb_info_scrap',
-    SB_TRANSFER_FORM: 'sb_info_transfer',
+    SB_ALLOCATE_FORM: 'sb_info_allocate',
     SB_STOP_FORM: 'sb_info_stop'
   },
   SB_INFO_AUDIT_MODEL_NAME: {
     'sb_info_scrap': '设备报废审批', // 报废
-    'sb_info_stop': '设备停用审批' // 停用
+    'sb_info_stop': '设备停用审批', // 停用
+    'sb_info_allocate': '设备调拨审批' // 调拨
   },
   CUSTOM_TEMPLATE_SB_REMARK_NUMBER: {
     SB_FIELD_TYPE: 1,

+ 10 - 3
src/views/activiti/user-model/modules/BaseForm.vue

@@ -56,6 +56,7 @@
             :wrapperCol="BaseTool.Constant.wrapperCol"
           >
             <a-select
+             @change="$event => onChangeType($event)"
               v-decorator="['type', {rules: [{required: true, message: '类型不能为空'}]}]"
               placeholder="请选择">
               <a-select-option
@@ -67,7 +68,7 @@
             </a-select>
           </a-form-item>
         </row-item>
-        <row-item>
+        <row-item v-show='visibleOne'>
           <a-form-item
             label="指定审批人"
             :labelCol="BaseTool.Constant.labelCol"
@@ -99,7 +100,7 @@
             <a-button type="default" style="width: 30%" @click="clearDeptSelect">清空</a-button>
           </a-form-item>
         </row-item>-->
-        <row-item>
+        <row-item v-show='visibleOne'>
           <a-form-item
             label="指定角色"
             :labelCol="BaseTool.Constant.labelCol"
@@ -194,7 +195,8 @@ export default {
       selectedKeys: [],
       roleList: [],
       // 下拉框map
-      typeMap: {}
+      typeMap: {},
+      visibleOne: true
     }
   },
   props: {},
@@ -319,6 +321,11 @@ export default {
       } else {
         this.$emit('ok')
       }
+    },
+    onChangeType (val) {
+      if (val === 8) {
+        this.visibleOne = false
+      }
     }
   }
 }

+ 14 - 1
src/views/sb/allocate-apply/ProjectSbAllocateApply.vue

@@ -1,4 +1,17 @@
 <template>
+  <SbAuditUnifyForm type-str="sb_info_allocate"/>
+</template>
+
+<script>
+import SbAuditUnifyForm from '@/views/sb/scraps/SbAuditUnifyForm'
+export default {
+  name: 'ProjectSbAllocateApply',
+  components: {
+    SbAuditUnifyForm
+  }
+}
+</script>
+<!--<template>
   <sb-allocate-apply :type="1" />
 </template>
 
@@ -10,4 +23,4 @@ export default {
     SbAllocateApply
   }
 }
-</script>
+</script>-->

+ 513 - 0
src/views/sb/scraps/SbAuditUnifyForm.vue

@@ -0,0 +1,513 @@
+<template>
+  <a-card :bordered="false">
+    <div v-show="visible">
+      <div class="table-page-search-wrapper" @keyup.enter="handleEnter">
+        <a-form layout="inline">
+          <a-row :gutter="48" v-show="advanced">
+            <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="设备Id">
+                <a-input v-model="queryParam.sbInfoName" placeholder="设备Id" />
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="状态">
+                <a-select
+                  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-row>
+          <a-row :gutter="48">
+            <a-col :md="24 || 24" :sm="24" style="text-align: right">
+              <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>
+                <a @click="()=>{ this.advanced = !this.advanced}" style="margin-left: 8px">
+                  {{ advanced ? '收起' : '展开' }}
+                  <a-icon :type="advanced ? 'up' : 'down'" />
+                </a>
+              </span>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+
+      <div class="table-operator" style="margin-bottom: 8px;">
+        <a-row>
+          <a-col :md="16">
+            <a-button type="primary" icon="plus" @click="handleAdd()">新增</a-button>
+            <a-button
+              style="margin-left: 8px"
+              type="primary"
+              icon="download"
+              @click="doExport">导出
+            </a-button>
+            <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('sb-scraps-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>
+          </a-col>
+        </a-row>
+      </div>
+
+      <s-table
+        ref="table"
+        size="default"
+        rowKey="id"
+        :columns="columns"
+        :data="loadData"
+        :alert="options.alert"
+        :rowSelection="options.rowSelection"
+        showPagination="auto"
+      >
+        <span slot="action" slot-scope="record">
+          <template>
+            <a @click="handleView(record)">查看</a>
+            <operation-button
+              v-if="record.status != 3"
+              @click="handleEdit(record)"
+            >修改</operation-button>
+            <operation-button
+              v-if="record.status == 1"
+              :type="2"
+              title="是否要删除该条数据?"
+              @confirm="batchDelete(record.id)">删除</operation-button>
+            <operation-button
+              v-if="record.status == 1"
+              :type="2"
+              title="确认提交该条数据?"
+              @confirm="handleStart(record)">提交</operation-button>
+            <operation-button
+              v-if="record.status == 4"
+              :type="2"
+              title="再次提交该条数据?"
+              @confirm="handleStart(record)">再次提交</operation-button>
+            <operation-button
+              :type="2"
+              title="是否要终止审批?"
+              @confirm="handleStop(record)">终止审批</operation-button>
+          </template>
+        </span>
+      </s-table>
+    </div>
+    <base-form ref="baseModal" @ok="handleOk" />
+    <detail ref="detailModal" @ok="handleOk" />
+    <sb-custom-form-view ref='showCustomView' @ok='handleOk'/>
+    <detail-audit-scrap :audit="false" ref="detailAuditScrapModal" @ok="handleOk"/>
+  </a-card>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import BaseForm from './modules/BaseForm'
+import Detail from './modules/Detail'
+import ImageModal from '@/views/activiti/ImageModal'
+import HistoryTable from '@/views/activiti/HistoryTable'
+import DetailAuditScrap from '@/views/sb/scraps/modules/DetailAudit'
+import { fetchCustomFieldTemplateByRemark } from '@/api/customize/fieldTemplate'
+import SbCustomFormView from './modules/SbCustomFormView'
+import { deleteSbScrapForms, fetchSbScrapForm, exportSbScrapForm } from '@/api/sb/scraps'
+import { startSbInfoScrap, stopSbInfoScrapForAudit } from '@/api/activiti/activiti-sb-scrap'
+import { getCustomFieldTemplateDataPage } from '@/api/customize/fieldTemplateData'
+export default {
+  name: 'SbAuditUnifyForm',
+  components: {
+    STable,
+    Ellipsis,
+    BaseForm,
+    ImageModal,
+    HistoryTable,
+    SbCustomFormView,
+    Detail,
+    DetailAuditScrap
+  },
+  props: {
+    typeStr: {
+      type: String,
+      default: null
+    }
+  },
+  data () {
+    return {
+      advanced: false,
+      visible: true,
+      columns: [],
+      // 查询参数
+      queryParam: {
+        type: this.DictCache.VALUE.CUSTOM_TEMPLATE_SB_REMARK_NUMBER.ACTIVITY_FORM,
+        remark: this.typeStr
+      },
+      // 默认报废单表头
+      defaultColumns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '单号',
+          dataIndex: 'no'
+        },
+        {
+          title: '设备名称',
+          dataIndex: 'sbName'
+        },
+        {
+          title: '设备编号',
+          dataIndex: 'sbNo'
+        },
+        {
+          title: '报废原因',
+          dataIndex: 'reason'
+        },
+        {
+          title: '备注',
+          dataIndex: 'dataRemark'
+        },
+        {
+          title: '状态',
+          dataIndex: 'status',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Table.getMapText(this.statusMap, text)
+          }
+        },
+        {
+          title: '申请人',
+          dataIndex: 'createdUserName'
+        },
+        {
+          title: '创建日期',
+          dataIndex: 'createdTime'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      stopColumns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '单号',
+          dataIndex: 'no'
+        },
+        {
+          title: '设备',
+          dataIndex: 'sbId',
+          customRender: (text, record, index) => {
+            return record.sbName
+          }
+        },
+        {
+          title: '维修单',
+          dataIndex: 'repairId'
+        },
+        {
+          title: '申请人',
+          dataIndex: 'createdUserName'
+        },
+        {
+          title: '申请日期',
+          dataIndex: 'createdTime'
+        },
+        {
+          title: '停用日期',
+          dataIndex: 'stopDate'
+        },
+        {
+          title: '停用原因',
+          dataIndex: 'reason'
+        },
+        {
+          title: '状态',
+          dataIndex: 'status',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Table.getMapText(this.statusMap, text)
+          }
+        },
+        {
+          title: '备注',
+          dataIndex: 'dataRemark'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      allocateColumns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '标题',
+          dataIndex: 'title'
+        },
+        {
+          title: '申请部门',
+          dataIndex: 'currentDeptName'
+        },
+        {
+          title: '目标部门',
+          dataIndex: 'targetDeptName'
+        },
+        {
+          title: '状态',
+          dataIndex: 'status',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Table.statusCustomRenderDict(this, text, record,
+              this.DictCache.COLOR.SB_ALLOCATE_APPLY_STATUS, this.statusMap)
+          }
+
+        },
+        {
+          title: '备注',
+          dataIndex: 'dataRemark'
+        },
+        {
+          title: '开始时间',
+          dataIndex: 'startTime'
+        },
+        {
+          title: '结束时间',
+          dataIndex: 'endTime'
+        },
+        {
+          title: '申请人',
+          dataIndex: 'createdUserName'
+        },
+        {
+          title: '申请日期',
+          dataIndex: 'createdTime'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      statusMap: {},
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'update_time'
+          }
+        }
+        return getCustomFieldTemplateDataPage(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 () {
+    // 下拉框map
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.ACTIVITI_FORM_STATUS)
+    this.tableOption()
+    // 根据type决定显示的表头
+    if (this.typeStr === this.DictCache.VALUE.CUSTOM_TEMPLATE_SB_REMARK.SB_SCRAP_FORM) {
+      this.columns = this.defaultColumns
+    } else if (this.typeStr === this.DictCache.VALUE.CUSTOM_TEMPLATE_SB_REMARK.SB_STOP_FORM) {
+      this.columns = this.stopColumns
+    } else if (this.typeStr === this.DictCache.VALUE.CUSTOM_TEMPLATE_SB_REMARK.SB_ALLOCATE_FORM) {
+      this.columns = this.allocateColumns
+    }
+  },
+  methods: {
+    tableOption () {
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: {
+            show: true,
+            clear: () => {
+              this.selectedRowKeys = []
+            }
+          },
+          rowSelection: {
+            selectedRowKeys: this.selectedRowKeys,
+            onChange: this.onSelectChange,
+            getCheckboxProps: record => ({
+              props: {
+                disabled: false,
+                name: record.id
+              }
+            })
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    batchDelete (id) {
+      let ids = []
+      if (this.BaseTool.String.isBlank(id)) {
+        const length = this.selectedRows.length
+        if (length === 0) {
+          this.$message.info('请选择要删除的记录')
+          return
+        }
+        ids = this.selectedRows.map(item => item.id)
+      } else {
+        ids = [id]
+      }
+      deleteSbScrapForms(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleAdd () {
+      this.visible = false
+      const params = { remark: this.typeStr }
+      fetchCustomFieldTemplateByRemark(params).then(res => {
+        const modal = this.$refs.showCustomView
+        modal.base(res.data)
+      })
+    },
+    handleEdit (record) {
+      this.visible = false
+      fetchSbScrapForm({ id: record.id }).then(res => {
+        const modal = this.$refs.baseModal
+        modal.base(res.data)
+      })
+    },
+    handleView (record) {
+      this.visible = false
+      const templateData = JSON.parse(record.data)
+      this.$refs.detailAuditScrapModal.base(record, templateData)
+    },
+    handleOk (values) {
+      this.visible = true
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm () {
+      this.queryParam = {}
+      this.$refs.table.refresh(true)
+    },
+    doExport () {
+      const parameter = {
+        ...this.queryParam
+      }
+      exportSbScrapForm(parameter).then(file => {
+        this.BaseTool.Util.downLoadExportExcel(file)
+      })
+    },
+    handleStart (record) {
+      const templateData = JSON.parse(record.data)
+      if (templateData.processInstanceId === undefined) {
+        templateData.processInstanceId = ''
+      }
+      const modelName = this.DictCache.VALUE.SB_INFO_AUDIT_MODEL_NAME[record.remark]
+      const params = {}
+      params.id = record.id
+      params.processInstanceId = templateData.processInstanceId
+      params.auditModelName = modelName
+      params.auditModelKey = record.remark
+      startSbInfoScrap(params).then(res => {
+        this.$message.info(res.data)
+        this.handleEnter()
+      })
+    },
+    handleViewImage (record) {
+      const modal = this.$refs.imageModal
+      modal.base(record.processInstanceId)
+    },
+    handleViewHistory (record) {
+      const modal = this.$refs.historyModal
+      modal.base(record)
+    },
+    handleStop (record) {
+      this.$message.info('正在终止审批流程,请勿重复点击')
+      this.confirmLoading = true
+      stopSbInfoScrapForAudit({ id: record.id, processInstanceId: record.processInstanceId })
+        .then(() => {
+          this.$message.info('已成功终止审批流程,可以重新发起审批')
+          this.confirmLoading = false
+          this.handleOk()
+        }).catch(() => {
+          this.confirmLoading = false
+        })
+    },
+    handleEnter () {
+      this.$refs.table.refresh(true)
+    },
+    sbIdhandleDetail () {
+      const text = this.$router.resolve({
+        name: 'sbInfo',
+        query: { id: this.model.sbId }
+      })
+      // 打开一个新的页面
+      window.open(text.href, '_blank')
+    }
+  }
+}
+</script>

+ 15 - 5
src/views/sb/scraps/SbScrapForm.vue

@@ -1,3 +1,17 @@
+<template>
+  <SbAuditUnifyForm type-str="sb_info_scrap"/>
+</template>
+
+<script>
+import SbAuditUnifyForm from '@/views/sb/scraps/SbAuditUnifyForm'
+export default {
+  name: 'SbScrapForm',
+  components: {
+    SbAuditUnifyForm
+  }
+}
+</script>
+<!--
 <template>
   <a-card :bordered="false">
     <div v-show="visible">
@@ -116,8 +130,6 @@
     <detail ref="detailModal" @ok="handleOk" />
     <sb-custom-form-view ref='showCustomView' @ok='handleOk'/>
     <detail-audit-scrap :audit="false" ref="detailAuditScrapModal" @ok="handleOk"/>
-<!--    <image-modal ref="imageModal"/>-->
-<!--    <history-table ref="historyModal"/>-->
   </a-card>
 </template>
 
@@ -311,9 +323,6 @@ export default {
       })
     },
     handleView (record) {
-      /*this.visible = false
-      const modal = this.$refs.detailModal
-      modal.base(record)*/
       this.visible = false
       const templateData = JSON.parse(record.data)
       this.$refs.detailAuditScrapModal.base(record, templateData)
@@ -388,3 +397,4 @@ export default {
   }
 }
 </script>
+-->

+ 27 - 20
src/views/sb/scraps/modules/DetailAudit.vue

@@ -8,6 +8,24 @@
       </a-col>
     </a-row>
     <detail-list title="" :col="2">
+      <detail-list-item term="类型">{{ model.auditName }}</detail-list-item>
+      <detail-list-item term="状态">{{ BaseTool.Object.getField(this.statusMap,model.status) }}</detail-list-item>
+      <detail-list-item term="申请人">{{ model.createdUserName }}</detail-list-item>
+      <detail-list-item term="申请日期">{{ model.createdTime }}</detail-list-item>
+    </detail-list>
+    <detail-list title="申请详情" :col="2" v-for="(item, index) in recordData" :key="index">
+      <detail-list-item :term="item.label">{{ item.no }}</detail-list-item>
+      <detail-list-item term="设备Id"><a @click="sbIdhandleDetail">{{ model.sbId }}</a></detail-list-item>
+      <detail-list-item term="设备编号">{{ model.sbNo }}</detail-list-item>
+      <detail-list-item term="设备名称">{{ model.sbName }}</detail-list-item>
+      <detail-list-item term="报废原因">{{ model.reason }}</detail-list-item>
+      <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
+      <detail-list-item term="状态">{{ BaseTool.Object.getField(this.statusMap,model.status) }}</detail-list-item>
+      <detail-list-item term="申请人">{{ model.applyUserId }}</detail-list-item>
+      <detail-list-item term="创建日期">{{ model.createdTime }}</detail-list-item>
+      <detail-list-item term="更新日期">{{ model.updateTime }}</detail-list-item>
+    </detail-list>
+    <detail-list v-show='sbInfoAllocate' title="申请详情附件" :col="2">
       <detail-list-item term="单号">{{ model.no }}</detail-list-item>
       <detail-list-item term="设备Id"><a @click="sbIdhandleDetail">{{ model.sbId }}</a></detail-list-item>
       <detail-list-item term="设备编号">{{ model.sbNo }}</detail-list-item>
@@ -20,12 +38,6 @@
       <detail-list-item term="更新日期">{{ model.updateTime }}</detail-list-item>
     </detail-list>
     <history ref="history" :audit="audit" @ok="handleCancel"></history>
-    <!--    <history
-      :audit="audit"
-      :target-id="task.targetId"
-      :process-instance-id="task.processInstanceId"
-      :task-id="task.taskId"
-      :ok="handleCancel"></history>-->
   </a-card>
 </template>
 
@@ -52,26 +64,19 @@ export default {
       confirmLoading: false,
       mdl: {},
       modalTitle: null,
+      sbInfoAllocate: false,
       visible: false,
       // 下拉框map
       statusMap: {},
       task: {},
       model: {
-        'no': null,
-        'sbId': null,
-        'sbNo': null,
-        'sbName': null,
-        'reason': null,
+        'auditName': null,
         'remark': null,
-        'processInstanceId': null,
         'status': null,
-        'applyUserId': null,
-        'applyUserName': null,
-        'createdUserId': null,
-        'updateUserId': null,
-        'updateUserName': null,
-        'updateTime': null
-      }
+        'createdUserName': null,
+        'createdTime': null
+      },
+      recordData: {}
     }
   },
   created () {
@@ -85,7 +90,9 @@ export default {
       this.visible = true
       this.modalTitle = '详情'
       this.task = record
-      this.model = model
+      this.model = record
+      this.model.auditName = this.DictCache.VALUE.SB_INFO_AUDIT_MODEL_NAME[record.remark]
+      this.recordData = model
       model.id = record.targetId // 将targetId赋给model,带入history,用作提交
       const modal = this.$refs.history
       model.auditModelKey = record.remark

+ 139 - 12
src/views/sb/scraps/modules/SbCustomFormView.vue

@@ -74,19 +74,54 @@
         </row-item>
       </row-list>
     </a-form>
+    <a-tabs v-show='isTransfer' type="card" default-active-key="1">
+      <a-tab-pane key="1" tab="设备列表">
+        <div class="table-operator" style="margin-bottom: 8px;">
+          <a-button size="small" type="primary" @click="handleStandardSelect">
+            <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
+          bordered
+          :data-source="dataSource"
+          :columns="columns"
+          tableLayout="auto"
+          rowKey="id"
+          :scroll="{ x: 1600, y: BaseTool.Constant.scrollY }"
+          :row-selection="rowSelection"
+        >
+          <span slot="action" slot-scope="record">
+            <template>
+              <a @click="handleView(record)">查看</a>
+            </template>
+          </span>
+          <span slot="status" slot-scope="text">
+            <badge :status="DictCache.COLOR.SB_INFO_STATUS[text]" :text="statusMap[text]" />
+          </span>
+        </a-table>
+      </a-tab-pane>
+    </a-tabs>
     <sb-info-select-modal ref="sbInfoSelectModal" @selected="sbInfoHandleSelected"/>
+    <sb-info-select-modal-by-user ref="sbInfoSelectModalByUser" :type="'checkbox'" @selected="handleSbSelected"/>
   </a-modal>
 </template>
 
 <script>
 import SbInfoSelectModal from '@/views/sb/info/modules/SbInfoSelectModal'
-import { addCustomFieldTemplate, updateCustomFieldTemplate } from '@/api/customize/fieldTemplate'
+import SbInfoSelectModalByUser from '@/views/sb/info/modules/SbInfoSelectModalByFilter'
+import { updateCustomFieldTemplate } from '@/api/customize/fieldTemplate'
 import { addCustomFieldTemplateDataForm } from '@/api/customize/fieldTemplateData'
 
 export default {
   name: 'SbCustomFormView',
   components: {
-    SbInfoSelectModal
+    SbInfoSelectModal,
+    SbInfoSelectModalByUser
   },
   data () {
     return {
@@ -100,29 +135,99 @@ export default {
       typeMap: {},
       typeFieldMap: {},
       hiddenFlag: false,
-      remark: null
+      remark: null,
+      isTransfer: false,
+      statusMap: {},
+      // 表头
+      columns: [
+        {
+          title: '设备编号',
+          dataIndex: 'no',
+          width: 200
+        },
+        {
+          title: '设备名称',
+          dataIndex: 'name',
+          width: 200
+        },
+        {
+          title: '设备类型',
+          dataIndex: 'type',
+          width: 200,
+          customRender: (text, record, index) => {
+            return record.typeName
+          }
+        },
+        {
+          title: '设备等级',
+          dataIndex: 'level',
+          width: 200,
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.levelMap, text)
+          }
+        },
+        {
+          title: '生产商',
+          dataIndex: 'producerId',
+          width: 200,
+          customRender: (text, record, index) => {
+            return record.producerName
+          }
+        },
+        {
+          title: '规格型号',
+          dataIndex: 'guigeId',
+          width: 200,
+          customRender: (text, record, index) => {
+            return record.guigeName
+          }
+        },
+        {
+          title: '状态',
+          dataIndex: 'status',
+          width: 200,
+          scopedSlots: { customRender: 'status' }
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          fixed: 'right',
+          scopedSlots: { width: 200, customRender: 'action' }
+        }
+      ],
+      dataSource: [],
+      selectedRowKeys: [],
+      selectedRows: [],
+      options: {
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys
+        }
+      }
     }
   },
   created () {
     // 下拉框map
     this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CUSTOM_FIELD_TEMPLATE_TYPE)
     this.typeFieldMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CUSTOM_FIELD_TEMPLATE_FILED_TYPE)
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
   },
   methods: {
     base (data) {
       this.visible = true
       this.modalTitle = '审批单'
       this.remark = data.remark
+      if (this.remark === this.DictCache.VALUE.CUSTOM_TEMPLATE_SB_REMARK.SB_ALLOCATE_FORM) {
+        this.isTransfer = true
+      }
       this.data = JSON.parse(data.content)
-    },
-    setData (values) {
-      const dataList = [...this.data]
-      dataList.forEach((item) => {
-        if (item.type !== 4) {
-          item.value = values[item.fieldName]
-        }
-      })
-      return dataList
+      // 调拨单处理
+      if (this.data.sbInfos !== null && this.data.sbInfos !== undefined) {
+        this.dataSource = JSON.parse(this.data.sbInfos)
+      } else {
+        this.dataSource = []
+      }
     },
     handleCancel (values) {
       this.visible = false
@@ -172,6 +277,9 @@ export default {
         if (values.stopDate !== null && values.stopDate !== undefined) {
           values.stopDate = this.BaseTool.Date.formatter(values.stopDate, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
         }
+        if (this.dataSource.length > 0) { // 调拨单
+          values.sbInfos = JSON.stringify(this.dataSource)
+        }
         const content = JSON.stringify(values)
         const obj = {}
         obj.type = this.DictCache.VALUE.CUSTOM_TEMPLATE_SB_REMARK_NUMBER.ACTIVITY_FORM
@@ -195,6 +303,25 @@ export default {
             })
         }
       })
+    },
+    handleStandardSelect () {
+      this.$refs.sbInfoSelectModalByUser.base({ notStatusList: [this.DictCache.VALUE.SB_INFO_STATUS.IN_DIAOBO] })
+    },
+    handleSbSelected (keys, rows) {
+      const { dataSource } = this
+      const len = dataSource.length
+      for (let i = 0; i < rows.length; i++) {
+        const row = rows[i]
+        let flag = false
+        for (let j = 0; j < len; j++) {
+          if (row.id === dataSource[j].id) {
+            flag = true
+          }
+        }
+        if (!flag) {
+          dataSource.push(row)
+        }
+      }
     }
   }
 }

+ 17 - 2
src/views/sb/stop-detail/SbInfoStopDetail.vue

@@ -1,3 +1,17 @@
+<template>
+  <SbAuditUnifyForm type-str="sb_info_stop"/>
+</template>
+
+<script>
+import SbAuditUnifyForm from '@/views/sb/scraps/SbAuditUnifyForm'
+export default {
+  name: 'SbScrapForm',
+  components: {
+    SbAuditUnifyForm
+  }
+}
+</script>
+<!--
 <template>
   <a-card :bordered="false">
     <div v-show="visible">
@@ -104,7 +118,7 @@
               title="是否要终止审批?"
               @confirm="handleStop(record)">终止审批</operation-button>
           </template>
-<!--          <template>
+&lt;!&ndash;          <template>
             <a @click="handleView(record)">查看</a>
             <operation-button
               v-if="$auth('sb-stop-details-edit')"
@@ -115,7 +129,7 @@
               :type="2"
               title="是否要删除该条数据?"
               @confirm="batchDelete(record.id)">删除</operation-button>
-          </template>-->
+          </template>&ndash;&gt;
         </span>
       </s-table>
     </div>
@@ -383,3 +397,4 @@ export default {
   }
 }
 </script>
+-->