|
@@ -14,7 +14,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { ref, watch } from 'vue'
|
|
|
-import { getArrValue, getObjValue } from 'js-fast-way'
|
|
|
+import { deepClone, getArrValue, getObjValue } from 'js-fast-way'
|
|
|
import HcUserModal from './modules/user-modal.vue'
|
|
|
|
|
|
//参数
|
|
@@ -24,6 +24,10 @@ const props = defineProps({
|
|
|
default: '',
|
|
|
},
|
|
|
data: {
|
|
|
+ type: Array,
|
|
|
+ default: () => ([]),
|
|
|
+ },
|
|
|
+ datas: {
|
|
|
type: Object,
|
|
|
default: () => ({}),
|
|
|
},
|
|
@@ -32,20 +36,15 @@ const props = defineProps({
|
|
|
//事件
|
|
|
const emit = defineEmits(['change'])
|
|
|
|
|
|
-//双向绑定
|
|
|
-const datas = defineModel('modelValue', {
|
|
|
- default: () => ([]),
|
|
|
-})
|
|
|
-
|
|
|
//监听基础数据
|
|
|
-const dataInfo = ref(props.data)
|
|
|
-watch(() => props.data, (data) => {
|
|
|
+const dataInfo = ref(props.datas)
|
|
|
+watch(() => props.datas, (data) => {
|
|
|
dataInfo.value = getObjValue(data)
|
|
|
}, { deep: true, immediate: true })
|
|
|
|
|
|
//监听用户数据
|
|
|
-const fixedData = ref([])
|
|
|
-watch(() => datas.value, (data) => {
|
|
|
+const fixedData = ref(props.data)
|
|
|
+watch(() => props.data, (data) => {
|
|
|
fixedData.value = getArrValue(data)
|
|
|
}, { deep: true, immediate: true })
|
|
|
|
|
@@ -57,7 +56,19 @@ const userShowModal = () => {
|
|
|
|
|
|
//选择完成
|
|
|
const fixedUserFinish = (data) => {
|
|
|
- console.log(data)
|
|
|
+ isUserModalShow.value = false
|
|
|
+ const res = getArrValue(data)
|
|
|
+ fixedData.value = res
|
|
|
+ const arr = deepClone(res)
|
|
|
+ for (let i = 0; i < arr.length; i++) {
|
|
|
+ const { userList } = arr[i]
|
|
|
+ let newUserId = []
|
|
|
+ for (let j = 0; j < userList.length; j++) {
|
|
|
+ newUserId.push(userList[j].userId)
|
|
|
+ }
|
|
|
+ arr[i].userIds = newUserId.join(',')
|
|
|
+ }
|
|
|
+ emit('change', arr)
|
|
|
}
|
|
|
</script>
|
|
|
|