This commit is contained in:
zxx 2023-12-12 11:29:49 +08:00
parent e3b4329138
commit 47837e9615
7 changed files with 693 additions and 410 deletions

View File

@ -1,4 +1,3 @@
import XEUtils from 'xe-utils' // 加载xe-utils
import JSONbig from 'json-bigint'
import guid from './guid' // 加载modal
@ -13,7 +12,7 @@ export default {
},
getGuid(){
getGuid() {
return new guid().newGUID();
},
@ -27,6 +26,19 @@ export default {
return XEUtils.toDateString(cellValue, 'yyyy-MM-dd HH:mm:ss')
},
getDateTime(cellValue) {
this.getDateString(cellValue);
},
getDate(cellValue) {
if (!cellValue) {
return '';
}
if (typeof (cellValue) == "number") {
cellValue = new Date(cellValue * 1000);
}
return XEUtils.toDateString(cellValue, 'yyyy-MM-dd')
},
formatEnum(cellValue, options) { // 格式化状态
if (cellValue == null) return '';
@ -39,7 +51,7 @@ export default {
},
formatDetailData({ data, rules }) {
formatDetailData({data, rules}) {
if (data.create_time) {
data.create_time = new Date(data.create_time * 1000);
@ -49,7 +61,6 @@ export default {
}
let feachRules = (rules) => {
rules.forEach(rule => { // 循环规则
@ -62,7 +73,7 @@ export default {
if (rule.dataRule.initType == "object" && data[rule.dataRule.idField]) {
data[rule.field] = {id:data[rule.dataRule.idField],name:data[rule.dataRule.textField]};
data[rule.field] = {id: data[rule.dataRule.idField], name: data[rule.dataRule.textField]};
}
@ -86,16 +97,13 @@ export default {
}
return data;
},
//格式化提交的明细类型 字段
//如果要提交的数据(value) 已经不存在 原有数据 (oldlistdata) 那么需要把id放到 value.deleteList
formatPostFieldValue({ dataId, oldlistdata, value }) {
formatPostFieldValue({dataId, oldlistdata, value}) {
if (!dataId) {
return;
}
@ -124,7 +132,7 @@ export default {
},
getPostFieldValue({ dataId, list, type, deletedList, fieldName, rowFilter, dataRule }) {
getPostFieldValue({dataId, list, type, deletedList, fieldName, rowFilter, dataRule}) {
let d = {};
console.log(list)
@ -144,16 +152,14 @@ export default {
if (value == null) {
item[rule.field] = null;
}
else {
} else {
if (!value) {
value = 0;
}
item[rule.field] = parseInt(value);
}
}
else if (rule.type == "number" || rule.type == "float") {
} else if (rule.type == "number" || rule.type == "float") {
if (value == null) {
item[rule.field] = null;
@ -163,8 +169,7 @@ export default {
}
item[rule.field] = parseFloat(value);
}
}
else if (rule.type == "timestamp") {
} else if (rule.type == "timestamp") {
if (value) {
if (typeof (value) == 'string') {
item[rule.field] = parseInt(new Date(value).getTime() / 1000);
@ -172,8 +177,7 @@ export default {
} else {
item[rule.field] = null;
}
}
else if (rule.type == "bigint") {
} else if (rule.type == "bigint") {
if (!item[rule.field]) {
item[rule.field] = null;
} else {
@ -199,7 +203,6 @@ export default {
if (dataId && type !== 'array') {
d = {
insertList: [],
updateList: [],
@ -209,8 +212,7 @@ export default {
list.forEach(item => {
if (item.id) {
d.updateList.push(item);
}
else {
} else {
d.insertList.push(item);
}
});

View File

@ -10,7 +10,8 @@
<template #sort_id="{ }">
<vxe-pulldown style="width:100%" ref="pulldownParent" transfer>
<template #default>
<vxe-input v-model="sortName" suffix-icon="vxe-icon-search" placeholder="选择分类" @keyup="pulldownKeyupEvent"
<vxe-input v-model="sortName" suffix-icon="vxe-icon-search" placeholder="选择分类"
@keyup="pulldownKeyupEvent"
@focus="pulldownFocusEvent" @suffix-click="pulldownSuffixClick"></vxe-input>
</template>
<template #dropdown>
@ -88,7 +89,7 @@ export default {
ajax: {
// queryreload
query: (options) => { //
const { page, sorts } = options;
const {page, sorts} = options;
var params = {};
params.page = page.currentPage;
params.limit = page.pageSize;
@ -102,7 +103,7 @@ export default {
})
});
}
return this.loadParentGrid({ params }); //
return this.loadParentGrid({params}); //
}
}
},
@ -119,8 +120,8 @@ export default {
highlight: true //
},
columns: [
{ field: 'name', sortable: true, title: '分类名', showHeaderOverflow: true, treeNode: true }, //
{ field: 'code', sortable: true, title: '编号', showHeaderOverflow: true } //
{field: 'name', sortable: true, title: '分类名', showHeaderOverflow: true, treeNode: true}, //
{field: 'code', sortable: true, title: '编号', showHeaderOverflow: true} //
]
},
options: {}
@ -147,13 +148,13 @@ export default {
methods: {
//
loadParentGrid({ params }) {
loadParentGrid({params}) {
params.start_time = 0;
params.end_time = 0;
return this.$mk.getPagedData({ url: this.actions.list, data: params });
return this.$mk.getPagedData({url: this.actions.list, data: params});
},
//
@ -208,10 +209,10 @@ export default {
// =============================== Start ===============================
code: [
{ required: true, message: '请输入编号' }
{required: true, message: '请输入编号'}
],
name: [
{ required: true, message: '请输入名称' }
{required: true, message: '请输入名称'}
]
// =============================== End ===============================
@ -223,11 +224,31 @@ export default {
title: '左侧',
span: 20,
children: [
{ field: 'code', title: '编号', span: 12, itemRender: { name: '$input' } },
{ field: 'name', title: '名称', span: 12, itemRender: { name: '$input' } },
{ title: '分类', span: 12, slots: { default: 'sort_id' } },
{ field: 'price', title: '单价', dataRule: { type: 'number' }, span: 12, itemRender: { name: '$input', props: { type: "number" } } },
{ field: 'size', title: '尺寸', span: 12, itemRender: { name: '$input' } },
{field: 'code', title: '编号', span: 12, itemRender: {name: '$input'}},
{field: 'name', title: '名称', span: 12, itemRender: {name: '$input'}},
{title: '分类', span: 12, slots: {default: 'sort_id'}},
{
field: 'price',
title: '单价',
dataRule: {type: 'number'},
span: 12,
itemRender: {name: '$input', props: {type: "number"}}
},
{
field: 'purchase_cost',
title: '采购成本',
dataRule: {type: 'number'},
span: 12,
itemRender: {name: '$input', props: {type: "number"}}
},
{
field: 'processing_cost',
title: '加工成本',
dataRule: {type: 'number'},
span: 12,
itemRender: {name: '$input', props: {type: "number"}}
},
{field: 'size', title: '尺寸', span: 12, itemRender: {name: '$input'}},
{
title: '颜色', span: 12,
@ -260,14 +281,14 @@ export default {
},
{ field: 'spec', title: '规格型号', span: 12, itemRender: { name: '$input' } },
{field: 'spec', title: '规格型号', span: 12, itemRender: {name: '$input'}},
]
},
{
title: '右侧',
span: 4,
children: [
{ field: 'image', span: 12, itemRender: { name: 'MkFormUploader' } },
{field: 'image', span: 12, itemRender: {name: 'MkFormUploader'}},
]
},
@ -368,7 +389,7 @@ export default {
},
{ field: 'theoretical_load', title: '理论装车量', span: 8, itemRender: { name: '$input' } },
{field: 'theoretical_load', title: '理论装车量', span: 8, itemRender: {name: '$input'}},
{
title: '土质', span: 12,
@ -482,13 +503,13 @@ export default {
let groupNames = [];
a.data.attribute.forEach(item => {
let formItem = { field: '', title: '', span: 12, itemRender: {} };
let formItem = {field: '', title: '', span: 12, itemRender: {}};
let groupName = item.category.name;
if (groupName && !groupNames.filter(a => a == groupName).length) {
this.options.formOptions2.items.push({
span: 24,
itemRender: { name: "MkFormInputShow", props: { showType: "divider", header: groupName } },
itemRender: {name: "MkFormInputShow", props: {showType: "divider", header: groupName}},
showTitle: false
});
groupNames.push(groupName);
@ -498,7 +519,7 @@ export default {
formItem.title = item.name;
//:1.,2.,3.,4.,5.,6.,7.
if (item.typeName == "2") {
formItem.itemRender.props = { type: "nubmer" };
formItem.itemRender.props = {type: "nubmer"};
formItem.itemRender.name = "$input";
formData[formItem.field] = 0;
@ -507,7 +528,7 @@ export default {
item.typeName == "5") {
formItem.itemRender.name = "$input";
formItem.itemRender.props = { type: "date" };
formItem.itemRender.props = {type: "date"};
formData[formItem.field] = '';
} else if (item.typeName == "6") {
@ -519,7 +540,7 @@ export default {
formData[formItem.field] = formItem.itemRender.options[0].value;
} else if (item.typeName == "7") {
formItem.itemRender.name = "$switch";
formItem.itemRender.props = { openLabel: '是', openValue: "true", closeValue: "false", closeLabel: '否' };
formItem.itemRender.props = {openLabel: '是', openValue: "true", closeValue: "false", closeLabel: '否'};
formData[formItem.field] = '1';
} else {
@ -721,7 +742,7 @@ export default {
console.log(postdata)
//
this.$mk.formatFormData({ data: postdata, rules: this.options.formOptions.items });
this.$mk.formatFormData({data: postdata, rules: this.options.formOptions.items});
//
@ -745,7 +766,7 @@ export default {
//
this.$mk.validateForm({ form: this.$refs.xForm }).then(() => { //
this.$mk.validateForm({form: this.$refs.xForm}).then(() => { //
save(); //
}).catch(count => { //
this.$mk.error(`存在${count}项错误,请检查`);
@ -776,7 +797,7 @@ export default {
},
//
pulldownCellClickEvent({ row }) {
pulldownCellClickEvent({row}) {
if (row.children && row.children.length) {
return;

View File

@ -1,6 +1,53 @@
<template>
<div class="page-body">
<a-divider orientation="left">库位</a-divider>
<a-descriptions title="">
<a-descriptions-item label="库位名称">
{{ warehouse_pos_idetail.name }}
</a-descriptions-item>
<a-descriptions-item label="库位编号">
{{ warehouse_pos_idetail.code }}
</a-descriptions-item>
<a-descriptions-item label="仓库名称">
{{ warehouse_idetail.name }}
</a-descriptions-item>
<a-descriptions-item label="仓库编号">
{{ warehouse_idetail.code }}
</a-descriptions-item>
<a-descriptions-item label="库存数量">
<span style="color: maroon;font-weight: bold;">{{
current_mes_stock_position.stock
}}</span> {{ product_detail.unit }}
</a-descriptions-item>
</a-descriptions>
<a-divider orientation="left">料品信息</a-divider>
<a-descriptions title="">
<a-descriptions-item label="料品名称">
{{ product_detail.name }}
</a-descriptions-item>
<a-descriptions-item label="料品编号">
{{ product_detail.code }}
</a-descriptions-item>
<a-descriptions-item label="规格">
{{ product_detail.spec }}
</a-descriptions-item>
<a-descriptions-item label="尺寸">
{{ product_detail.size }}
</a-descriptions-item>
<a-descriptions-item label="颜色">
{{ product_detail.color }}
</a-descriptions-item>
<a-descriptions-item label="单价">
{{ product_detail.price }}
</a-descriptions-item>
<a-descriptions-item label="备注">
{{ product_detail.remark }}
</a-descriptions-item>
<a-descriptions-item label="总库存">
<span style="color: maroon;font-weight: bold;">{{ mes_stock.stock }}</span> {{ product_detail.unit }}
</a-descriptions-item>
</a-descriptions>
<a-divider orientation="left">新建入库信息</a-divider>
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
</vxe-form>
@ -24,9 +71,9 @@ export default {
type: String,
default: "edit"
},
dataId: {
}
dataId: {},
stockId: {},
pageOptions: {}
},
data() {
@ -56,7 +103,8 @@ export default {
material_id: 0,
warehouse_id: 0,
version: '',
is_default: 0
is_default: 0,
processing_cost: 11,
},
//
titleWidth: 100,
@ -67,7 +115,7 @@ export default {
rules: {
in_stock: [
{ required: true, message: '请输入入库数量' }
{required: true, message: '请输入入库数量'}
]
},
@ -75,10 +123,28 @@ export default {
items: [
{ field: 'stock', dataRule: { type: 'number' }, title: '入库数量', span: 12, itemRender: { name: '$input', props: { type: "number" } } },
{ field: 'in_type',title: '入库类型', span: 12, itemRender: { name: '$input' } },
{ field: 'in_time', dataRule: { type: 'timestamp' }, title: '入库时间', span: 12, itemRender: { name: '$input', props: { type: "date" } } },
{ field: 'bill_date', dataRule: { type: 'timestamp' }, title: '单据日期', span: 12, itemRender: { name: '$input', props: { type: "date" } } },
{
field: 'stock',
dataRule: {type: 'number'},
title: '入库数量',
span: 12,
itemRender: {name: '$input', props: {type: "number"}}
},
{field: 'in_type', title: '入库类型', span: 12, itemRender: {name: '$input'}},
{
field: 'in_time',
dataRule: {type: 'timestamp'},
title: '入库时间',
span: 12,
itemRender: {name: '$input', props: {type: "date"}}
},
{
field: 'bill_date',
dataRule: {type: 'timestamp'},
title: '单据日期',
span: 12,
itemRender: {name: '$input', props: {type: "date"}}
},
{
title: '入库人', span: 12,
@ -95,7 +161,7 @@ export default {
textField: "name",
listdataFieldName: 'MesStaff',
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`,
onDataChanged: ({ data }) => {
onDataChanged: ({data}) => {
console.log(data)
this.pageOptions.formOptions.data.warehouse_mobile = data.phone;
}
@ -118,7 +184,7 @@ export default {
textField: "name",
listdataFieldName: 'MesStaff',
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`,
onDataChanged: ({ data }) => {
onDataChanged: ({data}) => {
console.log(data)
this.pageOptions.formOptions.data.warehouse_mobile = data.phone;
}
@ -128,24 +194,47 @@ export default {
},
{
field: 'check_time',
dataRule: {type: 'timestamp'},
title: '验货时间',
span: 12,
itemRender: {name: '$input', props: {type: "date"}}
},
{ field: 'check_time', dataRule: { type: 'timestamp' }, title: '验货时间', span: 12, itemRender: { name: '$input', props: { type: "date" } } },
{field: 'delivery_no', title: '发货单号', span: 12, itemRender: {name: '$input'}},
{ field: 'delivery_no', title: '发货单号', span: 12, itemRender: { name: '$input' } },
{field: 'contact', title: '联系人', span: 12, itemRender: {name: '$input'}},
{
field: 'purchase_cost',
title: '采购成本',
span: 12,
{ field: 'contact', title: '联系人', span: 12, itemRender: { name: '$input' } },
{ field: 'phone', title: '联系电话', span: 12, itemRender: { name: '$input' } },
{ field: 'remark', title: '备注', span: 24, itemRender: { name: '$textarea' } },
itemRender: {name: '$input', props: {type: "number"}},
},
{
field: 'processing_cost',
title: '加工成本',
span: 12,
itemRender: {name: '$input', props: {type: "number"}},
},
{field: 'phone', title: '联系电话', span: 12, itemRender: {name: '$input'}},
{field: 'remark', title: '备注', span: 24, itemRender: {name: '$textarea'}},
]
},
//
addModeItems: [
],
addModeItems: [],
mes_stock: {}, //
mes_stock_position: {}, //
current_mes_stock_position: {}, //
stock_in: {}, //
stock_out: {}, //
product_detail: {}, //
warehouse_idetail: {}, //
warehouse_pos_idetail: {}, //
};
@ -166,20 +255,40 @@ export default {
// id
let dataId = this.getDataId();
let dataId = this.getStockId();
// id
if (dataId) {
this.$mk.post({
url: this.actions.get,
loading: "加载中...",
data: { id: this.$mk.toBigInt(dataId) },
data: {id: this.$mk.toBigInt(dataId)},
useBigInt: true
}).then(a => {
console.log(a) //
this.mes_stock = a.data.mes_stock;
console.log(" this.mes_stock:", this.mes_stock)
this.mes_stock_position = a.data.mes_stock_position;
console.log(" this.mes_stock_position:", this.mes_stock_position)
for (let i = 0; i < this.mes_stock_position.length; i++) {
// console.log("this.GetId_BigInt(this.mes_stock_position[i].id).c[1]:", this.GetId_BigInt(this.mes_stock_position[i].id).c[1])
// console.log("this.getDataId_BigInt().c[1]:", this.getDataId_BigInt().c[1])
if (this.GetId_BigInt(this.mes_stock_position[i].id).c[1] === this.getDataId_BigInt().c[1]) {
this.current_mes_stock_position = this.mes_stock_position[i];
}
}
console.log(" this.current_mes_stock_position:", this.current_mes_stock_position)
this.product_detail = a.data.mes_stock.product_detail;
this.warehouse_idetail = this.current_mes_stock_position.warehouse_idetail;
this.warehouse_pos_idetail = this.current_mes_stock_position.warehouse_pos_idetail;
this.stock_in = a.data.stock_in;
this.stock_out = a.data.stock_out;
console.log(" this.warehouse_idetail:", this.warehouse_idetail)
console.log(" this.warehouse_pos_idetail:", this.warehouse_pos_idetail)
}).catch((a) => {
this.$mk.error(a.data.msg);
});
@ -197,14 +306,11 @@ export default {
}
},
//
methods: {
// id
getDataId() {
let dataId = this.dataId;
@ -216,39 +322,60 @@ export default {
}
return dataId;
},
getStockId() {
let stockId = this.pageOptions.stockId;
if (this.$route && this.$route.params && this.$route.params.id) {
stockId = this.$route.params.id;
}
if (!stockId) {
stockId = 0;
}
return stockId;
},
getDataId_BigInt() {
let dataId = this.getDataId();
return this.$mk.toBigInt(dataId);
},
GetId_BigInt(id) {
let dataId = id
if (this.$route && this.$route.params && this.$route.params.id) {
dataId = this.$route.params.id;
}
if (!dataId) {
dataId = 0;
}
return this.$mk.toBigInt(dataId);
},
getStockId_BigInt() {
let stockId = this.getStockId();
return this.$mk.toBigInt(stockId);
},
// materials
//
back() {
this.$emit("callback", { success: true });
this.$emit("callback", {success: true});
},
//
ok() {
let save = () => {
let postdata = Object.assign({}, this.formOptions.data);
//
this.$mk.formatFormData({ data: postdata, rules: this.formOptions.items });
this.$mk.formatFormData({data: postdata, rules: this.formOptions.items});
postdata.stock_pos_id = this.getDataId_BigInt();
//
this.$mk.post({
url: this.actions.save,
@ -272,9 +399,8 @@ export default {
};
//
this.$mk.validateForm({ form: this.$refs.xForm }).then(() => { //
this.$mk.validateForm({form: this.$refs.xForm}).then(() => { //
save(); //
@ -294,9 +420,7 @@ export default {
},
//
watch: {
}
watch: {}
};
</script>

View File

@ -2,7 +2,7 @@
<template>
<div class="page-body">
<a-button type="primary" icon="eye" @click="preView">
<a-button type="primary" v-if="formOptions.data.in_time === 0" icon="eye" @click="preView">
打印预览
</a-button>
<h2> {{ title }}</h2>
@ -41,6 +41,20 @@
{{ formOptions.data.total_price|formatNumber }}
</td>
</tr>
<tr class="table-row-2" v-if="formOptions.data.out_time === 0">
<th class="table-cell">
采购成本
</th>
<td class="table-cell" colspan="3">
{{ formOptions.data.purchase_cost|formatNumber }}
</td>
<th class="table-cell">
加工成本
</th>
<td class="table-cell" colspan="6">
{{ formOptions.data.processing_cost|formatNumber }}
</td>
</tr>
<tr class="table-row-3" v-if="formOptions.data.out_time === 0">
<th class="table-cell">
入库数量
@ -401,6 +415,8 @@ export default {
// { field: 'department_id', title: 'ID', span: 12, itemRender: { name: '$input' } },
{field: 'salesman_uid', title: '业务员ID', span: 12, itemRender: {name: '$input'}},
{field: 'salesman_name', title: '业务员姓名', span: 12, itemRender: {name: '$input'}},
{field: 'purchase_cost', title: '采购成本', span: 12, itemRender: {name: '$input'}},
{field: 'processing_cost', title: '加工成本', span: 12, itemRender: {name: '$input'}},
// { field: 'handler_uid', title: 'ID', span: 12, itemRender: { name: '$input' } },
// { field: 'handler_name', title: '', span: 12, itemRender: { name: '$input' } },
// { field: 'warehouse_keeper_uid', title: 'ID', span: 12, itemRender: { name: '$input' } },
@ -584,8 +600,8 @@ export default {
"spec": this.formOptions.data.product_detail.spec,
"unit": this.formOptions.data.product_detail.unit,
"out_stock": this.formOptions.data.out_stock,
"price": this.formOptions.data.price,
"total_price": this.formOptions.data.total_price,
"price": this.formatNumber(this.formOptions.data.price),
"total_price": this.formatNumber(this.formOptions.data.total_price),
"remark": this.formOptions.data.remark,
}
]
@ -593,6 +609,13 @@ export default {
console.log("this.formOptions.data", this.formOptions.data)
this.$refs.preView.show(hiprintTemplate, this.formOptions.data, width)
},
formatNumber(cellValue) {
if (!cellValue) {
return '';
}
return cellValue.toFixed(2);
},
},

View File

@ -1,6 +1,53 @@
<template>
<div class="page-body">
<a-divider orientation="left">库位</a-divider>
<a-descriptions title="">
<a-descriptions-item label="库位名称">
{{ warehouse_pos_idetail.name }}
</a-descriptions-item>
<a-descriptions-item label="库位编号">
{{ warehouse_pos_idetail.code }}
</a-descriptions-item>
<a-descriptions-item label="仓库名称">
{{ warehouse_idetail.name }}
</a-descriptions-item>
<a-descriptions-item label="仓库编号">
{{ warehouse_idetail.code }}
</a-descriptions-item>
<a-descriptions-item label="库存数量">
<span style="color: maroon;font-weight: bold;">{{
current_mes_stock_position.stock
}}</span> {{ product_detail.unit }}
</a-descriptions-item>
</a-descriptions>
<a-divider orientation="left">料品信息</a-divider>
<a-descriptions title="">
<a-descriptions-item label="料品名称">
{{ product_detail.name }}
</a-descriptions-item>
<a-descriptions-item label="料品编号">
{{ product_detail.code }}
</a-descriptions-item>
<a-descriptions-item label="规格">
{{ product_detail.spec }}
</a-descriptions-item>
<a-descriptions-item label="尺寸">
{{ product_detail.size }}
</a-descriptions-item>
<a-descriptions-item label="颜色">
{{ product_detail.color }}
</a-descriptions-item>
<a-descriptions-item label="单价">
{{ product_detail.price }}
</a-descriptions-item>
<a-descriptions-item label="备注">
{{ product_detail.remark }}
</a-descriptions-item>
<a-descriptions-item label="总库存">
<span style="color: maroon;font-weight: bold;">{{ mes_stock.stock }}</span> {{ product_detail.unit }}
</a-descriptions-item>
</a-descriptions>
<a-divider orientation="left">新建出库信息</a-divider>
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
</vxe-form>
@ -24,7 +71,9 @@ export default {
type: String,
default: "edit"
},
dataId: {}
dataId: {},
stockId: {},
pageOptions: {}
},
@ -166,7 +215,14 @@ export default {
//
addModeItems: [],
mes_stock: {}, //
mes_stock_position: {}, //
current_mes_stock_position: {}, //
stock_in: {}, //
stock_out: {}, //
product_detail: {}, //
warehouse_idetail: {}, //
warehouse_pos_idetail: {}, //
};
@ -187,7 +243,7 @@ export default {
// id
let dataId = this.getDataId();
let dataId = this.getStockId();
// id
if (dataId) {
@ -201,6 +257,25 @@ export default {
console.log(a) //
this.mes_stock = a.data.mes_stock;
console.log(" this.mes_stock:", this.mes_stock)
this.mes_stock_position = a.data.mes_stock_position;
console.log(" this.mes_stock_position:", this.mes_stock_position)
for (let i = 0; i < this.mes_stock_position.length; i++) {
// console.log("this.GetId_BigInt(this.mes_stock_position[i].id).c[1]:", this.GetId_BigInt(this.mes_stock_position[i].id).c[1])
// console.log("this.getDataId_BigInt().c[1]:", this.getDataId_BigInt().c[1])
if (this.GetId_BigInt(this.mes_stock_position[i].id).c[1] === this.getDataId_BigInt().c[1]) {
this.current_mes_stock_position = this.mes_stock_position[i];
}
}
console.log(" this.current_mes_stock_position:", this.current_mes_stock_position)
this.product_detail = a.data.mes_stock.product_detail;
this.warehouse_idetail = this.current_mes_stock_position.warehouse_idetail;
this.warehouse_pos_idetail = this.current_mes_stock_position.warehouse_pos_idetail;
this.stock_in = a.data.stock_in;
console.log(" this.stock_in:", this.stock_in)
this.stock_out = a.data.stock_out;
console.log(" this.stock_out:", this.stock_out)
}).catch((a) => {
this.$mk.error(a.data.msg);
});
@ -240,6 +315,31 @@ export default {
},
getStockId() {
let stockId = this.pageOptions.stockId;
if (this.$route && this.$route.params && this.$route.params.id) {
stockId = this.$route.params.id;
}
if (!stockId) {
stockId = 0;
}
return stockId;
},
GetId_BigInt(id) {
let dataId = id
if (this.$route && this.$route.params && this.$route.params.id) {
dataId = this.$route.params.id;
}
if (!dataId) {
dataId = 0;
}
return this.$mk.toBigInt(dataId);
},
getStockId_BigInt() {
let stockId = this.getStockId();
return this.$mk.toBigInt(stockId);
},
//
back() {

View File

@ -4,8 +4,9 @@
<basic-page-list :desc="desc" :options="pageOptions" ref="List">
<template v-slot:column1="{ row }">
<a-button class="in" type="primary" @click="stockIn(row.id)">入库</a-button>
<a-button class="out" @click="stockOut(row.id)">出库</a-button>
<a-button class="in" type="primary" @click="stockIn(row.id,row.stock_id)">入库</a-button>
<a-button class="out" @click="stockOut(row.id,row.stock_id)">出库</a-button>
</template>
<template v-slot:column2="{ row }">
@ -216,7 +217,7 @@ export default {
},
//
stockOut(id) {
stockOut(id, stockId) {
//console.log("stockOut:"+id)
//this.$router.push('/MesStock/MesStockOut/'+id) //
@ -224,7 +225,9 @@ export default {
this.$mk.dialog.open({
page: () => import("../OutIn/OutEdit"),
title: "出库",
pageOptions: {},
pageOptions: {
stockId: stockId,
},
width: 1000,
height: 800,
dataId: id,
@ -239,7 +242,7 @@ export default {
},
//
stockIn(id) {
stockIn(id, stockId) {
//console.log("stockIn:"+id)
//this.$router.push('/MesStock/MesStockIn/'+id) //
@ -247,10 +250,13 @@ export default {
this.$mk.dialog.open({
page: () => import("../OutIn/InEdit"),
title: "入库",
pageOptions: {},
pageOptions: {
stockId: stockId,
},
width: 1000,
height: 800,
dataId: id,
callback: ({success}) => {
if (success) {
this.$refs.List.gridReload()

View File

@ -3,20 +3,25 @@
<vxe-table border show-overflow keep-source ref="xTable" :data="detailsData" @pulldownSelected="onPulldownSelected"
@popupSelected="onPopupSelected" :export-config="{}" @edit-closed="afterEditEvent" @edit-actived="beforeEditEvent"
@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 title="图片" width="110" align="center">
<vxe-column title="图片" width="80" align="center">
<template #default="{ row }">
<div v-if="row.component_img" style="position: relative;" class="imgbox">
<img style="width:50px;height:50px;" :src="row.component_img"
@click.stop="$hevueImgPreview(row.component_img)" />
@click.stop="$hevueImgPreview(row.component_img)"/>
<div class="imgicons" style="position:absolute;right:0px;top:0px;">
<div>
<a @click="imgDel({ row })"> <a-icon type="close-circle" /></a>
<a @click="imgDel({ row })">
<a-icon type="close-circle"/>
</a>
</div>
<div>
<a-upload name="file" accept="image/*" :before-upload="beforeUpload" :show-upload-list="false">
<a @click="uploadClick({ row })"> <a-icon type="edit" /></a>
<a @click="uploadClick({ row })">
<a-icon type="edit"/>
</a>
</a-upload>
</div>
</div>
@ -32,7 +37,7 @@
</template>
</vxe-column>
<vxe-column field="component_num" title="数量" width="80" align="center"
<vxe-column field="component_num" title="数量" width="70" align="center"
:edit-render="{ name: '$input', props: { type: 'number' } }"></vxe-column>
<vxe-column field="production_type" title="布产类型" width="100" align="center" :edit-render="{}">
<template #default="{ row }">
@ -56,34 +61,42 @@
:edit-render="{ name: '$input', props: { type: 'date' } }"></vxe-column>
<vxe-column title="完成" width="160" align="center" v-if="getDataId()">
<vxe-column title="完成" width="100" align="center" v-if="getDataId()">
<template #default="{ row }">
<div v-if="row.id">
<div v-if="row.complete_time">{{ $mk.getDateString(row.complete_time) }}</div>
<div v-if="row.complete_time">
<a-tooltip placement="topLeft" :title="'完成时间:'+$mk.getDateString(row.complete_time)"
arrow-point-at-center>
{{ $mk.getDate(row.complete_time) }}
</a-tooltip>
</div>
<a-button v-else :disabled="!(isComponentOutProduct() || pageIsComplete())" @click.stop="pageComplete(row)"
type="primary">完成</a-button>
type="primary">完成
</a-button>
</div>
</template>
</vxe-column>
<!-- <vxe-column field="complete_type" v-if="getDataId() && isDetails1Complete()" title="完工人员类型" width="160"
:params="{ data: options_user_type }" formatter='formatEnum'></vxe-column> -->
<vxe-column field="spec" title="规格" align="center" width="160"
<vxe-column field="spec" title="规格" align="center" width="140"
:edit-render="{ name: '$input', props: {} }"></vxe-column>
<vxe-column field="surface" title="表面工艺" align="center" width="160"
<vxe-column field="surface" title="表面工艺" align="center" width="140"
:edit-render="{ name: '$input', props: {} }"></vxe-column>
<vxe-column field="inlay" title="镶件材料" align="center" width="160"
<vxe-column field="inlay" title="镶件材料" align="center" width="140"
:edit-render="{ name: '$input', props: {} }"></vxe-column>
<vxe-column field="purchase_cost" title="采购成本" align="center" width="auto"
:edit-render="{ name: '$input', props: {type: 'number' } }"></vxe-column>
<vxe-column field="processing_cost" title="加工成本" align="center" width="auto"
:edit-render="{ name: '$input', props: {type: 'number' } }"></vxe-column>
<vxe-column field="remark" title="备注" align="center" width="auto"
:edit-render="{ name: '$input', props: {} }"></vxe-column>
</vxe-table>
<vxe-table v-if="!isComponentOutProduct()" border show-overflow keep-source ref="xTable2" :data="detailsData2"
@ -94,10 +107,10 @@
<template #default="{ row }">
<div class="oplinks2">
<a @click.stop="pageAdd2(row)" title="新增">
<a-icon class="icon" type="plus-circle" />
<a-icon class="icon" type="plus-circle"/>
</a>
<a @click.stop="pageDelete2(row)" title="删除">
<a-icon class="icon" type="delete" />
<a-icon class="icon" type="delete"/>
</a>
</div>
</template>
@ -106,15 +119,14 @@
:edit-render="{ name: 'MkGridDataSelector' }"></vxe-column>
<vxe-column field="department_detail" title="部门" width="120" :params="editor_department" formatter="formatRef"
:edit-render="{ name: 'MkGridDataSelector' }"></vxe-column>
<vxe-column field="progress" title="进度" width="160" :cellRender="{ name: 'progress' }"></vxe-column>
<vxe-column field="progress" title="进度" width="120" :cellRender="{ name: 'progress' }"></vxe-column>
<vxe-column v-if="false" field="process_uid_detail" title="加工人员" width="160" :params="editor_process_uid"
formatter="formatRef" :edit-render="{ name: 'MkGridDataSelector' }"></vxe-column>
<vxe-column field="progress" v-if="isEdit" :cellRender="{ name: 'progress' }" title="进度" width="180"></vxe-column>
<vxe-column field="progress" v-if="isEdit" :cellRender="{ name: 'progress' }" title="进度"
width="100"></vxe-column>
<vxe-column field="prepare_process_time" title="预备加工日期" width="130" formatter="formatDate" align="center"
:edit-render="{ name: '$input', props: { type: 'date' } }"></vxe-column>
@ -122,26 +134,33 @@
:edit-render="{ name: '$input', props: { type: 'date' } }"></vxe-column>
<vxe-column title="发料" width="210" v-if="getDataId()">
<vxe-column title="发料" width="100" align="center" v-if="getDataId()">
<template #default="{ row }">
<div v-if="row.id">
<a-button v-if="!row.is_send" @click.stop="pageSend(row)" type="primary">发料</a-button>
<div v-if="row.is_send">
{{ $mk.getDateString(row.send_time) }}
<a-button v-if="!isComponentDone() && !row.is_complete" @click.stop="pageSend(row, true)">撤销</a-button>
<a-tooltip placement="topLeft" :title="'发料时间:'+$mk.getDateString(row.send_time)"
arrow-point-at-center>
<a-button v-if="!isComponentDone() && !row.is_complete" @click.stop="pageSend(row, true)">撤销
</a-button>
</a-tooltip>
</div>
</div>
</template>
</vxe-column>
<vxe-column title="完成" width="210" v-if="getDataId()">
<vxe-column title="完成" width="100" align="center" v-if="getDataId()">
<template #default="{ row }">
<div v-if="row.id && row.is_send">
<a-tooltip placement="topLeft" :title="'发料时间:'+$mk.getDateString(row.send_time)" arrow-point-at-center>
<a-button v-if="!row.is_complete" @click.stop="pageDone(row)" type="primary">完成</a-button>
</a-tooltip>
<div v-if="row.is_complete">
{{ $mk.getDateString(row.complete_time) }}
<a-tooltip placement="topLeft" :title="'完成时间:'+$mk.getDateString(row.complete_time)"
arrow-point-at-center>
<a-button v-if="!isComponentDone()" @click.stop="pageDone(row, true)">撤销</a-button>
</a-tooltip>
</div>
</div>
</template>
@ -153,15 +172,17 @@
<vxe-column field="complete_type" v-if="getDataId() && readonly" title="完工人员" width="80" align="center"
:params="{ data: options_user_type }" formatter='formatEnum'></vxe-column>
<vxe-column field="purchase_cost" title="采购成本(元)" width="130"
:edit-render="{ name: '$input', props: {type: 'number' } }"></vxe-column>
<vxe-column field="processing_cost" title="加工成本(元)" width="130"
:edit-render="{ name: '$input', props: {type: 'number' } }"></vxe-column>
<vxe-column field="remark" title="备注" width="auto" :edit-render="{ name: '$input', props: {} }"></vxe-column>
</vxe-table>
</div>
</template>
@ -187,8 +208,7 @@ export default {
itemData: {
type: Object
},
dataId: {
}
dataId: {}
},
@ -228,31 +248,22 @@ export default {
isEdit: false,
//
addModeItems: [
],
addModeItems: [],
detailsSourceData: [
],
detailsData: [
],
deletedDetailsData: [
detailsSourceData: [],
detailsData: [],
deletedDetailsData: [],
],
detailsData2: [
],
deletedDetailsData2: [
],
detailsData2: [],
deletedDetailsData2: [],
editor_component: {
dataType: "object",
valueField: "id",
textField: "name",
listdataFieldName: 'MoldComponent',
mapper: [
{ fromField: "id", field: "component_id" }
{fromField: "id", field: "component_id"}
],
dataUrl: `${BASE_URL.BASE_URL}/MoldComponent/v1/mold/component/list`
},
@ -262,7 +273,7 @@ export default {
textField: "name",
listdataFieldName: 'BaseDepartment',
mapper: [
{ fromField: "id", field: "department_id" }
{fromField: "id", field: "department_id"}
],
dataUrl: `${BASE_URL.BASE_URL}/BaseDepartment/v1/base/department/list`
},
@ -273,7 +284,7 @@ export default {
textField: "name",
listdataFieldName: 'MesProcesses',
mapper: [
{ fromField: "id", field: "process_id" }
{fromField: "id", field: "process_id"}
],
dataUrl: `${BASE_URL.BASE_URL}/MesProcesses/v1/mes/processes/list`
},
@ -284,7 +295,7 @@ export default {
textField: "name",
listdataFieldName: 'MesStaff',
mapper: [
{ fromField: "id", field: "process_uid" }
{fromField: "id", field: "process_uid"}
],
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`
},
@ -294,7 +305,7 @@ export default {
textField: "name",
listdataFieldName: 'MesStaff',
mapper: [
{ fromField: "id", field: "send_uid" }
{fromField: "id", field: "send_uid"}
],
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`
},
@ -304,7 +315,7 @@ export default {
textField: "name",
listdataFieldName: 'MesStaff',
mapper: [
{ fromField: "id", field: "process_uid" }
{fromField: "id", field: "process_uid"}
],
dataUrl: `${BASE_URL.BASE_URL}/MesStaff/v1/mes/staff/list`
},
@ -346,9 +357,6 @@ export default {
this.detailsData2 = JSON.parse(JSON.stringify(this.itemData.mold_production_order_component_processes || []));
//this.loadDepartment();
this.detailsDataInit();
@ -394,7 +402,6 @@ export default {
this.detailsData2[i].department_detail = row.department_detail;
}
}
});
@ -432,7 +439,6 @@ export default {
},
getDateValue(v) {
return new Date(v * 1000);
},
@ -531,9 +537,7 @@ export default {
pageAdd(row) {
const $table = this.$refs.xTable
const record = {
}
const record = {}
if (row) {
this.detailsData = JSON.parse(JSON.stringify(this.detailsData))
this.detailsData.splice($table.getRowSeq(row), 0, record);
@ -592,27 +596,31 @@ export default {
})
postdata.mold_production_order_component = this.$mk.getPostFieldValue({
rowFilter: (row) => { return row.id || row.component_id },
rowFilter: (row) => {
return row.id || row.component_id
},
dataId: this.getDataId_BigInt(),
list: this.detailsData,
deletedList: this.deletedDetailsData,
fieldName: 'production_id',
dataRule: [
{ field: 'production_type', type: 'integer' },
{ field: 'component_num', type: 'integer' },
{ field: 'prepare_process_time', type: 'timestamp' },
{ field: 'plan_complete_time', type: 'timestamp' },
{field: 'production_type', type: 'integer'},
{field: 'component_num', type: 'integer'},
{field: 'prepare_process_time', type: 'timestamp'},
{field: 'plan_complete_time', type: 'timestamp'},
{ field: 'order_id', type: 'bigint' },
{ field: 'id', type: 'bigint' },
{ field: 'update_uid', type: 'bigint' },
{ field: 'complete_uid', type: 'bigint' },
{ field: 'create_uid', type: 'bigint' },
{ field: 'mold_id', type: 'bigint' },
{ field: 'component_id', type: 'bigint' },
{ field: 'process_uid', type: 'bigint' },
{ field: 'send_uid', type: 'bigint' },
{ field: 'process_id', type: 'bigint' },
{field: 'order_id', type: 'bigint'},
{field: 'id', type: 'bigint'},
{field: 'update_uid', type: 'bigint'},
{field: 'complete_uid', type: 'bigint'},
{field: 'create_uid', type: 'bigint'},
{field: 'mold_id', type: 'bigint'},
{field: 'component_id', type: 'bigint'},
{field: 'process_uid', type: 'bigint'},
{field: 'send_uid', type: 'bigint'},
{field: 'process_id', type: 'bigint'},
{field: 'purchase_cost', type: 'bigint'},
{field: 'processing_cost', type: 'bigint'},
]
});
@ -630,57 +638,60 @@ export default {
item.component_id = this.detailsData[0].component_id;
})
postdata.mold_production_order_component_processes = this.$mk.getPostFieldValue({
rowFilter: (row) => { return row.id || (row.component_id && row.process_id) },
rowFilter: (row) => {
return row.id || (row.component_id && row.process_id)
},
dataId: this.getDataId_BigInt(),
list: list,
deletedList: this.deletedDetailsData2,
fieldName: 'production_id',
dataRule: [
{ field: 'id', type: 'bigint' },
{ field: 'prepare_process_time', type: 'timestamp' },
{ field: 'plan_complete_time', type: 'timestamp' },
{field: 'id', type: 'bigint'},
{field: 'prepare_process_time', type: 'timestamp'},
{field: 'plan_complete_time', type: 'timestamp'},
{ field: 'order_id', type: 'bigint' },
{ field: 'send_uid', type: 'bigint' },
{ field: 'complete_uid', type: 'bigint' },
{ field: 'update_uid', type: 'bigint' },
{ field: 'create_uid', type: 'bigint' },
{ field: 'component_id', type: 'bigint' },
{ field: 'department_id', type: 'bigint' },
{ field: 'process_id', type: 'bigint' },
{ field: 'process_uid', type: 'bigint' },
{field: 'order_id', type: 'bigint'},
{field: 'send_uid', type: 'bigint'},
{field: 'complete_uid', type: 'bigint'},
{field: 'update_uid', type: 'bigint'},
{field: 'create_uid', type: 'bigint'},
{field: 'component_id', type: 'bigint'},
{field: 'department_id', type: 'bigint'},
{field: 'process_id', type: 'bigint'},
{field: 'process_uid', type: 'bigint'},
{field: 'purchase_cost', type: 'bigint'},
{field: 'processing_cost', type: 'bigint'},
]
});
}
this.itemData.postdata = postdata;
},
beforeEditMethod({ column, row }) {
beforeEditMethod({column, row}) {
if (this.readonly) {
return false;
}
console.log(column, row);
return true;
},
afterEditEvent({ column, row }) {
afterEditEvent({column, row}) {
console.log(column, row);
this.postDataUpdate();
},
beforeEditEvent({ column, row }) {
beforeEditEvent({column, row}) {
console.log(column, row);
if (this.readonly) {
return false;
}
},
onPulldownSelected({ row, selectedData, column }) {
onPulldownSelected({row, selectedData, column}) {
console.log(selectedData);
@ -689,7 +700,7 @@ export default {
row.department_id = selectedData.department_id;
}
},
onPopupSelected({ rows, name, params }) {
onPopupSelected({rows, name, params}) {
console.log(rows, name, params);
},
@ -703,7 +714,7 @@ export default {
if (this.currentRow.id) {
this.$mk.post({
url: `${BASE_URL.BASE_URL}/MoldProductionOrder/v1/mold/production/order/upload`,
data: { id: this.currentRow.id, image: url },
data: {id: this.currentRow.id, image: url},
useBigInt: true
}).then(a => {
console.log(a);
@ -714,12 +725,12 @@ export default {
return false
},
imgDel({ row }) {
imgDel({row}) {
row.component_img = "";
this.$mk.post({
url: `${BASE_URL.BASE_URL}/MoldProductionOrder/v1/mold/production/order/upload`,
data: { id: row.id, image: "" },
data: {id: row.id, image: ""},
useBigInt: true
}).then(a => {
console.log(a);
@ -727,16 +738,13 @@ export default {
},
uploadClick({ row }) {
uploadClick({row}) {
this.currentRow = row;
}
},
//
watch: {
}
watch: {}
};
</script>
@ -782,8 +790,7 @@ export default {
}
.imgicons {
display: none;
;
display: none;;
}
.imgbox:hover .imgicons {