index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <page-search-table @search="reload"></page-search-table>
  5. <!-- 数据表格 -->
  6. <ele-pro-table
  7. ref="table"
  8. :columns="columns"
  9. :datasource="datasource"
  10. height="calc(100vh - 325px)"
  11. full-height="calc(100vh - 116px)"
  12. tool-class="ele-toolbar-form"
  13. :selection.sync="selection"
  14. :page-size="20"
  15. @columns-change="handleColumnChange"
  16. :cache-key="cacheKeyUrl"
  17. @header-dragend="handleHeaderDragend"
  18. >
  19. <!-- 表头工具栏 -->
  20. <template v-slot:toolbar>
  21. <el-button
  22. size="small"
  23. type="primary"
  24. icon="el-icon-plus"
  25. class="ele-btn-icon"
  26. @click="handleAddOrEdit('','add')"
  27. >
  28. 新建
  29. </el-button>
  30. <el-button
  31. size="small"
  32. type="danger"
  33. el-icon-delete
  34. class="ele-btn-icon"
  35. @click="allDelBtn"
  36. :disabled="selection?.length === 0"
  37. >
  38. 批量删除
  39. </el-button>
  40. </template>
  41. <!-- 操作 -->
  42. <template v-slot:action="{row}">
  43. <!-- <el-link-->
  44. <!-- type="primary"-->
  45. <!-- v-if="[0, 3].includes(row.approvalStatus)"-->
  46. <!-- :underline="false"-->
  47. <!-- icon="el-icon-plus"-->
  48. <!-- @click="sub(row)"-->
  49. <!-- >-->
  50. <!-- 提交-->
  51. <!-- </el-link>-->
  52. <el-link
  53. type="primary"
  54. :underline="false"
  55. icon="el-icon-edit"
  56. @click="handleAddOrEdit(row,'update')"
  57. >
  58. 修改
  59. </el-link>
  60. <el-popconfirm
  61. class="ele-action"
  62. title="确定要删除此信息吗?"
  63. @confirm="remove([row.id])"
  64. >
  65. <template v-slot:reference>
  66. <el-link
  67. type="danger"
  68. :underline="false"
  69. icon="el-icon-delete"
  70. >
  71. 删除
  72. </el-link>
  73. </template>
  74. </el-popconfirm>
  75. </template>
  76. <template v-slot:driverName="{row}">
  77. <el-link
  78. type="primary"
  79. :underline="false"
  80. @click="handleDetail(row,'view')"
  81. >
  82. {{ row.driverName }}
  83. </el-link>
  84. </template>
  85. <!-- <template v-slot:drivingLicenseType="{row}">-->
  86. <!-- {{ getDict('驾照类型', row.drivingLicenseType) }}-->
  87. <!-- </template>-->
  88. </ele-pro-table>
  89. <!-- 多选删除弹窗 -->
  90. <pop-modal
  91. :visible.sync="delVisible"
  92. content="是否确定删除?"
  93. @done="commitBtn"
  94. />
  95. <!-- 新增/修改 -->
  96. <add-or-edit-dialog v-if="addOrEditDialogFlag" :addOrEditDialogFlag.sync="addOrEditDialogFlag"
  97. ref="addOrEditDialogRef" @reload="reload"></add-or-edit-dialog>
  98. <detail-dialog v-if="detailDialogFlag" :detail-dialog-flag.sync="detailDialogFlag"
  99. ref="detailDialogRef"></detail-dialog>
  100. </el-card>
  101. </div>
  102. </template>
  103. <script>
  104. import popModal from '@/components/pop-modal';
  105. import {reviewStatus} from '@/enum/dict';
  106. import dictMixins from "@/mixins/dictMixins";
  107. import pageSearchTable from "./indexSearchTable.vue";
  108. import addOrEditDialog from './components/addOrEditDialog.vue'
  109. import detailDialog from './components/detailDialog.vue'
  110. import {driverBookPageListAPI, driverRemoveAPI, driverSubmit} from "@/api/transportManager/driverBook";
  111. import {mapGetters} from "vuex";
  112. import tabMixins from '@/mixins/tableColumnsMixin';
  113. export default {
  114. mixins: [dictMixins,tabMixins],
  115. components: {
  116. addOrEditDialog,
  117. pageSearchTable,
  118. popModal,
  119. detailDialog
  120. },
  121. data() {
  122. return {
  123. selection: [],
  124. statusList: [
  125. {
  126. label: '空闲',
  127. value: 0,
  128. },
  129. {
  130. label: '派单中',
  131. value: 1,
  132. }
  133. ],
  134. delVisible: false,
  135. // 加载状态
  136. loading: false,
  137. addOrEditDialogFlag: false,
  138. detailDialogFlag: false,
  139. cacheKeyUrl:'eos-8738c576-driverBook',
  140. columnsVersion:1,
  141. };
  142. },
  143. computed: {
  144. ...mapGetters(['dict','getDictValue']),
  145. columns() {
  146. // 当columnsVersion变化时会重新计算,用作更新列配置
  147. const version = this.columnsVersion;
  148. return this.applyColumnWidth([
  149. {
  150. width: 45,
  151. type: 'selection',
  152. columnKey: 'selection',
  153. align: 'center'
  154. },
  155. {
  156. columnKey: 'index',
  157. label: '序号',
  158. type: 'index',
  159. width: 55,
  160. align: 'center',
  161. showOverflowTooltip: true,
  162. fixed: 'left'
  163. },
  164. {
  165. prop: 'driverName',
  166. label: '姓名',
  167. align: 'center',
  168. showOverflowTooltip: true,
  169. minWidth: 120,
  170. slot: 'driverName'
  171. },
  172. {
  173. prop: 'sex',
  174. label: '性别',
  175. align: 'center',
  176. showOverflowTooltip: true,
  177. minWidth: 100,
  178. formatter: (_row, _column, cellValue) => {
  179. return cellValue == 1 ? '男' : cellValue == 2 ? '女' : '';
  180. }
  181. },
  182. {
  183. prop: 'age',
  184. label: '年龄',
  185. align: 'center',
  186. showOverflowTooltip: true,
  187. minWidth: 100
  188. },
  189. {
  190. prop: 'phone',
  191. label: '手机号',
  192. align: 'center',
  193. slot: 'phone',
  194. showOverflowTooltip: true,
  195. minWidth: 120,
  196. },
  197. {
  198. prop: 'personId',
  199. label: '身份证号',
  200. align: 'center',
  201. slot: 'personId',
  202. showOverflowTooltip: true,
  203. minWidth: 120,
  204. },
  205. {
  206. prop: 'driverAge',
  207. label: '驾龄',
  208. align: 'center',
  209. slot: 'driverAge',
  210. showOverflowTooltip: true,
  211. minWidth: 100,
  212. },
  213. {
  214. prop: 'drivingLicenseType',
  215. label: '驾驶证类型',
  216. align: 'center',
  217. slot: 'drivingLicenseType',
  218. showOverflowTooltip: true,
  219. formatter: (_row, _column, cellValue) => {
  220. return this.getDict('驾照类型', cellValue)
  221. },
  222. minWidth: 100,
  223. },
  224. {
  225. prop: 'status',
  226. label: '状态',
  227. align: 'center',
  228. slot: 'status',
  229. showOverflowTooltip: true,
  230. minWidth: 100,
  231. formatter: (_row, _column, cellValue) => {
  232. return this.statusList.find(i => i.value == cellValue)?.label;
  233. }
  234. },
  235. {
  236. columnKey: 'action',
  237. label: '操作',
  238. width: 150,
  239. align: 'center',
  240. resizable: false,
  241. slot: 'action',
  242. showOverflowTooltip: true,
  243. fixed: 'right'
  244. }
  245. ]);
  246. },
  247. getDict() {
  248. return (dictName, val) => {
  249. return this.getDictValue(dictName, val)
  250. }
  251. }
  252. },
  253. methods: {
  254. //新增、修改
  255. handleAddOrEdit(row = {}, type) {
  256. this.addOrEditDialogFlag = true
  257. this.$nextTick(() => {
  258. this.$refs.addOrEditDialogRef.init(row, type)
  259. })
  260. },
  261. //详情
  262. handleDetail(row = {}, type) {
  263. this.detailDialogFlag = true
  264. this.$nextTick(() => {
  265. this.$refs.detailDialogRef.init(row, type)
  266. })
  267. },
  268. /* 表格数据源 */
  269. datasource({page, limit, where, order}) {
  270. return driverBookPageListAPI({
  271. pageNum: page,
  272. size: limit,
  273. ...where
  274. });
  275. },
  276. /* 刷新表格 */
  277. reload(where) {
  278. this.$nextTick(() => {
  279. this.$refs.table.reload({page: 1, where});
  280. })
  281. },
  282. //批量删除
  283. allDelBtn() {
  284. if (this.selection.length === 0) return;
  285. let flag = this.selection.some(item => [1, 2].includes(item.approvalStatus))
  286. if (flag) return this.$message.warning('抱歉已审核、审核中的数据不能删除,请检查')
  287. this.delVisible = true;
  288. },
  289. commitBtn() {
  290. const dataId = this.selection.map((v) => v.id);
  291. driverRemoveAPI(dataId).then((res) => {
  292. this.$message.success('删除成功!');
  293. this.reload();
  294. });
  295. },
  296. remove(row) {
  297. driverRemoveAPI(row).then((res) => {
  298. this.$message.success('删除成功!');
  299. this.reload();
  300. });
  301. },
  302. sub(res) {
  303. driverSubmit({
  304. businessId: res.id
  305. })
  306. .then((res) => {
  307. this.$message.success('提交成功');
  308. this.reload();
  309. })
  310. .catch((e) => {
  311. this.$message.error(e.message);
  312. });
  313. },
  314. }
  315. };
  316. </script>
  317. <style lang="scss" scoped>
  318. :deep(.el-link--inner) {
  319. margin-left: 0px !important;
  320. }
  321. .sys-organization-list {
  322. height: calc(100vh - 264px);
  323. box-sizing: border-box;
  324. border-width: 1px;
  325. border-style: solid;
  326. overflow: auto;
  327. }
  328. .sys-organization-list :deep(.el-tree-node__content) {
  329. height: 40px;
  330. & > .el-tree-node__expand-icon {
  331. margin-left: 10px;
  332. }
  333. }
  334. </style>