Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
华润手术跟台
admin
Commits
6cf57367
提交
6cf57367
authored
11月 07, 2022
作者:
leon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix ApiSelect.vue 重复查询问题
上级
07c762f0
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
15 行增加
和
8 行删除
+15
-8
index.ts
src/commonSchemaProperty/index.ts
+1
-0
ApiSelect.vue
src/components/Form/src/components/ApiSelect.vue
+14
-8
没有找到文件。
src/commonSchemaProperty/index.ts
浏览文件 @
6cf57367
...
@@ -124,6 +124,7 @@ const getHospitalIdAndDoctorId = ({ colProps }) => {
...
@@ -124,6 +124,7 @@ const getHospitalIdAndDoctorId = ({ colProps }) => {
getHospitalId
({
getHospitalId
({
colProps
,
colProps
,
onChange
:
({
formActionType
,
formModel
,
e
})
=>
{
onChange
:
({
formActionType
,
formModel
,
e
})
=>
{
console
.
log
(
'onChange'
,
e
);
const
{
updateSchema
}
=
formActionType
;
const
{
updateSchema
}
=
formActionType
;
updateSchema
([
updateSchema
([
{
field
:
'doctorId'
,
componentProps
:
{
params
:
{
hospitalId
:
e
.
value
}
}
},
{
field
:
'doctorId'
,
componentProps
:
{
params
:
{
hospitalId
:
e
.
value
}
}
},
...
...
src/components/Form/src/components/ApiSelect.vue
浏览文件 @
6cf57367
...
@@ -21,15 +21,16 @@
...
@@ -21,15 +21,16 @@
</Select>
</Select>
</template>
</template>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
PropType
,
ref
,
watchEffect
,
computed
,
unref
,
watch
}
from
'vue'
;
import
{
defineComponent
,
PropType
,
ref
,
watchEffect
,
computed
,
unref
,
watch
,
reactive
}
from
'vue'
;
import
{
Select
}
from
'ant-design-vue'
;
import
{
Select
}
from
'ant-design-vue'
;
import
{
isFunction
}
from
'/@/utils/is'
;
import
{
isFunction
}
from
'/@/utils/is'
;
import
{
useRuleFormItem
}
from
'/@/hooks/component/useFormItem'
;
import
{
useRuleFormItem
}
from
'/@/hooks/component/useFormItem'
;
import
{
useAttrs
}
from
'/@/hooks/core/useAttrs'
;
import
{
useAttrs
}
from
'/@/hooks/core/useAttrs'
;
import
{
get
,
omit
}
from
'lodash-es'
;
import
{
cloneDeep
,
get
,
omit
}
from
'lodash-es'
;
import
{
LoadingOutlined
}
from
'@ant-design/icons-vue'
;
import
{
LoadingOutlined
}
from
'@ant-design/icons-vue'
;
import
{
useI18n
}
from
'/@/hooks/web/useI18n'
;
import
{
useI18n
}
from
'/@/hooks/web/useI18n'
;
import
{
propTypes
}
from
'/@/utils/propTypes'
;
import
{
propTypes
}
from
'/@/utils/propTypes'
;
import
{
deepMerge
}
from
'/@/utils'
;
type
OptionsItem
=
{
label
:
string
;
value
:
string
;
disabled
?:
boolean
};
type
OptionsItem
=
{
label
:
string
;
value
:
string
;
disabled
?:
boolean
};
...
@@ -67,7 +68,7 @@
...
@@ -67,7 +68,7 @@
const
emitData
=
ref
<
any
[]
>
([]);
const
emitData
=
ref
<
any
[]
>
([]);
const
attrs
=
useAttrs
();
const
attrs
=
useAttrs
();
const
{
t
}
=
useI18n
();
const
{
t
}
=
useI18n
();
let
oldParams
=
reactive
({});
// Embedded in the form, just use the hook binding to perform form verification
// Embedded in the form, just use the hook binding to perform form verification
const
[
state
]
=
useRuleFormItem
(
props
,
'value'
,
'change'
,
emitData
);
const
[
state
]
=
useRuleFormItem
(
props
,
'value'
,
'change'
,
emitData
);
...
@@ -88,27 +89,29 @@
...
@@ -88,27 +89,29 @@
});
});
watchEffect
(()
=>
{
watchEffect
(()
=>
{
props
.
immediate
&&
!
props
.
alwaysLoad
&&
fetch
();
props
.
immediate
&&
!
props
.
alwaysLoad
&&
isFirstLoad
.
value
&&
fetch
();
isFirstLoad
.
value
=
false
;
});
});
watch
(
watch
(
()
=>
props
.
params
,
()
=>
props
.
params
,
()
=>
{
()
=>
{
console
.
log
(
'aaaa'
);
console
.
log
(
'props.params'
,
props
.
params
);
console
.
log
(
'oldParams'
,
oldParams
);
if
(
JSON
.
stringify
(
oldParams
)
!==
JSON
.
stringify
(
props
.
params
))
{
!
unref
(
isFirstLoad
)
&&
fetch
();
!
unref
(
isFirstLoad
)
&&
fetch
();
}
},
},
{
deep
:
true
},
{
deep
:
true
},
);
);
async
function
fetch
()
{
async
function
fetch
()
{
if
(
!
isFirstLoad
.
value
)
{
isFirstLoad
.
value
=
false
;
}
const
api
=
props
.
api
;
const
api
=
props
.
api
;
if
(
!
api
||
!
isFunction
(
api
))
return
;
if
(
!
api
||
!
isFunction
(
api
))
return
;
options
.
value
=
[];
options
.
value
=
[];
try
{
try
{
loading
.
value
=
true
;
loading
.
value
=
true
;
oldParams
=
cloneDeep
(
props
.
params
);
const
res
=
await
api
(
props
.
params
);
const
res
=
await
api
(
props
.
params
);
if
(
Array
.
isArray
(
res
))
{
if
(
Array
.
isArray
(
res
))
{
options
.
value
=
res
;
options
.
value
=
res
;
...
@@ -129,9 +132,12 @@
...
@@ -129,9 +132,12 @@
async
function
handleFetch
(
visible
)
{
async
function
handleFetch
(
visible
)
{
if
(
visible
)
{
if
(
visible
)
{
if
(
props
.
alwaysLoad
)
{
if
(
props
.
alwaysLoad
)
{
console
.
log
(
'handleFetc alwaysLoadh'
);
await
fetch
();
await
fetch
();
}
else
if
(
!
props
.
immediate
&&
unref
(
isFirstLoad
))
{
}
else
if
(
!
props
.
immediate
&&
unref
(
isFirstLoad
))
{
console
.
log
(
'handleFetch immediate'
);
await
fetch
();
await
fetch
();
isFirstLoad
.
value
=
false
;
}
}
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论