$effect(() => {
$request("/dictionary/listDictionaryByCondition", {
method: "post",
data: { dictionaryTypeCode: "SYS_BASE_DATA_AGGREGATE_TYPE" },
}).then((res) => {
$self.dataSource = res.data?.map((x) => ({ label: x.name, value: x.code }))
})
}, [])
$effect(() => {
$form.query("ee").take((target) => {
const result = (target?.value || []).reduce((prev, cur) => {
return Number(prev) + Number(cur.total)
}, 0)
console.log(result)
$form.setValuesIn("ff", result)
})
}, [$deps.price, $deps.count])
$props({
// 弹框内的表单是否需要校验
modalvalidate: true,
// 点击弹框确认按钮后执行
modalconfirm: (values) => {
// values 是弹框表单的值
// $form.setValuesIn("assetSeller", values)
// 只需要改变自身的值(随机数即可)
// assetSeller 配置依赖当前组件
$self.value = Math.random()
},
})
$props({
fieldNames: {
label: "name",
value: "id",
},
})
$effect(() => {
$request("/org/organization/listOrganizationByCondition", {
method: "post",
data: { companyId: "1", dimensionId: "1" },
}).then((res) => {
$self.dataSource = res.data
})
}, [])
$effect(() => {
$request("/org/member/listMemberByPage", {
method: "post",
data: {
current: 1,
pageSize: 100,
organizationId: $deps.assignDepart,
},
}).then((res) => {
$self.dataSource = res.data.records?.map((x) => ({
label: x.name,
value: x.id,
}))
})
}, [$deps.assignDepart])
$props({
fieldNames: {
label: "name",
value: "code",
},
})
$effect(() => {
$request("/dictionary/listDictionaryByCondition", {
method: "post",
data: { dictionaryTypeCode: "code_distract" },
}).then((res) => {
$self.dataSource = res.data
})
}, [])
---------------前端搜索--------------------------------
树:
$props({
fieldNames: {
label: "name",
value: "id",
},
treeNodeFilterProp: "name",
})
下拉框:
$props({
optionFilterProp: "label",
})
---------------后端搜索--------------------------------
下拉框:
const state = $observable({
keyword: "",
timer: null,
})
$props({
filterOption: false,
onSearch(keyword) {
if (state.timer) {
clearTimeout(state.timer)
state.timer = null
}
state.timer = setTimeout(() => {
state.keyword = keyword
}, 300)
},
})
$effect(() => {
$request("/dictionary/listDictionaryByCondition", {
method: "post",
data: {
dictionaryTypeCode: "code_distract",
name: state.keyword,
},
}).then((res) => {
$self.dataSource = res.data?.map((x) => ({
label: x.name,
value: x.code,
}))
})
}, [state.keyword])
树:
const state = $observable({
keyword: "",
timer: null,
})
$props({
fieldNames: {
label: "name",
value: "id",
},
filterTreeNode: false,
onSearch(keyword) {
if (state.timer) {
clearTimeout(state.timer)
state.timer = null
}
state.timer = setTimeout(() => {
state.keyword = keyword
}, 300)
},
})
$effect(() => {
$request("/org/organization/listOrganizationByCondition", {
method: "post",
data: {
companyId: "1",
dimensionId: "1",
name: state.keyword,
},
}).then((res) => {
$self.dataSource = res.data
})
}, [state.keyword])