referShipmentDetailsModal.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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. <a-spin :spinning="confirmLoading">
  12. <!-- 查询 -->
  13. <div class="table-page-search-wrapper">
  14. <a-form layout="inline" @keyup.enter.native="searchQuery">
  15. <a-row :gutter="24">
  16. <a-col :md="6" :sm="8">
  17. <a-form-item label="发运明细单号">
  18. <a-input placeholder="请输入发运明细单号" v-model="queryParam.documentNo"></a-input>
  19. </a-form-item>
  20. </a-col>
  21. <a-col :md="6" :sm="8">
  22. <a-form-item label="客户">
  23. <j-search-select-tag
  24. placeholder="请选择客户"
  25. v-model="queryParam.customer"
  26. dict="view_customer,customername,customername">
  27. </j-search-select-tag>
  28. </a-form-item>
  29. </a-col>
  30. <a-col :md="6" :sm="8">
  31. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  32. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  33. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  34. <a @click="handleToggleSearch" style="margin-left: 8px">
  35. {{ toggleSearchStatus ? '收起' : '展开' }}
  36. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  37. </a>
  38. </span>
  39. </a-col>
  40. </a-row>
  41. </a-form>
  42. </div>
  43. <!-- table -->
  44. <a-table
  45. bordered
  46. size="small"
  47. rowKey="id"
  48. v-if="data"
  49. :columns="columns"
  50. :data-source="data"
  51. :loading="loading"
  52. :pagination="pagination"
  53. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  54. @change="handleTableChange"
  55. :scroll="{ x: 1500 }"
  56. >
  57. </a-table>
  58. </a-spin>
  59. </a-modal>
  60. </template>
  61. <script>
  62. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  63. import JEllipsis from '@/components/jeecg/JEllipsis'
  64. import moment from 'moment'
  65. import { shipList } from '@api/document/advance-packingList.js'
  66. export default {
  67. name: 'ReferShipmentDetailsModal',
  68. mixins: [JeecgListMixin],
  69. components: { JEllipsis, moment },
  70. data() {
  71. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
  72. return {
  73. selectedRowKeys: [], // 勾选行
  74. selectedRows: {}, // 勾选项
  75. loading: false, // 表格加载
  76. // 表头
  77. columns: [
  78. {
  79. title: '单据号',
  80. dataIndex: 'documentNo',
  81. width: 160,
  82. fixed: 'left',
  83. className: 'replacecolor'
  84. },
  85. {
  86. title: '销售订单号',
  87. dataIndex: 'orderNumber',
  88. width: 120,
  89. fixed: 'left',
  90. className: 'replacecolor'
  91. },
  92. {
  93. title: '客户简称',
  94. dataIndex: 'customerAbbreviation',
  95. width: 120,
  96. className: 'replacecolor'
  97. },
  98. {
  99. title: '部门',
  100. dataIndex: 'salesDepartment',
  101. width: 120,
  102. className: 'replacecolor'
  103. },
  104. {
  105. title: '业务员',
  106. dataIndex: 'salesman',
  107. width: 100,
  108. className: 'replacecolor'
  109. },
  110. {
  111. title: '小po',
  112. dataIndex: 'smallPo',
  113. width: 120,
  114. className: 'replacecolor'
  115. },
  116. {
  117. title: 'Pack Id',
  118. dataIndex: 'packId',
  119. width: 120,
  120. className: 'replacecolor'
  121. },
  122. {
  123. title: '分销点',
  124. dataIndex: 'distributionPoint',
  125. width: 120,
  126. className: 'replacecolor'
  127. },
  128. {
  129. title: '款号',
  130. dataIndex: 'itemNumber',
  131. width: 120,
  132. className: 'replacecolor'
  133. },
  134. // {
  135. // title: '创建时间',
  136. // dataIndex: 'createTime',
  137. // align: 'center',
  138. // sorter: true,
  139. // customRender: text => {
  140. // return moment(text).format('YYYY-MM-DD')
  141. // }
  142. // },
  143. {
  144. title: '预发货日期',
  145. dataIndex: 'preDeliveryDate',
  146. width: 120,
  147. className: 'replacecolor'
  148. },
  149. {
  150. title: '计划到货日期',
  151. dataIndex: 'plannedArrivalDate',
  152. width: 120,
  153. className: 'replacecolor'
  154. },
  155. {
  156. title: '存货名称',
  157. dataIndex: 'inventoryName',
  158. width: 220,
  159. className: 'replacecolor'
  160. },
  161. {
  162. title: '数量(合计)',
  163. dataIndex: 'shipmentQuantity',
  164. width: 100,
  165. className: 'replacecolor'
  166. },
  167. {
  168. title: '单价(销售)',
  169. dataIndex: 'salesUnitPrice',
  170. width: 120,
  171. className: 'replacecolor'
  172. },
  173. {
  174. title: '采购/委外订单号',
  175. dataIndex: 'purOrSubOrder',
  176. width: 140,
  177. className: 'replacecolor'
  178. },
  179. {
  180. title: '订单类型',
  181. dataIndex: 'orderType',
  182. width: 120,
  183. className: 'replacecolor'
  184. },
  185. {
  186. // (采购/委外单价)
  187. title: '工厂单价',
  188. dataIndex: 'factoryUnitPrice',
  189. width: 100,
  190. className: 'replacecolor'
  191. },
  192. {
  193. // (单证维护)
  194. title: '申报要素',
  195. dataIndex: 'declarationElements',
  196. width: 120,
  197. customRender: t => ellipsis(t),
  198. className: 'replacecolor'
  199. },
  200. {
  201. // (存货自定义项)
  202. title: '套装件数',
  203. dataIndex: 'numberOfSets',
  204. width: 100,
  205. className: 'replacecolor'
  206. },
  207. {
  208. title: '是否TC功能',
  209. dataIndex: 'isTC',
  210. // 0 否 、 1 是
  211. width: 90,
  212. className: 'replacecolor'
  213. },
  214. {
  215. title: 'HScode',
  216. dataIndex: 'hsCode',
  217. width: 120,
  218. className: 'replacecolor'
  219. },
  220. {
  221. title: '中文品名',
  222. dataIndex: 'chineseName',
  223. width: 120,
  224. className: 'replacecolor'
  225. },
  226. {
  227. title: '英文品名',
  228. dataIndex: 'englishProductName',
  229. width: 120,
  230. className: 'replacecolor'
  231. },
  232. {
  233. title: '成衣工厂',
  234. dataIndex: 'garmentFactory',
  235. width: 120,
  236. className: 'replacecolor'
  237. },
  238. {
  239. title: '报关单价',
  240. dataIndex: 'customsDeclarationUnitPrice',
  241. width: 120,
  242. className: 'replacecolor'
  243. }
  244. ],
  245. data: [],
  246. confirmLoading: false,
  247. referShipDetModVis: false,
  248. // 查询条件
  249. queryParam: {
  250. documentNo: '',
  251. customer: '',
  252. pageNo: ''
  253. },
  254. // 分页
  255. pagination: {
  256. // total: 0,
  257. // current: 0,
  258. // pageSize: 0
  259. }
  260. }
  261. },
  262. // 接收父组件 方法
  263. // props: {
  264. // father: {
  265. // type: Function,
  266. // default: null
  267. // }
  268. // },
  269. created() {
  270. this.getShipData()
  271. },
  272. methods: {
  273. //参照发运明细数据
  274. getShipData() {
  275. this.$nextTick(() => {
  276. shipList(this.queryParam).then(res => {
  277. // console.log('参照订单数据res', res)
  278. if (res.success) {
  279. this.data = [];
  280. if (res.result.records != null){
  281. this.data = res.result.records;
  282. }
  283. this.pagination = {
  284. total: res.result.total,
  285. current: res.result.current,
  286. pageSize: res.result.size
  287. }
  288. }
  289. })
  290. })
  291. },
  292. // 弹框确定
  293. onSubmit() {
  294. if (this.selectedRowKeys.length == 0) {
  295. this.$message.error('请勾选发运明细')
  296. } else {
  297. // console.log('需要传给父组件的数据', this.selectedRows)
  298. // bao父组件指定的传数据绑定的函数 || this.selectedRows子组件给父组件传递的数据
  299. var msg = "选中记录后,会清除编辑的内容。";
  300. if (this.selectedRowKeys.length>1){
  301. msg = '当前勾选了多行,只有第一行会被选中。'+msg;
  302. }
  303. this.$message.info(msg);
  304. this.$emit('bao', this.selectedRows)
  305. this.referShipDetModVis = false
  306. this.selectedRowKeys = []
  307. this.selectedRows = []
  308. }
  309. },
  310. // 弹框查询按钮
  311. searchQuery() {
  312. this.queryParam.pageNo = ''
  313. this.getShipData()
  314. },
  315. // 重置
  316. searchReset() {
  317. this.queryParam.documentNo = ''
  318. this.queryParam.customer = ''
  319. this.getShipData()
  320. },
  321. close() {
  322. this.$emit('close')
  323. this.referShipDetModVis = false
  324. this.selectedRowKeys = []
  325. this.data = []
  326. this.getShipData()
  327. },
  328. handleCancel() {
  329. this.close()
  330. },
  331. // 选中行
  332. onSelectChange(keys, rows) {
  333. this.selectedRowKeys = keys
  334. this.selectedRows = rows
  335. if (this.selectedRows.length > 1) {
  336. // alert('error')
  337. // var newOne = keys.shift()
  338. // this.selectedRows = newOne
  339. // console.log('最新选择', this.selectedRows)
  340. // this.$error.message('只能参照一条发运明细')
  341. }
  342. },
  343. handleTableChange(pagination, filters, sorter) {
  344. this.queryParam.pageNo = pagination.current
  345. this.getShipData()
  346. }
  347. },
  348. computed: {
  349. // 选中项
  350. rowSelection() {
  351. return {
  352. onChange: (selectedRowKeys, selectedRows) => {
  353. console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
  354. },
  355. getCheckboxProps: record => ({
  356. props: {
  357. disabled: record.title === 'Disabled User',
  358. // Column configuration not to be checked
  359. title: record.title
  360. }
  361. })
  362. }
  363. }
  364. }
  365. }
  366. </script>
  367. <style lang="less" scoped>
  368. @import '~@assets/less/common.less';
  369. @import '~@assets/less/overwriter.less';
  370. /deep/ .ant-table-thead > tr > th {
  371. text-align: center;
  372. // font-weight: 700;
  373. }
  374. /deep/ .ant-table-tbody {
  375. text-align: center;
  376. }
  377. /deep/ th.replacecolor {
  378. background-color: #ccc !important;
  379. }
  380. </style>