feat: 拉取代码
This commit is contained in:
@@ -1 +1,244 @@
|
||||
<template></template>
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 列表 -->
|
||||
<template v-if="isA">
|
||||
<!-- 搜索 -->
|
||||
|
||||
|
||||
<!-- 列表 -->
|
||||
<page-content ref="contentRef" :content-config="contentConfig" @add-click="handleAddClick"
|
||||
@edit-click="handleEditClick" @export-click="handleExportClick" @search-click="handleSearchClick"
|
||||
@toolbar-click="handleToolbarClick" @operat-click="handleOperatClick" @filter-change="handleFilterChange">
|
||||
<template #status="scope">
|
||||
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
|
||||
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #gender="scope">
|
||||
<DictLabel v-model="scope.row[scope.prop]" code="gender" />
|
||||
</template>
|
||||
<template #timemanagement="scope">
|
||||
{{ scope.row.startTime }}-{{ scope.row.endTime }}
|
||||
</template>
|
||||
<template #mobile="scope">
|
||||
<el-text>{{ scope.row[scope.prop] }}</el-text>
|
||||
<copy-button v-if="scope.row[scope.prop]" :text="scope.row[scope.prop]" style="margin-left: 2px" />
|
||||
</template>
|
||||
</page-content>
|
||||
|
||||
<!-- 新增 -->
|
||||
<page-modal ref="addModalRef" :modal-config="addModalConfig" @submit-click="handleSubmitClick">
|
||||
<template #gender="scope">
|
||||
<Dict v-model="scope.formData[scope.prop]" code="gender" />
|
||||
</template>
|
||||
<template #addButton="scope">
|
||||
<div>
|
||||
<el-button type="primary" @click="addgoods">
|
||||
<el-icon>
|
||||
<Plus />
|
||||
</el-icon>添加商品
|
||||
</el-button>
|
||||
<!-- 选责商品列表 -->
|
||||
<selectGoodslist @deleteItememit="deleteItem($event)" :list="selectData"></selectGoodslist>
|
||||
</div>
|
||||
</template>
|
||||
<template #addmanagementtime="scope">
|
||||
<template v-if="scope.formData.useTime == 1">
|
||||
<el-time-picker value-format="HH:mm:ss" v-model="scope.formData.saleTime" is-range range-separator="到"
|
||||
start-placeholder="开始时间" end-placeholder="结束时间" />
|
||||
</template>
|
||||
</template>
|
||||
</page-modal>
|
||||
|
||||
<!-- 编辑 -->
|
||||
<page-modal ref="editModalRef" :modal-config="editModalConfig" @submit-click="handleSubmitClick">
|
||||
<template #gender="scope">
|
||||
<Dict v-model="scope.formData[scope.prop]" code="gender" v-bind="scope.attrs" />
|
||||
</template>
|
||||
<template #addButton="scope">
|
||||
<div>
|
||||
<el-button type="primary" @click="addgoods">
|
||||
<el-icon>
|
||||
<Plus />
|
||||
</el-icon>添加商品
|
||||
</el-button>
|
||||
<!-- 选责商品列表 -->
|
||||
<selectGoodslist @deleteItememit="deleteItem($event)" :list="selectData"></selectGoodslist>
|
||||
</div>
|
||||
</template>
|
||||
<template #addmanagementtime="scope">
|
||||
<template v-if="scope.formData.useTime == 1">
|
||||
{{ scope.formData }}
|
||||
<el-time-picker value-format="HH:mm:ss" v-model="scope.formData.saleTime" is-range range-separator="到"
|
||||
start-placeholder="开始时间" end-placeholder="结束时间" />
|
||||
</template>
|
||||
</template>
|
||||
</page-modal>
|
||||
</template>
|
||||
<template v-else>
|
||||
<page-content ref="contentRef" :content-config="contentConfig2" @operat-click="handleOperatClick">
|
||||
<template #status="scope">
|
||||
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
|
||||
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</page-content>
|
||||
</template>
|
||||
<!-- 新增 -->
|
||||
<myDialog title="选择商品" width="50%" ref="myDialogRef" @Confirm="subitgood">
|
||||
|
||||
</myDialog>
|
||||
<!-- 新增添加商品 -->
|
||||
<myDialog title="选择商品" width="50%" ref="myDialogRef" @Confirm="subitgood">
|
||||
<page-search ref="searchRef" :search-config="searchConfig2" @query-click="handleQueryClick"
|
||||
@reset-click="handleResetClick" />
|
||||
<page-content ref="contentRefs" :content-config="contentConfig2" @add-click="handleAddClick"
|
||||
@edit-click="handleEditClick" @export-click="handleExportClick" @search-click="handleSearchClick"
|
||||
@toolbar-click="handleToolbarClick" @operat-click="handleOperatClick" @filter-change="handleFilterChange">
|
||||
<template #status="scope">
|
||||
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
|
||||
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #gender="scope">
|
||||
<DictLabel v-model="scope.row[scope.prop]" code="gender" />
|
||||
</template>
|
||||
<template #timemanagement="scope">
|
||||
{{ scope.row.startTime }}-{{ scope.row.endTime }}
|
||||
</template>
|
||||
<template #mobile="scope">
|
||||
<el-text>{{ scope.row[scope.prop] }}</el-text>
|
||||
<copy-button v-if="scope.row[scope.prop]" :text="scope.row[scope.prop]" style="margin-left: 2px" />
|
||||
</template>
|
||||
</page-content>
|
||||
</myDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import UserAPI from "@/api/onlineShop/goodsGroupconfig";
|
||||
|
||||
import type { IObject, IOperatData } from "@/components/CURD/types";
|
||||
import usePage from "@/components/CURD/usePage";
|
||||
import addModalConfig from "./goodsGroupconfig/add";
|
||||
import contentConfig from "./goodsGroupconfig/content";
|
||||
import contentConfig2 from "./goodsGroupconfig/content2";
|
||||
import editModalConfig from "./goodsGroupconfig/edit";
|
||||
import searchConfig from "./goodsGroupconfig/search";
|
||||
import searchConfig2 from "./goodsGroupconfig/search2";
|
||||
import myDialog from '@/components/mycomponents/myDialog.vue'
|
||||
import selectGoodslist from "./goodsGroupconfig/selectGoodslist.vue"
|
||||
const {
|
||||
searchRef,
|
||||
contentRef,
|
||||
addModalRef,
|
||||
editModalRef,
|
||||
handleQueryClick,
|
||||
handleResetClick,
|
||||
// handleAddClick,
|
||||
// handleEditClick,
|
||||
handleSubmitClick,
|
||||
handleExportClick,
|
||||
handleSearchClick,
|
||||
handleFilterChange,
|
||||
} = usePage();
|
||||
|
||||
// 新增
|
||||
async function handleAddClick() {
|
||||
console.log(123)
|
||||
// addModalRef.value?.setModalVisible();
|
||||
selectData.value = []
|
||||
// 加载上级规格下拉数据源
|
||||
// addModalConfig.formItems[2]!.attrs!.data = await UserAPI.getPage({ name: "" });
|
||||
// 加载角色下拉数据源
|
||||
// addModalConfig.formItems[4]!.options = await RoleAPI.getOptions();
|
||||
}
|
||||
const myDialogRef = ref(null)
|
||||
const contentRefs = ref(null)
|
||||
// 选中的商品数据
|
||||
let selectData = ref([])
|
||||
// 添加商品
|
||||
function addgoods() {
|
||||
myDialogRef.value.open()
|
||||
const oldfun = addModalConfig.formAction
|
||||
addModalConfig.formAction = (data) => {
|
||||
oldfun({
|
||||
...data,
|
||||
selectgoods: selectData.value
|
||||
})
|
||||
addModalRef.value.handleClose();
|
||||
handleSubmitClick()
|
||||
}
|
||||
}
|
||||
// 删除商品
|
||||
function deleteItem(data: any) {
|
||||
selectData.value = data
|
||||
}
|
||||
// 添加商品的回调
|
||||
function subitgood() {
|
||||
selectData.value = contentRefs.value.getselectTable()
|
||||
}
|
||||
// 编辑
|
||||
async function handleEditClick(row: IObject) {
|
||||
editModalRef.value?.handleDisabled(false);
|
||||
// 加载部门下拉数据源
|
||||
// editModalConfig.formItems[2]!.attrs!.data = await UserAPI.getPage({ name: "" });
|
||||
// editModalConfig.formItems[2]!.attrs!.data = await DeptAPI.getOptions();
|
||||
// 加载角色下拉数据源
|
||||
// editModalConfig.formItems[4]!.options = await RoleAPI.getOptions();
|
||||
// 根据id获取数据进行填充
|
||||
const data = await UserAPI.getunitinfo(row.id);
|
||||
let obj = { ...data }
|
||||
selectData.value = data.productList
|
||||
obj.selectgoods = data.productList
|
||||
obj.saleTime = [data.saleStartTime, data.saleEndTime]
|
||||
console.log(obj, 'dbug')
|
||||
editModalRef.value?.setFormData(obj);
|
||||
editModalRef.value?.setModalVisible();
|
||||
|
||||
}
|
||||
// 其他工具栏
|
||||
function handleToolbarClick(name: string) {
|
||||
console.log(name);
|
||||
if (name === "custom1") {
|
||||
ElMessage.success("点击了自定义1按钮");
|
||||
}
|
||||
}
|
||||
// 其他操作列
|
||||
async function handleOperatClick(data: IOperatData) {
|
||||
console.log(data);
|
||||
// 重置密码
|
||||
if (data.name === "reset_pwd") {
|
||||
ElMessageBox.prompt("请输入用户「" + data.row.username + "」的新密码", "重置密码", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
}).then(({ value }) => {
|
||||
if (!value || value.length < 6) {
|
||||
ElMessage.warning("密码至少需要6位字符,请重新输入");
|
||||
return false;
|
||||
}
|
||||
// UserAPI.resetPassword(data.row.id, value).then(() => {
|
||||
// ElMessage.success("密码重置成功,新密码是:" + value);
|
||||
// });
|
||||
});
|
||||
} else if (data.name === "detail") {
|
||||
// 禁用表单编辑
|
||||
editModalRef.value?.handleDisabled(true);
|
||||
// 打开抽屉
|
||||
editModalRef.value?.setModalVisible();
|
||||
// 修改抽屉标题
|
||||
editModalConfig.drawer = { ...editModalConfig.drawer, title: "用户详情" };
|
||||
// 加载部门下拉数据源
|
||||
// editModalConfig.formItems[2]!.attrs!.data = await DeptAPI.getOptions();
|
||||
// 加载角色下拉数据源
|
||||
// editModalConfig.formItems[4]!.options = await RoleAPI.getOptions();
|
||||
// 根据id获取数据进行填充
|
||||
// const formData = await UserAPI.getFormData(data.row.id);
|
||||
// 设置表单数据
|
||||
// editModalRef.value?.setFormData(formData);
|
||||
}
|
||||
}
|
||||
|
||||
// 切换示例
|
||||
const isA = ref(true);
|
||||
</script>
|
||||
|
||||
104
src/views/online-shop/goodsGroupconfig/add.ts
Normal file
104
src/views/online-shop/goodsGroupconfig/add.ts
Normal file
@@ -0,0 +1,104 @@
|
||||
import UserAPI from "@/api/onlineShop/goodsGroupconfig";
|
||||
|
||||
import type { IModalConfig } from "@/components/CURD/types";
|
||||
|
||||
const modalConfig: IModalConfig<UserForm> = {
|
||||
pageName: "sys:user",
|
||||
dialog: {
|
||||
title: "新增分组",
|
||||
width: 800,
|
||||
draggable: true,
|
||||
},
|
||||
form: {
|
||||
labelWidth: 100,
|
||||
},
|
||||
formAction: function (data: any) {
|
||||
if (data.selectgoods) {
|
||||
let arr = []
|
||||
data.selectgoods.forEach(element => {
|
||||
arr.push(element.id)
|
||||
});
|
||||
data.productIds = arr
|
||||
}
|
||||
console.log("提交之前处理2", data);
|
||||
return UserAPI.addunit(data)
|
||||
},
|
||||
beforeSubmit(data: any) {
|
||||
if (data.saleTime) {
|
||||
let a = data.saleTime[0]
|
||||
let b = data.saleTime[1]
|
||||
data.saleStartTime = a
|
||||
data.saleEndTime = b
|
||||
}
|
||||
},
|
||||
formItems: [
|
||||
{
|
||||
label: "分组名称",
|
||||
prop: "name",
|
||||
rules: [{ required: true, message: "分组名称不能为空", trigger: "blur" }],
|
||||
type: "input",
|
||||
attrs: {
|
||||
placeholder: "请输入分组名称",
|
||||
},
|
||||
},
|
||||
{
|
||||
slotName: "addButton",
|
||||
prop: "selectgoods",
|
||||
attrs: {},
|
||||
type: "custom",
|
||||
label: "选择商品",
|
||||
},
|
||||
|
||||
{
|
||||
label: "分组状态",
|
||||
prop: "status",
|
||||
type: "radio",
|
||||
options: [
|
||||
{ label: "启用", value: 1 },
|
||||
{ label: "禁用", value: 0 },
|
||||
],
|
||||
initialValue: 1,
|
||||
}, {
|
||||
label: "售卖时间管控",
|
||||
prop: "useTime",
|
||||
type: "radio",
|
||||
options: [
|
||||
{ label: "启用", value: 1 },
|
||||
{ label: "禁用", value: 0 },
|
||||
],
|
||||
initialValue: 0,
|
||||
},
|
||||
|
||||
{
|
||||
label: "排列方式",
|
||||
prop: "sortMode",
|
||||
type: "radio",
|
||||
options: [
|
||||
{ label: "默认", value: 0 },
|
||||
{ label: "价格由高到低", value: 1 },
|
||||
{ label: "销量由高到低", value: 2 },
|
||||
],
|
||||
initialValue: 0,
|
||||
},
|
||||
{
|
||||
label: "分组排序",
|
||||
prop: "sort",
|
||||
type: "input-number",
|
||||
attrs: {
|
||||
controlsPosition: "right"
|
||||
},
|
||||
initialValue: 1,
|
||||
},
|
||||
{
|
||||
slotName: "addmanagementtime",
|
||||
prop: "",
|
||||
type: "custom",
|
||||
label: "",
|
||||
},
|
||||
],
|
||||
};
|
||||
export interface UserForm {
|
||||
|
||||
}
|
||||
// 如果有异步数据会修改配置的,推荐用reactive包裹,而纯静态配置的可以直接导出
|
||||
export default reactive(modalConfig);
|
||||
74
src/views/online-shop/goodsGroupconfig/content.ts
Normal file
74
src/views/online-shop/goodsGroupconfig/content.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
import UserAPI from "@/api/onlineShop/goodsGroupconfig";
|
||||
|
||||
import RoleAPI from "@/api/system/role";
|
||||
import type { UserPageQuery } from "@/api/system/user";
|
||||
import type { IContentConfig } from "@/components/CURD/types";
|
||||
|
||||
const contentConfig: IContentConfig<UserPageQuery> = {
|
||||
pageName: "sys:user",
|
||||
table: {
|
||||
border: true,
|
||||
highlightCurrentRow: true,
|
||||
},
|
||||
pagination: {
|
||||
background: true,
|
||||
layout: "prev,pager,next,jumper,total,sizes",
|
||||
pageSize: 20,
|
||||
pageSizes: [10, 20, 30, 50],
|
||||
},
|
||||
indexActionData: {},
|
||||
indexAction: function (params) {
|
||||
return UserAPI.getPage(params);
|
||||
},
|
||||
deleteAction: UserAPI.deleteByIds,
|
||||
// importAction(file) {
|
||||
// return UserAPI.import(1, file);
|
||||
// },
|
||||
// exportAction: UserAPI.export,
|
||||
// importTemplate: UserAPI.downloadTemplate,
|
||||
modifyAction(data) {
|
||||
// console.log("modifyAction:", data);
|
||||
},
|
||||
importsAction(data) {
|
||||
// 模拟导入数据
|
||||
console.log("importsAction", data);
|
||||
return Promise.resolve();
|
||||
},
|
||||
exportsAction: async function (params) {
|
||||
// 模拟获取到的是全量数据
|
||||
const res = await UserAPI.getPage(params);
|
||||
console.log("exportsAction", res.list);
|
||||
return res.list;
|
||||
},
|
||||
pk: "id",
|
||||
toolbar: [
|
||||
"add",
|
||||
],
|
||||
cols: [
|
||||
{ label: "排序", align: "center", prop: "sort", },
|
||||
{ label: "分组名称", align: "center", prop: "name", },
|
||||
{
|
||||
label: "售卖时间管控",
|
||||
slotName: "timemanagement",
|
||||
templet: "custom",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
label: "状态",
|
||||
align: "center",
|
||||
prop: "useTime",
|
||||
templet: "switch",
|
||||
slotName: "status",
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
align: "center",
|
||||
fixed: "right",
|
||||
width: 280,
|
||||
templet: "tool",
|
||||
operat: ["edit", "delete"],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default contentConfig;
|
||||
34
src/views/online-shop/goodsGroupconfig/content2.ts
Normal file
34
src/views/online-shop/goodsGroupconfig/content2.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import type { IContentConfig } from "@/components/CURD/types";
|
||||
import UserAPI from "@/api/onlineShop/goodsGroupconfig";
|
||||
|
||||
const contentConfig: IContentConfig = {
|
||||
pageName: "sys:user",
|
||||
table: {
|
||||
showOverflowTooltip: true,
|
||||
},
|
||||
toolbar: [],
|
||||
|
||||
indexAction: function (params) {
|
||||
return UserAPI.getPage(params);
|
||||
},
|
||||
modifyAction(data) {
|
||||
// 模拟发起网络请求修改字段
|
||||
// console.log("modifyAction:", data);
|
||||
ElMessage.success(JSON.stringify(data));
|
||||
return Promise.resolve(null);
|
||||
},
|
||||
|
||||
cols: [
|
||||
{ type: "selection", width: 50, align: "center" },
|
||||
{ label: "商品信息", align: "center", prop: "name" },
|
||||
{ label: "规格", align: "center", prop: "specSnap", },
|
||||
{ label: "是否售罄", align: "center", prop: "isPauseSale", },
|
||||
{ label: "售价", align: "center", prop: "lowPrice", },
|
||||
{ label: "库存", align: "center", prop: "realSalesNumber", },
|
||||
{ label: "销量", align: "center", prop: "stockNumber", },
|
||||
{ label: "分类名称", align: "center", prop: "categoryName", },
|
||||
|
||||
],
|
||||
};
|
||||
|
||||
export default contentConfig;
|
||||
135
src/views/online-shop/goodsGroupconfig/edit.ts
Normal file
135
src/views/online-shop/goodsGroupconfig/edit.ts
Normal file
@@ -0,0 +1,135 @@
|
||||
import UserAPI from "@/api/onlineShop/goodsGroupconfig";
|
||||
|
||||
import type { IModalConfig } from "@/components/CURD/types";
|
||||
import { DeviceEnum } from "@/enums/DeviceEnum";
|
||||
import { useAppStore } from "@/store";
|
||||
|
||||
const modalConfig: IModalConfig<UserForm> = {
|
||||
pageName: "sys:user",
|
||||
// component: "drawer",
|
||||
dialog: {
|
||||
title: "编辑单位",
|
||||
width: 800,
|
||||
draggable: true,
|
||||
},
|
||||
|
||||
pk: "id",
|
||||
formAction: function (data: any) {
|
||||
if (data.selectgoods) {
|
||||
let arr = []
|
||||
data.selectgoods.forEach(element => {
|
||||
arr.push(element.id)
|
||||
});
|
||||
data.productIds = arr
|
||||
}
|
||||
console.log("提交之前处理2", data);
|
||||
// return UserAPI.update(data);
|
||||
|
||||
},
|
||||
beforeSubmit(data: any) {
|
||||
if (data.saleTime) {
|
||||
let a = data.saleTime[0]
|
||||
let b = data.saleTime[1]
|
||||
data.saleStartTime = a
|
||||
data.saleEndTime = b
|
||||
}
|
||||
},
|
||||
formItems: [
|
||||
{
|
||||
label: "分组名称",
|
||||
prop: "name",
|
||||
rules: [{ required: true, message: "分组名称不能为空", trigger: "blur" }],
|
||||
type: "input",
|
||||
attrs: {
|
||||
placeholder: "请输入分组名称",
|
||||
},
|
||||
},
|
||||
{
|
||||
slotName: "addButton",
|
||||
prop: "selectgoods",
|
||||
attrs: {},
|
||||
type: "custom",
|
||||
label: "选择商品",
|
||||
},
|
||||
|
||||
{
|
||||
label: "分组状态",
|
||||
prop: "status",
|
||||
type: "radio",
|
||||
options: [
|
||||
{ label: "启用", value: 1 },
|
||||
{ label: "禁用", value: 0 },
|
||||
],
|
||||
initialValue: 1,
|
||||
}, {
|
||||
label: "售卖时间管控",
|
||||
prop: "useTime",
|
||||
type: "radio",
|
||||
options: [
|
||||
{ label: "启用", value: 1 },
|
||||
{ label: "禁用", value: 0 },
|
||||
],
|
||||
initialValue: 0,
|
||||
},
|
||||
|
||||
{
|
||||
label: "排列方式",
|
||||
prop: "sortMode",
|
||||
type: "radio",
|
||||
options: [
|
||||
{ label: "默认", value: '0' },
|
||||
{ label: "价格由高到低", value: '1' },
|
||||
{ label: "销量由高到低", value: '2' },
|
||||
],
|
||||
initialValue: '0',
|
||||
},
|
||||
{
|
||||
label: "分组排序",
|
||||
prop: "sort",
|
||||
type: "input-number",
|
||||
attrs: {
|
||||
controlsPosition: "right"
|
||||
},
|
||||
},
|
||||
{
|
||||
slotName: "addmanagementtime",
|
||||
prop: "",
|
||||
type: "custom",
|
||||
label: " ",
|
||||
},
|
||||
{
|
||||
prop: "saleTime",
|
||||
label: "",
|
||||
attrs: {
|
||||
},
|
||||
watch() {
|
||||
|
||||
}
|
||||
},
|
||||
],
|
||||
};
|
||||
/** 用户表单类型 */
|
||||
interface UserForm {
|
||||
/** 用户头像 */
|
||||
avatar?: string;
|
||||
/** 部门ID */
|
||||
deptId?: number;
|
||||
/** 邮箱 */
|
||||
email?: string;
|
||||
/** 性别 */
|
||||
gender?: number;
|
||||
/** 用户ID */
|
||||
id?: number;
|
||||
/** 手机号 */
|
||||
mobile?: string;
|
||||
/** 昵称 */
|
||||
nickname?: string;
|
||||
/** 角色ID集合 */
|
||||
roleIds?: number[];
|
||||
/** 用户状态(1:正常;0:禁用) */
|
||||
status?: number;
|
||||
/** 用户名 */
|
||||
username?: string;
|
||||
}
|
||||
|
||||
export default reactive(modalConfig);
|
||||
101
src/views/online-shop/goodsGroupconfig/search.ts
Normal file
101
src/views/online-shop/goodsGroupconfig/search.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
import UserAPI from "@/api/onlineShop/goodsGroupconfig";
|
||||
|
||||
import DeptAPI from "@/api/product/specificationsconfig";
|
||||
|
||||
import type { ISearchConfig } from "@/components/CURD/types";
|
||||
|
||||
const searchConfig: ISearchConfig = {
|
||||
pageName: "sys:user",
|
||||
formItems: [
|
||||
{
|
||||
type: "input",
|
||||
label: "商品名称",
|
||||
prop: "name",
|
||||
attrs: {
|
||||
placeholder: "请输入商品名称",
|
||||
clearable: true,
|
||||
style: {
|
||||
width: "200px",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "select",
|
||||
label: "商品分类",
|
||||
prop: "categoryId",
|
||||
attrs: {
|
||||
placeholder: "请选择商品分类",
|
||||
clearable: true,
|
||||
style: {
|
||||
width: "200px",
|
||||
},
|
||||
},
|
||||
options: [],
|
||||
async initFn(formItem) {
|
||||
formItem.options = await UserAPI.getList();
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
type: "tree-select",
|
||||
label: "商品规格",
|
||||
prop: "specId",
|
||||
attrs: {
|
||||
placeholder: "请选择商品规格",
|
||||
data: [],
|
||||
filterable: true,
|
||||
"check-strictly": true,
|
||||
"render-after-expand": false,
|
||||
clearable: true,
|
||||
style: {
|
||||
width: "200px",
|
||||
},
|
||||
props: {
|
||||
label: 'name', // 指定节点显示的文本字段为 name
|
||||
value: 'id' // 指定节点的值字段为 id
|
||||
}
|
||||
},
|
||||
async initFn(formItem) {
|
||||
formItem.attrs.data = await DeptAPI.getPage();
|
||||
// 注意:如果initFn函数不是箭头函数,this会指向此配置项对象,那么也就可以用this来替代形参formItem
|
||||
// this.attrs!.data = await DeptAPI.getOptions();
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "date-picker",
|
||||
label: "日期",
|
||||
prop: "times",
|
||||
attrs: {
|
||||
type: "daterange",
|
||||
"range-separator": "~",
|
||||
"start-placeholder": "开始时间",
|
||||
"end-placeholder": "截止时间",
|
||||
"value-format": "YYYY-MM-DD",
|
||||
style: {
|
||||
width: "240px",
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
type: "select",
|
||||
label: "排序",
|
||||
prop: "orderBy",
|
||||
attrs: {
|
||||
placeholder: "请选择商品分类",
|
||||
clearable: true,
|
||||
style: {
|
||||
width: "200px",
|
||||
},
|
||||
},
|
||||
options: [{
|
||||
label: "创建时间",
|
||||
value: "create_time asc"
|
||||
}, {
|
||||
label: "数量由低到高",
|
||||
value: "stock_number asc"
|
||||
}],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default searchConfig;
|
||||
41
src/views/online-shop/goodsGroupconfig/search2.ts
Normal file
41
src/views/online-shop/goodsGroupconfig/search2.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import DeptAPI from "@/api/product/specificationsconfig";
|
||||
import UserAPI from "@/api/onlineShop/goodsGroupconfig";
|
||||
|
||||
import type { ISearchConfig } from "@/components/CURD/types";
|
||||
|
||||
const searchConfig: ISearchConfig = {
|
||||
pageName: "sys:user",
|
||||
formItems: [
|
||||
{
|
||||
type: "input",
|
||||
label: "商品名称",
|
||||
prop: "name",
|
||||
attrs: {
|
||||
placeholder: "请输入商品名称",
|
||||
clearable: true,
|
||||
style: {
|
||||
width: "200px",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "select",
|
||||
label: "商品分类",
|
||||
prop: "categoryId",
|
||||
attrs: {
|
||||
placeholder: "请选择商品分类",
|
||||
clearable: true,
|
||||
style: {
|
||||
width: "200px",
|
||||
},
|
||||
},
|
||||
options: [],
|
||||
async initFn(formItem) {
|
||||
formItem.options = await UserAPI.getList();
|
||||
},
|
||||
},
|
||||
|
||||
],
|
||||
};
|
||||
|
||||
export default searchConfig;
|
||||
92
src/views/online-shop/goodsGroupconfig/selectGoodslist.vue
Normal file
92
src/views/online-shop/goodsGroupconfig/selectGoodslist.vue
Normal file
@@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<div class="shop_list">
|
||||
<div class="item_wrap" v-for="(item, index) in props.list" :key="item.id" @click="deleteItem(index)">
|
||||
<div class="item" :data-index="index + 1">
|
||||
<el-image :src="item.coverImg" style="width: 100%;height: 100%;"></el-image>
|
||||
</div>
|
||||
<div class="name">{{ item.name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
const props = defineProps({
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
|
||||
});
|
||||
const emit = defineEmits(['deleteItememit'])
|
||||
function deleteItem(index: number) {
|
||||
props.list.splice(index, 1);
|
||||
emit('deleteItememit', props.list)
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.shop_list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.item_wrap {
|
||||
$size: 80px;
|
||||
|
||||
.item {
|
||||
$radius: 4px;
|
||||
width: $size;
|
||||
height: $size;
|
||||
border-radius: $radius;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
margin-right: 10px;
|
||||
margin-top: 10px;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: attr(data-index);
|
||||
font-size: 12px;
|
||||
height: 20px;
|
||||
display: flex;
|
||||
padding: 0 10px;
|
||||
border-radius: 0 0 $radius 0;
|
||||
align-items: center;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
backdrop-filter: blur(10px);
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
&::before {
|
||||
content: '删除';
|
||||
font-size: 12px;
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
display: flex;
|
||||
padding: 0 10px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
backdrop-filter: blur(10px);
|
||||
color: #fff;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
transition: all .1s ease-in-out;
|
||||
}
|
||||
}
|
||||
|
||||
.name {
|
||||
width: $size;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user