chenc 3 gadi atpakaļ
vecāks
revīzija
0ee6ee7f32

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 733 - 522
src/views/activiti/form/demoForm2.vue


+ 642 - 0
src/views/activiti/form/demoForm22.vue

@@ -0,0 +1,642 @@
+<template>
+  <div class="form-main">
+    <a-card :body-style="{ padding: '24px 32px' }" :bordered="false">
+      <!-- <a-form @submit="handleSubmit" :form="form">
+        <a-form-item
+          label="标题"
+          :labelCol="{lg: {span: 7}, sm: {span: 7}}"
+          :wrapperCol="{lg: {span: 10}, sm: {span: 17} }">
+          <a-input :disabled="disabled"
+                   v-decorator="[
+            'name',
+            {rules: [{ required: true, message: '请输入标题' }]}
+          ]"
+                   name="name"
+                   placeholder="给目标起个名字" />
+        </a-form-item>
+        <a-form-item v-if="!disabled"
+                     :wrapperCol="{ span: 24 }"
+                     style="text-align: center"
+        >
+          <a-button htmlType="submit" type="primary" :disabled="disabled||btndisabled" @click="handleSubmit">保存</a-button>
+          <a-button style="margin-left: 8px" :disabled="disabled" @click="close">取消</a-button>
+        </a-form-item>
+      </a-form>-->
+      <k-form-build
+        :value="jsonData"
+        @change="handleChange"
+        :dynamicData="dynamicData"
+        ref="KFB"
+        @submit="handleSubmit"
+      />
+      <div style="text-align:center">
+        <a-button
+          htmlType="submit"
+          type="primary"
+          :disabled="disabled || btndisabled"
+          @click="handleSubmit"
+        >保存</a-button
+        >
+        <todoManageOperation
+          v-if="processData.operationType && processData.operationType == '1'"
+          :processData="processData"
+          :todoManageOperationObject="todoManageOperationObject"
+          :disabled="disabled"
+          :btndisabled="btndisabled"
+          @refreshToDo="refreshToDo"
+          @handleSubmit2="handleSubmit2"
+        ></todoManageOperation>
+        <a-button style="margin-left: 8px;" :disabled="disabled || disabled2" @click="close">取消</a-button>
+      </div>
+    </a-card>
+  </div>
+</template>
+
+<script>
+import pick from 'lodash.pick'
+import todoManageOperation from '../operation/todoManageOperation'
+import { postAction } from '@/api/manage'
+
+export default {
+    name: 'DemoForm',
+    props: {
+    /* 全局禁用,可表示查看 */
+        disabled: {
+            type: Boolean,
+            default: false,
+            required: false
+        },
+        /* 流程数据 */
+        processData: {
+            type: Object,
+            default: () => {
+                return {}
+            },
+            required: false
+        },
+        /* 是否新增 */
+        isNew: { type: Boolean, default: false, required: false }
+    },
+    components: {
+        todoManageOperation
+    },
+    data () {
+        return {
+            todoManageOperationObject: {
+                isSave: false,
+                formData: {}
+            },
+            disabled2: false, // 用来取决于表单时不同流程节点填写不同表单信息使用
+            jsonData: {},
+            url: {
+                getForm: '/actBusiness/getForm',
+                addApply: '/actBusiness/add',
+                editForm: '/actBusiness/editForm',
+                leaveType: '/sys/dict/getDictItems'
+            },
+            description: '流程表单demo,按例开发表单。需在 activitiMixin.js 中加入写好的表单',
+            // form
+            form: this.$form.createForm(this),
+            /* 表单回显数据 */
+            data: {},
+            btndisabled: false,
+            ceshi_file: null,
+            dynamicData: {
+                typeData: [], // 请假类型下拉数据
+                reimbursementTypeList: [], // 报销类型下拉数据
+                invoiceTypeList: [] // 发票类型下拉数据
+            }
+        }
+    },
+    created () {
+        console.log('流程数据', this.processData)
+        // 加载一些下拉选择数据等
+        // this.getDataList()
+        let businessTable = ''
+        // 如果没有值则在另一个属性上有值
+        if (!this.processData.businessTable) {
+            this.processData.businessTable = this.processData.tableName
+        }
+        this.getAction('/tbTableInfo/query', {
+            businessTable: this.processData.businessTable,
+            taskNodeId: this.processData.key
+        }).then(res => {
+            // this.$refs.KFB.setData({aaa:null,bbb:null,name:"123"})
+            // this.$refs.KFB.getData().then(res => {
+            //   console.log('aaa',res)
+            // })
+
+            var jsonString = JSON.stringify(res.result.jsonContent)
+            // var jsonString='123d"dynamicKey":"666"'
+            var index = 1
+
+            var dynamicKeyValueList = []
+            for (var index = 1; index !== -1;) {
+                // 动态字符位置
+                index = jsonString.indexOf('"dynamicKey"', index)
+                if (index !== -1) {
+                    // 从指定字符的周后一个字符后开始找(")
+                    var ihStart = jsonString.indexOf('"', index + 12)
+                    // 再从 (") 后面位置还是找下一个 (")
+                    var ihEnd = jsonString.indexOf('"', ihStart + 1)
+                    // 获取引号之间的字符
+                    var dynamicKeyValue = jsonString.substring(ihStart + 1, ihEnd)
+                    // 如果动态表示不为空则获取
+                    if (dynamicKeyValue != '') {
+                        dynamicKeyValueList.push(dynamicKeyValue)
+                    }
+                    index = ihEnd + 1
+                }
+            }
+            // 循环动态数据源表示获取数据
+            // if(dynamicKeyValueList.length>0){
+            //   dynamicKeyValueList.forEach(async element => {
+            //      await this.getDataListByName(element);
+            //   });
+            // }
+            // console.log('?????', dynamicKeyValueList)
+            if (dynamicKeyValueList.length > 0) {
+                // 获取数据字典数据源
+                postAction('/sys/dict/getDictItems/getDictList', dynamicKeyValueList).then(dictData => {
+                    if (dictData.success) {
+                        this.dynamicData = dictData.result.dicList
+
+                        // 获取用户下拉数据
+                        this.getAction('/sys/user/list2', { pageSize: 20000 }).then(userData => {
+                            if (res.success) {
+                                userData.result.records.forEach(user => {
+                                    user.label = user.realname
+                                    user.value = user.username
+                                })
+                                // 存到动态数据源中
+                                this.dynamicData.userList = userData.result.records
+                                // 获取json
+                                this.jsonData = res.result.jsonContent
+                                if (!this.isNew) {
+                                    this.init()
+                                }
+                            } else {
+                                this.$message.error(userData.message)
+                            }
+                        })
+                    } else {
+                        this.$message.error(dictData.message)
+                    }
+                })
+            } else {
+                // 获取json
+                this.jsonData = res.result.jsonContent
+                if (!this.isNew) {
+                    this.init()
+                }
+            }
+
+            // 后台检测到流程节点有关联表单且前台处于我的待办界面打开表单详情
+            if (res.result.isSave && this.processData.isSuspended != undefined) {
+                this.disabled = false
+                this.btndisabled = false
+            }
+        })
+    },
+    methods: {
+    // 根据字典名字获取数据源
+        getDataListByName (name) {
+            this.getAction(this.url.leaveType + '/' + name).then(res => {
+                if (res.success) {
+                    this.dynamicData[name] = res.result
+                    console.log(111)
+                } else {
+                    this.$message.error(res.message)
+                }
+            })
+        },
+        // 获取获取下拉数据等
+        getDataList () {
+            // 获取请假类型下拉数据
+            this.getAction(this.url.leaveType + '/leave_type').then(res => {
+                if (res.success) {
+                    this.dynamicData.typeData = res.result
+                } else {
+                    this.$message.error(res.message)
+                }
+            })
+            // 获取报销类型下拉数据
+            this.getAction(this.url.leaveType + '/reimbursement_type').then(res => {
+                if (res.success) {
+                    this.dynamicData.reimbursementTypeList = res.result
+                } else {
+                    this.$message.error(res.message)
+                }
+            })
+            // 获取发票类型下拉数据
+            this.getAction(this.url.leaveType + '/invoice_type').then(res => {
+                if (res.success) {
+                    this.dynamicData.invoiceTypeList = res.result
+                } else {
+                    this.$message.error(res.message)
+                }
+            })
+        },
+        /* 回显数据 */
+        init () {
+            this.btndisabled = true
+            var r = this.processData
+            this.getAction(this.url.getForm, {
+                tableId: r.tableId,
+                tableName: r.tableName
+            }).then(res => {
+                if (res.success) {
+                    let formData = res.result
+                    formData.tableName = r.tableName
+                    this.data = formData
+                    console.log('表单回显数据', this.data)
+                    // console.log(this.data)
+                    this.$refs.KFB.setData(this.data)
+                    this.$nextTick(() => {
+                        this.$refs.KFB.form.setFieldsValue(pick(this.data, 'name'))
+                        console.log(this.data)
+                        console.log('where')
+                    })
+                    this.btndisabled = false
+                } else {
+                    this.$message.error(res.message)
+                }
+            })
+        },
+        // 表单字段数值发生改变事件
+        handleChange (value, key) {
+            // 数据变化时触发
+            // 如果开始时间发生变化
+            if (key == 'start_time') {
+                // 判断结束时间是否存在
+                if (this.$refs.KFB.form.getFieldValue('end_time')) {
+                    // 获取时间差
+                    let duration = startEndFun(value, this.$refs.KFB.form.getFieldValue('end_time'))
+                    if (duration) {
+                        // 使用k-form-design组件的form属性修改表单数据
+                        this.$refs.KFB.setData({
+                            duration: duration
+                        })
+                    }
+                }
+            }
+            // 如果结束时间发生变化
+            if (key == 'end_time') {
+                // 判断结束时间是否存在
+                if (this.$refs.KFB.form.getFieldValue('start_time')) {
+                    // 获取时间差
+                    let duration = startEndFun(this.$refs.KFB.form.getFieldValue('start_time'), value)
+                    if (duration) {
+                        // 使用k-form-design组件的form属性修改表单数据
+                        this.$refs.KFB.setData({
+                            duration: duration
+                        })
+                    }
+                }
+            }
+        },
+        // handler
+        handleSubmit (e) {
+            // return new Promise((resolve)=>{
+            // 通过函数获取数据
+            this.$refs.KFB.getData()
+                .then(res => {
+                    // 清除为空的表单数据
+                    _.keys(res).forEach(r => {
+                        if (!res[r]) {
+                            delete res[r]
+                        }
+                    })
+                    // 获取数据成功
+                    let formData = JSON.parse(JSON.stringify(res))
+                    console.log(formData)
+                    formData.id = this.data.id
+                    formData.procDefId = this.processData.id
+                    formData.procDeTitle = this.processData.name
+                    if (!formData.tableName) formData.tableName = this.processData.businessTable
+                    formData.filedNames = _.keys(res).join(',')
+                    formData.filedNames = getFiledNames(formData) // 获取主表字段,排除子表标识
+                    var url = this.url.addApply
+                    if (!this.isNew) {
+                        url = this.url.editForm
+                    }
+                    // 是否存在子表
+                    let ischild = false
+                    // 循环表单字段属性判断是否属性中包含数组对象
+                    let i = 0 // 子表数量
+                    _.keys(res)
+                        .join(',')
+                        .split(',')
+                        .forEach(element => {
+                            if (formData[element] instanceof Array) {
+                                // 判断是否符合子表命名规则
+                                if (element.indexOf('&') != -1) {
+                                    let tableChildNameList = element.split('&')
+                                    // 判断是否能拆分两个字符,子表标识和子表数据库名称
+                                    if (tableChildNameList.length == 2) {
+                                        i++
+                                        let childName = tableChildNameList[1] // 子表数据库名称
+                                        if (!formData.table_name_children) {
+                                            // 第一次拼接
+                                            formData.table_name_children = childName // 表名
+                                        } else {
+                                            // 后面的表明拼接用“,”隔开
+                                            formData.table_name_children = formData.table_name_children + ',' + childName // 表名
+                                        }
+                                        // 定义属性名和值
+                                        formData['childFiledNames' + i] = _.keys(formData[element][0]).join(',') // 子表字段名
+                                        formData['childList' + i] = JSON.stringify(formData[element]) // 子表数据
+                                        ischild = true
+                                    }
+                                } else {
+                                    // 如果不是子表则是上传文件,则转字符串
+                                    formData[element] = JSON.stringify(formData[element])
+                                }
+                            }
+                            // formData[element];
+                        })
+                    // 判断需不需要存子表
+                    if (ischild) {
+                        formData.filedNames = formData.filedNames + ',table_name_children'
+                    }
+
+                    console.log(formData)
+                    // 子表数据
+                    // 调用保存接口
+                    this.btndisabled = true
+                    this.todoManageOperationObject.formData = formData
+                    this.todoManageOperationObject.url = url
+                    // 获取是否部门负责人
+                    formData.filedNames = formData.filedNames + ',is_leaders'
+                    formData.is_leaders = this.$store.getters.userInfo.identity
+
+                    // 非我的待办节点打卡表单界面
+                    this.postFormAction(url, formData)
+                        .then(res => {
+                            if (res.success) {
+                                this.todoManageOperationObject.isSave = true
+                                this.$message.success('保存成功!')
+                                console.log('报销流程 保存成功')
+                                this.$emit('afterSubmit', formData)
+                                this.$emit('close')
+                                // resolve(true);
+                            } else {
+                                this.$message.error(res.message)
+                                // resolve(false);
+                            }
+                        })
+                        .finally(() => {
+                            this.btndisabled = false
+                            // resolve(false);
+                        })
+                })
+                .catch(err => {
+                    console.log(err, '校验失败')
+                    // resolve(false);
+                })
+            // })
+        },
+        // 我的待办点击通过保存专用
+        handleSubmit2 (e) {
+            // return new Promise((resolve)=>{
+            // 通过函数获取数据
+            this.$refs.KFB.getData()
+                .then(res => {
+                    // 获取数据成功
+                    let formData = JSON.parse(JSON.stringify(res))
+                    console.log(formData)
+                    formData.id = this.data.id
+                    formData.procDefId = this.processData.id
+                    formData.procDeTitle = this.processData.name
+                    if (!formData.tableName) formData.tableName = this.processData.businessTable
+                    formData.filedNames = _.keys(res).join(',')
+                    formData.filedNames = getFiledNames(formData) // 获取主表字段,排除子表标识
+                    var url = this.url.addApply
+                    if (!this.isNew) {
+                        url = this.url.editForm
+                    }
+                    // 是否存在子表
+                    let ischild = false
+                    // 循环表单字段属性判断是否属性中包含数组对象
+                    let i = 0 // 子表数量
+                    _.keys(res)
+                        .join(',')
+                        .split(',')
+                        .forEach(element => {
+                            if (formData[element] instanceof Array) {
+                                // 判断是否符合子表命名规则
+                                if (element.indexOf('&') != -1) {
+                                    let tableChildNameList = element.split('&')
+                                    // 判断是否能拆分两个字符,子表标识和子表数据库名称
+                                    if (tableChildNameList.length == 2) {
+                                        i++
+                                        let childName = tableChildNameList[1] // 子表数据库名称
+                                        if (!formData.table_name_children) {
+                                            // 第一次拼接
+                                            formData.table_name_children = childName // 表名
+                                        } else {
+                                            // 后面的表明拼接用“,”隔开
+                                            formData.table_name_children = formData.table_name_children + ',' + childName // 表名
+                                        }
+                                        // 定义属性名和值
+                                        formData['childFiledNames' + i] = _.keys(formData[element][0]).join(',') // 子表字段名
+                                        formData['childList' + i] = JSON.stringify(formData[element]) // 子表数据
+                                        ischild = true
+                                    }
+                                } else {
+                                    // 如果不是子表则是上传文件,则转字符串
+                                    formData[element] = JSON.stringify(formData[element])
+                                }
+                            }
+                            // formData[element];
+                        })
+                    // 判断需不需要存子表
+                    if (ischild) {
+                        formData.filedNames = formData.filedNames + ',table_name_children'
+                    }
+
+                    console.log(formData)
+                    // 子表数据
+                    // 调用保存接口
+                    this.btndisabled = true
+                    this.todoManageOperationObject.formData = formData
+                    this.todoManageOperationObject.url = url
+                })
+                .catch(err => {
+                    console.log(err, '校验失败')
+                    // resolve(false);
+                })
+            // })
+        },
+        close () {
+            this.$emit('close')
+        },
+        getData () {
+            // 通过函数获取数据
+            this.$refs.KFB.getData()
+                .then(res => {
+                    // 获取数据成功
+                    alert(JSON.stringify(res))
+                })
+                .catch(err => {
+                    console.log(err, '校验失败')
+                })
+        },
+        // 刷新待办列表
+        refreshToDo () {
+            this.close()
+            this.$emit('getDataList')
+        }
+    }
+}
+// 获取主表字段,排除子表标识
+function getFiledNames (formData) {
+    let filedNames = ''
+    let list = formData.filedNames.split(',') // 获取表单属性名集合
+    list.forEach(element => {
+        if (element.indexOf('&') == -1) {
+            // 查询是否有这个字段
+            if (filedNames == '') {
+                // 第一次则直接等于
+                filedNames = element
+            } else {
+                // 后面用逗号隔开
+                filedNames = filedNames + ',' + element
+            }
+        }
+    })
+    return filedNames
+}
+
+// 根据开始时间 结束时间计算天数
+function startEndFun (start, end) {
+    let startTime = new Date(start)
+    let endTime = new Date(end)
+    if (startTime >= endTime) return 0
+    // 1,分钟取整
+    startTime = carryTime(startTime)
+    endTime = carryTime(endTime)
+    // 2,计算总天数
+    var totalTime = 0 // 工时,天数
+    if (startTime.getDay() == 6 || startTime.getDay() == 0) {
+        totalTime = endTime.getDate() - startTime.getDate()
+    } else {
+        totalTime = Math.floor((endTime - startTime) / (3600 * 1000) / 24)
+    }
+    // 3,拿初始值赋值给一个临时变量
+    var tempStartTime = new Date()
+    tempStartTime.setTime(startTime.getTime())
+    // 4,计算出总天数
+    while (tempStartTime.getDate() < endTime.getDate()) {
+        if (tempStartTime.getDay() == 6 || tempStartTime.getDay() == 0) {
+            // 周六或者周日减去
+            totalTime--
+        }
+        tempStartTime.setDate(tempStartTime.getDate() + 1)
+    }
+
+    // 5,计算出总小时数
+    var temp = 0 // 工时,小时
+    do {
+        if (startTime.getDay() == 6 || startTime.getDay() == 0) {
+            // 周六周日
+            startTime.setDate(startTime.getDate() + 1)
+            //* ********周六周日直接跳过,初始化为早晨9点
+            startTime.setHours(9)
+            startTime.setMinutes(0)
+            continue
+        }
+
+        if (endTime.getDay() == 6 || endTime.getDay() == 0) {
+            // 周六周日
+            endTime.setDate(endTime.getDate() + 1)
+            //* ********周六周日直接跳过,初始化为早晨9点
+            endTime.setHours(9)
+            endTime.setMinutes(0)
+            continue
+        }
+
+        let tempMinutes = startTime.getHours() * 60 + startTime.getMinutes()
+        // 上午9点到12点半,算工时
+        if (tempMinutes >= 9 * 60 && tempMinutes < 12 * 60) {
+            temp += 0.05
+        }
+        // 上午14点到18点半,算工时
+        if (tempMinutes >= 13 * 60 && tempMinutes < 18 * 60) {
+            temp += 0.05
+        }
+        startTime.setTime(startTime.getTime() + 0.5 * 3600 * 1000) // 每次增加半个小时
+    } while (startTime.getHours() * 60 + startTime.getMinutes() != endTime.getHours() * 60 + endTime.getMinutes())
+    {
+        totalTime += Math.floor(temp / 0.8)
+        totalTime += temp % 0.8
+        totalTime = Math.round(totalTime * 100) / 100
+    }
+    var days = Math.floor(totalTime)
+    var hours = Math.round((totalTime - days) * 100) / 10
+    console.log(days + '天', hours + '小时')
+
+    return days * 8 + hours
+
+    // if (start && end) {
+    //   let startTime = new Date(start) // 开始时间
+    //   let endTime = new Date(end) // 结束时间
+    //   let usedTime = endTime - startTime // 相差的毫秒数
+    //   let days = (usedTime / 1000 / 60 / 60).toFixed(2) // 计算出天数
+    //   return days
+    // } else {
+    //   return null
+    // }
+}
+
+// 格式化时间
+function formatDate (date, fmt) {
+    if (/(y+)/.test(fmt)) {
+        fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
+    }
+    let o = {
+        'M+': date.getMonth() + 1,
+        'd+': date.getDate(),
+        'h+': date.getHours(),
+        'm+': date.getMinutes(),
+        's+': date.getSeconds()
+    }
+    for (let k in o) {
+        if (new RegExp(`(${k})`).test(fmt)) {
+            let str = o[k] + ''
+            fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? str : padLeftZero(str))
+        }
+    }
+    return fmt
+}
+
+function padLeftZero (str) {
+    return ('00' + str).substr(str.length)
+}
+
+/*
+ * 0-15分不算工时
+ * 15-45算半个小时
+ * 45-60算一个小时
+ * */
+function carryTime (date) {
+    if (date.getMinutes() > 0 && date.getMinutes() < 15) {
+        date.setMinutes(0)
+    }
+    if (date.getMinutes() >= 15 && date.getMinutes() < 30) {
+        date.setMinutes(30)
+    }
+    if (date.getMinutes() > 30 && date.getMinutes() < 45) {
+        date.setMinutes(30)
+    }
+    if (date.getMinutes() >= 45) {
+        date.setHours(date.getHours() + 1)
+        date.setMinutes(0)
+    }
+    return date
+}
+</script>
+<style lang="less" scoped>
+.form-main {
+}
+</style>

+ 2 - 2
src/views/activiti/operation/todoManageOperation.vue

@@ -101,7 +101,7 @@
 </template>
 
 <script>
-import { getAction, postFormAction } from '@/api/manage'
+import { getAction, postFormAction,postFormDataAction } from '@/api/manage'
 import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
 import todoManage from '../todoManage'
 export default {
@@ -300,7 +300,7 @@ export default {
           //调用保存按钮
           await this.$emit('handleSubmit2');
           //保存
-          this.postFormAction(this.todoManageOperationObject.url, this.todoManageOperationObject.formData).then(res => {
+          postFormDataAction(this.todoManageOperationObject.url, this.todoManageOperationObject.formData,{jsonContent:this.todoManageOperationObject.jsonData}).then(res => {
             if (res.success) {
               this.$message.success('保存成功!')
               //通过

+ 388 - 0
src/views/activiti/operation/todoManageOperation2.vue

@@ -0,0 +1,388 @@
+<template>
+  <!-- <a-row :gutter="24">
+  <a-col :md="24" :sm="24">-->
+  <span>
+    <span
+      v-if="Boolean(processData.isSuspended)"
+      style="cursor: no-drop;color: #999999;"
+      title="流程已被挂起,无法操作!"
+    >
+      通过
+      <a-divider type="vertical" />驳回
+      <a-divider type="vertical" />委托
+      <a-divider type="vertical" />
+    </span>
+    <span v-else>
+      <a-button style="margin-left: 8px;" type="primary" @click="passTask(processData)">通过</a-button>
+      <a-button style="margin-left: 8px;" type="primary" @click="backTask(processData)">驳回</a-button>
+      <a-button style="margin-left: 8px;" type="primary" @click="delegateTask(processData)">委托</a-button>
+      <!-- <a href="javascript:void(0);" @click="passTask(processData)" style="color: green">通过</a>
+      <a-divider type="vertical" />
+      <a href="javascript:void(0);" @click="backTask(processData)" style="color: orange">驳回</a>
+      <a-divider type="vertical" />
+      <a href="javascript:void(0);" @click="delegateTask(processData)" style="color: #00A0E9">委托</a>
+      <a-divider type="vertical" />-->
+    </span>
+    <!-- 审批操作 -->
+    <a-modal :title="modalTaskTitle" v-model="modalTaskVisible" :mask-closable="false" :width="500">
+      <div v-if="modalTaskVisible">
+        <a-form ref="form" :model="form" :label-width="85" :rules="formValidate">
+          <a-form-item label="审批意见" prop="reason">
+            <a-input type="textarea" v-model="form.comment" :rows="4" />
+          </a-form-item>
+          <a-form-item label="下一审批人" prop="assignees" v-show="showAssign" :error="error">
+            <a-select
+              v-model="form.assignees"
+              placeholder="请选择"
+              allowClear
+              mode="multiple"
+              :loading="userLoading"
+            >
+              <a-select-option
+                v-for="(item, i) in assigneeList"
+                :key="i"
+                :value="item.username"
+              >{{item.realname}}</a-select-option>
+            </a-select>
+          </a-form-item>
+          <a-form-item label="下一审批人" v-show="isGateway">
+            <span>分支网关处暂不支持自定义选择下一审批人,将发送给下一节点所有人</span>
+          </a-form-item>
+          <div v-show="form.type==1">
+            <a-form-item label="驳回至">
+              <a-select v-model="form.backTaskKey" :loading="backLoading" @change="changeBackTask">
+                <a-select-option
+                  v-for="(item, i) in backList"
+                  :key="i"
+                  :value="item.key"
+                >{{item.name}}</a-select-option>
+              </a-select>
+            </a-form-item>
+            <a-form-item
+              label="指定原节点审批人"
+              prop="assignees"
+              v-show="form.backTaskKey!=-1"
+              :error="error"
+            >
+              <a-select
+                v-model="form.assignees"
+                placeholder="请选择"
+                allowClear
+                mode="multiple"
+                :loading="userLoading"
+              >
+                <a-select-option
+                  v-for="(item, i) in assigneeList"
+                  :key="i"
+                  :value="item.id"
+                >{{item.username}}</a-select-option>
+              </a-select>
+            </a-form-item>
+          </div>
+          <a-form-item label="选择委托人" prop="userId" :error="error" v-show="form.type==2">
+            <JSelectUserByDep v-model="form.userId" :multi="false"></JSelectUserByDep>
+          </a-form-item>
+          <a-form-item label="消息通知">
+            <a-checkbox v-model="form.sendMessage">站内消息通知</a-checkbox>
+            <a-checkbox v-model="form.sendSms" disabled>短信通知</a-checkbox>
+            <a-checkbox v-model="form.sendEmail" disabled>邮件通知</a-checkbox>
+          </a-form-item>
+        </a-form>
+      </div>
+      <div slot="footer">
+        <a-button type="text" @click="modalTaskVisible=false">取消</a-button>
+        <a-button type="primary" :loading="submitLoading" @click="handelSubmit">提交</a-button>
+      </div>
+    </a-modal>
+  </span>
+  <!-- </a-col> -->
+
+  <!-- </a-row> -->
+</template>
+
+<script>
+import { getAction, postFormAction } from '@/api/manage'
+import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
+import todoManage from '../todoManage'
+export default {
+  name: 'todoManageOperation',
+  components: { JSelectUserByDep, todoManage },
+  props: {
+    /*流程数据*/
+    processData: {
+      type: Object,
+      default: () => {
+        return {}
+      },
+      required: false
+    },
+    todoManageOperationObject: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    },
+    disabled: false,
+    btndisabled: false
+  },
+  data() {
+    return {
+      url: {
+        todoList: '/actTask/todoList',
+        pass: '/actTask/pass',
+        back: '/actTask/back',
+        backToTask: '/actTask/backToTask',
+        delegate: '/actTask/delegate',
+        getNextNode: '/activiti_process/getNextNode',
+        getNode: '/activiti_process/getNode/',
+        getBackList: '/actTask/getBackList/',
+        passAll: '/actTask/passAll/',
+        backAll: '/actTask/backAll/'
+      },
+      form: {
+        id: '',
+        userId: '',
+        procInstId: '',
+        comment: '',
+        type: 0,
+        assignees: [],
+        backTaskKey: '-1',
+        sendMessage: true,
+        sendSms: false,
+        sendEmail: false
+      },
+      modalTaskVisible: false,
+      modalTaskTitle: '',
+      formValidate: {
+        // 表单验证规则
+      },
+      showAssign: false,
+      userLoading: false,
+      assigneeList: [],
+      isGateway: false,
+      backLoading: false,
+      backList: [
+        {
+          key: '-1',
+          name: '发起人'
+        }
+      ],
+      error: '',
+      submitLoading: false // 添加或编辑提交状态
+    }
+  },
+  methods: {
+    passTask(v) {
+      //调用表单提交表单的保存方法
+      //  console.log(this.todoManageOperationObject.isSave)
+      //  console.log(this.disabled)
+      //  console.log(this.btndisabled)
+      //  let isPassTask=false;//是否可以通过
+      //  //表单是否需要保存
+      //  if(this.disabled==false&&this.btndisabled==false){
+      //    //需要保存 那么是否已经点击保存
+      //    if(this.todoManageOperationObject.isSave){
+      //      isPassTask=true;
+      //    }
+      //  }else{//不需要保存直接可以通过
+      //    isPassTask=true;
+      //  }
+      // if(isPassTask==false){
+      //   this.$message.error("请先保存表单数据!")
+      //   return;
+      // }
+
+      this.modalTaskTitle = '审批通过'
+      this.form.id = v.id
+      this.form.procInstId = v.procInstId
+      this.form.priority = v.priority
+      this.form.type = 0
+      this.modalTaskVisible = true
+      this.userLoading = true
+      getAction(this.url.getNextNode, { procDefId: v.procDefId, currActId: v.key ,procInstId:v.procInstId}).then(res => {
+        this.userLoading = false
+        if (res.success) {
+          if (res.result.type == 3 || res.result.type == 4) {
+            this.isGateway = true
+            this.showAssign = false
+            this.error = ''
+            return
+          }
+          this.isGateway = false
+          if (res.result.users && res.result.users.length > 0) {
+            this.error = ''
+            this.assigneeList = res.result.users
+            // 默认勾选
+            let ids = []
+            res.result.users.forEach(e => {
+              ids.push(e.username)
+            })
+            this.form.assignees = ids
+            this.showAssign = true
+          } else {
+            this.form.assignees = []
+            this.showAssign = false
+          }
+        }
+      })
+    },
+    changeBackTask(v) {
+      if (v == '-1') {
+        return
+      }
+      this.userLoading = true
+      getAction(this.url.getNode + v).then(res => {
+        this.userLoading = false
+        if (res.success) {
+          if (res.result.users && res.result.users.length > 0) {
+            this.assigneeList = res.result.users
+            // 默认勾选
+            let ids = []
+            res.result.users.forEach(e => {
+              ids.push(e.username)
+            })
+            this.form.assignees = ids
+          }
+        }
+      })
+    },
+    backTask(v) {
+      this.modalTaskTitle = '审批驳回'
+      this.form.id = v.id
+      this.form.procInstId = v.procInstId
+      this.form.procDefId = v.procDefId
+      this.form.priority = v.priority
+      this.form.type = 1
+      this.showAssign = false
+      this.modalTaskVisible = true
+      // 获取可驳回节点
+      this.backList = [
+        {
+          key: '-1',
+          name: '发起人'
+        }
+      ]
+      this.form.backTaskKey = '-1'
+      this.backLoading = true
+      getAction(this.url.getBackList + v.procInstId).then(res => {
+        this.backLoading = false
+        if (res.success) {
+          res.result.forEach(e => {
+            this.backList.push(e)
+          })
+        }
+      })
+    },
+    delegateTask(v) {
+      this.modalTaskTitle = '委托他人代办'
+      this.form.id = v.id
+      this.form.procInstId = v.procInstId
+      this.form.type = 2
+      this.showAssign = false
+      this.modalTaskVisible = true
+    },
+    async handelSubmit() {
+      console.log('提交')
+      this.submitLoading = true
+      var formData = Object.assign({}, this.form)
+      formData.assignees = formData.assignees.join(',')
+      if (formData.type == 0) {
+        // 通过
+        if (this.showAssign && formData.assignees.length < 1) {
+          this.$message.error('请至少选择一个审批人')
+          this.submitLoading = false
+          return
+        } else {
+          this.error = ''
+        }
+        //是否需要保存表单
+        if (this.disabled == false && this.btndisabled == false) {
+          //调用保存按钮
+          await this.$emit('handleSubmit2');
+          //保存
+          this.postFormAction(this.todoManageOperationObject.url, this.todoManageOperationObject.formData).then(res => {
+            if (res.success) {
+              this.$message.success('保存成功!')
+              //通过
+              postFormAction(this.url.pass, formData).then(res => {
+                this.submitLoading = false
+                if (res.success) {
+                  this.$message.success('操作成功')
+                  this.modalTaskVisible = false
+                  //刷新父组件数据
+                  this.$emit('refreshToDo')
+                }
+              })
+            } else {
+              this.$message.error(res.message)
+              // resolve(false);
+              this.modalTaskVisible = false
+            }
+          })
+        } else {//不需要保存直接通过
+          //通过
+          postFormAction(this.url.pass, formData).then(res => {
+            this.submitLoading = false
+            if (res.success) {
+              this.$message.success('操作成功')
+              this.modalTaskVisible = false
+              //刷新父组件数据
+              this.$emit('refreshToDo')
+            }
+          })
+        }
+      } else if (formData.type == 1) {
+        // 驳回
+        if (formData.backTaskKey == '-1') {
+          // 驳回至发起人
+          postFormAction(this.url.back, formData).then(res => {
+            this.submitLoading = false
+            if (res.success) {
+              this.$message.success('操作成功')
+              this.modalTaskVisible = false
+              //刷新父组件数据
+              this.$emit('refreshToDo')
+            }
+          })
+        } else {
+          // 自定义驳回
+          if (formData.backTaskKey != '-1' && formData.assignees.length < 1) {
+            this.$message.error('请至少选择一个审批人')
+            this.submitLoading = false
+            return
+          } else {
+            this.error = ''
+          }
+          postFormAction(this.url.backToTask, formData).then(res => {
+            this.submitLoading = false
+            if (res.success) {
+              this.$message.success('操作成功')
+              this.modalTaskVisible = false
+              //刷新父组件数据
+              this.$emit('refreshToDo')
+            }
+          })
+        }
+      } else if (formData.type == 2) {
+        // 委托
+        if (!formData.userId) {
+          this.$message.error('请选择一委托人')
+          this.submitLoading = false
+          return
+        } else {
+          this.error = ''
+        }
+        postFormAction(this.url.delegate, formData).then(res => {
+          this.submitLoading = false
+          if (res.success) {
+            this.$message.success('操作成功')
+            this.modalTaskVisible = false
+            //刷新父组件数据
+            this.$emit('refreshToDo')
+          }
+        })
+      }
+    }
+  }
+}
+</script>

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels