中航光电热表web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

667 lines
18 KiB

<template>
<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="moldAddFn(null, true)">批量模具申报</el-button>
<!-- <el-button type="primary" @click="moldAddFn(null,true)">模具申报</el-button> -->
<el-button type="primary" @click="closeNeed()">关闭需求</el-button>
</template>
<template #menu-right> </template>
<template #poCode="{ row }">
<el-text type="primary">{{ row.poCode }}</el-text>
</template>
<template #prodIdent="{ row }">
<el-tag>{{ row.prodIdent }}</el-tag>
</template>
<template #menu="{ row }">
<el-button
type="primary"
text
plain
style="border: 0; background-color: transparent !important"
@click="detailsFn(row)"
>详情
</el-button>
<el-button
type="primary"
text
plain
style="border: 0; background-color: transparent !important"
@click="moldAddOneFn(row, false)"
>模具申报
</el-button>
</template>
</avue-crud>
<!-- 模具申报 -->
<addMoldDailog
v-if="addOpen"
:showDialog="addOpen"
@closeDialog="closeDialog"
:moldAddMore="moldAddMore"
:list="selectionList"
>
</addMoldDailog>
<!-- 详情 -->
<detailsInfoDialog
v-if="detailsOpen"
:showDialog="detailsOpen"
@closeDialog="closeDialog"
:id="Id"
></detailsInfoDialog>
<!-- 单个模具申报 -->
<moldAddOneDialog
v-if="moldAddOneOpen"
:showDialog="moldAddOneOpen"
@closeDialog="closeDialog"
:id="moldId"
></moldAddOneDialog>
</template>
<script>
import { getSelectData } from '@/utils/dict';
import { getList, closeBatchs } from '@/api/orderManagement/moldPlan';
import addMoldDailog from './addMoldDailog.vue';
import detailsInfoDialog from './detailsInfoDialog.vue';
import moldAddOneDialog from './moldAddOneDialog.vue';
export default {
components: {
addMoldDailog,
detailsInfoDialog,
moldAddOneDialog,
},
data() {
return {
Id: null,
moldId:null,
departments: [],
materials: [],
activeName: 'first',
inBatchesOpen: false,
platingSmallOpen: false,
planOrderArr: [],
isOpen: false,
rowItem: {},
poId: null,
form: {},
box: false,
props: {
label: 'title',
value: 'key',
},
menuGrantList: [],
dataScopeGrantList: [],
apiScopeGrantList: [],
apiGrantList: [],
menuTreeObj: [],
dataScopeTreeObj: [],
apiScopeTreeObj: [],
selectionList: [],
query: {},
loading: true,
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
option: {
columnSort: true,
tip: false,
height: 'auto',
calcHeight: 32,
simplePage: false,
searchShow: true,
searchMenuSpan: 12,
searchIcon: true,
searchIndex: 3,
tree: false,
border: true,
index: false,
selection: true,
viewBtn: false,
addBtn: false,
delBtn: false,
editBtn: false,
editBtnText: '修改',
labelWidth: 120,
// searchLabelWidth: 120,
menuWidth: 140,
dialogWidth: 900,
dialogClickModal: false,
searchEnter: true,
excelBtn: false,
filterBtn: true,
searchShowBtn: false,
excelBtn: true,
showOverflowTooltip: true,
addBtnIcon: ' ',
viewBtnIcon: ' ',
delBtnIcon: ' ',
editBtnIcon: ' ',
gridBtn: false,
searchLabelPosition: 'left',
searchLabelPosition: 'left',
searchGutter: 24,
searchSpan: 6,
menuAlign: 'left',
gridBtn: false,
searchMenuPosition: 'right',
align: 'center',
column: [
{
label: '需求单号',
prop: 'partCode',
search: false,
sortable: true,
span: 12,
headerAlign: 'center',
align: 'center',
},
{
label: '零件号',
prop: 'partCode',
search: true,
sortable: true,
span: 12,
headerAlign: 'center',
align: 'center',
searchLabelWidth: 60,
},
{
label: '零件名称',
prop: 'partName',
search: false,
sortable: true,
span: 12,
headerAlign: 'center',
align: 'center',
searchLabelWidth: 60,
},
{
label: '工装号',
prop: 'moCode',
search: true,
sortable: true,
span: 12,
headerAlign: 'center',
align: 'center',
searchLabelWidth: 60,
},
{
label: '工装名称',
prop: 'moName',
search: false,
sortable: true,
span: 12,
headerAlign: 'center',
align: 'left',
},
{
label: '订单需求量',
prop: 'quantity',
search: false,
sortable: true,
span: 12,
headerAlign: 'center',
align: 'center',
},
{
label: '库存量',
prop: 'stockNum',
search: false,
sortable: true,
span: 12,
headerAlign: 'center',
align: 'center',
},
{
label: '占用量',
prop: 'occupyNum',
search: false,
sortable: true,
span: 12,
headerAlign: 'center',
align: 'center',
},
{
label: '关联订单',
prop: 'linkOrderIds',
search: false,
sortable: true,
span: 12,
headerAlign: 'center',
align: 'center',
},
],
},
data: [],
addOpen: false, //模具申报
moldAddMore: false,
detailsOpen: false, //详情
moldAddOneOpen: false, //单个模具申报
};
},
methods: {
// 关闭需求
closeNeed() {
// 检查是否选择了数据
if (this.selectionList.length === 0) {
this.$message.error('请至少选择一条数据!');
return;
}
this.$confirm('确定将选择数据批量关闭?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'error',
})
.then(() => {
const ids = this.selectionList.map(item => item.id).join(',');
closeBatchs({ ids }).then(res => {
if (res.code === 200) {
this.$message({
type: 'success',
message: '操作成功!',
});
}
this.onLoad();
});
// this.onLoad(this.page);
// this.$message({
// type: 'success',
// message: '操作成功!',
// });
// this.$refs.crud.toggleSelection();
})
.catch(() => {
this.$message.error('操作失败!');
this.$refs.crud.toggleSelection();
});
},
// 新增
moldAddFn(row, flag) {
// if(this.selectionList.length == 0) {
// this.$message.error('请至少选择一条数据!');
// return;
// }
this.addOpen = true;
this.moldAddMore = flag;
},
// 模具申报
moldAddOneFn(row) {
this.moldId = row.id;
this.moldAddMore = false
this.selectionList = [{...row}]
this.addOpen = true;
},
// 详情
detailsFn(row) {
this.Id = row.id;
this.detailsOpen = true;
},
// 关闭弹框
closeDialog(val) {
this.addOpen = false;
this.detailsOpen = false;
this.moldAddOneOpen = false;
if(val){
this.onLoad()
}
},
inBatchesFn(row) {
this.rowItem = row;
this.inBatchesOpen = true;
},
subclass() {
this.platingSmallOpen = true;
},
lookProcessRoute(row) {
this.isOpen = true;
this.rowItem = row;
},
cancel(refresh) {
if (refresh) {
this.$refs.myTable.load();
}
this.inBatchesOpen = false;
this.isOpen = false;
this.planFormOpen = false;
this.platingSmallOpen = false;
},
initData(roleId) {
getRoleTreeById(roleId).then(res => {
const column = this.findObject(this.option.column, 'parentId');
column.dicData = res.data.data;
});
},
submit() {
const menuList = this.$refs.treeMenu.getCheckedKeys();
const dataScopeList = this.$refs.treeDataScope.getCheckedKeys();
const apiScopeList = this.$refs.treeApiScope.getCheckedKeys();
grant(this.idsArray, menuList, dataScopeList, apiScopeList).then(() => {
this.box = false;
this.$message({
type: 'success',
message: '操作成功!',
});
this.selectionList = [];
this.onLoad(this.page);
});
},
rowSave(row, done, loading) {
console.log(222222222, 111);
add(row).then(
() => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
});
done();
},
error => {
window.console.log(error);
loading();
}
);
},
rowUpdate(row, index, done, loading) {
update(row).then(
() => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
});
done();
},
error => {
window.console.log(error);
loading();
}
);
},
rowDel(row) {
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
return remove(row.id);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
});
});
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
selectionChange(list) {
this.selectionList = list;
},
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
beforeOpen(done, type) {
if (['add', 'edit'].includes(type)) {
this.initData(this.form.id);
}
if (['edit', 'view'].includes(type)) {
if (this.form.parentId === '0') {
this.form.parentId = '';
}
}
getRoleAlias().then(res => {
const column = this.findObject(this.option.column, 'currentAlias');
column.dicData = res.data.data;
});
done();
},
handleRole() {
if (this.selectionList.length !== 1) {
this.$message.warning('只能选择一条数据');
return;
}
this.menuTreeObj = [];
this.dataScopeTreeObj = [];
this.apiScopeTreeObj = [];
grantTree().then(res => {
this.menuGrantList = res.data.data.menu;
this.dataScopeGrantList = res.data.data.dataScope;
this.apiScopeGrantList = res.data.data.apiScope;
getRole(this.ids).then(res => {
this.menuTreeObj = res.data.data.menu;
this.dataScopeTreeObj = res.data.data.dataScope;
this.apiScopeTreeObj = res.data.data.apiScope;
this.box = true;
});
});
},
handleRowRole(row) {
this.menuTreeObj = [];
this.dataScopeTreeObj = [];
this.apiScopeTreeObj = [];
grantTree().then(res => {
this.menuGrantList = res.data.data.menu;
this.dataScopeGrantList = res.data.data.dataScope;
this.apiScopeGrantList = res.data.data.apiScope;
getRole(row.id).then(res => {
this.menuTreeObj = res.data.data.menu;
this.dataScopeTreeObj = res.data.data.dataScope;
this.apiScopeTreeObj = res.data.data.apiScope;
this.selectionList.push(row);
this.box = true;
});
});
},
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning('请选择至少一条数据');
return;
}
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
return remove(this.ids);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
});
this.$refs.crud.toggleSelection();
});
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
refreshChange() {
this.onLoad(this.page, this.query);
},
handleChange(file, fileList) {
// proxy.$Export.xlsx(file.raw).then((data) => {
// data.value = data.results;
// });
this.$message({
type: 'success',
message: '操作成功!',
});
},
onLoad(page, params = {}) {
this.loading = true;
getList(this.page.currentPage, this.page.pageSize, Object.assign(params, this.query)).then(res => {
this.data = res.data.data.records;
this.page.total = res.data.data.total;
this.selectionClear();
this.loading = false;
});
// this.data = [
// {
// id: 1,
// alreadyBranchQty: 104.0,
// bsPlatingSmall: null,
// bsProcedureQua: null,
// closeMan: null,
// closeTime: null,
// curStatus: 4,
// curStatusText: '已派工',
// custodian: null,
// deliveryQty: 0.0,
// demandDate: '2025-03-13 00:00:00',
// dominantDept: '3400',
// dsPart: null,
// keyValue: 43933,
// memo: '最多三个批次0159BKFX',
// partCode: '21E6-575-1710_003-H14-C-N',
// partName: '09-J599_25烧结插座',
// planType: 2,
// planUser: '0300009',
// plate: 'Ep.Ni3b',
// poArea: 0.0,
// poCode: 'WO-2211134240',
// poCode1: '4240',
// partCode: '40',
// toolingNo: '888',
// poId: 43933,
// poQty: 104,
// primaryCraft: '4(封接、表、涂色带)-库2',
// priority: 1,
// prodIdent: 'JHT',
// prodLine: null,
// quantity: 'JY599',
// releaseDate: '2022-11-24 11:59:21',
// roamNo: 'B5199029',
// routeNo: 'LX08-05-002',
// sureType: null,
// sureTypeTitle: '未确认',
// syncTime: '2023-02-10 20:58:11',
// undeliveredQty: 104.0,
// useDept: '3502',
// wcName: null,
// },
// {
// id: 2,
// alreadyBranchQty: 104.0,
// bsPlatingSmall: null,
// bsProcedureQua: null,
// closeMan: null,
// closeTime: null,
// curStatus: 4,
// curStatusText: '已派工',
// custodian: null,
// deliveryQty: 0.0,
// demandDate: '2025-03-13 00:00:00',
// dominantDept: '3400',
// dsPart: null,
// keyValue: 43948,
// memo: '最多三个批次0159BKFX',
// partCode: '21E6-575-1710_003-H14-C-N',
// partName: '09-J599_25烧结插座',
// planType: 2,
// planUser: '0300009',
// plate: 'Ep.Ni3b',
// poArea: 0.0,
// poCode: 'WO-2211134240',
// poId: 43948,
// poQty: 104,
// primaryCraft: '4(封接、表、涂色带)-库2',
// priority: 1,
// prodIdent: 'JHT',
// prodLine: null,
// quantity: 'JY599',
// releaseDate: '2022-11-24 11:59:21',
// roamNo: null,
// routeNo: 'LX08-05-002',
// sureType: null,
// sureTypeTitle: '未确认',
// syncTime: '2023-02-10 20:58:11',
// undeliveredQty: 104.0,
// useDept: '3502',
// wcName: null,
// },
// {
// id: 3,
// alreadyBranchQty: 19.0,
// bsPlatingSmall: null,
// bsProcedureQua: null,
// closeMan: null,
// closeTime: null,
// curStatus: 4,
// curStatusText: '已派工',
// custodian: null,
// deliveryQty: 0.0,
// demandDate: '2025-02-23 00:00:00',
// dominantDept: '3400',
// dsPart: null,
// keyValue: 43932,
// memo: '最多三个批次0159BKFX',
// partCode: '21E6-575-1710_002-H14-N-N',
// partName: '09-J599_25烧结插座',
// planType: 2,
// planUser: '0300009',
// plate: 'Ep.Ni3b',
// poArea: 0.0,
// poCode: 'WO-2211134211',
// poId: 43932,
// poQty: 19,
// primaryCraft: '4(封接、表、涂色带)-库2',
// priority: 1,
// prodIdent: 'JHT',
// prodLine: null,
// quantity: 'JY599',
// releaseDate: '2022-11-24 11:59:21',
// roamNo: null,
// routeNo: 'LX08-05-002',
// sureType: null,
// sureTypeTitle: '未确认',
// syncTime: '2023-02-10 20:58:11',
// undeliveredQty: 19.0,
// useDept: '3502',
// wcName: null,
// },
// ];
},
},
mounted() {},
};
</script>