integrated_traffic_uniapp/pages/application/commitment-company/commitment-company-edit.vue

379 lines
11 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>
<cu-custom bgColor="bg-gradual-blueness" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">安全承诺</block>
</cu-custom>
<scroll-view scroll-y="false">
<view>
<view class="wui-sub-title">
<text>企业状态</text>
</view>
<view class="wui-form-list" style="margin-top: 0;">
<view class="cu-form-group">
<view class="title">生产装置</view>
<input type="number" name="input" ref="INPUT1" v-model="pd.INPUT1" placeholder="请输入..."></input>
</view>
<view class="cu-form-group">
<view class="title">运行:</view>
<input type="number" name="input" ref="INPUT2" v-model="pd.INPUT2" placeholder="请输入..."></input>
</view>
<view class="cu-form-group">
<view class="title">停产:</view>
<input type="number" name="input" ref="INPUT3" v-model="pd.INPUT3" placeholder="请输入..."></input>
</view>
<view class="cu-form-group">
<view class="title">检修:</view>
<input type="number" name="input" ref="INPUT4" v-model="pd.INPUT4" placeholder="请输入..."></input>
</view>
</view>
<view class="wui-form-list">
<view class="cu-form-group">
<view class="title">特级动火作业:</view>
<input type="number" name="input" ref="INPUT5" v-model="pd.INPUT5" placeholder="请输入..."></input>
</view>
<view class="cu-form-group">
<view class="title">一级动火作业:</view>
<input type="number" name="input" ref="INPUT6" v-model="pd.INPUT6" placeholder="请输入..."></input>
</view>
<view class="cu-form-group">
<view class="title">二级动火作业:</view>
<input type="number" name="input" ref="INPUT7" v-model="pd.INPUT7" placeholder="请输入..."></input>
</view>
<view class="cu-form-group">
<view class="title">受限空间作业:</view>
<input type="number" name="input" ref="INPUT8" v-model="pd.INPUT8" placeholder="请输入..."></input>
</view>
<view class="cu-form-group">
<view class="title">登高作业:</view>
<input type="number" name="input" ref="INPUT9" v-model="pd.INPUT9" placeholder="请输入..."></input>
</view>
<view class="cu-form-group">
<view class="title">其他特殊作业:</view>
<input type="number" name="input" ref="INPUT10" v-model="pd.INPUT10" placeholder="请输入..."></input>
</view>
</view>
<view class="wui-form-list">
<view class="cu-form-group">
<view class="title">是否处于生产</view>
<view style="width: 200upx;">
<radio-group class="wui-radio-group">
<radio class='radio' value="-1" @click="changeRadio('RADIO1','-1')">
<text class="wui-pl10">否</text>
</radio>
<radio class='radio' value="1" @click="changeRadio('RADIO1','1')">
<text class="wui-pl10">是</text>
</radio>
</radio-group>
</view>
</view>
<view class="cu-form-group">
<view class="title">是否处于开停车状态</view>
<view style="width: 200upx;">
<radio-group class="wui-radio-group">
<radio class='radio' value="-1" @click="changeRadio('RADIO2','-1')">
<text class="wui-pl10">否</text>
</radio>
<radio class='radio' value="1" @click="changeRadio('RADIO2','1')">
<text class="wui-pl10">是</text>
</radio>
</radio-group>
</view>
</view>
<view class="cu-form-group" style="height: 160upx;">
<view class="title" style="height: auto;padding-right: 0; width: 380upx;">罐区、库房等危险源是否处于安全状态</view>
<view style="width: 200upx;">
<radio-group class="wui-radio-group">
<radio class='radio' value="-1" @click="changeRadio('RADIO3','-1')">
<text class="wui-pl10">否</text>
</radio>
<radio class='radio' value="1" @click="changeRadio('RADIO3','1')">
<text class="wui-pl10">是</text>
</radio>
</radio-group>
</view>
</view>
</view>
<view class="wui-sub-title">
<text class="text-semi">企业承诺</text>
</view>
<view class="wui-form-list" style="margin-top: 0; padding: 10upx 20upx 20upx 20upx;">
<view class="cu-form-group ">
<view class="title">今日</view>
<ruiDatePicker
fields="minute"
:start="todayDate"
:value="pd.START_TIME?pd.START_TIME:''"
@change="changeStartDate"
></ruiDatePicker>
</view>
<view class="cu-form-group">
<view class="title">至</view>
<ruiDatePicker
fields="minute"
:value="pd.END_TIME?pd.END_TIME:''"
@change="changeEndDate"
></ruiDatePicker>
</view>
<view class="sure-p wui-p20">
今天我公司已进行安全风险研判,各项安全风险防控措施已落实到位,我承诺所有生产设施处于安全运行状态,罐区、库房等危险源安全风险得到有效控制。
</view>
<view class="wui-sign" style="border-top: 1px dashed #eee;;">
<view class="title">承诺人</view>
<button class="cu-btn bg-green shadow" @tap="showModal" data-target="Modal">手写签字</button>
</view>
<view class="wui-sign-box" v-show="imgList && imgList.length > 0">
<view class="sign-title">
签字照片:
</view>
<view class="wui-sign-cotent">
<view class="sign-img" v-for="(item,index) in imgList" :key="index"
@tap="ViewImage" data-type="0" :data-url="imgList[index].filePath">
<image :src="imgList[index].filePath" mode="aspectFit"></image>
</view>
</view>
</view>
<view class="cu-modal" :class="modalName=='Modal'?'show':''">
<writing-board @confirm="subCanvas" @cancel="hideModal"></writing-board>
</view>
</view>
</view>
<view class="cu-bar btn-group" style="margin-top: 30upx;">
<button :loading="buttonloading" class="cu-btn bg-green margin-tb-sm lg" @click="$noMultipleClicks(goSubmit)">提 交</button>
</view>
<view class="padding flex flex-direction">
</view>
</scroll-view>
</view>
</template>
<script>
import {
basePath,
corpinfoId,
deptId,
loginUser,
formatDate,
loginSession,
baseImgPath
} from '@/common/tool.js';
import tkiTree from "@/components/select-tree/select-tree.vue"
import writingBoard from "@/components/writing-board/writing-board.vue"
import gcoord from '@/common/gcoord.js'
import ruiDatePicker from '@/components/rattenking-dtpicker/rattenking-dtpicker.vue';
export default {
components: {
tkiTree,
ruiDatePicker,
writingBoard
},
data() {
return {
baseImgPath: baseImgPath,
buttonloading: false,
isUps: false,
forbidEdit: true, // 禁止修改
msg: 'add',
noClick: true,
pd: {}, // 数据
measuresList: [],
gasList: [],
rules: [{
name: 'INPUT1',
message: '请输入生产装置数'
},
{
name: 'INPUT2',
message: '请输入生产装置运行数'
},
{
name: 'INPUT3',
message: '请输入生产装置停产数'
},
{
name: 'INPUT4',
message: '请输入生产装置检修数'
},
{
name: 'INPUT5',
message: '请输入特级动火作业数'
},
{
name: 'INPUT6',
message: '请输入一级动火作业数'
},
{
name: 'INPUT7',
message: '请输入二级动火作业数'
},
{
name: 'INPUT8',
message: '请输入受限空间作业数'
},
{
name: 'INPUT9',
message: '请输入登高作业数'
},
{
name: 'INPUT10',
message: '请输入其他特殊作业数'
},
{
name: 'RADIO1',
message: '请选择是否处于生产'
},
{
name: 'RADIO2',
message: '请选择是否处于开停车状态'
},
{
name: 'RADIO3',
message: '请选择罐区、库房等危险源是否处于安全状态'
},
{name: 'START_TIME', message: '请选择承诺时间'},
{name: 'END_TIME', message: '请选择承诺时间'},
],
todayDate: '',
modalName: null,
imgList: [],
}
},
onLoad(event) {
loginSession();
this.todayDate = formatDate(new Date(), 'yyyy-MM-dd hh:mm');
},
methods: {
goSubmit() {
let startTime = this.pd.START_TIME
let endTime = this.pd.END_TIME
let timeStamp = 86400000 * 30
if(new Date(endTime).getTime() - new Date(startTime).getTime() > timeStamp){
uni.showToast({
title:'只能选择30天内的日期',
icon:'none'
})
return;
}
var _this = this;
let required = true
uni.showLoading({
title: '请稍候'
})
if (_this.imgList.length <= 0) {
uni.showToast({
icon: 'none',
title: '请签字',
duration: 1500
});
return;
}
this.rules.map(({
name,
message
}) => {
if (!this.pd[name]) {
uni.showToast({
icon: 'none',
title: message,
duration: 1500
});
required = false
}
})
if (!required) {
return
}
const formData = {}
Object.keys(this.pd).map(key => {
formData[key] = this.pd[key]
})
formData.DEPARTMENT_ID = deptId
formData.SIGN_USER = loginUser.USER_ID
formData.CORPINFO_ID = loginUser.CORPINFO_ID
formData.USER_ID = loginUser.USER_ID
this.buttonloading = true
uni.uploadFile({
url: basePath + 'app/commitmentcompany/add',
filePath: _this.imgList[0].filePath,
name: 'FFILE',
formData: formData,
success: (res) => {
uni.showToast({
icon: 'none',
title: '保存成功',
duration: 2000
});
_this.goback()
this.buttonloading = false
},
fail: (err) => {
uni.hideLoading();
uni.showModal({
content: err.errMsg,
showCancel: false
});
}
})
},
changeRadio(name, value) {
this.pd[name] = value
},
changeStartDate(e) {
this.pd.START_TIME = e
this.$forceUpdate();//强制刷新
},
changeEndDate(e) {
this.pd.END_TIME = e
this.$forceUpdate();//强制刷新
},
/*
*手写板
*/
showModal(e) {
this.modalName = e.currentTarget.dataset.target
},
hideModal(e) {
this.modalName = null
},
//完成
subCanvas(e) {
this.imgList.splice(0, this.imgList.length);
this.imgList.push(e);
this.pd.SIGNER_TIME = formatDate(new Date(), 'yyyy-MM-dd hh:mm');
this.hideModal()
},
ViewImage(e) {
let files = [];
files.push(e.currentTarget.dataset.url)
uni.previewImage({
urls: files,
current: e.currentTarget.dataset.url
});
},
goback() {
var pages = getCurrentPages(); // 获取当前页面栈
var prePage = pages[pages.length - 2]; // 上二级页面
prePage.$vm.initflag = true; // A 页面 init方法 为true
uni.navigateBack({
delta: 1
});
uni.hideLoading();
},
}
}
</script>
<style scoped>
</style>