Compare commits
3 Commits
6f8a3e72a5
...
8524d2112e
| Author | SHA1 | Date | |
|---|---|---|---|
| 8524d2112e | |||
| fd35dc532b | |||
| cc5d380551 |
@@ -73,7 +73,7 @@ const props = withDefaults(defineProps<UploadFileProps>(), {
|
||||
drag: true,
|
||||
disabled: false,
|
||||
fileSize: 5,
|
||||
fileType: () => ["image/jpeg", "image/png", "image/gif"],
|
||||
fileType: () => ["image/jpeg", "image/png", "image/gif", "image/webp"],
|
||||
height: "150px",
|
||||
width: "150px",
|
||||
borderRadius: "8px"
|
||||
@@ -151,7 +151,9 @@ const editImg = () => {
|
||||
* @param rawFile 选择的文件
|
||||
* */
|
||||
const beforeUpload: UploadProps["beforeUpload"] = rawFile => {
|
||||
// console.log(rowFile.type, "=============1111111111");
|
||||
const imgSize = rawFile.size / 1024 / 1024 < props.fileSize;
|
||||
|
||||
const imgType = props.fileType.includes(rawFile.type as File.ImageMimeType);
|
||||
|
||||
if (!imgType)
|
||||
|
||||
@@ -66,7 +66,7 @@ const props = withDefaults(defineProps<UploadFileProps>(), {
|
||||
disabled: false,
|
||||
limit: 9,
|
||||
fileSize: 5,
|
||||
fileType: () => ["image/jpeg", "image/png", "image/gif"],
|
||||
fileType: () => ["image/jpeg", "image/png", "image/gif", "image/webp"],
|
||||
height: "150px",
|
||||
width: "150px",
|
||||
borderRadius: "8px"
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
show-checkbox
|
||||
check-strictly
|
||||
@change="handleSelectChange(_ruleForm[`${item.prop}`], item.prop)"
|
||||
style="max-width: 240px"
|
||||
style="max-width: 340px"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="item.type === 'treeSelects'">
|
||||
@@ -171,7 +171,7 @@
|
||||
show-checkbox
|
||||
check-strictly
|
||||
check-on-click-node
|
||||
style="width: 240px"
|
||||
style="width: 340px"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="item.type === 'treeSelectInput'">
|
||||
|
||||
@@ -66,6 +66,7 @@ const getArticleClassData = async () => {
|
||||
const result = await getArticleClassDataApi();
|
||||
if (result?.code === 0) {
|
||||
const { data } = result;
|
||||
console.log(data, "============>>>>>");
|
||||
dataStore.formData[1].options = addLabelValue(data);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ export const FORM_DATA: FormItem[] = [
|
||||
{
|
||||
prop: "category_id",
|
||||
placeholder: "请选择",
|
||||
type: "select",
|
||||
type: "treeSelect",
|
||||
isArray: true,
|
||||
label: "文章分类: ",
|
||||
options: []
|
||||
|
||||
@@ -70,7 +70,11 @@ export const EDIT_FORM_DATA: FormItem[] = [
|
||||
type: "upImg",
|
||||
label: "Banner图片: "
|
||||
},
|
||||
|
||||
{
|
||||
prop: "extra_image",
|
||||
type: "upImg",
|
||||
label: "悬浮图: "
|
||||
},
|
||||
{
|
||||
prop: "banner_id",
|
||||
placeholder: "请选择",
|
||||
@@ -157,7 +161,7 @@ export const EDIT_FORM_DATA1: FormItem[] = [
|
||||
},
|
||||
{
|
||||
label: "否",
|
||||
value: 0
|
||||
value: -1
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -166,7 +170,11 @@ export const EDIT_FORM_DATA1: FormItem[] = [
|
||||
type: "upImg",
|
||||
label: "Banner图片: "
|
||||
},
|
||||
|
||||
// {
|
||||
// prop: "image1",
|
||||
// type: "upImg",
|
||||
// label: "Banner图片1: "
|
||||
// },
|
||||
{
|
||||
prop: "banner_id",
|
||||
placeholder: "请选择",
|
||||
@@ -211,7 +219,8 @@ export const EDIT_FORM_DATA1: FormItem[] = [
|
||||
|
||||
export const EDIT_RULE_FORM = {
|
||||
type: "image",
|
||||
sort: 1
|
||||
sort: 1,
|
||||
status: 1
|
||||
};
|
||||
// editRuleForm: {},
|
||||
//editFormData: [],
|
||||
|
||||
@@ -140,7 +140,7 @@ const getProductCategoryList = async () => {
|
||||
const result = await getProductCategoryListApi();
|
||||
if (result?.code === 0) {
|
||||
let dataClone: any = cloneDeep(result?.data);
|
||||
dataStore.editFormData[6].options = addLabelValue(dataClone);
|
||||
dataStore.editFormData[7].options = addLabelValue(dataClone);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -280,12 +280,12 @@ const getBannerUp = async () => {
|
||||
const getBannerClassEditList = async () => {
|
||||
const result = await getBannerClassListApi();
|
||||
if (result?.code === 0) {
|
||||
// let arr: any = [];
|
||||
// result?.data?.forEach((item: any) => {
|
||||
// arr.push({ value: item.id, label: item.name });
|
||||
// });
|
||||
dataStore.formData[1].options = addLabelValue(result?.data);
|
||||
dataStore.editFormData[5].options = addLabelValue(result?.data);
|
||||
dataStore.editFormData.forEach((item: any) => {
|
||||
if (item.prop === "banner_id") {
|
||||
item.options = addLabelValue(result?.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
getBannerClassEditList();
|
||||
@@ -334,6 +334,7 @@ const resetFields = () => {
|
||||
// 抽屉重置
|
||||
const handleResetClick = () => {
|
||||
if (dataStore.title === "添加Banner") {
|
||||
console.log("12323");
|
||||
resetFields();
|
||||
} else {
|
||||
getBannerRead(dataStore.editRuleForm.id);
|
||||
@@ -343,14 +344,17 @@ const handleResetClick = () => {
|
||||
const handleAdd = () => {
|
||||
dataStore.title = "添加Banner";
|
||||
dataStore.visible = true;
|
||||
getBannerClassEditList();
|
||||
dataStore.editRuleForm = cloneDeep(EDIT_RULE_FORM);
|
||||
(dataStore.editFormData = cloneDeep(EDIT_FORM_DATA)), // 抽屉表单配置项
|
||||
getBannerClassEditList();
|
||||
// getBannerClassList();
|
||||
getProductCategoryList();
|
||||
};
|
||||
// 抽屉关闭前的钩子
|
||||
const handleBeforeClone = () => {
|
||||
dataStore.editRuleForm = cloneDeep(EDIT_RULE_FORM);
|
||||
resetFields();
|
||||
(dataStore.editFormData = cloneDeep(EDIT_FORM_DATA)), // 抽屉表单配置项
|
||||
resetFields();
|
||||
dataStore.visible = false;
|
||||
dataStore.isFirstRequest = true;
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<el-input v-model="_ruleFormParam.short_name" style="width: 440px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="型号" required>
|
||||
<el-input v-model="_ruleFormParam.spu" style="width: 440px" />
|
||||
<el-input v-model="_ruleFormParam.spu" style="width: 440px" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品分类" style="width: 440px" required>
|
||||
<!-- <el-input v-model="_ruleFormParam.category_id" /> -->
|
||||
|
||||
@@ -110,6 +110,7 @@ getProductAttrsList();
|
||||
const getProductList = async (query: any) => {
|
||||
const result: any = await getProductListApi({
|
||||
spu: query,
|
||||
is_show: 1,
|
||||
page: 1,
|
||||
size: 1000
|
||||
});
|
||||
@@ -165,6 +166,7 @@ const handleRelatedAdd = () => {
|
||||
};
|
||||
//相关信息及下载远程搜索
|
||||
const handleRemote = debounce((params: any) => {
|
||||
console.log(params, "============>>>>");
|
||||
getProductList(params.query);
|
||||
}, 800);
|
||||
//产品属性接口
|
||||
|
||||
@@ -21,7 +21,7 @@ interface FormItem {
|
||||
export const EDIT_FORM_DATA: FormItem[] = [
|
||||
{
|
||||
prop: "name",
|
||||
placeholder: "请输入",
|
||||
placeholder: "以“.”分隔,可对同分组内配置再次分组,支持多维",
|
||||
type: "input",
|
||||
label: "配置标识: "
|
||||
},
|
||||
@@ -60,7 +60,8 @@ export const EDIT_FORM_DATA: FormItem[] = [
|
||||
{
|
||||
prop: "extra",
|
||||
type: "textarea",
|
||||
label: "配置项: "
|
||||
label: "配置项: ",
|
||||
placeholder: "选项型配置时:选项值:选项名['联动配置项的“配置标识”', ......],联动配置项为可选"
|
||||
},
|
||||
{
|
||||
prop: "remark",
|
||||
|
||||
@@ -11,12 +11,13 @@
|
||||
{{ extraItem.name }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
<span style="margin-left: 20px; color: #999999" v-if="config.remark">({{ config.remark }})</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="config.title" v-if="config.type === 'text'">
|
||||
<el-input v-model="config.value" style="width: 400px"> </el-input>
|
||||
<el-input v-model="config.value" style="width: 400px" :placeholder="config.remark"> </el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="config.type === 'select'" :label="config.title">
|
||||
<el-select v-model="config.value" placeholder="请选择">
|
||||
<el-select v-model="config.value" :placeholder="config.remark">
|
||||
<el-option
|
||||
v-for="extraItem in config.extra"
|
||||
:key="extraItem.value"
|
||||
@@ -32,12 +33,14 @@
|
||||
{{ extraItem.name }}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
<span style="margin-left: 20px; color: #999999" v-if="config.remark">({{ config.remark }})</span>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="config.type === 'image'" :label="config.title">
|
||||
<UploadImg v-model:image-url="config.value" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="config.type === 'textarea'" :label="config.title">
|
||||
<el-input v-model="config.value" type="textarea" :rows="8" style="width: 400px"> </el-input>
|
||||
<el-input v-model="config.value" type="textarea" :rows="8" style="width: 400px" :placeholder="config.remark">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-if="config.type === 'file'" :label="config.title">
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<div class="card table-main">
|
||||
<el-tabs v-model="activeName" class="demo-tabs">
|
||||
<el-tab-pane :label="item.name" :name="item.name" v-for="(item, index) in dataStore.list" :key="index">
|
||||
<el-form :model="dataStore.formData" label-width="120px">
|
||||
<el-form :model="dataStore.formData" label-position="top">
|
||||
<RecursiveForm :configs="item.configs" />
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
@@ -108,4 +108,9 @@ const handleClick = () => {
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
<style scoped lang="scss">
|
||||
::v-deep(.el-form-item__label) {
|
||||
font-weight: 900;
|
||||
color: #333333;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user