721 lines
26 KiB
Vue
721 lines
26 KiB
Vue
<template>
|
|
<div>
|
|
<div>
|
|
<hidden-info :data="data"/>
|
|
</div>
|
|
<div style="padding: 0 20px 20px;">
|
|
<div class="level-line" />
|
|
<div class="level-title">
|
|
<h1>隐患整改</h1>
|
|
</div>
|
|
<div>
|
|
<el-form ref="formRule" :model="form" label-width="90px" class="table-ui">
|
|
<el-form-item label="正常整改">
|
|
<el-radio-group v-model="form.IS_NORMAL">
|
|
<el-radio label="1" value="1">是</el-radio>
|
|
<el-radio label="2" value="2">否</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
<div v-show="form.IS_NORMAL=='2'">
|
|
<el-form-item :rules="form.IS_NORMAL =='2' ?formRule.disposalPlan:[{required: false}]" label="无法整改原因">
|
|
<el-input v-model="form.disposalPlan" type="textarea" placeholder="请输入无法整改原因" style="margin-bottom: 10px"/>
|
|
</el-form-item>
|
|
</div>
|
|
<div v-show="form.IS_NORMAL=='1'">
|
|
<el-form-item :rules="form.IS_NORMAL =='1' ?formRule.RECTIFYDESCR:[{required: false}]" prop="RECTIFYDESCR" label=" 整改描述">
|
|
<el-input v-model="form.RECTIFYDESCR" />
|
|
</el-form-item>
|
|
<el-form-item :rules="form.IS_NORMAL =='1' ?formRule.INVESTMENT_FUNDS:[{required: false}]" prop="INVESTMENT_FUNDS" label="投入资金">
|
|
<el-input v-model="form.INVESTMENT_FUNDS" type="number">
|
|
<template slot="append">元</template>
|
|
</el-input>
|
|
</el-form-item>
|
|
<el-form-item :rules="form.IS_NORMAL =='1' ?formRule.RECTIFICATIONTIME:[{required: false}]" label="整改时间" prop="RECTIFICATIONTIME">
|
|
<el-date-picker v-model="form.RECTIFICATIONTIME" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期" />
|
|
</el-form-item>
|
|
<el-form-item :rules="[{required: true}]" label="整改后图片" label-width="100px">
|
|
<el-upload
|
|
ref="zhenggaiupload"
|
|
:class="{hide:hideUpload}"
|
|
:on-remove="handleRemove"
|
|
:on-change="handleChangeIMG"
|
|
:limit="4"
|
|
:on-preview="handlePictureCardPreview"
|
|
:before-upload="beforeFileUpload"
|
|
:auto-upload="false"
|
|
class="avatar-uploader"
|
|
action="#"
|
|
accept=".jpg,.jpeg,.png"
|
|
list-type="picture-card">
|
|
<i class="el-icon-plus" />
|
|
</el-upload>
|
|
<el-dialog :visible.sync="dialogImageVisible">
|
|
<img :src="dialogImageUrl" width="100%" alt="">
|
|
</el-dialog>
|
|
</el-form-item>
|
|
<div v-if="pd.ISCONFIRM=='0'">
|
|
<div class="form-flex">
|
|
<div class="form-item">
|
|
<el-form-item :rules="form.IS_NORMAL =='1' ?formRule.DEPARTMENT_ID:[{required: false}]" label="验收部门" prop="DEPARTMENT_ID">
|
|
<SelectTree
|
|
ref="deptTree1"
|
|
:clearable="false"
|
|
:options="defaultNodes"
|
|
:props="defaultProps"
|
|
v-model="form.DEPARTMENT_ID"
|
|
placeholder="请选择验收部门"
|
|
@change="form.USER_ID='';getUserList(form.DEPARTMENT_ID ,-2)"
|
|
/>
|
|
</el-form-item>
|
|
</div>
|
|
<div class="form-item">
|
|
<el-form-item :rules="form.IS_NORMAL =='1' ?formRule.USER_ID:[{required: false}]" label="验收人" prop="USER_ID">
|
|
<el-select :value="form.USER_ID" clearable placeholder="请选择" @visible-change="$forceUpdate()" @change="acceptedByChange">
|
|
<el-option v-for="item in ys_userList" :key="item.USER_ID" :label="item.NAME" :value="item.USER_ID" />
|
|
</el-select>
|
|
</el-form-item>
|
|
</div>
|
|
<div class="form-item">
|
|
<el-button type="primary" style="margin-left:15px" @click="addOther">添加</el-button>
|
|
</div>
|
|
</div>
|
|
<div v-for="(data,index) in other" :key="data.id" class="form-group input-group-sm">
|
|
<div class="form-flex">
|
|
<div class="form-item">
|
|
<el-form-item label="验收部门">
|
|
<SelectTree
|
|
ref="'deptTree'+index"
|
|
:clearable="false"
|
|
:options="defaultNodes"
|
|
:props="defaultProps"
|
|
v-model="data.DEPARTMENT_ID"
|
|
placeholder="请选择验收部门"
|
|
@change="updateOtherDep(data.DEPARTMENT_ID,index)"
|
|
/>
|
|
</el-form-item>
|
|
</div>
|
|
<div class="form-item">
|
|
<el-form-item label="验收人">
|
|
<el-select :value="data.USER_ID" placeholder="请选择" @change="otherAcceptedByChange($event,index)">
|
|
<el-option v-for="item in otherUserList[index]" :key="item.USER_ID" :label="item.NAME" :value="item.USER_ID" />
|
|
</el-select>
|
|
</el-form-item>
|
|
</div>
|
|
<div class="form-item">
|
|
<el-button type="danger" style="margin-left:15px" @click="removeOther(index)">删除</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<el-form-item label="整改方案">
|
|
<el-radio-group v-model="form.HAVESCHEME">
|
|
<el-radio label="1" value="1">有</el-radio>
|
|
<el-radio v-if="pd.ISCONFIRM=='1'" disabled label="0" value="0">无</el-radio>
|
|
<el-radio v-if="pd.ISCONFIRM=='0'" label="0" value="0">无</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
<div v-show="form.HAVESCHEME==1">
|
|
<el-form-item prop="SCREENINGDATE" label="排查日期">
|
|
<el-date-picker v-model="form.SCREENINGDATE" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" />
|
|
</el-form-item>
|
|
<el-form-item prop="LIST_NAME" label="隐患清单">
|
|
<el-input v-model="pd.LIST_NAME" :disabled="true" placeholder="这里输入隐患清单" />
|
|
</el-form-item>
|
|
<el-form-item :rules="form.HAVESCHEME =='1' ?formRule.GOVERNSTANDARDS:[{required: false}]" label="治理标准" prop="GOVERNSTANDARDS">
|
|
<el-input v-model="form.GOVERNSTANDARDS" placeholder="这里输入治理标准要求" />
|
|
</el-form-item>
|
|
<el-form-item v-show="form.HAVESCHEME==1" :rules="form.HAVESCHEME =='1' ?formRule.GOVERNMETHOD:[{required: false}]" label="治理方法" prop="GOVERNMETHOD">
|
|
<el-input v-model="form.GOVERNMETHOD" placeholder="这里输入治理方法" />
|
|
</el-form-item>
|
|
<el-form-item :rules="form.HAVESCHEME =='1' ?formRule.EXPENDITURE:[{required: false}]" label="经费落实" prop="EXPENDITURE">
|
|
<el-input v-model="form.EXPENDITURE" placeholder="这里输入经费和物资的落实" />
|
|
</el-form-item>
|
|
<el-form-item :rules="form.HAVESCHEME =='1' ?formRule.PRINCIPAL:[{required: false}]" label="负责人员" prop="PRINCIPAL">
|
|
<el-input v-model="form.PRINCIPAL" placeholder="这里输入负责治理人员" />
|
|
</el-form-item>
|
|
<el-form-item :rules="form.HAVESCHEME =='1' ?formRule.PROGRAMMING:[{required: false}]" label="工时安排" prop="PROGRAMMING">
|
|
<el-input v-model="form.PROGRAMMING" placeholder="这里输入工时安排" />
|
|
</el-form-item>
|
|
<el-form-item :rules="form.HAVESCHEME =='1' ?formRule.TIMELIMITFOR:[{required: false}]" label="时限要求" prop="TIMELIMITFOR">
|
|
<el-input v-model="form.TIMELIMITFOR" placeholder="这里输入时限要求" />
|
|
</el-form-item>
|
|
<el-form-item :rules="form.HAVESCHEME =='1' ?formRule.JOBREQUIREMENT:[{required: false}]" label="工作要求" prop="JOBREQUIREMENT">
|
|
<el-input v-model="form.JOBREQUIREMENT" placeholder="这里输入工作要求" />
|
|
</el-form-item>
|
|
<el-form-item :rules="form.HAVESCHEME =='1' ?formRule.OTHERBUSINESS:[{required: false}]" label="其他事项" prop="OTHERBUSINESS">
|
|
<el-input v-model="form.OTHERBUSINESS" placeholder="这里输入其他事项" />
|
|
</el-form-item>
|
|
<el-form-item label="方案图片">
|
|
<el-upload ref="fanganupload" :on-preview="handlePictureCardPreview" :on-change="onchangezhengai" :before-upload="beforeFileUploadzhengai" :auto-upload="false" class="avatar-uploader" action="#" accept=".jpg,.jpeg,.png" list-type="picture-card">
|
|
<i class="el-icon-plus" />
|
|
</el-upload>
|
|
<el-dialog :visible.sync="dialogImageVisible">
|
|
<img :src="dialogImageUrl" width="100%" alt="">
|
|
</el-dialog>
|
|
</el-form-item>
|
|
</div>
|
|
</div>
|
|
</el-form>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="ui-height" />
|
|
<div v-loading="loading" class="ui-foot">
|
|
<el-button v-show="form.IS_NORMAL=='2'" type="primary" @click="goSpecial">申 请</el-button>
|
|
<el-button v-show="form.IS_NORMAL=='1'" type="primary" @click="saveRectify">保 存</el-button>
|
|
<el-button plain type="info" @click="back">返 回</el-button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import { requestFN } from '@/utils/request'
|
|
import { upload } from '@/utils/upload'
|
|
import SelectTree from '@/components/SelectTree'
|
|
import hiddenInfo from '../../../hiddenApi/publicMethod/detailInfo'
|
|
export default {
|
|
components: { SelectTree, hiddenInfo },
|
|
data() {
|
|
return {
|
|
data: { HIDDEN_ID: '',
|
|
pd: {}, hiddenExamineList: [], hs: {}, checkList: {}
|
|
},
|
|
config: config,
|
|
loading: false,
|
|
HIDDEN_ID: '', // 主键ID
|
|
pd: {}, // 存放字段参数
|
|
loginUserid: '', // 当前登录人
|
|
form: {
|
|
IS_NORMAL: '1',
|
|
HAVESCHEME: '0',
|
|
disposalPlan: '', // 无法整改原因
|
|
RECTIFYDESCR: '', // 整改描述
|
|
INVESTMENT_FUNDS: '', // 投入资金
|
|
RECTIFICATIONTIME: ''// 整改时间
|
|
},
|
|
rectify_files: [],
|
|
hideUpload: false, // 整改照片
|
|
dialogImageVisible: false, // 放大照片的显示和隐藏
|
|
dialogImageUrl: '', // 照片的地址
|
|
scheme_files: [], // 整改方案图片
|
|
formRule: {
|
|
RECTIFICATIONDEPT: [{ required: true, message: '请选择整改部门', trigger: 'blur' }],
|
|
RECTIFICATIONOR: [{ required: true, message: '请选择整改人', trigger: 'blur' }],
|
|
RECTIFYDESCR: [{ required: true, message: '请输入整改描述', trigger: 'blur' }],
|
|
INVESTMENT_FUNDS: [{ required: true, message: '请输入投入资金', trigger: 'blur' }],
|
|
RECTIFICATIONTIME: [{ required: true, message: '请输入整改时间', trigger: 'blur' }],
|
|
DEPARTMENT_ID: [{ required: true, message: '请选择验收部门', trigger: 'blur' }],
|
|
USER_ID: [{ required: true, message: '请选择验收人', trigger: 'blur' }],
|
|
GOVERNSTANDARDS: [{ required: true, message: '请输入治理标准要求', trigger: 'blur' }],
|
|
GOVERNMETHOD: [{ required: true, message: '请输入治理方法', trigger: 'blur' }],
|
|
EXPENDITURE: [{ required: true, message: '请输入经费和物资的落实', trigger: 'blur' }],
|
|
PRINCIPAL: [{ required: true, message: '请输入负责治理人员', trigger: 'blur' }],
|
|
PROGRAMMING: [{ required: true, message: '请输入工时安排', trigger: 'blur' }],
|
|
TIMELIMITFOR: [{ required: true, message: '请输入时限要求', trigger: 'blur' }],
|
|
JOBREQUIREMENT: [{ required: true, message: '请输入工作要求', trigger: 'blur' }],
|
|
OTHERBUSINESS: [{ required: true, message: '请输入其他事项', trigger: 'blur' }],
|
|
disposalPlan: [{ required: true, message: '请输入无法整改原因', trigger: 'blur' }]
|
|
},
|
|
defaultProps: {
|
|
value: 'id',
|
|
children: 'nodes',
|
|
label: 'name',
|
|
checkStrictly: true
|
|
},
|
|
defaultNodes: [],
|
|
ys_userList: [],
|
|
other: [], // 其他验收人员
|
|
otherUserList: []
|
|
}
|
|
},
|
|
watch: {
|
|
// 'form.DEPARTMENT_ID': {
|
|
// handler: function() {
|
|
// this.form.USER_ID = ''
|
|
// this.getUserList(this.form.DEPARTMENT_ID, -2)
|
|
// }
|
|
// },
|
|
// 'form.RECTIFICATIONDEPT': {
|
|
// handler: function() {
|
|
// this.form.RECTIFICATIONOR = ''
|
|
// this.getUserList(this.form.RECTIFICATIONDEPT, -1)
|
|
// }
|
|
// }
|
|
},
|
|
created() {
|
|
if (this.$parent.HIDDEN_ID) {
|
|
this.HIDDEN_ID = this.$parent.HIDDEN_ID
|
|
this.getData()
|
|
}
|
|
this.getDept()
|
|
this.getEditMyInfo()
|
|
},
|
|
methods: {
|
|
getEditMyInfo: function() {
|
|
requestFN(
|
|
'/user/goEditMyInfo',
|
|
{}
|
|
).then((data) => {
|
|
this.loginUserid = data.pd.USER_ID// copy obj
|
|
}).catch((e) => {
|
|
|
|
})
|
|
},
|
|
getData() {
|
|
requestFN(
|
|
'/hiddenApi/getHiddenById',
|
|
{
|
|
HIDDEN_ID: this.HIDDEN_ID,
|
|
tm: new Date().getTime()
|
|
}
|
|
).then((data) => {
|
|
if (data.result == 'success') {
|
|
this.data = data
|
|
this.pd = data.hidden
|
|
if (this.pd.HIDDENLEVEL == 'hiddenLevel0002') {
|
|
this.getqyData()
|
|
}
|
|
this.pd.ISCONFIRM = '0'
|
|
if (this.pd.ISCONFIRM == '1') {
|
|
this.form.HAVESCHEME = '1'
|
|
}
|
|
}
|
|
}).catch((e) => {
|
|
this.listLoading = false
|
|
})
|
|
},
|
|
getqyData() {
|
|
requestFN(
|
|
'/app/corpinfo/goqyzzh',
|
|
{
|
|
CORPINFO_ID: JSON.parse(sessionStorage.getItem('user')).CORPINFO_ID,
|
|
tm: new Date().getTime()
|
|
}
|
|
).then((data) => {
|
|
if (data.result == 'success') {
|
|
this.userpd = data.userpd // 参数map
|
|
this.deppd = data.deppd // 参数map
|
|
console.log(this.pd.HIDDENLEVEL)
|
|
if (this.pd.HIDDENLEVEL == 'hiddenLevel0002') {
|
|
this.form.DEPARTMENT_ID = data.deppd.DEPARTMENT_ID
|
|
this.form.USER_ID = data.userpd.USER_ID
|
|
console.info(this.form.DEPARTMENT_ID)
|
|
console.info(this.form.USER_ID)
|
|
}
|
|
}
|
|
}).catch((e) => {
|
|
this.listLoading = false
|
|
})
|
|
},
|
|
|
|
getDept() {
|
|
requestFN(
|
|
'/department/listTree',
|
|
{}
|
|
).then((data) => {
|
|
this.defaultNodes = JSON.parse(data.zTreeNodes)
|
|
}).catch((e) => {
|
|
})
|
|
},
|
|
// 修改其他检查人部门
|
|
updateOtherDep(DEPARTMENT_ID, i) {
|
|
this.other[i].USER_ID = ''
|
|
this.getUserList(DEPARTMENT_ID, i)
|
|
},
|
|
handleRemove(file, fileList) {
|
|
this.hideUpload = fileList.length >= 4
|
|
},
|
|
handleChangeIMG(file, fileList) {
|
|
const types = ['image/jpeg', 'image/jpg', 'image/png']
|
|
const isImage = types.includes(file.raw.type)
|
|
if (!isImage) {
|
|
this.$message.error('上传图片只能是 JPG、JPEG、PNG 格式!')
|
|
fileList.pop()
|
|
}
|
|
this.hideUpload = fileList.length >= 4
|
|
},
|
|
// 点击放大图片
|
|
handlePictureCardPreview(file) {
|
|
this.dialogImageUrl = file.url
|
|
this.dialogImageVisible = true
|
|
},
|
|
beforeFileUpload(file) {
|
|
const types = ['image/jpeg', 'image/jpg', 'image/png']
|
|
const isImage = types.includes(file.type)
|
|
if (!isImage) {
|
|
this.$message.error('上传图片只能是 JPG、JPEG、PNG 格式!')
|
|
return false
|
|
} else {
|
|
this.rectify_files.push(file)
|
|
}
|
|
},
|
|
addOther() {
|
|
var o = { 'DEPARTMENT_ID': '', 'USER_ID': '' }
|
|
this.other.push(o)
|
|
var index = this.other.length - 1
|
|
this.otherUserList[index] = this.userList
|
|
},
|
|
// 动态--验收部门 删除
|
|
removeOther: function(index) {
|
|
this.other.splice(index, 1)
|
|
},
|
|
otherAcceptedByChange(event, index) {
|
|
let flag = false
|
|
if (this.form.USER_ID === event) {
|
|
flag = true
|
|
} else {
|
|
for (let i = 0; i < this.other.length; i++) {
|
|
if (this.other[i].USER_ID === event) {
|
|
flag = true
|
|
break
|
|
}
|
|
}
|
|
}
|
|
if (flag) {
|
|
this.$message.warning('不能选择重复的验收人')
|
|
} else {
|
|
this.other[index].USER_ID = event
|
|
}
|
|
},
|
|
acceptedByChange(event) {
|
|
let flag = false
|
|
for (let i = 0; i < this.other.length; i++) {
|
|
if (this.other[i].USER_ID === event) {
|
|
flag = true
|
|
break
|
|
}
|
|
}
|
|
if (flag) {
|
|
this.$message.warning('不能选择重复的验收人')
|
|
} else {
|
|
this.form.USER_ID = event
|
|
}
|
|
},
|
|
getUserList(DEPARTMENT_ID, index) { // 根据部门获取部门内的人员
|
|
this.listLoading = true
|
|
requestFN(
|
|
'/user/listAll',
|
|
{
|
|
DEPARTMENT_ID: DEPARTMENT_ID,
|
|
tm: new Date().getTime()
|
|
}
|
|
).then((data) => {
|
|
if (index > -1) {
|
|
this.$set(this.otherUserList, index, data.userList)
|
|
} else if (index == -1) {
|
|
this.zg_userList = data.userList
|
|
} else if (index == -2) {
|
|
this.ys_userList = data.userList
|
|
}
|
|
}).catch((e) => {
|
|
this.listLoading = false
|
|
})
|
|
},
|
|
saveRectify() { // 正常整改
|
|
this.loading = true
|
|
if (this.$refs.zhenggaiupload.uploadFiles.length < 1) {
|
|
this.$message({
|
|
message: '请上传整改后照片',
|
|
type: 'error'
|
|
})
|
|
this.loading = false
|
|
return false
|
|
}
|
|
var formdata = new FormData()
|
|
formdata.append('HIDDEN_ID', this.HIDDEN_ID)
|
|
|
|
formdata.append('IS_NORMAL', this.form.IS_NORMAL) // 是否正常整改
|
|
if (this.form.HAVESCHEME == 1) {
|
|
if (this.$refs.fanganupload.uploadFiles.length < 1) {
|
|
this.$message({
|
|
message: '请上传方案照片',
|
|
type: 'error'
|
|
})
|
|
this.loading = false
|
|
return false
|
|
}
|
|
formdata.append('SCREENINGDATE', this.form.SCREENINGDATE)
|
|
formdata.append('LISTNAME', this.pd.LIST_NAME ? this.pd.LIST_NAME : '')
|
|
formdata.append('GOVERNSTANDARDS', this.form.GOVERNSTANDARDS)
|
|
formdata.append('GOVERNMETHOD', this.form.GOVERNMETHOD)
|
|
formdata.append('EXPENDITURE', this.form.EXPENDITURE)
|
|
formdata.append('PRINCIPAL', this.form.PRINCIPAL)
|
|
formdata.append('PROGRAMMING', this.form.PROGRAMMING)
|
|
formdata.append('TIMELIMITFOR', this.form.TIMELIMITFOR)
|
|
formdata.append('JOBREQUIREMENT', this.form.JOBREQUIREMENT)
|
|
formdata.append('OTHERBUSINESS', this.form.OTHERBUSINESS)
|
|
// this.form.DEPARTMENT_ID = this.deppd.DEPARTMENT_ID
|
|
// this.form.USER_ID = this.userpd.USER_ID
|
|
}
|
|
|
|
formdata.append('RECTIFYDESCR', this.form.RECTIFYDESCR) // 整改描述
|
|
formdata.append('RECTIFICATIONTIME', this.form.RECTIFICATIONTIME) // 整改时间
|
|
formdata.append('HAVESCHEME', this.form.HAVESCHEME) // 整改方案
|
|
|
|
formdata.append('INVESTMENT_FUNDS', this.form.INVESTMENT_FUNDS) // 投入资金
|
|
formdata.append('CHECKDEPT', this.form.DEPARTMENT_ID) // 验收人
|
|
formdata.append('CHECKOR', this.form.USER_ID) // 验收部门
|
|
formdata.append('OTHER', JSON.stringify(this.other)) // 其他验收人
|
|
if (this.form.USER_ID == this.loginUserid) {
|
|
this.$message({
|
|
message: '验收人和整改人不能是同一个人!',
|
|
type: 'error'
|
|
})
|
|
this.loading = false
|
|
return false
|
|
}
|
|
for (var i = 0; i < this.other.length; i++) {
|
|
if (this.other[i].USER_ID == this.loginUserid) {
|
|
this.$message({
|
|
message: '验收人和整改人不能是同一个人!',
|
|
type: 'error'
|
|
})
|
|
this.loading = false
|
|
return false
|
|
}
|
|
}
|
|
if (!this.form.USER_ID) {
|
|
this.$message({
|
|
message: '请选择验收人',
|
|
type: 'error'
|
|
})
|
|
this.loading = false
|
|
return false
|
|
}
|
|
if (!this.form.RECTIFICATIONTIME) {
|
|
this.$message({
|
|
message: '请选择整改时间',
|
|
type: 'error'
|
|
})
|
|
this.loading = false
|
|
return false
|
|
}
|
|
if (!this.form.RECTIFYDESCR) {
|
|
this.$message({
|
|
message: '请填写整改描述',
|
|
type: 'error'
|
|
})
|
|
this.loading = false
|
|
return false
|
|
}
|
|
if (!this.form.INVESTMENT_FUNDS) {
|
|
this.$message({
|
|
message: '请填写投入资金',
|
|
type: 'error'
|
|
})
|
|
this.loading = false
|
|
return false
|
|
}
|
|
const loading = this.$loading({
|
|
lock: true,
|
|
text: '加载中......',
|
|
background: 'rgba(0,0,0,0.5)'
|
|
})
|
|
upload(
|
|
'/hiddenApi/rectify',
|
|
formdata
|
|
).then((data) => {
|
|
loading.close()
|
|
if (data.result == 'success') {
|
|
this.saveRectifyImg()
|
|
// this.back()
|
|
} else {
|
|
this.$message({
|
|
message: data.exception,
|
|
type: 'error'
|
|
})
|
|
this.loading = false
|
|
}
|
|
}).catch((e) => {
|
|
this.listLoading = false
|
|
this.loading = false
|
|
})
|
|
},
|
|
saveRectifyImg() {
|
|
var _this = this
|
|
// eslint-disable-next-line no-unused-vars
|
|
const $this = this
|
|
const loading = this.$loading({
|
|
lock: true,
|
|
text: '加载中......',
|
|
background: 'rgba(0,0,0,0.5)'
|
|
})
|
|
this.$refs.zhenggaiupload.submit()
|
|
var todata = new FormData()
|
|
for (var i = 0; i < _this.rectify_files.length; i++) {
|
|
if (_this.rectify_files[i]) {
|
|
todata.append('FFILE', _this.rectify_files[i])
|
|
}
|
|
}
|
|
if (!todata.get('FFILE')) {
|
|
return
|
|
}
|
|
todata.append('FOREIGN_KEY', this.HIDDEN_ID)
|
|
todata.append('TYPE', 4)
|
|
upload(
|
|
'/imgfiles/add',
|
|
todata
|
|
).then((data) => {
|
|
loading.close()
|
|
if (data.result == 'success') {
|
|
if (this.form.HAVESCHEME == 1) {
|
|
this.saveSchemeImg()
|
|
} else {
|
|
this.$message({
|
|
message: '保存成功',
|
|
type: 'success'
|
|
})
|
|
this.loading = false
|
|
this.back()
|
|
}
|
|
} else {
|
|
this.$message({
|
|
message: '隐患照片上传失败',
|
|
type: 'error'
|
|
})
|
|
this.loading = false
|
|
}
|
|
}).catch((e) => {
|
|
this.listLoading = false
|
|
this.loading = false
|
|
})
|
|
},
|
|
saveSchemeImg() {
|
|
// this.$refs.fanganupload.submit()
|
|
var _this = this
|
|
// eslint-disable-next-line no-unused-vars
|
|
const $this = this
|
|
const loading = this.$loading({
|
|
lock: true,
|
|
text: '加载中......',
|
|
background: 'rgba(0,0,0,0.5)'
|
|
})
|
|
var todata = new FormData()
|
|
for (var i = 0; i < _this.scheme_files.length; i++) {
|
|
if (_this.scheme_files[i]) {
|
|
todata.append('FFILE', _this.scheme_files[i])
|
|
}
|
|
}
|
|
if (!todata.get('FFILE')) {
|
|
this.loading = false
|
|
return
|
|
}
|
|
todata.append('FOREIGN_KEY', this.HIDDEN_ID)
|
|
todata.append('TYPE', 8)
|
|
upload(
|
|
'/imgfiles/add',
|
|
todata
|
|
).then((data) => {
|
|
loading.close()
|
|
if (data.result == 'success') {
|
|
this.$message({
|
|
message: '保存成功',
|
|
type: 'success'
|
|
})
|
|
this.loading = false
|
|
this.back()
|
|
} else {
|
|
this.$message({
|
|
message: '整改方案图片上传失败',
|
|
type: 'error'
|
|
})
|
|
this.loading = false
|
|
}
|
|
}).catch((e) => {
|
|
this.listLoading = false
|
|
this.loading = false
|
|
})
|
|
},
|
|
goSpecial() {
|
|
this.loading = true
|
|
if (!this.form.disposalPlan) {
|
|
this.$message({
|
|
message: '请输入无法整改原因',
|
|
type: 'error'
|
|
})
|
|
this.loading = false
|
|
return false
|
|
}
|
|
requestFN(
|
|
'/hiddenApi/unableRectify',
|
|
{
|
|
HIDDEN_ID: this.HIDDEN_ID,
|
|
disposalPlan: this.form.disposalPlan,
|
|
tm: new Date().getTime()
|
|
}
|
|
).then((data) => {
|
|
if (data.result == 'success') {
|
|
this.$message({
|
|
message: '保存成功',
|
|
type: 'success'
|
|
})
|
|
this.loading = false
|
|
this.back()
|
|
} else {
|
|
this.$message({
|
|
message: data.exception,
|
|
type: 'error'
|
|
})
|
|
this.loading = false
|
|
}
|
|
}).catch((e) => {
|
|
this.listLoading = false
|
|
this.loading = false
|
|
})
|
|
},
|
|
onchangezhengai(file, fileList) { // 整改方案的添加
|
|
const types = ['image/jpeg', 'image/jpg', 'image/png']
|
|
const isImage = types.includes(file.raw.type)
|
|
if (!isImage) {
|
|
this.$message.error('上传图片只能是 JPG、JPEG、PNG 格式!')
|
|
fileList.pop()
|
|
} else {
|
|
this.scheme_files.push(file.raw)
|
|
}
|
|
},
|
|
beforeFileUploadzhengai(file) {
|
|
const types = ['image/jpeg', 'image/jpg', 'image/png']
|
|
const isImage = types.includes(file.type)
|
|
if (!isImage) {
|
|
this.$message.error('上传图片只能是 JPG、JPEG、PNG 格式!')
|
|
return false
|
|
} else {
|
|
this.scheme_files.push(file)
|
|
}
|
|
},
|
|
back() {
|
|
this.$parent.activeName = 'List'
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="sass" scoped>
|
|
.form-flex
|
|
display: flex
|
|
align-items: center
|
|
margin-bottom: 18px
|
|
.form-item
|
|
width: 300px
|
|
.el-form-item--small.el-form-item
|
|
margin-bottom: 0
|
|
.table-ui
|
|
.tbg
|
|
width: 150px
|
|
.img-flex
|
|
display: flex
|
|
.img-ui
|
|
width: 240px
|
|
height: 240px
|
|
margin-right: 20px
|
|
& img
|
|
width: 100%
|
|
height: 100%
|
|
</style>
|
|
<style>
|
|
.hide .el-upload--picture-card {
|
|
display: none;
|
|
}
|
|
</style>
|