qa-regulatory-gwj-app/pages/key-project-management/penalty-management/list.vue

237 lines
6.9 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view class="content">
<u-tabs
lineWidth="336upx"
:list="tabsList"
itemStyle="height:80upx;padding-bottom:10upx;background-color: #fff;"
@click="tabsClick"
></u-tabs>
<u-list @scrolltolower="scrolltolower" v-if="list.length > 0">
<u-list-item v-for="(item, index) in list" :key="index">
<view>
<view class="flex-between main-title">
<text>{{ item.HIDDENDESCR }}</text>
</view>
<view class="flex-between mt-10 subtitle">
<text>被处罚单位:{{ item.UNITS_NAME }}</text>
<text v-show="item.ISPUNISH==='1'&&item.HANDLED==='0'">被处罚人:{{ item.PERSON_NAME }}</text>
</view>
<view v-show="item.ISPUNISH==='1'" class="flex-between mt-10 subtitle">
<text>
处罚原因:{{ item.REASON }}
</text>
</view>
<view v-show="item.ISPUNISH" class="flex-between mt-10 subtitle">
<text>下发人:{{ item.CREATOR_NAME }}</text>
<text>是否处罚:{{ item.ISPUNISH == "2" ? "否":"是" }}</text>
</view>
<view class="flex-between mt-10 subtitle">
<text>处罚处理状态:{{ item.ISPUNISH == "2" ? "不处罚":item.HANDLED == "1" ?"已完成":item.ISPUNISH == "1" ? "待反馈" : "待处罚" }}</text>
<view class="flex-between">
<u-button
v-if="!item.ISPUNISH"
color="linear-gradient(to right, #ff6034, #ee0a24)"
text="处罚" size="mini" class="bth-mini ml-10"
@click="fnModalShow(item)"></u-button>
<u-button style="margin-left: 20upx;" type="primary" text="查看" size="mini" class="bth-mini" @click="fnNavigatorDetail(item.HIDDEN_ID)"></u-button>
</view>
</view>
</view>
</u-list-item>
</u-list>
<empty v-else></empty>
<u-modal :show="modalShow" title="处罚" showCancelButton @cancel="modalShow = false" @confirm="fnSubmit">
<view style="flex: 1">
<u-cell-group :border="false">
<view class="cu-form-group">
<view class="title">是否进行罚款</view>
<radio-group @change="changeRadioGroup($event)">
<label class="radio"><radio value="1" :checked="punishForm.ISPUNISH === '1'" :disabled="TabCur == 2" /></label>
<label class="radio"><radio value="2" :checked="punishForm.ISPUNISH === '2'" :disabled="TabCur == 2" /></label>
</radio-group>
</view>
<view v-if="punishForm.ISPUNISH==1">
<u-cell>
<view slot="title" class="title required">
处罚原因:
</view>
<view slot="value">
<u--input v-model="punishForm.REASON" border="none" inputAlign="right"></u--input>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">
处罚金额(元):
</view>
<view slot="value" style="flex: 1;">
<u--input v-model="punishForm.AMOUT" border="none" type="number" inputAlign="right"></u--input>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">
被处罚单位:
</view>
<view slot="value">{{punishForm.RECTIFICATIONDEPT_NAME}}</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">
被处罚人:
</view>
<view slot="value">{{punishForm.RECTIFICATIONOR_NAME}}</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">下发处罚时间:</view>
<view slot="value">
<text @click="timeShow = true">{{ punishForm.DATE || '请选择' }}</text>
<u-datetime-picker :show="timeShow" :value="punishForm.DATE"
:minDate="Number(1970)"
@cancel="timeShow = false"
@confirm="timeConfirm"></u-datetime-picker>
</view>
</u-cell>
</view>
</u-cell-group>
</view>
</u-modal>
</view>
</template>
<script>
import {setKeyProjectsPunishList,getKeyProjectsPunishList, getKeyProjectsPunishAdd,editHiddenIspunish} from "../../../api";
export default {
data() {
return {
TabCur: 0, //迁移变量,作用未知
tabsList: [
{name: '待反馈处罚', id: '1'},
{name: '已完成处罚', id: '2'}
],
tabsType: '1',
pageSize: 10,
currentPage: 1,
totalPage: 0,
list: [],
modalShow: false,
punishForm: {
HIDDEN_ID: '',
ISPUNISH: '',
RECTIFICATIONDEPT_NAME: '',
RECTIFICATIONOR_NAME: '',
REASON: '',
CORPINFO_ID: '',
AMOUT: '',
DATE: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
},
timeShow:false
}
},
onShow() {
this.resetList()
},
onLoad(e) {
this.CORPINFO_ID = e.CORPINFO_ID
},
computed: {
userInfo() {
return this.$store.getters.getUserInfo
}
},
methods:{
async getData(){
let resData = await getKeyProjectsPunishList({
showCount: this.pageSize,
currentPage: this.currentPage,
CORPINFO_ID: this.CORPINFO_ID,
HANDLED: this.tabsType,
loginUserId: this.userInfo.USER_ID
});
this.list = [...this.list,...resData.varList];
this.totalPage = resData.page.totalPage;
},
resetList() {
this.pageSize= 10
this.currentPage= 1
this.list = []
this.getData()
},
fnNavigatorDetail(HIDDEN_ID){
uni.$u.route({
url: '/pages/key-project-management/penalty-management/viewHidden',
params: {
HIDDEN_ID,
type:'view'
}
})
},
scrolltolower() {
this.currentPage++;
if(this.totalPage >= this.currentPage) this.getData();
},
tabsClick(e) {
this.tabsType = e.id
this.resetList()
},
fnModalShow(item) {
this.punishForm.HIDDEN_ID = item.HIDDEN_ID
this.punishForm.RECTIFICATIONDEPT_NAME = item.UNITS_NAME
this.punishForm.RECTIFICATIONOR_NAME = item.RECTIFICATIONOR_NAME
this.punishForm.ISPUNISH = '2'
this.modalShow = true
},
changeRadioGroup(e){
if(this.TabCur == 2) return
this.punishForm.ISPUNISH = e.detail.value
},
timeConfirm(e){
this.punishForm.DATE = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM')
this.timeShow = false;
},
async fnSubmit(){
if(this.punishForm.ISPUNISH == 1){
for (const key in this.punishRules) {
if(!this.punishForm[key]){
uni.showToast({
title: this.punishRules[key],
icon: 'none'
})
return
}
}
await getKeyProjectsPunishAdd({
...this.punishForm,
CREATOR: this.userInfo.USER_ID,
OPERATOR: this.userInfo.USER_ID
})
await this.editHiddenIspunishIndex(1)
}else {
await this.editHiddenIspunishIndex(2)
}
},
editHiddenIspunishIndex(Ispunish){
// 如果不处罚 修改隐患
editHiddenIspunish({
...this.punishForm,
ISPUNISH:Ispunish,
PUNISH_PERSON:this.userInfo.USER_ID
})
this.punishForm= {
HIDDEN_ID: '',
ISPUNISH: '',
RECTIFICATIONDEPT_NAME: '',
RECTIFICATIONOR_NAME: '',
REASON: '',
AMOUT: '',
DATE: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
},
this.modalShow = false
this.resetList()
},
}
}
</script>
<style scoped>
</style>