selfcarRec.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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. </template>
  99. </el-table-column>
  100. <el-table-column
  101. prop="recStatus"
  102. label="备案状态"
  103. show-overflow-tooltip>
  104. <template slot-scope="scope">
  105. <span v-if="scope.row.recStatus == 1" style="color: green">备案成功</span>
  106. <span v-else-if="scope.row.recStatus == 0" style="color: red">备案失败</span>
  107. </template>
  108. </el-table-column>
  109. <el-table-column
  110. prop="succTime"
  111. label="成功时间"
  112. show-overflow-tooltip>
  113. </el-table-column>
  114. <el-table-column
  115. prop="failTime"
  116. label="失败时间"
  117. show-overflow-tooltip>
  118. </el-table-column>
  119. <el-table-column
  120. prop="failReason"
  121. label="失败原因"
  122. show-overflow-tooltip>
  123. </el-table-column>
  124. <el-table-column
  125. label="操作"
  126. width="280">
  127. <template slot-scope="scope" show-overflow-tooltip>
  128. <el-link v-if="scope.row.businessType == 1 || scope.row.businessType == 0" style="cursor:pointer; color: blue;" @click="selfCarUnBind(scope.row.etcNum)">解绑</el-link>
  129. </template>
  130. </el-table-column>
  131. </el-table>
  132. </template>
  133. <!-- 分页 -->
  134. <div class="block">
  135. <el-pagination
  136. @size-change="handleSizeChange"
  137. @current-change="handleCurrentChange"
  138. :current-page="current"
  139. :page-sizes="[6, 8, 10, 20, 50, 100]"
  140. :page-size="pagesize"
  141. layout="total, sizes, prev, pager, next, jumper"
  142. :total="total">
  143. </el-pagination>
  144. </div>
  145. </div>
  146. </template>
  147. <script type="text/javascript">
  148. import FileSaver from "file-saver";
  149. import XLSX from "xlsx";
  150. export default {
  151. data(){
  152. return{
  153. selfcarRecCarTable:[],
  154. recLists:[{"label":"备案失败","value":"1"},{"label":"备案成功","value":"2"}],
  155. formCondition:{
  156. businessType: "0"
  157. },
  158. hightt:'0px',
  159. current: 1,
  160. pagesize: 8,
  161. total:''
  162. }
  163. },
  164. created() {
  165. this.heightt = tableHeight;
  166. this.loadData();
  167. },
  168. methods:{
  169. firstLoadData(){
  170. this.current = 1;
  171. this.pagesize = 8;
  172. this.loadData();
  173. },
  174. // 列表展示
  175. async loadData() {
  176. const formData = new FormData();
  177. formData.append('current', this.current);
  178. formData.append('size', this.pagesize);
  179. for(var i in this.formCondition){
  180. formData.append(i,this.formCondition[i]);
  181. }
  182. const response = await this.$http.post(`noCar/findCarRec`, formData);
  183. if (response.data.code === 0) {
  184. this.selfcarRecCarTable = response.data.data.records;
  185. this.total = response.data.data.total;
  186. }
  187. },
  188. async selfCarUnBind(etcNum){
  189. this.$confirm('此操作将解绑ETC:'+etcNum+', 是否继续?', '提示', {
  190. confirmButtonText: '确定',
  191. cancelButtonText: '取消',
  192. type: 'warning'
  193. }).then(() => {
  194. const formData = new FormData();
  195. formData.append('etcNum',etcNum);
  196. const request = this.$http.post(`selfCar/selfCarUnBind`, formData);
  197. request.then(
  198. data => {
  199. if (data.data.code === 0) {
  200. loadData();
  201. this.$message({
  202. type: 'success',
  203. message: '解绑成功'
  204. });
  205. }else{
  206. console.log(data)
  207. this.$message({
  208. type: 'error',
  209. message: ''+data.data.msg
  210. });
  211. }
  212. }
  213. );
  214. }).catch(() => {
  215. //几点取消的提示
  216. });
  217. },
  218. // 分页方法
  219. handleSizeChange(val) {
  220. this.pagesize = val;
  221. this.loadData();
  222. console.log(`每页 ${val} 条`);
  223. },
  224. handleCurrentChange(val) {
  225. this.current = val;
  226. this.loadData();
  227. // console.log(`当前页: ${val}`);
  228. },
  229. async exportExcel() {
  230. let curr = this.current;
  231. let pagesize1 = this.pagesize;
  232. this.current = 1;
  233. this.pagesize = this.total;
  234. await this.loadData();
  235. // 设置当前日期
  236. let time = new Date();
  237. //console.log(time);
  238. let year = time.getFullYear();
  239. let month = time.getMonth() + 1;
  240. let day = time.getDate();
  241. let name = "自有车ETC备案查询列表_"+year + "" + month + "" + day;
  242. // console.log(name)
  243. /* generate workbook object from table */
  244. // .table要导出的是哪一个表格
  245. var wb = XLSX.utils.table_to_book(document.querySelector(".table"),{ raw: true });
  246. /* get binary string as output */
  247. var wbout = XLSX.write(wb, {
  248. bookType: "xlsx",
  249. bookSST: true,
  250. type: "array"
  251. });
  252. try {
  253. // name+'.xlsx'表示导出的excel表格名字
  254. FileSaver.saveAs(
  255. new Blob([wbout], { type: "application/octet-stream" }),
  256. name + ".xlsx"
  257. );
  258. } catch (e) {
  259. if (typeof console !== "undefined") console.log(e, wbout);
  260. }
  261. this.current = curr;
  262. this.pagesize = pagesize1;
  263. this.loadData();
  264. return wbout;
  265. },
  266. }
  267. };
  268. </script>
  269. <style>
  270. .sefCarRec_container {
  271. border: 1px solid #d9d9d9;
  272. border-radius: 10px;
  273. }
  274. .sefCarRec_container .title {
  275. font-size: 5px;
  276. margin-bottom: 20px;
  277. }
  278. .sefCarRec_container .top {
  279. padding-top: 20px;
  280. padding-left: 20px;
  281. }
  282. .sefCarRec_container .text {
  283. display: inline-block;
  284. color: #000;
  285. font-size: 16px ;
  286. margin-left: 1%;
  287. }
  288. .sefCarRec_container .input-demo {
  289. display: inline-block;
  290. width: 20%;
  291. margin-left: 1%;
  292. }
  293. .sefCarRec_container .block {
  294. font-size: 5px;
  295. text-align: center;
  296. margin-top: 25px;
  297. margin-bottom: 25px;
  298. }
  299. .sefCarRec_container .el-dialog {
  300. width: 60%;
  301. }
  302. .sefCarRec_container .el-dialog__header, .el-dialog__body {
  303. padding: 0 20px;
  304. }
  305. .sefCarRec_container .tou {
  306. font-size: 20px;
  307. height: 30px;
  308. line-height: 30px;
  309. padding-top: 15px;
  310. }
  311. .sefCarRec_container .line {
  312. margin-top: 15px;
  313. margin-bottom: 15px;
  314. width: 100%;
  315. height: 2px;
  316. background-color: #d9d9d9;
  317. }
  318. .sefCarRec_container .xinxi {
  319. text-align: center;
  320. margin: 15px auto;
  321. font-size: 18px;
  322. }
  323. </style>