Commit 4eb4c405a0db7d20c1c942e939ec545957edd32b

Authored by loveumiko
1 parent a50efc3d

fix: 修复场景联动查看全部都要置灰,不允许点击,还有数据流转中的数据源

... ... @@ -126,10 +126,16 @@
126 126 }
127 127 }
128 128
129   - async function handleFetch() {
130   - if (!props.immediate && unref(isFirstLoad)) {
  129 + // async function handleFetch() {
  130 + // if (!props.immediate && unref(isFirstLoad)) {
  131 + // await fetch();
  132 + // isFirstLoad.value = false;
  133 + // }
  134 + // }
  135 +
  136 + async function handleFetch(open) {
  137 + if (open) {
131 138 await fetch();
132   - isFirstLoad.value = false;
133 139 }
134 140 }
135 141
... ...
... ... @@ -30,12 +30,14 @@
30 30 modalProps?: ExtractPropTypes<InstanceType<typeof BasicModal>['$props']>;
31 31 transferProps?: ExtractPropTypes<TransferType['$props']>;
32 32 buttonProps?: ExtractPropTypes<InstanceType<typeof Button>['$props']>;
  33 + disabled?: any;
33 34 }>(),
34 35 {
35 36 labelField: 'label',
36 37 valueField: 'value',
37 38 buttonName: '选择产品',
38 39 maxTagLength: 2,
  40 + disabled: false,
39 41 }
40 42 );
41 43
... ... @@ -146,6 +148,8 @@
146 148 );
147 149
148 150 const handleOpenModal = () => {
  151 + const { disabled } = props;
  152 + if (disabled) return;
149 153 openModal(true);
150 154 };
151 155
... ...
... ... @@ -42,6 +42,7 @@
42 42 onValueChange?: (selectedRowkeys: string[]) => any[];
43 43 onRemoveAfter?: (actionType: ActionType) => Promise<any>;
44 44 onSelectedAfter?: (actionType: ActionType) => Promise<any>;
  45 + disabled?: any;
45 46 }>(),
46 47 {
47 48 buttonName: '选择设备',
... ... @@ -49,6 +50,7 @@
49 50 maxTagLength: 2,
50 51 labelField: 'label',
51 52 valueField: 'value',
  53 + disabled: false,
52 54 }
53 55 );
54 56
... ... @@ -217,6 +219,8 @@
217 219 }
218 220
219 221 const handleOpenModal = async () => {
  222 + const { disabled } = props;
  223 + if (disabled) return;
220 224 openModal(true);
221 225 await nextTick();
222 226 if (props.value && !props.value.length) {
... ...
... ... @@ -61,7 +61,6 @@
61 61 //input动态数据
62 62 const dynamicInput: UnwrapRef<{ params: Params[] }> = reactive({ params: [] });
63 63
64   - console.log(dynamicInput, 'dynamicInput');
65 64 //删除Input
66 65 const remove = (item: Params) => {
67 66 let index = dynamicInput.params.indexOf(item);
... ... @@ -71,11 +70,6 @@
71 70 emitChange();
72 71 };
73 72
74   - // const disabled = computed(() => {
75   - // const { disabled } = props || {};
76   - // return disabled;
77   - // });
78   -
79 73 //新增Input
80 74 const add = () => {
81 75 dynamicInput.params.push({
... ...
... ... @@ -16,6 +16,7 @@
16 16 import { BasicInfoFormField } from './enum';
17 17 import { BasicInfoRecord } from './types';
18 18 import { Button } from 'ant-design-vue';
  19 + import { ref, unref } from 'vue';
19 20
20 21 const props = defineProps({
21 22 saveContent: {
... ... @@ -25,8 +26,9 @@
25 26
26 27 const emit = defineEmits(['currentDataFlowMethodEmitNext']);
27 28
  29 + const disabled = ref<boolean>(false);
28 30 const [register, { validateFields, setFieldsValue, resetFields, setProps }] = useForm({
29   - schemas: modeForm(props.saveContent),
  31 + schemas: modeForm(props.saveContent, unref(disabled)),
30 32 ...modelFormPublicConfig,
31 33 });
32 34
... ... @@ -61,12 +63,21 @@
61 63 emit('currentDataFlowMethodEmitNext', getValue());
62 64 };
63 65
  66 + const setDisabledProps = (value) => {
  67 + setProps(value);
  68 + disabled.value = false;
  69 + };
  70 + const setCancelDisabled = () => {
  71 + disabled.value = false;
  72 + };
  73 +
64 74 const resetValue = () => resetFields();
65 75 defineExpose({
66 76 getValue,
67 77 setValue,
68 78 resetValue,
69   - setProps,
  79 + setDisabledProps,
  80 + setCancelDisabled,
70 81 });
71 82 </script>
72 83 <style lang="less" scoped>
... ...
... ... @@ -75,7 +75,9 @@
75 75 const { text, record } = data;
76 76 businessText.value = text;
77 77 if (businessText.value == BusinessDataFlowTextEnum.BUSINESS_MODAL_VIEW_TEXT) {
78   - dataFlowMethodRef.value?.setProps({ disabled: true });
  78 + dataFlowMethodRef.value?.setDisabledProps({ disabled: true });
  79 + } else {
  80 + dataFlowMethodRef.value?.setCancelDisabled();
79 81 }
80 82 restData.data = record;
81 83 setModalProps(modalProps(businessText.value));
... ...
... ... @@ -150,7 +150,10 @@ const TransferTableProps: BasicTableProps = {
150 150 fetchSetting: FETCH_SETTING,
151 151 } as BasicTableProps;
152 152
153   -export const modeForm = (submitFn?: Function): FormSchema[] => {
  153 +export const modeForm = (
  154 + submitFn: Function | undefined,
  155 + disabled?: boolean | any
  156 +): FormSchema[] => {
154 157 return [
155 158 {
156 159 field: BasicInfoFormField.CONVERT_CONFIG_ID,
... ... @@ -187,6 +190,7 @@ export const modeForm = (submitFn?: Function): FormSchema[] => {
187 190 api: getDeviceProfile,
188 191 labelField: 'name',
189 192 valueField: 'tbProfileId',
  193 + disabled,
190 194 transferProps: {
191 195 listStyle: { height: '400px' },
192 196 showSearch: true,
... ... @@ -222,6 +226,7 @@ export const modeForm = (submitFn?: Function): FormSchema[] => {
222 226 labelField: 'name',
223 227 valueField: 'tbDeviceId',
224 228 primaryKey: 'tbDeviceId',
  229 + disabled,
225 230 pendingTableProps: {
226 231 ...TransferTableProps,
227 232 api: devicePage,
... ...
... ... @@ -208,7 +208,15 @@
208 208 };
209 209 const [
210 210 registerAction,
211   - { getFieldsValue, resetFields, setFieldsValue, validate, clearValidate, validateFields },
  211 + {
  212 + getFieldsValue,
  213 + resetFields,
  214 + setFieldsValue,
  215 + validate,
  216 + clearValidate,
  217 + validateFields,
  218 + setProps,
  219 + },
212 220 ] = useForm({
213 221 schemas: actionSchema,
214 222 showActionButtonGroup: false,
... ...