|
@@ -27,9 +27,7 @@
|
|
|
:pagination="pagination"
|
|
|
:row-selection="{
|
|
|
getCheckboxProps: (scene: Scene) => ({
|
|
|
- disabled: scene.bind &&
|
|
|
- !defaultTypeNums[params.type].some(num => scene.num === num) ||
|
|
|
- (selectFirstScene && ( scene.type.toString() !== selectType || scene.shootCount !== selectNum ))
|
|
|
+ disabled: isDisableScene(scene)
|
|
|
}),
|
|
|
selectedRowKeys: typeNums[params.type],
|
|
|
onChange: changeSelectNums
|
|
@@ -53,7 +51,7 @@
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { selectSceneColumns as sceneColumns } from './columns'
|
|
|
-import { computed, reactive, ref } from 'vue'
|
|
|
+import { computed, reactive, ref, watchEffect } from 'vue'
|
|
|
import { fetchScenes, SceneType, SceneTypeDesc } from '@/api'
|
|
|
import { usePaging } from '@/hook'
|
|
|
|
|
@@ -92,6 +90,15 @@ const selectNum = computed(() => {
|
|
|
const nums = selectFirstScene.value?.[1]
|
|
|
return nums && props.scenesCount[nums[0]]
|
|
|
})
|
|
|
+const isDisableScene = (scene: Scene) => {
|
|
|
+ return (
|
|
|
+ (scene.bind &&
|
|
|
+ !defaultTypeNums[params.type].some(num => scene.num === num)) ||
|
|
|
+ (selectFirstScene.value &&
|
|
|
+ (scene.type.toString() !== selectType.value ||
|
|
|
+ scene.shootCount !== selectNum.value))
|
|
|
+ )
|
|
|
+}
|
|
|
const { list, pagination } = usePaging(fetchScenes, params)
|
|
|
|
|
|
const updateType = (type: any) => {
|
|
@@ -104,9 +111,11 @@ const changeSelectNums = (nums: any[]) => {
|
|
|
const reserve = currentNums.filter(num =>
|
|
|
list.value.every(scene => scene.num !== num)
|
|
|
)
|
|
|
+
|
|
|
+ const scenes = list.value.filter(item => nums.includes(item.num))
|
|
|
emit('update:sceneList', [
|
|
|
...props.sceneList.filter(item => item.type === params.type),
|
|
|
- ...list.value.filter(item => nums.includes(item.num))
|
|
|
+ ...scenes
|
|
|
])
|
|
|
|
|
|
emit('update:typeNums', {
|
|
@@ -114,6 +123,27 @@ const changeSelectNums = (nums: any[]) => {
|
|
|
[params.type]: [...reserve, ...nums]
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+watchEffect(() => {
|
|
|
+ const scenes = props.sceneList.filter(scene => !isDisableScene(scene))
|
|
|
+ if (scenes.length === props.sceneList.length) return
|
|
|
+
|
|
|
+ const typeNums = scenes.reduce(
|
|
|
+ (t, scene) => {
|
|
|
+ t[scene.type].push(scene.num)
|
|
|
+ return t
|
|
|
+ },
|
|
|
+ {
|
|
|
+ [SceneType.SWKJ]: [],
|
|
|
+ [SceneType.SWKK]: [],
|
|
|
+ [SceneType.SWSS]: [],
|
|
|
+ [SceneType.SWSG]: []
|
|
|
+ } as SelectTypeScenes
|
|
|
+ )
|
|
|
+
|
|
|
+ emit('update:sceneList', scenes)
|
|
|
+ emit('update:typeNums', typeNums)
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|