book-list.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  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. //获取表格数据
  259. getBookList(){
  260. this.$nextTick(() => {
  261. this.queryParam.pageSize = 20
  262. bookList(this.queryParam).then(res => {
  263. if (res.success) {
  264. this.bookListData = res.result.records
  265. this.pagination = {
  266. total: res.result.total,
  267. current: res.result.current,
  268. pageSize: res.result.size
  269. }
  270. }else {
  271. this.$message.error(res.message);
  272. }
  273. })
  274. })
  275. },
  276. // 查询按钮
  277. searchQuery() {
  278. this.queryParam.pageNo = ''
  279. this.getBookList()
  280. // this.getpreBookList() // 渲染渲染预托书
  281. },
  282. // 重置
  283. searchReset() {
  284. this.queryParam = {
  285. pageNo:''
  286. }
  287. this.getBookList()
  288. // this.getpreBookList()
  289. },
  290. // 新增
  291. addBookDrawer() {
  292. console.log('新增托书')
  293. this.$refs.addBookDrawer.visible = true
  294. },
  295. // -----------------------------------
  296. // 结汇发票打印
  297. handleExportXls(record) {
  298. var exinvoiceArr = ['报关信息-发票','报关信息-报关单']
  299. exinvoiceArr.map(item =>{
  300. downFile('/syShippingOrder/syShippingOrder/syShippingOrderPrint',{id:record.id,testName:'报关信息-发票'}).then(data => {
  301. if (!data) {
  302. this.$message.warning('文件下载失败')
  303. return
  304. }
  305. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  306. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), '报关信息-发票' + '.xlsx')
  307. } else {
  308. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  309. let link = document.createElement('a')
  310. link.style.display = 'none'
  311. link.href = url
  312. link.setAttribute('download', '报关信息-发票' + '.xlsx')
  313. document.body.appendChild(link)
  314. link.click()
  315. document.body.removeChild(link) // 下载完成移除元素
  316. window.URL.revokeObjectURL(url) // 释放掉blob对象
  317. }
  318. })
  319. })
  320. },
  321. // 上传附件
  322. accessoryUpload() {},
  323. // 操作 提交
  324. submit(record) {
  325. this.$nextTick(() => {
  326. submitPackingList({ id: record.id, type: '1' }).then(res => {
  327. if (res.success) {
  328. // record.theDocumentsState = '1'
  329. this.getBookList()
  330. this.$message.success('提交成功')
  331. }else {
  332. this.$message.error(res.message);
  333. }
  334. })
  335. })
  336. },
  337. // //批量提交
  338. batchSubmit(){
  339. this.$nextTick(() => {
  340. submitPackingList({ ids: this.selectedRowKeys, type: '1' }).then(res => {
  341. if (res.success) {
  342. // record.theDocumentsState = '1'
  343. this.getBookList()
  344. this.$message.success('提交成功')
  345. this.selectedRowKeys = []
  346. }else {
  347. this.$message.error(res.message);
  348. }
  349. })
  350. })
  351. },
  352. //取消提交
  353. canaleSubmit(record) {
  354. this.$nextTick(() => {
  355. submitPackingList({ id: record.id, type: '2' }).then(res => {
  356. if (res.success) {
  357. this.$message.success('取消提交成功')
  358. record.theDocumentsState = '0'
  359. this.getBookList()
  360. }else {
  361. this.$message.error(res.message);
  362. }
  363. })
  364. })
  365. },
  366. batchCanaleSubmit(){
  367. this.$nextTick(() => {
  368. submitPackingList({ ids: this.selectedRowKeys, type: '2' }).then(res => {
  369. if (res.success) {
  370. this.$message.success('取消提交成功')
  371. // record.theDocumentsState = '0'
  372. this.getBookList()
  373. this.selectedRowKeys = []
  374. }else {
  375. this.$message.error(res.message);
  376. }
  377. })
  378. })
  379. },
  380. // 操作 详情
  381. details(record) {
  382. this.$refs.detailsBookDrawer.visible = true
  383. },
  384. // 操作 编辑
  385. edit(record,pattern) {
  386. this.$nextTick(() => {
  387. bookListId({id:record.id}).then(res => {
  388. if (res.success) {
  389. var data =res.result
  390. if(pattern == '1'){
  391. this.$refs.addBookDrawer.visible = true
  392. this.$refs.addBookDrawer.defaultMethod = 'edit'
  393. this.$refs.addBookDrawer.addBook = data
  394. this.$refs.addBookDrawer.addBookData = data.syShippingOrderItemList
  395. this.$refs.addBookDrawer.addBookData.map(item =>{
  396. item.smallPo = item.smailPo
  397. item.itemNumber = item.styleNumber
  398. item.totalVolume = item.volume
  399. item.price = item.unitPrice
  400. })
  401. this.$refs.addBookDrawer.rmbList = data.rmbList
  402. this.$refs.addBookDrawer.usdList = data.usdList
  403. }else {
  404. this.$refs.detailsBookDrawer.visible = true
  405. this.$refs.detailsBookDrawer.addBook = data
  406. this.$refs.detailsBookDrawer.addBookData = data.syShippingOrderItemList
  407. this.$refs.detailsBookDrawer.rmbList = data.rmbList
  408. this.$refs.detailsBookDrawer.usdList = data.usdList
  409. }
  410. // this.bookListData = res.result.records
  411. }else {
  412. this.$message.error(res.message);
  413. }
  414. })
  415. })
  416. },
  417. // 操作 打印
  418. print(record) {},
  419. // 操作 删除
  420. handleDelete(id) {
  421. this.$nextTick(() => {
  422. if(this.queryParam.pageNo > 1 && this.bookListData.length === 1){
  423. this.queryParam.pageNo = this.queryParam.pageNo -1
  424. }
  425. deletePackingList({id:id}).then(res => {
  426. if (res.success) {
  427. this.getBookList()
  428. }else {
  429. this.$message.error(res.message);
  430. }
  431. })
  432. })
  433. },
  434. // // 分页、排序、筛选变化时触发
  435. handleTableChange(pagination, filters, sorter) {
  436. // console.log('当前页信息>>>>',pagination)
  437. this.queryParam.pageNo = pagination.current
  438. this.getBookList()
  439. },
  440. // 选中行
  441. onSelectChange(keys) {
  442. this.selectedRowKeys = keys
  443. }
  444. },
  445. computed: {},
  446. mounted() {}
  447. }
  448. </script>
  449. <style lang="less" scoped>
  450. @import '~@assets/less/common.less';
  451. @import '~@assets/less/overwriter.less';
  452. /deep/ .ant-table-thead > tr > th {
  453. text-align: center;
  454. // font-weight: 700;
  455. }
  456. /deep/ .ant-table-tbody {
  457. text-align: center;
  458. }
  459. // /deep/ th.replacecolor {
  460. // background-color: #ccc;
  461. // }
  462. </style>