preBookList.vue 18 KB

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