index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <div>
  3. <basic-container v-show="!show">
  4. <avue-crud
  5. :option="option"
  6. :data="dataList"
  7. :page.sync="page"
  8. :table-loading="loading"
  9. :key="key"
  10. ref="crud"
  11. @refresh-change="refreshChange"
  12. @search-change="searchChange"
  13. @resetColumn="resetColumn"
  14. @saveColumn="saveColumn"
  15. @on-load="onLoad">
  16. <template slot-scope="scope" slot="menuLeft">
  17. <el-button type="primary"
  18. icon="el-icon-plus"
  19. size="small"
  20. @click="rowSave">新增</el-button>
  21. </template>
  22. <template slot-scope="{type,size,row,index}" slot="menu">
  23. <el-button icon="el-icon-view" :size="size" :type="type" @click.stop="rowCell(row,index)">查看</el-button>
  24. <el-button icon="el-icon-delete" :size="size" :type="type" v-if="row.status === 0" @click.stop="rowDel(row)">删除</el-button>
  25. </template>
  26. </avue-crud>
  27. </basic-container>
  28. <details-page-edit v-if="show" @backToList="backToList" :detailData="detailData" :id="id"></details-page-edit>
  29. </div>
  30. </template>
  31. <script>
  32. import detailsPageEdit from './detailsPageEdit'
  33. import {selectInvoiceList,removeDelegationList} from '@/api/bidingDocument/issueTender'
  34. export default {
  35. components: {
  36. detailsPageEdit
  37. },
  38. data(){
  39. return {
  40. page: {
  41. pageSize: 10,
  42. currentPage: 1,
  43. total: 0,
  44. pageSizes: [10, 50, 100, 200, 300]
  45. },
  46. key:0,
  47. query:{},
  48. dataList:[],
  49. detailData: {},
  50. loading:false,
  51. show:false,
  52. id:'',
  53. option:{},
  54. optionList:{
  55. addBtn:false,
  56. editBtn:false,
  57. delBtn:false,
  58. align: 'center',
  59. index: true,
  60. border: true,
  61. stripe: true,
  62. searchMenuPosition:"right",
  63. searchSpan: 8,
  64. searchIcon: true,
  65. searchIndex: 2,
  66. highlightCurrentRow: true,
  67. selection: true,
  68. height: "auto",
  69. column: [{
  70. label: '发布日期',
  71. prop: 'releaseTime',
  72. search: true,
  73. overHidden: true,
  74. type: "date",
  75. searchRange: true,
  76. defaultTime: ['00:00:00', '23:59:59'],
  77. format: "yyyy-MM-dd HH:mm",
  78. valueFormat: "yyyy-MM-dd HH:mm:ss",
  79. width:150,
  80. index:1,
  81. },{
  82. label: '截止日期',
  83. prop: 'deadlineTime',
  84. overHidden: true,
  85. search: true,
  86. type: "date",
  87. searchRange: true,
  88. defaultTime: ['00:00:00', '23:59:59'],
  89. format: "yyyy-MM-dd HH:mm",
  90. valueFormat: "yyyy-MM-dd HH:mm:ss",
  91. width:150,
  92. index:2,
  93. },{
  94. label: '起运港',
  95. prop: 'departureHarbor',
  96. overHidden: true,
  97. width:120,
  98. index:3,
  99. },{
  100. label: '目的港',
  101. prop: 'objectiveHarbor',
  102. overHidden: true,
  103. width:120,
  104. index:4,
  105. },{
  106. label: '箱型箱量',
  107. prop: 'boxTypeQuantity',
  108. overHidden: true,
  109. width:120,
  110. index:5,
  111. },{
  112. label: '装柜日期',
  113. prop: 'loadingTime',
  114. overHidden: true,
  115. search: true,
  116. type: "date",
  117. searchRange: true,
  118. defaultTime: ['00:00:00', '23:59:59'],
  119. format: "yyyy-MM-dd HH:mm",
  120. valueFormat: "yyyy-MM-dd HH:mm:ss",
  121. width:150,
  122. index:6,
  123. },{
  124. label: '货物信息',
  125. prop: 'cargoInformation',
  126. overHidden: true,
  127. width:120,
  128. index:7,
  129. },{
  130. label: '制单日期',
  131. prop: 'createTime',
  132. search: true,
  133. overHidden: true,
  134. type: "date",
  135. searchRange: true,
  136. defaultTime: ['00:00:00', '23:59:59'],
  137. format: "yyyy-MM-dd HH:mm",
  138. valueFormat: "yyyy-MM-dd HH:mm:ss",
  139. width:150,
  140. index:8,
  141. }, {
  142. label: '状态',
  143. disabled:true,
  144. prop: 'status',
  145. dataType: "string",
  146. type: 'select',
  147. dicUrl: "/api/blade-system/dict-biz/dictionary?code=main_bid_status",
  148. props: {
  149. label: "dictValue",
  150. value: "dictKey"
  151. },
  152. width:100,
  153. index:9,
  154. }]
  155. }
  156. }
  157. },
  158. async created() {
  159. if (this.$route.query.check){
  160. this.detailData = {
  161. id: this.$route.query.check.billId,
  162. check: this.$route.query.check,
  163. auditId: this.$route.query.check.id
  164. };
  165. this.id = this.$route.query.check.billId
  166. this.show = true
  167. this.$router.$avueRouter.closeTag(window.location.hash.slice(1))
  168. }else {
  169. this.detailData = {}
  170. }
  171. this.option = await this.getColumnData(this.getColumnName(201), this.optionList);
  172. this.key++
  173. let i = 0;
  174. if (i % 3 !== 0) {
  175. const num = 3 - Number(i % 3)
  176. this.option.searchMenuSpan = num * 8;
  177. this.option.searchMenuPosition = "right";
  178. }
  179. },
  180. methods:{
  181. //自定义列保存
  182. async saveColumn() {
  183. /**
  184. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  185. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  186. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  187. */
  188. const inSave = await this.saveColumnData(this.getColumnName(201), this.option);
  189. if (inSave) {
  190. this.$message.success("保存成功");
  191. //关闭窗口
  192. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  193. }
  194. },
  195. //自定义列重置
  196. async resetColumn() {
  197. this.option = this.optionList;
  198. const inSave = await this.delColumnData(this.getColumnName(201), this.optionList);
  199. if (inSave) {
  200. this.$message.success("重置成功");
  201. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  202. }
  203. },
  204. rowSave(){
  205. this.show = true
  206. },
  207. backToList(args){
  208. this.show = false
  209. this.id = ''
  210. },
  211. //查看
  212. rowCell(row, index) {
  213. this.id = row.id
  214. this.show = true
  215. },
  216. //列表删除
  217. rowDel(row) {
  218. this.$confirm('此操作将永久删除该单据, 是否继续?', '提示', {
  219. confirmButtonText: '确定',
  220. cancelButtonText: '取消',
  221. type: 'warning'
  222. }).then(() => {
  223. removeDelegationList({id: row.id}).then(res => {
  224. this.$message.success('删除成功');
  225. this.onLoad(this.page)
  226. })
  227. }).catch(() => {
  228. this.$message({
  229. type: 'info',
  230. message: '已取消删除'
  231. });
  232. });
  233. },
  234. //刷新按钮
  235. refreshChange(){
  236. this.onLoad(this.page)
  237. },
  238. //搜索
  239. searchChange(params, done) {
  240. let data = params
  241. if (params.releaseTime) {
  242. data.releaseBeginTime = params.releaseTime[0]
  243. data.releaseEndTime = params.releaseTime[1]
  244. }
  245. if (params.deadlineTime) {
  246. data.deadlineBeginTime = params.deadlineTime[0]
  247. data.deadlineEndTime = params.deadlineTime[1]
  248. }
  249. if (params.loadingTime) {
  250. data.loadingBeginTime = params.loadingTime[0]
  251. data.loadingEndTime = params.loadingTime[1]
  252. }
  253. if (params.createTime) {
  254. data.createBeginTime = params.createTime[0]
  255. data.createEndTime = params.createTime[1]
  256. }
  257. delete data.releaseTime
  258. delete data.deadlineTime
  259. delete data.loadingTime
  260. delete data.createTime
  261. this.query = data;
  262. this.onLoad(this.page, data)
  263. done();
  264. },
  265. onLoad(page, params = {}) {
  266. let queryParams = {
  267. size: page.pageSize,
  268. current: page.currentPage,
  269. ...Object.assign(params, this.query)
  270. }
  271. this.loading = true;
  272. selectInvoiceList(queryParams).then(res=>{
  273. this.dataList = res.data.data.records
  274. this.page.total = res.data.data.total
  275. }).finally(() => {
  276. this.loading = false;
  277. })
  278. }
  279. }
  280. }
  281. </script>
  282. <style scoped>
  283. </style>