作者 王勇

修改为带状态表格

@@ -13,18 +13,18 @@ @@ -13,18 +13,18 @@
13 <div> 13 <div>
14 <el-form :model="queryInfo" :rules="queryFormRules" ref="queryFormRef" status-icon> 14 <el-form :model="queryInfo" :rules="queryFormRules" ref="queryFormRef" status-icon>
15 <el-form-item> 15 <el-form-item>
16 - <!-- <el-col :span="4">-->  
17 - <!-- <el-form-item prop="userName">-->  
18 - <!-- <el-input v-model="queryInfo.userName" prefix-icon="el-icon-search"-->  
19 - <!-- placeholder="请输入用户名称" clearable size="small"></el-input>-->  
20 - <!-- </el-form-item>-->  
21 - <!-- </el-col>-->  
22 - <!-- <el-col :span="4" style="margin-left: 10px">-->  
23 - <!-- <el-form-item prop="userMobile">-->  
24 - <!-- <el-input v-model="queryInfo.userMobile" prefix-icon="el-icon-search"-->  
25 - <!-- placeholder="请输入联系方式" clearable size="small"></el-input>-->  
26 - <!-- </el-form-item>-->  
27 - <!-- </el-col>--> 16 + <!-- <el-col :span="4">-->
  17 + <!-- <el-form-item prop="userName">-->
  18 + <!-- <el-input v-model="queryInfo.userName" prefix-icon="el-icon-search"-->
  19 + <!-- placeholder="请输入用户名称" clearable size="small"></el-input>-->
  20 + <!-- </el-form-item>-->
  21 + <!-- </el-col>-->
  22 + <!-- <el-col :span="4" style="margin-left: 10px">-->
  23 + <!-- <el-form-item prop="userMobile">-->
  24 + <!-- <el-input v-model="queryInfo.userMobile" prefix-icon="el-icon-search"-->
  25 + <!-- placeholder="请输入联系方式" clearable size="small"></el-input>-->
  26 + <!-- </el-form-item>-->
  27 + <!-- </el-col>-->
28 <el-col :span="4"> 28 <el-col :span="4">
29 <el-form-item prop="gmtCreate"> 29 <el-form-item prop="gmtCreate">
30 <el-date-picker v-model="queryInfo.gmtCreate" type="date" value-format="yyyy-MM-dd" 30 <el-date-picker v-model="queryInfo.gmtCreate" type="date" value-format="yyyy-MM-dd"
@@ -59,7 +59,8 @@ @@ -59,7 +59,8 @@
59 </div> 59 </div>
60 <!--调度记录列表区域--> 60 <!--调度记录列表区域-->
61 <div style="margin-top: 20px;"> 61 <div style="margin-top: 20px;">
62 - <el-table :data="DispatchNoteList" border stripe highlight-current-row v-loading="listLoading" 62 + <el-table :data="DispatchNoteList" border highlight-current-row v-loading="listLoading"
  63 + :row-class-name="rowStatus"
63 element-loading-text="拼命加载中"> 64 element-loading-text="拼命加载中">
64 <el-table-column type="index" align="center"></el-table-column> 65 <el-table-column type="index" align="center"></el-table-column>
65 <el-table-column label="用户名称" prop="userName" align="center" width="100"></el-table-column> 66 <el-table-column label="用户名称" prop="userName" align="center" width="100"></el-table-column>
@@ -214,14 +215,15 @@ @@ -214,14 +215,15 @@
214 <el-form :model="showForm" ref="showFormRef" 215 <el-form :model="showForm" ref="showFormRef"
215 :inline="true" align="center" 216 :inline="true" align="center"
216 style="background-color: #F5F7FA;margin-left: 5%;margin-right: 5%"> 217 style="background-color: #F5F7FA;margin-left: 5%;margin-right: 5%">
217 -  
218 <div style="margin-top: -15px"> 218 <div style="margin-top: -15px">
219 <br> 219 <br>
220 <el-form-item label="用户名称:" prop="userName"> 220 <el-form-item label="用户名称:" prop="userName">
221 - <el-input v-model="showForm.userName" style="width: 200px;" size="small" readonly></el-input> 221 + <el-input v-model="showForm.userName" style="width: 200px;" size="small"
  222 + readonly></el-input>
222 </el-form-item> 223 </el-form-item>
223 <el-form-item label="联系方式:" prop="userMobile"> 224 <el-form-item label="联系方式:" prop="userMobile">
224 - <el-input v-model="showForm.userMobile" style="width: 200px;" size="small" readonly></el-input> 225 + <el-input v-model="showForm.userMobile" style="width: 200px;" size="small"
  226 + readonly></el-input>
225 </el-form-item> 227 </el-form-item>
226 <el-form-item label="车辆类型:" prop="vehicleType"> 228 <el-form-item label="车辆类型:" prop="vehicleType">
227 <el-select v-model="showForm.vehicleType" style="width:200px" size="small" readonly 229 <el-select v-model="showForm.vehicleType" style="width:200px" size="small" readonly
@@ -261,13 +263,16 @@ @@ -261,13 +263,16 @@
261 </el-select> 263 </el-select>
262 </el-form-item> 264 </el-form-item>
263 <el-form-item label="创建时间:" prop="gmtCreate"> 265 <el-form-item label="创建时间:" prop="gmtCreate">
264 - <el-input v-model="showForm.gmtCreate" style="width: 200px;" size="small" readonly></el-input> 266 + <el-input v-model="showForm.gmtCreate" style="width: 200px;" size="small"
  267 + readonly></el-input>
265 </el-form-item> 268 </el-form-item>
266 <el-form-item label="开始时间:" prop="beginTime"> 269 <el-form-item label="开始时间:" prop="beginTime">
267 - <el-input v-model="showForm.beginTime" style="width: 200px;" size="small" readonly></el-input> 270 + <el-input v-model="showForm.beginTime" style="width: 200px;" size="small"
  271 + readonly></el-input>
268 </el-form-item> 272 </el-form-item>
269 <el-form-item label="结束时间:" prop="endTime"> 273 <el-form-item label="结束时间:" prop="endTime">
270 - <el-input v-model="showForm.endTime" style="width: 200px;" size="small" readonly></el-input> 274 + <el-input v-model="showForm.endTime" style="width: 200px;" size="small"
  275 + readonly></el-input>
271 </el-form-item> 276 </el-form-item>
272 <el-form-item label="记录状态:" prop="status"> 277 <el-form-item label="记录状态:" prop="status">
273 <el-select v-model="showForm.status" placeholder="记录状态" style="width:200px" size="small" 278 <el-select v-model="showForm.status" placeholder="记录状态" style="width:200px" size="small"
@@ -666,8 +671,27 @@ @@ -666,8 +671,27 @@
666 }).catch((error) => { 671 }).catch((error) => {
667 this.$message.error(error.toString()); 672 this.$message.error(error.toString());
668 }); 673 });
669 -  
670 }, 674 },
  675 + /**
  676 + * 根据状态的不同区分颜色
  677 + *
  678 + * @param row
  679 + * @param rowIndex
  680 + */
  681 + rowStatus({row, rowIndex}) {
  682 + if (row.status === '1') {
  683 + return 'success-row';
  684 + }
  685 + if (row.status === '2') {
  686 + return 'run-row';
  687 + }
  688 + if (row.status === '3') {
  689 + return 'cancel-row';
  690 + }
  691 + if (row.status === '4') {
  692 + return 'await-row';
  693 + }
  694 + }
671 }, 695 },
672 mounted() { 696 mounted() {
673 var user = sessionStorage.getItem('user'); 697 var user = sessionStorage.getItem('user');
@@ -689,6 +713,24 @@ @@ -689,6 +713,24 @@
689 } 713 }
690 </script> 714 </script>
691 715
692 -<style scoped> 716 +<style>
  717 + /* 完成状态 */
  718 + .el-table .success-row {
  719 + background: rgba(64, 158, 255, 0.2);
  720 + }
  721 +
  722 + /* 执行状态 */
  723 + .el-table .run-row {
  724 + background: rgba(103, 194, 58, 0.2);
  725 + }
693 726
  727 + /* 取消状态 */
  728 + .el-table .cancel-row {
  729 + background: rgba(144, 147, 153, 0.2);
  730 + }
  731 +
  732 + /* 待执行状态 */
  733 + .el-table .await-row {
  734 + background: rgba(230, 162, 60, 0.2);
  735 + }
694 </style> 736 </style>
@@ -61,7 +61,7 @@ @@ -61,7 +61,7 @@
61 </div> 61 </div>
62 <!--调度记录列表区域--> 62 <!--调度记录列表区域-->
63 <div style="margin-top: 20px;"> 63 <div style="margin-top: 20px;">
64 - <el-table :data="DispatchNoteList" border stripe v-loading="listLoading" 64 + <el-table :data="DispatchNoteList" border v-loading="listLoading"
65 :row-class-name="rowStatus" 65 :row-class-name="rowStatus"
66 element-loading-text="拼命加载中"> 66 element-loading-text="拼命加载中">
67 <el-table-column type="index" align="center"></el-table-column> 67 <el-table-column type="index" align="center"></el-table-column>
@@ -815,9 +815,41 @@ @@ -815,9 +815,41 @@
815 * @param row 815 * @param row
816 * @param rowIndex 816 * @param rowIndex
817 */ 817 */
818 - rowStatus({row, rowIndex}){  
819 - 818 + rowStatus({row, rowIndex}) {
  819 + if (row.status === '1') {
  820 + return 'success-row';
  821 + }
  822 + if (row.status === '2') {
  823 + return 'run-row';
  824 + }
  825 + if (row.status === '3') {
  826 + return 'cancel-row';
  827 + }
  828 + if (row.status === '4') {
  829 + return 'await-row';
  830 + }
820 } 831 }
821 } 832 }
822 } 833 }
823 </script> 834 </script>
  835 +<style>
  836 + /* 完成状态 */
  837 + .el-table .success-row {
  838 + background: rgba(64, 158, 255, 0.2);
  839 + }
  840 +
  841 + /* 执行状态 */
  842 + .el-table .run-row {
  843 + background: rgba(103, 194, 58, 0.2);
  844 + }
  845 +
  846 + /* 取消状态 */
  847 + .el-table .cancel-row {
  848 + background: rgba(144, 147, 153, 0.2);
  849 + }
  850 +
  851 + /* 待执行状态 */
  852 + .el-table .await-row {
  853 + background: rgba(230, 162, 60, 0.2);
  854 + }
  855 +</style>