fjl
fujunling
2023-07-18 2c6c24281d4c261b172d02a98df9524cffc0c276
Source/UBCS-WEB/src/components/template/SetPersonnel.vue
@@ -52,7 +52,9 @@
            typeof: String,
            default: '流程审批'
        },
        // 参数:选择的id,多个以数组方式传递:['id','id'],模板id,模板用途,流程名字,流程模板
        // 参数:选择的id,多个以数组方式传递:['id','id'],模板id,模板用途,流程名字,流程模板,
        // flowTemplate:
        // vars:object格式,名字为vars,里面key键值,自己随意
        parameter: {
            typeof: Object,
            default: () => { }
@@ -74,6 +76,7 @@
        visible(n) {
            this.dialogVisible = n;
            if (n) {
              this.saveParam=this.setSaveParam();
                this.apiInit()
                this.apiDict()
            }
@@ -88,7 +91,12 @@
            },
            deep:true,
            immediate:true
        }
        },
      parameter:{
          handler(newval,oldval){
            console.log('子',newval)
          }
      }
    },
    data() {
        return {
@@ -98,7 +106,7 @@
            tags: [],
            typeName: [],
            collectParam: {},
            saveParam: this.saveParam(),
            saveParam: this.setSaveParam(),
            users: [],
            rules: {
                processName: [
@@ -110,22 +118,23 @@
    },
    mounted() {
        // this.apiInit()
        // this.apiDict()
    },
    methods: {
        saveParam() {
    created() {
  },
  methods: {
        setSaveParam() {
            return {
                processName: this.parameter[this.parameterKeys.flowTemplate],
                topName: this.title,
                ids: this.parameter[this.parameterKeys.ids],
                vars:this.parameter['vars']
            }
        },
        userIndex(arr1) {
            return this.initFrom.findIndex(i => i.taskId === arr1)
        },
        async apiInit() {
            const response = await personnelInit({ type: this.parameter[this.parameterKeys.type], templateId: this.parameter[this.parameterKeys.code] })
            const response = await personnelInit({ type: this.parameter[this.parameterKeys.type], templateId: this.parameter[this.parameterKeys.code]})
            if (response.status === 200) {
                console.log(response)
                this.initFrom = response.data.data.user
@@ -133,6 +142,7 @@
                const { modelKey, templateId, modelName } = response.data.data.flow
                let flowTaskUsers = response.data.data.user
                this.collectParam = { modelKey, templateId, flowTaskUsers: flowTaskUsers }
                this.users = response.data.data.user
                console.log(this.collectParam)
                this.saveParam = { ...this.saveParam, modelKey, templateId, modelName }
                if (this.tags.length !== 0) this.handleClickTag(this.tags[0])
@@ -196,16 +206,17 @@
                        message: "请选择节点!"
                    });
                } else {
                    console.log('baoc')
                    // const response = await personnelSave({ ...this.saveParam, flowTaskUsers: this.collectParam.flowTaskUsers })
                    // if (response.status === 200) {
                    //     console.log(response)
                    //     this.$message({
                    //         type: 'success',
                    //         message: response.data.msg
                    //     });
                    //     this.done()
                    // }
                    const {modelKey,modelName,processDesc,processName,templateId,topName,vars,ids} = this.saveParam
                    const vals= {modelKey,modelName,processDesc,processName,templateId,topName,ids,...vars}
                    const response = await personnelSave({ variables:vals, flowTaskUsers: this.collectParam.flowTaskUsers, })
                    if (response.status === 200) {
                        console.log(response)
                        this.$message({
                            type: 'success',
                            message: response.data.msg
                        });
                        this.done()
                    }
                }
            } catch {
@@ -248,6 +259,7 @@
        handleSelect(event, index) {
            const res = this.typeName.find(item => item.userId === event)
            const { userName } = res
            console.log(this.users)
            this.$set(this.users, index, { ... this.collectParam.flowTaskUsers[index], userName })
            // this.users[index] = { ... this.collectParam.flowTaskUsers[index], userName }
            console.log(this.users)