addShipDetDrawer.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  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. <a-form-model layout="inline" ref="form" :model="addShipDet" :rules="validatorRules">
  16. <a-row :gutter="24">
  17. <a-col :md="6" :sm="8">
  18. <a-form-model-item label="单据号" prop="orderNum">
  19. <a-input placeholder="请输入单据号" v-model="addShipDet.orderNum"></a-input>
  20. </a-form-model-item>
  21. </a-col>
  22. <a-col :md="6" :sm="8">
  23. <a-form-model-item label="单据日期" required prop="billDate">
  24. <a-date-picker
  25. placeholder="请选择单据日期"
  26. :format="dateFormat"
  27. style="width:100%;"
  28. v-model="addShipDet.billDate"
  29. />
  30. </a-form-model-item>
  31. </a-col>
  32. <a-col :md="6" :sm="8">
  33. <a-form-model-item label="客户" prop="customer">
  34. <a-input placeholder="请输入客户" v-model="addShipDet.customer"></a-input>
  35. </a-form-model-item>
  36. </a-col>
  37. <a-col :md="6" :sm="8">
  38. <a-form-model-item label="预发货日期" required prop="scheduledShipDate">
  39. <a-date-picker
  40. placeholder="请选择预发货时间"
  41. :format="dateFormat"
  42. style="width:100%;"
  43. v-model="addShipDet.scheduledShipDate"
  44. />
  45. </a-form-model-item>
  46. </a-col>
  47. <a-col :md="6" :sm="8">
  48. <a-form-model-item label="预完工日期" required prop="scheduledDoneDate">
  49. <a-date-picker
  50. placeholder="请选择预完工时间"
  51. :format="dateFormat"
  52. style="width:100%;"
  53. v-model="addShipDet.scheduledDoneDate"
  54. />
  55. </a-form-model-item>
  56. </a-col>
  57. <a-col :md="18" :sm="18">
  58. <a-form-model-item label="备注" prop="note">
  59. <a-input placeholder="请输入备注" v-model="addShipDet.note"></a-input>
  60. </a-form-model-item>
  61. </a-col>
  62. </a-row>
  63. </a-form-model>
  64. </div>
  65. </a-card>
  66. <!-- 参照订单数据 増行-->
  67. <a-card :bordered="true" style="margin:10px 0">
  68. <div class="table-operator">
  69. <a-button type="primary" @click="referOrderDataOpen" icon="ordered-list">参照订单数据</a-button>
  70. <a-button type="primary" @click="handleAddColumn" icon="plus" style="margin-left: 20px">増行</a-button>
  71. </div>
  72. <!-- 子表 :model="form" :pagination="ipagination" -->
  73. <a-spin :spinning="confirmLoading">
  74. <a-form-model ref="formRef" :rules="validatorRules">
  75. <a-table
  76. bordered
  77. :row-key="record => record.id"
  78. :columns="columns"
  79. :data-source="data"
  80. :loading="loading"
  81. :pagination="false"
  82. :scroll="{ x: 1500 }"
  83. @change="handleTableChange"
  84. >
  85. <!-- 款号 输入框 -->
  86. <template slot="styleNum" slot-scope="text, record, index">
  87. <a-form-model-item prop="styleNum" :rules="rules.styleNum" required>
  88. <a-input style="width:100%" type="text" v-model="record.styleNum" />
  89. </a-form-model-item>
  90. </template>
  91. <!-- 发货数量 -->
  92. <template slot="shipQuantity" slot-scope="text, record, index">
  93. <a-form-model-item prop="styleNum" :rules="rules.shipQuantity">
  94. <a-input style="width:100%" type="text" v-model="record.shipQuantity" />
  95. </a-form-model-item>
  96. </template>
  97. <!-- 是否TC功能 -->
  98. <template slot="isTC" slot-scope="text, record, index">
  99. <a-form-model-item prop="isEnable" :rules="rules.isTC">
  100. <a-select v-model="record.isTC">
  101. <a-select-option :value="1">是</a-select-option>
  102. <a-select-option :value="2">否</a-select-option>
  103. </a-select>
  104. </a-form-model-item>
  105. </template>
  106. <!-- 物料成分 -->
  107. <template slot="materialComposition" slot-scope="text, record, index">
  108. <a-form-model-item prop="styleNum" :rules="rules.materialComposition">
  109. <a-input style="width:100%" type="text" v-model="record.materialComposition" />
  110. </a-form-model-item>
  111. </template>
  112. <!-- 操作 -->
  113. <span slot="operationSlot" slot-scope="text, record">
  114. <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(record.id)">
  115. <a href="javascript:void(0);" style="color:red;">删除</a>
  116. </a-popconfirm>
  117. <a-divider type="vertical" />
  118. <a @click="copy(record)">复制</a>
  119. </span>
  120. </a-table>
  121. </a-form-model>
  122. </a-spin>
  123. </a-card>
  124. <!-- 页面底部保存取消 -->
  125. <div
  126. :style="{
  127. position: 'absolute',
  128. right: 0,
  129. bottom: 0,
  130. width: '100%',
  131. borderTop: '1px solid #e9e9e9',
  132. padding: '10px 16px',
  133. background: '#fff',
  134. textAlign: 'right',
  135. zIndex: 1
  136. }"
  137. >
  138. <a-popconfirm title="确定放弃新增?" @confirm="handleCancel" okText="确定" cancelText="取消">
  139. <a-button :style="{ marginRight: '8px' }">取消</a-button>
  140. </a-popconfirm>
  141. <a-button type="primary" @click="submitAdd">
  142. 提交
  143. </a-button>
  144. </div>
  145. </a-drawer>
  146. <!-- 参照订单数据弹框 -->
  147. <referOrderData-modal ref="referOrderDataModal" :father="aa" @ok="referOrderDataOk"></referOrderData-modal>
  148. </div>
  149. </template>
  150. <script>
  151. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  152. import JEllipsis from '@/components/jeecg/JEllipsis'
  153. import moment from 'moment'
  154. import ReferOrderDataModal from '@views/shipment-details/referOrderDataModal.vue'
  155. export default {
  156. name: 'AddShipDetDrawer', // 新增 发运明细 抽屉
  157. mixins: [JeecgListMixin],
  158. components: { JEllipsis, ReferOrderDataModal, moment }, // 参照订单数据 弹框
  159. data() {
  160. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
  161. return {
  162. id: '',
  163. // 表头
  164. columns: [
  165. {
  166. title: '账套',
  167. dataIndex: 'accountSet',
  168. width: 120,
  169. fixed: 'left',
  170. className: 'replacecolor'
  171. },
  172. {
  173. title: '订单号',
  174. dataIndex: 'orderNum',
  175. width: 120,
  176. fixed: 'left',
  177. className: 'replacecolor'
  178. },
  179. {
  180. title: '款号',
  181. dataIndex: 'styleNum',
  182. scopedSlots: { customRender: 'styleNum' },
  183. fixed: 'left',
  184. width: 180,
  185. className: 'replacecolor'
  186. },
  187. // {
  188. // title: '创建时间',
  189. // dataIndex: 'createTime',
  190. // align: 'center',
  191. // sorter: true,
  192. // customRender: text => {
  193. // return moment(text).format('YYYY-MM-DD')
  194. // }
  195. // },
  196. {
  197. title: '订单日期',
  198. dataIndex: 'orderDate',
  199. width: 120,
  200. className: 'replacecolor'
  201. },
  202. {
  203. title: '业务类型',
  204. dataIndex: 'businessType',
  205. width: 120,
  206. className: 'replacecolor'
  207. },
  208. {
  209. title: '客户订单',
  210. dataIndex: 'customerOrder',
  211. width: 120,
  212. className: 'replacecolor'
  213. },
  214. {
  215. title: '小po',
  216. dataIndex: 'smallPo',
  217. width: 120,
  218. className: 'replacecolor'
  219. },
  220. {
  221. title: 'Pack Id',
  222. dataIndex: 'packId',
  223. width: 120,
  224. className: 'replacecolor'
  225. },
  226. {
  227. title: '订单数据',
  228. dataIndex: 'orderData',
  229. width: 120,
  230. className: 'replacecolor'
  231. },
  232. {
  233. title: '订单剩余数量',
  234. dataIndex: 'orderRemaQuantity',
  235. width: 120,
  236. className: 'replacecolor'
  237. },
  238. {
  239. title: '发货数量',
  240. dataIndex: 'shipQuantity',
  241. scopedSlots: { customRender: 'shipQuantity' },
  242. width: 120,
  243. className: 'replacecolor'
  244. },
  245. {
  246. title: '是否TC功能',
  247. dataIndex: 'isTC',
  248. width: 90,
  249. scopedSlots: { customRender: 'isTC' },
  250. className: 'replacecolor'
  251. },
  252. {
  253. title: '物料成分',
  254. dataIndex: 'materialComposition',
  255. scopedSlots: { customRender: 'materialComposition' },
  256. width: 140,
  257. className: 'replacecolor'
  258. },
  259. {
  260. title: '销售类型',
  261. dataIndex: 'saleType',
  262. width: 120,
  263. className: 'replacecolor'
  264. },
  265. {
  266. title: '客户简称',
  267. dataIndex: 'customerShortName',
  268. width: 120,
  269. className: 'replacecolor'
  270. },
  271. {
  272. title: '客户名称',
  273. dataIndex: 'customerName',
  274. width: 120,
  275. className: 'replacecolor'
  276. },
  277. {
  278. title: '汇率',
  279. dataIndex: 'exchangeRate',
  280. width: 120,
  281. className: 'replacecolor'
  282. },
  283. {
  284. title: '整单合计',
  285. dataIndex: 'wholeSingleCombined',
  286. width: 120,
  287. className: 'replacecolor'
  288. },
  289. {
  290. title: '销售部门',
  291. dataIndex: 'salesDepartment',
  292. width: 120,
  293. className: 'replacecolor'
  294. },
  295. {
  296. title: '业务员',
  297. dataIndex: 'salesman',
  298. width: 120,
  299. className: 'replacecolor'
  300. },
  301. {
  302. title: '币种',
  303. dataIndex: 'currency',
  304. width: 120,
  305. className: 'replacecolor'
  306. },
  307. {
  308. title: '品牌方',
  309. dataIndex: 'brand',
  310. width: 120,
  311. className: 'replacecolor'
  312. },
  313. {
  314. title: '第三方',
  315. dataIndex: 'thirdParty',
  316. width: 120,
  317. className: 'replacecolor'
  318. },
  319. {
  320. title: '定金比例(%)',
  321. dataIndex: 'depositRate',
  322. width: 120,
  323. className: 'replacecolor'
  324. },
  325. {
  326. title: '定金',
  327. dataIndex: 'deposit',
  328. width: 120,
  329. className: 'replacecolor'
  330. },
  331. {
  332. title: '协同路线',
  333. dataIndex: 'collaborativeRoute',
  334. width: 120,
  335. className: 'replacecolor'
  336. },
  337. {
  338. title: '付款条件',
  339. dataIndex: 'paymentClause',
  340. width: 160,
  341. customRender: t => ellipsis(t),
  342. className: 'replacecolor'
  343. },
  344. {
  345. title: '最终客户',
  346. dataIndex: 'finalCustomer',
  347. width: 120,
  348. className: 'replacecolor'
  349. },
  350. {
  351. title: '订单备注',
  352. dataIndex: 'orderNote',
  353. width: 160,
  354. customRender: t => ellipsis(t),
  355. className: 'replacecolor'
  356. },
  357. {
  358. title: '价格备注',
  359. dataIndex: 'priceNote',
  360. width: 160,
  361. customRender: t => ellipsis(t),
  362. className: 'replacecolor'
  363. },
  364. {
  365. title: '订单变更说明',
  366. dataIndex: 'orderChangeDesc',
  367. width: 160,
  368. customRender: t => ellipsis(t),
  369. className: 'replacecolor'
  370. },
  371. {
  372. title: '操作',
  373. dataIndex: 'operation',
  374. scopedSlots: { customRender: 'operationSlot' },
  375. width: 220,
  376. fixed: 'right',
  377. className: 'replacecolor'
  378. }
  379. ],
  380. // 子表数据
  381. data: [
  382. {
  383. orderNum: 'AA002200001',
  384. smallPo: '008',
  385. // shipQuantity: '',
  386. // isTC: '',
  387. paymentClause: '定金达到50%定金达到50%定金达到50%定金达到50%定金达到50%定金达到50%'
  388. },
  389. {}
  390. ],
  391. addShipDet: {}, // 新增发运明细
  392. visible: false,
  393. confirmLoading: false,
  394. dateFormat: 'YYYY-MM-DD',
  395. validatorRules: {
  396. orderNum: [{ required: true, message: '订单号不能为空', trigger: 'blur' }], // 单据号
  397. billDate: [{ required: true, message: '单据日期不能为空', trigger: 'blur' }],
  398. customer: [{ required: true, message: '客户不能为空', trigger: 'blur' }], // 客户
  399. scheduledShipDate: [{ required: true, message: '预发货日期不能为空', trigger: 'blur' }],
  400. scheduledDoneDate: [{ required: true, message: '预完工日期不能为空', trigger: 'blur' }],
  401. note: [{ required: false, trigger: 'blur' }],
  402. styleNum: [{ required: true, message: '款号不能为空', trigger: 'blur' }],
  403. shipQuantity: [{ required: true, message: '发货数量不能为空', trigger: 'blur' }],
  404. isTC: [{ required: true, message: '请选择是否TC功能', trigger: 'blur' }],
  405. materialComposition: [{ required: true, message: '物料成分不能为空', trigger: 'blur' }]
  406. }
  407. }
  408. },
  409. created() {
  410. // this.getShipmentList() // 发运明细列表
  411. },
  412. methods: {
  413. // 参照订单数据
  414. referOrderDataOpen() {
  415. console.log('打开参照订单数据')
  416. this.$refs.referOrderDataModal.referOrderDataModVis = true
  417. },
  418. // 増行
  419. handleAddColumn() {
  420. console.log('増行')
  421. const addrow = {
  422. accountSet: '',
  423. orderNum: '',
  424. styleNum: '',
  425. orderDate: '',
  426. businessType: '',
  427. customerOrder: '',
  428. smallPo: '',
  429. packId: '',
  430. orderData: '',
  431. orderRemaQuantity: '',
  432. shipQuantity: '',
  433. isTC: '',
  434. materialComposition: '',
  435. saleType: '',
  436. customerShortName: '',
  437. customerName: '',
  438. exchangeRate: '',
  439. wholeSingleCombined: '',
  440. salesDepartment: '',
  441. salesman: '',
  442. currency: '',
  443. brand: '',
  444. thirdParty: '',
  445. depositRate: '',
  446. deposit: '',
  447. collaborativeRoute: '',
  448. paymentClause: '',
  449. finalCustomer: '',
  450. orderNote: '',
  451. priceNote: '',
  452. orderChangeDesc: '',
  453. operation: ''
  454. }
  455. this.data.push(addrow)
  456. },
  457. // --------------------------------------
  458. // 操作 删除
  459. handleDelete(id) {
  460. console.log('id:', id)
  461. },
  462. // 操作 复制
  463. copy(record) {},
  464. // --------------------------------------
  465. // 抽屉 取消
  466. handleCancel() {
  467. console.log('点击抽屉取消')
  468. this.close()
  469. },
  470. // 抽屉 提交
  471. submitAdd() {
  472. console.log('保存新增、刷新发运明细列表')
  473. const that = this
  474. // 触发表单验证
  475. this.$refs.form.validate(valid => {
  476. if (valid) {
  477. that.confirmLoading = true
  478. }
  479. })
  480. this.close()
  481. // this.getShipmentList() // 刷新发运明细列表
  482. },
  483. // --------------------------------------
  484. close() {
  485. this.$emit('close')
  486. this.visible = false
  487. this.$refs.form.resetFields()
  488. },
  489. // --------------------------------------
  490. // validateorderNum(rule, value, callback) {},
  491. // 分页、排序、筛选变化时触发
  492. // handleTableChange(pagination, filters, sorter) {
  493. // // console.log('当前页信息>>>>',pagination)
  494. // this.queryParam.pageNo = pagination.current
  495. // // this.getAnnList()
  496. // },
  497. // 参照订单数据弹框 ok-------------------------------------
  498. referOrderDataOk() {
  499. console.log('参照订单数据弹框确定')
  500. this.$refs.referOrderDataModal.referOrderDataModVis = false
  501. },
  502. // father
  503. aa() {}
  504. },
  505. computed: {},
  506. mounted() {}
  507. }
  508. </script>
  509. <style lang="less" scoped>
  510. @import '~@assets/less/common.less';
  511. /deep/ .ant-table-thead > tr > th {
  512. text-align: center;
  513. // font-weight: 700;
  514. }
  515. /deep/ .ant-table-tbody {
  516. text-align: center;
  517. }
  518. // /deep/ th.replacecolor {
  519. // background-color: #ccc;
  520. // }
  521. // 抽屉里的card样式
  522. /deep/ .ant-drawer-content {
  523. background-color: #f0f2f5;
  524. }
  525. /deep/ .ant-drawer-body {
  526. padding: 10px;
  527. }
  528. </style>