基础数据-外协分派管理-新增排序与权限

dev-scheduling
ysn 1 month ago
parent c6af258443
commit ac3490771a
  1. 396
      src/views/oem/outsourcingAssignmentControl/index.vue

@ -15,19 +15,43 @@
@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="danger" @click="handleDelete">删除 </el-button> <el-button
<el-button type="primary" @click="handleSave">保存 </el-button> type="danger"
v-if="permission.outsourcingAssignmentControl_del"
@click="handleDelete"
>
删除
</el-button>
<el-button
type="primary"
v-if="permission.outsourcingAssignmentControl_save"
@click="handleSave"
>
保存
</el-button>
</template> </template>
<template #oemId="scope"> <template #oemId="scope">
<el-select v-model="scope.row.oemId" @change="handleSupplierChange(scope.row)"> <el-select v-model="scope.row.oemId" @change="handleSupplierChange(scope.row)">
<el-option v-for="item in supplierData" :key="item.id" :label="item.ocName" :value="item.id"></el-option> <el-option
v-for="item in supplierData"
:key="item.id"
:label="item.ocName"
:value="item.id"
></el-option>
</el-select> </el-select>
</template> </template>
<template #platingId="scope"> <template #platingId="scope">
<el-select v-model="scope.row.platingId" filterable> <el-select v-model="scope.row.platingId" filterable>
<el-option v-for="item in scope.row.abilityData" :key="item.id" :label="item.caName" :value="item.id"></el-option> <el-option
v-for="item in scope.row.abilityData"
:key="item.id"
:label="item.caName"
:value="item.id"
></el-option>
</el-select> </el-select>
</template> </template>
<template #dsPart="scope"> <template #dsPart="scope">
@ -51,35 +75,55 @@
:debounce-time="500" :debounce-time="500"
:title="'修改'" :title="'修改'"
/> />
</template> </template>
<template #assignScale="scope"> <template #assignScale="scope">
<el-input-number style="width:98%;" v-model="scope.row.assignScale" controls-position="right"></el-input-number> <el-input-number
style="width: 98%"
v-model="scope.row.assignScale"
controls-position="right"
></el-input-number>
</template> </template>
<template #menu-right> <template #menu-right>
<!-- <el-button type="primary" icon="el-icon-printer" @click="handleDelete">打印 <!-- <el-button type="primary" icon="el-icon-printer" @click="handleDelete">打印
</el-button> --> </el-button> -->
<el-button type="primary" @click="handleImport">导入 </el-button> <el-button
type="primary"
v-if="permission.outsourcingAssignmentControl_import"
@click="handleImport"
>导入
</el-button>
</template> </template>
<template #proportion="{ row }"> <template #proportion="{ row }">
<span>{{ row.proportion ? row.proportion + "%" : "0%" }}</span> <span>{{ row.proportion ? row.proportion + '%' : '0%' }}</span>
</template> </template>
</avue-crud> </avue-crud>
<!-- 导入 --> <!-- 导入 -->
<basic-import v-if="isShowImport" title="导入" :isShow="isShowImport" <basic-import
v-if="isShowImport"
title="导入"
:isShow="isShowImport"
templateUrl="/blade-desk/BA/PlanAssignSteer/downloadExcelTemplate" templateUrl="/blade-desk/BA/PlanAssignSteer/downloadExcelTemplate"
templateName="外协分派管理模板.xls" templateName="外协分派管理模板.xls"
importUrl="/blade-desk/BA/PlanAssignSteer/importExcel" importUrl="/blade-desk/BA/PlanAssignSteer/importExcel"
@closeDialog="closeDialog"></basic-import> @closeDialog="closeDialog"
></basic-import>
</basic-container> </basic-container>
</template> </template>
<script> <script>
import basicImport from '@/components/basic-import/main.vue' import basicImport from '@/components/basic-import/main.vue';
import {getList,getSupplier,getProcessAbility,getPartList,submitBat,remove} from "@/api/basicData/outsourcingAssignmentControl" import {
getList,
getSupplier,
getProcessAbility,
getPartList,
submitBat,
remove,
} from '@/api/basicData/outsourcingAssignmentControl';
import jhSelect from '@/components/jh-select/index.vue'; import jhSelect from '@/components/jh-select/index.vue';
import { mapGetters } from 'vuex';
export default { export default {
components: { basicImport,jhSelect }, components: { basicImport, jhSelect },
data() { data() {
return { return {
isShowImport: false, isShowImport: false,
@ -89,17 +133,17 @@ export default {
currentPage: 1, currentPage: 1,
total: 0, total: 0,
}, },
query:{}, query: {},
supplierData:[], supplierData: [],
abilityData:[], abilityData: [],
partData:[], partData: [],
data: [], data: [],
option: { option: {
index: false, index: false,
addRowBtn: true, addRowBtn: true,
addBtnText:"插入一行", addBtnText: '插入一行',
addRowBtnText: "插入一行", addRowBtnText: '插入一行',
height: "auto", height: 'auto',
calcHeight: 32, calcHeight: 32,
tip: false, tip: false,
// size: "medium", // size: "medium",
@ -115,10 +159,10 @@ export default {
addBtn: false, addBtn: false,
delBtn: false, delBtn: false,
editBtn: true, editBtn: true,
editBtnText: "修改", editBtnText: '修改',
viewBtnIcon: " ", viewBtnIcon: ' ',
delBtnIcon: " ", delBtnIcon: ' ',
editBtnIcon: " ", editBtnIcon: ' ',
labelWidth: 120, labelWidth: 120,
menuWidth: 150, menuWidth: 150,
dialogWidth: 600, dialogWidth: 600,
@ -132,48 +176,48 @@ export default {
columnSort: true, columnSort: true,
showOverflowTooltip: true, showOverflowTooltip: true,
menu: false, menu: false,
searchLabelPosition: "left", searchLabelPosition: 'left',
searchGutter: 24, searchGutter: 24,
searchSpan: 6, searchSpan: 6,
menuAlign: "left", menuAlign: 'left',
gridBtn: false, gridBtn: false,
searchMenuPosition: "right", searchMenuPosition: 'right',
addBtnIcon: " ", addBtnIcon: ' ',
viewBtnIcon: " ", viewBtnIcon: ' ',
delBtnIcon: " ", delBtnIcon: ' ',
editBtnIcon: " ", editBtnIcon: ' ',
align: "center", align: 'center',
column: [ column: [
{ {
label: "供应商", label: '供应商',
prop: "oemId", prop: 'oemId',
// bind: "bsOemCustomer.ocCode", // bind: "bsOemCustomer.ocCode",
sortable: true, sortable: 'custom',
filter: true, filter: true,
span: 24, span: 24,
minWidth: 150, minWidth: 150,
search: false, search: false,
type: "select", type: 'select',
rules: [{ required: true, message: "请输入分派比例", trigger: "blur" }], rules: [{ required: true, message: '请输入分派比例', trigger: 'blur' }],
}, },
{ {
label: "工艺能力", label: '工艺能力',
prop: "platingId", prop: 'platingId',
// bind: "bsCraftAbility.caId", // bind: "bsCraftAbility.caId",
sortable: true, sortable: 'custom',
filter: true, filter: true,
span: 24, span: 24,
minWidth: 150, minWidth: 150,
type: "select", type: 'select',
search: true, search: true,
filterable: true, filterable: true,
// cell: true, // cell: true,
// type: "select", // type: "select",
dicUrl:"/api/blade-desk/BA/craftAbility/findList", dicUrl: '/api/blade-desk/BA/craftAbility/findList',
props:{ props: {
label: 'caName', label: 'caName',
value:'id' value: 'id',
} },
// dicData: [ // dicData: [
// { // {
// value: 1, // value: 1,
@ -187,11 +231,11 @@ export default {
// rules: [{ required: true, message: "", trigger: "blur" }], // rules: [{ required: true, message: "", trigger: "blur" }],
}, },
{ {
label: "零件", label: '零件',
prop: "dsPart", prop: 'dsPart',
// bind: "dsPart.partId", // bind: "dsPart.partId",
sortable: true, sortable: 'custom',
type: "select", type: 'select',
filter: true, filter: true,
span: 24, span: 24,
search: false, search: false,
@ -211,48 +255,48 @@ export default {
// rules: [{ required: true, message: "", trigger: "blur" }], // rules: [{ required: true, message: "", trigger: "blur" }],
}, },
{ {
label: "分派比例(%)", label: '分派比例(%)',
prop: "assignScale", prop: 'assignScale',
width: 150, width: 150,
sortable: true, sortable: 'custom',
filter: true, filter: true,
span: 24, span: 24,
search: false, search: false,
display: false, display: false,
// cell: true, // cell: true,
rules: [{ required: true, message: "请输入分派比例", trigger: "blur" }], rules: [{ required: true, message: '请输入分派比例', trigger: 'blur' }],
}, },
{ {
label: "日分派量(d㎡)", label: '日分派量(d㎡)',
prop: "assign", prop: 'assign',
sortable: true, sortable: 'custom',
filter: true, filter: true,
width: 150, width: 150,
span: 24, span: 24,
search: false, search: false,
}, },
{ {
label: "厂家周累计分派量(dm²)", label: '厂家周累计分派量(dm²)',
prop: "weekAssign", prop: 'weekAssign',
sortable: true, sortable: 'custom',
filter: true, filter: true,
span: 24, span: 24,
search: false, search: false,
width: 200, width: 200,
}, },
{ {
label: "分类周累计分派量(dm²)", label: '分类周累计分派量(dm²)',
prop: "classifyAssign", prop: 'classifyAssign',
sortable: true, sortable: 'custom',
filter: true, filter: true,
span: 24, span: 24,
search: false, search: false,
width: 200, width: 200,
}, },
{ {
label: "比例偏差因子", label: '比例偏差因子',
prop: "factor", prop: 'factor',
sortable: true, sortable: 'custom',
filter: true, filter: true,
span: 24, span: 24,
search: false, search: false,
@ -260,129 +304,134 @@ export default {
}, },
], ],
}, },
selectionList:[], selectionList: [],
partLoading:false, partLoading: false,
}; };
}, },
computed: {
...mapGetters(['permission']),
permissionList() {
return {
addRowBtn: this.validData(this.permission.outsourcingAssignmentControl_addRow, false),
};
},
},
mounted() { mounted() {
this.getSupplierData() this.getSupplierData();
// this.getAbility() // this.getAbility()
// this.getPartData() // this.getPartData()
}, },
methods: { methods: {
selectionChange(list){ selectionChange(list) {
this.selectionList = list this.selectionList = list;
}, },
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();
}, },
currentChange(currentPage){ currentChange(currentPage) {
this.page.currentPage = currentPage this.page.currentPage = currentPage;
}, },
sizeChange(pageSize){ sizeChange(pageSize) {
this.page.pageSize = pageSize this.page.pageSize = pageSize;
}, },
refreshChange(){ refreshChange() {
this.onLoad() this.onLoad();
}, },
// //
handleImport() { handleImport() {
this.isShowImport = true this.isShowImport = true;
}, },
closeDialog(val) { closeDialog(val) {
this.isShowImport = false this.isShowImport = false;
if(val){ if (val) {
this.onLoad() this.onLoad();
} }
}, },
handleSave(){ handleSave() {
submitBat(this.data).then(res =>{ submitBat(this.data).then(res => {
if(res.data.code == 200){ if (res.data.code == 200) {
this.$message.success("保存成功") this.$message.success('保存成功');
this.onLoad() this.onLoad();
} }
}) });
}, },
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();
} }
}) });
}) });
}, },
getSupplierData(){ getSupplierData() {
getSupplier().then(res =>{ getSupplier().then(res => {
this.supplierData = res.data.data this.supplierData = res.data.data;
}) });
}, },
getAbility(){ getAbility() {
getProcessAbility().then(res =>{ getProcessAbility().then(res => {
this.abilityData = res.data.data this.abilityData = res.data.data;
}) });
}, },
queryPart(query,index){ queryPart(query, index) {
console.log('query----------------',query) console.log('query----------------', query);
console.log('index----------------',index) console.log('index----------------', index);
this.partLoading = true this.partLoading = true;
if(query){ if (query) {
getPartList({ getPartList({
current:1, current: 1,
size:50, size: 50,
partCode:query partCode: query,
}).then(res =>{ }).then(res => {
this.partData = res.data.data.records this.partData = res.data.data.records;
this.partLoading = false this.partLoading = false;
}) });
}else{ } else {
getPartList({ getPartList({
current:1, current: 1,
size:50, size: 50,
}).then(res =>{ }).then(res => {
this.partData = res.data.data.records this.partData = res.data.data.records;
let tmp = this.partData.find(item => item.id == this.data[index].dsPart) let tmp = this.partData.find(item => item.id == this.data[index].dsPart);
if(!tmp){ if (!tmp) {
getPartList({ getPartList({
current:1, current: 1,
size:50, size: 50,
partCode:this.data[index].partCode partCode: this.data[index].partCode,
}).then(res =>{ }).then(res => {
this.partData = [...this.partData,...res.data.data.records] this.partData = [...this.partData, ...res.data.data.records];
this.partLoading = false this.partLoading = false;
});
}) } else {
}else{ this.partLoading = false;
this.partLoading = false
} }
}) });
} }
}, },
getPartData(){ getPartData() {
getPartList().then(res =>{ getPartList().then(res => {
this.partData = res.data.data this.partData = res.data.data;
}) });
}, },
// onLoad() { // onLoad() {
// this.loading = true; // this.loading = true;
@ -409,11 +458,13 @@ export default {
// //
handleSupplierChange(row) { handleSupplierChange(row) {
if (row.oemId) { if (row.oemId) {
getProcessAbility({ supplierId: row.oemId }).then(res => { getProcessAbility({ supplierId: row.oemId })
.then(res => {
row.abilityData = res.data.data || []; row.abilityData = res.data.data || [];
// //
row.platingId = ''; row.platingId = '';
}).catch(() => { })
.catch(() => {
row.abilityData = []; row.abilityData = [];
row.platingId = ''; row.platingId = '';
}); });
@ -422,13 +473,23 @@ export default {
row.platingId = ''; row.platingId = '';
} }
}, },
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);
},
async onLoad() { async onLoad() {
this.loading = true; this.loading = true;
try { try {
const res = await getList({ const res = await getList({
current: this.page.currentPage, current: this.page.currentPage,
size: this.page.pageSize, size: this.page.pageSize,
...this.query ...this.query,
}); });
const records = res.data.data.records; const records = res.data.data.records;
@ -440,23 +501,23 @@ export default {
// 2. // 2.
// 使 Promise.all // 使 Promise.all
const abilityPromises = records.map(async (item) => { const abilityPromises = records.map(async item => {
if (item.oemId) { if (item.oemId) {
try { try {
const abilityRes = await getProcessAbility({ const abilityRes = await getProcessAbility({
supplierId: item.oemId supplierId: item.oemId,
}); });
item.abilityData = abilityRes.data.data || [] item.abilityData = abilityRes.data.data || [];
// item // item
// this.$set(item, 'abilityData', abilityRes.data.data || []); // this.$set(item, 'abilityData', abilityRes.data.data || []);
} catch (e) { } catch (e) {
console.error('获取工艺能力失败', e); console.error('获取工艺能力失败', e);
// this.$set(item, 'abilityData', []); // this.$set(item, 'abilityData', []);
item.abilityData = [] item.abilityData = [];
} }
} else { } else {
// this.$set(item, 'abilityData', []); // this.$set(item, 'abilityData', []);
item.abilityData = [] item.abilityData = [];
} }
}); });
@ -464,12 +525,11 @@ export default {
// 3. data // 3. data
this.data = records; this.data = records;
this.data.forEach(item=>{ this.data.forEach(item => {
item.oemId = item.oemId==null?'':item.oemId+'' item.oemId = item.oemId == null ? '' : item.oemId + '';
item.platingId = item.platingId==null?'':item.platingId+'' item.platingId = item.platingId == null ? '' : item.platingId + '';
item.dsPart = item.dsPart==null?'':item.dsPart+'' item.dsPart = item.dsPart == null ? '' : item.dsPart + '';
});
})
this.page.total = res.data.data.total; this.page.total = res.data.data.total;
} catch (error) { } catch (error) {
console.error(error); console.error(error);

Loading…
Cancel
Save