Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/demo_' into demo_

3254194295 2 anni fa
parent
commit
77cdc08453

+ 1 - 1
src/layouts/UserLayout.vue

@@ -21,7 +21,7 @@
         <!--          <a href="_self">条款</a>-->
         <!--        </div>-->
         <div class="copyright">
-          Copyright &copy; 2020 乾元坤和
+          Copyright &copy; 2022 乾元坤和
         </div>
       </div>
     </div>

+ 8 - 2
src/utils/dict.js

@@ -356,8 +356,14 @@ DictCache.VALUE = {
    * 自定义模板之设备备注
    */
   CUSTOM_TEMPLATE_SB_REMARK: {
-    SB_SCRAP_FORM: 'SB_SCRAP_FORM',
-    SB_TRANSFER_FORM: 'SB_TRANSFER_FORM'
+    SB_SCRAP_FORM: 'sb_info_scrap',
+    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_allocate': '设备调拨审批' // 调拨
   },
   CUSTOM_TEMPLATE_SB_REMARK_NUMBER: {
     SB_FIELD_TYPE: 1,

+ 17 - 1
src/views/activiti/History.vue

@@ -78,6 +78,8 @@ export default {
       image2: '',
       refuseReason: '同意',
       auditFlag: 1,
+      auditModelKey: null,
+      auditModelName: null,
       auditColumns: [
         {
           title: '审批人',
@@ -127,6 +129,8 @@ export default {
       this.processInstanceId = record.processInstanceId
       this.historyRecordLoading = true
       this.historyImgLoading = true
+      this.auditModelKey = record.auditModelKey
+      this.auditModelName = this.DictCache.VALUE.SB_INFO_AUDIT_MODEL_NAME[this.auditModelKey]
       this.getAuditRecords(record)
       this.getImage(record)
     },
@@ -176,7 +180,15 @@ export default {
     },
     save () {
       this.confirmLoading = true
-      auditSbInfoScrapForAudit({ id: this.targetId, processInstanceId: this.processInstanceId, refuseReason: this.refuseReason, auditFlag: this.auditFlag, taskId: this.taskId })
+      const params = {}
+      params.id = this.targetId
+      params.processInstanceId = this.processInstanceId
+      params.refuseReason = this.refuseReason
+      params.auditFlag = this.auditFlag
+      params.taskId = this.taskId
+      params.auditModelKey = this.auditModelKey
+      params.auditModelName = this.auditModelName
+      auditSbInfoScrapForAudit(params)
         .then(() => {
           this.$message.info('操作成功')
           this.auditFinish = false
@@ -187,6 +199,7 @@ export default {
         })
     },
     handleCancel () {
+      alert('hhhh')
       this.confirmLoading = false
       this.image1 = ''
       this.showFlag = true
@@ -197,6 +210,9 @@ export default {
       this.auditFinish = true
       clearInterval(this.timer)
       this.$emit('ok')
+    },
+    handleOk () {
+      this.$emit('ok')
     }
   }
 }

+ 4 - 12
src/views/activiti/task/MyStart.vue

@@ -97,22 +97,19 @@ export default {
           title: '类型',
           dataIndex: 'remark',
           customRender: (text, record, index) => {
-            if (text === 'supplier') {
+            return this.DictCache.VALUE.SB_INFO_AUDIT_MODEL_NAME[text]
+            /*if (text === 'supplier') {
               return '供应商审批'
             } else if (text === 'SB_SCRAP_FORM') {
               return '设备报废审批'
-            }
+            }*/
           }
         },
         {
           title: '任务名称',
           dataIndex: 'remark',
           customRender: (text, record, index) => {
-            if (text === 'supplier') {
-              return '供应商审批'
-            } else if (text === 'SB_SCRAP_FORM') {
-              return '设备报废审批'
-            }
+            return this.DictCache.VALUE.SB_INFO_AUDIT_MODEL_NAME[text]
           }
         },
         {
@@ -202,11 +199,6 @@ export default {
     },
     handleView (record) {
       this.visible = false
-      /*if (record.targetCode === 'sb_info_scrap') {
-        fetchSbScrapForm({ id: record.targetId }).then(res => {
-          this.$refs.detailAuditScrapModal.base(record, res.data)
-        })
-      }*/
       const templateData = JSON.parse(record.data)
       this.$refs.detailAuditScrapModal.base(record, templateData)
     },

+ 2 - 11
src/views/activiti/task/MyTask.vue

@@ -46,7 +46,6 @@ import { STable, Ellipsis } from '@/components'
 import AssignForm from './modules/AssignForm'
 import DetailAuditScrap from '@/views/sb/scraps/modules/DetailAudit'
 import { getTaskPage } from '@/api/activiti/activiti'
-import { fetchSbScrapForm } from '@/api/sb/scraps'
 import { fetchCustomFieldTemplateData } from '@/api/customize/fieldTemplateData'
 
 export default {
@@ -76,11 +75,7 @@ export default {
           title: '类型',
           dataIndex: 'targetCode',
           customRender: (text, record, index) => {
-            if (text === 'supplier') {
-              return '供应商审批'
-            } else if (text === 'sb_info_scrap' || text === '设备报废审批') {
-              return '设备报废审批'
-            }
+            return this.DictCache.VALUE.SB_INFO_AUDIT_MODEL_NAME[text]
           }
         },
         {
@@ -155,13 +150,9 @@ export default {
     },
     handleAudit (record) {
       this.visible = false
-      /*if (record.targetCode === 'sb_info_scrap') {
-        fetchSbScrapForm({ id: record.targetId }).then(res => {
-          this.$refs.detailAuditScrapModal.base(record, res.data)
-        })
-      }*/
       fetchCustomFieldTemplateData({ id: record.targetId }).then(res => {
         const templateData = JSON.parse(res.data.data)
+        record.remark = res.data.remark
         this.$refs.detailAuditScrapModal.base(record, templateData)
       })
     },

+ 11 - 13
src/views/activiti/task/MyTaskClaim.vue

@@ -44,7 +44,7 @@ import AssignForm from './modules/AssignForm'
 import DetailAuditScrap from '@/views/sb/scraps/modules/DetailAudit'
 import { getTaskPageClaim } from '@/api/activiti/activiti'
 import { claimSbInfoScrapForAudit } from '@/api/activiti/activiti-sb-scrap'
-
+import { fetchCustomFieldTemplateData } from '@/api/customize/fieldTemplateData'
 export default {
   name: 'TaskList',
   components: {
@@ -72,11 +72,7 @@ export default {
           title: '类型',
           dataIndex: 'targetCode',
           customRender: (text, record, index) => {
-            if (text === 'supplier') {
-              return '供应商审批'
-            } else if (text === 'sb_info_scrap' || text === '设备报废审批') {
-              return '设备报废审批'
-            }
+            return this.DictCache.VALUE.SB_INFO_AUDIT_MODEL_NAME[text]
           }
         },
         {
@@ -151,13 +147,15 @@ export default {
     },
     handleClaim (record) {
       this.confirmLoading = true
-      claimSbInfoScrapForAudit({ taskId: record.taskId })
-        .then((res) => {
-          this.$message.info(res.data)
-          this.handleOk()
-        }).catch(() => {
-          this.confirmLoading = false
-        })
+      fetchCustomFieldTemplateData({ id: record.targetId }).then(res => {
+        claimSbInfoScrapForAudit({ taskId: record.taskId, auditModelKey: res.data.remark })
+          .then((res) => {
+            this.$message.info(res.data)
+            this.handleOk()
+          }).catch(() => {
+            this.confirmLoading = false
+          })
+      })
     },
     handleOk () {
       this.visible = true

+ 1 - 5
src/views/activiti/task/MyTaskFinish.vue

@@ -73,11 +73,7 @@ export default {
           title: '类型',
           dataIndex: 'targetCode',
           customRender: (text, record, index) => {
-            if (text === 'supplier') {
-              return '供应商审批'
-            } else if (text === 'sb_info_scrap' || text === '设备报废审批') {
-              return '设备报废审批'
-            }
+            return this.DictCache.VALUE.SB_INFO_AUDIT_MODEL_NAME[text]
           }
         },
         {

+ 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>-->

+ 285 - 266
src/views/sb/sb-stop-details/SbInfoStopDetail.vue

@@ -1,288 +1,307 @@
 <template>
-    <a-card :bordered="false">
-        <div class="table-page-search-wrapper"  @keyup.enter="handleEnter">
-            <a-form layout="inline">
-                <a-row :gutter="48">
-                    <a-col :md="6" :sm="24">
-                        <a-form-item label="关键字">
-                            <a-input v-model.trim="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-select
-                                        v-model="['queryParam.type', {rules: [{required: true, message: '类型不能为空'}]}]"
-                                        placeholder="请选择">
-                                                                        <a-select-option
-                                            v-for="(label,value) in typeMap"
-                                            :key="value"
-                                            :label="label"
-                                            :value="parseInt(value)">{{ label }}
-                                    </a-select-option>
-                                </a-select>
-                                                                                                                                                            <a-select
-                                        v-model="['queryParam.status', {rules: [{required: true, message: '状态不能为空'}]}]"
-                                        placeholder="请选择">
-                                                                        <a-select-option
-                                            v-for="(label,value) in statusMap"
-                                            :key="value"
-                                            :label="label"
-                                            :value="parseInt(value)">{{ label }}
-                                    </a-select-option>
-                                </a-select>
-                                                                                            <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>
+  <a-card :bordered='false'>
+    <div class='table-page-search-wrapper' @keyup.enter='handleEnter'>
+      <a-form layout='inline'>
+        <a-row :gutter='48'>
+          <a-col :md='6' :sm='24'>
+            <a-form-item label='关键字'>
+              <a-input v-model.trim='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-select
+            v-model="['queryParam.type', {rules: [{required: true, message: '类型不能为空'}]}]"
+            placeholder='请选择'>
+            <a-select-option
+              v-for='(label,value) in typeMap'
+              :key='value'
+              :label='label'
+              :value='parseInt(value)'>{{ label }}
+            </a-select-option>
+          </a-select>
+          <a-select
+            v-model="['queryParam.status', {rules: [{required: true, message: '状态不能为空'}]}]"
+            placeholder='请选择'>
+            <a-select-option
+              v-for='(label,value) in statusMap'
+              :key='value'
+              :label='label'
+              :value='parseInt(value)'>{{ label }}
+            </a-select-option>
+          </a-select>
+          <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>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
 
-        <div class="table-operator" style="margin-bottom: 8px;">
-            <a-row>
-                <a-col :md="16">
-                    <a-button v-if="$auth('sb-sb-add')" type="primary" icon="plus" @click="$refs.baseModal.base()">新增</a-button>
-                    <a-button style="margin-left: 8px" v-if="$auth('sb-sb-export')" type="primary" icon="download" @click="doExport">导出</a-button>
-                    <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('sb-sb-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-col style="text-align: right">
-                    <span class="table-page-search-submitButtons">
-                    <a-button type="primary" @click="handleOk">查询</a-button>
-                    <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
-                    <a @click="()=>{ this.advanced = !this.advanced}" style="margin-left: 8px">
+    <div class='table-operator' style='margin-bottom: 8px;'>
+      <a-row>
+        <a-col :md='16'>
+          <a-button v-if="$auth('sb-sb-add')" type='primary' icon='plus' @click='$refs.baseModal.base()'>新增</a-button>
+          <a-button style='margin-left: 8px' v-if="$auth('sb-sb-export')" type='primary' icon='download'
+                    @click='doExport'>导出
+          </a-button>
+          <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('sb-sb-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-col style='text-align: right'>
+                    <span class='table-page-search-submitButtons'>
+                    <a-button type='primary' @click='handleOk'>查询</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-icon :type="advanced ? 'up' : 'down'" />
                     </a>
                   </span>
-                </a-col>
-            </a-row>
-        </div>
+        </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">
+    <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>
+                <a @click='handleView(record)'>查看</a>
                 <operation-button
-                        v-if="$auth('sb-sb-edit')" @click="handleEdit(record)"
-                      >修改</operation-button>
+                  v-if="$auth('sb-sb-edit')" @click='handleEdit(record)'
+                >修改</operation-button>
                 <operation-button
-                        v-if="$auth('sb-sb-del')"
-                        :type="2"
-                        title="是否要删除该条数据?"
-                        @confirm="batchDelete(record.id)">删除</operation-button>
+                  v-if="$auth('sb-sb-del')"
+                  :type='2'
+                  title='是否要删除该条数据?'
+                  @confirm='batchDelete(record.id)'>删除</operation-button>
               </template>
             </span>
-        </s-table>
-        <base-form ref="baseModal" @ok="handleOk"/>
-        <detail ref="detailModal"/>
-    </a-card>
+    </s-table>
+    <base-form ref='baseModal' @ok='handleOk' />
+    <detail ref='detailModal' />
+    <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 { getSbInfoStopDetailPage, deleteSbInfoStopDetails, fetchSbInfoStopDetail, exportSbInfoStopDetail } from '@/api/sb/sb-stop-details'
+import { STable, Ellipsis } from '@/components'
+import BaseForm from './modules/BaseForm'
+import Detail from './modules/Detail'
+import DetailAuditScrap from '@/views/sb/scraps/modules/DetailAudit'
+import {
+  getSbInfoStopDetailPage,
+  deleteSbInfoStopDetails,
+  fetchSbInfoStopDetail,
+  exportSbInfoStopDetail
+} from '@/api/sb/sb-stop-details'
 
-    export default {
-        name: 'SbInfoStopDetailList',
-        components: {
-            STable,
-            Ellipsis,
-            BaseForm,
-            Detail
+export default {
+  name: 'SbInfoStopDetailList',
+  components: {
+    STable,
+    Ellipsis,
+    BaseForm,
+    Detail,
+    DetailAuditScrap
+  },
+  data() {
+    return {
+      advanced: false,
+      // 查询参数
+      queryParam: {},
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
         },
-        data () {
-            return {
-                advanced: false,
-                // 查询参数
-                queryParam: {
-                },
-                // 表头
-                columns: [
-                    {
-                        title: '序号',
-                        dataIndex: 'index',
-                        customRender: (text, record, index) => {
-                            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
-                        }
-                    },
-                                                                                                        {
-                                    title: '设备Id',
-                                    dataIndex: 'sbId',
-                                    customRender: (text, record, index) => {
-                                        return '<a @click=="sbIdhandleDetail">' + record.sbInfo + '</a>'
-                                    }                  ,
-                                },
-                                                                                                                                                            {
-                                    title: '类型',
-                                    dataIndex: 'type',
-                                    customRender: (text, record, index) => {
-                                        return this.BaseTool.Table.getMapText(this.typeMap, text)
-                                    }                  ,
-                                },
-                                                                                                                                                            {
-                                    title: '状态',
-                                    dataIndex: 'status',
-                                    customRender: (text, record, index) => {
-                                        return this.BaseTool.Table.getMapText(this.statusMap, text)
-                                    }                  ,
-                                },
-                                                                                            {
-                        title: '操作',
-                        key: 'action',
-                        width: '200px',
-                        align: 'center',
-                        scopedSlots: { customRender: 'action' }
-                    }
-                ],
-                // 下拉框map
-                                                                                                                                                                            typeMap: {},
-                                                                                                                                        statusMap: {},
-                                                                            // 加载数据方法 必须为 Promise 对象
-                loadData: parameter => {
-                    parameter = {
-                        ...parameter,
-                        ...this.queryParam,
-                        dataScope: {
-                            sortBy: 'desc',
-                            sortName: 'update_time'
-                        }
-                    }
-                    return getSbInfoStopDetailPage(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
-            }
+        {
+          title: '设备Id',
+          dataIndex: 'sbId',
+          customRender: (text, record, index) => {
+            return '<a @click=="sbIdhandleDetail">' + record.sbInfo + '</a>'
+          }
         },
-        created () {
-            // 下拉框map
-                                                                                                                                        this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STOP_DETAIL_)
-                                                                                                            this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STOP_DETAIL_)
-                                                            this.tableOption()
+        {
+          title: '类型',
+          dataIndex: 'type',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Table.getMapText(this.typeMap, text)
+          }
         },
-        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]
-                }
-                deleteSbInfoStopDetails(ids).then(res => {
-                    this.$message.info('删除成功')
-                    this.handleOk()
-                    this.$refs.table.clearSelected()
-                })
-            },
-            handleEdit (record) {
-                fetchSbInfoStopDetail({ id: record.id }).then(res => {
-                    const modal = this.$refs.baseModal
-                    modal.base(res.data)
-                })
-            },
-            handleView (record) {
-                fetchSbInfoStopDetail({ 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)
-            },
-            doExport () {
-                const parameter = {
-                    ...this.queryParam
-                }
-                exportSbInfoStopDetail(parameter).then(file => {
-                    this.BaseTool.Util.downLoadExportExcel(file)
-                })
-            },
-            handleEnter () {
-                this.$refs.table.refresh(true)
+        {
+          title: '状态',
+          dataIndex: 'status',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Table.getMapText(this.statusMap, text)
+          }
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      typeMap: {},
+      statusMap: {},
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'update_time'
+          }
+        }
+        return getSbInfoStopDetailPage(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.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STOP_DETAIL_)
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STOP_DETAIL_)
+    this.tableOption()
+  },
+  methods: {
+    tableOption() {
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: {
+            show: true, clear: () => {
+              this.selectedRowKeys = []
             }
-                                                        ,
-                                            sbIdhandleDetail () {
-                        const text = this.$router.resolve({
-                            name: sbInfo,
-                            query: { id: this.model.sbId }
-                        })
-                        // 打开一个新的页面
-                        window.open(text.href, '_blank')
-                    }
-                                                                                                                                            }
+          },
+          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]
+      }
+      deleteSbInfoStopDetails(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleEdit(record) {
+      fetchSbInfoStopDetail({ id: record.id }).then(res => {
+        const modal = this.$refs.baseModal
+        modal.base(res.data)
+      })
+    },
+    handleView(record) {
+      fetchSbInfoStopDetail({ 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)
+    },
+    doExport() {
+      const parameter = {
+        ...this.queryParam
+      }
+      exportSbInfoStopDetail(parameter).then(file => {
+        this.BaseTool.Util.downLoadExportExcel(file)
+      })
+    },
+    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>

+ 153 - 153
src/views/sb/sb-stop-details/modules/BaseForm.vue

@@ -1,165 +1,165 @@
 <template>
-    <a-card :bordered="false" v-show="visible" class="card" :title="modalTitle">
-        <a-form :form="form">
+  <a-card :bordered='false' v-show='visible' class='card' :title='modalTitle'>
+    <a-form :form='form'>
 
-            <a-form-item v-show="false">
-                <a-input v-decorator="['id']" type="hidden"/>
-            </a-form-item>
+      <a-form-item v-show='false'>
+        <a-input v-decorator="['id']" type='hidden' />
+      </a-form-item>
 
-            <row-list :col="2">
-                                                            <row-item>
+      <row-list :col='2'>
+        <row-item>
 
-                            <a-form-item
-                                    label="设备Id"
-                                    :labelCol="BaseTool.Constant.labelCol"
-                                    :wrapperCol="BaseTool.Constant.wrapperCol"
-                            >
-                                                                    <a-input
-                                            style="width: 70%"
-                                            disabled
-                                            v-decorator="['sbInfoName', {rules: [{required: true, message: '设备名称不能为空'}]}]" />
-                                    <a-button style="width: 30%" type="primary" @click="sbInfoHandleSelect">选择</a-button>
-                                                            </a-form-item>
-                        </row-item>
-                                                                                <row-item>
+          <a-form-item
+            label='设备Id'
+            :labelCol='BaseTool.Constant.labelCol'
+            :wrapperCol='BaseTool.Constant.wrapperCol'
+          >
+            <a-input
+              style='width: 70%'
+              disabled
+              v-decorator="['sbInfoName', {rules: [{required: true, message: '设备名称不能为空'}]}]" />
+            <a-button style='width: 30%' type='primary' @click='sbInfoHandleSelect'>选择</a-button>
+          </a-form-item>
+        </row-item>
+        <row-item>
 
-                            <a-form-item
-                                    label="类型"
-                                    :labelCol="BaseTool.Constant.labelCol"
-                                    :wrapperCol="BaseTool.Constant.wrapperCol"
-                            >
-                                                                    <a-select
-                                            v-decorator="['type', {rules: [{required: true, message: '类型不能为空'}]}]"
-                                            placeholder="请选择">
-                                                                                <a-select-option
-                                                v-for="(label,value) in typeMap"
-                                                :key="value"
-                                                :label="label"
-                                                :value="parseInt(value)">{{ label }}
-                                        </a-select-option>
-                                    </a-select>
-                                                            </a-form-item>
-                        </row-item>
-                                                                                <row-item>
+          <a-form-item
+            label='类型'
+            :labelCol='BaseTool.Constant.labelCol'
+            :wrapperCol='BaseTool.Constant.wrapperCol'
+          >
+            <a-select
+              v-decorator="['type', {rules: [{required: true, message: '类型不能为空'}]}]"
+              placeholder='请选择'>
+              <a-select-option
+                v-for='(label,value) in typeMap'
+                :key='value'
+                :label='label'
+                :value='parseInt(value)'>{{ label }}
+              </a-select-option>
+            </a-select>
+          </a-form-item>
+        </row-item>
+        <row-item>
 
-                            <a-form-item
-                                    label="状态"
-                                    :labelCol="BaseTool.Constant.labelCol"
-                                    :wrapperCol="BaseTool.Constant.wrapperCol"
-                            >
-                                                                    <a-select
-                                            v-decorator="['status', {rules: [{required: true, message: '状态不能为空'}]}]"
-                                            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>
-                        </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" @selected="sbInfoHandleSelected"/>
-                                                                                                                                        </a-card>
+          <a-form-item
+            label='状态'
+            :labelCol='BaseTool.Constant.labelCol'
+            :wrapperCol='BaseTool.Constant.wrapperCol'
+          >
+            <a-select
+              v-decorator="['status', {rules: [{required: true, message: '状态不能为空'}]}]"
+              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>
+        </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' @selected='sbInfoHandleSelected' />
+  </a-card>
 </template>
 
 <script>
-    import pick from 'lodash.pick'
-    import {addSbInfoStopDetail, updateSbInfoStopDetail } from '@/api/sb/sb-stop-details'
+import pick from 'lodash.pick'
+import { addSbInfoStopDetail, updateSbInfoStopDetail } from '@/api/sb/sb-stop-details'
 
-    export default {
-        name: 'BaseSbInfoStopDetail',
-        data() {
-            return {
-                confirmLoading: false,
-                modalTitle: null,
-                form: this.$form.createForm(this),
-                visible: false,
-            // 下拉框map
-                                                                                                                                            typeMap: {},
-                                                                                                                statusMap: {},
-                                                        }
-        },
-        props: {},
-        created() {
-            // 下拉框map
-                                                                                                                                        this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STOP_DETAIL_)
-                                                                                                            this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STOP_DETAIL_)
-                                                        },
-        methods: {
-            base(record) {
-                this.visible = true
-                // 如果是空标识添加
-                if (this.BaseTool.Object.isBlank(record)) {
-                    this.modalTitle = '添加'
-                    return
-                }
-                this.modalTitle = '编辑'
-                const {form: {setFieldsValue}} = this
-                // 日期处理
-                                this.$nextTick(() => {
-                    setFieldsValue(Object.assign(pick(record, [
-                                                                                    'sbId',
-                                                                                                                'type',
-                                                                                                                'status',
-                                                    ])))
-                })
-            },
-            save() {
-                const {form: {validateFieldsAndScroll}} = this
-                this.confirmLoading = true
-                validateFieldsAndScroll((errors, values) => {
-                    if (errors) {
-                        this.confirmLoading = false
-                        return
-                    }
-                    // 日期处理
-                                        if (this.BaseTool.String.isBlank(values.id)) {
-                        addSbInfoStopDetail(values)
-                                .then(() => {
-                                    this.handleCancel(values)
-                                }).catch(() => {
-                            this.confirmLoading = false
-                        })
-                    } else {
-                        updateSbInfoStopDetail(values)
-                                .then(() => {
-                                    this.handleCancel(values)
-                                }).catch(() => {
-                            this.confirmLoading = false
-                        })
-                    }
-                })
-            },
-            handleCancel(values) {
-                this.visible = false
-                this.confirmLoading = false
-                this.form.resetFields()
-                if (this.BaseTool.Object.isNotBlank(values)) {
-                    this.$emit('ok', values)
-                }
-            }
-                                                ,
-                                sbInfoHandleSelect () {
-                    this.$refs.sbInfoSelectModal.base({}, {})
-                },
-                sbInfoHandleSelected (keys, rows) {
-                    const [ key ] = keys
-                    const [ row ] = rows
-                    const { form: { setFieldsValue } } = this
-                    // 日期处理
-                    this.$nextTick(() => {
-                        setFieldsValue(Object.assign({
-                            'sbId': key,
-                            'sbInfoName': row.name
-                        }))
-                    })
-                },
-                                                                                            }
+export default {
+  name: 'BaseSbInfoStopDetail',
+  data() {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false,
+      // 下拉框map
+      typeMap: {},
+      statusMap: {}
     }
+  },
+  props: {},
+  created() {
+    // 下拉框map
+    this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STOP_DETAIL_)
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STOP_DETAIL_)
+  },
+  methods: {
+    base(record) {
+      this.visible = true
+      // 如果是空标识添加
+      if (this.BaseTool.Object.isBlank(record)) {
+        this.modalTitle = '添加'
+        return
+      }
+      this.modalTitle = '编辑'
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign(pick(record, [
+          'sbId',
+          'type',
+          'status'
+        ])))
+      })
+    },
+    save() {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        // 日期处理
+        if (this.BaseTool.String.isBlank(values.id)) {
+          addSbInfoStopDetail(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+            this.confirmLoading = false
+          })
+        } else {
+          updateSbInfoStopDetail(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+            this.confirmLoading = false
+          })
+        }
+      })
+    },
+    handleCancel(values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      if (this.BaseTool.Object.isNotBlank(values)) {
+        this.$emit('ok', values)
+      }
+    }
+    ,
+    sbInfoHandleSelect() {
+      this.$refs.sbInfoSelectModal.base({}, {})
+    },
+    sbInfoHandleSelected(keys, rows) {
+      const [key] = keys
+      const [row] = rows
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign({
+          'sbId': key,
+          'sbInfoName': row.name
+        }))
+      })
+    }
+  }
+}
 </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>

+ 31 - 11
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">
@@ -115,8 +129,7 @@
     <base-form ref="baseModal" @ok="handleOk" />
     <detail ref="detailModal" @ok="handleOk" />
     <sb-custom-form-view ref='showCustomView' @ok='handleOk'/>
-<!--    <image-modal ref="imageModal"/>-->
-<!--    <history-table ref="historyModal"/>-->
+    <detail-audit-scrap :audit="false" ref="detailAuditScrapModal" @ok="handleOk"/>
   </a-card>
 </template>
 
@@ -126,9 +139,10 @@ 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 { getSbScrapFormPage, deleteSbScrapForms, fetchSbScrapForm, exportSbScrapForm } from '@/api/sb/scraps'
+import { deleteSbScrapForms, fetchSbScrapForm, exportSbScrapForm } from '@/api/sb/scraps'
 import { startSbInfoScrap, stopSbInfoScrapForAudit } from '@/api/activiti/activiti-sb-scrap'
 import { getCustomFieldTemplateDataPage } from '@/api/customize/fieldTemplateData'
 
@@ -140,7 +154,9 @@ export default {
     BaseForm,
     ImageModal,
     HistoryTable,
-    SbCustomFormView
+    SbCustomFormView,
+    Detail,
+    DetailAuditScrap
   },
   data () {
     return {
@@ -292,14 +308,11 @@ export default {
       })
     },
     handleAdd () {
-      /*this.visible = false
-      const modal = this.$refs.baseModal
-      modal.base()*/
       this.visible = false
       const params = { remark: this.DictCache.VALUE.CUSTOM_TEMPLATE_SB_REMARK.SB_SCRAP_FORM }
       fetchCustomFieldTemplateByRemark(params).then(res => {
         const modal = this.$refs.showCustomView
-        modal.base(res.data.content)
+        modal.base(res.data)
       })
     },
     handleEdit (record) {
@@ -311,8 +324,8 @@ export default {
     },
     handleView (record) {
       this.visible = false
-      const modal = this.$refs.detailModal
-      modal.base(record)
+      const templateData = JSON.parse(record.data)
+      this.$refs.detailAuditScrapModal.base(record, templateData)
     },
     handleOk (values) {
       this.visible = true
@@ -339,7 +352,13 @@ export default {
       if (templateData.processInstanceId === undefined) {
         templateData.processInstanceId = ''
       }
-      startSbInfoScrap({ id: record.id, processInstanceId: templateData.processInstanceId }).then(res => {
+      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()
       })
@@ -378,3 +397,4 @@ export default {
   }
 }
 </script>
+-->

+ 29 - 21
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>
@@ -19,13 +37,7 @@
       <detail-list-item term="创建日期">{{ model.createdTime }}</detail-list-item>
       <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>-->
+    <history ref="history" :audit="audit" @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,9 +90,12 @@ 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
       modal.base(model, this.task.taskId)
     },
     handleCancel () {

+ 149 - 17
src/views/sb/scraps/modules/SbCustomFormView.vue

@@ -22,14 +22,14 @@
           <a-form-item
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
-            v-if="item.type === 1 && item.disabledFlag === '0'"
+            v-if="item.type === 1 && (item.disabledFlag === 0 || item.disabledFlag === '0')"
             :label="item.label">
             <a-input v-decorator="[item.fieldName, {initialValue: item.value, rules: [{required: item.required, message: '不能为空'}]}]"/>
           </a-form-item>
           <a-form-item
             :labelCol="BaseTool.Constant.labelCol"
             :wrapperCol="BaseTool.Constant.wrapperCol"
-            v-if="item.type === 1 && item.disabledFlag === '1'"
+            v-if="item.type === 1 && (item.disabledFlag === 1 || item.disabledFlag === '1')"
             :label="item.label">
             <a-input disabled='disabled' v-decorator="[item.fieldName, {initialValue: item.value, rules: [{required: item.required, message: '不能为空'}]}]"/>
           </a-form-item>
@@ -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 {
@@ -99,28 +134,100 @@ export default {
       // 下拉框map
       typeMap: {},
       typeFieldMap: {},
-      hiddenFlag: false
+      hiddenFlag: false,
+      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.data = JSON.parse(data)
-    },
-    setData (values) {
-      const dataList = [...this.data]
-      dataList.forEach((item) => {
-        if (item.type !== 4) {
-          item.value = values[item.fieldName]
-        }
-      })
-      return dataList
+      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)
+      // 调拨单处理
+      if (this.data.sbInfos !== null && this.data.sbInfos !== undefined) {
+        this.dataSource = JSON.parse(this.data.sbInfos)
+      } else {
+        this.dataSource = []
+      }
     },
     handleCancel (values) {
       this.visible = false
@@ -167,12 +274,18 @@ export default {
           this.confirmLoading = false
           return
         }
+        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
         obj.objId = values.sbId
         obj.data = content
-        obj.remark = this.DictCache.VALUE.CUSTOM_TEMPLATE_SB_REMARK.SB_SCRAP_FORM
+        obj.remark = this.remark
         // 日期处理
         if (this.BaseTool.String.isBlank(values.id)) {
           addCustomFieldTemplateDataForm(obj)
@@ -190,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)
+        }
+      }
     }
   }
 }

+ 95 - 33
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">
@@ -84,6 +98,27 @@
       >
         <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="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>
+&lt;!&ndash;          <template>
             <a @click="handleView(record)">查看</a>
             <operation-button
               v-if="$auth('sb-stop-details-edit')"
@@ -94,12 +129,14 @@
               :type="2"
               title="是否要删除该条数据?"
               @confirm="batchDelete(record.id)">删除</operation-button>
-          </template>
+          </template>&ndash;&gt;
         </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>
 
@@ -107,7 +144,12 @@
 import { STable, Ellipsis } from '@/components'
 import BaseForm from './modules/BaseForm'
 import Detail from './modules/Detail'
-import { getSbInfoStopDetailPage, deleteSbInfoStopDetails, fetchSbInfoStopDetail, exportSbInfoStopDetail } from '@/api/sb/stopDetail'
+import SbCustomFormView from '@/views/sb/scraps/modules/SbCustomFormView'
+import DetailAuditScrap from '@/views/sb/scraps/modules/DetailAudit'
+import { deleteSbInfoStopDetails, fetchSbInfoStopDetail, exportSbInfoStopDetail } from '@/api/sb/stopDetail'
+import { getCustomFieldTemplateDataPage } from '@/api/customize/fieldTemplateData'
+import { startSbInfoScrap, stopSbInfoScrapForAudit } from '@/api/activiti/activiti-sb-scrap'
+import { fetchCustomFieldTemplateByRemark } from '@/api/customize/fieldTemplate'
 
 export default {
   name: 'SbInfoStopDetailList',
@@ -115,7 +157,9 @@ export default {
     STable,
     Ellipsis,
     BaseForm,
-    Detail
+    Detail,
+    SbCustomFormView,
+    DetailAuditScrap
   },
   data () {
     return {
@@ -123,6 +167,8 @@ export default {
       visible: true,
       // 查询参数
       queryParam: {
+        type: this.DictCache.VALUE.CUSTOM_TEMPLATE_SB_REMARK_NUMBER.ACTIVITY_FORM,
+        remark: this.DictCache.VALUE.CUSTOM_TEMPLATE_SB_REMARK.SB_STOP_FORM
       },
       // 表头
       columns: [
@@ -138,34 +184,23 @@ export default {
           dataIndex: 'no'
         },
         {
-          title: '设备Id',
+          title: '设备',
           dataIndex: 'sbId',
           customRender: (text, record, index) => {
-            return record.sbInfoName
+            return record.sbName
           }
         },
         {
-          title: '维修id',
+          title: '维修',
           dataIndex: 'repairId'
         },
         {
           title: '申请人',
-          dataIndex: 'userId'
-        },
-        {
-          title: '类型',
-          dataIndex: 'type',
-          customRender: (text, record, index) => {
-            return this.BaseTool.Table.getMapText(this.typeMap, text)
-          }
+          dataIndex: 'createdUserName'
         },
         {
           title: '申请日期',
-          dataIndex: 'applyDate'
-        },
-        {
-          title: '启用日期',
-          dataIndex: 'startDate'
+          dataIndex: 'createdTime'
         },
         {
           title: '停用日期',
@@ -173,7 +208,7 @@ export default {
         },
         {
           title: '停用原因',
-          dataIndex: 'content'
+          dataIndex: 'reason'
         },
         {
           title: '状态',
@@ -184,15 +219,7 @@ export default {
         },
         {
           title: '备注',
-          dataIndex: 'remark'
-        },
-        {
-          title: '创建日期',
-          dataIndex: 'createdTime'
-        },
-        {
-          title: '创建人名称',
-          dataIndex: 'createdUserName'
+          dataIndex: 'dataRemark'
         },
         {
           title: '操作',
@@ -215,7 +242,7 @@ export default {
             sortName: 'update_time'
           }
         }
-        return getSbInfoStopDetailPage(Object.assign(parameter, this.queryParam))
+        return getCustomFieldTemplateDataPage(Object.assign(parameter, this.queryParam))
           .then(res => {
             return res.data
           })
@@ -236,7 +263,7 @@ export default {
   created () {
     // 下拉框map
     this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STOP_DETAIL_TYPE)
-    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STOP_DETAIL_STATUS)
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.ACTIVITI_FORM_STATUS)
     this.tableOption()
   },
   methods: {
@@ -284,8 +311,11 @@ export default {
     },
     handleAdd () {
       this.visible = false
-      const modal = this.$refs.baseModal
-      modal.base()
+      const params = { remark: this.DictCache.VALUE.CUSTOM_TEMPLATE_SB_REMARK.SB_STOP_FORM }
+      fetchCustomFieldTemplateByRemark(params).then(res => {
+        const modal = this.$refs.showCustomView
+        modal.base(res.data)
+      })
     },
     handleEdit (record) {
       this.visible = false
@@ -296,11 +326,42 @@ export default {
     },
     handleView (record) {
       this.visible = false
+      const templateData = JSON.parse(record.data)
+      this.$refs.detailAuditScrapModal.base(record, templateData)
+      /*this.visible = false
       fetchSbInfoStopDetail({ id: record.id }).then(res => {
         const modal = this.$refs.detailModal
         modal.base(res.data)
+      })*/
+    },
+    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()
       })
     },
+    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
+        })
+    },
     handleOk (values) {
       this.visible = true
       this.$refs.table.refresh()
@@ -336,3 +397,4 @@ export default {
   }
 }
 </script>
+-->