qa-prevention-xgf-app/safetyEnvirSubPackages/pages/initiate/plead.vue

175 lines
6.0 KiB
Vue
Raw Normal View History

<template>
<view class="content">
<view class="card">
<u-cell-group :border="false">
<u-cell class="flex-none">
<view slot="title" class="title">申辩人</view>
<view slot="value" class="mt-10">
<u--image :showLoading="true" :src="$store.state.filePath + form.INSPECTED_SITEUSER_SIGN_IMG" width="100%"
height="80px" mode="scaleToFill"
@click="previewImage($store.state.filePath + form.INSPECTED_SITEUSER_SIGN_IMG)"></u--image>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title">申辩时间</view>
<view slot="value">{{ form.INSPECTED_SITEUSER_SIGN_TIME }}</view>
</u-cell>
<u-cell>
<view slot="title" class="title">申辩说明</view>
<view slot="value">{{ form.INSPECTED_EXPLAIN }}</view>
</u-cell>
<u-cell class="flex-none" v-if="form.INSPECTED_EXPLAIN_FILENAME">
<view slot="title" class="title">申辩附件</view>
<view slot="value" class="mt-10 flex-between">
<text class="u-line-1">{{ form.INSPECTED_EXPLAIN_FILENAME }}</text>
<u-button type="primary" text="下载" size="mini" class="bth-mini ml-10" @click="downloadAppendix"></u-button>
</view>
</u-cell>
<u-cell>
<view slot="title" class="title required">申辩是否成立</view>
<view slot="value">
<u-radio-group v-model="form.INSPECTION_STATUS" placement="row">
<u-radio label="是" name="-2"></u-radio>
<u-radio label="否" name="3" class="ml-10"></u-radio>
</u-radio-group>
</view>
</u-cell>
<template v-if="form.INSPECTION_STATUS === '-2'">
<u-cell class="flex-none">
<view slot="title" class="title flex-between">
确认人签字
<u-button type="primary" text="手写添加" size="mini" class="bth-mini" @click="signShow = true"></u-button>
</view>
<view slot="value" class="mt-10">
<u--image v-show="form.SIGN_IMG" :showLoading="true" :src="form.SIGN_IMG" width="100%" height="80px"
mode="scaleToFill" @click="previewImage(form.SIGN_IMG)"></u--image>
<sign v-if="signShow" :signShow.sync="signShow" @confirm="signConfirm"></sign>
</view>
</u-cell>
</template>
<template v-if="form.INSPECTION_STATUS === '3'">
<u-cell class="flex-none">
<view slot="title" class="title required">不成立理由</view>
<view slot="value" class="mt-10">
<u--textarea v-model="form.INSPECTED_EXPLAIN_REFUSE" placeholder="请输入不成立理由"></u--textarea>
</view>
</u-cell>
<u-cell class="flex-none">
<view slot="title" class="title flex-between">
确认人签字
<u-button type="primary" text="手写添加" size="mini" class="bth-mini" @click="signShow = true"></u-button>
</view>
<view slot="value" class="mt-10">
<u--image v-show="form.SIGN_IMG" :showLoading="true" :src="form.SIGN_IMG" width="100%" height="80px"
mode="scaleToFill" @click="previewImage(form.SIGN_IMG)"></u--image>
<sign v-if="signShow" :signShow.sync="signShow" @confirm="signConfirm"></sign>
</view>
</u-cell>
</template>
<u-cell class="flex-none" :border="false">
<view slot="value" class="flex-between">
<u-button type="primary" class="bth" text="提交" @click="$u.debounce(fnSubmit, 1000, true)"></u-button>
</view>
</u-cell>
</u-cell-group>
</view>
</view>
</template>
<script>
import sign from "../../../components/sign/sign";
import { setSafetyenvironmentalGoEdit, setSafetyenvironmentalExplain } from "../../api";
export default {
components: {
sign,
},
data() {
return {
INSPECTION_ID: '',
form: {},
signShow: false
}
},
onLoad(event) {
this.INSPECTION_ID = event.INSPECTION_ID
this.getData()
},
computed: {
userInfo() {
return this.$store.getters.getUserInfo
}
},
methods: {
async getData() {
let params = {
INSPECTION_ID: this.INSPECTION_ID,
}
let resData = await setSafetyenvironmentalGoEdit(params)
this.form = resData.pd
},
previewImage(current) {
uni.previewImage({
urls: [current],
current
});
},
downloadAppendix() {
plus.runtime.openURL(this.$store.state.filePath + this.form.INSPECTED_EXPLAIN_FILEPATH, function (res) {
console.log(res);
});
},
signConfirm(signImg) {
this.form.SIGN_IMG = signImg.filePath
},
async fnSubmit() {
if (!this.form.INSPECTION_STATUS) {
uni.showToast({
title: '请选择申辩是否成立',
icon: "none"
})
return;
}
if (this.form.INSPECTION_STATUS === '3') {
if (!this.form.INSPECTED_EXPLAIN_REFUSE) {
uni.showToast({
title: '请填写不成立理由',
icon: "none"
})
return;
}
if (!this.form.SIGN_IMG) {
uni.showToast({
title: '请签字',
icon: "none"
})
return;
}
await setSafetyenvironmentalExplain({
...this.form,
'loginUserId': this.userInfo.USER_ID,
'loginUserName': this.userInfo.USERNAME
})
uni.showToast({
title: '申辩成功',
})
uni.$u.route({
type: 'navigateBack'
})
} else if (this.form.INSPECTION_STATUS === '-2') {
uni.$u.route({
url: '/pages/safety-environmental-inspection/initiate/detail',
params: {
INSPECTION_ID: this.INSPECTION_ID,
type: 'edit',
vector: 'list'
}
})
}
}
}
}
</script>
<style scoped></style>