addShipDetDrawer.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. <template>
  2. <!-- 新增发运明细 -->
  3. <div id="AddShipDetDrawer">
  4. <a-drawer
  5. title="新增发运明细"
  6. width="89%"
  7. placement="right"
  8. :closable="true"
  9. :visible="visible"
  10. @close="handleCancel"
  11. >
  12. <!-- 主表信息 填写-->
  13. <a-card :bordered="true">
  14. <div class="table-page-search-wrapper">
  15. <!-- :rules="validatorRules" -->
  16. <a-form-model layout="inline" ref="form" :model="addShipDet">
  17. <a-row :gutter="24">
  18. <a-col :md="6" :sm="8">
  19. <!-- required必填项 disabled 禁用 -->
  20. <a-form-model-item label="单据号" prop="documentNo">
  21. <a-input placeholder="请输入单据号" v-model="addShipDet.documentNo"></a-input>
  22. </a-form-model-item>
  23. </a-col>
  24. <a-col :md="6" :sm="8">
  25. <a-form-model-item label="单据日期" prop="documentDate">
  26. <a-date-picker
  27. placeholder="请选择单据日期"
  28. :format="dateFormat"
  29. style="width:100%;"
  30. v-model="addShipDet.documentDate"
  31. />
  32. </a-form-model-item>
  33. </a-col>
  34. <a-col :md="6" :sm="8">
  35. <a-form-model-item label="客户" prop="customer">
  36. <a-input placeholder="请输入客户" v-model="addShipDet.customer"></a-input>
  37. </a-form-model-item>
  38. </a-col>
  39. <a-col :md="6" :sm="8">
  40. <a-form-model-item label="预发货日期" prop="preDeliveryDate">
  41. <a-date-picker
  42. placeholder="请选择预发货时间"
  43. :format="dateFormat"
  44. style="width:100%;"
  45. v-model="addShipDet.preDeliveryDate"
  46. />
  47. </a-form-model-item>
  48. </a-col>
  49. <a-col :md="6" :sm="8">
  50. <a-form-model-item label="预完工日期" prop="preCompletionDate">
  51. <a-date-picker
  52. placeholder="请选择预完工日期"
  53. :format="dateFormat"
  54. style="width:100%;"
  55. v-model="addShipDet.preCompletionDate"
  56. />
  57. </a-form-model-item>
  58. </a-col>
  59. <a-col :md="6" :sm="8">
  60. <a-form-model-item label="pack id" prop="packId">
  61. <a-input placeholder="请输入pack id" v-model="addShipDet.packId"></a-input>
  62. </a-form-model-item>
  63. </a-col>
  64. <a-col :md="6" :sm="8">
  65. <a-form-model-item label="分销点" prop="distributionPoint">
  66. <a-input placeholder="请输入分销点" v-model="addShipDet.distributionPoint"></a-input>
  67. </a-form-model-item>
  68. </a-col>
  69. <a-col :md="6" :sm="8">
  70. <a-form-model-item label="数量" prop="todo">
  71. <a-input placeholder="合计" v-model="addShipDet.todo"></a-input>
  72. </a-form-model-item>
  73. </a-col>
  74. <a-col :md="6" :sm="8">
  75. <a-form-model-item label="单价" prop="salesUnitPrice">
  76. <a-input placeholder="销售" v-model="addShipDet.salesUnitPrice"></a-input>
  77. </a-form-model-item>
  78. </a-col>
  79. <a-col :md="6" :sm="8">
  80. <a-form-model-item label="采购/委外订单号" prop="purOrSubOrder">
  81. <a-input placeholder="请输入采购/委外订单号" v-model="addShipDet.purOrSubOrder"></a-input>
  82. </a-form-model-item>
  83. </a-col>
  84. <a-col :md="6" :sm="8">
  85. <a-form-model-item label="订单类型" prop="orderType">
  86. <a-input placeholder="请输入订单类型" v-model="addShipDet.orderType"></a-input>
  87. </a-form-model-item>
  88. </a-col>
  89. <a-col :md="6" :sm="8">
  90. <a-form-model-item label="工厂单价" prop="factoryUnitPrice">
  91. <a-input placeholder="采购/委外单价" v-model="addShipDet.factoryUnitPrice"></a-input>
  92. </a-form-model-item>
  93. </a-col>
  94. <a-col :md="6" :sm="8">
  95. <a-form-model-item label="申报要素" prop="declarationElements">
  96. <a-input placeholder="单证维护" v-model="addShipDet.declarationElements"></a-input>
  97. </a-form-model-item>
  98. </a-col>
  99. <a-col :md="6" :sm="8">
  100. <a-form-model-item label="套装件数" prop="numberOfSets">
  101. <a-input placeholder="存货自定义项" v-model="addShipDet.numberOfSets"></a-input>
  102. </a-form-model-item>
  103. </a-col>
  104. <a-col :md="6" :sm="8">
  105. <a-form-model-item label="中文品名" prop="chineseName">
  106. <a-input placeholder="请输入中文品名" v-model="addShipDet.chineseName"></a-input>
  107. </a-form-model-item>
  108. </a-col>
  109. <a-col :md="6" :sm="8">
  110. <a-form-model-item label="英文品名" prop="englishName">
  111. <a-input placeholder="请输入英文品名" v-model="addShipDet.englishName"></a-input>
  112. </a-form-model-item>
  113. </a-col>
  114. <a-col :md="6" :sm="8">
  115. <a-form-model-item label="成衣工厂" prop="garmentFactory">
  116. <a-input placeholder="请输入成衣工厂" v-model="addShipDet.garmentFactory"></a-input>
  117. </a-form-model-item>
  118. </a-col>
  119. <a-col :md="6" :sm="8">
  120. <a-form-model-item label="报关单价" prop="customsDeclarationUnitPrice">
  121. <a-input placeholder="请输入报关单价" v-model="addShipDet.customsDeclarationUnitPrice"></a-input>
  122. </a-form-model-item>
  123. </a-col>
  124. <!-- U8系统适用 -->
  125. <a-col :md="12" :sm="12">
  126. <a-form-model-item label="备注" prop="memo">
  127. <a-input placeholder="U8系统适用" v-model="addShipDet.memo"></a-input>
  128. </a-form-model-item>
  129. </a-col>
  130. </a-row>
  131. </a-form-model>
  132. </div>
  133. </a-card>
  134. <!-- 参照订单数据 増行-->
  135. <a-card :bordered="true" style="margin:10px 0">
  136. <div class="table-operator">
  137. <a-button type="primary" @click.stop="referOrderDataOpen" icon="ordered-list">参照订单数据</a-button>
  138. <a-button type="primary" @click.stop="handleAddColumn" icon="plus" style="margin-left: 20px">増行</a-button>
  139. </div>
  140. <!-- 子表 :model="form" rowKey="id" ,y:800 -->
  141. <a-spin :spinning="confirmLoading">
  142. <a-form-model ref="formRef">
  143. <a-table
  144. :loading="loading"
  145. v-if="syShippingDetailsItemList"
  146. bordered
  147. :rowKey="record => record.id"
  148. :columns="columns"
  149. :data-source="syShippingDetailsItemList"
  150. :pagination="false"
  151. :scroll="{ x: 1500 }"
  152. size="small"
  153. >
  154. <!-- 款号 输入框 :rules="rules.itemNumber" -->
  155. <template slot="itemNumber" slot-scope="text, record, index">
  156. <a-form-model-item prop="itemNumber">
  157. <a-input style="width:100%" type="text" v-model="record.itemNumber" />
  158. </a-form-model-item>
  159. </template>
  160. <!-- 发货数量 :rules="rules.shipQuantity"-->
  161. <template slot="shipQuantity" slot-scope="text, record, index">
  162. <a-form-model-item prop="shipmentQuantity">
  163. <a-input style="width:100%" type="text" v-model="record.shipQuantity" />
  164. </a-form-model-item>
  165. </template>
  166. <!-- 是否TC功能 :rules="rules.isTC"-->
  167. <!-- isTc ' 是否 tc 功能 0 否 1 是', -->
  168. <template slot="isTC" slot-scope="text, record, index">
  169. <a-form-model-item prop="isTc">
  170. <a-select v-model="record.isTC">
  171. <a-select-option value="">请选择</a-select-option>
  172. <a-select-option :value="1">是</a-select-option>
  173. <a-select-option :value="0">否</a-select-option>
  174. </a-select>
  175. </a-form-model-item>
  176. </template>
  177. <!-- 物料成分 :rules="rules.materialComposition"-->
  178. <template slot="materialComposition" slot-scope="text, record, index">
  179. <a-form-model-item prop="materialComposition">
  180. <a-input style="width:100%" type="text" v-model="record.materialComposition" />
  181. </a-form-model-item>
  182. </template>
  183. <!-- 操作 -->
  184. <template slot="operationSlot" slot-scope="text, record, index">
  185. <a-popconfirm
  186. v-if="syShippingDetailsItemList.length"
  187. title="确定删除吗?"
  188. @confirm="handleDelete(index)"
  189. >
  190. <a href="javascript:void(0);" style="color:red;">删除</a>
  191. </a-popconfirm>
  192. <a-divider type="vertical" />
  193. <a @click="copy(record)">复制</a>
  194. </template>
  195. </a-table>
  196. </a-form-model>
  197. </a-spin>
  198. </a-card>
  199. <!-- 页面底部保存取消 -->
  200. <div
  201. :style="{
  202. position: 'absolute',
  203. right: 0,
  204. bottom: 0,
  205. width: '100%',
  206. borderTop: '1px solid #e9e9e9',
  207. padding: '10px 16px',
  208. background: '#fff',
  209. textAlign: 'right',
  210. zIndex: 1
  211. }"
  212. >
  213. <a-popconfirm title="确定放弃新增?" @confirm="handleCancel" okText="确定" cancelText="取消">
  214. <a-button :style="{ marginRight: '8px' }">取消</a-button>
  215. </a-popconfirm>
  216. <a-button type="primary" @click="addSave">
  217. 保存
  218. </a-button>
  219. </div>
  220. </a-drawer>
  221. <!-- 参照订单数据弹框 -->
  222. <referOrderData-modal ref="referOrderDataModal" @bao="getSon" @ok="referOrderDataOk"></referOrderData-modal>
  223. </div>
  224. </template>
  225. <script>
  226. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  227. import JEllipsis from '@/components/jeecg/JEllipsis'
  228. import moment from 'moment'
  229. // import 'moment/locale/zh-cn'
  230. import ReferOrderDataModal from '@views/shipment-details/referOrderDataModal.vue'
  231. import { addShipmentList } from '@api/document/shipmentList'
  232. export default {
  233. name: 'AddShipDetDrawer', // 新增 发运明细 抽屉
  234. mixins: [JeecgListMixin],
  235. components: { JEllipsis, ReferOrderDataModal, moment }, // 参照订单数据 弹框
  236. data() {
  237. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
  238. return {
  239. id: '',
  240. // 表头
  241. columns: [
  242. {
  243. title: '账套',
  244. dataIndex: 'pkOrg',
  245. width: 80,
  246. fixed: 'left',
  247. className: 'replacecolor'
  248. },
  249. {
  250. title: '订单号',
  251. dataIndex: 'orderNumber',
  252. width: 120,
  253. fixed: 'left',
  254. className: 'replacecolor'
  255. },
  256. {
  257. title: '款号',
  258. dataIndex: 'itemNumber',
  259. scopedSlots: { customRender: 'itemNumber' },
  260. fixed: 'left',
  261. width: 180,
  262. className: 'replacecolor'
  263. },
  264. // {
  265. // title: '创建时间',
  266. // dataIndex: 'createTime',
  267. // align: 'center',
  268. // sorter: true,
  269. // customRender: text => {
  270. // return moment(text).format('YYYY-MM-DD')
  271. // }
  272. // },
  273. {
  274. title: '订单日期',
  275. dataIndex: 'orderDate',
  276. width: 120,
  277. className: 'replacecolor'
  278. },
  279. {
  280. title: '业务类型',
  281. dataIndex: 'businessTypeText',
  282. width: 120,
  283. className: 'replacecolor'
  284. },
  285. {
  286. title: '客户订单',
  287. dataIndex: 'customerOrderNumber',
  288. width: 120,
  289. className: 'replacecolor'
  290. },
  291. {
  292. title: '小po',
  293. dataIndex: 'smallPo',
  294. width: 120,
  295. className: 'replacecolor'
  296. },
  297. {
  298. title: 'Pack Id',
  299. dataIndex: 'packId',
  300. width: 120,
  301. className: 'replacecolor'
  302. },
  303. {
  304. title: '订单数据',
  305. dataIndex: 'orderDate',
  306. width: 120,
  307. className: 'replacecolor'
  308. },
  309. {
  310. title: '订单剩余数量',
  311. dataIndex: 'orderRemainingQuantity',
  312. width: 120,
  313. className: 'replacecolor'
  314. },
  315. {
  316. title: '发货数量',
  317. dataIndex: 'shipQuantity',
  318. scopedSlots: { customRender: 'shipQuantity' },
  319. width: 120,
  320. className: 'replacecolor'
  321. },
  322. {
  323. title: '是否TC功能',
  324. dataIndex: 'isTC',
  325. width: 90,
  326. scopedSlots: { customRender: 'isTC' },
  327. className: 'replacecolor'
  328. },
  329. {
  330. title: '物料成分',
  331. dataIndex: 'materialComposition',
  332. scopedSlots: { customRender: 'materialComposition' },
  333. width: 140,
  334. className: 'replacecolor'
  335. },
  336. {
  337. title: '销售类型',
  338. dataIndex: 'salesTypeText',
  339. width: 120,
  340. className: 'replacecolor'
  341. },
  342. {
  343. title: '客户简称',
  344. dataIndex: 'customerAbbreviation',
  345. width: 120,
  346. className: 'replacecolor'
  347. },
  348. {
  349. title: '客户名称',
  350. dataIndex: 'customerName',
  351. width: 120,
  352. className: 'replacecolor'
  353. },
  354. {
  355. title: '汇率',
  356. dataIndex: 'exchangeRate',
  357. width: 120,
  358. className: 'replacecolor'
  359. },
  360. {
  361. title: '整单合计',
  362. dataIndex: 'wholeOrderTotal',
  363. width: 120,
  364. className: 'replacecolor'
  365. },
  366. {
  367. title: '销售部门',
  368. dataIndex: 'salesDepartment',
  369. width: 120,
  370. className: 'replacecolor'
  371. },
  372. {
  373. title: '业务员',
  374. dataIndex: 'salesman',
  375. width: 120,
  376. className: 'replacecolor'
  377. },
  378. {
  379. title: '币种',
  380. dataIndex: 'currencyText',
  381. width: 120,
  382. className: 'replacecolor'
  383. },
  384. {
  385. title: '品牌方',
  386. dataIndex: 'brandSide',
  387. width: 120,
  388. className: 'replacecolor'
  389. },
  390. {
  391. title: '第三方',
  392. dataIndex: 'thirdParty',
  393. width: 120,
  394. className: 'replacecolor'
  395. },
  396. {
  397. title: '定金比例(%)',
  398. dataIndex: 'depositRatio',
  399. width: 120,
  400. className: 'replacecolor'
  401. },
  402. {
  403. title: '定金',
  404. dataIndex: 'deposit',
  405. width: 120,
  406. className: 'replacecolor'
  407. },
  408. {
  409. title: '协同路线',
  410. dataIndex: 'collaborativeRoute',
  411. width: 120,
  412. className: 'replacecolor'
  413. },
  414. {
  415. title: '付款条件',
  416. dataIndex: 'termOfPayment',
  417. width: 160,
  418. customRender: t => ellipsis(t),
  419. className: 'replacecolor'
  420. },
  421. {
  422. title: '最终客户',
  423. dataIndex: 'endCustomer',
  424. width: 120,
  425. className: 'replacecolor'
  426. },
  427. {
  428. title: '订单备注',
  429. dataIndex: 'orderRemarks',
  430. width: 160,
  431. customRender: t => ellipsis(t),
  432. className: 'replacecolor'
  433. },
  434. {
  435. title: '价格备注',
  436. dataIndex: 'priceRemarks',
  437. width: 160,
  438. customRender: t => ellipsis(t),
  439. className: 'replacecolor'
  440. },
  441. {
  442. title: '订单变更说明',
  443. dataIndex: 'orderChangeDescription',
  444. width: 160,
  445. customRender: t => ellipsis(t),
  446. className: 'replacecolor'
  447. },
  448. {
  449. title: '操作',
  450. dataIndex: 'operation',
  451. scopedSlots: { customRender: 'operationSlot' },
  452. width: 160,
  453. fixed: 'right',
  454. className: 'replacecolor'
  455. }
  456. ],
  457. msgFormSon: 'test', // 子组件传来数据的变量
  458. syShippingDetailsItemList: [], // 子表数据
  459. addShipDet: {}, // 新增发运明细
  460. visible: false,
  461. confirmLoading: false,
  462. dateFormat: 'YYYY-MM-DD',
  463. state: '0', // 单据状态初始未【仅保存】
  464. pushState: '0' // 推送状态初始未【仅保存】
  465. // validatorRules: {
  466. // documentNo: [{ required: true, message: '单据号不能为空', trigger: 'blur' }], 单据号
  467. }
  468. },
  469. // 接收父组件查询方法
  470. props: {
  471. fatherList: {
  472. type: Function,
  473. default: null
  474. }
  475. },
  476. created() {},
  477. methods: {
  478. getSon(val) {
  479. console.log('勾选订单数据', val)
  480. this.msgFormSon = val
  481. this.syShippingDetailsItemList = this.msgFormSon
  482. console.log('新增页 子表信息', this.syShippingDetailsItemList)
  483. },
  484. // 参照订单数据
  485. referOrderDataOpen() {
  486. this.$refs.referOrderDataModal.referOrderDataModVis = true
  487. console.log('点击参照订单数据')
  488. },
  489. // 新增 保存
  490. addSave() {
  491. var newObj = {} // 新增对象
  492. newObj.documentNo = this.addShipDet.documentNo
  493. newObj.documentDate = this.addShipDet.documentDate.format('YYYY-MM-DD')
  494. newObj.customer = this.addShipDet.customer
  495. newObj.preDeliveryDate = this.addShipDet.preDeliveryDate.format('YYYY-MM-DD') // 预发货日期
  496. newObj.preCompletionDate = this.addShipDet.preCompletionDate.format('YYYY-MM-DD') // 预完工日期
  497. // 2022-06-10 增加的字段
  498. newObj.packId = this.addShipDet.packId
  499. newObj.distributionPoint = this.addShipDet.distributionPoint
  500. newObj.todo = this.addShipDet.todo //数量(合计)
  501. newObj.salesUnitPrice = this.addShipDet.salesUnitPrice
  502. newObj.purOrSubOrder = this.addShipDet.purOrSubOrder
  503. newObj.orderType = this.addShipDet.orderType
  504. newObj.factoryUnitPrice = this.addShipDet.factoryUnitPrice
  505. newObj.declarationElements = this.addShipDet.declarationElements
  506. newObj.numberOfSets = this.addShipDet.numberOfSets
  507. newObj.chineseName = this.addShipDet.chineseName
  508. newObj.englishName = this.addShipDet.englishName
  509. newObj.garmentFactory = this.addShipDet.garmentFactory
  510. newObj.customsDeclarationUnitPrice = this.addShipDet.customsDeclarationUnitPrice
  511. newObj.memo = this.addShipDet.memo // U8系统适用
  512. newObj.syShippingDetailsItemList = this.syShippingDetailsItemList // 子表信息赋值
  513. // 单据状态
  514. // newObj.state = this.state
  515. // newObj.pushState = this.pushState
  516. // 必须选择子表 --- 参照订单数据
  517. if (newObj.syShippingDetailsItemList.length == 0) {
  518. this.$message.error('请选择参照订单数据')
  519. } else {
  520. addShipmentList(newObj).then(res => {
  521. if (res.success) {
  522. this.$message.success('新增成功')
  523. console.log('新增的对象', newObj)
  524. this.close()
  525. //清空信息
  526. newObj = {}
  527. newObj.syShippingDetailsItemList = []
  528. this.fatherList() // 调用父组件 查询方法
  529. // this.msgFormSon = {} 清空子表信息
  530. console.log('空')
  531. }
  532. })
  533. }
  534. },
  535. // 増行
  536. handleAddColumn() {
  537. console.log('増行')
  538. const addrow = {
  539. accountSet: '',
  540. documentNo: '',
  541. itemNumber: '',
  542. orderDate: '',
  543. businessType: '',
  544. customerOrder: '',
  545. smallPo: '',
  546. packId: '',
  547. orderDate: '',
  548. orderRemaQuantity: '',
  549. shipQuantity: '',
  550. isTC: '',
  551. materialComposition: '',
  552. saleType: '',
  553. customerShortName: '',
  554. customerName: '',
  555. exchangeRate: '',
  556. wholeSingleCombined: '',
  557. salesDepartment: '',
  558. salesman: '',
  559. currency: '',
  560. brand: '',
  561. thirdParty: '',
  562. depositRate: '',
  563. deposit: '',
  564. collaborativeRoute: '',
  565. paymentClause: '',
  566. finalCustomer: '',
  567. orderNote: '',
  568. priceNote: '',
  569. orderChangeDesc: '',
  570. operation: ''
  571. }
  572. this.syShippingDetailsItemList.push(addrow)
  573. },
  574. // --------------------------------------
  575. // 操作 删除
  576. handleDelete(index) {
  577. console.log('index', index)
  578. console.log('删除该项订单数据', index)
  579. return this.syShippingDetailsItemList.splice(index, 1)
  580. },
  581. // 操作 复制 复制一行已有的数据
  582. copy(record) {},
  583. // --------------------------------------
  584. // 抽屉 取消
  585. handleCancel() {
  586. this.close()
  587. },
  588. // --------------------------------------
  589. close() {
  590. this.$emit('close')
  591. this.visible = false
  592. this.addShipDet = {}
  593. this.syShippingDetailsItemList = []
  594. },
  595. // 参照订单数据弹框 ok-------------------------------------
  596. referOrderDataOk() {
  597. console.log('参照订单数据弹框确定')
  598. this.$refs.referOrderDataModal.referOrderDataModVis = false
  599. }
  600. },
  601. computed: {},
  602. mounted() {}
  603. }
  604. </script>
  605. <style lang="less" scoped>
  606. @import '~@assets/less/common.less';
  607. /deep/ .ant-table-thead > tr > th {
  608. text-align: center;
  609. // font-weight: 700;
  610. }
  611. /deep/ .ant-table-tbody {
  612. text-align: center;
  613. }
  614. // /deep/ th.replacecolor {
  615. // background-color: #ccc;
  616. // }
  617. // 抽屉里的card样式
  618. /deep/ .ant-drawer-content {
  619. background-color: #f0f2f5;
  620. }
  621. /deep/ .ant-drawer-body {
  622. padding: 10px;
  623. }
  624. // 子表下拉显示
  625. /deep/ .ant-card-body {
  626. margin-bottom: 50px;
  627. }
  628. </style>