quanyawei
2024-03-18 9aeeea9741d3e2bca01bc7ebb4864f834fe88ee7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
<template>
  <div class="main">
    <div>
      <searchBar
        v-if="searchType"
        :search-type="searchType"
        @handleSearch="handleSearch"
        @handleAdd="handleOpenDialog(null,'add')"
      />
      <div class="tab">
        <el-table
          :data="tableData"
          border
          size="mini"
          style="width: 100%"
          :header-cell-style="{
            color: '#101111', fontSize: '16px'
          }"
        >
          <el-table-column
            type="index"
            label="序号"
            width="60px"
            align="center"
          />
          <el-table-column
            align="center"
            prop="allocationNum"
            label="单号"
          />
          <el-table-column
            align="center"
            prop="createTime"
            label="时间"
          />
          <el-table-column
            align="center"
            prop="unitId"
            label="责任单位"
            :formatter="unitIdFormatter"
          />
          <el-table-column
            align="center"
            prop="polluteType"
            label="污染分类"
            :formatter="polluteTypeFormatter"
          />
          <el-table-column
            align="center"
            prop="changeType"
            label="整改类型"
          >
            <template slot-scope="scope">
              <div>  {{ dictObj.changeEnum[scope.row.changeType] }}</div>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="extensionNum"
            width="60px"
            label="延期天数"
          >
            <template slot-scope="scope">
              <div>  {{ scope.row.extensionNum }}天</div>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="address"
            width="80px"
            label="状态"
          >
            <template slot-scope="scope">
              <el-tag
                v-if="scope.row.state===40"
                type="success"
                size="medium "
              >
                {{ stateFormatter(scope.row) }}
              </el-tag>
              <el-tag
                v-if="scope.row.state===50"
                type="danger"
                size="medium "
              >
                {{ stateFormatter(scope.row) }}
              </el-tag>
              <el-tag
                v-if="scope.row.state===9"
                type="info"
                size="medium "
              >
                {{ stateFormatter(scope.row) }}
              </el-tag>
              <el-tag
                v-if="scope.row.state===20"
                type="warning"
                size="medium "
              >
                {{ stateFormatter(scope.row) }}
              </el-tag>
              <el-tag
                v-if="scope.row.state===10"
                type="warning"
                size="medium "
              >
                {{ stateFormatter(scope.row) }}
              </el-tag>
              <el-tag
                v-if="scope.row.state===30"
                type="warning"
                size="medium "
              >
                {{ stateFormatter(scope.row) }}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
          >
            <template slot="header">
              <div>上报单位</div>
              <div>上报人</div>
            </template>
            <template slot-scope="scope">
              <div> {{ scope.row.escalationName }}</div>
              <div> {{ updatUnitIdFormatter(scope.row) }}</div>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
          >
            <template slot="header">
              <div>操作人</div>
              <div>操作时间</div>
            </template>
            <template slot-scope="scope">
              <div>{{ scope.row.updateName }}</div>
              <div>{{ scope.row.updateTime }}</div>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            prop="address"
            width="100px"
            label="操作"
          >
            <template slot-scope="scope">
              <el-button
                type="text"
                size="medium"
                @click="openWorkOrdinDialog(scope.row,'detail')"
              >
                详情
              </el-button>
              <el-button
                v-if="scope.row.state===30&&scope.row.isApprove===1"
                type="text"
                size="medium"
                @click="openWorkOrdinDialog(scope.row,'approve')"
              >
                审批
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="pagina">
        <el-pagination
          background
          :current-page="pagination.currentPage"
          :page-sizes="pagination.pageSizes"
          :page-size="pagination.pageSize"
          :total="pagination.totalCount"
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>
    </div>
    <workOrderInformation
      v-if="workOrdinDialogVisible"
      :dialog-data="dialogData"
      :visible.sync="workOrdinDialogVisible"
      @handeleSumit="handeleWorkSumbit"
    />
  </div>
</template>
 
<script>
import workOrderInformation from '@/views/toCarryOutLegislativeReforms/components/workOrderInformation'
import searchBar from '@/views/toCarryOutLegislativeReforms/delay/componets/queryForm'
export default {
  components: {
    searchBar,
    workOrderInformation
  },
  data () {
    return {
      Dic: JSON.parse(localStorage.getItem('dict')),
      dictObj: JSON.parse(localStorage.getItem('dictObj')),
      workOrdinDialogVisible: false,
      formData: {},
      tableData: [],
      polluteList: [],
      unitList: [],
      searchType: 'delay',
      pagination: {
        currentPage: 1,
        // 总条数,根据接口获取数据长度(注意:这里不能为空)
        totalCount: 0,
        // 个数选择器(可修改)
        pageSizes: [10, 20, 30, 40],
        // 默认每页显示的条数(可修改)
        pageSize: 10
      },
      searchData: {}
    }
  },
  created () {
    this.getUnitList()
    this.getContaminateList()
    this.handleSearch()
  },
  methods: {
    handeleWorkSumbit () {
      this.handleSearch()
    },
    handleSearch (obj) {
      this.searchData.isInvalid = 0
      if (obj) {
        this.searchData = obj
      }
      this.$request({
        url: '/allocationExtension/page',
        method: 'post',
        data: {
          ...obj,
          'page': this.pagination
        }
      }).then((res) => {
        this.tableData = res.data.list
        this.pagination.totalCount = res.data.page.totalNum
      })
    },
    // 分页
    // 每页显示的条数
    handleSizeChange (val) {
      // 改变每页显示的条数
      this.pagination.pageSize = val
      // 注意:在改变每页显示的条数时,要将页码显示到第一页
      this.pagination.currentPage = 1
      this.handleSearch()
    },
    // 显示第几页
    handleCurrentChange (val) {
      // 改变默认的页数
      this.pagination.currentPage = val
      this.handleSearch()
      // console.log(val)
    },
    openWorkOrdinDialog (row, type) {
      this.$request({
        url: '/allocationExtension/detail',
        method: 'get',
        params: {
          id: row.id
        }
      }).then((res) => {
        this.parentFormData = res.data
        this.workOrdinDialogVisible = true
        if (type === 'detail') {
          this.dialogData = {
            title: '审批交办单',
            parentFormData: res.data,
            pageState: 'view',
            pageType: 'delay',
            sysCode: '1010202'
          }
        } else if (type === 'approve') {
          this.dialogData = {
            title: '延期申请审批',
            parentFormData: res.data,
            pageState: 'edit',
            pageType: 'delay',
            sysCode: '1010202'
          }
        }
      })
    },
    updatUnitIdFormatter (val) {
      const data = this.unitList.find(item => item && item.unitId === val.escalationUnitId)
      return data ? data.unitName : ''
    },
    unitIdFormatter (val) {
      const data = this.unitList.find(item => item && item.unitId === val.unitId)
      return data ? data.unitName : ''
    },
    polluteTypeFormatter (val) {
      const data = this.polluteList.find(item => item && parseInt(item.dataKey) === val.polluteType)
      return data ? data.dataValue : ''
    },
    investigationTypeFormatter (val) {
      return this.dictObj.investigationEnum[val.investigationType]
    },
    stateFormatter (val) {
      return this.dictObj.allocationApproveEnum[val.state]
    },
    isInvalidFormatter (val) {
      return this.dictObj.yesOrNo[val.isInvalid]
    },
    // 获取责任单位list
    getUnitList () {
      this.$request({
        url: '/allocation/unit',
        method: 'get'
      }).then((res) => {
        this.unitList = res.data
        console.log(' JSON.stringify(this.unitList)', this.unitList)
      })
    },
    getContaminateList () {
      this.$request({
        url: '/allocation/contaminate',
        method: 'get'
      }).then((res) => {
        this.polluteList = res.data
      })
    }
  }
}
</script>
 
<style scoped lang="scss">
.main{
    padding: 20px;
    padding-top: 0px;
    height: 100%;
    overflow: overlay;
}
.tab {
    margin-top: 0px;
   /deep/ .el-tag{
      font-size: 16px;
    }
}
// /deep/ .el-table__body-wrapper {
//     overflow: scroll;
//     position: relative;
//     overflow-x: hidden;
//     max-height: 400px;
// }
.pagina{
    margin-top: 10px;
}
/deep/ .el-table__row{
  font-size: 18px;
}
.el-pagination {
  padding: 0;
  .el-select{
    /deep/.el-input{
      margin:0;
    }
  }
 
}
</style>