123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973 |
- <template>
- <!-- 新增 发运明细 -->
- <div id="AddShipDetDrawer">
- <a-drawer
- title="新增发运明细"
- width="89%"
- placement="right"
- :closable="true"
- :visible="visible"
- @close="handleCancel"
- >
- <!-- 主表信息 填写-->
- <a-card :bordered="true">
- <div class="table-page-search-wrapper">
- <!-- :rules="validatorRules" -->
- <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" readOnly></a-input>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="单据日期" prop="documentDate">
- <a-date-picker
- placeholder="请选择单据日期"
- format="YYYY-MM-DD"
- style="width:100%;"
- v-model="addShipDet.documentDate"
- />
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="8">
- <a-form-model-item label="客户" prop="customer">
- <a-input placeholder="请输入客户" v-model="addShipDet.customer"></a-input>
- </a-form-model-item>
- </a-col>
- <!-- <a-col :md="6" :sm="8">
- <a-form-model-item label="预发货日期" prop="preDeliveryDate">
- <a-date-picker
- placeholder="请选择预发货时间"
- format="YYYY-MM-DD"
- style="width:100%;"
- v-model="addShipDet.preDeliveryDate"
- />
- </a-form-model-item>
- </a-col> -->
- <!-- <a-col :md="6" :sm="8">
- <a-form-model-item label="预完工日期" prop="preCompletionDate">
- <a-date-picker
- placeholder="请选择预完工日期"
- format="YYYY-MM-DD"
- style="width:100%;"
- v-model="addShipDet.preCompletionDate"
- />
- </a-form-model-item>
- </a-col> -->
- <a-col :md="6" :sm="8">
- <a-form-model-item label="订单类型" prop="orderType">
- <a-input placeholder="请输入订单类型" v-model="addShipDet.orderType"></a-input>
- </a-form-model-item>
- </a-col>
- <!-- <a-col :md="6" :sm="8">
- <a-form-model-item label="成衣工厂" prop="garmentFactory">
- <a-input placeholder="请输入成衣工厂" v-model="addShipDet.garmentFactory"></a-input>
- </a-form-model-item>
- </a-col> -->
- <!--
- <a-col :md="6" :sm="8">
- <a-form-model-item label="整单合计" prop="wholeOrderTotal">
- <a-input placeholder="整单合计" v-model="addShipDet.wholeOrderTotal"></a-input>
- </a-form-model-item>
- </a-col> -->
- <!-- U8系统适用 -->
- <a-col :md="12" :sm="12">
- <a-form-model-item label="备注" prop="memo">
- <a-input placeholder="U8系统适用" v-model="addShipDet.memo"></a-input>
- </a-form-model-item>
- </a-col>
- </a-row>
- </a-form-model>
- </div>
- </a-card>
- <!-- 参照订单数据 増行-->
- <a-card :bordered="true" style="margin:10px 0">
- <div class="table-operator">
- <a-button type="primary" @click.stop="referOrderDataOpen" icon="ordered-list">参照订单数据</a-button>
- <!-- <a-button type="primary" @click.stop="handleAddColumn" icon="plus" style="margin-left: 20px">増行</a-button> -->
- </div>
- <!-- 子表 :model="form" rowKey="id" ,y:800 -->
- <a-spin :spinning="confirmLoading">
- <a-form-model ref="formRef">
- <a-table
- :loading="loading"
- v-if="syShippingDetailsItemList"
- bordered
- :rowKey="record => record.id"
- :columns="columns"
- :data-source="syShippingDetailsItemList"
- :pagination="false"
- :scroll="{ x: 2800, y: 400 }"
- size="small"
- >
- <!-- 款号 输入框 :rules="rules.itemNumber" -->
- <template slot="itemNumber" slot-scope="text, record, index">
- <a-form-model-item prop="itemNumber">
- <a-input style="width:100%" type="text" v-model="record.itemNumber" readOnly />
- </a-form-model-item>
- </template>
- <!-- 发货数量 :rules="rules.shipQuantity"-->
- <template slot="shipmentQuantity" slot-scope="text, record, index">
- <a-form-model-item prop="shipmentQuantity">
- <a-input style="width:100%" type="text" v-model="record.shipmentQuantity" />
- </a-form-model-item>
- </template>
- <!-- 是否TC功能 :rules="rules.isTC"-->
- <!-- isTc ' 是否 tc 功能 0 否 1 是', -->
- <template slot="isTC" slot-scope="text, record, index">
- <a-form-model-item prop="isTc">
- <a-select v-model="record.isTc">
- <a-select-option value="">请选择</a-select-option>
- <a-select-option value="1">是</a-select-option>
- <a-select-option value="0">否</a-select-option>
- </a-select>
- </a-form-model-item>
- </template>
- <!-- 物料成分 :rules="rules.materialComposition"-->
- <template slot="materialComposition" slot-scope="text, record, index">
- <a-form-model-item prop="materialComposition">
- <a-input style="width:100%" type="text" v-model="record.materialComposition" />
- </a-form-model-item>
- </template>
- <!-- 采购/委外订单号 :rules="rules.purOrSubOrder"-->
- <template slot="purOrSubOrder" slot-scope="text, record, index">
- <a-form-model-item prop="purOrSubOrder">
- <a-input style="width:100%" type="text" v-model="record.purOrSubOrder" />
- </a-form-model-item>
- </template>
- <!-- 报关单价 :rules="rules.customsDeclarationUnitPrice"-->
- <template slot="customsDeclarationUnitPrice" slot-scope="text, record, index">
- <a-form-model-item prop="customsDeclarationUnitPrice">
- <a-input style="width:100%" type="text" v-model="record.customsDeclarationUnitPrice" />
- </a-form-model-item>
- </template>
- <!-- 套装件数 :rules="rules.numberOfSets"-->
- <template slot="numberOfSets" slot-scope="text, record, index">
- <a-form-model-item prop="numberOfSets">
- <a-input style="width:100%" type="text" v-model="record.numberOfSets" />
- </a-form-model-item>
- </template>
- <!-- 工厂单价 :rules="rules.factoryUnitPrice"-->
- <template slot="factoryUnitPrice" slot-scope="text, record, index">
- <a-form-model-item prop="factoryUnitPrice">
- <a-input style="width:100%" type="text" v-model="record.factoryUnitPrice" />
- </a-form-model-item>
- </template>
- <!--处理方式 -->
- <template slot="treatmentMethod" slot-scope="text, record, index">
- <a-form-model-item prop="treatmentMethod">
- <a-input style="width:100%" type="text" v-model="record.treatmentMethod" />
- </a-form-model-item>
- </template>
- <!--是否手册纱 -->
- <template slot="manualYarnFlag" slot-scope="text, record, index">
- <a-form-model-item prop="manualYarnFlag">
- <a-select v-model="record.manualYarnFlag" @change='changeManualYarnFlag'>
- <a-select-option :value="1">是</a-select-option>
- <a-select-option :value="0">否</a-select-option>
- </a-select>
- </a-form-model-item>
- </template>
- <!--手册纱单价 -->
- <template slot="manualYarnUnitPrice" slot-scope="text, record, index">
- <a-form-model-item prop="manualYarnUnitPrice">
- <a-input style="width:100%" type="text" v-model="record.manualYarnUnitPrice" :disabled='manualYarnDisabled' @change="changeManualYarn('Price',record.manualYarnUnitPrice)" />
- </a-form-model-item>
- </template>
- <!--手册纱占比 -->
- <template slot="manualYarnProportion" slot-scope="text, record, index">
- <a-form-model-item prop="manualYarnProportion">
- <a-input style="width:100%" type="text" v-model="record.manualYarnProportion" :disabled='manualYarnDisabled' @change="changeManualYarn('Proportion',record.manualYarnProportion)" />
- </a-form-model-item>
- </template>
- <!-- 操作 -->
- <template slot="operationSlot" slot-scope="text, record, index">
- <a-popconfirm
- v-if="syShippingDetailsItemList.length"
- title="确定删除吗?"
- @confirm="handleDelete(index)"
- >
- <a href="javascript:void(0);" style="color:red;">删除</a>
- </a-popconfirm>
- </template>
- </a-table>
- </a-form-model>
- </a-spin>
- </a-card>
- <!-- 页面底部保存取消 -->
- <div
- :style="{
- position: 'absolute',
- right: 0,
- bottom: 0,
- width: '100%',
- borderTop: '1px solid #e9e9e9',
- padding: '10px 16px',
- background: '#fff',
- textAlign: 'right',
- zIndex: 1
- }"
- >
- <a-popconfirm title="确定放弃新增?" @confirm="handleCancel" okText="确定" cancelText="取消">
- <a-button :style="{ marginRight: '8px' }">取消</a-button>
- </a-popconfirm>
- <a-button type="primary" @click="addSave">
- 保存
- </a-button>
- </div>
- </a-drawer>
- <!-- 参照订单数据弹框 -->
- <referOrderData-modal ref="referOrderDataModal" @bao="getSon" @ok="referOrderDataOk" @default-reset="defaultReset"></referOrderData-modal>
- </div>
- </template>
- <script>
- import { JeecgListMixin } from '@/mixins/JeecgListMixin'
- import JEllipsis from '@/components/jeecg/JEllipsis'
- import moment from 'moment'
- import ReferOrderDataModal from '@views/shipment-details/referOrderDataModal.vue'
- import { addShipmentList } from '@api/document/shipmentList'
- import { getDotConfig, getDotValidExpress } from '@/utils/myutil'
- export default {
- name: 'AddShipDetDrawer', // 新增 发运明细 抽屉
- mixins: [JeecgListMixin],
- components: { JEllipsis, ReferOrderDataModal, moment }, // 参照订单数据 弹框
- data() {
- 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: [
- {
- title: '账套',
- dataIndex: 'account',
- width: 80,
- fixed: 'left',
- className: 'replacecolor'
- },
- {
- title: '订单号',
- dataIndex: 'orderNumber',
- width: 120,
- fixed: 'left',
- className: 'replacecolor'
- },
- {
- title: '款号',
- dataIndex: 'itemNumber',
- fixed: 'left',
- width: 180,
- className: 'replacecolor'
- },
- {
- title: '订单日期',
- dataIndex: 'orderDate',
- width: 120,
- className: 'replacecolor',
- customRender: text => {
- return moment(text).format('YYYY-MM-DD')
- }
- },
-
- {
- title: '预发货日期',
- dataIndex: 'preDeliveryDate',
- width: 100,
- className: 'replacecolor',
-
- },
- {
- title: '预完工日期',
- dataIndex: 'preCompletionDate',
- width: 100,
- className: 'replacecolor',
-
- },
- {
- title: '成衣工厂',
- dataIndex: 'garmentFactory',
- width: 100,
- className: 'replacecolor'
- },
- {
- title: '业务类型',
- dataIndex: 'businessTypeText',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '客户订单',
- dataIndex: 'customerOrder',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '小po',
- dataIndex: 'smallPo',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: 'Pack Id',
- dataIndex: 'packId',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '分销点',
- dataIndex: 'distributionPoint',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '采购/委外订单号',
- dataIndex: 'purOrSubOrder',
- scopedSlots: { customRender: 'purOrSubOrder' },
- // fixed: 'left',
- width: 180,
- className: 'replacecolor'
- },
- {
- title: ' 报关单价',
- dataIndex: 'customsDeclarationUnitPrice',
- scopedSlots: { customRender: 'customsDeclarationUnitPrice' },
- // fixed: 'left',
- width: 180,
- className: 'replacecolor'
- },
- {
- title: '订单数量',
- dataIndex: 'orderQuantity',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '订单剩余数量',
- dataIndex: 'orderRemainingQuantity',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '发货数量',
- dataIndex: 'shipmentQuantity',
- scopedSlots: { customRender: 'shipmentQuantity' },
- width: 120,
- },
- {
- title: '套装件数',
- dataIndex: 'numberOfSets',
- scopedSlots: { customRender: 'numberOfSets' },
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '是否TC功能',
- dataIndex: 'isTC',
- width: 90,
- scopedSlots: { customRender: 'isTC' },
- className: 'replacecolor'
- },
- {
- title: '物料成分',
- dataIndex: 'materialComposition',
- scopedSlots: { customRender: 'materialComposition' },
- width: 140,
- className: 'replacecolor'
- },
- {
- title: '销售类型',
- dataIndex: 'salesTypeText',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '客户简称',
- dataIndex: 'customerAbbreviation',
- width: 220,
- align: 'left',
- className: 'replacecolor'
- },
- {
- title: '客户名称',
- dataIndex: 'customerName',
- width: 300,
- align: 'left',
- className: 'replacecolor',
- customRender: t => ellipsis(t),
- },
- {
- title: '汇率',
- dataIndex: 'exchangeRate',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '销售部门',
- dataIndex: 'salesDepartment',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '业务员',
- dataIndex: 'salesman',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '币种',
- dataIndex: 'currencyText',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '品牌方',
- dataIndex: 'brandSide',
- width: 180,
- className: 'replacecolor'
- },
- {
- title: '第三方',
- dataIndex: 'thirdParty',
- width: 220,
- align: 'left',
- className: 'replacecolor'
- },
- {
- title: '定金比例(%)',
- dataIndex: 'depositRatio',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '定金',
- dataIndex: 'deposit',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '协同路线',
- dataIndex: 'collaborativeRoute',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '佣金',
- dataIndex: 'ymoney',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '单价(销售)',
- dataIndex: 'salesUnitPrice',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '工厂单价',
- dataIndex: 'factoryUnitPrice',
- width: 120,
- scopedSlots: { customRender: 'factoryUnitPrice' },
- className: 'replacecolor'
- },
- {
- title: '付款条件',
- dataIndex: 'termOfPayment',
- width: 160,
- customRender: t => ellipsis(t),
- className: 'replacecolor'
- },
- {
- title: '最终客户',
- dataIndex: 'endCustomer',
- width: 120,
- className: 'replacecolor'
- },
- {
- title: '订单备注',
- dataIndex: 'orderRemarks',
- width: 200,
- customRender: t => ellipsis(t),
- className: 'replacecolor'
- },
- {
- title: '价格备注',
- dataIndex: 'priceRemarks',
- width: 160,
- customRender: t => ellipsis(t),
- className: 'replacecolor'
- },
- {
- title: '订单变更说明',
- dataIndex: 'orderChangeDescription',
- width: 160,
- customRender: t => ellipsis(t),
- className: 'replacecolor'
- },
- {
- title: '处理方式',
- dataIndex: 'treatmentMethod',
- width: 160,
- scopedSlots: { customRender: 'treatmentMethod' },
- className: 'replacecolor'
- },
- {
- title: '是否手册纱',
- dataIndex: 'manualYarnFlag',
- width: 140,
- scopedSlots: { customRender: 'manualYarnFlag' },
- className: 'replacecolor'
- },
- {
- title: '手册纱单价',
- dataIndex: 'manualYarnUnitPrice',
- width: 160,
- scopedSlots: { customRender: 'manualYarnUnitPrice' },
- className: 'replacecolor'
- },
- {
- title: '手册纱占比',
- dataIndex: 'manualYarnProportion',
- width: 120,
- scopedSlots: { customRender: 'manualYarnProportion' },
- className: 'replacecolor'
- },
- {
- title: '操作',
- dataIndex: 'operation',
- scopedSlots: { customRender: 'operationSlot' },
- width: 100,
- fixed: 'right',
- className: 'replacecolor'
- }
- ],
- monthStartDate:'',//本月第一天日期
- syShippingDetailsItemList: [], // 子表数据
- msgFormSon: 'test', // 子组件传来数据的变量
- manualYarnDisabled: false, //手工纱单价和手工纱占比可输入
- addShipDet: {}, // 主表信息
- visible: false,
- confirmLoading: false,
- dateFormat: 'YYYY-MM-DD',
- state: '0', // 单据状态初始未【仅保存】
- pushState: '0' // 推送状态初始未【仅保存】
- // validatorRules: {
- // documentNo: [{ required: true, message: '单据号不能为空', trigger: 'blur' }], 单据号
- }
- },
- // 接收父组件查询方法
- props: {
- fatherList: {
- type: Function,
- default: null
- }
- },
- methods: {
- //默认预发货日期
- defalutDate(){
- Date.prototype.format = function(fmt) {
- var o = {
- "M+" : this.getMonth()+1, //月份
- "Y+" : this.getFullYear(), //年
- "d+" : this.getDate(), //日
- "h+" : this.getHours(), //小时
- "m+" : this.getMinutes(), //分
- "s+" : this.getSeconds(), //秒
- "q+" : Math.floor((this.getMonth()+3)/3), //季度
- "S" : this.getMilliseconds() //毫秒
- };
- if(/(Y+)/.test(fmt)) {
- fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
- }
- for(var k in o) {
- if(new RegExp("("+ k +")").test(fmt)){
- fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
- }
- }
- return fmt;
- }
- var now = new Date(); //当前日期
- var nowMonth = now.getMonth(); //当前月
- var nowYear = now.getFullYear(); //当前年
- //本月的开始时间
- this.monthStartDate = new Date(nowYear, nowMonth, 1).format('YYYY-MM-dd');
- },
- //参照数据重置,恢复默认值
- defaultReset() {
- this.defalutDate()
- this.$refs.referOrderDataModal.range.push(this.monthStartDate)
- this.$refs.referOrderDataModal.queryParam.preDeliveryDateS = this.monthStartDate;
- this.$refs.referOrderDataModal.queryParam.preDeliveryDateE = '';
- },
- getSon(val) {
- this.manualYarnDisabled = false //初始化manualYarnDisabled
- var copyValList = JSON.parse(JSON.stringify(val));
- this.addShipDet.customer = copyValList[0].customerName;
- console.log(copyValList);
- for (var i in copyValList) {
- copyValList[i]['orderQuantity'] = copyValList[i].quantity
- copyValList[i]['orderRemainingQuantity'] = copyValList[i].surplusNum
- copyValList[i]['salesUnitPrice'] = copyValList[i].unitPriceIncludingTax
- copyValList[i]['customerOrder'] = copyValList[i].customerOrderNumber
- copyValList[i]['shipmentQuantity'] = copyValList[i].surplusNum // 订单剩余数量 赋值给发货数量
- }
- this.syShippingDetailsItemList = this.syShippingDetailsItemList.concat(copyValList);
- this.msgFormSon = this.syShippingDetailsItemList;
- this.syShippingDetailsItemList.map(item =>{
- item.customsDeclarationUnitPrice = item.salesUnitPrice - item.ymoney
- item.manualYarnFlag = 0
- this.manualYarnDisabled = true
- item.manualYarnUnitPrice = null
- item.manualYarnProportion = null
- })
- this.$forceUpdate()
- },
- // 参照订单数据
- referOrderDataOpen() {
- this.$refs.referOrderDataModal.range = []
- if(this.syShippingDetailsItemList.length !== 0){
- this.$refs.referOrderDataModal.fatherData.push(this.syShippingDetailsItemList[0])
- }
- this.$refs.referOrderDataModal.referOrderDataModVis = true
- this.defalutDate()
- this.$refs.referOrderDataModal.range.push(this.monthStartDate)
- this.$refs.referOrderDataModal.queryParam.preDeliveryDateS = this.monthStartDate;
- this.$refs.referOrderDataModal.queryParam.preDeliveryDateE = '';
- // console.log('点击参照订单数据')
- },
- // 新增 保存
- addSave() {
- 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 {
- for (var i=0; i<newObj.syShippingDetailsItemList.length; i++){
- var rowData = newObj.syShippingDetailsItemList[i];
- if (rowData.shipmentQuantity > rowData.orderRemainingQuantity){
- this.$message.error('第'+(i+1)+'行超发货数量超过订单剩余数量,无法保存');
- return;
- }
- }
- // 根据syOrderDataItemId判断重复子表id
- for (var i=0; i<newObj.syShippingDetailsItemList.length; i++){
- var rowData = newObj.syShippingDetailsItemList[i];
- for (var j=i+1;j<newObj.syShippingDetailsItemList.length; j++){
- var nextData = newObj.syShippingDetailsItemList[j];
- if (rowData.smallPo == nextData.smallPo && rowData.orderNumber == nextData.orderNumber &&
- rowData.preDeliveryDate == nextData.preDeliveryDate && rowData.preCompletionDate == nextData.preCompletionDate &&
- rowData.itemNumber == nextData.itemNumber && rowData.inventoryCode == nextData.inventoryCode&&
- rowData.colour == nextData.colour&& rowData.size == nextData.size){
- this.$message.error('第'+(i+1)+'行和第'+(j+1)+'行数据相同,无法保存');
- return;
- }
-
-
- }
- }
- for(var i=0; i<newObj.syShippingDetailsItemList.length; i++){
- var rowData = newObj.syShippingDetailsItemList[i];
- //判断输入报关单价是否为数字
- if(isNaN(Number(rowData.customsDeclarationUnitPrice,10)) && rowData.customsDeclarationUnitPrice){
- this.$message.error('第'+(i+1)+'行报关单价必须为数字!');
- return
- }
- //判断输入发货数量是否为数字
- if(isNaN(Number(rowData.shipmentQuantity,10)) && rowData.shipmentQuantity){
- this.$message.error('第'+(i+1)+'行发货数量必须为数字!');
- return
- }
- //判断输入套装件数是否为数字
- if(isNaN(Number(rowData.numberOfSets,10)) && rowData.numberOfSets){
- this.$message.error('第'+(i+1)+'行套装件数必须为数字!');
- return
- }
- //判断输入工厂单价是否为数字
- if(isNaN(Number(rowData.factoryUnitPrice,10)) && rowData.factoryUnitPrice){
- this.$message.error('第'+(i+1)+'行工厂单价必须为数字!');
- return
- }
- //判断输入工厂单价是否为数字
- if(isNaN(Number(rowData.manualYarnUnitPrice,10)) && rowData.manualYarnUnitPrice){
- this.$message.error('手册纱单价必须为数字!');
- return
- }
- //报关单价不超过四位小数
- if(!Number.isInteger(Number(rowData.customsDeclarationUnitPrice)) && rowData.customsDeclarationUnitPrice !== '' && rowData.customsDeclarationUnitPrice !== undefined){
- console.log(rowData.customsDeclarationUnitPrice)
- var position = rowData.customsDeclarationUnitPrice.toString().indexOf('.') + 1; //小数点的位置
- var digit = rowData.customsDeclarationUnitPrice.toString().length - position; //小数的位数
- if(digit > 4){
- this.$message.error('第'+(i+1)+'行报关单价超过四位小数!');
- return
- }
- }
-
- // //发货数量必须是整数
- // if(!Number.isInteger(Number(rowData.shipmentQuantity)) && rowData.shipmentQuantity !== '' && rowData.shipmentQuantity !== undefined){
- // this.$message.error('第'+(i+1)+'行发货数量不为整数!');
- // return
- // }
- //套装件数必须为整数
- if(!Number.isInteger(Number(rowData.numberOfSets)) && rowData.numberOfSets !== '' && rowData.numberOfSets !== undefined){
- this.$message.error('第'+(i+1)+'行套装件数不为整数!');
- return
- }
- //工厂单价不超过四位小数
- if(!Number.isInteger(Number(rowData.factoryUnitPrice)) && rowData.factoryUnitPrice !== '' && rowData.factoryUnitPrice !== undefined){
- var position = rowData.factoryUnitPrice.toString().indexOf('.') + 1; //小数点的位置
- var digit = rowData.factoryUnitPrice.toString().length - position; //小数的位数
- if(digit > 4){
- this.$message.error('第'+(i+1)+'行工厂单价超过四位小数!');
- return
- }
- }
- //手册纱单价不超过四位小数
- if(!Number.isInteger(Number(rowData.manualYarnUnitPrice)) && rowData.manualYarnUnitPrice !== '' && rowData.manualYarnUnitPrice !== undefined){
- console.log(rowData.factoryUnitPrice)
- var position = rowData.manualYarnUnitPrice.toString().indexOf('.') + 1; //小数点的位置
- var digit = rowData.manualYarnUnitPrice.toString().length - position; //小数的位数
- if(digit > 4){
- this.$message.error('手册纱单价超过四位小数!');
- return
- }
- }
- }
- //判断当是手册纱时,手册纱单价和手册纱占比是否为空
- for (var i=0; i<newObj.syShippingDetailsItemList.length; i++){
- var rowData = newObj.syShippingDetailsItemList[i];
- if((rowData.manualYarnFlag === 1 && !rowData.manualYarnUnitPrice) || (rowData.manualYarnFlag === 1 && rowData.manualYarnUnitPrice === '')|| (rowData.manualYarnFlag === 1 && rowData.manualYarnProportion === "0") || (rowData.manualYarnFlag === 1 && rowData.manualYarnProportion === 0) ){
- this.$message.error('手册纱单价为必填项');
- return
- }else if((rowData.manualYarnFlag === 1 && !rowData.manualYarnProportion) || (rowData.manualYarnFlag === 1 && rowData.manualYarnProportion === '') || (rowData.manualYarnFlag === 1 && rowData.manualYarnProportion === "0") || (rowData.manualYarnFlag === 1 && rowData.manualYarnProportion === 0)){
- this.$message.error('手册纱占比为必填项');
- return
- }
- }
-
- addShipmentList(newObj).then(res => {
- if (res.success) {
- this.$message.success('新增成功');
- this.close();
- // 清空信息
- this.addShipDet = {};
- this.addShipDet.syShippingDetailsItemList = [];
- // this.fatherList(); // 调用父组件 查询方法
- // this.msgFormSon = {} 清空子表信息
- }else{
- this.$message.error(res.message);
- }
- })
- }
- }else{
- return false;
- }
- });
-
- // const that = this
- // // 触发表单验证
- // this.$refs.form.validate(valid => {
- // if (valid) {
- // that.confirmLoading = true
- // }
- // })
- },
- // 校验复制行数量和不能超订单,根据syOrderDataItemId判断
- // 増行
- // handleAddColumn() {
- // console.log('増行')
- // const addrow = {
- // accountSet: '',
- // documentNo: '',
- // itemNumber: '',
- // orderDate: '',
- // businessType: '',
- // customerOrder: '',
- // smallPo: '',
- // packId: '',
- // orderDate: '',
- // orderRemaQuantity: '',
- // shipQuantity: '',
- // isTC: '',
- // materialComposition: '',
- // saleType: '',
- // customerShortName: '',
- // customerName: '',
- // exchangeRate: '',
- // wholeSingleCombined: '',
- // salesDepartment: '',
- // salesman: '',
- // currency: '',
- // brand: '',
- // thirdParty: '',
- // depositRate: '',
- // deposit: '',
- // collaborativeRoute: '',
- // paymentClause: '',
- // finalCustomer: '',
- // orderNote: '',
- // priceNote: '',
- // orderChangeDesc: '',
- // operation: ''
- // }
- // this.syShippingDetailsItemList.push(addrow)
- // },
- // --------------------------------------
- // 操作 删除
- handleDelete(index) {
- return this.syShippingDetailsItemList.splice(index, 1)
- },
- // 操作 复制 复制一行已有的数据
- copy(record) {
- var newRecord = JSON.parse(JSON.stringify(record));
- this.syShippingDetailsItemList.push(newRecord)
- },
- handleCancel() {
- this.close()
- },
- close() {
- this.$emit('close');
- this.visible = false;
- this.addShipDet = {};
- this.syShippingDetailsItemList = [];
- },
- // 参照订单数据弹框 ok-------------------------------------
- referOrderDataOk() {
- // console.log('参照订单数据弹框确定')
- this.$refs.referOrderDataModal.referOrderDataModVis = false;
- this.$refs.referOrderDataModal.queryParam.orderNumber="";
- this.$refs.referOrderDataModal.queryParam.account="";
- this.$refs.referOrderDataModal.queryParam.salesman="";
- this.$refs.referOrderDataModal.queryParam.customerName="";
- this.$refs.referOrderDataModal.queryParam.dateRange=[];
- this.$refs.referOrderDataModal.queryParam.preDeliveryDate="";
- this.$refs.referOrderDataModal.queryParam.flourOrGarment="";
- },
-
- //修改是否为手册纱时触发
- changeManualYarnFlag(val) {
- this.syShippingDetailsItemList.map(item =>{
- item.manualYarnFlag = null
- item.manualYarnFlag = val
- //是手工纱时
- if(val === 0){
- item.manualYarnUnitPrice = 0
- item.manualYarnProportion = 0
- this.manualYarnDisabled = true
- }else {
- this.manualYarnDisabled = false
- }
- })
- this.$forceUpdate()
- },
-
- //输入手册纱单价或者手册纱占比时触发
- changeManualYarn(data,val){
- console.log(this.syShippingDetailsItemList)
- this.syShippingDetailsItemList.map(item => {
- if(data === 'Price'){item.manualYarnUnitPrice = val}
- else{item.manualYarnProportion = val}
- })
- this.$forceUpdate()
- }
- }
- }
- </script>
- <style lang="less" scoped>
- @import '~@assets/less/common.less';
- /deep/ .ant-table-thead > tr > th {
- text-align: center;
- // font-weight: 700;
- }
- /deep/ .ant-table-tbody {
- text-align: center;
- }
- // /deep/ th.replacecolor {
- // background-color: #ccc;
- // }
- // 抽屉里的card样式
- /deep/ .ant-drawer-content {
- background-color: #f0f2f5;
- }
- /deep/ .ant-drawer-body {
- padding: 10px;
- }
- // 子表下拉显示
- /deep/ .ant-card-body {
- margin-bottom: 60px;
- }
- </style>
|