13 changed files with 832 additions and 288 deletions
@ -0,0 +1,104 @@ |
|||
<!-- |
|||
@ 作者: 秦东 |
|||
@ 时间: 2023-10-19 08:13:15 |
|||
@ 备注: 行政岗位 |
|||
--> |
|||
<script lang='ts' setup> |
|||
import { positionList, searchPostName, getPostList, searchVal } from '@/components/workflow/dialog/common' |
|||
import $func from '@/utils/workflow/index' |
|||
//引入样式 |
|||
import '@/styles/workflowcss/dialog.scss' |
|||
//引入页面 |
|||
import selectBox from '@/components/workflow/selectBoxs.vue' |
|||
import selectResult from '@/components/workflow/selectResult.vue' |
|||
|
|||
let props = defineProps({ |
|||
visible: { |
|||
type: Boolean, |
|||
default: false |
|||
}, |
|||
data: { |
|||
type: Array, |
|||
default: () => [] |
|||
} |
|||
}); |
|||
let checkedRoleList = ref([]) |
|||
let emits = defineEmits(['update:visible', 'change']) |
|||
let list = computed(() => { |
|||
return [{ |
|||
type: 'position', |
|||
data: positionList.value, |
|||
isActive: (item) => $func.toggleClass(checkedRoleList.value, item, 'id'), |
|||
// change: (item) => { |
|||
// checkedRoleList.value = [item] |
|||
// } |
|||
change: (item)=> $func.toChecked(checkedRoleList.value, item), |
|||
}] |
|||
}) |
|||
let resList = computed(() => { |
|||
return [{ |
|||
type: 'position', |
|||
data: checkedRoleList.value, |
|||
// cancel: (item) => $func.removeEle(checkedRoleList.value, item, 'id') |
|||
cancel: (item)=> $func.removeEle(checkedRoleList.value, item) |
|||
}] |
|||
}) |
|||
let visibleDialog = computed({ |
|||
get() { |
|||
return props.visible |
|||
}, |
|||
set(val) { |
|||
closeDialog() |
|||
} |
|||
}) |
|||
watch(() => props.visible, (val) => { |
|||
if (val) { |
|||
getPostList(); |
|||
searchVal.value = ""; |
|||
checkedRoleList.value = props.data.map(({ name, targetId }) => ({ |
|||
name: name, |
|||
id: targetId |
|||
})); |
|||
} |
|||
}) |
|||
let total = computed(() => checkedRoleList.value.length) |
|||
const saveDialog = () => { |
|||
let checkedList = checkedRoleList.value.map(item => ({ |
|||
type: "position", |
|||
targetId: item.id, |
|||
name: item.name |
|||
})) |
|||
emits('change', checkedList) |
|||
} |
|||
const delList = () => { |
|||
checkedRoleList.value = []; |
|||
} |
|||
|
|||
const closeDialog = () => { |
|||
emits('update:visible', false) |
|||
} |
|||
</script> |
|||
<template> |
|||
<el-dialog v-model="visibleDialog" title="选择岗位" :width="600" append-to-body class="promoter_person"> |
|||
<div class="person_body clear"> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<div class="person_tree l"> |
|||
<input v-model="searchVal" type="text" placeholder="搜索岗位" @input="searchPostName($event,2)"> |
|||
<selectBox :list="list"/> |
|||
</div> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<selectResult :list="resList" :total="total" @del="delList"/> |
|||
</el-col> |
|||
</el-row> |
|||
</div> |
|||
<template #footer> |
|||
<el-button @click="closeDialog">取 消</el-button> |
|||
<el-button type="primary" @click="saveDialog">确 定</el-button> |
|||
</template> |
|||
</el-dialog> |
|||
</template> |
|||
<style lang='scss' scoped> |
|||
|
|||
</style> |
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue