This commit is contained in:
parent
2a962e471e
commit
cd11856de9
|
|
@ -29,7 +29,7 @@ export default {
|
|||
}
|
||||
data[saveField] = parseInt(value); // 转换为整数
|
||||
}
|
||||
else if (rule.dataRule.type == "number") { // 如果是整数
|
||||
else if (rule.dataRule.type == "number" || rule.dataRule.type == "float") { // 如果是整数
|
||||
data[saveField] = parseFloat(value); // 转换为整数
|
||||
}
|
||||
else if (rule.dataRule.type == "timestamp") { // 如果是时间戳
|
||||
|
|
|
|||
|
|
@ -107,13 +107,14 @@ export default {
|
|||
|
||||
},
|
||||
|
||||
getPostFieldValue({ dataId, list, type, deletedList, fieldName, rowFilter, dataRule }) {
|
||||
getPostFieldValue({ dataId, list, type, deletedList, fieldName, rowFilter, dataRule }) {
|
||||
|
||||
let d = {};
|
||||
console.log(list)
|
||||
if (rowFilter) {
|
||||
list = list.filter(rowFilter);
|
||||
}
|
||||
|
||||
if (dataRule) {
|
||||
list.forEach(item => {
|
||||
|
||||
|
|
@ -121,15 +122,16 @@ export default {
|
|||
dataRule.forEach(rule => {
|
||||
let value = item[rule.field];
|
||||
|
||||
if(isNaN(value) ){
|
||||
value = 0;
|
||||
}
|
||||
|
||||
if (rule.type == "integer") {
|
||||
if(isNaN(value) ){
|
||||
value = 0;
|
||||
}
|
||||
item[rule.field] = parseInt(value);
|
||||
|
||||
|
||||
}
|
||||
else if (rule.type == "number") {
|
||||
else if (rule.type == "number" || rule.type == "float") {
|
||||
item[rule.field] = parseFloat(value);
|
||||
}
|
||||
else if (rule.type == "timestamp") {
|
||||
|
|
@ -147,6 +149,8 @@ export default {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
|
|
|||
|
|
@ -101,6 +101,8 @@
|
|||
<script>
|
||||
import BASE_URL from '@/services/mes/api.js';
|
||||
|
||||
const dataset = require('./dataset.js');
|
||||
|
||||
export default {
|
||||
|
||||
name: '',
|
||||
|
|
@ -124,6 +126,7 @@ export default {
|
|||
// 页面数据变量
|
||||
var pageData = {
|
||||
|
||||
dataset:dataset,
|
||||
options_paid_status: options_paid_status,
|
||||
options_production_type: [{ value: '1', label: '正常布产' }, { value: '2', label: '委托布产' }],
|
||||
// 当前项目名称
|
||||
|
|
@ -275,7 +278,7 @@ export default {
|
|||
}).then(a => {
|
||||
|
||||
|
||||
this.formOptions.data = this.$mk.formatDetailData({ data: a.data[this.detailDataFieldName], rules: this.formOptions.items });
|
||||
this.formOptions.data = this.$mk.formatDetailData({ dataset:this.dataset, data: a.data[this.detailDataFieldName], rules: this.formOptions.items });
|
||||
console.log(this.formOptions.data)
|
||||
this.detailsData = JSON.parse(JSON.stringify(a.data[this.detailDataFieldName].order_molds || []));
|
||||
if (a.data[this.detailDataFieldName].auditor_uid) {
|
||||
|
|
@ -392,36 +395,19 @@ export default {
|
|||
// 如果是新增模式,提交的数据中加入id 如果是编辑模式,提交的数据中不加入id
|
||||
let postdata = Object.assign({}, this.formOptions.data);
|
||||
|
||||
|
||||
console.log(this.dataset.order_molds.fields)
|
||||
postdata.order_molds = this.$mk.getPostFieldValue({
|
||||
rowFilter: (row) => { return row.id || row.mold_id },
|
||||
dataId: this.getDataId_BigInt(),
|
||||
list: this.detailsData,
|
||||
deletedList: this.deletedDetailsData,
|
||||
fieldName: 'order_id',
|
||||
dataRule: [
|
||||
{ field: 'id', type: 'bigint' },
|
||||
{ field: 'production_type', type: 'integer' },
|
||||
{ field: 'manufacture_cycle', type: 'timestamp' },
|
||||
{ field: 'draw_start_time', type: 'timestamp' },
|
||||
{ field: 'split_design_time', type: 'timestamp' },
|
||||
{ field: 'draw_time', type: 'timestamp' },
|
||||
{ field: 'draw2D_time', type: 'timestamp' },
|
||||
{ field: 'draw3D_time', type: 'timestamp' },
|
||||
{ field: 'horizontal_frame_time', type: 'timestamp' },
|
||||
{ field: 'inlay_deep_hole_time', type: 'timestamp' },
|
||||
{ field: 'update_uid', type: 'bigint' },
|
||||
{ field: 'mold_id', type: 'bigint' },
|
||||
{ field: 'mold_master_uid', type: 'bigint' },
|
||||
{ field: 'manufacture_cycle', type: 'timestamp' },
|
||||
{ field: 'product_structure_uid', type: 'bigint' },
|
||||
{ field: 'mold_structure_uid', type: 'bigint' },
|
||||
{ field: 'create_uid', type: 'bigint' }
|
||||
]
|
||||
dataRule: this.dataset.order_molds.fields
|
||||
});
|
||||
|
||||
|
||||
// 格式化提交的数据
|
||||
this.$mk.formatFormData({ data: postdata, rules: this.formOptions.items });
|
||||
this.$mk.formatFormData({ dataset:this.dataset, data: postdata, rules: this.formOptions.items });
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
var dataset = {
|
||||
|
||||
actions: {
|
||||
getList: `/MoldOrder/v1/mold/order/list`,
|
||||
delete: `/MoldOrder/v1/mold/order/batchDelete`,
|
||||
get: `/MoldOrder/v1/mold/order/detail`,
|
||||
create: `/MoldOrder/v1/mold/order/create`,
|
||||
update: `/MoldOrder/v1/mold/order/update`
|
||||
},
|
||||
|
||||
listFieldName: 'MoldOrder', // list接口返回 数据数组的字段名
|
||||
detailDataFieldName: "mold_order", // detail接口返回 数据的字段名
|
||||
|
||||
fields: [
|
||||
{ field: 'code', title: '订单编码', type: 'string' },
|
||||
{ field: 'name', title: '客户名称', type: 'string' },
|
||||
{ field: 'contact', title: '联系人', type: 'string' },
|
||||
{ field: 'phone', title: '联系电话', type: 'string' },
|
||||
{ field: 'salesman', title: '业务员姓名', type: 'string' },
|
||||
{ field: 'contract_no', title: '合同号', type: 'string' },
|
||||
{ field: 'contract_start_time', type: "timestamp", title: '合同开始日期' },
|
||||
{ field: 'contract_end_time', type: "timestamp", title: '合同结束日期' },
|
||||
|
||||
{ field: 'amount', type: 'float', title: '订单金额' },
|
||||
{ field: 'paid_amount', type: 'number', title: '付款金额' },
|
||||
{ field: 'paid_ratio', type: 'number', title: '付款比例' },
|
||||
{ field: 'paid_status', type: 'integer', title: '付款状态' },
|
||||
{ field: 'remark', title: '备注', type: 'string' },
|
||||
|
||||
],
|
||||
|
||||
order_molds:{
|
||||
fields:[
|
||||
{ field: 'id', type: 'bigint' },
|
||||
{ field: 'production_type', type: 'integer' },
|
||||
{ field: 'manufacture_cycle', type: 'timestamp' },
|
||||
{ field: 'draw_start_time', type: 'timestamp' },
|
||||
{ field: 'split_design_time', type: 'timestamp' },
|
||||
{ field: 'draw_time', type: 'timestamp' },
|
||||
{ field: 'draw2D_time', type: 'timestamp' },
|
||||
{ field: 'draw3D_time', type: 'timestamp' },
|
||||
{ field: 'horizontal_frame_time', type: 'timestamp' },
|
||||
{ field: 'inlay_deep_hole_time', type: 'timestamp' },
|
||||
{ field: 'update_uid', type: 'bigint' },
|
||||
{ field: 'mold_id', type: 'bigint' },
|
||||
{ field: 'mold_master_uid', type: 'bigint' },
|
||||
{ field: 'manufacture_cycle', type: 'timestamp' },
|
||||
{ field: 'product_structure_uid', type: 'bigint' },
|
||||
{ field: 'mold_structure_uid', type: 'bigint' },
|
||||
{ field: 'create_uid', type: 'bigint' }
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
module.exports = dataset
|
||||
Loading…
Reference in New Issue