中航光电热表web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

311 lines
7.8 KiB

<template>
<basic-container>
<avue-crud
:option="option"
:table-loading="loading"
:data="data"
v-model="form"
v-model:page="page"
ref="crud"
@row-del="rowDel"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
>
<template #menu-left>
<el-button type="primary" @click="addFn()" v-if="permission.assignConfig_add"
>新增</el-button
>
</template>
<template #menu-right> </template>
<template #menu="scope">
<el-button
type="text"
v-if="permission.assignConfig_update && (scope.row.status == 0 || scope.row.status == 3)"
@click="addEdit(scope.row)"
>修改</el-button
>
<el-button
v-if="scope.row.status == 0 && permission.assignConfig_send_check"
type="text"
@click="sendApprovalFn(scope.row)"
>发送审批</el-button
>
<el-button
v-if="scope.row.status == 1 && permission.assignConfig_check"
type="text"
@click="approvalFn(scope.row)"
>审批</el-button
>
<el-button
v-if="scope.row.status == 0 && permission.assignConfig_del"
type="text"
@click="deletePart(scope.row)"
>删除</el-button
>
</template>
<template #applicationTimeArr="scope">
{{ scope.row.applicationTime }}
</template>
</avue-crud>
<!-- 新增和修改 -->
<addOrEditDialog
v-if="showDialog"
:showDialog="showDialog"
:title="title"
:rowItem="rowItem"
@closeDialog="closeDialog"
></addOrEditDialog>
<!-- 审核 -->
<checkDialog
v-if="checkShow"
:showDialog="checkShow"
:rowItem="rowItem"
@closeDialog="closeDialog"
></checkDialog>
</basic-container>
</template>
<script>
import addOrEditDialog from './addOrEditDialog.vue';
import checkDialog from './checkDialog.vue';
import { getList, del, submitApproval } from '@/api/basicData/assignConfigApprove';
import { mapGetters } from 'vuex';
export default {
components: {
addOrEditDialog,
checkDialog,
},
computed: {
...mapGetters(['permission']),
},
data() {
return {
checkShow: false,
showDialog: false,
title: '新增',
form: {},
selectionList: [],
query: {},
loading: false,
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
option: {
columnSort: true,
tip: false,
height: 'auto',
calcHeight: 32,
simplePage: false,
searchShow: true,
searchMenuSpan: 6,
searchIcon: true,
searchIndex: 3,
tree: false,
border: true,
index: true,
selection: false,
addBtn: false,
editBtn: false,
viewBtn: false,
delBtn: false,
editBtnText: '修改',
menuWidth: 160,
dialogWidth: 900,
dialogClickModal: false,
searchEnter: true,
excelBtn: false,
filterBtn: true,
searchShowBtn: false,
excelBtn: true,
showOverflowTooltip: true,
addBtnIcon: ' ',
viewBtnIcon: ' ',
delBtnIcon: ' ',
editBtnIcon: ' ',
gridBtn: false,
searchLabelPosition: 'left',
searchGutter: 24,
searchSpan: 6,
menuAlign: 'left',
gridBtn: false,
searchMenuPosition: 'right',
searchLabelWidth: 'auto',
align: 'center',
column: [
{
label: '申请单号',
prop: 'applicationNo',
search: true,
sortable: true,
span: 12,
},
{
label: '申请人',
prop: 'applicantName',
search: true,
sortable: true,
span: 12,
},
{
label: '申请时间',
prop: 'applicationTimeArr',
search: true,
sortable: true,
span: 12,
type: 'date',
searchRange: true,
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
},
{
label: '申请描述',
prop: 'remark',
search: true,
sortable: true,
span: 12,
width: 360,
},
// 状态: 0-草稿, 1-审批中, 2-审批通过, 3-审批驳回, 4-已撤销
{
label: '审批状态',
prop: 'status',
search: false,
sortable: true,
span: 12,
type: 'select',
dicData: [
{
label: '草稿',
value: 0,
},
{
label: '审批中',
value: 1,
},
{
label: '审批通过',
value: 2,
},
{
label: '审批驳回',
value: 3,
},
{
label: '已撤销',
value: 4,
},
],
},
],
},
data: [],
rowItem: {},
};
},
methods: {
addFn() {
this.showDialog = true;
this.title = '新增';
},
addEdit(row) {
this.showDialog = true;
this.title = '修改';
this.rowItem = row;
},
sendApprovalFn(row) {
this.$confirm('确定将数据发送审批?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
submitApproval({ id: row.id }).then(res => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
});
});
});
},
approvalFn(row) {
this.checkShow = true;
this.rowItem = row;
},
deletePart(row) {
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
del({ ids: [row.id] }).then(res => {
this.onLoad(this.page, this.query);
this.$message({
type: 'success',
message: '操作成功!',
});
});
});
},
closeDialog() {
this.showDialog = false;
this.checkShow = false;
this.onLoad(this.page, this.query);
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
selectionChange(list) {
this.selectionList = list;
},
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
refreshChange() {
this.onLoad(this.page, this.query);
},
onLoad(page, params = {}) {
this.loading = true;
if (!!params.applicationTimeArr) {
this.query.applicationTimeStart = params.applicationTimeArr[0];
this.query.applicationTimeEnd = params.applicationTimeArr[1];
}
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
this.data = res.data.data.records;
this.loading = false;
this.page.total = res.data.data.total;
});
},
},
mounted() {},
};
</script>
d