郑永安
2023-06-19 2befd4a5d3733520b69ed97da88e675b6b086a3c
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
<template>
    <div class="app-container">
        <div class="filter-container">
            <div style="display: block;">
                <div class="basic_search" style="padding-top: 10px">
                    <span>按企业名称:</span>
                    <el-input filterable clearable v-model="listQuery.filter.enterprisename" style="width:200px">
                    </el-input>
                </div>
                <div class="basic_search" style="padding-top: 10px">
                    <span>按单号:</span>
                    <el-input filterable clearable v-model="listQuery.filter.code" style="width:200px">
                    </el-input>
                </div>
                <div class="basic_search" style="padding-top: 10px">
                    <span>按状态:</span>
                    <el-select filterable clearable v-model="listQuery.filter.status" style="width:200px">
                        <el-option
                            v-for="item in statusList"
                            :key="item.id"
                            :value="item.text"
                            :label="item.name"
                        ></el-option>
                    </el-select>
                </div>
                <div class="basic_search" style="margin-right: 10px">
                    <el-button style="margin-left: 10px;" type="primary" @click="openSaleJudgeForm('新增','')">新增</el-button>
                    <el-button style="margin-left: 10px;" type="primary" icon="el-icon-search" @click="search('查询','')">查询</el-button>
                </div>
            </div>
 
        </div>
        <div class="table_content">
            <el-table
                v-loading="listLoading"
                :key="tableKey"
                :data="saleJudgeData"
                border
                fit
                highlight-current-row
                style="width: 100%;"
            >
                <el-table-column label="序号" type="index" align="center" width="60"/>
                <el-table-column label="企业名称" prop="enterprisename" align="center">
                </el-table-column>
                <el-table-column label="单号" prop="code" align="center">
                </el-table-column>
                <el-table-column label="提出人" prop="requestor" align="center">
                </el-table-column>
                <el-table-column label="提交时间" prop="submittime" align="center">
                </el-table-column>
                <el-table-column label="单号" prop="code" align="center">
                </el-table-column>
                <el-table-column label="处罚措施" prop="punishmentmeasure" align="center">
                    <template slot-scope="scope">
                        <div v-for="item in punishmentMeasureList">
                            <div v-if="scope.row.punishmentmeasure === item.value">
                                <span>{{item.text}}</span>
                            </div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="处罚原因" prop="punishmentreason" align="center">
                </el-table-column>
                <el-table-column label="审批人" prop="approver" align="center">
                </el-table-column>
                <el-table-column label="文件" prop="file" align="center">
                    <template slot-scope="scope">
                        <el-button type="text" @click="download(scope.row)">下载</el-button>
                    </template>
                </el-table-column>
                <el-table-column label="状态" prop="status" align="center">
                </el-table-column>
                <el-table-column label="操作" align="center">
                    <template slot-scope="scope">
                        <el-button type="text" @click="commit(scope.row)" v-if="(scope.row.status === '待提交' || scope.row.status === '驳回') ? true :false">提交</el-button>
                        <el-button type="text" @click="openSaleJudgeForm('修改',scope.row)" v-if="(scope.row.status === '待提交' || scope.row.status === '驳回') ? true :false">修改</el-button>
                        <el-button type="text" @click="review(scope.row)" v-if="scope.row.status === '待审批' ? true :false">审批</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <br>
            <el-pagination
                v-show="recordTotal>0"
                :current-page="currentPage"
                :page-sizes="[10, 20, 30, 50]"
                :page-size="pageSize"
                :total="recordTotal"
                layout="total, sizes, prev, pager, next, jumper"
                background
                style="float:right;"
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
            />
            <br>
        </div>
        <el-dialog
            title="审批"
            :visible.sync="dialogVisible"
            :close-on-click-modal="false"
            :close-on-press-escape="false"
            width="60%">
            <el-form :model="saleJudgeForm" ref="ruleForm" label-width="200px">
                <el-row>
                    <el-col :span="20">
                        <el-form-item label="企业名称" prop="enterprisename" >
                            <el-select v-model="saleJudgeForm.enterprisename" :disabled="ifShow">
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="20">
                        <el-form-item label="处罚类型" prop="punishmentmeasure">
                            <el-select v-model="saleJudgeForm.punishmentmeasure" :disabled="ifShow">
                                <el-option
                                    v-for="item in punishmentMeasureList"
                                    :key="item.id"
                                    :value="item.value"
                                    :label="item.text">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="20">
                        <el-form-item label="处罚原因" prop="punishmentreason">
                            <el-input type="textarea" :row="2" v-model="saleJudgeForm.punishmentreason" :disabled="ifShow">
                            </el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="20">
                        <el-form-item label="审批建议:">
                            <el-input type="textarea" :row="3" v-model="reviewRegisterForm.lastrejectreason"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <div align="center">
                <el-button @click="refuse">拒绝</el-button>
                <el-button type="primary" @click="agree()">通过</el-button>
            </div>
        </el-dialog>
        <sale-judge-form ref="form" @getinfo="getSaleJudge"></sale-judge-form>
    </div>
</template>
 
<script>
import {uploadUrl} from '@/assets/upload/url'
import {agreeSaleJudge, commitSaleJudge, getSaleJudge, refuseSaleJudge} from "../../../api/saleJudge";
import {computePageCount} from "../../../utils";
import SaleJudgeForm from "./components/saleJudgeForm";
import {dictionaryAllItems} from "../../../api/dictionary";
import {parseError} from "../../../utils/messageDialog";
 
export default {
    name: "registerReview",
    data(){
        return{
            ifShow:false,
            pageSize: 10,
            recordTotal: 0,
            currentPage: 1,
            pageTotal: 0,
            tableKey: 0,
            listLoading:false,
            saleJudgeData:[],
            dialogVisible:false,
            reviewRegisterForm:{
                id:'',
                lastrejectreason:'',
            },
            saleJudgeForm:{
                enterprisename:'',
                enterprisenumber:'',
                punishmentmeasure:'',
                punishmentreason:'',
                file:'',
                id:'',
            },
            provinceList:[],
            cityList:[],
            districtList:[],
            streetList:[],
            committeeList:[],
            punishmentMeasureList:[],
            statusList:[{id:1,name:'待提交',text:'TOSUBMIT'},{id:2,name:'待审批',text:'PENDING'},{id:3,name:'驳回',text:'REJECT'},{id:4,name:'审批通过',text:'APPROVED'}],
            reviewResultList:[{id:0,name:'未审核'},{id:1,name:'审核通过'},{id:2,name:'审核拒绝'}],
            listQuery:{
                filter:{
                    enterprisename:'',
                    status:'',
                    code:'',
                },
                pageIndex:1,
                pageSize:10,
            },
        }
    },
    components:{
        SaleJudgeForm
    },
    created() {
        this.getSaleJudge()
        this.getPunishmentTypeList()
    },
    watch: {
    },
    methods:{
        async getSaleJudge(){
            this.listLoading = true
            let res = await getSaleJudge(this.listQuery)
            if(res.data.code === "200"){
                this.recordTotal = res.data.result.total
                this.pageSize = res.data.result.size
                this.pageTotal = computePageCount(res.data.result.totalCount, res.data.result.pageSize)
                this.currentPage = res.data.result.current
                this.saleJudgeData = res.data.result.records
            }else{
                this.$message({
                    type:'warning',
                    message:res.data.message
                })
            }
            this.listLoading = false
        },
        openSaleJudgeForm(title,value){
            this.$refs.form.showSaleJudgeForm(title,value,this.punishmentMeasureList)
        },
        search(){
            this.getSaleJudge()
        },
        async commit(val){
            commitSaleJudge(val.id).then((res)=>{
                if(res.data.code == '200') {
                    this.getSaleJudge()
                    this.$notify({
                        title: '成功',
                        message: '提交成功',
                        type: 'success',
                        duration: 2000,
                    })
                }else{
                    this.$message({
                        message:res.data.message,
                        type:'warning'
                    })
                }
            })
        },
        review(value){
            this.dialogVisible = true
            this.ifShow = true
            this.saleJudgeForm.enterprisename = JSON.parse(JSON.stringify(value)).enterprisename
            this.saleJudgeForm.enterprisenumber = JSON.parse(JSON.stringify(value)).enterprisenumber
            this.saleJudgeForm.punishmentmeasure = JSON.parse(JSON.stringify(value)).punishmentmeasure
            this.saleJudgeForm.punishmentreason = JSON.parse(JSON.stringify(value)).punishmentreason
            this.saleJudgeForm.id= JSON.parse(JSON.stringify(value)).id
            this.reviewRegisterForm.lastrejectreason = ''
        },
        refuse(){
            this.reviewRegisterForm.id = this.saleJudgeForm.id
            this.$confirm('拒绝申请,是否继续','提示',{
                confirmButtonText:'确定',
                cancelButtonText:'取消',
                type:'warning',
            }).then(()=> {
                refuseSaleJudge(this.reviewRegisterForm).then( (res)=>{
                    if(res.data.code === "200"){
                        this.dialogVisible = false
                        this.getSaleJudge()
                        this.$notify({
                            title:'成功',
                            message:'审核拒绝成功',
                            type:'success',
                            duration:2000,
                        })
                    }else{
                        this.$message({
                            type:'warning',
                            message:res.data.message
                        })
                    }
                })
            })
        },
        agree(){
            this.reviewRegisterForm.id = this.saleJudgeForm.id
            this.$confirm('同意申请,是否继续','提示',{
                confirmButtonText:'确定',
                cancelButtonText:'取消',
                type:'warning',
            }).then(()=> {
                agreeSaleJudge(this.reviewRegisterForm).then( (res)=>{
                    if(res.data.code === "200"){
                        this.dialogVisible = false
                        this.getSaleJudge()
                        this.$notify({
                            title:'成功',
                            message:'审核通过成功',
                            type:'success',
                            duration:2000,
                        })
                    }else{
                        this.$message({
                            type:'warning',
                            message:res.data.message
                        })
                    }
                })
            })
        },
        handleSizeChange: function(val) {
            this.listQuery.pageSize = val
            this.getSaleJudge()
        },
        handleCurrentChange: function(val) {
            this.listQuery.pageIndex = val
            this.getSaleJudge()
        },
        download(val){
            window.open(uploadUrl()+val.path1, '_blank')
        },
        getPunishmentTypeList(){
            const _this = this
            if (_this.levelOptions && _this.levelOptions.length > 0) {
                return
            }
            const params = {}
            params['dictionaryType'] = '处罚类型'
            dictionaryAllItems(params).then(response => {
                const res = response.data
                if (res.code == 200) {
                    _this.punishmentMeasureList = res.result
                    console.log(_this.punishmentMeasureList);
                } else {
                    parseError({error: res.message, vm: _this})
                }
            }).catch(error => {
                parseError({error: error, vm: _this})
            })
        },//获取处罚类型
    },
}
</script>
 
<style scoped>
.basic_search{
    display:inline-block;
}
 
</style>