index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <template>
  2. <div>
  3. <basic-container v-if="isShow">
  4. <avue-crud
  5. ref="crud"
  6. id="out-table"
  7. :option="option"
  8. :table-loading="loading"
  9. :data="data"
  10. :page.sync="page"
  11. :search.sync="query"
  12. @search-change="searchChange"
  13. @search-reset="searchReset"
  14. @selection-change="selectionChange"
  15. @current-change="currentChange"
  16. @size-change="sizeChange"
  17. @refresh-change="refreshChange"
  18. @on-load="onLoad"
  19. >
  20. <template slot="menuLeft">
  21. <el-button
  22. type="primary"
  23. size="small"
  24. icon="el-icon-plus"
  25. @click="addButton"
  26. >创建单据
  27. </el-button>
  28. </template>
  29. <template slot="menu" slot-scope="{ row, index }">
  30. <el-button
  31. size="small"
  32. icon="el-icon-edit"
  33. type="text"
  34. @click="rowEdit(row)"
  35. >编辑
  36. </el-button>
  37. <el-button
  38. size="small"
  39. icon="el-icon-delete"
  40. type="text"
  41. @click="rowDel(row, index)"
  42. :disabled="row.count > 0"
  43. >删 除
  44. </el-button>
  45. </template>
  46. <template slot="contractNo" slot-scope="{ row }">
  47. <span style="color: #1e9fff;cursor: pointer;" @click="rowEdit(row)">
  48. {{ row.contractNo }}
  49. </span>
  50. </template>
  51. </avue-crud>
  52. </basic-container>
  53. <detailsPage
  54. v-if="!isShow"
  55. :detailData="detailData"
  56. @goBack="goBack"
  57. ></detailsPage>
  58. </div>
  59. </template>
  60. <script>
  61. import { getList, remove } from '@/api/claimSettlement/index';
  62. import detailsPage from './detailsPage.vue';
  63. import { getToken } from '@/util/auth';
  64. export default {
  65. data() {
  66. return {
  67. isShow: true,
  68. form: {},
  69. query: {},
  70. loading: false,
  71. page: {
  72. pageSize: 10,
  73. currentPage: 1,
  74. total: 0
  75. },
  76. selectionList: [],
  77. option: {
  78. height: 'auto',
  79. calcHeight: 30,
  80. menuWidth: 140,
  81. tip: false,
  82. searchShow: true,
  83. searchMenuSpan: 24,
  84. border: true,
  85. index: true,
  86. addBtn: false,
  87. viewBtn: false,
  88. editBtn: false,
  89. delBtn: false,
  90. selection: true,
  91. searchIcon: true,
  92. align: 'center',
  93. searchIndex: 3,
  94. column: [
  95. {
  96. label: '理赔单号',
  97. prop: 'claimNo',
  98. search: true,
  99. overHidden: true
  100. },
  101. {
  102. label: '来源类型',
  103. prop: 'claimSourceType',
  104. search: true,
  105. type: 'select',
  106. dicData: [
  107. {
  108. label: '经销商',
  109. value: 1
  110. },
  111. {
  112. label: '门店',
  113. value: 2
  114. },
  115. {
  116. label: '终端消费者',
  117. value: 3
  118. }
  119. ],
  120. overHidden: true
  121. },
  122. {
  123. label: '来源方名称',
  124. prop: 'sourceName',
  125. width: 90,
  126. search: true,
  127. overHidden: true
  128. },
  129. {
  130. label: '消费者姓名',
  131. prop: 'consumerName',
  132. width: 90,
  133. search: true,
  134. overHidden: true
  135. },
  136. {
  137. label: '消费者电话',
  138. prop: 'consumerPhone',
  139. width: 90,
  140. overHidden: true
  141. },
  142. {
  143. label: '胎号',
  144. prop: 'tyreNo',
  145. overHidden: true
  146. },
  147. {
  148. label: '规格型号',
  149. prop: 'tyreSpecs',
  150. overHidden: true
  151. },
  152. {
  153. label: '购买日期',
  154. prop: 'purchaseDate',
  155. overHidden: true
  156. },
  157. {
  158. label: '装车日期',
  159. prop: 'mountDate',
  160. overHidden: true
  161. },
  162. {
  163. label: '行驶里程(km)',
  164. prop: 'runMileage',
  165. width: 100,
  166. overHidden: true
  167. },
  168. {
  169. label: '理赔原因',
  170. prop: 'claimReason',
  171. overHidden: true
  172. },
  173. {
  174. label: '索赔金额',
  175. prop: 'claimAmount',
  176. overHidden: true
  177. },
  178. {
  179. label: '审核状态',
  180. prop: 'auditStatus',
  181. type: 'select',
  182. dicData: [
  183. {
  184. label: '待审核',
  185. value: 0
  186. },
  187. {
  188. label: '审核中',
  189. value: 1
  190. },
  191. {
  192. label: '已通过',
  193. value: 2
  194. },
  195. {
  196. label: '已拒绝',
  197. value: 3
  198. }
  199. ],
  200. overHidden: true
  201. },
  202. {
  203. label: '提交时间',
  204. prop: 'submitTime',
  205. overHidden: true
  206. },
  207. {
  208. label: '备注',
  209. prop: 'remark',
  210. overHidden: true
  211. },
  212. {
  213. label: '制单人',
  214. prop: 'createUserName',
  215. overHidden: true,
  216. width: 80
  217. },
  218. {
  219. label: '制单日期',
  220. prop: 'createTime',
  221. type: 'date',
  222. overHidden: true,
  223. width: 100,
  224. format: 'yyyy-MM-dd',
  225. valueFormat: 'yyyy-MM-dd HH:mm:ss'
  226. },
  227. {
  228. label: '修改人',
  229. prop: 'updateUserName',
  230. overHidden: true,
  231. width: 80
  232. },
  233. {
  234. label: '修改日期',
  235. prop: 'updateTime',
  236. type: 'date',
  237. overHidden: true,
  238. width: 100,
  239. format: 'yyyy-MM-dd',
  240. valueFormat: 'yyyy-MM-dd HH:mm:ss'
  241. }
  242. ]
  243. },
  244. data: []
  245. };
  246. },
  247. components: {
  248. detailsPage
  249. },
  250. created() {
  251. },
  252. methods: {
  253. addButton() {
  254. this.isShow = false;
  255. },
  256. /**
  257. * @param {{ id: any; }} row
  258. */
  259. rowEdit(row) {
  260. this.detailData = {
  261. id: row.id
  262. };
  263. this.isShow = false;
  264. },
  265. // 删除
  266. /**
  267. * @param {{ item: number; id: any; }} row
  268. * @param {any} index
  269. */
  270. rowDel(row, index) {
  271. if (row.item == 1) {
  272. return this.$message.error('存在明细不允许删除');
  273. }
  274. this.$confirm('确定将选择数据删除?', {
  275. confirmButtonText: '确定',
  276. cancelButtonText: '取消',
  277. type: 'warning'
  278. }).then(() => {
  279. remove({ ids: row.id }).then(res => {
  280. this.onLoad(this.page, this.query);
  281. this.$message.success('成功删除');
  282. });
  283. });
  284. },
  285. searchReset() {
  286. this.query = this.$options.data().query;
  287. this.onLoad(this.page);
  288. },
  289. // 搜索按钮点击
  290. /**
  291. * @param {any} params
  292. * @param {() => void} done
  293. */
  294. searchChange(params, done) {
  295. this.page.currentPage = 1;
  296. this.onLoad(this.page, this.query);
  297. done();
  298. },
  299. /**
  300. * @param {any} list
  301. */
  302. selectionChange(list) {
  303. this.selectionList = list;
  304. },
  305. /**
  306. * @param {any} currentPage
  307. */
  308. currentChange(currentPage) {
  309. this.page.currentPage = currentPage;
  310. },
  311. /**
  312. * @param {any} pageSize
  313. */
  314. sizeChange(pageSize) {
  315. this.page.pageSize = pageSize;
  316. },
  317. refreshChange() {
  318. this.onLoad(this.page, this.query);
  319. },
  320. /**
  321. * @param {{ currentPage: any; pageSize: any; }} page
  322. */
  323. onLoad(page, params = {}) {
  324. let obj = {};
  325. obj = {
  326. ...Object.assign(params, this.query)
  327. };
  328. this.loading = true;
  329. getList(page.currentPage, page.pageSize, obj)
  330. .then(res => {
  331. this.data = res.data.data.records;
  332. this.page.total = res.data.data.total;
  333. this.$nextTick(() => {
  334. this.$refs.crud.doLayout();
  335. // this.$refs.crud.dicInit();
  336. });
  337. })
  338. .finally(() => {
  339. this.loading = false;
  340. });
  341. },
  342. // 详情的返回列表
  343. goBack() {
  344. // 初始化数据
  345. if (JSON.stringify(this.$route.query) != '{}') {
  346. this.$router.$avueRouter.closeTag();
  347. this.$router.push({
  348. path: '/boxManagement/buyContainer/index'
  349. });
  350. }
  351. this.detailData = {};
  352. this.isShow = true;
  353. this.onLoad(this.page, this.query);
  354. },
  355. }
  356. };
  357. </script>
  358. <style lang="scss" scoped>
  359. ::v-deep .el-col-md-8 {
  360. width: 24.33333%;
  361. }
  362. </style>