Authored by 李奇

差异工单列表修改

@@ -29,8 +29,10 @@ @@ -29,8 +29,10 @@
29 }, 29 },
30 created() { 30 created() {
31 this.diffService = new DiffService(); 31 this.diffService = new DiffService();
  32 + this.$Loading.start();
32 this.diffService.detail({id: +this.id}) 33 this.diffService.detail({id: +this.id})
33 .then(res => { 34 .then(res => {
  35 + this.$Loading.finish();
34 let fields = [{ 36 let fields = [{
35 label: '主题:', 37 label: '主题:',
36 value: 'subject' 38 value: 'subject'
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 :placeholder="filters.subject.holder"></Input> 6 :placeholder="filters.subject.holder"></Input>
7 </filter-item> 7 </filter-item>
8 <filter-item :label="filters.emergency.label"> 8 <filter-item :label="filters.emergency.label">
9 - <Select v-model.trim="filters.emergency.model"> 9 + <Select v-model.trim="filters.emergency.model" clearable>
10 <Option v-for="option in filters.emergency.options" 10 <Option v-for="option in filters.emergency.options"
11 :value="option.value" 11 :value="option.value"
12 :key="option.value">{{option.label}}</Option> 12 :key="option.value">{{option.label}}</Option>
@@ -16,15 +16,15 @@ @@ -16,15 +16,15 @@
16 <select-brand v-model="filters.brand.model"></select-brand> 16 <select-brand v-model="filters.brand.model"></select-brand>
17 </filter-item> 17 </filter-item>
18 <filter-item :label="filters.status.label"> 18 <filter-item :label="filters.status.label">
19 - <Select v-model.trim="filters.status.model"> 19 + <Select v-model.trim="filters.status.model" clearable>
20 <Option v-for="option in filters.status.options" 20 <Option v-for="option in filters.status.options"
21 :value="option.value" 21 :value="option.value"
22 :key="option.value">{{option.label}}</Option> 22 :key="option.value">{{option.label}}</Option>
23 </Select> 23 </Select>
24 </filter-item> 24 </filter-item>
25 <filter-item> 25 <filter-item>
26 - <Button type="primary" @click="filterSearch">筛选</Button>  
27 - <Button @click="clearFilter">清空条件</Button> 26 + <Button type="primary" @click="doSearch">筛选</Button>
  27 + <Button @click="reset">清空条件</Button>
28 </filter-item> 28 </filter-item>
29 </layout-filter> 29 </layout-filter>
30 30
@@ -37,9 +37,9 @@ @@ -37,9 +37,9 @@
37 </template> 37 </template>
38 38
39 <script> 39 <script>
  40 +import _ from 'lodash';
40 import {list as diffList} from './store'; 41 import {list as diffList} from './store';
41 import {DiffService} from 'services/repository'; 42 import {DiffService} from 'services/repository';
42 -import {SelectBrand} from 'components/select';  
43 43
44 export default { 44 export default {
45 data() { 45 data() {
@@ -47,32 +47,78 @@ export default { @@ -47,32 +47,78 @@ export default {
47 }, 47 },
48 created() { 48 created() {
49 this.DiffService = new DiffService(); 49 this.DiffService = new DiffService();
50 -  
51 - this.DiffService.list()  
52 - .then(res => {  
53 - this.$Loading.finish();  
54 - this.dataList = res.data.records;  
55 - }); 50 + this.search(this.params());
56 }, 51 },
57 methods: { 52 methods: {
58 - clearFilter() { 53 + search(params) {
  54 + this.$Loading.start();
  55 + this.DiffService.list(params)
  56 + .then(res => {
  57 + this.$Loading.finish();
  58 + this.dataList = res.data.records;
  59 + this.page.total = res.data.totalCount;
  60 + }, () => {
  61 + this.$Loading.finish();
  62 + });
  63 +
59 }, 64 },
60 - filterSearch() { 65 + params() {
  66 + const defVal = {
  67 + pageNo: 1,
  68 + pageSize: 20,
  69 + statuses: [3, 21, 22]
  70 + };
  71 + const keyMap = {
  72 + brandId: 'brand',
  73 + statuses: 'status',
  74 + subject: 'subject',
  75 + emergencyDegree: 'emergency'
  76 + };
  77 +
  78 + if (this.enableFilter) {
  79 + let model;
  80 +
  81 + _.each(keyMap, (val, key) => {
  82 + model = this.filters[val].model;
  83 +
  84 + if (('' + model).length) {
  85 + if (key === 'statuses') {
  86 + defVal[key] = [model];
  87 + } else {
  88 + defVal[key] = model;
  89 + }
  90 + }
  91 + });
  92 + }
61 93
  94 + return defVal;
62 }, 95 },
63 - pageChange() { 96 + reset() {
  97 + _.each(this.filters, item => {
  98 + item.model = '';
  99 + });
  100 + this.page.current = 1;
  101 + this.enableFilter = false;
  102 + this.search(this.params());
  103 + },
  104 + doSearch() {
  105 + this.enableFilter = true;
  106 + this.search(this.params());
64 }, 107 },
65 - goDetail(id) { 108 + pageChange(no) {
  109 + let params;
  110 +
  111 + params = this.params();
  112 + params.pageNo = no;
  113 + this.search(params);
  114 + this.page.current = no;
  115 + },
  116 + toDetail(id) {
66 this.$router.push({ 117 this.$router.push({
67 - query: {  
68 - id  
69 - }, 118 + query: { id },
70 name: 'repository.diff.detail', 119 name: 'repository.diff.detail',
71 }); 120 });
72 } 121 }
73 - },  
74 - components: {  
75 - SelectBrand  
76 } 122 }
77 }; 123 };
78 </script> 124 </script>
@@ -29,7 +29,11 @@ export default function() { @@ -29,7 +29,11 @@ export default function() {
29 { 29 {
30 title: '品牌经理', 30 title: '品牌经理',
31 align: 'center', 31 align: 'center',
32 - key: 'claimName' 32 + render(h, params) {
  33 + return (
  34 + <span>{params.row.claimName || '-'}</span>
  35 + );
  36 + }
33 }, 37 },
34 { 38 {
35 title: '状态', 39 title: '状态',
@@ -42,16 +46,17 @@ export default function() { @@ -42,16 +46,17 @@ export default function() {
42 render: (h, params) => { 46 render: (h, params) => {
43 return ( 47 return (
44 <i-button type="success" size="small" 48 <i-button type="success" size="small"
45 - onClick={() => this.goDetail(params.row.id)}>查看</i-button> 49 + onClick={() => this.toDetail(params.row.id)}>查看</i-button>
46 ); 50 );
47 } 51 }
48 } 52 }
49 ], 53 ],
50 dataList: [], 54 dataList: [],
51 page: { 55 page: {
52 - total: 0, 56 + totalPage: 0,
53 current: 1 57 current: 1
54 }, 58 },
  59 + enableFilter: false,
55 filters: { 60 filters: {
56 subject: { 61 subject: {
57 label: '主题', 62 label: '主题',
@@ -62,15 +67,15 @@ export default function() { @@ -62,15 +67,15 @@ export default function() {
62 model: '', 67 model: '',
63 options: [ 68 options: [
64 { 69 {
65 - value: 1, 70 + value: 3,
66 label: '一般' 71 label: '一般'
67 }, 72 },
68 { 73 {
69 - value: 2, 74 + value: 1,
70 label: '特别紧急' 75 label: '特别紧急'
71 }, 76 },
72 { 77 {
73 - value: 3, 78 + value: 2,
74 label: '紧急' 79 label: '紧急'
75 }, 80 },
76 { 81 {
@@ -88,15 +93,15 @@ export default function() { @@ -88,15 +93,15 @@ export default function() {
88 model: '', 93 model: '',
89 options: [ 94 options: [
90 { 95 {
91 - value: 1, 96 + value: 3,
92 label: '完成' 97 label: '完成'
93 }, 98 },
94 { 99 {
95 - value: 2, 100 + value: 21,
96 label: '处理中-待确认' 101 label: '处理中-待确认'
97 }, 102 },
98 { 103 {
99 - value: 3, 104 + value: 22,
100 label: '处理中-已确认' 105 label: '处理中-已确认'
101 } 106 }
102 ] 107 ]