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

268 lines
8.0 KiB
Vue
Raw 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.OUTSOURCED_NAME ? item.OUTSOURCED_NAME : item.AIOUTSOURCED_NAME}}</text>
</view>
<view class="flex-between mt-10 subtitle">
<text>
隐患来源:{{ sourceState[item.SOURCE] }}
</text>
</view>
<view class="flex-between mt-10 subtitle">
<text>隐患描述:{{ item.HIDDENDESCR }}</text>
</view>
<view class="flex-between mt-10 subtitle">
<text>隐患发现人:{{item.CREATOR_NAME || item.CREATOR_NAMES}}</text>
</view>
<view class="flex-between mt-10 subtitle">
<text>隐患发现时间:{{item.CREATTIME}}</text>
</view>
<view class="flex-between mt-10 subtitle">
<text>隐患整改人:{{item.RECTIFICATIONOR_NAME}}</text>
<text>整改时间:{{item.RECTIFICATIONTIME}}</text>
</view>
<view class="flex-between mt-10 subtitle">
<text>隐患验收人:{{item.CREATOR_NAME}}</text>
<text>验收时间:{{item.CHECKTIME}}</text>
</view>
<view class="flex-between mt-10 subtitle">
<text>隐患状态:{{state[item.STATE]}}</text>
<text>是否处罚:{{ item.ISPUNISH && (item.ISPUNISH === "1" ? "是" : "否") }}</text>
</view>
<view class="flex-end mt-10 subtitle">
<u-button
v-if="item.CREATOR == userInfo.USER_ID
&& tabsType === '1'
"
type="primary" text="验收" size="mini" class="bth-mini" @click="fnNavigatorDetail(item.HIDDEN_ID,'acceptance')"></u-button>
<u-button
type="primary" text="查看" size="mini" class="bth-mini ml-10" @click="fnNavigatorDetail(item.HIDDEN_ID,'view')"></u-button>
<!-- <u-button
v-if="item.ISPUNISH !== '2'
&& !item.KEYPROJECTPUNISH_ID
&& item.PUNISH_THE_PERSON
&& item.PUNISH_THE_PERSON.includes(userInfo.USER_ID )
"
color="linear-gradient(to right, #ff6034, #ee0a24)"
text="处罚" size="mini" class="bth-mini ml-10"
@click="fnModalShow(item)"></u-button> -->
<view></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">
<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 {getKeyProjectsCheckHiddenList, 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: [],
sourceState: {
1: "AI报警",
2: "AI报警(企业端)",
4: "安全环保检查(监管端)",
5: "安全环保检查(企业端)",
},
state: {
1: "未整改",
2: "已整改",
4: "已验收",
},
modalShow:false,
punishForm:{
ISPUNISH:'',
HIDDEN_ID:'',
RECTIFICATIONDEPT_NAME:'',
RECTIFICATIONOR_NAME:'',
REASON:'',
AMOUT:'',
DATE:uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
},
punishRules: {
'REASON': '请填写处罚原因',
'AMOUT': '请填写处罚金额',
'DATE': '请选择下发处罚时间',
},
timeShow:false
}
},
onShow() {
this.resetList()
},
computed: {
userInfo() {
return this.$store.getters.getUserInfo
}
},
methods:{
async getData(){
let resData = await getKeyProjectsCheckHiddenList({
showCount: this.pageSize,
currentPage: this.currentPage,
CREATOR: this.userInfo.USER_ID,
ISCHECK: this.tabsType
});
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,type){
uni.$u.route({
url: '/pages/key-project-management/hidden-management/view',
params: {
HIDDEN_ID,
type: type
}
})
},
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.RECTIFICATIONDEPT_NAME
this.punishForm.RECTIFICATIONOR_NAME = item.RECTIFICATIONOR_NAME
this.modalShow = true
},
timeConfirm(e){
this.punishForm.DATE = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM')
this.timeShow = false;
},
changeRadioGroup(e){
console.log(e.detail.value)
if(this.TabCur == 2) return
this.punishForm.ISPUNISH = e.detail.value
},
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
})
this.punishForm= {
HIDDEN_ID: '',
ISPUNISH: '',
RECTIFICATIONDEPT_NAME: '',
RECTIFICATIONOR_NAME: '',
REASON: '',
AMOUT: '',
DATE: formatDate(new Date(), 'yyyy-MM-dd hh:mm'),
},
await this.editHiddenIspunishIndex(1)
}else {
await this.editHiddenIspunishIndex(2)
}
},
editHiddenIspunishIndex(Ispunish){
// 如果不处罚 修改隐患
editHiddenIspunish({
...this.punishForm,
ISPUNISH:Ispunish
})
this.modalShow = false
this.resetList()
},
}
}
</script>
<style scoped>
</style>