referShipmentDetailsModal.vue 10 KB

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