qa-prevention-gwj-vue/src/views/xgf/flow/components/sendUtil.vue

345 lines
10 KiB
Vue
Raw Normal View History

2023-12-18 20:24:01 +08:00
<template>
<div>
<el-dialog
v-loading="loading"
:visible.sync="visible"
:append-to-body="appendToBody"
:before-close="beforeClose"
title="审批"
width="1200px"
destroy-on-close>
2024-01-22 14:39:38 +08:00
<el-form ref="form" :model="form" :rules="rules" label-width="200px" label-position="right" type="flex">
2024-01-17 18:43:02 +08:00
<el-row :gutter="12">
<el-col :span="12">
2024-01-22 14:39:38 +08:00
<el-form-item prop="STATUS" label="是否通过: ">
<el-select v-model="form.STATUS" filterable style="width: 300px" placeholder="请选择" @change="clearInfo">
2024-01-17 18:43:02 +08:00
<el-option label="是" value="1"/>
<el-option label="否" value="0"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
v-if="form.STATUS === '1' && isShow"
:label="menu.department + ':'"
prop="APPOINT_DEPARTMENT_ID">
2024-01-17 18:43:02 +08:00
<Treeselect
:options="departmentTree"
:normalizer="normalizer"
2024-01-18 13:56:14 +08:00
v-model="form.APPOINT_DEPARTMENT_ID"
2024-01-17 18:43:02 +08:00
placeholder="请选择部门"
no-options-text="暂无数据"
no-children-text="暂无数据"
2024-01-27 16:09:29 +08:00
style="width: 300px"
2024-01-18 13:56:14 +08:00
@select="getPeopleList($event)"
2024-01-17 18:43:02 +08:00
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
2024-01-22 14:39:38 +08:00
<el-col v-if="form.STATUS === '0'" :span="12">
<el-form-item v-if="form.STATUS === '0'" prop="OPINION" label="打回原因:">
<el-input v-model="form.OPINION" :rows="2" type="textarea" placeholder="填写审批意见"/>
</el-form-item>
</el-col>
2024-01-22 15:23:02 +08:00
<el-col v-if="form.STATUS === '1' && isShow" :span="12">
<el-form-item v-if="form.STATUS === '1'" :label="menu.user +':'" prop="APPOINT_USER_ID">
2024-01-18 13:56:14 +08:00
<el-select v-model="form.user" style="width: 300px" placeholder="请选择" @change="chooseUser">
<el-option
v-for="item in peopleList"
:key="item.USER_ID"
:value="JSON.stringify(item)"
:label="item.NAME"/>
2024-01-17 18:43:02 +08:00
</el-select>
</el-form-item>
</el-col>
<el-col v-if="form.STATUS === '1' && menu.uploadFile" :span="12">
<el-form-item :label="menu.uploadFile + ':'" prop="APPOINT_ANNEX">
<upload-file
:file-list.sync="form.APPOINT_ANNEX"
:multiple="false"
:accept="'.pdf,.jpg,.png,doc,docx'"
:limit="20"
:size="1024"
:upload-type="1"/>
</el-form-item>
</el-col>
<el-col v-if="menu.limitFlag === '1' && form.STATUS === '1'" :span="12">
2024-03-30 15:49:10 +08:00
<el-form-item prop="LIMIT_END_TIME" label="培训有效期结束时间:">
<el-date-picker v-model="form.LIMIT_END_TIME" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" style="width:300px "/>
</el-form-item>
</el-col>
2024-01-17 18:43:02 +08:00
</el-row>
2023-12-18 20:24:01 +08:00
</el-form>
2024-01-17 18:43:02 +08:00
2023-12-18 20:24:01 +08:00
<div slot="footer" class="dialog-footer">
2024-01-17 18:43:02 +08:00
<el-button @click="handleClose"> </el-button>
2024-01-22 14:39:38 +08:00
<el-button type="primary" @click="sendMessage('1')"> </el-button>
2023-12-18 20:24:01 +08:00
</div>
</el-dialog>
</div>
</template>
<script>
import vueQr from 'vue-qr'
import Treeselect from '@riophae/vue-treeselect'
import { requestFN } from '@/utils/request'
import uploadFile from '../../../util/uploadFile/index.vue'
import { upload } from '@/utils/upload'
2023-12-18 20:24:01 +08:00
export default {
components: { uploadFile, Treeselect, vueQr },
2023-12-18 20:24:01 +08:00
props: {
appendToBody: {
type: Boolean,
default: false
}
},
data() {
return {
visible: false,
loading: false,
2024-01-17 18:43:02 +08:00
form: {
2024-01-18 13:56:14 +08:00
STATUS: null,
2024-01-19 20:44:32 +08:00
APPOINT_CORP_ID: '',
APPOINT_CORP_NAME: '',
2024-01-18 13:56:14 +08:00
APPOINT_DEPARTMENT_ID: null,
APPOINT_DEPARTMENT_NAME: '',
APPOINT_USER_ID: null,
APPOINT_USER_NAME: '',
2024-01-22 14:39:38 +08:00
OPINION: '',
APPOINT_ANNEX: [],
2024-01-18 13:56:14 +08:00
user: '',
tm: new Date().getTime(),
2024-01-22 15:23:02 +08:00
list: [],
isShow: true,
info: {}
2024-01-17 18:43:02 +08:00
},
2024-01-22 14:39:38 +08:00
rules: {
STATUS: [
{ required: true, message: '请选择是否通过', trigger: 'change' }
],
APPOINT_DEPARTMENT_ID: [
{ required: true, message: '请选择指定监管部门', trigger: 'change' }
],
APPOINT_USER_ID: [
{ required: true, message: '请选择指定监管部门审批人', trigger: 'change' }
],
OPINION: [
{ required: true, message: '请填写打回原因', trigger: 'change' }
],
APPOINT_ANNEX: [
{ required: true, message: '请上传文件', trigger: 'change' }
],
LIMIT_END_TIME: [
{ required: true, message: '请选择指定培训有效截至时间', trigger: 'change' }
2024-01-22 14:39:38 +08:00
]
},
2024-01-17 18:43:02 +08:00
heirloom: {},
normalizer(node) {
return {
id: node.id,
label: node.name,
children: node.nodes
}
},
departmentTree: [],
2024-01-22 18:11:54 +08:00
peopleList: [],
corpFlag: false,
menu: {
department: '',
user: '',
uploadFile: '',
limitFlag: ''
}
2023-12-18 20:24:01 +08:00
}
},
methods: {
2024-01-17 18:43:02 +08:00
async init(e) {
this.loading = true
2023-12-18 20:24:01 +08:00
this.visible = true
this.heirloom = JSON.stringify(e)
2024-01-19 18:35:26 +08:00
this.form.list = JSON.stringify(e)
2024-01-22 15:23:02 +08:00
this.info = e[0]
await this.getMenu()
2024-01-22 15:23:02 +08:00
if (this.info.FLOWS_TYPE === '0') {
if (this.info.FLOWS_STEP === 0) {
this.isShow = true
await this.getDepartmentTree()
2024-01-22 18:11:54 +08:00
this.corpFlag = false
2024-01-22 15:23:02 +08:00
} else {
this.isShow = false
}
}
if (this.info.FLOWS_TYPE === '1') {
2024-01-22 15:23:02 +08:00
this.isShow = true
2024-01-27 15:57:50 +08:00
if (this.info.FLOWS_STEP === 2 || this.info.FLOWS_STEP === 3) {
2024-01-22 18:11:54 +08:00
await this.getDepartmentTree()
this.corpFlag = false
2024-01-27 15:57:50 +08:00
if (this.info.FLOWS_STEP === 3) {
2024-01-22 18:47:24 +08:00
this.isShow = false
}
2024-01-22 18:11:54 +08:00
} else {
await this.getCorpDepartmentTree()
this.corpFlag = true
}
2024-01-22 15:23:02 +08:00
}
if (this.info.FLOWS_TYPE === '2') {
if (this.info.FLOWS_STEP === 1) {
this.isShow = true
await this.getDepartmentTree()
this.corpFlag = false
} else {
this.isShow = false
}
}
2024-01-17 18:43:02 +08:00
this.loading = false
2023-12-18 20:24:01 +08:00
},
getMenu() {
return new Promise(resolve => {
requestFN(
'/flowTrain/getPintName', { FLOWS_TYPE: this.info.FLOWS_TYPE, FLOWS_STEP: this.info.FLOWS_STEP }
).then((data) => {
this.menu.department = data.Department
this.menu.user = data.User
this.menu.uploadFile = data.UploadFile
this.menu.limitFlag = data.limitFlag
resolve(true)
}).catch((e) => {
})
})
},
2024-01-22 14:39:38 +08:00
sendMessage(e) {
this.$refs.form.validate((valid) => {
if (!valid) {
this.$message.error('请填写完整信息')
} else {
2024-04-17 17:58:27 +08:00
this.loading = true
const formData = new FormData()
Object.keys(this.form).map(key => {
formData.append(key, this.form[key])
})
if (this.form.APPOINT_ANNEX) {
for (let i = 0; i < this.form.APPOINT_ANNEX.length; i++) {
formData.append('chengNuoShu', this.form.APPOINT_ANNEX[i].raw)
}
}
upload('/xgf/user/approveMax', formData)
2024-01-22 14:39:38 +08:00
.then((data) => {
this.$message.success('推送成功')
this.visible = false
this.$emit('refresh', '')
this.handleClose()
2024-04-17 17:58:27 +08:00
this.loading = false
2024-01-22 14:39:38 +08:00
})
.catch((e) => {
console.log(e)
2024-04-17 17:58:27 +08:00
this.loading = false
2024-01-22 14:39:38 +08:00
})
}
})
2024-01-17 18:43:02 +08:00
},
getDepartmentTree() {
return new Promise(resolve => {
requestFN(
'/department/listTree',
{}
).then((data) => {
this.departmentTree = this.removeEmptyChildren(JSON.parse(data.zTreeNodes))
resolve(true)
}).catch((e) => {
})
})
},
2024-01-22 15:23:02 +08:00
getCorpDepartmentTree() {
return new Promise(resolve => {
requestFN(
'/openApi/corpDepartment/listTree',
{}
).then((data) => {
this.departmentTree = this.removeEmptyChildren(JSON.parse(data.zTreeNodes))
resolve(true)
}).catch((e) => {
})
})
},
2024-01-18 13:56:14 +08:00
getPeopleList(e) {
this.form.APPOINT_DEPARTMENT_NAME = e.name
2024-01-22 18:11:54 +08:00
if (!this.corpFlag) {
2024-01-22 15:23:02 +08:00
requestFN(
'/user/listAll',
{
DEPARTMENT_ID: e.id
}
).then((data) => {
this.peopleList = data.userList
this.form.user = ''
2024-01-22 15:23:02 +08:00
}).catch((e) => {
console.log(e)
})
} else {
requestFN(
'/user/listAllManageAndCorp',
{
DEPARTMENT_ID: e.id
}
).then((data) => {
this.peopleList = data.userList
this.form.user = ''
2024-01-22 15:23:02 +08:00
}).catch((e) => {
console.log(e)
})
}
2024-01-17 18:43:02 +08:00
},
2024-01-18 13:56:14 +08:00
chooseUser(e) {
const entity = JSON.parse(e)
this.form.APPOINT_USER_ID = entity.USER_ID
this.form.APPOINT_USER_NAME = entity.NAME
},
2024-01-17 18:43:02 +08:00
handleClose() {
this.form = {
2024-01-18 13:56:14 +08:00
STATUS: '',
2024-01-22 14:39:38 +08:00
APPOINT_DEPARTMENT_ID: null,
2024-01-18 13:56:14 +08:00
APPOINT_DEPARTMENT_NAME: '',
APPOINT_USER_ID: '',
APPOINT_USER_NAME: '',
OPINION: '',
2024-01-18 13:56:14 +08:00
user: '',
list: [],
tm: new Date().getTime()
2024-01-17 18:43:02 +08:00
}
this.visible = false
2024-01-18 13:56:14 +08:00
},
beforeClose() {
this.visible = false
this.form = {
STATUS: '',
2024-01-22 14:39:38 +08:00
APPOINT_DEPARTMENT_ID: null,
2024-01-18 13:56:14 +08:00
APPOINT_DEPARTMENT_NAME: '',
APPOINT_USER_ID: '',
APPOINT_USER_NAME: '',
OPINION: '',
2024-01-18 13:56:14 +08:00
user: '',
list: [],
tm: new Date().getTime()
}
},
clearInfo() {
this.form.APPOINT_DEPARTMENT_ID = null
this.form.APPOINT_DEPARTMENT_NAME = ''
this.form.APPOINT_USER_ID = null
this.form.APPOINT_USER_NAME = ''
this.form.OPINION = ''
this.form.user = ''
2023-12-18 20:24:01 +08:00
}
}
}
</script>
<style lang="scss" scoped>
</style>