parent
8e6b4a7f7b
commit
3737eb7688
1 changed files with 319 additions and 296 deletions
@ -1,308 +1,331 @@ |
||||
<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="handleAdd">新增</el-button> |
||||
<el-button type="danger" @click="handleDelete">删除</el-button> |
||||
</template> |
||||
<template #menu="scope"> |
||||
<el-button type="primary" text @click="editRow(scope.row)">修改</el-button> |
||||
</template> |
||||
</avue-crud> |
||||
<add-batch |
||||
v-if="showDialog" |
||||
:show-dialog="showDialog" |
||||
@closeDialog="closeDialog" |
||||
:title="title" |
||||
:moldAddMore="moldAddMore" |
||||
:checkRow="checkRow" |
||||
></add-batch> |
||||
</basic-container> |
||||
|
||||
<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" |
||||
@sort-change="sortChange" |
||||
:permission="permissionList" |
||||
> |
||||
<template #menu-left> |
||||
<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 v-if="permission.bigBatch_edit" @click="editRow(scope.row)"> |
||||
修改 |
||||
</el-button> |
||||
</template> |
||||
</avue-crud> |
||||
<add-batch |
||||
v-if="showDialog" |
||||
:show-dialog="showDialog" |
||||
@closeDialog="closeDialog" |
||||
:title="title" |
||||
:moldAddMore="moldAddMore" |
||||
: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 |
||||
components: { |
||||
addBatch, |
||||
}, |
||||
data() { |
||||
return { |
||||
loading: false, |
||||
showDialog: false, |
||||
moldAddMore: false, |
||||
data: [], |
||||
form: {}, |
||||
query: {}, |
||||
title: '', |
||||
page: { |
||||
pageSize: 10, |
||||
currentPage: 1, |
||||
total: 0, |
||||
}, |
||||
selectionList: [], |
||||
chechRow: {}, |
||||
option: { |
||||
columnSort: true, |
||||
tip: false, |
||||
height: 'auto', |
||||
calcHeight: 32, |
||||
simplePage: false, |
||||
searchShow: true, |
||||
searchMenuSpan: 18, |
||||
searchIcon: true, |
||||
searchIndex: 3, |
||||
tree: false, |
||||
border: true, |
||||
index: false, |
||||
selection: true, |
||||
viewBtn: false, |
||||
delBtn: false, |
||||
editBtn: false, |
||||
addBtnIcon: ' ', |
||||
viewBtnIcon: ' ', |
||||
delBtnIcon: ' ', |
||||
editBtnIcon: ' ', |
||||
addBtn: false, |
||||
labelWidth: 120, |
||||
searchLabelWidth: 120, |
||||
menu: true, |
||||
menuWidth: 80, |
||||
dialogWidth: 600, |
||||
dialogClickModal: false, |
||||
searchEnter: true, |
||||
excelBtn: true, |
||||
gridBtn: false, |
||||
searchShowBtn: false, |
||||
showOverflowTooltip: true, |
||||
searchLabelPosition: 'left', |
||||
filterBtn: true, |
||||
searchLabelPosition: 'left', |
||||
searchGutter: 24, |
||||
searchSpan: 6, |
||||
menuAlign: 'center', |
||||
gridBtn: false, |
||||
searchMenuPosition: 'right', |
||||
align: 'center', |
||||
column: [ |
||||
{ |
||||
label: '工艺能力', |
||||
prop: 'caName', |
||||
span: 24, |
||||
overflow: true, |
||||
search: false, |
||||
sortable: 'custom', |
||||
headerAlign: 'center', |
||||
align: 'center', |
||||
searchLabelWidth: 80, |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入工艺能力', |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
label: '单批面积(dm²)', |
||||
prop: 'area', |
||||
span: 24, |
||||
overflow: true, |
||||
search: false, |
||||
sortable: 'custom', |
||||
headerAlign: 'center', |
||||
align: 'center', |
||||
searchLabelWidth: 80, |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入单批面积(dm²)', |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
label: '零件号(XXX-XXX)', |
||||
prop: 'partCode', |
||||
span: 24, |
||||
overflow: true, |
||||
search: false, |
||||
sortable: 'custom', |
||||
headerAlign: 'center', |
||||
align: 'center', |
||||
searchLabelWidth: 80, |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入零件号(XXX-XXX)', |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
label: '单件面积(dm²)', |
||||
prop: 'singletonArea', |
||||
span: 24, |
||||
overflow: true, |
||||
search: false, |
||||
sortable: 'custom', |
||||
headerAlign: 'center', |
||||
align: 'center', |
||||
searchLabelWidth: 80, |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入单件面积(dm²)', |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
label: '描述', |
||||
prop: 'describe', |
||||
span: 24, |
||||
overflow: true, |
||||
search: false, |
||||
sortable: 'custom', |
||||
headerAlign: 'center', |
||||
align: 'center', |
||||
searchLabelWidth: 80, |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入描述', |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
label: '维护人', |
||||
prop: 'updateUserName', |
||||
span: 24, |
||||
overflow: true, |
||||
search: false, |
||||
sortable: 'custom', |
||||
headerAlign: 'center', |
||||
align: 'center', |
||||
searchLabelWidth: 80, |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入维护人', |
||||
}, |
||||
], |
||||
}, |
||||
{ |
||||
label: '维护时间', |
||||
prop: 'updateTime', |
||||
span: 24, |
||||
overflow: true, |
||||
search: false, |
||||
sortable: 'custom', |
||||
headerAlign: 'center', |
||||
align: 'center', |
||||
searchLabelWidth: 80, |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入维护时间', |
||||
}, |
||||
], |
||||
}, |
||||
], |
||||
}, |
||||
}; |
||||
}, |
||||
computed: { |
||||
...mapGetters(['permission']), |
||||
}, |
||||
methods: { |
||||
searchChange(params, done) { |
||||
this.query = params; |
||||
this.page.currentPage = 1; |
||||
this.onLoad(); |
||||
done(); |
||||
}, |
||||
data(){ |
||||
return{ |
||||
loading:false, |
||||
showDialog:false, |
||||
moldAddMore:false, |
||||
data:[], |
||||
form:{}, |
||||
query:{}, |
||||
title:"", |
||||
page:{ |
||||
pageSize: 10, |
||||
currentPage: 1, |
||||
total: 0, |
||||
}, |
||||
selectionList:[], |
||||
chechRow:{}, |
||||
option:{ |
||||
columnSort: true, |
||||
tip: false, |
||||
height: 'auto', |
||||
calcHeight: 32, |
||||
simplePage: false, |
||||
searchShow: true, |
||||
searchMenuSpan: 18, |
||||
searchIcon: true, |
||||
searchIndex: 3, |
||||
tree: false, |
||||
border: true, |
||||
index: false, |
||||
selection: true, |
||||
viewBtn: false, |
||||
delBtn: false, |
||||
editBtn: false, |
||||
addBtnIcon: ' ', |
||||
viewBtnIcon: ' ', |
||||
delBtnIcon: ' ', |
||||
editBtnIcon: ' ', |
||||
addBtn: false, |
||||
labelWidth: 120, |
||||
searchLabelWidth: 120, |
||||
menu: true, |
||||
menuWidth: 80, |
||||
dialogWidth: 600, |
||||
dialogClickModal: false, |
||||
searchEnter: true, |
||||
excelBtn: true, |
||||
gridBtn: false, |
||||
searchShowBtn: false, |
||||
showOverflowTooltip: true, |
||||
searchLabelPosition: 'left', |
||||
filterBtn: true, |
||||
searchLabelPosition: 'left', |
||||
searchGutter: 24, |
||||
searchSpan: 6, |
||||
menuAlign: 'center', |
||||
gridBtn: false, |
||||
searchMenuPosition: 'right', |
||||
align: 'center', |
||||
column: [ |
||||
{ |
||||
label: '工艺能力', |
||||
prop: 'caName', |
||||
span: 24, |
||||
overflow: true, |
||||
search: false, |
||||
headerAlign: 'center', |
||||
align: 'center', |
||||
searchLabelWidth: 80, |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入工艺能力', |
||||
} |
||||
] |
||||
}, |
||||
{ |
||||
label: '单批面积(dm²)', |
||||
prop: 'area', |
||||
span: 24, |
||||
overflow: true, |
||||
search: false, |
||||
headerAlign: 'center', |
||||
align: 'center', |
||||
searchLabelWidth: 80, |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入单批面积(dm²)', |
||||
} |
||||
] |
||||
}, |
||||
{ |
||||
label: '零件号(XXX-XXX)', |
||||
prop: 'partCode', |
||||
span: 24, |
||||
overflow: true, |
||||
search: false, |
||||
headerAlign: 'center', |
||||
align: 'center', |
||||
searchLabelWidth: 80, |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入零件号(XXX-XXX)', |
||||
} |
||||
] |
||||
}, |
||||
{ |
||||
label: '单件面积(dm²)', |
||||
prop: 'singletonArea', |
||||
span: 24, |
||||
overflow: true, |
||||
search: false, |
||||
headerAlign: 'center', |
||||
align: 'center', |
||||
searchLabelWidth: 80, |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入单件面积(dm²)', |
||||
} |
||||
] |
||||
}, |
||||
{ |
||||
label: '描述', |
||||
prop: 'describe', |
||||
span: 24, |
||||
overflow: true, |
||||
search: false, |
||||
headerAlign: 'center', |
||||
align: 'center', |
||||
searchLabelWidth: 80, |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入描述', |
||||
} |
||||
] |
||||
}, |
||||
{ |
||||
label: '维护人', |
||||
prop: 'updateUserName', |
||||
span: 24, |
||||
overflow: true, |
||||
search: false, |
||||
headerAlign: 'center', |
||||
align: 'center', |
||||
searchLabelWidth: 80, |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入维护人', |
||||
} |
||||
] |
||||
}, |
||||
{ |
||||
label: '维护时间', |
||||
prop: 'updateTime', |
||||
span: 24, |
||||
overflow: true, |
||||
search: false, |
||||
headerAlign: 'center', |
||||
align: 'center', |
||||
searchLabelWidth: 80, |
||||
rules: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入维护时间', |
||||
} |
||||
] |
||||
}, |
||||
] |
||||
} |
||||
} |
||||
searchReset() { |
||||
this.query = {}; |
||||
this.onLoad(); |
||||
}, |
||||
created(){ |
||||
|
||||
refreshChange() { |
||||
this.onLoad(); |
||||
}, |
||||
currentChange(currentPage) { |
||||
this.page.currentPage = currentPage; |
||||
}, |
||||
sizeChange(pageSize) { |
||||
this.page.pageSize = pageSize; |
||||
}, |
||||
closeDialog(val) { |
||||
this.showDialog = false; |
||||
if (val) { |
||||
this.onLoad(); |
||||
} |
||||
}, |
||||
handleAdd() { |
||||
this.chechRow = {}; |
||||
this.title = '新增'; |
||||
this.moldAddMore = true; |
||||
this.showDialog = true; |
||||
}, |
||||
methods:{ |
||||
searchChange(params, done){ |
||||
this.query = params |
||||
this.page.currentPage = 1 |
||||
this.onLoad() |
||||
done() |
||||
}, |
||||
searchReset(){ |
||||
this.query = {} |
||||
this.onLoad() |
||||
}, |
||||
refreshChange(){ |
||||
this.onLoad() |
||||
}, |
||||
currentChange(currentPage){ |
||||
this.page.currentPage = currentPage |
||||
}, |
||||
sizeChange(pageSize){ |
||||
this.page.pageSize = pageSize |
||||
}, |
||||
closeDialog(val){ |
||||
this.showDialog = false |
||||
if(val){ |
||||
this.onLoad() |
||||
} |
||||
}, |
||||
handleAdd(){ |
||||
this.chechRow = {} |
||||
this.title = '新增' |
||||
this.moldAddMore = true |
||||
this.showDialog = true |
||||
}, |
||||
selectionChange(list){ |
||||
this.selectionList = list |
||||
}, |
||||
handleDelete(){ |
||||
if(this.selectionList.length == 0){ |
||||
this.$message.error('请至少选择一条数据') |
||||
return |
||||
} |
||||
this.$confirm("确定将选择数据删除?", { |
||||
confirmButtonText: "确定", |
||||
cancelButtonText: "取消", |
||||
type: "warning", |
||||
}).then(() =>{ |
||||
remove({ |
||||
ids:this.selectionList.map(item => item.id).join(',') |
||||
}).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('删除成功') |
||||
this.onLoad() |
||||
} |
||||
}) |
||||
}) |
||||
}, |
||||
editRow(row){ |
||||
console.log('row========================>',row) |
||||
this.checkRow = row |
||||
this.title = '修改' |
||||
this.moldAddMore = false |
||||
this.showDialog = true |
||||
}, |
||||
onLoad(){ |
||||
this.loading = true; |
||||
getList({ |
||||
current:this.page.currentPage, |
||||
size:this.page.pageSize, |
||||
...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 |
||||
this.loading = false; |
||||
}) |
||||
}, |
||||
} |
||||
} |
||||
selectionChange(list) { |
||||
this.selectionList = list; |
||||
}, |
||||
handleDelete() { |
||||
if (this.selectionList.length == 0) { |
||||
this.$message.error('请至少选择一条数据'); |
||||
return; |
||||
} |
||||
this.$confirm('确定将选择数据删除?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}).then(() => { |
||||
remove({ |
||||
ids: this.selectionList.map(item => item.id).join(','), |
||||
}).then(res => { |
||||
if (res.data.code == 200) { |
||||
this.$message.success('删除成功'); |
||||
this.onLoad(); |
||||
} |
||||
}); |
||||
}); |
||||
}, |
||||
editRow(row) { |
||||
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, |
||||
}).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; |
||||
this.loading = false; |
||||
}); |
||||
}, |
||||
}, |
||||
}; |
||||
</script> |
||||
|
||||
<style scoped> |
||||
|
||||
</style> |
||||
Loading…
Reference in new issue