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 });
|
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]) {
|
else if (this.value && this.value[1]) {
|
||||||
this.textboxValue = this.value[1];
|
this.textboxValue = this.value[1];
|
||||||
} else {
|
} else {
|
||||||
this.textboxValue = "";
|
this.textboxValue = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let f = params.listdataFieldName || "Records";
|
let f = params.listdataFieldName || "Records";
|
||||||
this.getData().then(data => {
|
this.getData().then(data => {
|
||||||
if('Total' in data){
|
if('Total' in data){
|
||||||
|
|
@ -318,6 +324,12 @@ export default {
|
||||||
else if (params.dataType == "object") {
|
else if (params.dataType == "object") {
|
||||||
this.$emit('input', e.row);
|
this.$emit('input', e.row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (params.dataType == 'mapper') {
|
||||||
|
if(params.showField){
|
||||||
|
this.$emit('input', e.row[params.showField]);
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
this.$emit('input', [e.row.ID, e.row[textField]]);
|
this.$emit('input', [e.row.ID, e.row[textField]]);
|
||||||
}
|
}
|
||||||
|
|
@ -345,6 +357,11 @@ export default {
|
||||||
else if (params.dataType == "object") {
|
else if (params.dataType == "object") {
|
||||||
this.$emit('input', selectedRow);
|
this.$emit('input', selectedRow);
|
||||||
}
|
}
|
||||||
|
else if (params.dataType == 'mapper') {
|
||||||
|
if(params.showField){
|
||||||
|
this.$emit('input', selectedRow[params.showField]);
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
this.$emit('input', [selectedRow.ID, selectedRow[textField]]);
|
this.$emit('input', [selectedRow.ID, selectedRow[textField]]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,13 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</vxe-column>
|
</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="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_code" title="料品编码" width="160"></vxe-column>
|
||||||
<vxe-column field="materials_name" title="料品名称" width="160" :params="editorMaterials"
|
<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-column field="remark" title="备注" width="160" :edit-render="{ name: '$input' }"></vxe-column>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</vxe-table>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -117,14 +161,23 @@ export default {
|
||||||
nextId: null,
|
nextId: null,
|
||||||
|
|
||||||
table1Height: 400,
|
table1Height: 400,
|
||||||
detailsSourceData: [
|
table2Height: 400,
|
||||||
],
|
|
||||||
detailsData: [
|
detailsData: [
|
||||||
],
|
],
|
||||||
deletedDetailsData: [
|
deletedDetailsData: [
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
currentRow :null,
|
||||||
|
showProcesses:false,
|
||||||
|
|
||||||
|
detailsData2: [
|
||||||
|
],
|
||||||
|
deletedDetailsData2: [
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
pageStatus: '',
|
pageStatus: '',
|
||||||
editorMaterials: {
|
editorMaterials: {
|
||||||
dataType: "mapper",
|
dataType: "mapper",
|
||||||
|
|
@ -143,6 +196,21 @@ export default {
|
||||||
page: () => import("../../MesMaterials/MesMaterials/List")
|
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: {
|
editor_process_route: {
|
||||||
dataType: "string",
|
dataType: "string",
|
||||||
valueField: "name",
|
valueField: "name",
|
||||||
|
|
@ -367,6 +435,11 @@ export default {
|
||||||
this.detailsData.push({});
|
this.detailsData.push({});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
detailsDataInit2() {
|
||||||
|
for (let i = this.detailsData2.length; i < 50; i++) {
|
||||||
|
this.detailsData2.push({});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// 获取路由的id参数
|
// 获取路由的id参数
|
||||||
getDataId() {
|
getDataId() {
|
||||||
|
|
@ -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) {
|
pageAdd(row) {
|
||||||
const $table = this.$refs.xTable
|
const $table = this.$refs.xTable
|
||||||
|
|
@ -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: {
|
watch: {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue