preBookList.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  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.aa"> </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.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="id"
  65. :columns="preBookListColumns"
  66. :data-source="preBookListData"
  67. :loading="loading"
  68. :pagination="pagination"
  69. @change="handleTableChange"
  70. :scroll="{ x: 1500 }"
  71. >
  72. <!-- 金额 输入框-->
  73. <template slot="money" slot-scope="text, record, index">
  74. <a-form-model-item prop="money" :rules="rules.money" required>
  75. <a-input style="width:100%" type="text" v-model="record.money" />
  76. </a-form-model-item>
  77. </template>
  78. <!-- 单据状态 -->
  79. <span slot="documentStateSlot" slot-scope="text, record">
  80. <a-tag color="orange" v-if="record.theDocumentsState == '0'">仅保存</a-tag>
  81. <a-tag color="green" v-if="record.theDocumentsState == '1'">已提交</a-tag>
  82. </span>
  83. <!-- 操作 -->
  84. <span slot="operationSlot" slot-scope="text, record">
  85. <a @click="print(record)">打印</a>
  86. <a-divider type="vertical" />
  87. <a-dropdown>
  88. <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
  89. <!-- 仅保存 -->
  90. <a-menu slot="overlay" v-if="record.theDocumentsState == '0'">
  91. <a-menu-item><a @click="details(record)">详情</a></a-menu-item>
  92. <a-menu-item><a @click="edit(record)">编辑</a></a-menu-item>
  93. <a-menu-item>
  94. <a-popconfirm title="确定提交吗?" ok-text="是" cancel-text="否" @confirm="submit(record)">
  95. <a href="javascript:void(0);" style="color:green;">提交</a>
  96. </a-popconfirm>
  97. </a-menu-item>
  98. <a-menu-item>
  99. <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(record)">
  100. <a href="javascript:void(0);" style="color:red;">删除</a>
  101. </a-popconfirm></a-menu-item
  102. >
  103. </a-menu>
  104. <!-- 已提交 -->
  105. <a-menu slot="overlay" v-if="record.theDocumentsState == '1'">
  106. <a-menu-item><a @click="details(record)">详情</a></a-menu-item>
  107. <a-menu-item>
  108. <a-popconfirm title="确定取消提交吗?" ok-text="是" cancel-text="否" @confirm="cancel(record)">
  109. <a href="javascript:void(0);" style="color:red;">取消提交</a>
  110. </a-popconfirm>
  111. </a-menu-item>
  112. </a-menu>
  113. </a-dropdown>
  114. </span>
  115. </a-table>
  116. </a-card>
  117. <!-- 抽屉 -->
  118. <addPreBook-drawer ref="addPreBookDrawer" :father="aa" @ok="modalFormOk"></addPreBook-drawer>
  119. <detailsPreBook-drawer ref="detailsPreBookDrawer" :father="bb" @ok="modalFormOk"></detailsPreBook-drawer>
  120. <editPreBook-drawer ref="editPreBookDrawer" :father="cc" @ok="modalFormOk"></editPreBook-drawer>
  121. </div>
  122. </template>
  123. <script>
  124. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  125. import JEllipsis from '@/components/jeecg/JEllipsis'
  126. import moment from 'moment'
  127. import addPreBookDrawer from '@views/pre-book/addPreBookDrawer.vue'
  128. import detailsPreBookDrawer from '@views/pre-book/detailsPreBookDrawer.vue'
  129. import editPreBookDrawer from '@views/pre-book/editPreBookDrawer.vue'
  130. import { preBookList, addPreBook, preBookById, editById } from '@api/document/pre-book.js'
  131. export default {
  132. name: 'PreBookList', // 预托书列表
  133. mixins: [JeecgListMixin],
  134. components: { JEllipsis, moment, addPreBookDrawer, detailsPreBookDrawer, editPreBookDrawer },
  135. data() {
  136. let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
  137. return {
  138. // 表头
  139. preBookListColumns: [
  140. {
  141. title: '预托书号',
  142. width: 220,
  143. dataIndex: 'depositaryReceiptNo',
  144. fixed: 'left',
  145. align: 'left',
  146. className: 'replacecolor'
  147. },
  148. { title: '订单号', width: 120, dataIndex: 'orderNumber', fixed: 'left', className: 'replacecolor' },
  149. { title: '外销发票号码', dataIndex: 'exportInvoiceNo', width: 220, align: 'left', className: 'replacecolor' },
  150. { title: '客户简称', dataIndex: 'clientAbbreviation', width: 120, className: 'replacecolor' },
  151. {
  152. title: '分销点',
  153. dataIndex: 'distributionPoint',
  154. width: 120,
  155. customRender: t => ellipsis(t),
  156. className: 'replacecolor'
  157. },
  158. {
  159. title: '经营单位',
  160. dataIndex: 'unitInOperation',
  161. width: 150,
  162. customRender: t => ellipsis(t),
  163. className: 'replacecolor'
  164. },
  165. { title: '总箱数', dataIndex: 'boxNumber', width: 120, className: 'replacecolor' },
  166. { title: '总毛重', dataIndex: 'totalGrossWeight', width: 120, className: 'replacecolor' },
  167. { title: '总体积', dataIndex: 'totalVolume', width: 100, className: 'replacecolor' },
  168. {
  169. title: '金额',
  170. dataIndex: 'money',
  171. scopedSlots: { customRender: 'money' },
  172. width: 140,
  173. className: 'replacecolor'
  174. },
  175. // {
  176. // title: '创建时间',
  177. // dataIndex: 'createTime',
  178. // align: 'center',
  179. // sorter: true,
  180. // customRender: text => {
  181. // return moment(text).format('YYYY-MM-DD')
  182. // }
  183. // },
  184. { title: '实际船期', dataIndex: 'theActualShippingDate', width: 120, className: 'replacecolor' },
  185. { title: '收汇方式', dataIndex: 'exchangeEarningsValue', width: 120, className: 'replacecolor' },
  186. {
  187. title: '收货人',
  188. dataIndex: 'consignee',
  189. width: 100,
  190. customRender: t => ellipsis(t),
  191. className: 'replacecolor'
  192. },
  193. {
  194. title: '提单或承运收据',
  195. dataIndex: 'billOfLadingOrCarriageReceipt',
  196. width: 140,
  197. customRender: t => ellipsis(t),
  198. className: 'replacecolor'
  199. },
  200. {
  201. title: '抬头人',
  202. dataIndex: 'addressee',
  203. width: 120,
  204. customRender: t => ellipsis(t),
  205. className: 'replacecolor'
  206. },
  207. { title: '贸易国别', dataIndex: 'tradeCountry', width: 100, className: 'replacecolor' },
  208. { title: '运抵国别', dataIndex: 'arriveInCountry', width: 100, className: 'replacecolor' },
  209. { title: '出口口岸', dataIndex: 'exportPort', width: 100, className: 'replacecolor' },
  210. {
  211. title: '通知人',
  212. dataIndex: 'notifier',
  213. width: 100,
  214. customRender: t => ellipsis(t),
  215. className: 'replacecolor'
  216. },
  217. { title: 'nottfy', dataIndex: 'nottfy', width: 150, className: 'replacecolor' },
  218. { title: '目的港', dataIndex: 'destinationPort', width: 100, className: 'replacecolor' },
  219. { title: '装运期限', dataIndex: 'latestDateOfShipment', width: 120, className: 'replacecolor' },
  220. {
  221. title: '单据状态',
  222. dataIndex: 'theDocumentsState',
  223. width: 90,
  224. scopedSlots: { customRender: 'documentStateSlot' },
  225. fixed: 'right',
  226. className: 'replacecolor'
  227. },
  228. {
  229. title: '操作',
  230. dataIndex: 'operation',
  231. scopedSlots: { customRender: 'operationSlot' },
  232. width: 160,
  233. fixed: 'right',
  234. className: 'replacecolor'
  235. }
  236. ],
  237. preBookListData: [],
  238. id: '', //
  239. loading: false, // 表格加载
  240. // 查询条件
  241. queryParam: {
  242. orderNumber: '',
  243. aa: '',//订单日期
  244. clientAbbreviation: '',
  245. containerNumber: '',
  246. smallPo: '',
  247. depositaryReceiptNo: '',
  248. pageNo: '' // 点击的页数
  249. },
  250. pagination: {
  251. // total: '',
  252. // current: 0,
  253. // pageSize: 0
  254. },
  255. dateFormat: 'YYYY-MM-DD',
  256. }
  257. },
  258. created() {
  259. this.getPreBookData() // 渲染预托书
  260. },
  261. methods: {
  262. // 分页查询 预托书
  263. getPreBookData() {
  264. this.$nextTick(() => {
  265. preBookList(this.queryParam).then(res => {
  266. if (res.success) {
  267. this.preBookListData = res.result.records
  268. console.log('预托书列表', this.preBookListData)
  269. this.pagination = {
  270. total: res.result.total,
  271. current: res.result.current,
  272. pageSize: res.result.size
  273. }
  274. }
  275. })
  276. })
  277. },
  278. // 新增
  279. addPreBook() {
  280. this.$refs.addPreBookDrawer.addPreBook = {syLetterDepositItemList:[],syRmbList:[],syUsdList:[]};
  281. this.$refs.addPreBookDrawer.visible = true;
  282. },
  283. // 详情
  284. details(record) {
  285. // console.log('点击项的ID', record.id)
  286. preBookById({ id: record.id }).then(res => {
  287. if (res.success) {
  288. // 把通过id查询到的对象,赋值给子组件
  289. this.$refs.detailsPreBookDrawer.preBookDetails = res.result; //主表
  290. this.$refs.detailsPreBookDrawer.data = res.result.syLetterDepositItemList; //子表
  291. this.$refs.detailsPreBookDrawer.visible = true
  292. }else{
  293. this.$message.error(res.message)
  294. }
  295. })
  296. },
  297. // 编辑
  298. edit(record) {
  299. preBookById({ id: record.id }).then(res => {
  300. if (res.success) {
  301. this.$refs.addPreBookDrawer.addPreBook = res.result;
  302. this.$refs.addPreBookDrawer.data = res.result.syLetterDepositItemList;
  303. this.$refs.editPreBookDrawer.visible = true
  304. }else{
  305. this.$message.error(res.message)
  306. }
  307. })
  308. },
  309. // 操作 提交
  310. submit(record) {
  311. console.log('点击id:', record.id)
  312. this.$nextTick(() => {
  313. submit({ id: record.id, type: '1' }).then(res => {
  314. if (res.success) {
  315. console.log('提交成功,单据状态改为【已提交】')
  316. this.preBookListData.theDocumentsState == '1'
  317. this.getPreBookData()
  318. this.$message.success('提交成功')
  319. }
  320. })
  321. })
  322. },
  323. // 取消提交
  324. cancel(record) {
  325. console.log('取消订单id:', record.id)
  326. this.$nextTick(() => {
  327. cancelSubmit({ id: record.id, type: '2' }).then(res => {
  328. if (res.success) {
  329. console.log('取消提交成功,单据状态改为【仅保存】')
  330. this.preBookListData.theDocumentsState == '0'
  331. this.getPreBookData()
  332. this.$message.success('取消提交成功')
  333. }
  334. })
  335. })
  336. },
  337. // 删除
  338. handleDelete(record) {
  339. console.log('点击删除项id:', record.id)
  340. this.$nextTick(() => {
  341. deletePreBook({ id: record.id }).then(res => {
  342. console.log('res:', res)
  343. this.getPreBookData()
  344. this.$message.success('删除成功')
  345. })
  346. })
  347. },
  348. // 查询按钮
  349. searchQuery() {
  350. this.getPreBookData() /// 渲染渲染预托书
  351. },
  352. // 重置
  353. searchReset() {
  354. this.queryParam = {}
  355. this.getPreBookData()
  356. },
  357. // 操作 打印
  358. print(record) {},
  359. handleTableChange(pagination, filters, sorter) {
  360. this.queryParam.pageNo = pagination.current
  361. this.getPreBookData()
  362. },
  363. aa() {},
  364. bb() {},
  365. cc() {}
  366. },
  367. computed: {},
  368. mounted() {}
  369. }
  370. </script>
  371. <style lang="less" scoped>
  372. @import '~@assets/less/common.less';
  373. @import '~@assets/less/overwriter.less';
  374. /deep/ .ant-table-thead > tr > th {
  375. text-align: center;
  376. // font-weight: 700;
  377. }
  378. /deep/ .ant-table-tbody {
  379. text-align: center;
  380. }
  381. // /deep/ th.replacecolor {
  382. // background-color: #ccc;
  383. // }
  384. </style>