refactor: 系统管理页面重构和ts类型声明优化

Former-commit-id: 40263bbb072596ada41ef33d9170841e7e66cd01
This commit is contained in:
郝先瑞
2022-06-15 00:48:17 +08:00
parent 928ba2dbd8
commit 321b584f9f
116 changed files with 1692 additions and 1485 deletions

View File

@@ -89,20 +89,20 @@ const dataFormRef = ref(ElForm);
const props = defineProps({
modelValue: {
type: Object,
default: () => {}
}
default: () => {},
},
});
const goodsInfo: any = computed({
get: () => props.modelValue,
set: value => {
set: (value) => {
emit('update:modelValue', value);
}
},
});
watch(
() => goodsInfo.value.categoryId,
newVal => {
(newVal) => {
// 商品编辑不加载分类下的属性
const goodsId = goodsInfo.value.id;
if (goodsId) {
@@ -111,7 +111,7 @@ watch(
// 商品新增加载默认分类下的属性
if (newVal) {
// type=2 商品分类下的属性
listAttributes({ categoryId: newVal, type: 2 }).then(response => {
listAttributes({ categoryId: newVal, type: 2 }).then((response) => {
const attrList = response.data;
if (attrList && attrList.length > 0) {
goodsInfo.value.attrList = attrList;
@@ -125,15 +125,15 @@ watch(
},
{
immediate: true,
deep: true
deep: true,
}
);
const state = reactive({
rules: {
name: [{ required: true, message: '请填写属性名称', trigger: 'blur' }],
value: [{ required: true, message: '请填写属性值', trigger: 'blur' }]
}
value: [{ required: true, message: '请填写属性值', trigger: 'blur' }],
},
});
const { rules } = toRefs(state);