preBookList.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  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.depositaryReceiptNo"></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 = "changeTime"> </a-date-picker>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :md="6" :sm="8">
  20. <a-form-item label="客户简称">
  21. <j-search-select-tag
  22. placeholder="请选择客户简称"
  23. v-model="queryParam.clientAbbreviation"
  24. dict="view_customer,customername,customername">
  25. </j-search-select-tag>
  26. </a-form-item>
  27. </a-col>
  28. <template v-if="toggleSearchStatus">
  29. <a-col :md="6" :sm="8">
  30. <a-form-item label="账套号">
  31. <j-search-select-tag
  32. placeholder="请选择账套号"
  33. v-model="queryParam.acSetNo"
  34. dict="view_account,account,account">
  35. </j-search-select-tag>
  36. </a-form-item>
  37. </a-col>
  38. <a-col :md="6" :sm="8">
  39. <a-form-item label="制单人">
  40. <!-- <a-input placeholder="请输入制单人" v-model="queryParam.createBy"></a-input> -->
  41. <j-search-select-tag
  42. placeholder="请选择制单人"
  43. v-model="queryParam.createBy"
  44. dict="view_createBy,createby,createby">
  45. </j-search-select-tag>
  46. </a-form-item>
  47. </a-col>
  48. <a-col :md="6" :sm="8">
  49. <a-form-item label="小po号">
  50. <a-input placeholder="请输入小po号" v-model="queryParam.smallPo"></a-input>
  51. </a-form-item>
  52. </a-col>
  53. <!-- <a-col :md="6" :sm="8">
  54. <a-form-item label="预托书号">
  55. <a-input placeholder="请输入预托书号" v-model="queryParam.depositaryReceiptNo"></a-input>
  56. </a-form-item>
  57. </a-col> -->
  58. </template>
  59. <a-col :md="6" :sm="8">
  60. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  61. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  62. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  63. <a @click="handleToggleSearch" style="margin-left: 8px">
  64. {{ toggleSearchStatus ? '收起' : '展开' }}
  65. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  66. </a>
  67. </span>
  68. </a-col>
  69. </a-row>
  70. </a-form>
  71. </div>
  72. </a-card>
  73. <!-- 操作按钮区域 新增-->
  74. <a-card :bordered="false" style="marginTop:10px;">
  75. <div class="table-operator">
  76. <a-button type="primary" @click="addPreBook" icon="plus">新增</a-button>
  77. </div>
  78. <!-- 子表 -->
  79. <a-table
  80. bordered
  81. v-if="preBookListData"
  82. :rowKey=" (row, index) => {return index;}"
  83. :columns="preBookListColumns"
  84. :data-source="preBookListData"
  85. :loading="loading"
  86. :pagination="ipagination"
  87. @change="handleTableChange"
  88. :scroll="{ x: 1500,y: 600 }"
  89. >
  90. <!-- 单据状态 -->
  91. <span slot="documentStateSlot" slot-scope="text, record">
  92. <a-tag color="orange" v-if="record.theDocumentsState == '0'">仅保存</a-tag>
  93. <a-tag color="green" v-if="record.theDocumentsState == '1'">已提交</a-tag>
  94. </span>
  95. <!-- 操作 -->
  96. <span slot="operationSlot" slot-scope="text, record">
  97. <a @click="print(record)">打印</a>
  98. <a-divider type="vertical" />
  99. <a-dropdown>
  100. <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
  101. <!-- 仅保存 -->
  102. <a-menu slot="overlay" v-if="record.theDocumentsState == '0'">
  103. <a-menu-item><a @click="details(record)">详情</a></a-menu-item>
  104. <a-menu-item><a @click="edit(record)">编辑</a></a-menu-item>
  105. <a-menu-item><a @click="copyForm(record)">复制</a></a-menu-item>
  106. <!-- <a-menu-item>
  107. <a-popconfirm title="确定提交吗?" ok-text="是" cancel-text="否" @confirm="submit(record)">
  108. <a href="javascript:void(0);" style="color:green;">提交</a>
  109. </a-popconfirm>
  110. </a-menu-item> -->
  111. <a-menu-item>
  112. <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(record)">
  113. <a href="javascript:void(0);" style="color:red;">删除</a>
  114. </a-popconfirm></a-menu-item>
  115. </a-menu>
  116. <!-- 已提交 -->
  117. <a-menu slot="overlay" v-if="record.theDocumentsState == '1'">
  118. <a-menu-item><a @click="details(record)">详情</a></a-menu-item>
  119. <a-menu-item><a @click="copyForm(record)">复制</a></a-menu-item>
  120. <!-- <a-menu-item>
  121. <a-popconfirm title="确定取消提交吗?" ok-text="是" cancel-text="否" @confirm="cancel(record)">
  122. <a href="javascript:void(0);" style="color:red;">取消提交</a>
  123. </a-popconfirm>
  124. </a-menu-item> -->
  125. </a-menu>
  126. </a-dropdown>
  127. </span>
  128. </a-table>
  129. </a-card>
  130. <!-- 抽屉 -->
  131. <addPreBook-drawer ref="addPreBookDrawer" :fatherList="getPreBookData" @ok="modalFormOk"></addPreBook-drawer>
  132. <detailsPreBook-drawer ref="detailsPreBookDrawer" @ok="modalFormOk"></detailsPreBook-drawer>
  133. </div>
  134. </template>
  135. <script>
  136. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  137. import JEllipsis from '@/components/jeecg/JEllipsis'
  138. import moment from 'moment'
  139. import addPreBookDrawer from '@views/pre-book/addPreBookDrawer.vue'
  140. import detailsPreBookDrawer from '@views/pre-book/detailsPreBookDrawer.vue'
  141. import { downFile } from '@/api/manage'
  142. import editPreBookDrawer from '@views/pre-book/editPreBookDrawer.vue'
  143. import { preBookList, addPreBook, preBookById, editById,deletePreBook,submit,cancelSubmit } from '@api/document/pre-book.js'
  144. export default {
  145. name: 'PreBookList', // 预托书列表
  146. mixins: [JeecgListMixin],
  147. components: { JEllipsis, moment, addPreBookDrawer, detailsPreBookDrawer, editPreBookDrawer },
  148. data() {
  149. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
  150. return {
  151. // 表头
  152. preBookListColumns: [
  153. {
  154. title: '预托书号',
  155. width: 150,
  156. dataIndex: 'depositaryReceiptNo',
  157. // fixed: 'left',
  158. align: 'left',
  159. className: 'replacecolor',
  160. ellipsis: true,
  161. },
  162. // { title: '订单号', width: 120, dataIndex: 'orderNumber', fixed: 'left', className: 'replacecolor' },
  163. // { title: '外销发票号码', dataIndex: 'exportInvoiceNo', width: 220, align: 'left', className: 'replacecolor' },
  164. { title: '客户简称', dataIndex: 'clientAbbreviation', width: 90, className: 'replacecolor', ellipsis: true, },
  165. {
  166. title: '分销点',
  167. dataIndex: 'distributionPoint',
  168. width: 130,
  169. // customRender: t => ellipsis(t),
  170. className: 'replacecolor',
  171. ellipsis: true,
  172. },
  173. {
  174. title: '经营单位',
  175. dataIndex: 'unitInOperation',
  176. width: 120,
  177. // customRender: t => ellipsis(t),
  178. ellipsis: true,
  179. className: 'replacecolor'
  180. },
  181. { title: '总箱数', dataIndex: 'boxNumber', width: 80, className: 'replacecolor', ellipsis: true, },
  182. { title: '总毛重', dataIndex: 'totalGrossWeight', width: 90, className: 'replacecolor', ellipsis: true, },
  183. { title: '总体积', dataIndex: 'totalVolume', width: 90, className: 'replacecolor', ellipsis: true, },
  184. {
  185. title: '金额',
  186. dataIndex: 'money',
  187. width: 100,
  188. className: 'replacecolor',
  189. ellipsis: true,
  190. },
  191. // {
  192. // title: '创建时间',
  193. // dataIndex: 'createTime',
  194. // align: 'center',
  195. // sorter: true,
  196. // customRender: text => {
  197. // return moment(text).format('YYYY-MM-DD')
  198. // }
  199. // },
  200. // { title: '实际船期', dataIndex: 'theActualShippingDate', width: 120, className: 'replacecolor' },
  201. // { title: '收汇方式', dataIndex: 'exchangeEarningsValue', width: 120, className: 'replacecolor' },
  202. // {
  203. // title: '收货人',
  204. // dataIndex: 'consignee',
  205. // width: 100,
  206. // customRender: t => ellipsis(t),
  207. // className: 'replacecolor'
  208. // },
  209. // {
  210. // title: '提单或承运收据',
  211. // dataIndex: 'billOfLadingOrCarriageReceipt',
  212. // width: 140,
  213. // customRender: t => ellipsis(t),
  214. // className: 'replacecolor'
  215. // },
  216. // {
  217. // title: '抬头人',
  218. // dataIndex: 'addressee',
  219. // width: 120,
  220. // customRender: t => ellipsis(t),
  221. // className: 'replacecolor'
  222. // },
  223. { title: '贸易国别', dataIndex: 'tradeCountry', width: 120, className: 'replacecolor' , ellipsis: true,},
  224. { title: '运抵国别', dataIndex: 'arriveInCountry', width: 120, className: 'replacecolor', ellipsis: true, },
  225. { title: '出口口岸', dataIndex: 'exportPort', width: 120, className: 'replacecolor', ellipsis: true, },
  226. // {
  227. // title: '通知人',
  228. // dataIndex: 'notifier',
  229. // width: 100,
  230. // customRender: t => ellipsis(t),
  231. // className: 'replacecolor'
  232. // },
  233. // { title: 'nottfy', dataIndex: 'nottfy', width: 150, className: 'replacecolor' },
  234. { title: '目的港', dataIndex: 'destinationPort', width: 140, className: 'replacecolor', ellipsis: true, },
  235. // { title: '装运期限', dataIndex: 'latestDateOfShipment', width: 120, className: 'replacecolor' },
  236. // {
  237. // title: '单据状态',
  238. // dataIndex: 'theDocumentsState',
  239. // width: 90,
  240. // scopedSlots: { customRender: 'documentStateSlot' },
  241. // fixed: 'right',
  242. // className: 'replacecolor'
  243. // },
  244. {
  245. title: '操作',
  246. dataIndex: 'operation',
  247. scopedSlots: { customRender: 'operationSlot' },
  248. width: 160,
  249. fixed: 'right',
  250. className: 'replacecolor'
  251. }
  252. ],
  253. preBookListData: [],
  254. id: '', //
  255. loading: false, // 表格加载
  256. // 查询条件
  257. queryParam: {
  258. depositaryReceiptNo: '',
  259. shippingOrderDate: '',//托书日期
  260. clientAbbreviation: '',
  261. acSetNo: '',
  262. smallPo: '',
  263. pageSize:'50',
  264. pageNo: '' // 点击的页数
  265. },
  266. dateFormat: 'YYYY-MM-DD',
  267. }
  268. },
  269. created() {
  270. // this.getPreBookData() // 渲染预托书
  271. },
  272. methods: {
  273. // 分页查询 预托书
  274. getPreBookData() {
  275. this.$nextTick(() => {
  276. // this.queryParam.pageSize = 50
  277. this.loading = true
  278. preBookList(this.queryParam).then(res => {
  279. this.loading = false
  280. if (res.success) {
  281. this.preBookListData = res.result.records;
  282. this.ipagination = {
  283. total: res.result.total,
  284. current: res.result.current,
  285. pageSize: res.result.size,
  286. pageSizeOptions: ["50", "100", "150"],
  287. }
  288. }else{
  289. this.$message.error(res.message)
  290. }
  291. })
  292. })
  293. },
  294. // 新增
  295. addPreBook() {
  296. this.$refs.addPreBookDrawer.addPreBook = {syLetterDepositItemList:[],syRmbList:[],syUsdList:[]};
  297. this.$refs.addPreBookDrawer.visible = true;
  298. },
  299. // 详情
  300. details(record) {
  301. preBookById({ id: record.id }).then(res => {
  302. if (res.success) {
  303. // 把通过id查询到的对象,赋值给子组件
  304. this.$refs.detailsPreBookDrawer.preBookDetails = res.result; //主表
  305. res.result.money = res.result.money.toFixed(2)
  306. res.result.syLetterDepositItemList.map(item =>{
  307. var str =item.hod
  308. var n=str.split(" ");
  309. item.hod = n[0]
  310. item.preDeliveryDate = item.hod
  311. })
  312. this.$refs.detailsPreBookDrawer.data = res.result.syLetterDepositItemList; //子表
  313. this.$refs.detailsPreBookDrawer.visible = true
  314. }else{
  315. this.$message.error(res.message)
  316. }
  317. })
  318. },
  319. // 编辑
  320. edit(record) {
  321. preBookById({ id: record.id }).then(res => {
  322. if (res.success) {
  323. res.result.consigneeAll = res.result.consignee+"+"+res.result.consigneeAddress+"+"+res.result.notifyParty+"+"+res.result.notifyPartyAddress;
  324. res.result.money = res.result.money.toFixed(2)
  325. this.$refs.addPreBookDrawer.addPreBook = res.result;
  326. this.$refs.addPreBookDrawer.defultMethod = 'edit';
  327. res.result.syLetterDepositItemList.map(item =>{
  328. var str =item.hod
  329. var n=str.split(" ");
  330. item.hod = n[0]
  331. item.preDeliveryDate = item.hod
  332. })
  333. this.$refs.addPreBookDrawer.data = res.result.syLetterDepositItemList;
  334. this.$refs.addPreBookDrawer.visible = true
  335. }else{
  336. this.$message.error(res.message)
  337. }
  338. })
  339. },
  340. //复制
  341. copyForm(record){
  342. preBookById({ id: record.id }).then(res => {
  343. if (res.success) {
  344. res.result.consigneeAll = res.result.consignee+"+"+res.result.consigneeAddress+"+"+res.result.notifyParty+"+"+res.result.notifyPartyAddress;
  345. res.result.money = res.result.money.toFixed(2)
  346. res.result.syLetterDepositItemList = []
  347. this.$refs.addPreBookDrawer.addPreBook = res.result;
  348. this.$refs.addPreBookDrawer.addPreBook.id=''
  349. this.$refs.addPreBookDrawer.defultMethod = 'edit';
  350. this.$refs.addPreBookDrawer.visible = true
  351. }else{
  352. this.$message.error(res.message)
  353. }
  354. })
  355. },
  356. // 操作 提交
  357. submit(record) {
  358. this.$nextTick(() => {
  359. submit({ id: record.id, type: '1' }).then(res => {
  360. if (res.success) {
  361. this.preBookListData.theDocumentsState == '1'
  362. this.getPreBookData()
  363. this.$message.success('提交成功')
  364. }else{
  365. this.$message.error(res.message)
  366. }
  367. })
  368. })
  369. },
  370. // 取消提交
  371. cancel(record) {
  372. this.$nextTick(() => {
  373. cancelSubmit({ id: record.id, type: '2' }).then(res => {
  374. if (res.success) {
  375. this.preBookListData.theDocumentsState == '0'
  376. this.getPreBookData()
  377. this.$message.success('取消提交成功')
  378. }else{
  379. this.$message.error(res.message)
  380. }
  381. })
  382. })
  383. },
  384. // 删除
  385. handleDelete(record) {
  386. this.$nextTick(() => {
  387. if(this.queryParam.pageNo > 1 && this.preBookListData.length === 1){
  388. this.queryParam.pageNo = this.queryParam.pageNo -1
  389. }
  390. deletePreBook({ id: record.id }).then(res => {
  391. if (res.success) {
  392. this.getPreBookData()
  393. this.$message.success('删除成功')
  394. }else{
  395. this.$message.error(res.message)
  396. }
  397. })
  398. })
  399. },
  400. //托书日期改变触发
  401. changeTime(val){
  402. this.queryParam.shippingOrderDate= val.format('YYYY-MM-DD')
  403. },
  404. // 查询按钮
  405. searchQuery() {
  406. this.toggleSearchStatus = false
  407. this.getPreBookData() /// 渲染渲染预托书
  408. },
  409. // 重置
  410. searchReset() {
  411. var dd =this.queryParam
  412. this.queryParam = {
  413. depositaryReceiptNo: '',
  414. shippingOrderDate: '',//托书日期
  415. clientAbbreviation: '',
  416. acSetNo: '',
  417. smallPo: '',
  418. pageSize:this.queryParam.pageSize,
  419. pageNo: '' // 点击的页数
  420. }
  421. this.getPreBookData()
  422. },
  423. // 操作 打印
  424. print(record) {
  425. downFile('/letterDeposit/syLetterDeposit/printSyletterDeposit',{id:record.id}).then(data => {
  426. if (!data) {
  427. this.$message.warning('文件下载失败')
  428. return
  429. }
  430. if (typeof window.navigator.msSaveBlob !== 'undefined') {
  431. window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), record.depositaryReceiptN + '.xlsx')
  432. } else {
  433. let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
  434. let link = document.createElement('a')
  435. link.style.display = 'none'
  436. link.href = url
  437. link.setAttribute('download', record.depositaryReceiptNo+'.xlsx')
  438. document.body.appendChild(link)
  439. link.click()
  440. document.body.removeChild(link) // 下载完成移除元素
  441. window.URL.revokeObjectURL(url) // 释放掉blob对象
  442. }
  443. })
  444. },
  445. handleTableChange(pagination, filters, sorter) {
  446. this.queryParam.pageNo = pagination.current
  447. this.queryParam.pageSize = pagination.pageSize
  448. this.getPreBookData()
  449. },
  450. aa() {},
  451. bb() {},
  452. cc() {}
  453. },
  454. computed: {},
  455. mounted() {}
  456. }
  457. </script>
  458. <style lang="less" scoped>
  459. @import '~@assets/less/common.less';
  460. @import '~@assets/less/overwriter.less';
  461. /deep/ .ant-table-thead > tr > th {
  462. text-align: center;
  463. // font-weight: 700;
  464. }
  465. /deep/ .ant-table-tbody {
  466. text-align: center;
  467. }
  468. // /deep/ th.replacecolor {
  469. // background-color: #ccc;
  470. // }
  471. /deep/ .ant-table-tbody .ant-table-row td{
  472. padding-top: 8px;
  473. padding-bottom: 8px;
  474. }
  475. /deep/.ant-card-body{
  476. padding-top: 10px !important;
  477. padding-bottom: 0px !important;
  478. }
  479. /deep/.table-operator .ant-btn{
  480. margin: 0 8px 3px 0;
  481. }
  482. /deep/.table-page-search-wrapper .ant-form-inline .ant-form-item{
  483. margin-bottom: 10px;
  484. }
  485. /deep/.table-page-search-wrapper .table-page-search-submitButtons{
  486. margin-bottom: 10px;
  487. }
  488. /deep/ thead.ant-table-thead>tr{
  489. height: 0 !important;
  490. }
  491. /deep/ .ant-table-thead > tr > th, .ant-table-tbody > tr > td{
  492. padding: 9px 16px
  493. }
  494. /deep/.ant-table-fixed-header .ant-table-scroll .ant-table-header{
  495. width: calc(100% + 9px);//减去滚动条的宽度
  496. }
  497. </style>