This commit is contained in:
parent
32f00cf500
commit
53b8636d68
|
|
@ -167,11 +167,17 @@ export default {
|
|||
this.textboxValue = this.getShowValue({ obj: this.value, path: params.textField });
|
||||
}
|
||||
}
|
||||
else if (params && params.dataType == 'mapper') {
|
||||
this.textboxValue = this.row[params.showField];
|
||||
}
|
||||
else if (this.value && this.value[1]) {
|
||||
this.textboxValue = this.value[1];
|
||||
} else {
|
||||
this.textboxValue = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
let f = params.listdataFieldName || "Records";
|
||||
this.getData().then(data => {
|
||||
if('Total' in data){
|
||||
|
|
@ -318,6 +324,12 @@ export default {
|
|||
else if (params.dataType == "object") {
|
||||
this.$emit('input', e.row);
|
||||
}
|
||||
|
||||
else if (params.dataType == 'mapper') {
|
||||
if(params.showField){
|
||||
this.$emit('input', e.row[params.showField]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.$emit('input', [e.row.ID, e.row[textField]]);
|
||||
}
|
||||
|
|
@ -345,6 +357,11 @@ export default {
|
|||
else if (params.dataType == "object") {
|
||||
this.$emit('input', selectedRow);
|
||||
}
|
||||
else if (params.dataType == 'mapper') {
|
||||
if(params.showField){
|
||||
this.$emit('input', selectedRow[params.showField]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.$emit('input', [selectedRow.ID, selectedRow[textField]]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@
|
|||
<a-button @click="pageVoucherDelete" :disabled="!this.getDataId() || pageStatus == 'approved'">删除</a-button>
|
||||
|
||||
<a-button @click="pageComplete" :disabled="!this.getDataId() || pageStatus != 'approved'">完成</a-button>
|
||||
|
||||
|
||||
<a-button @click="pageClose" :disabled="!this.getDataId() || pageStatus != 'approved'">关闭</a-button>
|
||||
|
||||
|
||||
<a-button :disabled="!this.getDataId()" @click="pageExport" v-if="false">导出</a-button>
|
||||
<a-button :disabled="!this.getDataId()" @click="pagePrint" v-if="false">打印</a-button>
|
||||
</div>
|
||||
|
|
@ -67,7 +67,13 @@
|
|||
</div>
|
||||
</template>
|
||||
</vxe-column>
|
||||
|
||||
<vxe-column title="工序管理" width="120" v-if="dataId">
|
||||
<template #default="{ row }">
|
||||
<div class="oplinks2">
|
||||
<a-button @click.stop="pageShowProcesses({row})">工序设置</a-button>
|
||||
</div>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="contract_number" title="合同号" width="160" :edit-render="{ name: '$input' }"></vxe-column>
|
||||
<vxe-column field="materials_code" title="料品编码" width="160"></vxe-column>
|
||||
<vxe-column field="materials_name" title="料品名称" width="160" :params="editorMaterials"
|
||||
|
|
@ -87,8 +93,46 @@
|
|||
<vxe-column field="remark" title="备注" width="160" :edit-render="{ name: '$input' }"></vxe-column>
|
||||
|
||||
|
||||
|
||||
</vxe-table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<vxe-modal class="vxe-table--ignore-clear" v-model="showProcesses" width="900" height="800" :show-footer="true"
|
||||
@confirm="confirmProcesses" min-width="600" min-height="400" show-zoom resize transfer>
|
||||
<template #title>
|
||||
<span>工序管理</span>
|
||||
</template>
|
||||
<template #default>
|
||||
|
||||
<vxe-table border show-overflow keep-source ref="xTable2" :height="table2Height" :data="detailsData2"
|
||||
@pulldownSelected="onPulldownSelected2" @popupSelected="onPopupSelected2" :export-config="{}"
|
||||
@edit-closed="afterEditEvent2" @edit-actived="beforeEditEvent2"
|
||||
:edit-config="{ trigger: 'click', mode: 'cell', icon: 'vxe-icon-edit', showStatus: false, beforeEditMethod: beforeEditMethod2 }">
|
||||
<vxe-column width="70">
|
||||
<template #default="{ row }">
|
||||
<div class="oplinks2">
|
||||
<a @click.stop="pageAdd2(row)" title="新增">
|
||||
<a-icon class="icon" type="plus-circle" />
|
||||
</a>
|
||||
<a @click.stop="pageDelete2(row)" title="删除">
|
||||
<a-icon class="icon" type="delete" />
|
||||
</a>
|
||||
</div>
|
||||
</template>
|
||||
</vxe-column>
|
||||
|
||||
<vxe-column field="step_name" title="工序" width="160" :params="editorProcesses"
|
||||
:edit-render="{ name: 'MkGridDataSelector' }"></vxe-column>
|
||||
|
||||
|
||||
|
||||
</vxe-table>
|
||||
|
||||
</template>
|
||||
</vxe-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -117,14 +161,23 @@ export default {
|
|||
nextId: null,
|
||||
|
||||
table1Height: 400,
|
||||
detailsSourceData: [
|
||||
],
|
||||
table2Height: 400,
|
||||
detailsData: [
|
||||
],
|
||||
deletedDetailsData: [
|
||||
|
||||
],
|
||||
|
||||
currentRow :null,
|
||||
showProcesses:false,
|
||||
|
||||
detailsData2: [
|
||||
],
|
||||
deletedDetailsData2: [
|
||||
|
||||
],
|
||||
|
||||
|
||||
pageStatus: '',
|
||||
editorMaterials: {
|
||||
dataType: "mapper",
|
||||
|
|
@ -143,6 +196,21 @@ export default {
|
|||
page: () => import("../../MesMaterials/MesMaterials/List")
|
||||
}
|
||||
},
|
||||
editorProcesses: {
|
||||
dataType: "mapper",
|
||||
mapper: [
|
||||
{ field: "step_id", fromField: "id" },
|
||||
{ field: "step_name", fromField: "name" }
|
||||
],
|
||||
showField: "step_name",
|
||||
valueField: "id",
|
||||
textField: "name",
|
||||
listdataFieldName: 'MesProcesses',
|
||||
dataUrl: `${BASE_URL.BASE_URL}/MesProcesses/v1/mes/processes/list`,
|
||||
popup: {
|
||||
page: () => import("../../MesProcesses/MesProcesses/List")
|
||||
}
|
||||
},
|
||||
editor_process_route: {
|
||||
dataType: "string",
|
||||
valueField: "name",
|
||||
|
|
@ -198,7 +266,7 @@ export default {
|
|||
if (this.$route.params.id) {
|
||||
this.dataId = this.$route.params.id;
|
||||
}
|
||||
},
|
||||
},
|
||||
// 函数
|
||||
methods: {
|
||||
|
||||
|
|
@ -339,7 +407,7 @@ export default {
|
|||
this.pageStatus = 'approved';
|
||||
}
|
||||
|
||||
this.detailsData = JSON.parse(JSON.stringify(a.data[detailDataFieldName].production_order_materials || [])) ;
|
||||
this.detailsData = JSON.parse(JSON.stringify(a.data[detailDataFieldName].production_order_materials || []));
|
||||
|
||||
this.detailsDataInit();
|
||||
this.$forceUpdate()
|
||||
|
|
@ -367,6 +435,11 @@ export default {
|
|||
this.detailsData.push({});
|
||||
}
|
||||
},
|
||||
detailsDataInit2() {
|
||||
for (let i = this.detailsData2.length; i < 50; i++) {
|
||||
this.detailsData2.push({});
|
||||
}
|
||||
},
|
||||
|
||||
// 获取路由的id参数
|
||||
getDataId() {
|
||||
|
|
@ -415,7 +488,7 @@ export default {
|
|||
postdata.id = this.getDataId_BigInt();
|
||||
}
|
||||
|
||||
let ds = JSONbig.parse(JSONbig.stringify(this.detailsData));
|
||||
let ds = JSONbig.parse(JSONbig.stringify(this.detailsData));
|
||||
|
||||
ds = ds.filter(item => item.materials_id);
|
||||
if (!ds.length) {
|
||||
|
|
@ -430,10 +503,10 @@ export default {
|
|||
}
|
||||
delete item._X_ROW_KEY;
|
||||
|
||||
if(item.id){
|
||||
if (item.id) {
|
||||
item.id = this.$mk.toBigInt(item.id);
|
||||
}
|
||||
|
||||
|
||||
item.materials_id = this.$mk.toBigInt(item.materials_id);
|
||||
item.production_num = parseInt(item.production_num);
|
||||
item.batch_num = parseInt(item.batch_num);
|
||||
|
|
@ -444,28 +517,28 @@ export default {
|
|||
|
||||
|
||||
if (this.dataId) {
|
||||
postdata.production_order_materials = {
|
||||
insertList:[],
|
||||
updateList:[],
|
||||
deleteList:[]
|
||||
postdata.production_order_materials = {
|
||||
insertList: [],
|
||||
updateList: [],
|
||||
deleteList: []
|
||||
};
|
||||
|
||||
ds.forEach(item=>{
|
||||
if(item.id){
|
||||
ds.forEach(item => {
|
||||
if (item.id) {
|
||||
postdata.production_order_materials.updateList.push(item);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
postdata.production_order_materials.insertList.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
this.deletedDetailsData.forEach(item=>{
|
||||
this.deletedDetailsData.forEach(item => {
|
||||
postdata.production_order_materials.deleteList.push(item);
|
||||
})
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
postdata.production_order_materials = ds;
|
||||
postdata.production_order_materials = ds;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -478,7 +551,7 @@ export default {
|
|||
delete postdata.audit_staff_appoint;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 格式化提交的数据
|
||||
this.$mk.formatFormData({ data: postdata, rules: this.options.formOptions.items });
|
||||
|
|
@ -499,7 +572,7 @@ export default {
|
|||
this.dataId = a.data.id;
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.pageInit();
|
||||
} else {
|
||||
this.$mk.error(a.msg || "保存失败"); // 显示错误信息
|
||||
|
|
@ -677,7 +750,7 @@ export default {
|
|||
width: width * 0.9,
|
||||
height: height * 0.9,
|
||||
callback: ({ data }) => {
|
||||
console.log(data)
|
||||
console.log(data)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -709,7 +782,50 @@ export default {
|
|||
});
|
||||
|
||||
},
|
||||
pageShowProcesses({row}){
|
||||
this.currentRow = row;
|
||||
|
||||
console.log(row)
|
||||
if(!this.dataId){
|
||||
return;
|
||||
}
|
||||
if(!row.materials_id){
|
||||
this.$mk.error("未设置料品");
|
||||
return;
|
||||
}
|
||||
this.$mk.post({
|
||||
url: `${BASE_URL.BASE_URL}/MesProductionOrder/v1/production/order/processes/list`,
|
||||
loading: "加载中...",
|
||||
data: {
|
||||
"page": 1,
|
||||
"limit": 10000,
|
||||
"start_time": 0,
|
||||
"end_time": 0,
|
||||
"search_rules": [
|
||||
{
|
||||
column: "materials_id",
|
||||
mode: "=",
|
||||
value: row.materials_id.toString()
|
||||
},
|
||||
{
|
||||
column: "production_order_id",
|
||||
mode: "=",
|
||||
value: this.dataId.toString()
|
||||
}
|
||||
],
|
||||
"order_bys": [
|
||||
]
|
||||
}
|
||||
}).then(a => {
|
||||
|
||||
this.deletedDetailsData2 = [];
|
||||
this.detailsData2 = a.data.ProductionOrderProcesses || [];
|
||||
|
||||
this.showProcesses = true;
|
||||
this.detailsDataInit2();
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
pageAdd(row) {
|
||||
const $table = this.$refs.xTable
|
||||
|
|
@ -732,7 +848,7 @@ export default {
|
|||
},
|
||||
beforeEditMethod({ column, row }) {
|
||||
|
||||
if(this.pageStatus == "approved"){
|
||||
if (this.pageStatus == "approved") {
|
||||
return false;
|
||||
}
|
||||
if (row.SourceTableID && column.field != "Quantity") {
|
||||
|
|
@ -751,7 +867,7 @@ export default {
|
|||
}
|
||||
},
|
||||
beforeEditEvent({ column, row }) {
|
||||
if(this.pageStatus == "approved"){
|
||||
if (this.pageStatus == "approved") {
|
||||
return false;
|
||||
}
|
||||
if (row.SourceTableID && column.field != "Quantity") {
|
||||
|
|
@ -794,8 +910,139 @@ export default {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
pageAdd2(row) {
|
||||
const $table = this.$refs.xTable2
|
||||
const record = {
|
||||
}
|
||||
if (row) {
|
||||
|
||||
this.detailsData2.splice($table.getRowSeq(row), 0, record);
|
||||
} else {
|
||||
this.detailsData2.push(record)
|
||||
}
|
||||
},
|
||||
|
||||
pageDelete2(row) {
|
||||
const $table = this.$refs.xTable2;
|
||||
if (row.id) {
|
||||
this.deletedDetailsData2.push(this.$mk.toBigInt(row.id))
|
||||
}
|
||||
this.detailsData2.splice($table.getRowSeq(row) - 1, 1);
|
||||
},
|
||||
beforeEditMethod2({ column, row }) {
|
||||
|
||||
if (this.pageStatus == "approved") {
|
||||
return false;
|
||||
}
|
||||
if (row.SourceTableID && column.field != "Quantity") {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
afterEditEvent2({ column, row }) {
|
||||
if (column.field == "Quantity" || column.field == "Price") {
|
||||
row.Amount = parseInt(row.Quantity || 0) * parseFloat(row.Price || 0);
|
||||
|
||||
}
|
||||
|
||||
if (column.field == "specification") {
|
||||
row.specification = this.specification;
|
||||
}
|
||||
},
|
||||
beforeEditEvent2({ column, row }) {
|
||||
if (this.pageStatus == "approved") {
|
||||
return false;
|
||||
}
|
||||
if (row.SourceTableID && column.field != "Quantity") {
|
||||
return false;
|
||||
}
|
||||
if (column.field == "specification") {
|
||||
this.specification = row.specification;
|
||||
}
|
||||
},
|
||||
|
||||
onPulldownSelected2({ row, name, params }) {
|
||||
if (name == 'ag_inventory') {
|
||||
this.updateToGrid(row, this.detailsData[params.$rowIndex]);
|
||||
|
||||
setTimeout(() => {
|
||||
this.$refs.xTable.clearEdit();
|
||||
}, 50);
|
||||
}
|
||||
|
||||
},
|
||||
onPopupSelected2({ rows, name, params }) {
|
||||
console.log(rows, name, params);
|
||||
if (name == 'ag_inventory') {
|
||||
|
||||
for (let i = params.$rowIndex, ri = 0; i < params.$rowIndex + rows.length; i++, ri++) {
|
||||
if (i == this.detailsData.length) {
|
||||
let newrow = {
|
||||
};
|
||||
this.detailsData.push(newrow);
|
||||
}
|
||||
let inv = rows[ri];
|
||||
|
||||
this.updateToGrid(inv, this.detailsData[i]);
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
this.$refs.xTable.clearEdit();
|
||||
}, 50);
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
confirmProcesses(){
|
||||
let ds = this.detailsData2.filter(a=>a.step_id);
|
||||
|
||||
var postdata = {
|
||||
insertList: [],
|
||||
updateList: [],
|
||||
deleteList: this.deletedDetailsData
|
||||
};
|
||||
|
||||
ds.forEach(item => {
|
||||
delete item._X_ROW_KEY;
|
||||
|
||||
item.production_order_id = this.getDataId_BigInt();
|
||||
item.materials_id = this.$mk.toBigInt(this.currentRow.materials_id);
|
||||
|
||||
if (item.id) {
|
||||
item.id = this.$mk.toBigInt(item.id);
|
||||
postdata.updateList.push(item);
|
||||
} else {
|
||||
postdata.insertList.push(item);
|
||||
}
|
||||
})
|
||||
this.$mk.post({
|
||||
url: `${BASE_URL.BASE_URL}/MesProductionOrder/v1/production/order/processes/batchUpdate`,
|
||||
data: postdata,
|
||||
useBigInt: true
|
||||
}).then(a => {
|
||||
if (a.code == "200") {
|
||||
|
||||
this.$mk.success("保存成功");
|
||||
|
||||
|
||||
} else {
|
||||
this.$mk.error(a.message);
|
||||
}
|
||||
|
||||
|
||||
}).catch((a) => {
|
||||
this.$mk.error(a.data.msg);
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
// 监听属性
|
||||
watch: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue