|
@@ -13,12 +13,12 @@
|
|
|
<a-card :bordered="true">
|
|
|
<div class="table-page-search-wrapper">
|
|
|
<!-- :rules="validatorRules" -->
|
|
|
- <a-form-model layout="inline" ref="form" :model="addShipDet">
|
|
|
+ <a-form-model layout="inline" ref="form" :model="addShipDet" :rules="validatorRules">
|
|
|
<a-row :gutter="24">
|
|
|
<a-col :md="6" :sm="8">
|
|
|
<!-- required 必填项 disabled 禁用 -->
|
|
|
<a-form-model-item label="单据号" prop="documentNo">
|
|
|
- <a-input placeholder="请输入单据号" v-model="addShipDet.documentNo"></a-input>
|
|
|
+ <a-input placeholder="自动生成" v-model="addShipDet.documentNo" readOnly></a-input>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
|
|
@@ -267,6 +267,13 @@ export default {
|
|
|
let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
|
|
|
return {
|
|
|
id: '',
|
|
|
+ validatorRules:{
|
|
|
+ documentDate:[{required: true, message: '请输入单据日期!'}],
|
|
|
+ customer:[{required: true, message: '请选择客户!'}],
|
|
|
+ preDeliveryDate:[{required: true, message: '请选择预发货时间!'}],
|
|
|
+ preCompletionDate:[{required: true, message: '请选择预完工日期!'}],
|
|
|
+ orderType:[{required: true, message: '请输入订单类型!'}],
|
|
|
+ },
|
|
|
// 表头
|
|
|
columns: [
|
|
|
{
|
|
@@ -611,36 +618,46 @@ export default {
|
|
|
|
|
|
// 新增 保存
|
|
|
addSave() {
|
|
|
- var newObj = {} // 新增对象
|
|
|
- newObj.documentNo = this.addShipDet.documentNo
|
|
|
- newObj.documentDate = this.addShipDet.documentDate.format('YYYY-MM-DD')
|
|
|
- newObj.customer = this.addShipDet.customer
|
|
|
- newObj.preDeliveryDate = this.addShipDet.preDeliveryDate.format('YYYY-MM-DD') // 预发货日期
|
|
|
- newObj.preCompletionDate = this.addShipDet.preCompletionDate.format('YYYY-MM-DD') // 预完工日期
|
|
|
- newObj.orderType = this.addShipDet.orderType
|
|
|
-
|
|
|
- newObj.garmentFactory = this.addShipDet.garmentFactory
|
|
|
- newObj.wholeOrderTotal = this.addShipDet.wholeOrderTotal
|
|
|
- newObj.memo = this.addShipDet.memo // U8系统适用
|
|
|
- newObj.syShippingDetailsItemList = this.syShippingDetailsItemList // 子表信息赋值
|
|
|
-
|
|
|
- // 必须选择子表 --- 参照订单数据
|
|
|
- if (newObj.syShippingDetailsItemList.length == 0) {
|
|
|
- this.$message.error('请选择参照订单数据')
|
|
|
- } else {
|
|
|
- addShipmentList(newObj).then(res => {
|
|
|
- if (res.success) {
|
|
|
- this.$message.success('新增成功')
|
|
|
- console.log('新增的对象', newObj)
|
|
|
- this.close()
|
|
|
- // 清空信息
|
|
|
- newObj = {}
|
|
|
- newObj.syShippingDetailsItemList = []
|
|
|
- this.fatherList() // 调用父组件 查询方法
|
|
|
- // this.msgFormSon = {} 清空子表信息
|
|
|
- }
|
|
|
- })
|
|
|
+ const that = this;
|
|
|
+ // 触发表单验证
|
|
|
+ this.$refs.form.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ var newObj = {} // 新增对象
|
|
|
+ newObj.documentNo = this.addShipDet.documentNo
|
|
|
+ newObj.documentDate = this.addShipDet.documentDate.format('YYYY-MM-DD')
|
|
|
+ newObj.customer = this.addShipDet.customer
|
|
|
+ newObj.preDeliveryDate = this.addShipDet.preDeliveryDate.format('YYYY-MM-DD') // 预发货日期
|
|
|
+ newObj.preCompletionDate = this.addShipDet.preCompletionDate.format('YYYY-MM-DD') // 预完工日期
|
|
|
+ newObj.orderType = this.addShipDet.orderType
|
|
|
+
|
|
|
+ newObj.garmentFactory = this.addShipDet.garmentFactory
|
|
|
+ newObj.wholeOrderTotal = this.addShipDet.wholeOrderTotal
|
|
|
+ newObj.memo = this.addShipDet.memo // U8系统适用
|
|
|
+ newObj.syShippingDetailsItemList = this.syShippingDetailsItemList // 子表信息赋值
|
|
|
+
|
|
|
+ // 必须选择子表 --- 参照订单数据
|
|
|
+ if (newObj.syShippingDetailsItemList.length == 0) {
|
|
|
+ this.$message.error('请选择参照订单数据')
|
|
|
+ } else {
|
|
|
+ addShipmentList(newObj).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('新增成功')
|
|
|
+ this.close()
|
|
|
+ // 清空信息
|
|
|
+ newObj = {}
|
|
|
+ newObj.syShippingDetailsItemList = []
|
|
|
+ this.fatherList() // 调用父组件 查询方法
|
|
|
+ // this.msgFormSon = {} 清空子表信息
|
|
|
+ }else{
|
|
|
+ this.$message.error(res.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ return false;
|
|
|
}
|
|
|
+ });
|
|
|
+
|
|
|
// const that = this
|
|
|
// // 触发表单验证
|
|
|
// this.$refs.form.validate(valid => {
|