|
@@ -14,20 +14,14 @@
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="处理方">
|
|
<el-form-item label="处理方">
|
|
- <el-select v-if="item.handleType === 0" v-model="item.handleValue" placeholder="请选择处理方">
|
|
|
|
- <el-option
|
|
|
|
- v-for="item in personOptions"
|
|
|
|
- :key="item.value"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value">
|
|
|
|
- </el-option>
|
|
|
|
- </el-select>
|
|
|
|
<el-cascader
|
|
<el-cascader
|
|
- v-if="item.handleType === 1"
|
|
|
|
v-model="item.handleValue"
|
|
v-model="item.handleValue"
|
|
|
|
+ :ref="`cascader_${index}`"
|
|
placeholder="请选择处理方"
|
|
placeholder="请选择处理方"
|
|
- :props="organizationProp"
|
|
|
|
- :options="organizationTree"
|
|
|
|
|
|
+ :show-all-levels="false"
|
|
|
|
+ :props="item.handleType === 0 ? personOptions : organizationProp"
|
|
|
|
+ :options="item.handleType === 0 ? personOrganizationTree : postOrganizationTree"
|
|
|
|
+ @change="onChangeCascader(item, `cascader_${index}`)"
|
|
></el-cascader>
|
|
></el-cascader>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<div class="button-group">
|
|
<div class="button-group">
|
|
@@ -47,10 +41,23 @@
|
|
import {
|
|
import {
|
|
saveWorkflow
|
|
saveWorkflow
|
|
} from '@/api/workflow'
|
|
} from '@/api/workflow'
|
|
|
|
+import {
|
|
|
|
+ getOrganizationAtlasEmployee,
|
|
|
|
+ getOrganizationAtlasPostName
|
|
|
|
+} from '@/api/system'
|
|
import { mapGetters } from 'vuex'
|
|
import { mapGetters } from 'vuex'
|
|
|
|
+import { cloneDeep } from 'lodash'
|
|
export default {
|
|
export default {
|
|
name: 'workflowApproved',
|
|
name: 'workflowApproved',
|
|
data () {
|
|
data () {
|
|
|
|
+ const defaultOptions = {
|
|
|
|
+ lazy: true,
|
|
|
|
+ emitPath: false,
|
|
|
|
+ value: 'organizationNo',
|
|
|
|
+ label: 'organizationName',
|
|
|
|
+ children: 'child'
|
|
|
|
+ }
|
|
|
|
+ const _this = this
|
|
return {
|
|
return {
|
|
key: 0,
|
|
key: 0,
|
|
formValues: {
|
|
formValues: {
|
|
@@ -64,24 +71,28 @@ export default {
|
|
]
|
|
]
|
|
},
|
|
},
|
|
item: {},
|
|
item: {},
|
|
- personOptions: [],
|
|
|
|
|
|
+ personOptions: {
|
|
|
|
+ ...defaultOptions,
|
|
|
|
+ async lazyLoad (node, resolve) {
|
|
|
|
+ _this.onSearch(node, resolve, getOrganizationAtlasEmployee)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
organizationProp: {
|
|
organizationProp: {
|
|
- lazy: true,
|
|
|
|
- value: 'organizationNo',
|
|
|
|
- label: 'organizationName',
|
|
|
|
- children: 'child',
|
|
|
|
- checkStrictly: true,
|
|
|
|
- lazyLoad (node, resolve) {
|
|
|
|
- if (node.children) {
|
|
|
|
- return resolve(node.children)
|
|
|
|
- }
|
|
|
|
- console.log(11)
|
|
|
|
|
|
+ ...defaultOptions,
|
|
|
|
+ async lazyLoad (node, resolve) {
|
|
|
|
+ _this.onSearch(node, resolve, getOrganizationAtlasPostName)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
- ...mapGetters(['organizationTree'])
|
|
|
|
|
|
+ ...mapGetters(['organizationTree']),
|
|
|
|
+ personOrganizationTree () {
|
|
|
|
+ return cloneDeep(this.organizationTree)
|
|
|
|
+ },
|
|
|
|
+ postOrganizationTree () {
|
|
|
|
+ return cloneDeep(this.organizationTree)
|
|
|
|
+ }
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
open (item) {
|
|
open (item) {
|
|
@@ -126,9 +137,45 @@ export default {
|
|
onDelete (index) {
|
|
onDelete (index) {
|
|
this.formValues.items.splice(index, 1)
|
|
this.formValues.items.splice(index, 1)
|
|
},
|
|
},
|
|
|
|
+ // 情况选项
|
|
onChange (item) {
|
|
onChange (item) {
|
|
item.handleValue = null
|
|
item.handleValue = null
|
|
},
|
|
},
|
|
|
|
+ async onSearch (node, resolve, api) {
|
|
|
|
+ const nodeData = node.data
|
|
|
|
+ if (!nodeData.hasChildren) {
|
|
|
|
+ return resolve()
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ const { data } = await api({
|
|
|
|
+ organizationNo: node.value
|
|
|
|
+ })
|
|
|
|
+ resolve(data.nodes.map(e => {
|
|
|
|
+ return {
|
|
|
|
+ organizationNo: e.id,
|
|
|
|
+ organizationName: e.text,
|
|
|
|
+ leaf: true
|
|
|
|
+ }
|
|
|
|
+ }))
|
|
|
|
+ } catch (error) {
|
|
|
|
+ resolve()
|
|
|
|
+ this.$message.error(error)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 提交参数格式化
|
|
|
|
+ onChangeCascader (item, ref) {
|
|
|
|
+ if (item.handleType === 0) {
|
|
|
|
+ item.handleValueData = {
|
|
|
|
+ userId: item.handleValue
|
|
|
|
+ }
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ const node = this.$refs[ref][0].getCheckedNodes()[0]
|
|
|
|
+ item.handleValueData = {
|
|
|
|
+ organizationNo: node.parent.value,
|
|
|
|
+ postName: node.value
|
|
|
|
+ }
|
|
|
|
+ },
|
|
async onSure () {
|
|
async onSure () {
|
|
try {
|
|
try {
|
|
await saveWorkflow({
|
|
await saveWorkflow({
|
|
@@ -139,7 +186,9 @@ export default {
|
|
sort: index
|
|
sort: index
|
|
}
|
|
}
|
|
}),
|
|
}),
|
|
- workFlowTmplate: this.item.workFlowTmplate
|
|
|
|
|
|
+ workFlowTmplate: {
|
|
|
|
+ workFlowTmplateId: this.item.workFlowTmplate.workFlowTmplateId
|
|
|
|
+ }
|
|
})
|
|
})
|
|
this.$message.success('保存成功')
|
|
this.$message.success('保存成功')
|
|
} catch (error) {
|
|
} catch (error) {
|