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

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