基础数据-大批量配置-新增权限与排序

dev-scheduling
ysn 1 month ago
parent 8e6b4a7f7b
commit 3737eb7688
  1. 159
      src/views/basicData/bigBatch/index.vue

@ -16,13 +16,19 @@
@size-change="sizeChange" @size-change="sizeChange"
@refresh-change="refreshChange" @refresh-change="refreshChange"
@on-load="onLoad" @on-load="onLoad"
@sort-change="sortChange"
:permission="permissionList"
> >
<template #menu-left> <template #menu-left>
<el-button type="primary" @click="handleAdd">新增</el-button> <el-button type="primary" v-if="permission.bigBatch_add" @click="handleAdd">新增</el-button>
<el-button type="danger" @click="handleDelete">删除</el-button> <el-button type="danger" v-if="permission.bigBatch_del" @click="handleDelete">
删除
</el-button>
</template> </template>
<template #menu="scope"> <template #menu="scope">
<el-button type="primary" text @click="editRow(scope.row)">修改</el-button> <el-button type="primary" text v-if="permission.bigBatch_edit" @click="editRow(scope.row)">
修改
</el-button>
</template> </template>
</avue-crud> </avue-crud>
<add-batch <add-batch
@ -34,15 +40,15 @@
:checkRow="checkRow" :checkRow="checkRow"
></add-batch> ></add-batch>
</basic-container> </basic-container>
</template> </template>
<script> <script>
import {getList,remove} from "@/api/basicData/bigBatch.js" import { getList, remove } from '@/api/basicData/bigBatch.js';
import addBatch from "./addBatch.vue" import addBatch from './addBatch.vue';
import { mapGetters } from 'vuex';
export default { export default {
components: { components: {
addBatch addBatch,
}, },
data() { data() {
return { return {
@ -52,7 +58,7 @@ export default {
data: [], data: [],
form: {}, form: {},
query: {}, query: {},
title:"", title: '',
page: { page: {
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
@ -109,6 +115,7 @@ export default {
span: 24, span: 24,
overflow: true, overflow: true,
search: false, search: false,
sortable: 'custom',
headerAlign: 'center', headerAlign: 'center',
align: 'center', align: 'center',
searchLabelWidth: 80, searchLabelWidth: 80,
@ -116,8 +123,8 @@ export default {
{ {
required: true, required: true,
message: '请输入工艺能力', message: '请输入工艺能力',
} },
] ],
}, },
{ {
label: '单批面积(dm²)', label: '单批面积(dm²)',
@ -125,6 +132,7 @@ export default {
span: 24, span: 24,
overflow: true, overflow: true,
search: false, search: false,
sortable: 'custom',
headerAlign: 'center', headerAlign: 'center',
align: 'center', align: 'center',
searchLabelWidth: 80, searchLabelWidth: 80,
@ -132,8 +140,8 @@ export default {
{ {
required: true, required: true,
message: '请输入单批面积(dm²)', message: '请输入单批面积(dm²)',
} },
] ],
}, },
{ {
label: '零件号(XXX-XXX)', label: '零件号(XXX-XXX)',
@ -141,6 +149,7 @@ export default {
span: 24, span: 24,
overflow: true, overflow: true,
search: false, search: false,
sortable: 'custom',
headerAlign: 'center', headerAlign: 'center',
align: 'center', align: 'center',
searchLabelWidth: 80, searchLabelWidth: 80,
@ -148,8 +157,8 @@ export default {
{ {
required: true, required: true,
message: '请输入零件号(XXX-XXX)', message: '请输入零件号(XXX-XXX)',
} },
] ],
}, },
{ {
label: '单件面积(dm²)', label: '单件面积(dm²)',
@ -157,6 +166,7 @@ export default {
span: 24, span: 24,
overflow: true, overflow: true,
search: false, search: false,
sortable: 'custom',
headerAlign: 'center', headerAlign: 'center',
align: 'center', align: 'center',
searchLabelWidth: 80, searchLabelWidth: 80,
@ -164,8 +174,8 @@ export default {
{ {
required: true, required: true,
message: '请输入单件面积(dm²)', message: '请输入单件面积(dm²)',
} },
] ],
}, },
{ {
label: '描述', label: '描述',
@ -173,6 +183,7 @@ export default {
span: 24, span: 24,
overflow: true, overflow: true,
search: false, search: false,
sortable: 'custom',
headerAlign: 'center', headerAlign: 'center',
align: 'center', align: 'center',
searchLabelWidth: 80, searchLabelWidth: 80,
@ -180,8 +191,8 @@ export default {
{ {
required: true, required: true,
message: '请输入描述', message: '请输入描述',
} },
] ],
}, },
{ {
label: '维护人', label: '维护人',
@ -189,6 +200,7 @@ export default {
span: 24, span: 24,
overflow: true, overflow: true,
search: false, search: false,
sortable: 'custom',
headerAlign: 'center', headerAlign: 'center',
align: 'center', align: 'center',
searchLabelWidth: 80, searchLabelWidth: 80,
@ -196,8 +208,8 @@ export default {
{ {
required: true, required: true,
message: '请输入维护人', message: '请输入维护人',
} },
] ],
}, },
{ {
label: '维护时间', label: '维护时间',
@ -205,6 +217,7 @@ export default {
span: 24, span: 24,
overflow: true, overflow: true,
search: false, search: false,
sortable: 'custom',
headerAlign: 'center', headerAlign: 'center',
align: 'center', align: 'center',
searchLabelWidth: 80, searchLabelWidth: 80,
@ -212,97 +225,107 @@ export default {
{ {
required: true, required: true,
message: '请输入维护时间', message: '请输入维护时间',
}
]
}, },
] ],
}
}
}, },
created(){ ],
},
};
},
computed: {
...mapGetters(['permission']),
}, },
methods: { methods: {
searchChange(params, done) { searchChange(params, done) {
this.query = params this.query = params;
this.page.currentPage = 1 this.page.currentPage = 1;
this.onLoad() this.onLoad();
done() done();
}, },
searchReset() { searchReset() {
this.query = {} this.query = {};
this.onLoad() this.onLoad();
}, },
refreshChange() { refreshChange() {
this.onLoad() this.onLoad();
}, },
currentChange(currentPage) { currentChange(currentPage) {
this.page.currentPage = currentPage this.page.currentPage = currentPage;
}, },
sizeChange(pageSize) { sizeChange(pageSize) {
this.page.pageSize = pageSize this.page.pageSize = pageSize;
}, },
closeDialog(val) { closeDialog(val) {
this.showDialog = false this.showDialog = false;
if (val) { if (val) {
this.onLoad() this.onLoad();
} }
}, },
handleAdd() { handleAdd() {
this.chechRow = {} this.chechRow = {};
this.title = '新增' this.title = '新增';
this.moldAddMore = true this.moldAddMore = true;
this.showDialog = true this.showDialog = true;
}, },
selectionChange(list) { selectionChange(list) {
this.selectionList = list this.selectionList = list;
}, },
handleDelete() { handleDelete() {
if (this.selectionList.length == 0) { if (this.selectionList.length == 0) {
this.$message.error('请至少选择一条数据') this.$message.error('请至少选择一条数据');
return return;
} }
this.$confirm("确定将选择数据删除?", { this.$confirm('确定将选择数据删除?', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning", type: 'warning',
}).then(() => { }).then(() => {
remove({ remove({
ids:this.selectionList.map(item => item.id).join(',') ids: this.selectionList.map(item => item.id).join(','),
}).then(res => { }).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message.success('删除成功') this.$message.success('删除成功');
this.onLoad() this.onLoad();
} }
}) });
}) });
}, },
editRow(row) { editRow(row) {
console.log('row========================>',row) console.log('row========================>', row);
this.checkRow = row this.checkRow = row;
this.title = '修改' this.title = '修改';
this.moldAddMore = false this.moldAddMore = false;
this.showDialog = true this.showDialog = true;
},
//
sortChange({ prop, order }) {
this.query.descs = undefined;
this.query.ascs = undefined;
let orderByFieldKey = order === 'descending' ? 'descs' : 'ascs';
this.query[orderByFieldKey] = !prop
? undefined
: prop.replace(/([a-z])([A-Z0-9])/g, '$1_$2').toUpperCase();
// //
this.onLoad(this.page, this.query);
}, },
onLoad() { onLoad() {
this.loading = true; this.loading = true;
getList({ getList({
current: this.page.currentPage, current: this.page.currentPage,
size: this.page.pageSize, size: this.page.pageSize,
...this.query ...this.query,
}).then(res => { }).then(res => {
res.data.data.records.map(item => { res.data.data.records.map(item => {
item.singletonArea = item.singletonArea == -1 ? null : item.singletonArea item.singletonArea = item.singletonArea == -1 ? null : item.singletonArea;
}) });
this.data = res.data.data.records this.data = res.data.data.records;
this.page.total = res.data.data.total this.page.total = res.data.data.total;
this.loading = false; this.loading = false;
}) });
}, },
} },
} };
</script> </script>
<style scoped> <style scoped>
</style> </style>
Loading…
Cancel
Save