referShipmentDetailsModal.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. <template>
  2. <a-modal
  3. title="参照出运明细"
  4. v-model="referShipDetModVis"
  5. :confirmLoading="confirmLoading"
  6. @ok="onSubmit"
  7. @cancel="handleCancel"
  8. width="86%"
  9. style="top:330px;left:100px;"
  10. >
  11. <!-- <template slot="footer">
  12. <a-button @click="handleCancel">关闭</a-button>
  13. <a-button @click="onSubmit" v-preventReClick="2000" type="primary">确定</a-button>
  14. </template> -->
  15. <a-spin :spinning="confirmLoading">
  16. <!-- 查询 -->
  17. <div class="table-page-search-wrapper">
  18. <a-form layout="inline" @keyup.enter.native="searchQuery">
  19. <a-row :gutter="24">
  20. <!-- <a-col :md="6" :sm="8">
  21. <a-form-item label="发运明细单号">
  22. <a-input placeholder="请输入发运明细单号" v-model="queryParam.documentNo"></a-input>
  23. </a-form-item>
  24. </a-col> -->
  25. <a-col :md="6" :sm="8">
  26. <a-form-item label="客户简称">
  27. <j-search-select-tag
  28. placeholder="请选择客户简称"
  29. v-model="queryParam.clientAbbreviation"
  30. dict="view_customer,customername,customername">
  31. </j-search-select-tag>
  32. </a-form-item>
  33. </a-col>
  34. <a-col :md="6" :sm="8">
  35. <a-form-item label="发货情况">
  36. <a-select v-model="queryParam.status" style="width: 200px" placeholder="请选择发货情况" >
  37. <a-select-option value="n">超量发货</a-select-option>
  38. <a-select-option value="y">正常</a-select-option>
  39. </a-select>
  40. </a-form-item>
  41. </a-col>
  42. <a-col :md="6" :sm="8">
  43. <a-form-item label="业务员">
  44. <!-- <a-input placeholder="请输入业务员" v-model="queryParam.salesman"></a-input> -->
  45. <j-search-select-tag
  46. placeholder="请选择业务员"
  47. v-model="queryParam.salesman"
  48. dict="view_salesman,salesman,salesman">
  49. </j-search-select-tag>
  50. </a-form-item>
  51. </a-col>
  52. <template v-if="toggleSearchStatus">
  53. <a-col :md="6" :sm="8">
  54. <a-form-item label="成衣工厂">
  55. <!-- <a-input placeholder="请输入成衣工厂" v-model="queryParam.garmentFactory"></a-input> -->
  56. <j-search-select-tag
  57. placeholder="请选择成衣广场"
  58. v-model="queryParam.garmentFactory"
  59. dict="view_garmentfactory,garmentfactory,garmentfactory">
  60. </j-search-select-tag>
  61. </a-form-item>
  62. </a-col>
  63. <a-col :md="6" :sm="8">
  64. <a-form-item label="Po">
  65. <a-input placeholder="请输入Po" v-model="queryParam.smallPo"></a-input>
  66. </a-form-item>
  67. </a-col>
  68. <a-col :md="6" :sm="8">
  69. <a-form-item label="分销点">
  70. <!-- <a-input placeholder="请输入分销点" v-model="queryParam.distributionPoint"></a-input> -->
  71. <j-search-select-tag
  72. placeholder="请选择成衣工厂"
  73. v-model="queryParam.distributionPoint"
  74. dict="view_distributionPoint,distributionPoint,distributionPoint">
  75. </j-search-select-tag>
  76. </a-form-item>
  77. </a-col>
  78. <a-col :md="6" :sm="8">
  79. <a-form-item label="预发货日期">
  80. <a-range-picker
  81. :placeholder="['开始时间', '结束时间']"
  82. format="YYYY-MM-DD"
  83. style="width: 100%"
  84. v-model="preDeliveryDate"
  85. @change="onDateChange"
  86. />
  87. </a-form-item>
  88. </a-col>
  89. </template>
  90. <a-col :md="6" :sm="8">
  91. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  92. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  93. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  94. <a @click="handleToggleSearch" style="margin-left: 8px">
  95. {{ toggleSearchStatus ? '收起' : '展开' }}
  96. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  97. </a>
  98. </span>
  99. </a-col>
  100. </a-row>
  101. </a-form>
  102. </div>
  103. <!-- table -->
  104. <a-table
  105. bordered
  106. size="small"
  107. rowKey="groupId"
  108. v-if="data"
  109. :columns="columns"
  110. :data-source="data"
  111. :loading="loading"
  112. :pagination="pagination"
  113. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  114. @change="handleTableChange"
  115. :scroll="{ x: 1500 }"
  116. >
  117. </a-table>
  118. <h3>共选择 {{selectedNumber}} 条</h3>
  119. </a-spin>
  120. </a-modal>
  121. </template>
  122. <script>
  123. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  124. import JEllipsis from '@/components/jeecg/JEllipsis'
  125. import moment from 'moment'
  126. import { shipList } from '@api/document/advance-packingList.js'
  127. export default {
  128. name: 'ReferShipmentDetailsModal',
  129. mixins: [JeecgListMixin],
  130. components: { JEllipsis, moment },
  131. data() {
  132. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
  133. return {
  134. selectedRowKeys: [], // 勾选行
  135. selectedRows: [], // 勾选项
  136. selectedNumber:0,//勾选条数
  137. loading: false, // 表格加载
  138. preDeliveryDate: [], //预发货日期
  139. // 表头
  140. columns: [
  141. {
  142. title: '单据号',
  143. dataIndex: 'documentNo',
  144. width: 160,
  145. // fixed: 'left',
  146. ellipsis: true,
  147. className: 'replacecolor'
  148. },
  149. {
  150. title: '销售订单号',
  151. dataIndex: 'orderNumber',
  152. width: 120,
  153. // fixed: 'left',
  154. ellipsis: true,
  155. className: 'replacecolor'
  156. },
  157. {
  158. title: '客户简称',
  159. dataIndex: 'customerAbbreviation',
  160. width: 120,
  161. ellipsis: true,
  162. className: 'replacecolor'
  163. },
  164. {
  165. title: '部门',
  166. dataIndex: 'salesDepartment',
  167. width: 120,
  168. ellipsis: true,
  169. className: 'replacecolor'
  170. },
  171. {
  172. title: '业务员',
  173. dataIndex: 'salesman',
  174. width: 100,
  175. ellipsis: true,
  176. className: 'replacecolor'
  177. },
  178. {
  179. title: '小po',
  180. dataIndex: 'smallPo',
  181. width: 120,
  182. ellipsis: true,
  183. className: 'replacecolor'
  184. },
  185. {
  186. title: 'Pack Id',
  187. dataIndex: 'packId',
  188. width: 120,
  189. ellipsis: true,
  190. className: 'replacecolor'
  191. },
  192. {
  193. title: '分销点',
  194. dataIndex: 'distributionPoint',
  195. width: 120,
  196. ellipsis: true,
  197. className: 'replacecolor'
  198. },
  199. {
  200. title: '款号',
  201. dataIndex: 'itemNumber',
  202. width: 120,
  203. ellipsis: true,
  204. className: 'replacecolor'
  205. },
  206. {
  207. title: '数量(合计)',
  208. dataIndex: 'shipmentQuantity',
  209. width: 100,
  210. ellipsis: true,
  211. className: 'replacecolor'
  212. },
  213. // {
  214. // title: '创建时间',
  215. // dataIndex: 'createTime',
  216. // align: 'center',
  217. // sorter: true,
  218. // customRender: text => {
  219. // return moment(text).format('YYYY-MM-DD')
  220. // }
  221. // },
  222. {
  223. title: '预发货日期',
  224. dataIndex: 'preDeliveryDate',
  225. width: 120,
  226. ellipsis: true,
  227. className: 'replacecolor',
  228. customRender: text => {
  229. return moment(text).format('YYYY-MM-DD')
  230. }
  231. },
  232. // {
  233. // title: '预完工日期',
  234. // dataIndex: 'preCompletionDate',
  235. // width: 120,
  236. // className: 'replacecolor'
  237. // },
  238. {
  239. title: '存货名称',
  240. dataIndex: 'inventoryName',
  241. width: 220,
  242. ellipsis: true,
  243. className: 'replacecolor'
  244. },
  245. // {
  246. // title: '单价(销售)',
  247. // dataIndex: 'salesUnitPrice',
  248. // width: 120,
  249. // className: 'replacecolor'
  250. // },
  251. // {
  252. // title: '采购/委外订单号',
  253. // dataIndex: 'purOrSubOrder',
  254. // width: 140,
  255. // className: 'replacecolor'
  256. // },
  257. // {
  258. // title: '订单类型',
  259. // dataIndex: 'orderType',
  260. // width: 120,
  261. // className: 'replacecolor'
  262. // },
  263. // {
  264. // // (采购/委外单价)
  265. // title: '工厂单价',
  266. // dataIndex: 'factoryUnitPrice',
  267. // width: 100,
  268. // className: 'replacecolor'
  269. // },
  270. // {
  271. // // (单证维护)
  272. // title: '申报要素',
  273. // dataIndex: 'declarationElements',
  274. // width: 120,
  275. // customRender: t => ellipsis(t),
  276. // className: 'replacecolor'
  277. // },
  278. // {
  279. // // (存货自定义项)
  280. // title: '套装件数',
  281. // dataIndex: 'numberOfSets',
  282. // width: 100,
  283. // className: 'replacecolor'
  284. // },
  285. // {
  286. // title: '是否TC功能',
  287. // dataIndex: 'isTc',
  288. // // 0 否 、 1 是
  289. // width: 90,
  290. // className: 'replacecolor'
  291. // },
  292. // {
  293. // title: 'HScode',
  294. // dataIndex: 'hsCode',
  295. // width: 120,
  296. // className: 'replacecolor'
  297. // },
  298. // {
  299. // title: '中文品名',
  300. // dataIndex: 'chineseName',
  301. // width: 120,
  302. // className: 'replacecolor'
  303. // },
  304. // {
  305. // title: '英文品名',
  306. // dataIndex: 'englishProductName',
  307. // width: 120,
  308. // className: 'replacecolor'
  309. // },
  310. {
  311. title: '成衣工厂',
  312. dataIndex: 'garmentFactory',
  313. width: 120,
  314. ellipsis: true,
  315. className: 'replacecolor'
  316. },
  317. // {
  318. // title: '报关单价',
  319. // dataIndex: 'customsDeclarationUnitPrice',
  320. // width: 120,
  321. // className: 'replacecolor'
  322. // }
  323. ],
  324. data: [],
  325. confirmLoading: false,
  326. referShipDetModVis: false,
  327. // 查询条件
  328. queryParam: {
  329. status:'y',
  330. },
  331. // 分页
  332. pagination: {
  333. // total: 0,
  334. // current: 0,
  335. // pageSize: 0
  336. }
  337. }
  338. },
  339. // 接收父组件 方法
  340. // props: {
  341. // father: {
  342. // type: Function,
  343. // default: null
  344. // }
  345. // },
  346. created() {
  347. // this.getShipData()
  348. },
  349. methods: {
  350. //参照发运明细数据
  351. getShipData() {
  352. this.$nextTick(() => {
  353. shipList(this.queryParam).then(res => {
  354. // console.log('参照订单数据res', res)
  355. if (res.success) {
  356. this.data = [];
  357. if (res.result.records != null){
  358. this.data = res.result.records;
  359. this.data.map(item=>{
  360. if(item.isTc === "1"){
  361. item.isTc = '是'
  362. }else if(item.isTc === "0"){
  363. item.isTc = '否'
  364. }
  365. })
  366. }
  367. this.pagination = {
  368. total: res.result.total,
  369. current: res.result.current,
  370. pageSize: res.result.size
  371. }
  372. }
  373. })
  374. })
  375. },
  376. // 弹框确定
  377. onSubmit() {
  378. if (this.selectedRowKeys.length == 0) {
  379. this.$message.error('请勾选发运明细')
  380. } else {
  381. // console.log('需要传给父组件的数据', this.selectedRows)
  382. // bao父组件指定的传数据绑定的函数 || this.selectedRows子组件给父组件传递的数据
  383. var msg = "选中记录后,会清除编辑的内容。";
  384. this.$message.info(msg);
  385. this.$emit('bao', this.selectedRows)
  386. // this.referShipDetModVis = false
  387. // this.selectedRowKeys = []
  388. // this.selectedRows = []
  389. this.close()
  390. }
  391. },
  392. // 弹框查询按钮
  393. searchQuery() {
  394. this.toggleSearchStatus = false
  395. this.queryParam.pageNo = ''
  396. this.getShipData()
  397. this.defulatSelect()
  398. },
  399. // 重置
  400. searchReset() {
  401. this.queryParam = {
  402. status:'y'
  403. }
  404. this.preDeliveryDate = []
  405. this.getShipData()
  406. this.defulatSelect()
  407. },
  408. close() {
  409. this.$emit('close')
  410. this.referShipDetModVis = false
  411. this.data = []
  412. this.defulatSelect()
  413. this.queryParam = {
  414. status:'y'
  415. }
  416. this.preDeliveryDate = []
  417. // this.getShipData()
  418. },
  419. handleCancel() {
  420. this.close()
  421. },
  422. // 选中行
  423. onSelectChange(keys, rows) {
  424. this.selectedRowKeys = keys
  425. this.selectedRows = rows
  426. if (this.selectedRows.length > 1) {
  427. this.$message.error("只能勾选一条参照数据!")
  428. this.selectedRowKeys.pop()
  429. this.selectedRow.pop()
  430. }
  431. this.selectedNumber = rows.length
  432. },
  433. //选中行恢复默认
  434. defulatSelect(){
  435. this.selectedRowKeys = [];
  436. this.selectedRows = [];
  437. this.selectedNumber = 0
  438. },
  439. handleTableChange(pagination, filters, sorter) {
  440. this.queryParam.pageNo = pagination.current
  441. this.getShipData()
  442. },
  443. onDateChange(value, dateString) {
  444. this.queryParam.startDate = dateString[0]
  445. this.queryParam.endDate = dateString[1]
  446. },
  447. },
  448. computed: {
  449. // 选中项
  450. rowSelection() {
  451. return {
  452. onChange: (selectedRowKeys, selectedRows) => {
  453. console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
  454. },
  455. getCheckboxProps: record => ({
  456. props: {
  457. disabled: record.title === 'Disabled User',
  458. // Column configuration not to be checked
  459. title: record.title
  460. }
  461. })
  462. }
  463. }
  464. }
  465. }
  466. </script>
  467. <style lang="less" scoped>
  468. @import '~@assets/less/common.less';
  469. @import '~@assets/less/overwriter.less';
  470. /deep/ .ant-table-thead > tr > th {
  471. text-align: center;
  472. // font-weight: 700;
  473. }
  474. /deep/ .ant-table-tbody {
  475. text-align: center;
  476. }
  477. /deep/ th.replacecolor {
  478. background-color: #ccc !important;
  479. }
  480. /deep/ .ant-table-fixed-left table, .ant-table-fixed-right table{
  481. width: min-content;
  482. }
  483. </style>