parent
8e6b4a7f7b
commit
3737eb7688
1 changed files with 319 additions and 296 deletions
@ -1,308 +1,331 @@ |
|||||||
<template> |
<template> |
||||||
<basic-container> |
<basic-container> |
||||||
<!-- 大批量配置 --> |
<!-- 大批量配置 --> |
||||||
<avue-crud |
<avue-crud |
||||||
:option="option" |
:option="option" |
||||||
:table-loading="loading" |
:table-loading="loading" |
||||||
:data="data" |
:data="data" |
||||||
v-model="form" |
v-model="form" |
||||||
v-model:page="page" |
v-model:page="page" |
||||||
ref="crud" |
ref="crud" |
||||||
@row-del="rowDel" |
@row-del="rowDel" |
||||||
@search-change="searchChange" |
@search-change="searchChange" |
||||||
@search-reset="searchReset" |
@search-reset="searchReset" |
||||||
@selection-change="selectionChange" |
@selection-change="selectionChange" |
||||||
@current-change="currentChange" |
@current-change="currentChange" |
||||||
@size-change="sizeChange" |
@size-change="sizeChange" |
||||||
@refresh-change="refreshChange" |
@refresh-change="refreshChange" |
||||||
@on-load="onLoad" |
@on-load="onLoad" |
||||||
> |
@sort-change="sortChange" |
||||||
<template #menu-left> |
:permission="permissionList" |
||||||
<el-button type="primary" @click="handleAdd">新增</el-button> |
> |
||||||
<el-button type="danger" @click="handleDelete">删除</el-button> |
<template #menu-left> |
||||||
</template> |
<el-button type="primary" v-if="permission.bigBatch_add" @click="handleAdd">新增</el-button> |
||||||
<template #menu="scope"> |
<el-button type="danger" v-if="permission.bigBatch_del" @click="handleDelete"> |
||||||
<el-button type="primary" text @click="editRow(scope.row)">修改</el-button> |
删除 |
||||||
</template> |
</el-button> |
||||||
</avue-crud> |
</template> |
||||||
<add-batch |
<template #menu="scope"> |
||||||
v-if="showDialog" |
<el-button type="primary" text v-if="permission.bigBatch_edit" @click="editRow(scope.row)"> |
||||||
:show-dialog="showDialog" |
修改 |
||||||
@closeDialog="closeDialog" |
</el-button> |
||||||
:title="title" |
</template> |
||||||
:moldAddMore="moldAddMore" |
</avue-crud> |
||||||
:checkRow="checkRow" |
<add-batch |
||||||
></add-batch> |
v-if="showDialog" |
||||||
</basic-container> |
:show-dialog="showDialog" |
||||||
|
@closeDialog="closeDialog" |
||||||
|
:title="title" |
||||||
|
:moldAddMore="moldAddMore" |
||||||
|
:checkRow="checkRow" |
||||||
|
></add-batch> |
||||||
|
</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() { |
||||||
|
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(){ |
searchReset() { |
||||||
return{ |
this.query = {}; |
||||||
loading:false, |
this.onLoad(); |
||||||
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: '请输入维护时间', |
|
||||||
} |
|
||||||
] |
|
||||||
}, |
|
||||||
] |
|
||||||
} |
|
||||||
} |
|
||||||
}, |
}, |
||||||
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:{ |
selectionChange(list) { |
||||||
searchChange(params, done){ |
this.selectionList = list; |
||||||
this.query = params |
}, |
||||||
this.page.currentPage = 1 |
handleDelete() { |
||||||
this.onLoad() |
if (this.selectionList.length == 0) { |
||||||
done() |
this.$message.error('请至少选择一条数据'); |
||||||
}, |
return; |
||||||
searchReset(){ |
} |
||||||
this.query = {} |
this.$confirm('确定将选择数据删除?', { |
||||||
this.onLoad() |
confirmButtonText: '确定', |
||||||
}, |
cancelButtonText: '取消', |
||||||
refreshChange(){ |
type: 'warning', |
||||||
this.onLoad() |
}).then(() => { |
||||||
}, |
remove({ |
||||||
currentChange(currentPage){ |
ids: this.selectionList.map(item => item.id).join(','), |
||||||
this.page.currentPage = currentPage |
}).then(res => { |
||||||
}, |
if (res.data.code == 200) { |
||||||
sizeChange(pageSize){ |
this.$message.success('删除成功'); |
||||||
this.page.pageSize = pageSize |
this.onLoad(); |
||||||
}, |
} |
||||||
closeDialog(val){ |
}); |
||||||
this.showDialog = false |
}); |
||||||
if(val){ |
}, |
||||||
this.onLoad() |
editRow(row) { |
||||||
} |
console.log('row========================>', row); |
||||||
}, |
this.checkRow = row; |
||||||
handleAdd(){ |
this.title = '修改'; |
||||||
this.chechRow = {} |
this.moldAddMore = false; |
||||||
this.title = '新增' |
this.showDialog = true; |
||||||
this.moldAddMore = true |
}, |
||||||
this.showDialog = true |
// 排序 |
||||||
}, |
sortChange({ prop, order }) { |
||||||
selectionChange(list){ |
this.query.descs = undefined; |
||||||
this.selectionList = list |
this.query.ascs = undefined; |
||||||
}, |
let orderByFieldKey = order === 'descending' ? 'descs' : 'ascs'; |
||||||
handleDelete(){ |
this.query[orderByFieldKey] = !prop |
||||||
if(this.selectionList.length == 0){ |
? undefined |
||||||
this.$message.error('请至少选择一条数据') |
: prop.replace(/([a-z])([A-Z0-9])/g, '$1_$2').toUpperCase(); |
||||||
return |
// // 重新加载数据 |
||||||
} |
this.onLoad(this.page, this.query); |
||||||
this.$confirm("确定将选择数据删除?", { |
}, |
||||||
confirmButtonText: "确定", |
onLoad() { |
||||||
cancelButtonText: "取消", |
this.loading = true; |
||||||
type: "warning", |
getList({ |
||||||
}).then(() =>{ |
current: this.page.currentPage, |
||||||
remove({ |
size: this.page.pageSize, |
||||||
ids:this.selectionList.map(item => item.id).join(',') |
...this.query, |
||||||
}).then(res =>{ |
}).then(res => { |
||||||
if(res.data.code == 200){ |
res.data.data.records.map(item => { |
||||||
this.$message.success('删除成功') |
item.singletonArea = item.singletonArea == -1 ? null : item.singletonArea; |
||||||
this.onLoad() |
}); |
||||||
} |
this.data = res.data.data.records; |
||||||
}) |
this.page.total = res.data.data.total; |
||||||
}) |
this.loading = false; |
||||||
}, |
}); |
||||||
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; |
|
||||||
}) |
|
||||||
}, |
|
||||||
} |
|
||||||
} |
|
||||||
</script> |
</script> |
||||||
|
|
||||||
<style scoped> |
<style scoped> |
||||||
|
|
||||||
</style> |
</style> |
||||||
Loading…
Reference in new issue