selfcarRec.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <template>
  2. <div class="sefCarRec_container">
  3. <div class="title">
  4. <el-row>
  5. <el-col :span="24">
  6. <div class="top">
  7. <div class="demo-input-suffix">
  8. <el-input placeholder="公司名称" class="input-demo" v-model="formCondition.companyName"></el-input>
  9. <el-input placeholder="企业编号" class="input-demo" v-model="formCondition.companyNum"></el-input>
  10. <el-input placeholder="etc卡号" class="input-demo" v-model="formCondition.etcNum"></el-input>
  11. <el-input placeholder="车牌号" class="input-demo" v-model="formCondition.carNum"></el-input>
  12. </div>
  13. <div class="demo-input-suffix" style="margin-top: 5px;margin-left: 10px;">
  14. <el-select v-model="formCondition.recStatus" placeholder="备案状态">
  15. <el-option
  16. v-for="item in recLists"
  17. :key="item.value"
  18. :label="item.label"
  19. :value="item.value">
  20. </el-option>
  21. </el-select>
  22. <el-button type="success" style="margin-left: 1%;" @click="firstLoadData">查询</el-button>
  23. <el-button type="primary" style="margin-left: 1%;" @click="exportExcel">导出报表</el-button>
  24. </div>
  25. </div>
  26. </el-col>
  27. </el-row>
  28. </div>
  29. <!-- 表格部分 -->
  30. <template>
  31. <el-table
  32. class="table"
  33. v-loading="loading"
  34. ref="multipleTable"
  35. :data="selfcarRecCarTable"
  36. :height="heightt"
  37. border
  38. tooltip-effect="dark">
  39. <el-table-column
  40. label="企业编号"
  41. prop="companyNum"
  42. show-overflow-tooltip>
  43. </el-table-column>
  44. <el-table-column
  45. prop="companyName"
  46. label="公司名称"
  47. show-overflow-tooltip>
  48. </el-table-column>
  49. <el-table-column
  50. prop="businessType"
  51. label="业务类型"
  52. show-overflow-tooltip>
  53. <template slot-scope="scope">
  54. <span v-if="scope.row.businessType == 0">自有车</span>
  55. <span v-if="scope.row.businessType == 1">外协车</span>
  56. <span v-if="scope.row.businessType == 2">无车</span>
  57. </template>
  58. </el-table-column>
  59. <el-table-column
  60. prop="carNum"
  61. label="车牌号"
  62. show-overflow-tooltip>
  63. </el-table-column>
  64. <el-table-column
  65. prop="carColor"
  66. label="车辆颜色"
  67. show-overflow-tooltip>
  68. <template slot-scope="scope">
  69. <span v-if="scope.row.carColor == 0">蓝色</span>
  70. <span v-else-if="scope.row.carColor == 1" >黄色</span>
  71. <span v-else-if="scope.row.carColor == 2" >黑色</span>
  72. <span v-else-if="scope.row.carColor == 3" >白色</span>
  73. <span v-else-if="scope.row.carColor == 4" >渐变绿色</span>
  74. <span v-else-if="scope.row.carColor == 5" >黄绿渐变色</span>
  75. <span v-else-if="scope.row.carColor == 6" >蓝白渐变色</span>
  76. <span v-else-if="scope.row.carColor == 7" >未确定</span>
  77. <span v-else-if="scope.row.carColor == 8" >未确定</span>
  78. <span v-else-if="scope.row.carColor == 9" >未确定</span>
  79. </template>
  80. </el-table-column>
  81. <el-table-column
  82. prop="custPhone"
  83. label="手机号"
  84. show-overflow-tooltip>
  85. </el-table-column>
  86. <el-table-column
  87. prop="etcNum"
  88. label="ETC卡号"
  89. show-overflow-tooltip>
  90. </el-table-column>
  91. <el-table-column
  92. prop="interType"
  93. label="对接方式"
  94. show-overflow-tooltip>
  95. <template slot-scope="scope">
  96. <span v-if="scope.row.interType == 0">接口</span>
  97. <span v-else-if="scope.row.interType == 1">平台</span>
  98. <span v-else-if="scope.row.interType == 3">迁移数据</span>
  99. </template>
  100. </el-table-column>
  101. <el-table-column
  102. prop="recStatus"
  103. label="备案状态"
  104. show-overflow-tooltip>
  105. <template slot-scope="scope">
  106. <span v-if="scope.row.recStatus == 1" style="color: green">备案成功</span>
  107. <span v-else-if="scope.row.recStatus == 2" style="color: red">解绑</span>
  108. <span v-else-if="scope.row.recStatus == 0" style="color: red">备案失败</span>
  109. </template>
  110. </el-table-column>
  111. <el-table-column
  112. prop="succTime"
  113. label="成功时间"
  114. show-overflow-tooltip>
  115. </el-table-column>
  116. <el-table-column
  117. prop="failTime"
  118. label="失败时间"
  119. show-overflow-tooltip>
  120. </el-table-column>
  121. <el-table-column
  122. prop="failReason"
  123. label="失败原因"
  124. show-overflow-tooltip>
  125. </el-table-column>
  126. <el-table-column
  127. label="操作"
  128. width="280">
  129. <template slot-scope="scope" show-overflow-tooltip>
  130. <el-link v-if="scope.row.businessType == 1 || scope.row.businessType == 0" style="cursor:pointer; color: blue;" @click="selfCarUnBind(scope.row.etcNum)">解绑</el-link>
  131. </template>
  132. </el-table-column>
  133. </el-table>
  134. </template>
  135. <!-- 分页 -->
  136. <div class="block">
  137. <el-pagination
  138. @size-change="handleSizeChange"
  139. @current-change="handleCurrentChange"
  140. :current-page="current"
  141. :page-sizes="[6, 8, 10, 20, 50, 100]"
  142. :page-size="pagesize"
  143. layout="total, sizes, prev, pager, next, jumper"
  144. :total="total">
  145. </el-pagination>
  146. </div>
  147. </div>
  148. </template>
  149. <script type="text/javascript">
  150. import FileSaver from "file-saver";
  151. import XLSX from "xlsx";
  152. export default {
  153. data(){
  154. return{
  155. selfcarRecCarTable:[],
  156. recLists:[{"label":"备案失败","value":"1"},{"label":"备案成功","value":"2"}],
  157. formCondition:{
  158. businessType: "0"
  159. },
  160. hightt:'0px',
  161. current: 1,
  162. pagesize: 8,
  163. total:''
  164. }
  165. },
  166. created() {
  167. this.heightt = tableHeight;
  168. this.loadData();
  169. },
  170. methods:{
  171. firstLoadData(){
  172. this.current = 1;
  173. this.pagesize = 8;
  174. this.loadData();
  175. },
  176. // 列表展示
  177. async loadData() {
  178. const formData = new FormData();
  179. formData.append('current', this.current);
  180. formData.append('size', this.pagesize);
  181. for(var i in this.formCondition){
  182. formData.append(i,this.formCondition[i]);
  183. }
  184. const response = await this.$http.post(`noCar/findCarRec`, formData);
  185. if (response.data.code === 0) {
  186. this.selfcarRecCarTable = response.data.data.records;
  187. this.total = response.data.data.total;
  188. }
  189. },
  190. async selfCarUnBind(etcNum){
  191. this.$confirm('此操作将解绑ETC:'+etcNum+', 是否继续?', '提示', {
  192. confirmButtonText: '确定',
  193. cancelButtonText: '取消',
  194. type: 'warning'
  195. }).then(() => {
  196. const formData = new FormData();
  197. formData.append('etcNum',etcNum);
  198. const request = this.$http.post(`selfCar/selfCarUnBind`, formData);
  199. request.then(
  200. data => {
  201. if (data.data.code === 0) {
  202. loadData();
  203. this.$message({
  204. type: 'success',
  205. message: '解绑成功'
  206. });
  207. }else{
  208. console.log(data)
  209. this.$message({
  210. type: 'error',
  211. message: ''+data.data.msg
  212. });
  213. }
  214. }
  215. );
  216. }).catch(() => {
  217. //几点取消的提示
  218. });
  219. },
  220. // 分页方法
  221. handleSizeChange(val) {
  222. this.pagesize = val;
  223. this.loadData();
  224. console.log(`每页 ${val} 条`);
  225. },
  226. handleCurrentChange(val) {
  227. this.current = val;
  228. this.loadData();
  229. // console.log(`当前页: ${val}`);
  230. },
  231. async exportExcel() {
  232. const loading = this.$loading({
  233. lock: true,
  234. text: '系统正在努力接收中,过程大概需要几分钟的时间,请您耐心等待...',
  235. spinner: 'el-icon-loading',
  236. background: 'rgba(0, 0, 0, 0.7)'
  237. });
  238. let curr = this.current;
  239. let pagesize1 = this.pagesize;
  240. this.current = 1;
  241. this.pagesize = this.total;
  242. await this.loadData();
  243. // 设置当前日期
  244. let time = new Date();
  245. //console.log(time);
  246. let year = time.getFullYear();
  247. let month = time.getMonth() + 1;
  248. let day = time.getDate();
  249. let name = "自有车ETC备案查询列表_"+year + "" + month + "" + day;
  250. // console.log(name)
  251. /* generate workbook object from table */
  252. // .table要导出的是哪一个表格
  253. var wb = XLSX.utils.table_to_book(document.querySelector(".table"),{ raw: true });
  254. /* get binary string as output */
  255. var wbout = XLSX.write(wb, {
  256. bookType: "xlsx",
  257. bookSST: true,
  258. type: "array"
  259. });
  260. try {
  261. // name+'.xlsx'表示导出的excel表格名字
  262. FileSaver.saveAs(
  263. new Blob([wbout], { type: "application/octet-stream" }),
  264. name + ".xlsx"
  265. );
  266. } catch (e) {
  267. if (typeof console !== "undefined") console.log(e, wbout);
  268. }
  269. this.current = curr;
  270. this.pagesize = pagesize1;
  271. this.loadData();
  272. loading.close();
  273. return wbout;
  274. },
  275. }
  276. };
  277. </script>
  278. <style>
  279. .sefCarRec_container {
  280. border: 1px solid #d9d9d9;
  281. border-radius: 10px;
  282. }
  283. .sefCarRec_container .title {
  284. font-size: 5px;
  285. margin-bottom: 20px;
  286. }
  287. .sefCarRec_container .top {
  288. padding-top: 20px;
  289. padding-left: 20px;
  290. }
  291. .sefCarRec_container .text {
  292. display: inline-block;
  293. color: #000;
  294. font-size: 16px ;
  295. margin-left: 1%;
  296. }
  297. .sefCarRec_container .input-demo {
  298. display: inline-block;
  299. width: 20%;
  300. margin-left: 1%;
  301. }
  302. .sefCarRec_container .block {
  303. font-size: 5px;
  304. text-align: center;
  305. margin-top: 25px;
  306. margin-bottom: 25px;
  307. }
  308. .sefCarRec_container .el-dialog {
  309. width: 60%;
  310. }
  311. .sefCarRec_container .el-dialog__header, .el-dialog__body {
  312. padding: 0 20px;
  313. }
  314. .sefCarRec_container .tou {
  315. font-size: 20px;
  316. height: 30px;
  317. line-height: 30px;
  318. padding-top: 15px;
  319. }
  320. .sefCarRec_container .line {
  321. margin-top: 15px;
  322. margin-bottom: 15px;
  323. width: 100%;
  324. height: 2px;
  325. background-color: #d9d9d9;
  326. }
  327. .sefCarRec_container .xinxi {
  328. text-align: center;
  329. margin: 15px auto;
  330. font-size: 18px;
  331. }
  332. </style>