preBookList.vue 16 KB

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