book-list.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. <template>
  2. <!-- 预托书列表 -->
  3. <div id="preBookList">
  4. <!-- 查询区域 -->
  5. <a-card :bordered="false">
  6. <div class="table-page-search-wrapper">
  7. <a-form layout="inline" @keyup.enter.native="searchQuery">
  8. <a-row :gutter="24">
  9. <a-col :md="6" :sm="8">
  10. <a-form-item label="订单号">
  11. <a-input placeholder="请输入订单号" v-model="queryParam.orderNumber"></a-input>
  12. </a-form-item>
  13. </a-col>
  14. <a-col :md="6" :sm="8">
  15. <a-form-item label="订单日期" has-feedback>
  16. <a-date-picker style="width: 100%" v-model="queryParam.orderDate"> </a-date-picker>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :md="6" :sm="8">
  20. <a-form-item label="客户简称">
  21. <a-input placeholder="请输入客户简称" v-model="queryParam.clientAbbreviation"></a-input>
  22. </a-form-item>
  23. </a-col>
  24. <template v-if="toggleSearchStatus">
  25. <!-- <a-col :md="6" :sm="8">
  26. <a-form-item label="箱号">
  27. <a-input placeholder="请输入箱号" v-model="queryParam.containerNumber"></a-input>
  28. </a-form-item>
  29. </a-col> -->
  30. <a-col :md="6" :sm="8">
  31. <a-form-item label="小po号">
  32. <a-input placeholder="请输入小po号" v-model="queryParam.smailPo"></a-input>
  33. </a-form-item>
  34. </a-col>
  35. <a-col :md="6" :sm="8">
  36. <a-form-item label="托书号">
  37. <a-input placeholder="请输入托书号" v-model="queryParam.shippingOrderNumber"></a-input>
  38. </a-form-item>
  39. </a-col>
  40. <a-col :md="6" :sm="8">
  41. <a-form-item label="外销发票">
  42. <a-input placeholder="请输入外销发票" v-model="queryParam.exportInvoiceNo"></a-input>
  43. </a-form-item>
  44. </a-col>
  45. <a-col :md="6" :sm="8">
  46. <a-form-model-item label="类型">
  47. <a-select v-model="queryParam.type">
  48. <a-select-option value="">请选择</a-select-option>
  49. <a-select-option value="成衣">成衣</a-select-option>
  50. <a-select-option value="面料">面料</a-select-option>
  51. </a-select>
  52. </a-form-model-item>
  53. </a-col>
  54. </template>
  55. <a-col :md="6" :sm="8">
  56. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  57. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  58. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  59. <a @click="handleToggleSearch" style="margin-left: 8px">
  60. {{ toggleSearchStatus ? '收起' : '展开' }}
  61. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  62. </a>
  63. </span>
  64. </a-col>
  65. </a-row>
  66. </a-form>
  67. </div>
  68. </a-card>
  69. <!-- 操作按钮区域 新增-->
  70. <a-card :bordered="false" style="marginTop:10px;">
  71. <div class="table-operator">
  72. <a-button type="primary" @click="addBookDrawer" icon="plus">新增</a-button>
  73. <a-button type="primary" @click="batchSubmit()" icon="plus">批量提交</a-button>
  74. <a-button type="primary" @click="batchCanaleSubmit()" icon="plus">批量取消提交</a-button>
  75. </div>
  76. <!-- 子表 -->
  77. <a-table
  78. bordered
  79. :columns="bookListColumns"
  80. :data-source="bookListData"
  81. :loading="loading"
  82. :scroll="{x: 1500 , y: 500 }"
  83. :pagination="pagination"
  84. :row-key="record => record.id"
  85. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  86. @change="handleTableChange"
  87. >
  88. <!-- 金额 输入框
  89. <template slot="money" slot-scope="text, record, index">
  90. <a-form-model-item prop="money" :rules="rules.money" required>
  91. <a-input style="width:100%" type="text" v-model="record.money" />
  92. </a-form-model-item>
  93. </template> -->
  94. <!-- 单据状态 -->
  95. <span slot="documentStateSlot" slot-scope="text, record">
  96. <a-tag color="orange" v-if="record.theDocumentsState == '0'">仅保存</a-tag>
  97. <a-tag color="green" v-if="record.theDocumentsState == '1'">已提交</a-tag>
  98. </span>
  99. <!-- if 已提交 -->
  100. <!-- <span slot="documentStateSlot">
  101. <a-tag color="#2db7f5">已提交</a-tag>
  102. </span> -->
  103. <!-- 操作 -->
  104. <span slot="operationSlot" slot-scope="text, record">
  105. <a @click="handleExportXls(record)" style="color:green;">结汇发票打印</a>
  106. <a-divider type="vertical" />
  107. <a-dropdown>
  108. <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
  109. <a-menu slot="overlay" v-if="record.theDocumentsState == '0'">
  110. <!-- <a-menu-item><a @click="submit(record)">提交</a></a-menu-item> -->
  111. <a-menu-item><a @click="edit(record,'2')">详情</a></a-menu-item>
  112. <a-menu-item><a @click="edit(record,'1')">编辑</a></a-menu-item>
  113. <a-menu-item><a @click="print(record)">打印</a></a-menu-item>
  114. <a-menu-item>
  115. <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(record.id)">
  116. <a href="javascript:void(0);" style="color:red;">删除</a>
  117. </a-popconfirm></a-menu-item
  118. >
  119. </a-menu>
  120. <a-menu slot="overlay" v-if="record.theDocumentsState == '1'">
  121. <!-- <a-menu-item><a @click="canaleSubmit(record)">取消提交</a></a-menu-item> -->
  122. <a-menu-item><a @click="edit(record,'2')">详情</a></a-menu-item>
  123. </a-menu>
  124. </a-dropdown>
  125. </span>
  126. </a-table>
  127. </a-card>
  128. <!-- 抽屉 -->
  129. <addBook-drawer ref="addBookDrawer" @ok="modalFormOk" @back="getBookList"></addBook-drawer>
  130. <detailsBook-drawer ref="detailsBookDrawer" @ok="modalFormOk"></detailsBook-drawer>
  131. <!-- <editBook-drawer ref="editBookDrawer" :father="cc" @ok="modalFormOk"></editBook-drawer> -->
  132. </div>
  133. </template>
  134. <script>
  135. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  136. import JEllipsis from '@/components/jeecg/JEllipsis'
  137. import moment from 'moment'
  138. import { downFile } from '@/api/manage'
  139. import addBookDrawer from '@views/book/addBookDrawer.vue'
  140. import detailsBookDrawer from '@views/book/detailsBookDrawer.vue'
  141. import editBookDrawer from '@views/book/editBookDrawer.vue'
  142. import {bookList,bookListId,submitPackingList,deletePackingList,settlement} from '@api/document/book.js'
  143. export default {
  144. name: 'BookList', // 托书列表
  145. mixins: [JeecgListMixin],
  146. components: { JEllipsis, moment, addBookDrawer, detailsBookDrawer, editBookDrawer },
  147. data() {
  148. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
  149. return {
  150. // 表头
  151. bookListColumns: [
  152. { title: '托书号', width: 120, dataIndex: 'shippingOrderNumber', className: 'replacecolor' , ellipsis: true,},
  153. { title: '订单号', width: 140, dataIndex: 'orderNumber', className: 'replacecolor', ellipsis: true, },
  154. { title: '外销发票号码', dataIndex: 'exportInvoiceNo', width: 120, className: 'replacecolor', ellipsis: true, },
  155. { title: '客户简称', dataIndex: 'clientAbbreviation', width: 120, className: 'replacecolor' , ellipsis: true,},
  156. {
  157. title: '分销点',
  158. dataIndex: 'distributionPoint',
  159. width: 120,
  160. ellipsis: true,
  161. className: 'replacecolor'
  162. },
  163. {
  164. title: '经营单位',
  165. dataIndex: 'unitInOperation',
  166. width: 150,
  167. ellipsis: true,
  168. className: 'replacecolor'
  169. },
  170. { title: '总箱数', dataIndex: 'boxNumber', width: 120, className: 'replacecolor', ellipsis: true, },
  171. { title: '总毛重', dataIndex: 'totalGrossWeight', width: 120, className: 'replacecolor', ellipsis: true, },
  172. { title: '总体积', dataIndex: 'totalVolume', width: 100, className: 'replacecolor', ellipsis: true, },
  173. {
  174. title: '金额',
  175. dataIndex: 'money',
  176. // scopedSlots: { customRender: 'money' },
  177. width: 140,
  178. ellipsis: true,
  179. className: 'replacecolor'
  180. },
  181. {
  182. title: '实际船期',
  183. dataIndex: 'theFinalShippingDate',
  184. ellipsis: true,
  185. width: 130,
  186. // customRender: text => { 有问题 显示当日日期
  187. // return moment(text).format('YYYY-MM-DD')
  188. // },
  189. className: 'replacecolor'
  190. },
  191. // { title: '收汇方式', dataIndex: 'exchangeEarningsValue', width: 120, className: 'replacecolor' },
  192. // {
  193. // title: '收货人',
  194. // dataIndex: 'consignee',
  195. // width: 100,
  196. // customRender: t => ellipsis(t),
  197. // className: 'replacecolor'
  198. // },
  199. // {
  200. // title: '提单或承运收据',
  201. // dataIndex: 'billOfLadingOrCarriageReceipt',
  202. // width: 140,
  203. // customRender: t => ellipsis(t),
  204. // className: 'replacecolor'
  205. // },
  206. // {
  207. // title: '抬头人',
  208. // dataIndex: 'addressee',
  209. // width: 120,
  210. // customRender: t => ellipsis(t),
  211. // className: 'replacecolor'
  212. // },
  213. // { title: '贸易国别', dataIndex: 'tradeCountry', width: 100, className: 'replacecolor' },
  214. // { title: '运抵国别', dataIndex: 'arriveInCountry', width: 100, className: 'replacecolor' },
  215. // { title: '出口口岸', dataIndex: 'exportPort', width: 100, className: 'replacecolor' },
  216. // {
  217. // title: '通知人',
  218. // dataIndex: 'notifier',
  219. // width: 100,
  220. // customRender: t => ellipsis(t),
  221. // className: 'replacecolor'
  222. // },
  223. // { title: 'NOTIFY', dataIndex: 'nottfy', width: 150, className: 'replacecolor' },
  224. // { title: '目的港', dataIndex: 'destinationPort', width: 100, className: 'replacecolor' },
  225. // { title: '装运期限', dataIndex: 'latestDateOfShipment', width: 100, className: 'replacecolor' },
  226. // {
  227. // title: '单据状态',
  228. // dataIndex: 'theDocumentsState',
  229. // width: 90,
  230. // scopedSlots: { customRender: 'documentStateSlot' },
  231. // fixed: 'right',
  232. // className: 'replacecolor'
  233. // },
  234. {
  235. title: '操作',
  236. dataIndex: 'operation',
  237. scopedSlots: { customRender: 'operationSlot' },
  238. width: 180,
  239. fixed: 'right',
  240. className: 'replacecolor'
  241. }
  242. ],
  243. bookListData: [],
  244. id: '',
  245. selectedRowKeys:[],//选中行id
  246. loading: false, // 表格加载
  247. pagination:{},
  248. // 查询条件
  249. queryParam: {
  250. pageNo:''
  251. }
  252. }
  253. },
  254. created() {
  255. this.getBookList( )
  256. },
  257. methods: {
  258. moment,
  259. //获取表格数据
  260. getBookList(){
  261. this.$nextTick(() => {
  262. this.queryParam.pageSize = 20
  263. bookList(this.queryParam).then(res => {
  264. if (res.success) {
  265. this.bookListData = res.result.records
  266. this.pagination = {
  267. total: res.result.total,
  268. current: res.result.current,
  269. pageSize: res.result.size
  270. }
  271. }else {
  272. this.$message.error(res.message);
  273. }
  274. })
  275. })
  276. },
  277. // 查询按钮
  278. searchQuery() {
  279. this.queryParam.pageNo = ''
  280. this.getBookList()
  281. // this.getpreBookList() // 渲染渲染预托书
  282. },
  283. // 重置
  284. searchReset() {
  285. this.queryParam = {
  286. pageNo:''
  287. }
  288. this.getBookList()
  289. // this.getpreBookList()
  290. },
  291. // 新增
  292. addBookDrawer() {
  293. console.log('新增托书')
  294. this.$refs.addBookDrawer.visible = true
  295. },
  296. // -----------------------------------
  297. // 结汇发票打印
  298. handleExportXls(record) {
  299. var exinvoiceArr = ["报关信息-报关单","报关信息-申报要素-成衣","报关信息-发票","报关信息-合同","报关信息-申报要素-面料","报关信息-装箱单"]
  300. exinvoiceArr.map(item =>{
  301. downFile('/syShippingOrder/syShippingOrder/syShippingOrderPrint',{id:record.id,testName:item}).then(data => {
  302. if (!data) {
  303. this.$message.warning('文件下载失败')
  304. return
  305. }
  306. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  307. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), item + '.xlsx')
  308. } else {
  309. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  310. let link = document.createElement('a')
  311. link.style.display = 'none'
  312. link.href = url
  313. link.setAttribute('download', item + '.xlsx')
  314. document.body.appendChild(link)
  315. link.click()
  316. document.body.removeChild(link) // 下载完成移除元素
  317. window.URL.revokeObjectURL(url) // 释放掉blob对象
  318. }
  319. })
  320. })
  321. },
  322. // 上传附件
  323. accessoryUpload() {},
  324. // 操作 提交
  325. submit(record) {
  326. this.$nextTick(() => {
  327. submitPackingList({ id: record.id, type: '1' }).then(res => {
  328. if (res.success) {
  329. // record.theDocumentsState = '1'
  330. this.getBookList()
  331. this.$message.success('提交成功')
  332. }else {
  333. this.$message.error(res.message);
  334. }
  335. })
  336. })
  337. },
  338. // //批量提交
  339. batchSubmit(){
  340. this.$nextTick(() => {
  341. submitPackingList({ ids: this.selectedRowKeys, type: '1' }).then(res => {
  342. if (res.success) {
  343. // record.theDocumentsState = '1'
  344. this.getBookList()
  345. this.$message.success('提交成功')
  346. this.selectedRowKeys = []
  347. }else {
  348. this.$message.error(res.message);
  349. }
  350. })
  351. })
  352. },
  353. //取消提交
  354. canaleSubmit(record) {
  355. this.$nextTick(() => {
  356. submitPackingList({ id: record.id, type: '2' }).then(res => {
  357. if (res.success) {
  358. this.$message.success('取消提交成功')
  359. record.theDocumentsState = '0'
  360. this.getBookList()
  361. }else {
  362. this.$message.error(res.message);
  363. }
  364. })
  365. })
  366. },
  367. batchCanaleSubmit(){
  368. this.$nextTick(() => {
  369. submitPackingList({ ids: this.selectedRowKeys, type: '2' }).then(res => {
  370. if (res.success) {
  371. this.$message.success('取消提交成功')
  372. // record.theDocumentsState = '0'
  373. this.getBookList()
  374. this.selectedRowKeys = []
  375. }else {
  376. this.$message.error(res.message);
  377. }
  378. })
  379. })
  380. },
  381. // 操作 详情
  382. details(record) {
  383. this.$refs.detailsBookDrawer.visible = true
  384. },
  385. // 操作 编辑
  386. edit(record,pattern) {
  387. this.$nextTick(() => {
  388. bookListId({id:record.id}).then(res => {
  389. if (res.success) {
  390. var data =res.result
  391. if(pattern == '1'){
  392. this.$refs.addBookDrawer.visible = true
  393. this.$refs.addBookDrawer.defaultMethod = 'edit'
  394. data.latestDateOfShipment = (moment(data.latestDateOfShipment)).format('YYYY-MM-DD')
  395. this.$refs.addBookDrawer.addBook = data
  396. this.$refs.addBookDrawer.addBookData = data.syShippingOrderItemList
  397. this.$refs.addBookDrawer.addBookData.map(item =>{
  398. item.smallPo = item.smailPo
  399. item.itemNumber = item.styleNumber
  400. item.totalVolume = item.volume
  401. item.price = item.unitPrice
  402. })
  403. this.$refs.addBookDrawer.rmbList = data.rmbList
  404. this.$refs.addBookDrawer.usdList = data.usdList
  405. }else {
  406. this.$refs.detailsBookDrawer.visible = true
  407. data.latestDateOfShipment = (moment(data.latestDateOfShipment)).format('YYYY-MM-DD')
  408. this.$refs.detailsBookDrawer.addBook = data
  409. this.$refs.detailsBookDrawer.addBookData = data.syShippingOrderItemList
  410. this.$refs.detailsBookDrawer.rmbList = data.rmbList
  411. this.$refs.detailsBookDrawer.usdList = data.usdList
  412. }
  413. // this.bookListData = res.result.records
  414. }else {
  415. this.$message.error(res.message);
  416. }
  417. })
  418. })
  419. },
  420. // 操作 打印
  421. print(record) {},
  422. // 操作 删除
  423. handleDelete(id) {
  424. this.$nextTick(() => {
  425. if(this.queryParam.pageNo > 1 && this.bookListData.length === 1){
  426. this.queryParam.pageNo = this.queryParam.pageNo -1
  427. }
  428. deletePackingList({id:id}).then(res => {
  429. if (res.success) {
  430. this.getBookList()
  431. }else {
  432. this.$message.error(res.message);
  433. }
  434. })
  435. })
  436. },
  437. // // 分页、排序、筛选变化时触发
  438. handleTableChange(pagination, filters, sorter) {
  439. // console.log('当前页信息>>>>',pagination)
  440. this.queryParam.pageNo = pagination.current
  441. this.getBookList()
  442. },
  443. // 选中行
  444. onSelectChange(keys) {
  445. this.selectedRowKeys = keys
  446. }
  447. },
  448. computed: {},
  449. mounted() {}
  450. }
  451. </script>
  452. <style lang="less" scoped>
  453. @import '~@assets/less/common.less';
  454. @import '~@assets/less/overwriter.less';
  455. /deep/ .ant-table-thead > tr > th {
  456. text-align: center;
  457. // font-weight: 700;
  458. }
  459. /deep/ .ant-table-tbody {
  460. text-align: center;
  461. }
  462. // /deep/ th.replacecolor {
  463. // background-color: #ccc;
  464. // }
  465. </style>