布产单

This commit is contained in:
xielue 2023-06-13 22:42:22 +08:00
parent e8077ff3da
commit a3956e6f97
9 changed files with 917 additions and 73 deletions

View File

@ -466,6 +466,7 @@ export default {
let delParms = {};
let url = this.options.actions.delete;
if (url.indexOf('batchDelete') != -1) {
delParms = {
@ -506,7 +507,12 @@ export default {
gridReload(){
this.$refs.xGrid.commitProxy('query')
}
},
getConfirmData() {
let rows = this.$refs.xGrid.getCheckboxRecords();
return rows;
},
},
//
watch: {

View File

@ -52,7 +52,7 @@ export default {
},
modalVisible: false,
listdataFieldName: 'list',
keyFieldName :"id",
keyFieldName: "id",
lastKey: '',
modelName: '',
orderBy: '',
@ -66,7 +66,7 @@ export default {
popupPage: null,
popupPageOptions: {},
popupPageMode: '',
actionParams: null,
tableColumn: [
{ field: 'name', title: '名称' },
{ field: 'code', title: '编码' }
@ -123,13 +123,27 @@ export default {
if (column.params.listdataFieldName) {
this.listdataFieldName = column.params.listdataFieldName;
}
if (column.params.actionParams) {
this.actionParams = column.params.actionParams;
}
}
if(column && column.params && column.params.dataType == "object"){
if(this.row[column.field]){
if (column && column.params && column.params.dataType == "object") {
if (this.row[column.field]) {
this.textboxValue = this.row[column.field][column.params.textField];
}
}
else if (column && column.params && column.params.dataType == "string") {
if (this.row[column.field]) {
this.textboxValue = this.row[column.field];
}
}
else if (column.params && column.params.dataType == 'mapper') {
this.textboxValue = this.row[column.params.showField || column.field];
}
else if (this.row[column.field] && this.row[column.field][1]) {
this.textboxValue = this.row[column.field][1];
@ -137,7 +151,7 @@ export default {
}
this.getData().then(data => {
this.tablePage.total = data.total;
this.tableData = data[this.listdataFieldName];
});
@ -148,12 +162,12 @@ export default {
this.lastKey = key;
var params = {}; //
var params = Object.assign({}, this.actionParams || {}) //
params.page = this.tablePage.currentPage; //
params.limit = this.tablePage.pageSize; //
params.order_bys = []; //
params.search_rules = []; //
if(key){
if (key) {
key = this.$mk.trim(key);
}
if (key) {
@ -210,7 +224,7 @@ export default {
const cellValue = this.textboxValue;
this.loading = true
if(!cellValue){
if (!cellValue) {
row[column.field] = null;
}
@ -219,7 +233,7 @@ export default {
this.loading = false
this.tablePage.total = data.total;
this.tableData = data[this.listdataFieldName] || [];
}).catch(()=>{
}).catch(() => {
this.loading = false;
});
},
@ -236,48 +250,79 @@ export default {
this.loading = false
this.tablePage.total = data.total;
this.tableData = data[this.listdataFieldName];
}).catch(()=>{
}).catch(() => {
this.loading = false;
});
},
getIdValue({row}){
getIdValue({ row }) {
let id = row[this.keyFieldName];
if(!id) id = '';
if(id.toString) id = id.toString();
if (!id) id = '';
if (id.toString) id = id.toString();
return id;
},
selectEvent(params) {
const { row, column } = this
let id = this.getIdValue({row:params.row});
let id = this.getIdValue({ row: params.row });
let textField = column.params.textField;
let textField = column.params.textField;
this.textboxValue = params.row[textField];
if(column.params && column.params.dataType == 'object'){
row[column.field] = Object.assign({},params.row)
}else{
if (column.params && column.params.dataType == 'object') {
row[column.field] = Object.assign({}, params.row)
}
else if (column.params && column.params.dataType == 'string') {
row[column.field] = params.row[textField]
}
else if (column.params && column.params.dataType == 'mapper') {
console.log(params.row)
}
else {
row[column.field] = [id, params.row[textField]];
}
this.params.$table.$emit("pulldownSelected", { row,selectedData : params.row, column, name: column.params.name, params: this.params });
if (column.params.mapper) {
column.params.mapper.forEach(item => {
row[item.field] = params.row[item.fromField];
})
}
this.params.$table.$emit("pulldownSelected", { row, selectedData: params.row, column, name: column.params.name, params: this.params });
this.$refs.xDown.hidePanel()
},
dblClickEvent(params) {
dblClickEvent(params) {
const { row, column } = this
let id = this.getIdValue({row:params.row});
let id = this.getIdValue({ row: params.row });
let textField = column.params.textField;
this.textboxValue = params.row[textField];
if(column.params && column.params.dataType == 'object'){
row[column.field] = Object.assign({},params.row)
}else{
if (column.params && column.params.dataType == 'object') {
row[column.field] = Object.assign({}, params.row)
}
else if (column.params && column.params.dataType == 'string') {
row[column.field] = params.row[textField]
}
else if (column.params && column.params.dataType == 'mapper') {
console.log(column);
}
else {
row[column.field] = [id, params.row[textField]];
}
if (column.params.mapper) {
column.params.mapper.forEach(item => {
row[item.field] = params.row[item.fromField];
})
}
console.log(id)
this.modalVisible = false;
@ -290,23 +335,37 @@ export default {
confirmEvent() {
const { row, column } = this
let selectedRow = this.$refs.popup.getSelectdRow();
let id = this.getIdValue({row:selectedRow});
let id = this.getIdValue({ row: selectedRow });
let textField = column.params.textField;
this.textboxValue = selectedRow[textField];
if(column.params && column.params.dataType == 'object'){
row[column.field] = Object.assign({},selectedRow)
}else{
if (column.params && column.params.dataType == 'object') {
row[column.field] = Object.assign({}, selectedRow)
}
else if (column.params && column.params.dataType == 'string') {
row[column.field] = selectedRow[textField]
}
else if (column.params && column.params.dataType == 'mapper') {
console.log(column)
}
else {
row[column.field] = [id, selectedRow[textField]];
}
if (column.params.mapper) {
column.params.mapper.forEach(item => {
row[item.field] = selectedRow[item.fromField];
})
}
this.modalVisible = false;
let rows = this.$refs.popup.getConfirmData();
this.params.$table.$emit("popupSelected", { rows, column:column, name: column.params.name, params: this.params });
this.params.$table.$emit("popupSelected", { rows, column: column, name: column.params.name, params: this.params });
}
}
}

View File

@ -33,6 +33,7 @@ export default {
if (loading) { // 如果需要加载
modal.hideLoading(); // 隐藏加载
}
/*
if (result.code != 200) { // 如果返回的状态码不是200
if (reject) { // 如果有错误回调
reject(response); // 返回错误
@ -41,6 +42,7 @@ export default {
}
return; // 返回
}
*/
resolve(result); // 返回成功
}).catch((error) => { // 如果出错
if (loading) { // 如果需要加载

View File

@ -123,4 +123,36 @@ height: 17px;
.treepanel-header .anticon {
margin-left: 8px;
cursor: pointer;
}
.voucher-toolbar{
display: flex;
}
.voucher-toolbar-left .ant-btn {
margin-right: 8px;
margin-bottom: 12px;
}
.voucher-toolbar-left{
flex:1;
}
.voucher-toolbar-right{
flex:1;
text-align: right;
}
.approvedbg {
width: 44px;
height: 22px;
background: url(../../../assets/img/approved.png) 0 0 no-repeat;
background-size: cover;
position: absolute;
left: 10px;
top: 50px;
z-index: 999;
}

BIN
src/assets/img/approved.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -1,5 +1,5 @@
<template>
<basic-page-list :desc="desc" :options="pageOptions"></basic-page-list>
<basic-page-list ref="pageList" :desc="desc" :options="pageOptions"></basic-page-list>
</template>
<script>
@ -31,7 +31,12 @@ export default {
},
//
methods: {
getConfirmData() {
return this.$refs.pageList.getConfirmData();
},
getSelectdRow() {
return this.$refs.pageList.getSelectdRow();
},
optionsInit() {
//
var pageData = { //

View File

@ -1,5 +1,5 @@
<template>
<basic-page-list :desc="desc" :options="pageOptions"></basic-page-list>
<basic-page-list ref="pageList" :desc="desc" :options="pageOptions"></basic-page-list>
</template>
<script>
@ -32,31 +32,26 @@ export default {
//
methods: {
getConfirmData() {
return this.$refs.pageList.getConfirmData();
},
getSelectdRow() {
return this.$refs.pageList.getSelectdRow();
},
optionsInit() {
//
var pageData = { //
keyName: 'id', //
listFieldName: 'MesUnit',
addPageUrl: "/MesUnit/MesUnitAdd",
editPageUrl: "/MesUnit/MesUnitUpdate/",
listFieldName: 'MesProductionOrder',
//
actions: { // Api
// =============================== Start ===============================
MesUnitList: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/list`, //
MesUnitDetail: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/detail`, //
MesUnitCreate: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/create`, //
MesUnitUpdate: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/update`, //
MesUnitDelete: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/detele`, //
MesUnitBatchDelete: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/batchDelete`, //
MesUnitBatchUpdate: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/batchUpdate`, //
MesUnitBatchCreate: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/batchCreate`, //
MesUnitExportExcel: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/export/excel`, // EXCEL
MesUnitImportExcel: `${BASE_URL.BASE_URL}/MesUnit/v1/mes/unit/import/excel`, // EXCEL
actions: { // Api
getList: `${BASE_URL.BASE_URL}/MesProductionOrder/v1/mes/production/order/list`,
// =============================== End ===============================
delete: `${BASE_URL.BASE_URL}/MesProductionOrder/v1/mes/production/order/detele`,
},
start_time: 0, //
@ -65,13 +60,10 @@ export default {
//
searchFormData: {
title: '',
desc: '',
code: ''
},
//
searchRules: [
{ key: "title", mode: "like" },
{ key: "desc", mode: "like" }
],
//
searchFormItems: [ //
@ -97,9 +89,8 @@ export default {
{ type: 'checkbox', width: 50 }, //
{ title: '操作', slots: { default: 'op' }, width: 120 },
{ field: 'code', sortable: true, title: '编码', width: 250 }, //
{ field: 'title', sortable: true, title: '单位名称', width: 250 }, //
{ field: 'name', sortable: true, title: '单位英文名称', width: 250 }, //
{ field: 'production_number', sortable: true, title: '单据编码', width: 250 }, //
{ field: 'create_time', formatter: 'formatDate', width: 160, sortable: true, title: '单据日期', showHeaderOverflow: true }, //
{ field: 'create_time', formatter: 'formatDate', width: 160, sortable: true, title: '创建时间', showHeaderOverflow: true }, //
{ field: 'update_time', formatter: 'formatDate', width: 160, sortable: true, title: '更新时间', showHeaderOverflow: true }, //
@ -107,9 +98,7 @@ export default {
}
};
pageData.actions.getList = pageData.actions.MesUnitList;
pageData.actions.delete = pageData.actions.MesUnitBatchDelete;
pageData.gridOptions = Object.assign({}, this.$mk.config.defaults.gridOptions, pageData.gridOptions); //

View File

@ -0,0 +1,751 @@
<template>
<div class="page-body">
<div class="approvedbg" v-if="pageStatus == 'approved'"></div>
<div class="voucher-toolbar">
<div class="voucher-toolbar-left">
<a-button @click="pageVoucherAdd">新增</a-button>
<a-dropdown :disabled="pageStatus == 'approved'">
<a-menu slot="overlay" @click="handleMenuClick">
<a-menu-item key="TP_outSourceOrder">
订单
</a-menu-item>
</a-menu>
<a-button> 选单
<a-icon type="down" />
</a-button>
</a-dropdown>
<a-button type="primary" @click="ok" :disabled="pageStatus == 'approved'">保存</a-button>
<a-button @click="pageApproved" type="primary" :disabled="!this.getDataId() || pageStatus == 'approved'">审批
</a-button>
<a-button @click="pageUnapproved" :disabled="!this.getDataId() || pageStatus != 'approved'">弃审</a-button>
<a-button @click="pageVoucherDelete" :disabled="!this.getDataId() || pageStatus == 'approved'">删除</a-button>
<a-button :disabled="!this.getDataId()" @click="pageExport">导出</a-button>
<a-button :disabled="!this.getDataId()" @click="pagePrint">打印</a-button>
</div>
<div class="voucher-toolbar-right">
<a-button-group>
<a-button @click="pageSearch">
<a-icon type="search" />
</a-button>
<a-button :disabled="!nextId" @click="pageNext">
<a-icon type="left" />
</a-button>
<a-button :disabled="!prevId" @click="pagePrev">
<a-icon type="right" />
</a-button>
</a-button-group>
</div>
</div>
<vxe-form :data="options.formOptions.data" ref="xForm" :title-width="options.formOptions.titleWidth"
:title-align="options.formOptions.titleAlign" :rules="options.formOptions.rules" :items="options.formOptions.items"
titleColon>
</vxe-form>
<vxe-table border show-overflow keep-source ref="xTable" :height="table1Height" :data="detailsData"
@pulldownSelected="onPulldownSelected" @popupSelected="onPopupSelected" :export-config="{}"
@edit-closed="afterEditEvent" @edit-actived="beforeEditEvent"
:edit-config="{ trigger: 'click', mode: 'cell', icon: 'vxe-icon-edit', showStatus: false, beforeEditMethod: beforeEditMethod }">
<vxe-column width="70">
<template #default="{ row }">
<div class="oplinks2">
<a @click.stop="pageAdd(row)" title="新增">
<a-icon class="icon" type="plus-circle" />
</a>
<a @click.stop="pageDelete(row)" title="删除">
<a-icon class="icon" type="delete" />
</a>
</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"
:edit-render="{ name: 'MkGridDataSelector' }"></vxe-column>
<vxe-column field="unit_name" title="单位名" width="160"></vxe-column>
<vxe-column field="process_route" title="工艺路线" width="160" :params="editor_process_route"
:edit-render="{ name: 'MkGridDataSelector' }"></vxe-column>
<vxe-column field="molding_type" title="成型方式" width="160" :params="editor_molding_type"
:edit-render="{ name: 'MkGridDataSelector' }"></vxe-column>
<vxe-column field="production_num" title="布产数量" width="160"
:edit-render="{ name: '$input', props: { type: 'integer' } }"></vxe-column>
<vxe-column field="batch_num" title="批次数量" width="160"
:edit-render="{ name: '$input', props: { type: 'integer' } }"></vxe-column>
<vxe-column field="remark" title="备注" width="160" :edit-render="{ name: '$input' }"></vxe-column>
</vxe-table>
</div>
</template>
<script>
import BASE_URL from '@/services/mes/api.js';
export default {
i18n: require('./i18n'),
components: {},
props: {
pageMode: {
type: String,
default: "edit"
}
},
data() {
let pageData = {
dataId: null,
actions: {
},
prevId: null,
nextId: null,
table1Height: 400,
detailsSourceData: [
],
detailsData: [
],
deletedDetailsData: [
],
pageStatus: '',
editorMaterials: {
dataType: "mapper",
mapper: [
{ field: "materials_id", fromField: "id" },
{ field: "materials_code", fromField: "code" },
{ field: "materials_name", fromField: "name" },
{ field: "unit_name", fromField: "unit" },
],
showField: "materials_name",
valueField: "id",
textField: "name",
listdataFieldName: 'MesMaterials',
dataUrl: `${BASE_URL.BASE_URL}/MesMaterials/v1/mes/materials/list`,
popup: {
page: () => import("../../MesMaterials/MesMaterials/List")
}
},
editor_process_route: {
dataType: "string",
valueField: "name",
textField: "name",
listdataFieldName: 'MesEnumValue',
actionParams: {
search_rules_enum: [
{
column: "code",
mode: "=",
value: "10"
}
]
},
dataUrl: `${BASE_URL.BASE_URL}/MesEnum/v1/mes/enum/value/list`
},
editor_molding_type: {
dataType: "string",
valueField: "name",
textField: "name",
listdataFieldName: 'MesEnumValue',
actionParams: {
search_rules_enum: [
{
column: "code",
mode: "=",
value: "1"
}
]
},
dataUrl: `${BASE_URL.BASE_URL}/MesEnum/v1/mes/enum/value/list`
},
options: {}
};
return pageData;
},
computed: {
desc() {
return this.$t('editPageDesc')
}
},
created() {
this.optionsInit();
this.pageInit();
this.heightInit();
},
onload() {
if (this.$route.params.id) {
this.dataId = this.$route.params.id;
}
},
//
methods: {
optionsInit() {
//
var pageData = {
//
currentConfigName: "",
// ID
currentBeid: 0,
detailDataFieldName: "mes_production_order",
actions: {
get: `${BASE_URL.BASE_URL}/MesProductionOrder/v1/mes/production/order/detail`,
create: `${BASE_URL.BASE_URL}/MesProductionOrder/v1/mes/production/order/create`,
update: `${BASE_URL.BASE_URL}/MesProductionOrder/v1/mes/production/order/update`,
},
keyName: 'id',
//
isEdit: false,
//
formOptions: {
data: {
},
//
titleWidth: 150,
//
titleAlign: 'right',
//
rules: {
start_time: [
{ required: true, message: '请输入预计开始日期' }
]
},
//
items: [
{
field: 'production_number', title: '单据编号', span: 6, itemRender: {
name: '$input',
props: { radonly: true, disabled: true, placeholder: '自动编号' }
}
},
{ field: 'start_time', dataRule: { type: "timestamp" }, title: '预计开始日期', span: 6, itemRender: { name: '$input', props: { type: 'date' } } },
]
},
//
addModeItems: [
],
};
pageData.formOptions.items.forEach(item => {
pageData.formOptions.data[item.field] = '';
})
//
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
this.options = pageData;
},
heightInit() {
this.$nextTick(() => {
let h = this.$mk.getWindowSize().height - this.$mk.getOffsetTop(this.$refs.xTable.$el) - 180;
this.table1Height = h;
});
},
getDefaultData() {
let data = {};
this.options.formOptions.items.forEach(item => {
data[item.field] = item.defaultValue || "";
});
return data;
},
setPageReadonly(readonly) {
this.options.formOptions.items.forEach(item => {
if (item.itemRender && item.itemRender.name == "$select") {
item.itemRender.props.disabled = readonly;
}
if (item.itemRender && item.itemRender.props) {
item.itemRender.props.readonly = readonly;
}
});
},
pageInit() {
this.pageStatus = '';
// id
let dataId = this.getDataId();
// id
if (dataId) {
this.$mk.post({
url: this.options.actions.get,
loading: "加载中...",
data: {
id: this.getDataId_BigInt()
},
useBigInt: true
}).then(a => {
let detailDataFieldName = this.options.detailDataFieldName;
if (a.data[detailDataFieldName].create_time) {
a.data[detailDataFieldName].create_time = new Date(a.data[detailDataFieldName].create_time * 1000);
}
if (a.data[detailDataFieldName].update_time) {
a.data[detailDataFieldName].update_time = new Date(a.data[detailDataFieldName].update_time * 1000);
}
if (a.data[detailDataFieldName].start_time) {
a.data[detailDataFieldName].start_time = new Date(a.data[detailDataFieldName].start_time * 1000);
}
this.options.formOptions.data = a.data[detailDataFieldName];
if (a.data[detailDataFieldName].audit_status == 1) {
this.pageStatus = 'approved';
}
this.detailsData = a.dta[detailDataFieldName].production_order_materials || [];
this.detailsDataInit();
this.$forceUpdate()
}).catch((a) => {
this.detailsDataInit();
this.$mk.error(a.data.msg);
});
this.options.isEdit = true;
this.$forceUpdate()
} else {
this.options.formOptions.data = this.getDefaultData();
this.detailsData = [];
this.pageStatus = '';
this.setPageReadonly(this.pageStatus == 'approved');
this.detailsDataInit();
}
},
detailsDataInit() {
for (let i = this.detailsData.length; i < 100; i++) {
this.detailsData.push({});
}
},
// id
getDataId() {
return this.dataId;
},
getDataId_BigInt() {
let dataId = this.getDataId();
return this.$mk.toBigInt(dataId);
},
//
back() {
this.isEdit = this.options.isEdit;
//
if (!this.isEdit) {
this.$closePage({
closeRoute: this.options.addPageUrl
});
} else {
this.$closePage({
closeRoute: this.options.editPageUrl
});
}
//
this.$openPage(this.options.listPageUrl)
},
//
ok() {
let save = () => {
//
let action = !this.dataId ? this.options.actions.create : this.options.actions.update;
// id id
let postdata = Object.assign({}, this.options.formOptions.data);
//
if (this.isEdit) {
// postdata = { MesUnit: postdata }
}
if (this.dataId) {
postdata.id = this.getDataId_BigInt();
}
postdata.production_order_materials = JSON.parse(JSON.stringify(this.detailsData));
postdata.production_order_materials = postdata.production_order_materials.filter(item => item.materials_id);
postdata.production_order_materials.forEach(item => {
if (this.dataId) {
item.production_order_id = this.getDataId_BigInt();
}
delete item._X_ROW_KEY;
item.materials_id = this.$mk.toBigInt(item.materials_id);
item.production_num = parseInt(item.production_num);
item.batch_num = parseInt(item.batch_num);
})
if (!postdata.production_order_materials || !postdata.production_order_materials.length) {
this.$mk.error(`数据行为空`);
return;
}
//
this.$mk.formatFormData({ data: postdata, rules: this.options.formOptions.items });
console.log(postdata)
//
this.$mk.post({
url: action,
loading: "保存中...",
data: postdata,
useBigInt: true,
}).then((a) => { //
console.log(a)
if (a.code == 200) {
this.$mk.success(a.msg || "保存成功");
if (!this.dataId) {
this.dataId = a.data.id;
this.pageInit();
}
} else {
this.$mk.error(a.msg || "保存失败"); //
}
}).catch((a) => { //
console.log(a)
this.$mk.error(a.msg); //
});
};
//
this.$mk.validateForm({ form: this.$refs.xForm }).then(() => { //
save(); //
}).catch(count => { //
this.$mk.error(`存在${count}项错误,请检查`);
});
},
//
cancel() {
this.back();
},
pageExport() {
},
pagePrint() {
},
pageSearch() {
let { width, height } = this.$mk.getWindowSize();
this.$mk.dialog.open({
page: () => import("./List"),
title: "选择单据",
showFooter: true,
width: width * 0.9,
height: height * 0.9,
callback: ({ data }) => {
if (data && data[0]) {
this.dataId = data[0].id;
this.pageInit();
}
}
})
},
pageNext() {
this.dataId = this.nextId;
this.pageInit();
},
pagePrev() {
this.dataId = this.prevId;
this.pageInit();
},
pageApproved() {
let dataId = this.getDataId();
if (!dataId) {
return;
}
let sendApproved = () => {
this.$mk.post({
url: `${BASE_URL.BASE_URL}/MesProductionOrder/v1/mes/production/order/approve`,
loading: '审批中...',
data: {
id: this.getDataId_BigInt(),
audit_remark: ''
},
useBigInt: true
}).then(a => {
if (a.code == "200") {
this.$mk.success("审批成功");
this.pageInit();
}
else {
this.$mk.error(a.msg);
}
});
}
sendApproved("");
},
pageUnapproved() {
let dataId = this.getDataId();
if (!dataId) {
return;
}
this.$mk.post({
url: `${BASE_URL.BASE_URL}//MesProductionOrder/v1/mes/production/order/cancelApprove`,
loading: '弃审中...',
data: {
id: this.getDataId_BigInt(),
audit_remark: ''
},
useBigInt: true
}).then(a => {
if (a.code == "200") {
this.$mk.success("弃审成功");
this.pageInit();
} else {
this.$mk.error(a.msg);
}
});
},
pageVoucherAdd() {
this.dataId = null;
this.pageInit();
},
handleMenuClick(e) {
let { width, height } = this.$mk.getWindowSize();
if (e.key == 'TP_outSourceOrder') {
this.$mk.dialog.open({
page: () => import("./List"),
title: "选择订单",
showFooter: true,
width: width * 0.9,
height: height * 0.9,
callback: ({ data }) => {
if (data.list && data.details && data.details.length) {
this.formOptions.data = this.getDefaultData();
this.formOptions.data.AAPartner = data.list[0].AAPartner;
this.formOptions.data.WorkingProcedure = data.list[0].WorkingProcedure;
var rows = [];
data.details.forEach(item => {
var row = {
AAProduct: item.AAInventory,
AAProductID: item.AAInventoryID
};
row.ProductCode = item.AAInventoryCode;
row.specification = item.specification;
row.UnitName = item.ProductionUnitTitle;
if (this.firstQuantityFieldName) {
row[this.firstQuantityFieldName] = (item.Quantity || 0) - (item.QuantityReceived || 0);
}
row.SourceTableName = "TP_outSourceOrder";
row.SourceTableID = item.OutSourceOrderID;
rows.push(row);
});
for (let i = rows.length; i < 10; i++) {
rows.push({});
}
console.log(rows)
this.detailsData = rows;
this.updateCurrentQuantity();
} else {
this.$mk.error("未选择任何数据");
}
}
})
}
},
pageVoucherDelete() {
let dataId = this.getDataId();
if (!dataId) {
return;
}
this.$mk.confirm('您确定要删除吗?').then(type => {
if (type == 'confirm') {
this.$mk.post({
url: `${BASE_URL.BASE_URL}/MesProductionOrder/v1/mes/production/order/detele`,
loading: "删除中...",
data: {
id: this.getDataId_BigInt()
},
useBigInt: true
}).then(a => {
if (a.code == "200") {
this.$mk.success("删除成功");
this.dataId = null;
this.pageInit();
} else {
this.$mk.error(a.message);
}
});
}
});
},
pageAdd(row) {
const $table = this.$refs.xTable
const record = {
}
if (row) {
this.detailsData.splice($table.getRowSeq(row), 0, record);
} else {
this.detailsData.push(record)
}
},
pageDelete(row) {
const $table = this.$refs.xTable;
if (row.id) {
this.deletedDetailsData.push(this.$mk.toBigInt(row.id))
}
this.detailsData.splice($table.getRowSeq(row) - 1, 1);
},
beforeEditMethod({ column, row }) {
if (row.SourceTableID && column.field != "Quantity") {
return false;
}
return true;
},
afterEditEvent({ 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;
}
},
beforeEditEvent({ column, row }) {
if (row.SourceTableID && column.field != "Quantity") {
return false;
}
if (column.field == "specification") {
this.specification = row.specification;
}
},
onPulldownSelected({ row, name, params }) {
if (name == 'ag_inventory') {
this.updateToGrid(row, this.detailsData[params.$rowIndex]);
setTimeout(() => {
this.$refs.xTable.clearEdit();
}, 50);
}
},
onPopupSelected({ 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);
}
},
},
//
watch: {
}
};
</script>
<style>
.page-body {
background: white;
padding: 8px;
}
.oplinks2 svg {
width: 18px;
height: 18px;
}
.oplinks2 i {
margin-left: 5px;
}
</style>

View File

@ -31,21 +31,21 @@ routerMap[FunName + 'List']= {
icon: 'idcard',
path: `/${FunName}/${FunName}List`,
meta:{
invisible: true,
page:{ cacheAble:false}
},
component: () => import(`@/pages/Middle/Mes/MesProductionOrder/MesProductionOrder/List`),
authority: {
permission: [],
permission: [],
}
};
routerMap[FunName + 'Create']= {
name: FunTitle,
name: '布产单',
icon: 'idcard',
path: `/${FunName}/${FunName}Add`,
component: () => import(`@/pages/Middle/Mes/MesProductionOrder/MesProductionOrder/Edit`),
path: `/${FunName}/${FunName}Voucher`,
component: () => import(`@/pages/Middle/Mes/MesProductionOrder/MesProductionOrder/voucher`),
meta: {
invisible: true,
},
authority: {
permission: [],