123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- <template>
- <a-card :bordered="false">
- <div v-if="visible">
- <div class="table-page-search-wrapper">
- <a-form layout="inline">
- <a-row :gutter="48">
- <a-col :md="8" :sm="24">
- <a-form-item label="关键字">
- <a-input v-model.trim="queryParam.keyword" placeholder="请输单号"/>
- </a-form-item>
- </a-col>
- <a-col :md="8 || 24" :sm="24">
- <span class="table-page-search-submitButtons">
- <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
- <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
- </span>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <s-table
- ref="table"
- size="small"
- rowKey="id"
- :columns="columns"
- :data="loadData"
- :scroll="{x: 1500, y: BaseTool.Constant.scrollY}"
- showPagination="auto"
- >
- <span slot="action" slot-scope="record">
- <template>
- <a @click="handleView(record)">查看</a>
- </template>
- </span>
- </s-table>
- </div>
- <detail-audit-scrap :audit="false" ref="detailAuditScrapModal" @ok="handleOk"/>
- </a-card>
- </template>
- <script>
- import { STable, Ellipsis } from '@/components'
- import AssignForm from './modules/AssignForm'
- import DetailAuditScrap from '@/views/sb/scraps/modules/DetailAudit'
- import { getLocalTaskPageFinish } from '@/api/activiti/activiti'
- import { fetchCustomFieldTemplateVOData } from '@/api/customize/fieldTemplateData'
- import { fetchOutStoreForm } from '@/api/store/outstoreform'
- export default {
- name: 'TaskList',
- components: {
- STable,
- Ellipsis,
- DetailAuditScrap,
- AssignForm
- },
- data () {
- return {
- mdl: {},
- statusMap: {},
- // 查询参数
- queryParam: {
- },
- // 表头
- columns: [
- {
- title: '序号',
- dataIndex: 'index',
- checked: true,
- width: 80,
- customRender: (text, record, index) => {
- return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
- }
- },
- {
- title: '类型',
- dataIndex: 'targetCode',
- checked: true,
- width: 120,
- customRender: (text, record, index) => {
- return this.DictCache.VALUE.SB_INFO_AUDIT_MODEL_NAME[text]
- }
- },
- {
- title: '任务名称',
- checked: true,
- width: 120,
- dataIndex: 'targetName'
- },
- {
- title: '单号',
- checked: true,
- width: 180,
- dataIndex: 'no'
- },
- {
- title: '申请人',
- checked: true,
- width: 120,
- dataIndex: 'userName'
- },
- {
- title: '创建时间',
- checked: true,
- width: 150,
- dataIndex: 'applyTime'
- },
- {
- title: '审批时间',
- checked: true,
- width: 150,
- dataIndex: 'createTime'
- },
- {
- title: '审批意见',
- checked: true,
- width: 120,
- dataIndex: 'opinion'
- },
- {
- title: '状态',
- checked: true,
- width: 100,
- dataIndex: 'status',
- fixed: 'right',
- customRender: (text, record, index) => {
- return this.BaseTool.Table.statusCustomRenderDict(this, text, record,
- this.DictCache.COLOR.SB_ALLOCATE_APPLY_STATUS, this.statusMap)
- }
- },
- {
- title: '操作',
- key: 'action',
- width: '220px',
- checked: true,
- fixed: 'right',
- align: 'center',
- scopedSlots: { customRender: 'action' }
- }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- return getLocalTaskPageFinish(Object.assign(parameter, this.queryParam))
- .then(res => {
- return res.data
- })
- },
- selectedRowKeys: [],
- selectedRows: [],
- menus: [],
- visible: true,
- options: {
- alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
- rowSelection: {
- selectedRowKeys: this.selectedRowKeys,
- onChange: this.onSelectChange
- }
- },
- optionAlertShow: false
- }
- },
- created () {
- this.tableOption()
- this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.ACTIVITI_FORM_STATUS)
- },
- 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
- }
- },
- handleView (record) {
- this.visible = false
- if (record.targetCode === 'out_store_back') { // 仓库审批跳转到仓库审批页面
- fetchOutStoreForm({ id: record.targetId }).then(res => {
- const templateData = res.data
- const recordTemp = res.data
- recordTemp.taskId = record.taskId
- recordTemp.remark = record.targetCode
- this.$refs.detailAuditScrapModal.base(recordTemp, templateData)
- })
- } else {
- fetchCustomFieldTemplateVOData({ id: record.targetId }).then(res => {
- const templateData = JSON.parse(res.data.data)
- const recordTemp = res.data
- recordTemp.taskId = record.taskId
- this.$refs.detailAuditScrapModal.base(recordTemp, templateData)
- })
- }
- /* fetchCustomFieldTemplateData({ id: record.targetId }).then(res => {
- const templateData = JSON.parse(res.data.data)
- this.$refs.detailAuditScrapModal.base(record, templateData)
- }) */
- },
- handleOk () {
- this.visible = true
- this.$refs.table.refresh()
- },
- onSelectChange (selectedRowKeys, selectedRows) {
- this.selectedRowKeys = selectedRowKeys
- this.selectedRows = selectedRows
- },
- resetSearchForm () {
- this.queryParam = {
- }
- this.$refs.table.refresh(true)
- }
- }
- }
- </script>
- <style lang="less" scoped>
- </style>
|