基础数据-物料定额表-金押定额-新增排序/权限

基础数据-物料定额表-银板定额-新增排序/权限
dev-scheduling
ysn 1 month ago
parent 3737eb7688
commit 2f486945f0
  1. 139
      src/views/basicData/materialQuota/components/KAu.vue
  2. 54
      src/views/basicData/materialQuota/components/silverAnode.vue

@ -1,32 +1,17 @@
<template> <template>
<div> <div>
<avue-crud <avue-crud :option="option" :table-loading="loading" :data="data" v-model="form" v-model:page="page" ref="crud"
:option="option" @row-del="rowDel" :before-open="beforeOpen" @row-save="rowSave" @row-update="rowUpdate"
:table-loading="loading" @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
:data="data" @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"
v-model="form" @sort-change="sortChange" :permission="permissionList">
v-model:page="page"
ref="crud"
@row-del="rowDel"
:before-open="beforeOpen"
@row-save="rowSave"
@row-update="rowUpdate"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
>
<template #menu-left> <template #menu-left>
<!-- <el-button type="primary" icon="el-icon-plus" @click="addEdit">新增 </el-button> --> <!-- <el-button type="primary" icon="el-icon-plus" @click="addEdit">新增 </el-button> -->
<el-button type="danger" @click="handleDelete" <el-button type="danger" v-if="permission.materialQuota1_del" @click="handleDelete">删除
>删除
</el-button> </el-button>
</template> </template>
<template #menu-right> <template #menu-right>
<el-button type="primary" @click="handleImport">导入 </el-button> <el-button type="primary" v-if="permission.materialQuota1_import" @click="handleImport">导入 </el-button>
</template> </template>
<template #menu="scope"> <template #menu="scope">
<!-- <el-button type="text" @click="editFn(scope.row)">编辑 </el-button> --> <!-- <el-button type="text" @click="editFn(scope.row)">编辑 </el-button> -->
@ -48,25 +33,24 @@
</avue-crud> </avue-crud>
<!-- 导入 --> <!-- 导入 -->
<basic-import v-if="isShowImport" title="导入" :isShow="isShowImport" <basic-import v-if="isShowImport" title="导入" :isShow="isShowImport"
templateUrl="/blade-desk/BA/MaterialQuota/downloadExcelTemplate" templateUrl="/blade-desk/BA/MaterialQuota/downloadExcelTemplate" templateName="金钾定额模板.xls"
templateName="金钾定额模板.xls" importUrl="/blade-desk/BA/MaterialQuota/importExcel" @closeDialog="closeDialog"></basic-import>
importUrl="/blade-desk/BA/MaterialQuota/importExcel"
@closeDialog="closeDialog"></basic-import>
</div> </div>
</template> </template>
<script> <script>
import basicImport from '@/components/basic-import/main.vue' import basicImport from '@/components/basic-import/main.vue'
import {getList,addQuota,updateQuota,deleteQuota} from "@/api/basicData/materialQuota" import { getList, addQuota, updateQuota, deleteQuota } from "@/api/basicData/materialQuota"
import { mapGetters } from 'vuex';
export default { export default {
components: { components: {
basicImport, basicImport,
}, },
data() { data() {
return { return {
isShowImport:false, isShowImport: false,
selectionList: [], selectionList: [],
loading:{}, loading: {},
query:{}, query: {},
option: { option: {
height: "auto", height: "auto",
calcHeight: 32, calcHeight: 32,
@ -119,11 +103,11 @@ export default {
{ {
label: "镀层厚度", label: "镀层厚度",
prop: "thickness", prop: "thickness",
sortable: true, sortable: 'custom',
filter: true, filter: true,
span: 24, span: 24,
search: false, search: false,
rule:[ rule: [
{ {
required: true, required: true,
message: "请输入镀层厚度", message: "请输入镀层厚度",
@ -135,7 +119,7 @@ export default {
// label: "", // label: "",
// prop: "processAbilityId", // prop: "processAbilityId",
// type:"select", // type:"select",
// sortable: true, // sortable: 'custom',
// filter: true, // filter: true,
// span: 24, // span: 24,
// search: false, // search: false,
@ -148,7 +132,7 @@ export default {
{ {
label: "滚振镀金类定额", label: "滚振镀金类定额",
prop: "quota", prop: "quota",
sortable: true, sortable: 'custom',
filter: true, filter: true,
span: 24, span: 24,
search: false, search: false,
@ -156,7 +140,7 @@ export default {
{ {
label: "挂镀金类定额", label: "挂镀金类定额",
prop: "smallBatQuota", prop: "smallBatQuota",
sortable: true, sortable: 'custom',
filter: true, filter: true,
span: 24, span: 24,
search: false, search: false,
@ -164,7 +148,7 @@ export default {
{ {
label: "微孔镀金类定额", label: "微孔镀金类定额",
prop: "bigBatQuota", prop: "bigBatQuota",
sortable: true, sortable: 'custom',
filter: true, filter: true,
span: 24, span: 24,
search: false, search: false,
@ -172,7 +156,7 @@ export default {
{ {
label: "局部镀定额", label: "局部镀定额",
prop: "localBatQuota", prop: "localBatQuota",
sortable: true, sortable: 'custom',
filter: true, filter: true,
span: 24, span: 24,
search: false, search: false,
@ -189,12 +173,22 @@ export default {
isWorkOpen: false, isWorkOpen: false,
}; };
}, },
computed: {
...mapGetters(['permission']),
permissionList() {
return {
addBtn: this.validData(this.permission.materialQuota1_add, false),
editBtn: this.validData(this.permission.materialQuota1_edit, false),
delBtn: this.validData(this.permission.materialQuota1_del, false),
};
},
},
methods: { methods: {
// //
handleImport() { handleImport() {
this.isShowImport = true this.isShowImport = true
}, },
validateValue(value){ validateValue(value) {
if (value == null) return ''; if (value == null) return '';
// 1 // 1
@ -226,16 +220,16 @@ export default {
} }
return filterVal; return filterVal;
}, },
validateRow(value){ validateRow(value) {
this.form.quota = this.validateValue(value) this.form.quota = this.validateValue(value)
}, },
validateSmallBat(value){ validateSmallBat(value) {
this.form.smallBatQuota = this.validateValue(value) this.form.smallBatQuota = this.validateValue(value)
}, },
validateBigBat(value){ validateBigBat(value) {
this.form.bigBatQuota = this.validateValue(value) this.form.bigBatQuota = this.validateValue(value)
}, },
validatePart(value){ validatePart(value) {
this.form.localBatQuota = this.validateValue(value) this.form.localBatQuota = this.validateValue(value)
}, },
addEdit() { addEdit() {
@ -248,49 +242,49 @@ export default {
this.isOpen = false; this.isOpen = false;
this.isWorkOpen = false; this.isWorkOpen = false;
this.isShowImport = false this.isShowImport = false
if(val){ if (val) {
this.onLoad() this.onLoad()
} }
}, },
beforeOpen(done, type){ beforeOpen(done, type) {
if(type == 'edit'){ if (type == 'edit') {
this.form.processAbilityId = this.form.processAbilityId + '' this.form.processAbilityId = this.form.processAbilityId + ''
done() done()
}else{ } else {
done() done()
} }
}, },
rowSave(row, done, loading){ rowSave(row, done, loading) {
row.quotaType = 1 row.quotaType = 1
console.log('row-------------------',row) console.log('row-------------------', row)
addQuota(row).then(res =>{ addQuota(row).then(res => {
if(res.data.code == 200){ if (res.data.code == 200) {
this.$message.success('新增成功') this.$message.success('新增成功')
this.onLoad() this.onLoad()
done() done()
} }
}) })
}, },
rowUpdate(row, index, done, loading){ rowUpdate(row, index, done, loading) {
row.quotaType = 1 row.quotaType = 1
updateQuota(row).then(res =>{ updateQuota(row).then(res => {
if(res.data.code == 200){ if (res.data.code == 200) {
this.$message.success('修改成功') this.$message.success('修改成功')
this.onLoad() this.onLoad()
done() done()
} }
}) })
}, },
rowDel(row) { rowDel(row) {
this.$confirm('确定删除数据吗?', { this.$confirm('确定删除数据吗?', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
}).then(() => { }).then(() => {
deleteQuota({ deleteQuota({
ids:row.id ids: row.id
}).then(res =>{ }).then(res => {
if(res.data.code == 200){ if (res.data.code == 200) {
this.$message.success('删除成功') this.$message.success('删除成功')
this.onLoad() this.onLoad()
} }
@ -334,8 +328,8 @@ export default {
}, },
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: "确定",
@ -343,30 +337,41 @@ export default {
type: "warning", type: "warning",
}).then(() => { }).then(() => {
deleteQuota({ deleteQuota({
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()
} }
}) })
}); });
}, },
refreshChange(){ refreshChange() {
this.onLoad() this.onLoad()
}, },
// //
selectionChange(list) { selectionChange(list) {
this.selectionList = list; this.selectionList = list;
}, },
//
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,
quotaType:1, quotaType: 1,
...this.query ...this.query
}).then(res =>{ }).then(res => {
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

@ -18,23 +18,37 @@
@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" icon="el-icon-plus" @click="addEdit">新增 </el-button> --> <!-- <el-button type="primary" icon="el-icon-plus" @click="addEdit">新增 </el-button> -->
<el-button type="danger" @click="handleDelete">删除 </el-button> <el-button type="danger" v-if="permission.materialQuota2_del" @click="handleDelete"
>删除
</el-button>
</template> </template>
<template #menu-right> <template #menu-right>
<el-button type="primary" @click="handleImport">导入 </el-button> <el-button type="primary" v-if="permission.materialQuota2_import" @click="handleImport"
>导入
</el-button>
</template> </template>
<template #menu="scope"> <template #menu="scope">
<!-- <el-button type="text" @click="editFn(scope.row)">编辑 </el-button> --> <!-- <el-button type="text" @click="editFn(scope.row)">编辑 </el-button> -->
<!-- <el-button type="text" @click="handleDelete">删除 </el-button> --> <!-- <el-button type="text" @click="handleDelete">删除 </el-button> -->
</template> </template>
<template #quota-form="{ type, disabled }"> <template #quota-form="{ type, disabled }">
<el-input v-model="form.quota" placeholder="请输入 滚振镀银类定额" @input="validateQuota"></el-input> <el-input
v-model="form.quota"
placeholder="请输入 滚振镀银类定额"
@input="validateQuota"
></el-input>
</template> </template>
<template #smallBatQuota-form="{ type, disabled }"> <template #smallBatQuota-form="{ type, disabled }">
<el-input v-model="form.smallBatQuota" placeholder="请输入 滚振镀银类定额" @input="validateSmallBat"></el-input> <el-input
v-model="form.smallBatQuota"
placeholder="请输入 滚振镀银类定额"
@input="validateSmallBat"
></el-input>
</template> </template>
</avue-crud> </avue-crud>
<!-- 导入 --> <!-- 导入 -->
@ -52,6 +66,7 @@
<script> <script>
import basicImport from '@/components/basic-import/main.vue'; import basicImport from '@/components/basic-import/main.vue';
import { getList, addQuota, updateQuota, deleteQuota } from '@/api/basicData/materialQuota'; import { getList, addQuota, updateQuota, deleteQuota } from '@/api/basicData/materialQuota';
import { mapGetters } from 'vuex';
export default { export default {
components: { components: {
basicImport, basicImport,
@ -114,7 +129,7 @@ export default {
{ {
label: '镀层厚度', label: '镀层厚度',
prop: 'thickness', prop: 'thickness',
sortable: true, sortable: 'custom',
filter: true, filter: true,
span: 24, span: 24,
search: false, search: false,
@ -130,7 +145,7 @@ export default {
// label: "", // label: "",
// prop: "processAbilityId", // prop: "processAbilityId",
// type:"select", // type:"select",
// sortable: true, // sortable: 'custom',
// filter: true, // filter: true,
// span: 24, // span: 24,
// search: false, // search: false,
@ -143,7 +158,7 @@ export default {
{ {
label: '滚振镀银类定额', label: '滚振镀银类定额',
prop: 'quota', prop: 'quota',
sortable: true, sortable: 'custom',
filter: true, filter: true,
span: 24, span: 24,
search: false, search: false,
@ -151,7 +166,7 @@ export default {
{ {
label: '挂镀银类定额', label: '挂镀银类定额',
prop: 'smallBatQuota', prop: 'smallBatQuota',
sortable: true, sortable: 'custom',
filter: true, filter: true,
span: 24, span: 24,
search: false, search: false,
@ -159,7 +174,7 @@ export default {
// { // {
// label: "", // label: "",
// prop: "bigBatQuota", // prop: "bigBatQuota",
// sortable: true, // sortable: 'custom',
// filter: true, // filter: true,
// span: 24, // span: 24,
// search: false, // search: false,
@ -176,6 +191,16 @@ export default {
isWorkOpen: false, isWorkOpen: false,
}; };
}, },
computed: {
...mapGetters(['permission']),
permissionList() {
return {
addBtn: this.validData(this.permission.materialQuota2_add, false),
editBtn: this.validData(this.permission.materialQuota2_edit, false),
delBtn: this.validData(this.permission.materialQuota2_del, false),
};
},
},
methods: { methods: {
// //
handleImport() { handleImport() {
@ -338,6 +363,17 @@ export default {
} }
}); });
}); });
},
//
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;

Loading…
Cancel
Save