|
@@ -5,14 +5,16 @@
|
|
|
</BasicModal>
|
|
|
</template>
|
|
|
<script lang="ts" setup>
|
|
|
- import { ref, computed, unref } from 'vue';
|
|
|
+ import { ref, computed, unref,onMounted } from 'vue';
|
|
|
//引入依赖
|
|
|
import { useForm, BasicForm, FormSchema } from '/@/components/Form';
|
|
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
|
import { saveOrUpdateDict } from '../api/productCassification.api';
|
|
|
+ import { defHttp } from '/@/utils/http/axios';
|
|
|
const emit = defineEmits(['register', 'success']); //定义emit
|
|
|
const isUpdate = ref(true); //判断编辑还是新增
|
|
|
const rowId = ref('');//获取主键
|
|
|
+ let classOption = []
|
|
|
//获取表单数据
|
|
|
const [registerModal, { closeModal, setModalProps }] = useModalInner(
|
|
|
async (data) => {
|
|
@@ -29,6 +31,22 @@
|
|
|
}
|
|
|
}
|
|
|
)
|
|
|
+ defHttp
|
|
|
+ .get({ url: 'baseCode/baseProductClass/list'}, { isTransformResponse: false })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ res.result.records.forEach(element => {
|
|
|
+ var obj = {
|
|
|
+ label: element.name,
|
|
|
+ value: element.name
|
|
|
+ };
|
|
|
+ classOption.push( obj)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ // loading.value = false;
|
|
|
+ });
|
|
|
//获取title
|
|
|
const getTitle = computed(() => {
|
|
|
return (!unref(isUpdate) ? '新增产品分类(add)' : '编辑产品分类(edit)');
|
|
@@ -41,9 +59,9 @@
|
|
|
//字段
|
|
|
field: 'parentId',
|
|
|
//组件 支持组件详见 components/Form/src/types/index.ts 中的 ComponentType
|
|
|
- component: 'JDictSelectTag',
|
|
|
+ component: 'JSelectInput',
|
|
|
componentProps:{
|
|
|
- dictCode: 'up_class',
|
|
|
+ options: classOption,
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -80,6 +98,12 @@
|
|
|
AutoComplete:'off'
|
|
|
},
|
|
|
},
|
|
|
+ {
|
|
|
+ label: '',
|
|
|
+ field: 'id',
|
|
|
+ component: 'Input',
|
|
|
+ show: false
|
|
|
+ },
|
|
|
];
|
|
|
/**
|
|
|
* BasicForm绑定注册;
|
|
@@ -112,6 +136,7 @@
|
|
|
setModalProps({ confirmLoading: true });
|
|
|
//提交表单
|
|
|
await saveOrUpdateDict(values, isUpdate.value);
|
|
|
+
|
|
|
//关闭弹窗
|
|
|
closeModal();
|
|
|
//刷新列表
|
|
@@ -120,4 +145,5 @@
|
|
|
setModalProps({ confirmLoading: false });
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
</script>
|