Files
SaaS-lib/resource-service/src/view/form/new.vue
xuziqiang d0155dbe3c push
2024-05-15 17:29:42 +08:00

97 lines
2.5 KiB
Vue

<template>
<div>
<ns-form :schemas="formConfig.schemas" />
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
name: 'new',
setup() {
const formConfig = {
schemas: [
{
field: 'cpu',
label: 'CPU',
component: 'NsSelectApi',
autoAddLink: true,
dynamicParams: {
ram: 'fieldLink.ram.ram',
},
componentProps: {
api: '/api/iaas/iaas/objs/FlavorCPU',
resultField: 'data',
labelField: 'cpuCount',
valueField: 'cpuCount',
// immediate: true,
placeholder: '请选择CPU',
firstOption: {
label: '全部',
value: ' ',
},
},
},
{
field: 'ram',
label: '内存',
component: 'NsSelectApi',
autoAddLink: true,
// // 值依赖
dynamicParams: {
cpu: 'fieldLink.cpu.cpuCount',
},
componentProps: {
api: '/api/iaas/iaas/objs/FlavorRam',
resultField: 'data',
labelField: 'ram',
valueField: 'ram',
// immediate: true,
placeholder: '请选择内存',
firstOption: {
label: '全部',
value: ' ',
},
onSelect: () => {
// unref(nsTableRef).triggerSubmit();
},
},
},
{
field: 'ram1',
label: '内存11',
component: 'NsSelectApi',
autoAddLink: true,
// // 值依赖
// dynamicParams: {
// cpu: 'fieldLink.cpu.cpuCount',
// },
componentProps: {
api: '/api/iaas/iaas/objs/FlavorRam',
resultField: 'data',
labelField: 'ram',
valueField: 'ram',
// immediate: true,
placeholder: '请选择内存',
// firstOption: {
// label: '全部',
// value: ' ',
// },
onSelect: () => {
// unref(nsTableRef).triggerSubmit();
},
},
},
],
params: {},
};
return {
formConfig,
};
},
});
</script>
<style lang="scss" scoped></style>