driverMsg.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <div class="mod-driverMsg">
  3. <!-- 面包屑导航区域 -->
  4. <el-breadcrumb separator-class="el-icon-arrow-right">
  5. <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
  6. <el-breadcrumb-item>驾驶员信息管理</el-breadcrumb-item>
  7. <!-- <el-breadcrumb-item>车队列表</el-breadcrumb-item>-->
  8. </el-breadcrumb>
  9. <!-- 卡片视图区域 -->
  10. <el-card style="margin-top:10px;">
  11. <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
  12. <el-form-item>
  13. <el-input v-model="dataForm.name" placeholder="驾驶员姓名" clearable></el-input>
  14. </el-form-item>
  15. <el-form-item>
  16. <el-input v-model="dataForm.tel" placeholder="联系电话" clearable></el-input>
  17. </el-form-item>
  18. <el-form-item>
  19. <el-button @click="getDataList()">查询</el-button>
  20. <el-button v-if="isAuth('fleet:driverMsg:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
  21. <!-- <el-button v-if="isAuth('fleet:driverMsg:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>-->
  22. </el-form-item>
  23. </el-form>
  24. <el-table
  25. :data="dataList"
  26. border
  27. v-loading="dataListLoading"
  28. @selection-change="selectionChangeHandle"
  29. style="width: 100%;"
  30. height=650>
  31. <el-table-column
  32. type="selection"
  33. header-align="center"
  34. align="center"
  35. width="50">
  36. </el-table-column>
  37. <el-table-column
  38. prop="companyName"
  39. header-align="center"
  40. align="center"
  41. :show-overflow-tooltip="true"
  42. width="150"
  43. label="所属公司">
  44. </el-table-column>
  45. <el-table-column
  46. prop="name"
  47. header-align="center"
  48. align="center"
  49. width="150"
  50. label="驾驶员姓名">
  51. </el-table-column>
  52. <el-table-column
  53. prop="sex"
  54. header-align="center"
  55. align="center"
  56. width="150"
  57. :formatter="formatSex"
  58. label="性别">
  59. </el-table-column>
  60. <el-table-column
  61. prop="birthday"
  62. header-align="center"
  63. align="center"
  64. :show-overflow-tooltip="true"
  65. width="160"
  66. :formatter="timestampToTime"
  67. label="出生日期">
  68. </el-table-column>
  69. <el-table-column
  70. prop="allowDriverCar"
  71. header-align="center"
  72. align="center"
  73. label="准驾车型">
  74. </el-table-column>
  75. <el-table-column
  76. prop="firstCertificateDate"
  77. header-align="center"
  78. align="center"
  79. :show-overflow-tooltip="true"
  80. :formatter="dateFormat"
  81. width="160"
  82. label="初次领证日期">
  83. </el-table-column>
  84. <el-table-column
  85. prop="idcarNum"
  86. header-align="center"
  87. align="center"
  88. :show-overflow-tooltip="true"
  89. width="170"
  90. label="身份证号">
  91. </el-table-column>
  92. <el-table-column
  93. prop="tel"
  94. header-align="center"
  95. align="center"
  96. width="150"
  97. label="联系电话">
  98. </el-table-column>
  99. <el-table-column
  100. prop="address"
  101. header-align="center"
  102. align="center"
  103. :show-overflow-tooltip="true"
  104. label="家庭住址">
  105. </el-table-column>
  106. <el-table-column
  107. header-align="center"
  108. align="center"
  109. width="150"
  110. label="个人照片">
  111. <template slot-scope="scope">
  112.     <img v-if="scope.row.resumePic? 'true':''" :src="scope.row.resumePic" width="80" height="60" class="head_pic"/>
  113.   </template>
  114. </el-table-column>
  115. <el-table-column
  116. prop="drivingPic"
  117. header-align="center"
  118. align="center"
  119. width="150"
  120. label="驾驶证照片">
  121. <template slot-scope="scope">
  122.     <img v-if="scope.row.drivingPic? 'true':''" :src="scope.row.drivingPic" width="80" height="60" class="head_pic"/>
  123.   </template>
  124. </el-table-column>
  125. <el-table-column
  126. prop="creatTime"
  127. header-align="center"
  128. align="center"
  129. width="160"
  130. :show-overflow-tooltip="true"
  131. label="注册时间">
  132. </el-table-column>
  133. <el-table-column
  134. fixed="right"
  135. header-align="center"
  136. align="center"
  137. width="150"
  138. label="操作">
  139. <template slot-scope="scope">
  140. <el-tooltip class="item" effect="dark" content="修改" :enterable="false" placement="top">
  141. <el-button type="primary"
  142. v-if="isAuth('fleet:driverMsg:edit')"
  143. icon="el-icon-edit"
  144. content="修改"
  145. size="mini"
  146. circle @click="addOrUpdateHandle(scope.row)"></el-button>
  147. </el-tooltip>
  148. <el-tooltip class="item" effect="dark" content="删除" :enterable="false" placement="top">
  149. <el-button type="danger"
  150. v-if="isAuth('fleet:driverMsg:delete')"
  151. icon="el-icon-delete"
  152. size="mini"
  153. circle @click="deleteHandle(scope.row.id)"></el-button>
  154. </el-tooltip>
  155. </template>
  156. </el-table-column>
  157. </el-table>
  158. <el-pagination
  159. @size-change="sizeChangeHandle"
  160. @current-change="currentChangeHandle"
  161. :current-page="dataForm.current"
  162. :page-sizes="[10, 20, 50, 100]"
  163. :page-size="dataForm.size"
  164. :total="totalPage"
  165. layout="total, sizes, prev, pager, next, jumper">
  166. </el-pagination>
  167. <!-- 弹窗, 新增 / 修改 -->
  168. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" :dataForm="editModel"></add-or-update>
  169. </el-card>
  170. </div>
  171. </template>
  172. <script>
  173. import AddOrUpdate from './driverMsg-add-or-update'
  174. export default {
  175. data () {
  176. return {
  177. dataForm: {
  178. name: null,
  179. tel: null,
  180. current: 1,
  181. size: 10
  182. },
  183. editModel: {},
  184. dataList: [],
  185. totalPage: 0,
  186. dataListLoading: false,
  187. dataListSelections: [],
  188. addOrUpdateVisible: false
  189. }
  190. },
  191. components: {
  192. AddOrUpdate
  193. },
  194. activated () {
  195. this.getDataList()
  196. },
  197. methods: {
  198. timestampToTime (row, column) {
  199. const daterc = row[column.property]
  200. if (daterc != null) {
  201. const date = new Date(row.birthday)
  202. const Y = date.getFullYear() + '-'
  203. const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
  204. const D = date.getDate() + ' '
  205. return Y + M + D
  206. }
  207. },
  208. dateFormat (row, column, cellValue, index) {
  209. const daterc = row[column.property]
  210. if (daterc != null) {
  211. const dateMat = new Date(row.firstCertificateDate)
  212. const year = dateMat.getFullYear()
  213. const month = dateMat.getMonth() + 1
  214. const day = dateMat.getDate()
  215. const timeFormat = year + '-' + month + '-' + day
  216. return timeFormat
  217. }
  218. },
  219. // 获取数据列表
  220. getDataList () {
  221. this.dataListLoading = true
  222. this.$http({
  223. url: this.$http.adornUrl('/fleet/driverMsg/page'),
  224. method: 'get',
  225. params: this.$http.adornParams(this.dataForm)
  226. }).then(({data}) => {
  227. if (data && data.code === 0) {
  228. this.dataList = data.page.records
  229. this.totalPage = data.page.total
  230. } else {
  231. this.dataList = []
  232. this.totalPage = 0
  233. }
  234. this.dataListLoading = false
  235. })
  236. },
  237. // 每页数
  238. sizeChangeHandle (val) {
  239. this.pageSize = val
  240. this.pageIndex = 1
  241. this.getDataList()
  242. },
  243. // 当前页
  244. currentChangeHandle (val) {
  245. this.dataForm.current = val
  246. this.getDataList()
  247. },
  248. // 多选
  249. selectionChangeHandle (val) {
  250. this.dataListSelections = val
  251. },
  252. // 新增 / 修改
  253. addOrUpdateHandle (row) {
  254. this.addOrUpdateVisible = true
  255. if (row) {
  256. this.editModel = row
  257. } else {
  258. this.editModel = {
  259. id: null,
  260. fleetCompanyId: null,
  261. name: null,
  262. sex: null,
  263. birthday: null,
  264. allowDriverCar: null,
  265. firstCertificateDate: null,
  266. idcarNum: null,
  267. tel: null,
  268. address: null,
  269. resumePic: null,
  270. drivingPic: null,
  271. creatTime: null,
  272. modificationTime: null,
  273. updateType: null
  274. }
  275. }
  276. this.$nextTick(() => {
  277. this.$refs.addOrUpdate.init()
  278. })
  279. },
  280. // 删除
  281. deleteHandle (id) {
  282. var driverMsgIds = id ? [id] : this.dataListSelections.map(item => {
  283. return item.userId
  284. })
  285. this.$confirm(`确定对[id=${driverMsgIds.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
  286. confirmButtonText: '确定',
  287. cancelButtonText: '取消',
  288. type: 'warning'
  289. }).then(() => {
  290. this.$http({
  291. url: this.$http.adornUrl('/fleet/driverMsg/delete'),
  292. method: 'post',
  293. data: this.$http.adornData(driverMsgIds, false)
  294. }).then(({data}) => {
  295. if (data && data.code === 0) {
  296. this.$message({
  297. message: '操作成功',
  298. type: 'success',
  299. duration: 1500,
  300. onClose: () => {
  301. this.getDataList()
  302. }
  303. })
  304. } else {
  305. this.$message.error(data.msg)
  306. }
  307. })
  308. }).catch(() => {})
  309. },
  310. formatSex: function (row, column) {
  311. return row.sex === 0 ? '男' : row.sex === 1 ? '女' : '未知'
  312. }
  313. }
  314. }
  315. </script>