hfxc226 2 年之前
父節點
當前提交
5bdb6fe667

+ 32 - 0
src/api/activiti/activiti.js

@@ -50,6 +50,38 @@ export function getAuditRecord (processInstanceId) {
     }
   })
 }
+/**
+ * getShineProImage func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getShineProDefImage (parameter) {
+  return axios({
+    url: '/act/shine-procDef-image/' + parameter.id,
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * getShineProImage func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getShineProDefXml (parameter) {
+  return axios({
+    url: '/act/shine-procDef-xml/' + parameter.id,
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    responseType: 'blob'
+  })
+}
 
 /**
  * getShineProImage func

+ 171 - 0
src/api/activiti/user-model.js

@@ -0,0 +1,171 @@
+import { axios } from '@/utils/request'
+import { stringify } from 'qs'
+
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getActivitiUserModelPage (parameter) {
+  return axios({
+    url: '/activiti/user-models/page?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * add func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function addActivitiUserModel (parameter) {
+  return axios({
+    url: '/activiti/user-models',
+    method: 'POST',
+    headers: {
+      'Accept': 'application/json',
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    data: parameter
+  })
+}
+
+/**
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function updateActivitiUserModel (parameter) {
+  return axios({
+    url: '/activiti/user-models/' + parameter.id,
+    method: 'PUT',
+    data: parameter
+  })
+}
+
+/**
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function updateActivitiUserModelBatch (parameter) {
+  return axios({
+    url: '/activiti/user-models/model/modify/' + parameter.modelId,
+    method: 'PUT',
+    data: parameter.list
+  })
+}
+
+/**
+     * update func
+     * parameter: { }
+     * @param parameter
+     * @returns {*}
+     */
+export function updateType (parameter) {
+  return axios({
+    url: '/type/user-models/type/' + parameter.id,
+    method: 'PUT',
+    data: parameter
+  })
+}
+
+/**
+ * fetch single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function fetchActivitiUserModel (parameter) {
+  return axios({
+    url: '/activiti/user-models/' + parameter.id,
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * fetch single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function fetchActivitiUserModelByModelId (parameter) {
+  return axios({
+    url: '/activiti/user-models/model/' + parameter.id,
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * query list func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function queryActivitiUserModel (parameter) {
+  return axios({
+    url: '/activiti/user-models?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}
+
+/**
+ * delete batch func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function deleteActivitiUserModels (parameter) {
+  return axios({
+    url: '/activiti/user-models',
+    method: 'DELETE',
+    data: parameter
+  })
+}
+
+/**
+ * delete single func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function deleteActivitiUserModel (parameter) {
+  return axios({
+    url: '/activiti/user-models/' + parameter.id,
+    method: 'DELETE',
+    data: parameter
+  })
+}
+
+/**
+ * export file
+ * parameter: { }
+ * @param parameter :
+ * @returns {*}
+ */
+export function exportActivitiUserModel (parameter) {
+  return axios({
+    url: '/activiti/user-models/export?' + stringify(parameter),
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    },
+    responseType: 'blob'
+  })
+}

+ 56 - 0
src/api/sb/info.js

@@ -446,3 +446,59 @@ export function auditProcess (parameter) {
     data: parameter
   })
 }
+
+/**
+ * update func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function startSbInfoScrap (parameter) {
+  return axios({
+    url: '/activiti/sb/start',
+    method: 'PUT',
+    data: parameter
+  })
+}
+
+/**
+ * update func 终止提交审批
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function stopSbInfoScrapForAudit (parameter) {
+  return axios({
+    url: '/activiti/sb/stop',
+    method: 'PUT',
+    data: parameter
+  })
+}
+
+/**
+ * update func 审批开始
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function auditSbInfoScrapForAudit (parameter) {
+  return axios({
+    url: '/activiti/sb/audit',
+    method: 'PUT',
+    data: parameter
+  })
+}
+
+/**
+ * update func 审批开始
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function historySbInfoScrapForAudit (parameter) {
+  return axios({
+    url: '/activiti/sb/history/' + parameter.id,
+    method: 'GET',
+    data: parameter
+  })
+}

+ 1 - 1
src/router/generator-platform-routers.js

@@ -220,7 +220,7 @@ const constantRouterComponents = {
   'Model': () => import('@/views/activiti/model/Model'),
   'Flow': () => import('@/views/activiti/flow/Flow'),
   'MyTask': () => import('@/views/activiti/task/MyTask'),
-
+  'ActivitiUserModel': () => import('@/views/activiti/user-model/ActivitiUserModel'),
   // 调拨申请
   'SbAllocateApply': () => import('@/views/sb/allocate-apply/ProjectSbAllocateApply'),
   'GroupToProjectSbAllocateApply': () => import('@/views/sb/allocate-apply/GroupToProjectSbAllocateApply'),

+ 1 - 0
src/utils/dict.js

@@ -65,6 +65,7 @@ const DictCache = {
 
 }
 DictCache.TYPE = {
+  ACTIVITI_USER_MODEL_TYPE: 'ACTIVITI_USER_MODEL_TYPE', // 审批业务用户模型
   SB_QR_CODE_LABEL_WIDTH: 'SB_QR_CODE_LABEL_WIDTH', // 设备标签宽度
   SB_QR_CODE_LABEL_CONTENT_WIDTH: 'SB_QR_CODE_LABEL_CONTENT_WIDTH', // 设备标签表格宽度
   SB_QR_CODE_LABEL_CONTENT_HEIGHT: 'SB_QR_CODE_LABEL_CONTENT_HEIGHT', // 设备标签表格高度

+ 125 - 0
src/views/activiti/HistoryTable.vue

@@ -0,0 +1,125 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="1200"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    class="ant-modal2"
+    @cancel="handleCancel"
+  >
+    <div class="table-operator" style="margin-bottom: 8px;">
+    </div>
+    <a-table
+      bordered
+      :data-source="data"
+      :columns="columns"
+      tableLayout="auto"
+      rowKey="id"
+      :row-selection="rowSelection">
+    </a-table>
+  </a-modal>
+</template>
+
+<script>
+import { historySbInfoScrapForAudit } from '@/api/sb/info'
+
+export default {
+  name: 'ActHistoryModal',
+  components: {
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false,
+      maskClosable: false,
+      model: null,
+      storeId: null,
+      typeMap: {},
+      userList: {},
+      storeTreeDate: [],
+      rowSelection: {
+        onChange: (selectedRowKeys, selectedRows) => {
+          this.selectedRowKeys = selectedRowKeys
+          this.selectedRows = selectedRows
+        }
+      },
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${index + 1}`
+          }
+        },
+        {
+          title: '开始时间',
+          dataIndex: 'startTime'
+        },
+        {
+          title: '结束时间',
+          dataIndex: 'endTime'
+        },
+        {
+          title: '审批人',
+          dataIndex: 'userName'
+        },
+        {
+          title: '审批节点名称',
+          dataIndex: 'name'
+        },
+        {
+          title: '流程变量',
+          dataIndex: 'result'
+        },
+        {
+          title: '审批意见',
+          dataIndex: 'approveComment'
+        }
+      ],
+      data: [],
+      user: this.$store.getters.userInfo,
+      selectedRowKeys: [],
+      selectedRows: [],
+      options: {
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys
+        }
+      }
+    }
+  },
+  props: {
+  },
+  created () {
+    // 下拉框map
+    this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.ACTIVITI_USER_MODEL_TYPE)
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      this.model = record
+      this.modalTitle = '节点设置'
+      historySbInfoScrapForAudit({ id: record.processInstanceId }).then(res => {
+        this.data = res.data
+      })
+    },
+    handleOk () {
+      this.visible = true
+      this.base(this.model)
+    },
+    handleCancel (values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.data = []
+      this.form.resetFields()
+      if (this.BaseTool.Object.isNotBlank(values)) {
+        this.$emit('ok', values)
+      } else {
+        this.$emit('ok')
+      }
+    }
+  }
+}
+</script>

+ 51 - 0
src/views/activiti/ImageDefModal.vue

@@ -0,0 +1,51 @@
+<template>
+  <a-modal
+    title="流程图"
+    :width="800"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    @cancel="handleCancel"
+  >
+    <div>
+      <img :src="image1" />
+    </div>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">关闭</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import { getShineProDefImage } from '@/api/activiti/activiti'
+
+export default {
+  name: 'ActImageDefModal',
+  data () {
+    return {
+      confirmLoading: false,
+      image1: '',
+      visible: false,
+      countNum: 0,
+      image2: ''
+    }
+  },
+  mounted () {
+  },
+  methods: {
+    base (id) {
+      this.visible = true
+      this.confirmLoading = true
+      getShineProDefImage({ id: id })
+        .then((res) => {
+          this.image1 = 'data:image/png;base64,' + res.data
+        }).catch(() => {
+          this.confirmLoading = false
+        })
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+    }
+  }
+}
+</script>

+ 1 - 0
src/views/activiti/ImageModal.vue

@@ -38,6 +38,7 @@ export default {
   methods: {
     base (id) {
       this.visible = true
+      this.confirmLoading = true
       getShineProImage({ processInstanceId: id })
         .then((res) => {
           const images = res.data.images

+ 24 - 3
src/views/activiti/flow/Flow.vue

@@ -48,24 +48,32 @@
           <!--          <a-divider type="vertical" />-->
           <!--          <a v-if="$auth('act-flow-edit')" @click="handleEdit(record)">修改</a>-->
           <!--          <a-divider type="vertical" />-->
+          <a @click="handleViewImage(record)">流程图</a>
+          <a-divider type="vertical" />
+          <a @click="handleXml(record)">XMl文件</a>
+          <a-divider type="vertical" />
           <a-popconfirm v-if="$auth('act-flow-del')" title="是否要删除该条数据?" @confirm="batchDelete(record.deploymentId)">
             <a>删除</a>
           </a-popconfirm>
         </template>
       </span>
     </s-table>
+    <image-def-modal ref="imageModal"></image-def-modal>
   </a-card>
 </template>
 
 <script>
 import { STable, Ellipsis } from '@/components'
 import { getFlowPage, deleteFlows } from '@/api/activiti/flow'
-
+import ImageDefModal from '../ImageDefModal'
+import { exportSbInfo } from '@/api/sb/info'
+import { getShineProDefXml } from '@/api/activiti/activiti'
 export default {
   name: 'ModelList',
   components: {
     STable,
-    Ellipsis
+    Ellipsis,
+    ImageDefModal
   },
   data () {
     return {
@@ -115,7 +123,7 @@ export default {
         {
           title: '操作',
           key: 'action',
-          width: '70px',
+          width: 250,
           fixed: 'right',
           checked: true,
           align: 'center',
@@ -189,10 +197,23 @@ export default {
         this.$refs.table.clearSelected()
       })
     },
+    handleOk (values) {
+      this.visible = true
+      this.$refs.table.refresh()
+    },
     onSelectChange (selectedRowKeys, selectedRows) {
       this.selectedRowKeys = selectedRowKeys
       this.selectedRows = selectedRows
     },
+    handleViewImage (record) {
+      const modal = this.$refs.imageModal
+      modal.base(record.id)
+    },
+    handleXml (record) {
+      getShineProDefXml(record).then(file => {
+        this.BaseTool.UPLOAD.downLoadExportExcel(file)
+      })
+    },
     resetSearchForm () {
       this.queryParam = {
       }

+ 18 - 2
src/views/activiti/model/Model.vue

@@ -52,6 +52,10 @@
           </a-popconfirm>
           <a-divider v-if="$auth('act-model-edit')" type="vertical" />
           <a v-if="$auth('act-model-edit')" @click="handleEdit(record)">修改</a>
+          <a-divider v-if="$auth('act-model-edit')" type="vertical" />
+          <a @click="handleViewPic(record)">流程图</a>
+          <a-divider v-if="$auth('act-model-del')" type="vertical" />
+          <a v-if="$auth('act-model-edit')" @click="handleUserModel(record)">审批节点</a>
           <a-divider v-if="$auth('act-model-del')" type="vertical" />
           <a-popconfirm v-if="$auth('act-model-del')" title="是否要删除该条数据?" @confirm="batchDelete(record.id)">
             <a>删除</a>
@@ -61,6 +65,7 @@
     </s-table>
     <base-form ref="baseModal" @ok="handleOk"/>
     <design ref="designModal" @ok="handleOk"/>
+    <activiti-user-model-table ref="activitiUserModelTable" @ok="handleOk"></activiti-user-model-table>
   </a-card>
 </template>
 
@@ -70,14 +75,15 @@ import BaseForm from './modules/BaseForm'
 import Design from './modules/Design'
 import { getModelPage, deleteModels, fetchModel, deployModel, sync } from '@/api/activiti/model'
 import { timestampToTime } from '@/utils/util'
-
+import ActivitiUserModelTable from '@/views/activiti/user-model/modules/ActivitiUserModelTable'
 export default {
   name: 'ModelList',
   components: {
     STable,
     Ellipsis,
     BaseForm,
-    Design
+    Design,
+    ActivitiUserModelTable
   },
   data () {
     return {
@@ -208,6 +214,16 @@ export default {
         modal.base(res.data)
       })
     },
+    handleViewPic (record) {
+      fetchModel({ id: record.id }).then(res => {
+        const modal = this.$refs.baseModal
+        modal.base(res.data)
+      })
+    },
+    handleUserModel (record) {
+      const modal = this.$refs.activitiUserModelTable
+      modal.base(record)
+    },
     handleDeploy (record) {
       deployModel({ id: record.id }).then(res => {
         this.$message.info('发布成功')

+ 1 - 1
src/views/activiti/task/MyTask.vue

@@ -167,7 +167,7 @@ export default {
         this.$refs.purchaseBidAuditAddModal.base(record)
       } else if (record.targetCode === 'supplier') {
         this.$refs.supplierAuditModal.base(record)
-      } else if (record.targetCode === 'sb_info_scrap') {
+      } else if (record.targetCode === 'sb_info_scrap' || record.targetCode === '设备报废审批') {
         this.$refs.detailAuditScrapModal.base(record)
       } else if (record.targetCode === 'sb_info_scrap_second') {
         this.$refs.detailAuditScrapSecondModal.base(record)

+ 294 - 0
src/views/activiti/user-model/ActivitiUserModel.vue

@@ -0,0 +1,294 @@
+<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="类型">
+                <a-select
+                  v-model="queryParam.type"
+                  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>
+            </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 v-if="$auth('activiti-user-models-add')" type="primary" icon="plus" @click="handleAdd()">新增</a-button>
+            <a-button style="margin-left: 8px" v-if="$auth('activiti-user-models-export')" type="primary" icon="download" @click="doExport">导出</a-button>
+            <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('activiti-user-models-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="$auth('activiti-user-models-edit')"
+              @click="handleEdit(record)"
+            >修改</operation-button>
+            <operation-button
+              v-if="$auth('activiti-user-models-del')"
+              :type="2"
+              title="是否要删除该条数据?"
+              @confirm="batchDelete(record.id)">删除</operation-button>
+          </template>
+        </span>
+      </s-table>
+    </div>
+    <base-form ref="baseModal" @ok="handleOk"/>
+    <detail ref="detailModal" @ok="handleOk"/>
+  </a-card>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import BaseForm from './modules/BaseForm'
+import Detail from './modules/Detail'
+import { getActivitiUserModelPage, deleteActivitiUserModels, fetchActivitiUserModel, exportActivitiUserModel } from '@/api/activiti/user-model'
+
+export default {
+  name: 'ActivitiUserModelList',
+  components: {
+    STable,
+    Ellipsis,
+    BaseForm,
+    Detail
+  },
+  props: {
+    reModelId: {
+      type: String,
+      default: null
+    }
+  },
+  data () {
+    return {
+      advanced: false,
+      visible: true,
+      // 查询参数
+      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: 'reModelId'
+        },
+        {
+          title: '节点名称',
+          dataIndex: 'name'
+        },
+        {
+          title: '类型',
+          dataIndex: 'type',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Table.getMapText(this.typeMap, text)
+          }
+        },
+        {
+          title: '审批人',
+          dataIndex: 'assignee'
+        },
+        {
+          title: '流程变量',
+          dataIndex: 'formVariable'
+        },
+        {
+          title: '备注',
+          dataIndex: 'remark'
+        },
+        {
+          title: '创建日期',
+          dataIndex: 'createdTime'
+        },
+        {
+          title: '创建人名称',
+          dataIndex: 'createdUserName'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      typeMap: {},
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'update_time'
+          }
+        }
+        return getActivitiUserModelPage(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.ACTIVITI_USER_MODEL_TYPE)
+    this.tableOption()
+  },
+  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]
+      }
+      deleteActivitiUserModels(ids).then(res => {
+        this.$message.info('删除成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleAdd () {
+      this.visible = false
+      const modal = this.$refs.baseModal
+      modal.base()
+    },
+    handleEdit (record) {
+      this.visible = false
+      fetchActivitiUserModel({ id: record.id }).then(res => {
+        const modal = this.$refs.baseModal
+        modal.base(res.data)
+      })
+    },
+    handleView (record) {
+      this.visible = false
+      fetchActivitiUserModel({ id: record.id }).then(res => {
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+    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
+      }
+      exportActivitiUserModel(parameter).then(file => {
+        this.BaseTool.Util.downLoadExportExcel(file)
+      })
+    },
+    handleEnter () {
+      this.$refs.table.refresh(true)
+    }
+  }
+}
+</script>

+ 308 - 0
src/views/activiti/user-model/modules/ActivitiUserModelSelectModal.vue

@@ -0,0 +1,308 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="1000"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    class="ant-modal2"
+    @cancel="handleCancel"
+  >
+    <a-card :bordered="false">
+      <div class="table-page-search-wrapper">
+        <a-form layout="inline">
+          <a-row :gutter="48">
+            <a-col :md="6" :sm="24">
+              <a-form-item label="关键字">
+                <a-input v-model="queryParam.keyword" placeholder="请输入名称/类型名称"/>
+              </a-form-item>
+            </a-col>
+            <a-select
+              v-model="queryParam.type"
+              placeholder="请选择">
+              <a-select-option
+                v-for="(label,value) in typeMap"
+                :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 @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">
+      </div>
+
+      <s-table
+        ref="table"
+        size="default"
+        rowKey="id"
+        :columns="columns"
+        :data="loadData"
+        :alert="options.alert"
+        :customRow="options.customRow"
+        :rowSelection="options.rowSelection"
+        showPagination="auto"
+      >
+        <span slot="action" slot-scope="record1">
+          <template>
+            <a @click="handleView(record1)">查看</a>
+          </template>
+        </span>
+      </s-table>
+      <detail ref="detailModal"/>
+    </a-card>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">取消</a-button>
+      <a-button :loading="confirmLoading" type="primary" @click="handleSelect()">确定</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import Detail from './Detail'
+import { getActivitiUserModelPage, fetchActivitiUserModel } from '@/api/activiti/user-model'
+
+export default {
+  name: 'ActivitiUserModelSelectModal',
+  components: {
+    STable,
+    Ellipsis,
+    Detail
+  },
+  props: {
+    type: {
+      type: String,
+      default: 'radio'
+    },
+    selectedRowKey: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    },
+    selectedRow: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    }
+  },
+  data () {
+    return {
+      advanced: false,
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      record: null,
+      // 查询参数
+      queryParam: {
+      },
+      extraQueryParam: {
+      },
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '模型id',
+          dataIndex: 'reModelId'
+        },
+        {
+          title: '节点名称',
+          dataIndex: 'name'
+        },
+        {
+          title: '类型',
+          dataIndex: 'type',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Table.getMapText(this.typeMap, text)
+          }
+        },
+        {
+          title: '审批人',
+          dataIndex: 'assignee'
+        },
+        {
+          title: '流程变量',
+          dataIndex: 'formVariable'
+        },
+        {
+          title: '备注',
+          dataIndex: 'remark'
+        },
+        {
+          title: '创建日期',
+          dataIndex: 'createdTime'
+        },
+        {
+          title: '创建人名称',
+          dataIndex: 'createdUserName'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      typeMap: {},
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          ...this.extraQueryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'update_time'
+          }
+        }
+        return getActivitiUserModelPage(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,
+      isCreated: false
+    }
+  },
+  created () {
+    // 下拉框map
+    this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.ACTIVITI_USER_MODEL_TYPE)
+  },
+  methods: {
+    tableOption () {
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+          rowSelection: {
+            selectedRowKeys: this.selectedRowKeys,
+            onChange: this.onSelectChange,
+            type: this.type,
+            getCheckboxProps: record => ({
+              props: {
+                disabled: false,
+                name: record.id
+              }
+            })
+          },
+          customRow: (record) => {
+            return {
+              on: { // 事件
+                click: (event) => { // 点击行
+                  // 选择对象
+                  this.mySelect([record.id], [record])
+                },
+                dblclick: (event) => {
+                  this.mySelect([record.id], [record])
+                  this.handleSelect()
+                }
+              }
+            }
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    handleView (record) {
+      fetchActivitiUserModel({ id: record.id }).then(res => {
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+    handleOk () {
+      this.$refs.table.refresh()
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    resetSearchForm () {
+      this.queryParam = {
+      }
+      this.$refs.table.refresh(true)
+    },
+    base (record, queryParam = {}) {
+      this.visible = true
+      this.modalTitle = '选择信息'
+      this.extraQueryParam = queryParam
+      this.record = record
+      if (this.isCreated) {
+        this.$refs.table.clearSelected()
+        this.options.rowSelection.type = this.type
+        this.handleOk()
+      } else {
+        this.tableOption()
+        this.isCreated = true
+      }
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+    },
+    handleSelect () {
+      if (this.selectedRowKeys.length === 0) {
+        this.$message.warn('请至少选择一项信息')
+      } else {
+        this.confirmLoading = true
+        this.$emit('selected', this.record, this.selectedRowKeys, this.selectedRows)
+        this.confirmLoading = false
+        this.visible = false
+      }
+    },
+    mySelect (selectedRowKeys, selectedRows) {
+      if (this.type === 'radio') {
+        this.$refs.table.updateSelect(selectedRowKeys, selectedRows)
+        this.$refs.table.rowSelection.onChange(selectedRowKeys, selectedRows)
+      } else {
+        let mySelectedRowKeys
+        let mySelectedRows = this.selectedRows.filter(item => item.id !== selectedRowKeys[0])
+        if (this.selectedRowKeys.includes(selectedRowKeys[0])) {
+          mySelectedRowKeys = this.selectedRowKeys.filter(item => item !== selectedRowKeys[0])
+        } else {
+          mySelectedRowKeys = [...selectedRowKeys, ...this.selectedRowKeys]
+          mySelectedRows = [...mySelectedRows, ...selectedRows]
+        }
+        this.$refs.table.updateSelect(mySelectedRowKeys, mySelectedRows)
+        this.$refs.table.rowSelection.onChange(mySelectedRowKeys, mySelectedRows)
+      }
+    }
+  }
+}
+</script>

+ 171 - 0
src/views/activiti/user-model/modules/ActivitiUserModelTable.vue

@@ -0,0 +1,171 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="1200"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    class="ant-modal2"
+    @cancel="handleCancel"
+  >
+    <div class="table-operator" style="margin-bottom: 8px;">
+    </div>
+    <a-table
+      bordered
+      :data-source="data"
+      :columns="columns"
+      tableLayout="auto"
+      rowKey="id"
+      :row-selection="rowSelection">
+      <span slot="action" slot-scope="record">
+        <template>
+          <a @click="handleView(record)">查看</a>
+          <a-divider type="vertical" />
+          <a @click="handleEdit(record)">修改</a>
+        </template>
+      </span>
+    </a-table>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
+    </template>
+    <base-form ref="baseModal" @ok="handleOk"/>
+    <detail ref="detailModal" @ok="handleOk"/>
+  </a-modal>
+</template>
+
+<script>
+import {
+  fetchActivitiUserModel,
+  fetchActivitiUserModelByModelId,
+  updateActivitiUserModelBatch
+} from '@/api/activiti/user-model'
+import BaseForm from './BaseForm'
+import Detail from './Detail'
+
+export default {
+  name: 'ActivitiUserModelTable',
+  components: {
+    BaseForm,
+    Detail
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false,
+      maskClosable: false,
+      model: null,
+      storeId: null,
+      typeMap: {},
+      userList: {},
+      storeTreeDate: [],
+      rowSelection: {
+        onChange: (selectedRowKeys, selectedRows) => {
+          this.selectedRowKeys = selectedRowKeys
+          this.selectedRows = selectedRows
+        }
+      },
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          customRender: (text, record, index) => {
+            return `${index + 1}`
+          }
+        },
+        {
+          title: '模型id',
+          dataIndex: 'reModelId'
+        },
+        {
+          title: '节点名称',
+          dataIndex: 'name'
+        },
+        {
+          title: '类型',
+          dataIndex: 'type',
+          customRender: (text, record, index) => {
+            return this.BaseTool.Object.getField(this.typeMap, text)
+          }
+        },
+        {
+          title: '流程变量',
+          dataIndex: 'formVariable'
+        },
+        {
+          title: '备注',
+          dataIndex: 'remark'
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      data: [],
+      user: this.$store.getters.userInfo,
+      selectedRowKeys: [],
+      selectedRows: [],
+      options: {
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys
+        }
+      }
+    }
+  },
+  props: {
+  },
+  created () {
+    // 下拉框map
+    this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.ACTIVITI_USER_MODEL_TYPE)
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      this.model = record
+      this.modalTitle = '节点设置'
+      fetchActivitiUserModelByModelId({ id: record.id }).then(res => {
+        this.data = res.data
+      })
+    },
+    handleEdit (record) {
+      fetchActivitiUserModel({ id: record.id }).then(res => {
+        const modal = this.$refs.baseModal
+        modal.base(res.data)
+      })
+    },
+    handleView (record) {
+      fetchActivitiUserModel({ id: record.id }).then(res => {
+        const modal = this.$refs.detailModal
+        modal.base(res.data)
+      })
+    },
+    save () {
+      this.confirmLoading = true
+      updateActivitiUserModelBatch({ list: this.data, modelId: this.model.id })
+        .then(() => {
+          this.handleCancel()
+        }).catch(() => {
+          this.confirmLoading = false
+        })
+    },
+    handleOk () {
+      this.visible = true
+      this.base(this.model)
+    },
+    handleCancel (values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      if (this.BaseTool.Object.isNotBlank(values)) {
+        this.$emit('ok', values)
+      } else {
+        this.$emit('ok')
+      }
+    }
+  }
+}
+</script>

+ 226 - 0
src/views/activiti/user-model/modules/BaseForm.vue

@@ -0,0 +1,226 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="1200"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    class="ant-modal2"
+    @cancel="handleCancel"
+  >
+    <a-row :gutter="48" slot="extra">
+      <a-col :md="48" :sm="48">
+        <span class="table-page-search-submitButtons" style="float: right">
+          <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
+          <a-button style="margin-left: 8px" type="default" @click="handleCancel()">返回</a-button>
+        </span>
+      </a-col>
+    </a-row>
+    <a-form :form="form">
+
+      <a-form-item v-show="false">
+        <a-input v-decorator="['id']" type="hidden"/>
+        <a-input v-decorator="['assignee']" type="hidden"/>
+        <a-input v-decorator="['roleId']" type="hidden"/>
+      </a-form-item>
+
+      <row-list :col="2">
+        <row-item>
+
+          <a-form-item
+            label="模型id"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              disabled
+              v-decorator="['reModelId', {rules: [{required: true, message: '模型id不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+
+          <a-form-item
+            label="节点名称"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              disabled
+              v-decorator="['name', {rules: [{required: true, message: '节点名称不能为空'}]}]"/>
+          </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-input
+              style="width: 60%"
+              v-decorator="['realName', {rules: [{required: true, message: '审批人不能为空'}]}]"/>
+            <a-button type="primary" style="width: 20%" @click="handleUserSelect">选择</a-button>
+            <a-button type="default" style="width: 20%" @click="clearUserSelect">清空</a-button>
+          </a-form-item>
+        </row-item>
+        <row-item>
+
+          <a-form-item
+            label="流程变量"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['formVariable', {rules: [{required: false, message: '流程变量不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+        <row-item>
+          <a-form-item
+            label="备注"
+            :labelCol="BaseTool.Constant.labelCol"
+            :wrapperCol="BaseTool.Constant.wrapperCol"
+          >
+            <a-input
+              v-decorator="['remark', {rules: [{required: true, message: '备注不能为空'}]}]"/>
+          </a-form-item>
+        </row-item>
+      </row-list>
+    </a-form>
+    <template slot="footer">
+      <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
+    </template>
+    <user-select-modal ref="userSelectModal" @selected="handleUserSelected"/>
+  </a-modal>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import { addActivitiUserModel, updateActivitiUserModel } from '@/api/activiti/user-model'
+import UserSelectModal from '@/views/upms/user/modules/UserSelectModal'
+export default {
+  name: 'BaseActivitiUserModel',
+  components: {
+    UserSelectModal
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      modalTitle: null,
+      form: this.$form.createForm(this),
+      visible: false,
+      // 下拉框map
+      typeMap: {}
+    }
+  },
+  props: {},
+  created () {
+    // 下拉框map
+    this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.ACTIVITI_USER_MODEL_TYPE)
+  },
+  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, [
+          'id',
+          'reModelId',
+          'name',
+          'type',
+          'assignee',
+          'realName',
+          'roleId',
+          'roleName',
+          'formVariable',
+          'remark'
+        ])))
+      })
+    },
+    save () {
+      const { form: { validateFieldsAndScroll } } = this
+      this.confirmLoading = true
+      validateFieldsAndScroll((errors, values) => {
+        if (errors) {
+          this.confirmLoading = false
+          return
+        }
+        // 日期处理
+        if (this.BaseTool.String.isBlank(values.id)) {
+          addActivitiUserModel(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+              this.confirmLoading = false
+            })
+        } else {
+          updateActivitiUserModel(values)
+            .then(() => {
+              this.handleCancel(values)
+            }).catch(() => {
+              this.confirmLoading = false
+            })
+        }
+      })
+    },
+    handleUserSelect () {
+      this.$refs.userSelectModal.base({})
+    },
+    handleUserSelected (keys, rows) {
+      // const [ key ] = keys
+      const [ row ] = rows
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign({
+          'assignee': row.userId,
+          'realName': row.realName
+        }))
+      })
+    },
+    clearUserSelect () {
+      const { form: { setFieldsValue } } = this
+      // 日期处理
+      this.$nextTick(() => {
+        setFieldsValue(Object.assign({
+          'assignee': null,
+          'realName': null
+        }))
+      })
+    },
+    handleCancel (values) {
+      this.visible = false
+      this.confirmLoading = false
+      this.form.resetFields()
+      if (this.BaseTool.Object.isNotBlank(values)) {
+        this.$emit('ok', values)
+      } else {
+        this.$emit('ok')
+      }
+    }
+  }
+}
+</script>

+ 77 - 0
src/views/activiti/user-model/modules/Detail.vue

@@ -0,0 +1,77 @@
+<template>
+  <a-modal
+    :title="modalTitle"
+    :width="1200"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    class="ant-modal2"
+    @cancel="handleCancel"
+  >
+    <detail-list title="" :col="2">
+      <detail-list-item term="模型id">{{ model.reModelId }}</detail-list-item>
+      <detail-list-item term="节点名称">{{ model.name }}</detail-list-item>
+      <detail-list-item term="类型">{{ BaseTool.Object.getField(this.typeMap,model.type) }}</detail-list-item>
+      <detail-list-item term="指定审批人">{{ model.realName }}</detail-list-item>
+      <detail-list-item term="指定角色">{{ model.roleName }}</detail-list-item>
+      <detail-list-item term="流程变量">{{ model.formVariable }}</detail-list-item>
+      <detail-list-item term="备注">{{ model.remark }}</detail-list-item>
+      <detail-list-item term="更新日期">{{ model.updateTime }}</detail-list-item>
+      <detail-list-item term="创建人">{{ model.createdUserId }}</detail-list-item>
+      <detail-list-item term="更新人">{{ model.updateUserId }}</detail-list-item>
+      <detail-list-item term="更新人名称">{{ model.updateUserName }}</detail-list-item>
+    </detail-list>
+  </a-modal>
+</template>
+
+<script>
+import DetailList from '@/components/tools/DetailList'
+const DetailListItem = DetailList.Item
+
+export default {
+  name: 'ActivitiUserModelDetail',
+  components: {
+    DetailList,
+    DetailListItem
+  },
+  data () {
+    return {
+      confirmLoading: false,
+      mdl: {},
+      modalTitle: null,
+      visible: false,
+      // 下拉框map
+      typeMap: {},
+      model: {
+        'reModelId': null,
+        'name': null,
+        'type': null,
+        'assignee': null,
+        'realName': null,
+        'roleId': null,
+        'roleName': null,
+        'formVariable': null,
+        'remark': null,
+        'updateTime': null,
+        'createdUserId': null,
+        'updateUserId': null,
+        'updateUserName': null
+      }
+    }
+  },
+  created () {
+    // 下拉框map
+    this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.ACTIVITI_USER_MODEL_TYPE)
+  },
+  methods: {
+    base (record) {
+      this.visible = true
+      this.modalTitle = '详情'
+      this.model = record
+    },
+    handleCancel () {
+      this.visible = false
+      this.confirmLoading = false
+    }
+  }
+}
+</script>

+ 44 - 128
src/views/sb/scrap/SbInfoScrap.vue

@@ -79,8 +79,14 @@
             <span slot="action" slot-scope="record">
               <template>
                 <a @click="handleView(record)">查看</a>
-                <a-divider v-if="record.status != 3 && record.status != 4" type="vertical" />
+                <a-divider type="vertical" />
                 <a v-if="record.status != 3 && record.status != 4" @click="handleEdit(record)">报废</a>
+                <a-divider type="vertical" />
+                <a @click="handleViewImage(record)">流程图</a>
+                <a-divider type="vertical" />
+                <a @click="handleViewHistory(record)">审批历史</a>
+                <a-divider type="vertical" />
+                <a @click="handleStop(record)">终止审批</a>
               </template>
             </span>
             <span slot="status" slot-scope="text">
@@ -94,6 +100,8 @@
     </a-row>
     <base-form ref="baseModal" @ok="handleOk"/>
     <detail ref="detailModal" @ok="handleOk"/>
+    <image-modal ref="imageModal"/>
+    <history-table ref="historyModal"/>
   </a-card>
 
 </template>
@@ -104,9 +112,17 @@ import BaseForm from './modules/BaseForm'
 import Detail from './modules/Detail'
 import DownloadModal from '@/views/download/DownloadModal'
 import PreviewModal from '@/views/preview/PreviewModal'
-import { updateSbInfo, getSbInfoPage, deleteSbInfos, fetchSbInfo, fetchSbInfos, exportSbInfo } from '@/api/sb/info'
-import { queryDept, getDeptsAllByParentId } from '@/api/upms/dept'
-import BaseTool from '../../../utils/tool'
+import ImageModal from '@/views/activiti/ImageModal'
+import HistoryTable from '@/views/activiti/HistoryTable'
+import {
+  getSbInfoPage,
+  deleteSbInfos,
+  exportSbInfo,
+  startSbInfoScrap,
+  stopSbInfoScrapForAudit
+} from '@/api/sb/info'
+import { queryDept } from '@/api/upms/dept'
+
 import { fetchSbTypeTree } from '@/api/sb/type'
 
 export default {
@@ -117,7 +133,9 @@ export default {
     BaseForm,
     Detail,
     DownloadModal,
-    PreviewModal
+    PreviewModal,
+    ImageModal,
+    HistoryTable
   },
   props: {
     filter: {
@@ -251,7 +269,7 @@ export default {
           title: '状态',
           checked: true,
           dataIndex: 'status',
-          width: 100,
+          width: 200,
           fixed: 'right',
           scopedSlots: { customRender: 'status' }
         },
@@ -261,7 +279,7 @@ export default {
           checked: true,
           fixed: 'right',
           align: 'center',
-          width: '100',
+          width: '250',
           scopedSlots: { customRender: 'action' }
         }
       ],
@@ -347,76 +365,30 @@ export default {
       })
     },
     handleEdit (record) {
-      fetchSbInfo({ id: record.id }).then(res => {
-        this.visible = false
-        const modal = this.$refs.baseModal
-        modal.base(res.data)
+      startSbInfoScrap(record).then(res => {
+        this.$message.info(res.data)
+        this.handleOk()
       })
     },
-    printQcode (record) {
-      let recordList = []
-      if (this.BaseTool.String.isBlank(record)) {
-        const length = this.selectedRows.length
-        if (length === 0) {
-          this.$message.info('请选择要打印的记录')
-          return
-        }
-        recordList = this.selectedRows
-      } else {
-        recordList = [record]
-      }
-      this.$refs.printSbCode.base(recordList)
+    handleViewImage (record) {
+      const modal = this.$refs.imageModal
+      modal.base(record.processInstanceId)
     },
-    handleStart (record) {
-      record.status = 2
-      updateSbInfo(record).then(res => {
-        this.$message.info('已启用')
-      })
+    handleViewHistory (record) {
+      const modal = this.$refs.historyModal
+      modal.base(record)
     },
     handleStop (record) {
-      record.status = 7
-      updateSbInfo(record).then(res => {
-        this.$message.info('已停用')
-      })
-    },
-    handleAdd () {
-      this.visible = false
-      this.$refs.baseModal.base()
-    },
-    handleView (record) {
-      fetchSbInfo({ id: record.id }).then(res => {
-        this.visible = false
-        const modal = this.$refs.detailModal
-        modal.base(res.data)
-      })
-    },
-    handleAreaChange (value) {
-      getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.FEN_GONG_SI }).then(res => {
-        this.companyList = res.data
-      })
-    },
-    handleCompanyChange (value) {
-      getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.XIANG_MU_BU }).then(res => {
-        this.projectList = res.data
-      })
-    },
-    handleProjectChange (value) {
-      getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.BU_MEN }).then(res => {
-        this.deptList = res.data
-      })
-    },
-    handleDeptChange (value) {
-      getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.BAN_ZU }).then(res => {
-        this.groupList = res.data
-      })
-    },
-    handleCopy (record) {
-      this.visible = false
-      fetchSbInfo({ id: record.id }).then(res => {
-        const modal = this.$refs.baseModal
-        res.data.id = null
-        modal.base(res.data)
-      })
+      this.$message.info('正在终止审批流程,请勿重复点击')
+      this.confirmLoading = true
+      stopSbInfoScrapForAudit(record)
+        .then(() => {
+          this.$message.info('已成功终止审批流程,可以重新发起审批')
+          this.confirmLoading = false
+          this.handleOk()
+        }).catch(() => {
+          this.confirmLoading = false
+        })
     },
     handleOk () {
       this.visible = true
@@ -458,62 +430,6 @@ export default {
     onExpand (expandedKeys) {
       this.expandedKeys = expandedKeys
       this.autoExpandParent = false
-    },
-    handleRepairFilePreview (record) {
-      console.log(record, 87878)
-      this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE)
-    },
-    handleRepairFileDownload (record) {
-      // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE, getDownloadUrl(record.id))
-    },
-    handleUseFilePreview (record) {
-      this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_USEFILE)
-    },
-    handleUseFileDownload (record) {
-      // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_USEFILE, getDownloadUrl(record.id))
-    },
-    handleCheckFilePreview (record) {
-      this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_RECHECKFILE)
-    },
-    handleCheckFileDownload (record) {
-      // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_RECHECKFILE, getDownloadUrl(record.id))
-    },
-    doImport () {
-      if (this.queryParam.useCompany == null) {
-        this.$message.error('请先选择公司')
-        return
-      }
-      if (this.queryParam.useProject == null) {
-        this.$message.error('请先选择项目部')
-        return
-      }
-      this.$refs.importModal.base(this.queryParam.useCompany, this.queryParam.useProject)
-    },
-    doImportDe () {
-      this.queryParam.useCompany = null
-      this.queryParam.useProject = null
-      this.$refs.importModal.base()
-    },
-    handlePrint (record) {
-      this.visible = false
-      fetchSbInfo({ id: record.id }).then(res => {
-        const modal = this.$refs.printInSbInfoBatch
-        modal.base([res.data])
-      })
-    },
-    handlePrintBatch () {
-      this.visible = false
-      let ids = []
-      const length = this.selectedRows.length
-      if (length === 0) {
-        this.$message.info('请选择要打印的记录')
-        return
-      }
-      ids = this.selectedRows.map(item => item.id)
-      fetchSbInfos(ids).then(res => {
-        const modal = this.$refs.printInSbInfoBatch
-        modal.base(res.data)
-      })
     }
   }
 }

+ 4 - 12
src/views/sb/scrap/modules/DetailAuditScrap.vue

@@ -4,7 +4,7 @@
       <a-row :gutter="48" slot="extra">
         <a-col :md="48" :sm="48">
           <span class="table-page-search-submitButtons" style="float: right">
-            <a-button type="error" :loading="confirmLoading" v-if="model.status == 3" @click="save()">提交审批</a-button>
+            <a-button type="error" :loading="confirmLoading" @click="save()">审核</a-button>
             <a-button style="margin-left: 8px" @click="handleCancel()">返回</a-button>
           </span>
         </a-col>
@@ -84,7 +84,7 @@
 
 <script>
 import DetailList from '@/components/tools/DetailList'
-import { fetchSbInfo, auditProcess, updateSbInfoScrapForAudit } from '@/api/sb/info'
+import { fetchSbInfo, auditSbInfoScrapForAudit } from '@/api/sb/info'
 import RepairApplicationFormTable from '@/views/repair/application-form/modules/RepairApplicationFormTable'
 import CheckJobTable from '@/views/check/checkjob/modules/CheckJobTable'
 import SparePartUsedSelectTable from '@/views/sqarepartmanage/sparepartused/modules/SparePartUsedSelectTable'
@@ -92,7 +92,6 @@ import SbRunFillPageTable from '@/views/sb/run-fill/modules/SbRunFillPageTable'
 import SbInspectionFillPageTable from '@/views/sb/inspection-fill/modules/SbInspectionFillPageTable'
 import PrintInForm from '@/views/sb/scrap/modules/PrintInForm'
 import { getAuditRecord } from '@/api/activiti/activiti'
-import { formatDate } from '@/utils/util'
 const DetailListItem = DetailList.Item
 
 export default {
@@ -113,6 +112,7 @@ export default {
       mdl: {},
       modalTitle: null,
       visible: false,
+      taskId: null,
       visible2: true,
       refuseReason: '同意',
       auditFlag: 1,
@@ -278,7 +278,7 @@ export default {
     },
     save () {
       this.confirmLoading = true
-      auditProcess({ id: this.model.id, refuseReason: this.refuseReason, auditFlag: this.auditFlag, taskId: this.taskId })
+      auditSbInfoScrapForAudit({ id: this.model.id, refuseReason: this.refuseReason, auditFlag: this.auditFlag, taskId: this.taskId })
         .then(() => {
           this.$message.info('操作成功')
           this.handleOk()
@@ -301,14 +301,6 @@ export default {
         this.getAuditRecords(data)
       })
     },
-    updateSbInfoScrapForAudit () {
-      updateSbInfoScrapForAudit(this.model)
-        .then(() => {
-          this.handleCancel(this.model)
-        }).catch(() => {
-          this.confirmLoading = false
-        })
-    },
     changeOpinion (e) {
       this.refuseReason = e.target.value ? '同意' : '不同意'
     }