index.vue 8.4 KB

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