referShipmentDetailsModal.vue 11 KB

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