feat: 拉取代码

This commit is contained in:
duan
2025-02-18 18:47:15 +08:00
parent c9a88abade
commit dea89010e9
26 changed files with 1429 additions and 162 deletions

View File

@@ -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>