<template>
|
<a-card
|
title=""
|
:bordered='false'
|
>
|
<div class='table-page-search-wrapper'>
|
<a-form
|
layout='inline'
|
@keyup.enter.native='searchQuery'
|
>
|
<a-row :gutter='24'>
|
<a-col
|
:xl='6'
|
:lg='7'
|
:md='8'
|
:sm='24'
|
>
|
<a-form-item label='请购编码'>
|
<j-input
|
placeholder='请输入请购编码'
|
v-model='queryParam.num'
|
></j-input>
|
</a-form-item>
|
</a-col>
|
<a-col
|
:xl='6'
|
:lg='7'
|
:md='8'
|
:sm='24'
|
>
|
<a-form-item
|
label="部门"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
>
|
<j-dict-select-tag
|
dictCode="sys_depart,depart_name,id"
|
placeholder="请选择维护部门"
|
v-model="queryParam.departId"
|
/>
|
</a-form-item>
|
</a-col>
|
|
<a-col
|
:xl='6'
|
:lg='7'
|
:md='8'
|
:sm='24'
|
>
|
<a-form-item label='设备名称'>
|
<!-- <a-input
|
placeholder='请输入设备名称'
|
v-model='queryParam.name'
|
></a-input> -->
|
<j-dict-select-tag
|
:dictCode="'mom_eam_equipment,num,id ,del_flag!=\'1\' and use_id = ' +'\''+ queryParam.departId+'\''"
|
placeholder="请选择设备"
|
v-model="queryParam.equipmentId"
|
/>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
|
<div class="table-operator">
|
<a-button
|
@click='handleAdd'
|
type='primary'
|
icon='plus'
|
v-has="'spartPartRequirement:add'"
|
>新增</a-button>
|
<a-button
|
type="primary"
|
@click="searchQuery"
|
icon="search"
|
>查询</a-button>
|
<a-button
|
type="primary"
|
@click="searchReset"
|
icon="reload"
|
style="margin-left: 8px"
|
>重置</a-button>
|
<a-button
|
v-show="this.selectedRowKeys.length > 0 && this.queryParam.versionStatus == '1'"
|
type="primary"
|
@click="batchHandleOK"
|
icon="reload"
|
style="margin-left: 8px"
|
>批量通过</a-button>
|
<a-button
|
v-show="this.selectedRowKeys.length > 0 && this.queryParam.versionStatus == '1'"
|
type="primary"
|
@click="batchHandleReject"
|
icon="reload"
|
style="margin-left: 8px"
|
>批量驳回</a-button>
|
</div>
|
|
<!-- table区域-begin -->
|
<div>
|
<div
|
class='ant-alert ant-alert-info'
|
style='margin-bottom: 16px;'
|
>
|
<i class='anticon anticon-info-circle ant-alert-icon'></i> 已选择 <a style='font-weight: 600'>{{ selectedRowKeys.length }}</a>项
|
<a
|
style='margin-left: 24px'
|
@click='onClearSelected'
|
>清空</a>
|
</div>
|
|
<a-table
|
ref='table'
|
size='middle'
|
bordered
|
rowKey='id'
|
:scroll="{ x: 'calc(1300px + 50%)', y: 700 }"
|
:columns='columns'
|
:dataSource='dataSource'
|
:pagination='ipagination'
|
:loading='loading'
|
:rowSelection='{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}'
|
:customRow='clickThenSelect'
|
@change='handleTableChange'
|
>
|
<span
|
slot="action"
|
slot-scope="text, record"
|
>
|
|
<a
|
@click="handleAuditApproval(record)"
|
v-show="record.auditStatus == '1' "
|
v-has="'spartPartRequirement:audit'"
|
>审核</a>
|
<a-divider type="vertical" />
|
<a-popconfirm
|
v-show="record.auditStatus == '0' || record.auditStatus == '3'"
|
title="确定提交吗?"
|
@confirm="() => handleSubmit(record)"
|
v-has="'spartPartRequirement:subit'"
|
>
|
<a>提交</a>
|
</a-popconfirm>
|
<a-divider type="vertical" />
|
<a
|
v-show="record.auditStatus == '0' || record.auditStatus == '3'"
|
@click="handleEdit(record)"
|
v-has="'spartPartRequirement:edit'"
|
>编辑</a>
|
<a-divider type="vertical" />
|
<a-popconfirm
|
v-show="record.auditStatus == '0' || record.auditStatus == '3'"
|
title="确定删除吗?"
|
@confirm="() => handleDelete(record.id)"
|
v-has="'spartPartRequirement:delete'"
|
>
|
<a>删除</a>
|
</a-popconfirm>
|
|
</span>
|
|
</a-table>
|
<a-tabs defaultActiveKey="1">
|
<a-tab-pane
|
tab='备件请购明细'
|
key="1"
|
>
|
<div
|
class="table-operator"
|
style="margin:-16px"
|
>
|
<spart-part-requirement-detail :sparePartRequirementId='sparePartRequirementId' />
|
</div>
|
</a-tab-pane>
|
|
</a-tabs>
|
</div>
|
|
<spart-part-requirement-modal
|
ref='modalForm'
|
@ok='modalFormOk'
|
></spart-part-requirement-modal>
|
|
<audit-approval-modal
|
ref='auditApprovalModal'
|
@ok='modalFormOk'
|
></audit-approval-modal>
|
</a-card>
|
</template>
|
|
<script>
|
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import { getAction, requestPut, downFile, postAction } from '@/api/manage'
|
import SpartPartRequirementDetail from './modules/spartPartRequirement/SpartPartRequirementDetail'
|
import SpartPartRequirementModal from './modules/spartPartRequirement/SpartPartRequirementModal'
|
import AuditApprovalModal from './modules/spartPartRequirement/AuditApprovalModal'
|
import '@/assets/less/TableExpand.less'
|
import JEllipsis from "@/components/jeecg/JEllipsis";
|
|
export default {
|
name: 'SpartPartRequirement',
|
mixins: [JeecgListMixin],
|
components: {
|
JEllipsis,
|
SpartPartRequirementDetail,
|
SpartPartRequirementModal,
|
AuditApprovalModal
|
},
|
data() {
|
return {
|
columns: [
|
{
|
title: '#',
|
dataIndex: '',
|
key: 'rowIndex',
|
width: 60,
|
align: 'center',
|
customRender: function (t, r, index) {
|
return parseInt(index) + 1
|
}
|
},
|
|
{
|
title: '请购单号',
|
align: 'center',
|
dataIndex: 'num',
|
},
|
{
|
title: '状态',
|
align: 'center',
|
dataIndex: 'auditStatus_dictText',
|
},
|
|
{
|
title: '设备信息',
|
align: 'center',
|
dataIndex: 'equipmentNumNameModel',
|
},
|
{
|
title: '部门',
|
align: 'center',
|
dataIndex: 'departId_dictText',
|
},
|
{
|
title: '请购人',
|
align: 'center',
|
dataIndex: 'person',
|
},
|
{
|
title: '请购时间',
|
align: 'center',
|
dataIndex: 'createBy',
|
},
|
{
|
title: '审核人',
|
align: 'center',
|
dataIndex: 'auditPerson',
|
},
|
{
|
title: '审核意见',
|
align: 'center',
|
dataIndex: 'approvalOpinions',
|
},
|
{
|
title: '审核时间',
|
align: 'center',
|
dataIndex: 'auditTime',
|
},
|
{
|
title: '操作',
|
dataIndex: 'action',
|
align: 'center',
|
fixed: 'right',
|
scopedSlots: { customRender: 'action' },
|
width: 180,
|
}
|
],
|
url: {
|
list: '/spare/sparePartRequirement/list',
|
delete: '/spare/sparePartRequirement/deleteNew',
|
deleteBatch: '/eam/inspectionStandard/deleteBatch',
|
importExcelUrl: "/eam/inspectionStandard/importExcel",
|
passBatch: '/eam/inspectionStandard/auditApprovalBatch',
|
submit: '/spare/sparePartRequirement/submit',
|
},
|
/* 分页参数 */
|
ipagination: {
|
current: 1,
|
pageSize: 10,
|
pageSizeOptions: ['5', '10', '20', '50'],
|
showTotal: (total, range) => {
|
return range[0] + '-' + range[1] + ' 共' + total + '条'
|
},
|
showQuickJumper: true,
|
showSizeChanger: true,
|
total: 0
|
},
|
sparePartRequirementId: '-1'
|
}
|
},
|
computed: {
|
importExcelUrl: function () {
|
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
|
}
|
},
|
methods: {
|
clickThenSelect(record) {
|
return {
|
on: {
|
click: () => {
|
this.onSelectChange(record.id.split(','), [record])
|
}
|
}
|
}
|
},
|
onClearSelected() {
|
this.selectedRowKeys = []
|
this.selectionRows = []
|
this.sparePartRequirementId = '-1'
|
},
|
onSelectChange(selectedRowKeys, selectionRows) {
|
if (selectedRowKeys.length == 1) {
|
this.sparePartRequirementId = selectionRows[0]['id']
|
} else {
|
this.sparePartRequirementId = '-1'
|
}
|
this.selectedRowKeys = selectedRowKeys
|
this.selectionRows = selectionRows
|
},
|
|
handleEdit: function (record) {
|
this.$refs.modalForm.edit(record)
|
this.$refs.modalForm.title = '编辑'
|
this.$refs.modalForm.disableSubmit = false
|
},
|
handleAdd: function () {
|
this.$refs.modalForm.add()
|
this.$refs.modalForm.title = '新增'
|
this.$refs.modalForm.disableSubmit = false
|
},
|
|
//审核审批
|
handleAuditApproval: function (record) {
|
this.$refs.auditApprovalModal.showModals(record);
|
this.$refs.auditApprovalModal.title = "审核";
|
},
|
|
|
loadData(arg) {
|
if (!this.url.list) {
|
this.$message.error('请设置url.list属性!')
|
return
|
}
|
//加载数据 若传入参数1则加载第一页的内容
|
if (arg === 1) {
|
this.ipagination.current = 1
|
}
|
this.onClearSelected()
|
var params = this.getQueryParams()//查询条件
|
this.loading = true
|
getAction(this.url.list, params).then((res) => {
|
if (res.success) {
|
this.dataSource = res.result.records
|
this.ipagination.total = res.result.total
|
}
|
if (res.code === 510) {
|
this.$message.warning(res.message)
|
}
|
this.loading = false
|
})
|
},
|
searchReset() {
|
this.queryParam = {}
|
this.sparePartRequirementId = '-1'
|
this.loadData(1);
|
},
|
|
handleSubmit(record) {
|
const that = this;
|
that.confirmLoading = true;
|
postAction(that.url.submit, record).then((res) => {
|
if (res.success) {
|
that.$message.success("提交成功!")
|
that.loadData(1)
|
} else {
|
that.$message.warning("提交失败!")
|
}
|
}).finally(() => {
|
that.confirmLoading = false;
|
})
|
|
},
|
|
modalFormOk() {
|
// 新增/修改 成功时,重载列表
|
this.loadData();
|
//清空列表选中
|
// this.onClearSelected()
|
},
|
batchHandleReject: function () {
|
if (this.selectedRowKeys.length <= 0) {
|
// this.$message.warning('请选择一条记录!');
|
this.$notification.warning({
|
message: '消息',
|
description: "请选择一条记录"
|
});
|
return;
|
} else {
|
|
var that = this;
|
this.$confirm({
|
title: "确认批量驳回",
|
content: "是否批量驳回选中数据?",
|
onOk: function () {
|
that.loading = true;
|
that.confirmLoading = true;
|
let formData = {};
|
let dailyInspectionStandardlist = that.selectionRows
|
for (var i = 0; i < dailyInspectionStandardlist.length; i++) {
|
let record = dailyInspectionStandardlist[i]
|
if (record.approvalStatus == '1') {
|
record.approvalStatus = '2'
|
} else if (record.approvalStatus == '3') {
|
record.approvalStatus = '4'
|
} else if (record.approvalStatus == '4') {
|
record.approvalStatus = '2'
|
}
|
}
|
formData.dailyInspectionStandardlist = dailyInspectionStandardlist
|
requestPut(that.url.passBatch, formData).then((res) => {
|
if (res.success) {
|
that.$message.success("批量驳回成功!")
|
that.loadData(1)
|
} else {
|
that.$message.warning("批量通过失败!")
|
}
|
}).finally(() => {
|
that.confirmLoading = false;
|
that.loading = false;
|
})
|
}
|
});
|
}
|
},
|
|
batchHandleOK: function () {
|
if (this.selectedRowKeys.length <= 0) {
|
// this.$message.warning('请选择一条记录!');
|
this.$notification.warning({
|
message: '消息',
|
description: "请选择一条记录"
|
});
|
return;
|
} else {
|
|
var that = this;
|
this.$confirm({
|
title: "确认批量通过",
|
content: "是否批量通过选中数据?",
|
onOk: function () {
|
that.loading = true;
|
that.confirmLoading = true;
|
let formData = {};
|
let dailyInspectionStandardlist = that.selectionRows
|
for (var i = 0; i < dailyInspectionStandardlist.length; i++) {
|
let record = dailyInspectionStandardlist[i]
|
if (record.approvalStatus == '1') {
|
record.approvalStatus = '3'
|
} else if (record.approvalStatus == '2') {
|
record.approvalStatus = '3'
|
} else if (record.approvalStatus == '3') {
|
record.approvalStatus = '5'
|
} else if (record.approvalStatus == '4') {
|
record.approvalStatus = '3'
|
}
|
}
|
formData.dailyInspectionStandardlist = dailyInspectionStandardlist
|
requestPut(that.url.passBatch, formData).then((res) => {
|
if (res.success) {
|
that.$message.success("批量通过成功!")
|
that.loadData(1)
|
} else {
|
that.$message.warning("批量通过失败!")
|
}
|
}).finally(() => {
|
that.confirmLoading = false;
|
that.loading = false;
|
})
|
}
|
});
|
}
|
},
|
|
}
|
}
|
</script>
|
<style scoped>
|
@import '~@assets/less/common.less';
|
.table-operator .ant-btn {
|
margin: 10px 8px 8px 10px;
|
}
|
</style>
|