中航光电热表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.
 
 
 
 

1063 lines
28 KiB

<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="batchClose()">批量关闭</el-button>
<el-button type="primary" @click.stop="priorityFn(row)">优先级调整</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 #curStatusText="{ row }">
<el-tag v-if="row.curStatusText == '已派工'">{{ row.curStatusText }}</el-tag>
<el-tag class="ml-2" type="success" v-if="row.curStatusText == '已完工'">
{{ row.curStatusText }}</el-tag
>
<el-tag class="ml-2" type="info" v-if="row.curStatusText == '已关闭'">{{
row.curStatusText
}}</el-tag>
<el-tag class="ml-2" type="warning" v-if="row.curStatusText == '加工中'">{{
row.curStatusText
}}</el-tag>
<el-tag class="ml-2" type="danger" v-if="row.curStatusText == '已退回'">{{
row.curStatusText
}}</el-tag>
</template>
<template #menu="{ row }">
<div class="menu-buttons">
<el-button type="primary" text plain @click="lookProcessRoute(row)" :id="id"
>工艺路线
</el-button>
<!-- <el-button type="primary" text plain size="small" @click.stop="priorityFn(row)">优先级调整
</el-button> -->
<el-button type="primary" text plain @click.stop="updateFn(row)">修改 </el-button>
<!-- <el-button type="primary" text plain size="small" @click.stop="confirmFn(row)">批量确认
</el-button> -->
</div>
</template>
</avue-crud>
<!-- 加急 -->
<!-- <rushDialog :showDialog="isRushOpen" v-if="isRushOpen" @closeDialog="closeDialog"></rushDialog>
<batchDialog :showDialog="isBatchOpen" v-if="isBatchOpen" @closeDialog="closeDialog"></batchDialog> -->
<!-- 修改 -->
<orderUpdateDailog
:showDialog="isUpdateOpen"
type="hotlist"
v-if="isUpdateOpen"
@closeDialog="closeDialog"
:id="id"
>
</orderUpdateDailog>
<!-- 优先级调整 -->
<priorityDialog
:showDialog="isPriorityOpen"
v-if="isPriorityOpen"
@closeDialog="closeDialog"
@submitPriority="handlePrioritySubmit"
:priorityName="priorityName"
></priorityDialog>
<!-- 工艺路线弹窗 -->
<lookProcess
:id="id"
:is-open="isOpen"
v-if="isOpen"
@cancel="closeDialog"
:rowData="rowItem"
sourceId="planYieIdOrder"
></lookProcess>
</basic-container>
</template>
<script>
import {
add,
getRole,
getRoleAlias,
getRoleTreeById,
grant,
grantTree,
remove,
update,
} from '@/api/system/role';
import { getList, updatePreference, closeBatchs,getHotOrderList } from '@/api/orderManagement/planYieIdOrder';
import { mapGetters } from 'vuex';
import { validatenull } from '@/utils/validate';
import lookProcess from './components/lookProcess.vue';
// import rushDialog from './components/rushDialog.vue'
// import batchDialog from './components/batchDialog.vue'
import orderUpdateDailog from './components/orderUpdateDailog.vue';
import priorityDialog from './components/priorityDialog.vue';
export default {
components: {
orderUpdateDailog,
priorityDialog,
// rushDialog,
// batchDialog
lookProcess,
},
data() {
return {
id: null,
isUpdateOpen: false,
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: 6,
searchIcon: true,
searchIndex: 3,
tree: false,
border: true,
index: true,
selection: true,
addBtn: false,
editBtn: false,
viewBtn: false,
delBtn: false,
editBtnText: '修改',
labelWidth: 120,
// searchLabelWidth: 120,
menuWidth: 300,
dialogWidth: 900,
dialogClickModal: false,
searchEnter: true,
excelBtn: false,
filterBtn: true,
searchShowBtn: false,
excelBtn: true,
index: false,
showOverflowTooltip: true,
addBtnIcon: ' ',
viewBtnIcon: ' ',
delBtnIcon: ' ',
editBtnIcon: ' ',
gridBtn: false,
searchLabelPosition: 'left',
searchGutter: 24,
searchSpan: 6,
menuAlign: 'left',
gridBtn: false,
searchMenuPosition: 'right',
align: 'center',
column: [
{
label: '计划单号',
prop: 'ypCode',
search: true,
sortable: true,
width: 150,
span: 12,
headerAlign: 'center',
align: 'center',
rules: [
{
required: true,
message: '请输入计划单号',
trigger: 'blur',
},
],
},
{
label: '生产单号',
prop: 'yoCode',
search: true,
sortable: true,
width: 150,
span: 12,
headerAlign: 'center',
align: 'center',
rules: [
{
required: true,
message: '请输入生产单号',
trigger: 'blur',
},
],
},
{
label: '零件号',
prop: 'partCode',
search: true,
sortable: true,
width: 180,
span: 12,
headerAlign: 'center',
align: 'center',
rules: [
{
required: true,
message: '请输入零件号',
trigger: 'blur',
},
],
},
{
label: '批次号',
prop: 'batchNo',
search: true,
sortable: true,
width: 150,
span: 12,
headerAlign: 'center',
align: 'center',
rules: [
{
required: true,
message: '请输入批次号',
trigger: 'blur',
},
],
},
{
label: '产品型号',
prop: 'productType',
search: false,
sortable: true,
disabled: true,
width: 120,
span: 12,
headerAlign: 'center',
align: 'center',
rules: [
{
required: false,
message: '请输入产品型号',
trigger: 'blur',
},
],
},
{
label: '产品名称',
prop: 'partName',
search: false,
sortable: true,
disabled: true,
span: 12,
width: 150,
headerAlign: 'center',
align: 'left',
rules: [
{
required: false,
message: '请输入产品名称',
trigger: 'blur',
},
],
},
{
label: '流程卡号',
prop: 'cardNo',
search: true,
sortable: true,
width: 150,
span: 12,
headerAlign: 'center',
align: 'center',
rules: [
{
required: true,
message: '请输入流程卡号',
trigger: 'blur',
},
],
},
{
label: '流转编号',
prop: 'roamNo',
search: true,
sortable: true,
width: 150,
span: 12,
headerAlign: 'center',
align: 'center',
rules: [
{
required: true,
message: '请输入流转编号',
trigger: 'blur',
},
],
},
{
label: '订单优先级',
prop: 'priorityAps',
search: false,
sortable: true,
width: 150,
span: 12,
headerAlign: 'center',
align: 'center',
type: 'select',
dicData: [
{
label: '一级',
value: '1',
},
{
label: '二级',
value: '2',
},
{
label: '三级',
value: '3',
},
],
rules: [
{
required: true,
message: '请输入订单优先级',
trigger: 'blur',
},
],
},
{
label: '镀种',
prop: 'plate',
search: false,
sortable: true,
disabled: true,
span: 12,
headerAlign: 'center',
align: 'center',
rules: [
{
required: false,
message: '请输入镀种',
trigger: 'blur',
},
],
},
// {
// label: '镀种小类',
// prop: 'plate',
// search: false,
// sortable: true,
// width: 120,
// display: false,
// span: 12,
// headerAlign: 'center',
// align: 'center',
// rules: [
// {
// required: true,
// message: '请输入角色名称',
// trigger: 'blur',
// },
// ],
// },
{
label: '生产标识',
prop: 'productIdent',
search: false,
sortable: true,
width: 120,
span: 12,
headerAlign: 'center',
align: 'center',
rules: [
{
required: true,
message: '请输入生产标识',
trigger: 'blur',
},
],
},
{
label: '使用部门',
prop: 'useDeptName',
search: false,
sortable: true,
disabled: true,
width: 120,
span: 12,
headerAlign: 'center',
align: 'center',
rules: [
{
required: true,
message: '请输入使用部门',
trigger: 'blur',
},
],
},
{
label: '需求数量',
prop: 'ypQty',
search: false,
sortable: true,
width: 120,
span: 12,
headerAlign: 'center',
align: 'center',
rules: [
{
required: true,
message: '请输入角色名称',
trigger: 'blur',
},
],
},
{
label: '面积(d㎡)',
prop: 'ypArea',
search: false,
sortable: true,
width: 120,
span: 12,
disabled: true,
headerAlign: 'center',
align: 'center',
rules: [
{
required: false,
message: '请输入面积(d㎡)',
trigger: 'blur',
},
],
},
{
label: '需求交期',
prop: 'demandDate',
search: false,
sortable: true,
width: 180,
span: 12,
headerAlign: 'center',
align: 'center',
rules: [
{
required: true,
message: '请输入需求交期',
trigger: 'blur',
},
],
},
{
label: '计划员',
prop: 'planUserName',
search: false,
sortable: true,
width: 120,
span: 12,
headerAlign: 'center',
align: 'center',
rules: [
{
required: true,
message: '请输入计划员',
trigger: 'blur',
},
],
},
{
label: '计划下达时间',
prop: 'releaseDate',
search: false,
sortable: true,
searchLabelWidth: 100,
width: 170,
span: 12,
type: 'date',
headerAlign: 'center',
align: 'center',
rules: [
{
required: true,
message: '请输入计划下达时间',
trigger: 'blur',
},
],
},
{
label: '返工单号',
prop: 'reworkCode',
search: true,
sortable: true,
width: 120,
span: 12,
headerAlign: 'center',
align: 'center',
rules: [
{
required: true,
message: '请输入返工单号',
trigger: 'blur',
},
],
},
{
label: '原生产单号',
prop: 'originalProductionOrderNo',
search: false,
sortable: true,
width: 120,
span: 12,
headerAlign: 'center',
align: 'center',
rules: [
{
required: true,
message: '请输入原生产单号',
trigger: 'blur',
},
],
},
{
label: '订单状态',
prop: 'status',
search: true,
sortable: true,
span: 12,
display: false,
type: 'select',
width: '140',
headerAlign: 'center',
align: 'center',
dicData: [
{
value: 10000,
label: '已同步',
},
{
value: 10001,
label: '订单异常',
},
{
value: 10002,
label: '未下达',
},
{
value: 10003,
label: '待排产',
},
{
value: 10004,
label: '待生产',
},
{
value: 10005,
label: '加工中',
},
{
value: 10006,
label: '排产异常',
},
{
value: 10015,
label: '已完工',
},
{
value: 10021,
label: '已关闭',
},
],
},
{
label: '备注',
prop: 'memo',
search: false,
sortable: true,
span: 24,
type: 'textarea',
width: 150,
headerAlign: 'center',
align: 'left',
rules: [
{
required: true,
message: '请输入备注',
trigger: 'blur',
},
],
},
],
},
data: [],
isRushOpen: false, //加急弹框
isBatchOpen: false, //分批处理
isPriorityOpen: false, //
priorityName: '',
};
},
computed: {
...mapGetters(['userInfo', 'permission']),
permissionList() {
return {
addBtn: this.validData(this.permission.role_add, false),
viewBtn: this.validData(this.permission.role_view, false),
delBtn: this.validData(this.permission.role_delete, false),
editBtn: this.validData(this.permission.role_edit, false),
};
},
ids() {
let ids = [];
this.selectionList.forEach(ele => {
ids.push(ele.id);
});
return ids.join(',');
},
idsArray() {
let ids = [];
this.selectionList.forEach(ele => {
ids.push(ele.id);
});
return ids;
},
},
watch: {
'form.currentAlias'() {
const alias = this.form.currentAlias;
if (!validatenull(alias)) {
this.form.roleAlias = alias;
}
},
},
methods: {
// 优先级调整
priorityFn() {
if (this.selectionList.length === 0 || this.selectionList.length > 1) {
this.$message.warning('请选择一条数据');
return;
}
this.priorityName = this.selectionList[0]['prodIdent'];
this.isPriorityOpen = true;
},
async handlePrioritySubmit(data) {
try {
const form = {
priority: data.priority,
ids: this.selectionList.map(item => item.id).join(','),
};
const res = await updatePreference(form);
if (res.code === 200) {
this.$message.success(`优先级已调整为${res.msg}`);
} else {
this.$message.error(`优先级已调整为${res.msg}`);
}
} catch (err) {
console.log(err);
}
// this.$message.success(
// `优先级已调整为${data.priority === 1 ? '一级' : data.priority === 2 ? '二级' : '三级'}`
// );
this.onLoad(this.page, {});
},
// 修改
updateFn(row) {
this.id = row.id;
this.isUpdateOpen = true;
},
// 批量接收
batchReceiving() {
this.$confirm('确定将选择数据批量关闭??', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
const ids = this.selectionList.map(item => item.id).join(',');
closeBatchs({ ...{ ids }, ...this.approveForm }).then(res => {
if (res.code === 200) {
this.$message.success('操作成功');
}
});
this.$refs.crud.toggleSelection();
this.onLoad(this.page);
})
.catch(() => {
// this.onLoad(this.page);
// this.$message({
// type: 'success',
// message: '操作成功!',
// });
});
},
// 批量关闭
batchClose() {
// 检查是否选择了数据
if (this.selectionList.length === 0) {
this.$message.warning('请选择至少一条数据');
return;
}
this.$confirm('确定将选择数据批量关闭?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
const ids = this.selectionList.map(item => item.id).join(',');
closeBatchs({ ...{ ids }, ...this.approveForm }).then(res => {
if (res.code === 200) {
this.$message.success('操作成功');
this.onLoad(this.page);
}
});
this.approveDialog = false;
this.$refs.crud.toggleSelection();
// return remove(row.id);
})
.catch(() => {
// this.onLoad(this.page);
// this.$message({
// type: 'success',
// message: '操作成功!',
// });
});
},
// 加急
rushFn() {
this.isRushOpen = true;
},
closeDialog() {
this.isRushOpen = false;
this.isBatchOpen = false;
this.isUpdateOpen = false;
this.isPriorityOpen = false;
this.isOpen = false;
},
inBatchesFn(row) {
this.rowItem = row;
this.isBatchOpen = true;
},
subclass() {
this.platingSmallOpen = true;
},
lookProcessRoute(row) {
this.id = row.id;
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) {
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: '操作成功!',
});
},
confirmFn() {
this.$confirm('确定将选择数据批量确认?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
// return remove(row.id);
})
.then(() => {
// this.onLoad(this.page);
// this.$message({
// type: 'success',
// message: '操作成功!',
// });
});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
handleEdit(row) {
this.$refs.editDialog.open(row);
},
handleDelete(row) {
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {});
},
async onLoad(page, params = {}) {
this.loading = true;
try {
const res = await getHotOrderList({
current:this.page.currentPage,
size:this.page.pageSize,
...this.query,
});
this.data = res.data.data.records;
this.page.total = res.data.data.total;
this.loading = false;
// const res = await getList(
// page.currentPage,
// page.pageSize,
// Object.assign(params, this.query)
// );
// if (res.code) {
// this.data = res.data.data.records;
// this.page.total = res.data.data.total;
// this.selectionClear();
// }
} catch (err) {
console.log(err);
}
},
},
mounted() {
// 设置默认查询条件为【待接收】状态
this.query = {
curStatusText: '已派工',
};
},
};
</script>
<style scoped>
.menu-buttons {
display: flex;
flex-wrap: nowrap;
justify-content: flex-start;
white-space: nowrap;
overflow: hidden;
width: 100%;
}
.menu-buttons .el-button {
margin-right: 5px;
padding: 2px 5px;
min-width: auto;
flex-shrink: 0;
}
.menu-buttons .el-button span {
white-space: nowrap;
}
</style>