index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <div>
  3. <basic-container v-if="show">
  4. <avue-crud
  5. :table-loading="loading"
  6. :data="dataList"
  7. :page.sync="page"
  8. ref="crud"
  9. :option="option"
  10. @on-load="onLoad"
  11. @row-del="rowDel"
  12. @search-change="searchChange">
  13. <!-- <template slot="menuLeft" slot-scope="{size}">-->
  14. <!-- <el-button type="primary" :size="size" @click="rowSave">新增</el-button>-->
  15. <!-- </template>-->
  16. <template slot-scope="{row,index}" slot="menu">
  17. <el-button type="text"
  18. icon="el-icon-edit"
  19. size="small"
  20. @click.stop="rowCell(row,index)">编辑</el-button>
  21. <el-button type="text"
  22. icon="el-icon-delete"
  23. size="small"
  24. @click.stop="$refs.crud.rowDel(row,index)">删除</el-button>
  25. </template>
  26. </avue-crud>
  27. </basic-container>
  28. <detail-page v-else @backToList="backToList" :id="id"></detail-page>
  29. </div>
  30. </template>
  31. <script>
  32. import detailPage from './detailPage'
  33. import {removeDelegationList, selectInvoiceList} from "@/api/landTransportation";
  34. export default {
  35. name: "index",
  36. components: {
  37. detailPage
  38. },
  39. data(){
  40. return{
  41. id:'',
  42. show:true,
  43. loading:false,
  44. dataList:[],
  45. page: {
  46. pageSize: 10,
  47. currentPage: 1,
  48. total: 0,
  49. pageSizes: [10,50,100,200,300]
  50. },
  51. option:{
  52. align:'center',
  53. index: true,
  54. addBtn: false,
  55. editBtn: false,
  56. delBtn:false,
  57. height:"auto",
  58. searchSpan: 8,
  59. searchIcon: true,
  60. column:[{
  61. label: '状态',
  62. prop: 'itemStatusDetail',
  63. index: 1,
  64. width: 140
  65. }, {
  66. label: '订单号',
  67. prop: 'id',
  68. index: 1,
  69. overHidden: true,
  70. width: 160,
  71. search: true,
  72. }, {
  73. label: '客户名称',
  74. prop: 'corpName',
  75. overHidden: true,
  76. index: 1,
  77. width: 140,
  78. search: true,
  79. }, {
  80. label: '所属公司',
  81. prop: 'corpName',
  82. overHidden: true,
  83. index: 1,
  84. width: 140,
  85. search: true,
  86. }, {
  87. label: '提单号',
  88. prop: 'billNo',
  89. index: 1,
  90. overHidden: true,
  91. width: 140,
  92. search: true,
  93. }, {
  94. label: '货物名称',
  95. prop: 'goods',
  96. overHidden: true,
  97. index: 1,
  98. width: 140,
  99. search: true,
  100. }, {
  101. label: '路线',
  102. prop: 'id',
  103. overHidden: true,
  104. index: 1,
  105. width: 140,
  106. search: true,
  107. }, {
  108. label: '场站',
  109. prop: 'station',
  110. overHidden: true,
  111. index: 1,
  112. width: 140,
  113. search: true,
  114. }, {
  115. label: '到厂时间',
  116. prop: 'arrivalTime',
  117. overHidden: true,
  118. index: 1,
  119. width: 140,
  120. search: true,
  121. }, {
  122. label: '工厂名称',
  123. prop: 'factory',
  124. overHidden: true,
  125. index: 1,
  126. width: 140,
  127. search: true,
  128. }, {
  129. label: '制单日期',
  130. overHidden: true,
  131. prop: 'createTime',
  132. index: 1,
  133. width: 140,
  134. search: true,
  135. }]
  136. }
  137. }
  138. },
  139. created() {
  140. let i = 0;
  141. this.option.column.forEach(item => {
  142. if (item.search) i++
  143. })
  144. if (i % 3 !== 0) {
  145. const num = 3 - Number(i % 3)
  146. this.option.searchMenuSpan = num * 8;
  147. this.option.searchMenuPosition = "right";
  148. }
  149. },
  150. methods:{
  151. onLoad(page, params) {
  152. let queryParams = {
  153. size: page.pageSize,
  154. current: page.currentPage,
  155. kind: '2',
  156. ...params
  157. }
  158. this.loading = true;
  159. selectInvoiceList(queryParams).then(res => {
  160. this.dataList = res.data.data.records
  161. this.page.total = res.data.data.total
  162. }).finally(() => {
  163. this.loading = false;
  164. })
  165. },
  166. //搜索
  167. searchChange(params,done) {
  168. this.onLoad(this.page,params)
  169. done();
  170. },
  171. //列表删除
  172. rowDel(row){
  173. this.$confirm('此操作将永久删除该单据, 是否继续?', '提示', {
  174. confirmButtonText: '确定',
  175. cancelButtonText: '取消',
  176. type: 'warning'
  177. }).then(() => {
  178. removeDelegationList({ids:row.id}).then(res=>{
  179. this.$message.success('删除成功');
  180. this.onLoad(this.page)
  181. })
  182. }).catch(() => {
  183. this.$message({
  184. type: 'info',
  185. message: '已取消删除'
  186. });
  187. });
  188. },
  189. //行编辑
  190. rowCell(row,index){
  191. console.log(row.id)
  192. this.id = row.id
  193. this.show = false
  194. },
  195. rowSave(){
  196. this.show = false
  197. },
  198. backToList(){
  199. this.show = true
  200. }
  201. }
  202. }
  203. </script>
  204. <style scoped>
  205. </style>