123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- <template class="deptmentAudit_formDialog">
- <div>
- <el-form
- ref="deptmentAuditFrom"
- style="overflow-y: auto;margin-top: 15px;"
- :rules="rules"
- :model="deptmentAuditFrom"
- label-width="110px"
- size="small"
- >
- <el-row v-if="disabled">
- <el-col v-if="approvalPersonOptions.length" :span="8">
- <el-form-item label="下一步审核人" prop="auditPersonId">
- <el-select
- v-model="deptmentAuditFrom.auditPersonId"
- style="width: 100%"
- clearable
- placeholder="请选择审核人"
- @change="changeAudit"
- >
- <el-option
- v-for="item in approvalPersonOptions"
- :key="item.approvalPersonId"
- :label="item.approvalPersonName"
- :value="item.approvalPersonId + ''"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="处理人" prop="registerUser">
- <el-input v-model="deptmentAuditFrom.registerUser" readonly placeholder="系统自动生成" disabled />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="处理时间" prop="registerDate">
- <el-input v-model="deptmentAuditFrom.registerDate" readonly placeholder="系统自动生成" disabled />
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="处理意见" prop="approvalSuggest">
- <el-input v-model="deptmentAuditFrom.approvalSuggest" maxlength="200" rows="3" resize="none" show-word-limit type="textarea" placeholder="请输入备注信息" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row v-else>
- <el-row>
- <el-col :span="8">
- <el-form-item label="处理人:">
- {{ deptmentAuditFrom.registerUser }}
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="处理时间:">
- {{ deptmentAuditFrom.registerDate }}
- </el-form-item>
- </el-col>
- <el-col :span="24">
- <el-form-item label="处理意见:">
- {{ deptmentAuditFrom.approvalSuggest }}
- </el-form-item>
- </el-col>
- </el-row>
- <el-row v-if="Array.isArray(list) && list.length !== 0">
- <tf-title>驳回记录</tf-title>
- <tf-table
- :table-data="list"
- :column="column"
- :pagination="false"
- :for-id="true"
- :border="true"
- :tableheight="tableheight"
- :multiple="false"
- />
- </el-row>
- </el-row>
- </el-form>
-
- </div>
- </template>
- <script>
- import { parseTime } from '@/utils/index'
- import { approvalInstance, addFormAssign, updateApplyState, changeApprovalPerson } from '@/api/dcApi/installationProcess/process.js'
- import { mixins } from '../mixin/index'
- export default {
- mixins: [mixins],
- props: {
- data: {
- type: Object,
- required: true
- },
- isLook: {
- type: Boolean,
- required: true
- },
- active: {
- type: Number,
- required: true
- },
- processInstanceId: {
- type: Number,
- default: 0
- },
-
- checkData: {
- type: Array,
- required: true
- },
- editFormId: {
- type: Number,
- required: true
- }
- },
- data() {
- return {
- rules: {
-
-
- approvalSuggest: [{ required: true, message: '请输入处理意见', trigger: 'blur' }]
- },
- deptmentAuditFrom: {
- registerUser: sessionStorage.getItem('realName'),
- registerDate: parseTime(
- new Date(),
- '{y}-{m}-{d} {h}:{i}:{s}'
- ),
- auditPersonId: '',
- auditPersonName: '',
- constructionCost: ''
- },
- disabled: false,
- fileList: [],
- optionData: [],
- tableId: '',
- loading: false,
- tableheight: '166px',
- list: [],
- column: [
- {
- label: '驳回人员',
- prop: 'approvalPersonName'
- },
- {
- label: '驳回时间',
- prop: 'approvalTime'
- },
- {
- label: '驳回意见',
- prop: 'approvalSuggest'
- }
- ],
- approvalPersonOptions: []
- }
- },
- created() {
- this.approvalStatus = this.checkData[1].approvalStatus
- if (this.isLook) {
-
- this.active > 1 ? this.disabled = false : this.disabled = true
- if (this.checkData[1]?.histroy) {
- this.deptmentAuditFrom = {
- registerDate: this.checkData[1].approvalTime ? this.checkData[1].approvalTime.slice(0, 10) : parseTime(
- new Date(),
- '{y}-{m}-{d} {h}:{i}:{s}'
- ),
- registerUser: sessionStorage.getItem('realName'),
- approvalSuggest: this.checkData[1].approvalSuggest
- }
- this.list = this.checkData[1].histroy.filter(e => {
- return (e.approvalStatus == 2 && e.nodeAlias == 'workOrderAudit')
- })
- }
- } else {
-
- this.disabled = false
- this.deptmentAuditFrom = {
- registerDate: this.checkData[1].approvalTime ? this.checkData[1].approvalTime.slice(0, 10) : '',
- registerUser: this.checkData[1].approvalPersonName,
- approvalSuggest: this.checkData[1].approvalSuggest
- }
- if (this.checkData[1].histroy) {
- this.list = this.checkData[1].histroy.filter(e => {
- return (e.approvalStatus == 2 && e.nodeAlias == 'workOrderAudit')
- })
- }
- }
- },
-
- mounted() {
- console.log('checkData', this.checkData, this.data)
- this.tableId = this.data.id
- },
- methods: {
-
- resetFields() {
- this.$refs.deptmentAuditFrom.resetFields()
- },
-
- submitForm(val) {
- console.log('this.fileList', this.fileList)
- const _this = this
- _this.$refs.deptmentAuditFrom.validate((valid) => {
- if (valid) {
- const checkData = _this.checkData[1]
- debugger
- const data = {
- formData: [
- {
- formId: this.editFormId,
- fieldName: 'auditPersonId',
- fieldDataValue: _this.deptmentAuditFrom.auditPersonId
- },
- {
- formId: this.editFormId,
- fieldName: 'auditPersonName',
- fieldDataValue: _this.deptmentAuditFrom.auditPersonName
- }
- ],
- processId: checkData.processId || '',
- processNodeAlias: checkData.nodeAlias || ''
- }
- addFormAssign(data).then((res) => {
- console.log('res', res)
- const flag = res.code == 1
- if (flag) {
- _this.newAddUser(val)
- }
- })
- return true
- } else {
- return false
- }
- })
- },
- async updateApplyStateF(data) {
- try {
- await updateApplyState(data)
- } finally {
- console.log(data)
- }
- },
-
- async newAddUser(val) {
- const _this = this
- this.loading = true
- _this.$emit('remind', '2')
- const checkData = this.checkData[1]
- debugger
- if (_this.approvalPersonOptions.length > 1 && _this.checkData[_this.active + 1]) {
-
- const params = [{
- 'approvalPersonId': _this.deptmentAuditFrom.auditPersonId,
- 'approvalPersonName': _this.deptmentAuditFrom.auditPersonName,
-
- 'nodeAlias': _this.checkData[_this.active + 1].nodeAlias,
-
- 'processId': _this.checkData[_this.active + 1].processId
-
- }]
- await changeApprovalPerson(params).then((pRes) => {
- if (pRes && pRes.code == 1) {
- console.log('流程节点改变成功', pRes)
- }
- })
- }
- const userInfo = this.$store.state.user
- const data = {
- approvalPersonId: userInfo.userId,
- approvalPersonName: userInfo.realName,
-
-
- approvalStatus: val,
- approvalSuggest: this.deptmentAuditFrom.approvalSuggest,
- nodeAlias: checkData.nodeAlias,
- processId: checkData.processId,
- isMessagePush: 1,
- buinessInfoId: this.tableId,
- nodeSortNum: checkData.nodeSortNum,
- constructionCost: this.deptmentAuditFrom.constructionCost,
- auditPersonId: this.deptmentAuditFrom.auditPersonId,
- auditPersonName: this.deptmentAuditFrom.auditPersonName
- }
- approvalInstance(data).then(res => {
- this.loading = false
- _this.$emit('remind', '0')
- console.log(res)
- if (res.code === 1) {
- if (val == 2) {
- const data = {
- id: this.data.id,
- applyStatus: 1
- }
- this.updateApplyStateF(data)
- }
- _this.$message.success('成功!')
- _this.$emit('remind', '1')
- _this.resetFields()
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|