book-list.vue 20 KB

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