| | |
| | | <template> |
| | | <div> |
| | | <a-modal width="65%" :title="title" :visible="visible" @cancel="visible=false" :maskClosable="false" centered |
| | | @ok="confirmBatchDeleteDocument"> |
| | | <div class="table-page-search-wrapper"> |
| | | <a-form layout="inline" @keyup.enter.native="searchQuery"> |
| | | <a-row :gutter="24"> |
| | | <a-col :md="6" :sm="6"> |
| | | <a-form-item label="文件名称"> |
| | | <a-input placeholder="请输入文件名称" v-model="queryParam.docName" allow-clear></a-input> |
| | | </a-form-item> |
| | | </a-col> |
| | | |
| | | <a-col :md="8" :sm="8"> |
| | | <a-form-item label="创建时间"> |
| | | <a-range-picker v-model="date" value-format="YYYY-MM-DD" @change="handleDateChange" |
| | | allow-clear></a-range-picker> |
| | | </a-form-item> |
| | | </a-col> |
| | | |
| | | <a-col :md="4" :sm="4"> |
| | | <a-button type="primary" @click="searchQuery" icon="search">查询</a-button> |
| | | </a-col> |
| | | </a-row> |
| | | </a-form> |
| | | </div> |
| | | |
| | | <a-table :columns="columns" :data-source="dataSource" bordered :pagination="ipagination" :loading="loading" |
| | | :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" @change="handleTableChange" |
| | | :scroll="{y:380}" :size="size" rowKey="docId" style="min-height: 480px"> |
| | | <span slot="docName" slot-scope="text">{{text}}</span> |
| | | </a-table> |
| | | </a-modal> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getAction } from '@/api/manage' |
| | | import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
| | | import dncApi from '@/api/dnc' |
| | | |
| | | export default { |
| | | name: 'DocumentBatchDeleteModal', |
| | | components: {}, |
| | | data() { |
| | | return {} |
| | | mixins: [JeecgListMixin], |
| | | props: { |
| | | currentDocumentInfo: { |
| | | type: Object |
| | | }, |
| | | size: { |
| | | type: String |
| | | } |
| | | }, |
| | | methods: {} |
| | | data() { |
| | | return { |
| | | disableMixinCreated: true, |
| | | visible: false, |
| | | title: '', |
| | | date: [], |
| | | columns: [ |
| | | { |
| | | title: '序号', |
| | | dataIndex: 'rowIndex', |
| | | key: 'rowIndex', |
| | | width: 65, |
| | | align: 'center', |
| | | customRender: function(t, r, index) { |
| | | return parseInt(index) + 1 |
| | | } |
| | | }, |
| | | { |
| | | title: '文件名称', |
| | | dataIndex: 'docName', |
| | | key: 'docName', |
| | | align: 'center', |
| | | width: 300, |
| | | sorter: true |
| | | }, |
| | | { title: '设备编号', dataIndex: 'docCode', align: 'center' }, |
| | | { |
| | | title: '出库状态', |
| | | dataIndex: 'pullStatus_dictText', |
| | | key: 'pullStatus', |
| | | align: 'center', |
| | | filters: [ |
| | | { text: '未出库', value: 1 }, |
| | | { text: '已出库', value: 2 } |
| | | ], |
| | | }, |
| | | { |
| | | title: '状 态', |
| | | dataIndex: 'docStatus_dictText', |
| | | key: 'docStatus', |
| | | align: 'center', |
| | | filters: [ |
| | | { text: '设计', value: 1 }, |
| | | { text: '发布', value: 2 }, |
| | | { text: '归档', value: 3 } |
| | | ], |
| | | }, |
| | | { title: '系统指定版本', dataIndex: 'publishVersion', align: 'center', width: 200 }, |
| | | { |
| | | title: '创建时间', |
| | | dataIndex: 'createTime', |
| | | align: 'center', |
| | | width: 200, |
| | | sorter: true |
| | | } |
| | | ], |
| | | spinning: false, |
| | | url: { |
| | | list: '/nc/doc/find/page' |
| | | } |
| | | } |
| | | }, |
| | | watch: { |
| | | visible: { |
| | | handler(value) { |
| | | if (value) { |
| | | this.resetData() |
| | | this.loadData() |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | // 获取当前工序或工步对应文档列表 |
| | | loadData() { |
| | | this.dataSource = [] |
| | | if (!this.url.list) { |
| | | this.$message.error('请设置url.list属性!') |
| | | return |
| | | } |
| | | |
| | | var params = this.getQueryParams()//查询条件 |
| | | if (!params) return false |
| | | const { attributionType, attributionId, param } = this.currentDocumentInfo |
| | | params.attributionType = attributionType |
| | | params.attributionId = attributionId |
| | | params.docClassCode = param |
| | | console.log('params', params) |
| | | this.loading = true |
| | | getAction(this.url.list + `/${this.ipagination.current}/${this.ipagination.pageSize}`, params).then((res) => { |
| | | if (res.success) { |
| | | this.dataSource = res.result.records |
| | | if (res.result.total) { |
| | | this.ipagination.total = res.result.total |
| | | } else { |
| | | this.ipagination.total = 0 |
| | | } |
| | | } |
| | | else this.$message.warning(res.message) |
| | | }).finally(() => { |
| | | this.loading = false |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * 表格分页、排序改变、筛选时触发 |
| | | * @param pagination 分页器选项 |
| | | * @param filters 筛选选项 |
| | | * @param sorter 排序选项 |
| | | */ |
| | | handleTableChange(pagination, filters, sorter) { |
| | | if (sorter.order) { |
| | | this.isorter.column = sorter.field |
| | | this.isorter.order = sorter.order === 'ascend' ? 'asc' : 'desc' |
| | | } else { |
| | | this.isorter.column = 'createTime' |
| | | this.isorter.order = 'desc' |
| | | } |
| | | for (let key in filters) { |
| | | this.filters[key] = filters[key].join(',') |
| | | } |
| | | this.ipagination = pagination |
| | | this.loadData() |
| | | }, |
| | | |
| | | // 时间选择器选择完成后触发 |
| | | handleDateChange(value) { |
| | | this.queryParam.startTime = value[0] |
| | | this.queryParam.endTime = value[1] |
| | | }, |
| | | |
| | | // 确认批量删除文档 |
| | | confirmBatchDeleteDocument() { |
| | | const that = this |
| | | const { selectedRowKeys, $notification, $confirm, currentDocumentInfo: { param, attributionId } } = that |
| | | |
| | | if (selectedRowKeys.length === 0) { |
| | | $notification.warning({ |
| | | message: '消息', |
| | | description: '请选择文档' |
| | | }) |
| | | return |
| | | } |
| | | |
| | | $confirm({ |
| | | title: '提示', |
| | | content: `删除后不可取消,确认删除吗?`, |
| | | okText: '确认', |
| | | cancelText: '取消', |
| | | onOk: () => { |
| | | let hasRequestedSuccessCount = 0 |
| | | let hasRequestedCount = 0 |
| | | selectedRowKeys.forEach(key => { |
| | | dncApi.deleteDocumentApi(key) |
| | | .then(res => { |
| | | if (res.success) { |
| | | $notification.success({ |
| | | message: '消息', |
| | | description: res.message |
| | | }) |
| | | hasRequestedSuccessCount++ |
| | | } else { |
| | | $notification.error({ |
| | | message: '消息', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | hasRequestedCount++ |
| | | if (hasRequestedCount === selectedRowKeys.length && hasRequestedSuccessCount > 0) { |
| | | this.loadData() |
| | | this.$emit('reloadDocumentListData', { docClassCode: param, attributionId }) |
| | | } |
| | | }) |
| | | }) |
| | | that.$destroyAll() |
| | | }, |
| | | onCancel: () => { |
| | | that.$destroyAll() |
| | | } |
| | | }) |
| | | |
| | | |
| | | }, |
| | | |
| | | resetData() { |
| | | this.queryParam = {} |
| | | this.selectedRowKeys = [] |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | | </script> |