|
@@ -1,32 +1,25 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="body">
|
|
<div class="body">
|
|
|
- <uni-forms ref="form" label-position="top" :rules="rules" :model="form">
|
|
|
|
|
- <uni-forms-item label="是否通过" required>
|
|
|
|
|
- <text class="status-item"
|
|
|
|
|
- :class="form.status==1?'active':''"
|
|
|
|
|
- @click="form.status=1"
|
|
|
|
|
- >通过</text>
|
|
|
|
|
- <text class="status-item"
|
|
|
|
|
- :class="form.status==2?'active':''"
|
|
|
|
|
- @click="form.status=2"
|
|
|
|
|
- >不通过</text>
|
|
|
|
|
|
|
+ <uni-forms ref="form" label-position="top" :model="formData">
|
|
|
|
|
+ <uni-forms-item label="处理动作" name="actionId" required>
|
|
|
|
|
+ <uni-data-checkbox v-model="flowData.actionId" :localdata="actionList" @change="changeCheck"/>
|
|
|
</uni-forms-item>
|
|
</uni-forms-item>
|
|
|
- <uni-forms-item label="整改人" name="user" required>
|
|
|
|
|
|
|
+ <uni-forms-item label="处理说明" name="reviewRemark" required>
|
|
|
|
|
+ <uni-easyinput type="textarea" autoHeight v-model="formData.reviewRemark" placeholder="请输入描述"></uni-easyinput>
|
|
|
|
|
+ </uni-forms-item>
|
|
|
|
|
+ <uni-forms-item label="整改人" name="rectifyAccountId" required>
|
|
|
<uni-data-select
|
|
<uni-data-select
|
|
|
- v-model="form.user"
|
|
|
|
|
- :localdata="users"
|
|
|
|
|
|
|
+ v-model="formData.rectifyAccountId"
|
|
|
|
|
+ :localdata="userList"
|
|
|
></uni-data-select>
|
|
></uni-data-select>
|
|
|
</uni-forms-item>
|
|
</uni-forms-item>
|
|
|
- <uni-forms-item label="描述" name="desc" required>
|
|
|
|
|
- <uni-easyinput type="textarea" autoHeight v-model="form.desc" placeholder="请输入描述"></uni-easyinput>
|
|
|
|
|
- </uni-forms-item>
|
|
|
|
|
<uni-forms-item label="附件">
|
|
<uni-forms-item label="附件">
|
|
|
<div class="upload-container">
|
|
<div class="upload-container">
|
|
|
<image @click="upload" class="upload" src="/static/icon/upload.png" mode="widthFix"></image>
|
|
<image @click="upload" class="upload" src="/static/icon/upload.png" mode="widthFix"></image>
|
|
|
<p class="tip">注:单个附件上传不超过10M,附件累计不超过20M</p>
|
|
<p class="tip">注:单个附件上传不超过10M,附件累计不超过20M</p>
|
|
|
</div>
|
|
</div>
|
|
|
- <view class="preview" v-if="form.attachList.length>0">
|
|
|
|
|
- <image :src="attach.path" mode="widthFix" v-for="(attach,index) in form.attachList" :key="index"></image>
|
|
|
|
|
|
|
+ <view class="preview" v-if="formData.attachList.length>0">
|
|
|
|
|
+ <image class="preview-item" :src="attach.fileUrl" mode="widthFix" v-for="(attach,index) in formData.attachList" :key="index"></image>
|
|
|
</view>
|
|
</view>
|
|
|
</uni-forms-item>
|
|
</uni-forms-item>
|
|
|
</uni-forms>
|
|
</uni-forms>
|
|
@@ -35,75 +28,185 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
- import {uploadFile,uploadFiles,uploadApi} from '@/api/upload.js'
|
|
|
|
|
|
|
+ import {getUserByPage} from '@/api/user.js'
|
|
|
|
|
+ import {upload} from '@/api/index.js'
|
|
|
|
|
+ import { startWorkflow, getWorkflowById, handleWorkflow } from '@/api/system/wfApi'
|
|
|
|
|
+ import { updateDanger, getDangerById } from '@/api/dangerApi'
|
|
|
|
|
+ import {parseTime} from '@/libs'
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- status: [
|
|
|
|
|
- { value: 0, text: "否" },
|
|
|
|
|
- { value: 1, text: "是" }
|
|
|
|
|
- ],
|
|
|
|
|
- users:[
|
|
|
|
|
- { value: 0, text: "张三" },
|
|
|
|
|
- { value: 1, text: "李四" }
|
|
|
|
|
- ],
|
|
|
|
|
- rules:{
|
|
|
|
|
- user:{
|
|
|
|
|
- rules:[
|
|
|
|
|
- {
|
|
|
|
|
- required: true,
|
|
|
|
|
- errorMessage: '请选择整改人',
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- },
|
|
|
|
|
- desc:{
|
|
|
|
|
- rules:[
|
|
|
|
|
- {
|
|
|
|
|
- required: true,
|
|
|
|
|
- errorMessage: '请填写描述',
|
|
|
|
|
- },
|
|
|
|
|
- ]
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ formData:{
|
|
|
|
|
+ 'hdangerId': undefined,
|
|
|
|
|
+ 'formCode': 'submit',
|
|
|
|
|
+ 'hdangerTitle': '', // 隐患标题
|
|
|
|
|
+ 'dangerCatId': undefined, // 隐患类别ID
|
|
|
|
|
+ 'hdangerLevel': 1, // 隐患等级
|
|
|
|
|
+ 'reviewRemark': '', // 描述
|
|
|
|
|
+ 'submitTime': parseTime(new Date()),
|
|
|
|
|
+ 'dangerDeadline': '', // 截止时间
|
|
|
|
|
+ 'goafId': undefined,
|
|
|
|
|
+ 'checklistId': '',
|
|
|
|
|
+ "attachList":[]
|
|
|
},
|
|
},
|
|
|
- form:{
|
|
|
|
|
- status:1,
|
|
|
|
|
- password:"",
|
|
|
|
|
- desc:"",
|
|
|
|
|
- attachList:[]
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ flowData:{
|
|
|
|
|
+ },
|
|
|
|
|
+ actionList:[],
|
|
|
|
|
+ userList:[]
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ created() {
|
|
|
|
|
+ this.init()
|
|
|
|
|
+ },
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ // 启动流程
|
|
|
|
|
+ async start(wfDefId) {
|
|
|
|
|
+ const { code, data, msg } = await startWorkflow(wfDefId)
|
|
|
|
|
+ if (code === 0) {
|
|
|
|
|
+ this.flowData = data
|
|
|
|
|
+ this.flowData.wfDefId = data.wfDefId
|
|
|
|
|
+ this.flowData.wfInsId = data.wfInsId
|
|
|
|
|
+ this.flowData.activityDefId = data.curActivityIns.activityDefId
|
|
|
|
|
+ this.flowData.activityInsId = data.curActivityIns.activityInsId
|
|
|
|
|
+ this.flowData.activityCode = data.curActivityIns.activityCode
|
|
|
|
|
+ this.formData.hdangerId=data.wfInsId
|
|
|
|
|
+ return data.wfInsId
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ // 获取流程
|
|
|
|
|
+ get(wfInsId) {
|
|
|
|
|
+ // this.resetFormData()
|
|
|
|
|
+ getWorkflowById(wfInsId).then((resp) => {
|
|
|
|
|
+ const { code, data, msg } = resp
|
|
|
|
|
+ if (code === 0) {
|
|
|
|
|
+ this.flowData = data
|
|
|
|
|
+ this.flowData.wfDefId = data.wfDefId
|
|
|
|
|
+ this.flowData.wfInsId = data.wfInsId
|
|
|
|
|
+ this.flowData.activityDefId = data.curActivityIns.activityDefId
|
|
|
|
|
+ this.flowData.activityInsId = data.curActivityIns.activityInsId
|
|
|
|
|
+ this.flowData.activityCode = data.curActivityIns.activityCode
|
|
|
|
|
+ let actionList=this.flowData.curActivityIns.actionList.map(function(item){
|
|
|
|
|
+ item.value=item.actionId
|
|
|
|
|
+ item.text=item.actionTitle
|
|
|
|
|
+ return item
|
|
|
|
|
+ })
|
|
|
|
|
+ this.actionList=JSON.parse(JSON.stringify(actionList))
|
|
|
|
|
+ this.flowData.actionId=actionList[0].actionId
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ init(){
|
|
|
|
|
+ let data=uni.getStorageSync('submit-data')
|
|
|
|
|
+ //初始化流程
|
|
|
|
|
+ let danger_info=uni.getStorageSync('danger-info')
|
|
|
|
|
+ this.formData={...this.formData,...danger_info}
|
|
|
|
|
+ this.get(danger_info.hdangerId)
|
|
|
|
|
+ this.getUser()
|
|
|
|
|
+ if(data){
|
|
|
|
|
+ this.formData.checklistId = data.checklistId
|
|
|
|
|
+ this.formData.goafId = data.goafId
|
|
|
|
|
+ this.formData.reviewRemark = data.checkItemNopass
|
|
|
|
|
+ this.formData.hdangerTitle = data.checkItemNopass
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ async onSubmit(){
|
|
|
|
|
+ let user=this.userList.filter(item=>item.accountId===this.formData.rectifyAccountId)[0]
|
|
|
|
|
+ if(user){
|
|
|
|
|
+ this.formData.rectifyAccountName = user.accountName
|
|
|
|
|
+ this.formData.rectifyGroupId = user.groupId
|
|
|
|
|
+ this.formData.rectifyGroupName = user.groupName
|
|
|
|
|
+ this.formData.rectifyPositionId = user.positionId
|
|
|
|
|
+ this.formData.rectifyPositionName = user.positionName
|
|
|
|
|
+ this.formData.ocId=user.ocId
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!this.verify()){
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ handleWorkflow({
|
|
|
|
|
+ "wfDefId": this.flowData.wfDefId,
|
|
|
|
|
+ "wfInsId": this.flowData.wfInsId,
|
|
|
|
|
+ "activityDefId": this.flowData.activityDefId,
|
|
|
|
|
+ "activityInsId": this.flowData.activityInsId,
|
|
|
|
|
+ "activityCode": this.flowData.activityCode,
|
|
|
|
|
+ "actionId": this.flowData.actionId,
|
|
|
|
|
+ "actionCode": this.flowData.actionCode,
|
|
|
|
|
+ "actionRemark": this.formData.reviewRemark,
|
|
|
|
|
+ "attachList":this.formData.attachList,
|
|
|
|
|
+ "groupIdTo": user.groupId,
|
|
|
|
|
+ "positionIdTo": user.positionId,
|
|
|
|
|
+ "accountIdTo": user.groupId,
|
|
|
|
|
+ "groupNameTo": user.groupName,
|
|
|
|
|
+ "positionNameTo": user.positionName,
|
|
|
|
|
+ "accountNameTo": user.accountName,
|
|
|
|
|
+ })
|
|
|
|
|
+ //renshengkuduan !
|
|
|
|
|
+ this.formData.status=2
|
|
|
|
|
+ this.formData.submitTime=parseTime(this.formData.submitTime)
|
|
|
|
|
+ this.formData.dangerDeadline=parseTime(this.formData.dangerDeadline)
|
|
|
|
|
+ updateDanger(this.formData).then((resp) => {
|
|
|
|
|
+ uni.switchTab({
|
|
|
|
|
+ url:'/pages/risk/risk'
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ getUser(){
|
|
|
|
|
+ getUserByPage({
|
|
|
|
|
+ page: 1,
|
|
|
|
|
+ limit: 999999
|
|
|
|
|
+ }).then((res)=>{
|
|
|
|
|
+ this.userList=res.data.map(item=>{
|
|
|
|
|
+ return{
|
|
|
|
|
+ ...item,
|
|
|
|
|
+ value:item.accountId,
|
|
|
|
|
+ text:item.accountName
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
upload(){
|
|
upload(){
|
|
|
|
|
+ let self=this;
|
|
|
uni.chooseImage({
|
|
uni.chooseImage({
|
|
|
- success: (files) => {
|
|
|
|
|
- const tempFilePaths = files.tempFilePaths;
|
|
|
|
|
- const tempFiles = files.tempFiles
|
|
|
|
|
- const formData = new FormData()
|
|
|
|
|
- formData.append('file', tempFilePaths)
|
|
|
|
|
- // uploadApi({
|
|
|
|
|
- // formData
|
|
|
|
|
- // })
|
|
|
|
|
|
|
+ success:(files)=>{
|
|
|
|
|
+ let filePath = files.tempFilePaths[0]
|
|
|
|
|
+ upload({
|
|
|
|
|
+ filePath
|
|
|
|
|
+ }).then((res)=>{
|
|
|
|
|
+ let result=JSON.parse(res);
|
|
|
|
|
+ let attachList=[result.data]
|
|
|
|
|
+ self.$set(self.formData,'attachList',attachList)
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- onSubmit(){
|
|
|
|
|
- this.$refs.form.validate().then(res=>{
|
|
|
|
|
- console.log('表单数据信息:', res);
|
|
|
|
|
- }).catch(err =>{
|
|
|
|
|
- console.log('表单错误信息:', err);
|
|
|
|
|
})
|
|
})
|
|
|
|
|
+ },
|
|
|
|
|
+ verify(){
|
|
|
|
|
+ let items={
|
|
|
|
|
+ 'reviewRemark': '处理说明', //
|
|
|
|
|
+ }
|
|
|
|
|
+ for(let key in items){
|
|
|
|
|
+ if(this.formData[key]===""||this.formData[key]===undefined||this.formData[key]==="undefined"){
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ icon:'none',
|
|
|
|
|
+ title:`请填写${items[key]}`
|
|
|
|
|
+ })
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return true
|
|
|
|
|
+ },
|
|
|
|
|
+ changeCheck(){
|
|
|
|
|
+ let actionCode=this.actionList.filter(item=>item.actionId===this.flowData.actionId)[0].actionCode
|
|
|
|
|
+ this.flowData.actionCode=actionCode
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
-
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
.body{
|
|
.body{
|
|
|
- height: 100vh;
|
|
|
|
|
|
|
+ min-height: 100vh;
|
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
|
padding:21rpx 16rpx;
|
|
padding:21rpx 16rpx;
|
|
|
background-color: #F3F5FB;
|
|
background-color: #F3F5FB;
|
|
|
|
|
+ padding-bottom: 160rpx;
|
|
|
.status-item{
|
|
.status-item{
|
|
|
padding: 22rpx 32rpx;
|
|
padding: 22rpx 32rpx;
|
|
|
background-color: #fff;
|
|
background-color: #fff;
|
|
@@ -149,5 +252,12 @@
|
|
|
padding-top: 20upx;
|
|
padding-top: 20upx;
|
|
|
letter-spacing: 2px;
|
|
letter-spacing: 2px;
|
|
|
}
|
|
}
|
|
|
|
|
+ .preview{
|
|
|
|
|
+ padding-top: 50rpx;
|
|
|
|
|
+ .preview-item{
|
|
|
|
|
+ width: 200rpx;
|
|
|
|
|
+ height: 200rpx;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|