This commit is contained in:
sa_10_0 2024-12-10 19:27:49 +08:00
parent c6beef1783
commit c32f203498
6 changed files with 305 additions and 140 deletions

View File

@ -12,7 +12,7 @@
<div style="height: 80px; color: white; font-weight: bold; <div style="height: 80px; color: white; font-weight: bold;
display: flex; align-items: center; justify-content: center"> display: flex; align-items: center; justify-content: center">
<img src="../../assets/logo.png" alt="" style="height: 30px"> <img src="../../assets/logo.png" alt="" style="height: 30px">
<span style="margin-left: 5px" v-show="isShow">泠珑水阁管理系统</span> <span style="margin-left: 5px" v-show="isShow">匠承非遗管理系统</span>
</div> </div>
<el-sub-menu index="1"> <el-sub-menu index="1">
@ -106,7 +106,7 @@
</template> </template>
<el-menu-item index="/ClothingGrade"> <el-menu-item index="/ClothingGrade">
<el-icon><Menu /></el-icon> <el-icon><Menu /></el-icon>
<span slot="title">服装等级管理</span> <span slot="title">服装类别管理</span>
</el-menu-item> </el-menu-item>
<el-menu-item index="/CostumeDetails"> <el-menu-item index="/CostumeDetails">
<el-icon><Menu /></el-icon> <el-icon><Menu /></el-icon>

View File

@ -35,20 +35,25 @@
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="服装名称" prop="name"> <el-form-item label="服装名称" prop="name">
<el-input v-model="form.name" /> <el-input v-model="form.name" maxlength="30" placeholder="30字以内"/>
</el-form-item> </el-form-item>
<el-form-item label="服装价格" prop="price"> <el-form-item label="服装价格(元)" prop="price">
<el-input v-model="form.price" /> <el-input v-model="form.price" />
</el-form-item> </el-form-item>
<el-form-item label="服装类别" prop="intro"> <el-form-item label="服装类别" prop="clothesType">
<el-input v-model="form.clothesType" /> <el-select v-model="clothesType.value" placeholder="请选择" @change="(event:any) => loadForm(event)">
<el-option v-for="item in clothesType" :key="item.value" :label="item.label" :value="item.values" />
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="服装简介" prop="intro"> <el-form-item label="服装简介" prop="intro">
<el-input v-model="form.intro" /> <el-input v-model="form.intro" maxlength="40" placeholder="40字以内"/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="onSubmit">提交</el-button> <el-button type="primary" @click="onSubmit">提交</el-button>
</el-form-item> </el-form-item>
<el-form-item>
<el-button type="primary" @click="resetForm">重置</el-button>
</el-form-item>
</el-form> </el-form>
</div> </div>
</template> </template>
@ -58,7 +63,7 @@
import {Plus} from "@element-plus/icons-vue"; import {Plus} from "@element-plus/icons-vue";
import {ElMessage, genFileId, type UploadProps, type UploadRawFile} from "element-plus"; import {ElMessage, genFileId, type UploadProps, type UploadRawFile} from "element-plus";
import myAxios from "@/api/myAxios"; import myAxios from "@/api/myAxios";
import {inject, ref} from "vue"; import {inject, ref ,onMounted} from "vue";
const fileSimple = ref() const fileSimple = ref()
const uploadProductImg : any = ref() const uploadProductImg : any = ref()
const uploadProductDetail : any = ref() const uploadProductDetail : any = ref()
@ -70,6 +75,53 @@ const form = ref({
price:'', price:'',
clothesType:'' clothesType:''
}) })
const clothesType: any = ref([
{
values: '',
label: ''
}
])
onMounted(()=>{
getGrade()
})
const getGrade = async ()=>{
const res = await myAxios.post('/clothesGrade/list',{})
for(let i in res.data.data){
clothesType.value[i] = {
values: res.data.data[i].clothesType,
label:res.data.data[i].clothesType,
}
}
}
const loadForm = (value: any) => {
form.value.clothesType = value
}
const reload : any = inject("reload")
const onSubmit = async () => {
const values = Object.values(form.value);
if (values.some(value => value === null || value === undefined || value === '')) {
ElMessage({
type:'warning',
message:'请检查表单数据是否完整填写'
})
return;
}
const res = await myAxios.post('/clothesInfo/add', { ...form.value })
if (res.data.code === 1) {
ElMessage({
type: 'success',
message: "提交成功"
})
reload() //
} else {
ElMessage.error("服务错误")
return;
}
}
const resetFormData = ref()
const resetForm = () =>{
resetFormData.value.resetFields()
}
const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => { const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
console.log(uploadFile, uploadFiles) console.log(uploadFile, uploadFiles)
} }
@ -104,29 +156,6 @@ const Exceed_ProductDetail: UploadProps['onExceed'] = (files) => { //覆盖商
file.uid = genFileId() file.uid = genFileId()
uploadProductDetail.value!.handleStart(file) uploadProductDetail.value!.handleStart(file)
} }
const reload : any = inject("reload")
const onSubmit = async () => {
const values = Object.values(form.value);
// 使some()
if (values.some(value => value === null || value === undefined || value === '')) {
ElMessage({
type:'warning',
message:'请检查表单数据是否完整填写'
})
return;
}
const res = await myAxios.post('/clothesInfo/add', { ...form.value })
if (res.data.code === 1) {
ElMessage({
type: 'success',
message: "提交成功"
})
reload() //
} else {
ElMessage.error("服务错误")
return;
}
}
</script> </script>

View File

@ -43,6 +43,13 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-config-provider style="padding: 10px 0" :locale="zhCn">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-page="searchParams.current" :page-size="searchParams.pageSize" :page-sizes="[5, 10, 15, 20]"
:small="null" :disabled="null" :background="null" layout="total, sizes, prev, pager, next, jumper"
:total="total" />
</el-config-provider>
<!-- 弹窗--> <!-- 弹窗-->
<el-dialog v-model="dialogVisible" title="" width="500"> <el-dialog v-model="dialogVisible" title="" width="500">
<el-form :model="order" label-width="auto" style="max-width: 600px" :disabled="disabled"> <el-form :model="order" label-width="auto" style="max-width: 600px" :disabled="disabled">
@ -93,17 +100,13 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref,onMounted } from 'vue' import { ref,onMounted,inject } from 'vue'
import myAxios from "@/api/myAxios"; import myAxios from "@/api/myAxios";
import zhCn from 'element-plus/es/locale/lang/zh-cn';
import {ElMessage, genFileId, type UploadProps, type UploadRawFile} from "element-plus"; import {ElMessage, genFileId, type UploadProps, type UploadRawFile} from "element-plus";
const orders = ref([{}]) const orders = ref([{}])
const name = ref('') const name = ref('')
const searchParams: any = ref({ //
current: 1, //
pageSize: 5, //
sortField: "id", //ID
sortOrder: "descend" //
})
onMounted(()=>{ onMounted(()=>{
getList() getList()
}) })
@ -151,7 +154,6 @@ const editShow = (index: number, row: any,flag:number) => {
const cancel = () => { const cancel = () => {
dialogVisible.value = false dialogVisible.value = false
} }
const editForm : any = ref({})
const addType =async () => { const addType =async () => {
dialogVisible.value = false dialogVisible.value = false
const res = await myAxios.post('/advanceOrder/update',{ const res = await myAxios.post('/advanceOrder/update',{
@ -175,8 +177,25 @@ const Search = (data:any)=>{
searchParams.value.current = 1 searchParams.value.current = 1
getList() getList()
} }
//
const reload : any = inject("reload")
const reset = ()=>{ const reset = ()=>{
name.value = '' reload()
}
//
const searchParams: any = ref({
current: 1,
pageSize: 5,
sortField: "id",
sortOrder: "descend"
})
const handleSizeChange = (newSize: any) => {
searchParams.value.pageSize = newSize
getList()
}
const handleCurrentChange = (Current: any) => {
searchParams.value.current = Current
getList()
} }
</script> </script>

View File

@ -14,8 +14,8 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="clothesType" label="等级" ></el-table-column> <el-table-column prop="clothesType" label="等级" ></el-table-column>
<el-table-column prop="minPrice" label="最低价" ></el-table-column> <el-table-column prop="minPrice" label="最低价(元)" ></el-table-column>
<el-table-column prop="maxPrice" label="最高价" ></el-table-column> <el-table-column prop="maxPrice" label="最高价(元)" ></el-table-column>
<el-table-column prop="brief" label="简介" ></el-table-column> <el-table-column prop="brief" label="简介" ></el-table-column>
<el-table-column label="操作"> <el-table-column label="操作">
<template #default="scope"> <template #default="scope">
@ -48,14 +48,14 @@
<el-form-item label="名称"> <el-form-item label="名称">
<el-input v-model="order.clothesType"/> <el-input v-model="order.clothesType"/>
</el-form-item> </el-form-item>
<el-form-item label="最低价"> <el-form-item label="最低价(元)">
<el-input v-model="order.minPrice"/> <el-input v-model="order.minPrice" />
</el-form-item> </el-form-item>
<el-form-item label="最高"> <el-form-item label="最高价(元)">
<el-input v-model="order.maxPrice"/> <el-input v-model="order.maxPrice"/>
</el-form-item> </el-form-item>
<el-form-item label="简介"> <el-form-item label="简介">
<el-input v-model="order.brief"/> <el-input v-model="order.brief" maxlength="30" placeholder="30字以内"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer #default="{ row, $index }"> <template #footer #default="{ row, $index }">

View File

@ -22,7 +22,7 @@
<el-table-column prop="id" label="序号" width="50"></el-table-column> <el-table-column prop="id" label="序号" width="50"></el-table-column>
<el-table-column prop="name" label="服装名称" ></el-table-column> <el-table-column prop="name" label="服装名称" ></el-table-column>
<el-table-column prop="clothesType" label="类型"></el-table-column> <el-table-column prop="clothesType" label="类型"></el-table-column>
<el-table-column prop="price" label="价格"></el-table-column> <el-table-column prop="price" label="价格(元)"></el-table-column>
<el-table-column prop="image" label="类别图片" width="200"> <el-table-column prop="image" label="类别图片" width="200">
<template #default="scope"><img :src="scope.row.image" alt="" style="height: 50px;"></template> <template #default="scope"><img :src="scope.row.image" alt="" style="height: 50px;"></template>
</el-table-column> </el-table-column>
@ -43,12 +43,13 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 分页--> <!-- 分页-->
<div style="padding: 10px 0"> <el-config-provider style="padding: 10px 0" :locale="zhCn">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-page="searchParams.current" :page-size="searchParams.pageSize" :page-sizes="[5, 10, 15, 20]" :current-page="searchParams.current" :page-size="searchParams.pageSize" :page-sizes="[5, 10, 15, 20]"
:small="null" :disabled="null" :background="null" layout="total, sizes, prev, pager, next, jumper" :small="null" :disabled="null" :background="null" layout="total, sizes, prev, pager, next, jumper"
:total="total" /> :total="total" />
</div>
</el-config-provider>
<!-- 弹窗--> <!-- 弹窗-->
<el-dialog v-model="dialogVisible" title="" width="500"> <el-dialog v-model="dialogVisible" title="" width="500">
<el-form :model="order" label-width="auto" style="max-width: 600px" :disabled="disabled"> <el-form :model="order" label-width="auto" style="max-width: 600px" :disabled="disabled">
@ -89,12 +90,14 @@
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="名称"> <el-form-item label="名称">
<el-input v-model="order.name"/> <el-input v-model="order.name" maxlength="25" placeholder="25字以内"/>
</el-form-item> </el-form-item>
<el-form-item label="类型"> <el-form-item label="类型" prop="clothesType">
<el-input v-model="order.clothesType"/> <el-select v-model="order.clothesType" @change="(event: any) => loadForm(event)">
<el-option v-for="item in clothesType" :key="item.value" :label="item.label" :value="item.values" />
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="价格"> <el-form-item label="价格(元)">
<el-input v-model="order.price"/> <el-input v-model="order.price"/>
</el-form-item> </el-form-item>
<el-form-item label="简介"> <el-form-item label="简介">
@ -104,7 +107,7 @@
<template #footer #default="{ row, $index }"> <template #footer #default="{ row, $index }">
<div class="dialog-footer"> <div class="dialog-footer">
<el-button @click="cancel">取消</el-button> <el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="addType"> <el-button type="primary" @click="saveEdit">
确定 确定
</el-button> </el-button>
</div> </div>
@ -113,12 +116,14 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {ref, onMounted} from 'vue' import {ref, onMounted,inject} from 'vue'
import myAxios from "@/api/myAxios"; import myAxios from "@/api/myAxios";
import {ElMessage, genFileId, type UploadProps, type UploadRawFile} from "element-plus"; import {ElMessage, genFileId, type UploadProps, type UploadRawFile} from "element-plus";
import zhCn from "element-plus/es/locale/lang/zh-cn";
onMounted(()=>{ onMounted(()=>{
getList() getList()
getGrade()
}) })
const orders = ref([{}]) const orders = ref([{}])
const total = ref(0) const total = ref(0)
@ -146,6 +151,24 @@ const order=ref({
intro:'', intro:'',
clothesType:'' clothesType:''
}) })
const clothesType: any = ref([
{
values: '',
label: ''
}
])
const getGrade = async ()=>{
const res = await myAxios.post('/clothesGrade/list',{})
for(let i in res.data.data){
clothesType.value[i] = {
values: res.data.data[i].clothesType,
label:res.data.data[i].clothesType,
}
}
}
const loadForm = (value: any) => {
order.value.clothesType = value
}
const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => { const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
console.log(uploadFile, uploadFiles) console.log(uploadFile, uploadFiles)
} }
@ -190,16 +213,15 @@ const handleCurrentChange = (Current: any) => {
searchParams.value.current = Current searchParams.value.current = Current
getList() getList()
} }
// //
const Search = (data:String)=>{ const Search = (data:String)=>{
searchParams.value.name = data searchParams.value.name = data
searchParams.value.current = 1 searchParams.value.current = 1
getList() getList()
} }
// const reload : any = inject("reload") const reload : any = inject("reload")
const reset =()=>{ const reset =()=>{
name.value='' reload()
} }
const handleSelectionChange = (val:any)=>{ const handleSelectionChange = (val:any)=>{
console.log(val) console.log(val)
@ -243,9 +265,9 @@ const delBatch = async ()=>{
} }
const editForm : any = ref({}) const editForm : any = ref({})
// //
const addType =async ()=>{ const saveEdit =async ()=>{
dialogVisible.value = false dialogVisible.value = false
const res = await myAxios('/clothesInfo/update',{...editForm.value}) const res = await myAxios.post('/clothesInfo/update',{...editForm.value})
if(res.data.code === 1) { if(res.data.code === 1) {
ElMessage({ ElMessage({
type: 'success', type: 'success',

View File

@ -1,87 +1,182 @@
<template> <!--<template>-->
<div class="date-picker"> <!-- <div class="demo-date-picker">-->
<div class="father"> <!-- <div class="block">-->
<div v-for="(item, index) in dayList" :key="index"> <!-- <span class="demonstration">选择日期</span>-->
<div class="inner"> <!-- <el-date-picker-->
{{ index + 1 }} <!-- v-model="valueData"-->
</div> <!-- type="daterange"-->
<!-- 时间段部分 --> <!-- range-separator="到"-->
<div class="time-picker"> <!-- start-placeholder="起始日期"-->
<div v-for="(item, row) in timeList[index]" :key="row" class="box"> <!-- end-placeholder="截至日期"-->
<span> {{ row+1 }} 个时间段</span> <!-- :size="size"-->
<el-time-select <!-- />-->
v-model="timeList[index][row].startTime" <!-- </div>-->
style="width: 150px" <!-- </div>-->
:max-time="timeList[index][row].endTime"
placeholder="Start time"
size="default"
start="08:30"
step="00:15"
end="18:30" />
<el-time-select
v-model="timeList[index][row].endTime"
style="width: 150px"
:min-time="timeList[index][row].startTime"
placeholder="End time"
size="default"
start="08:30"
step="00:15"
end="18:30" />
<el-button circle @click="addList(index, row)"><el-icon><Plus /></el-icon></el-button>
<el-button circle @click="subList(index, row)" v-if="row + 1 > 1"><el-icon><Minus /></el-icon></el-button>
</div>
</div>
</div>
</div>
</div> <!-- <div style="margin-bottom: 10px">-->
<!-- <el-button @click="addTimePickers">添加时间段</el-button>-->
<!-- </div>-->
<!-- <div v-for="(timeData, index) in timeDataList" :key="index">-->
<!-- <el-time-picker v-model="timeData.value1" placeholder="设置时间段" />-->
<!-- //////////////////-->
<!-- <el-time-picker-->
<!-- v-model="timeData.value2"-->
<!-- is-range-->
<!-- range-separator="到"-->
<!-- start-placeholder="起始时间"-->
<!-- end-placeholder="截至时间"-->
<!-- />-->
<!-- <el-button @click="deleteTimePicker(index)">删除时间段</el-button>-->
<!-- </div>-->
<!--</template>-->
<!--<script lang="ts" setup>-->
<!--import { ref } from 'vue';-->
<!--import { ElButton, ElDatePicker, ElTimePicker } from 'element-plus';-->
<!--const size = ref<'default' | 'large' | 'small'>('default');-->
<!--const valueData = ref('');-->
<!--const timeDataList = ref<{ value1: string; value2: [Date, Date] }[]>([]);-->
<!--const addTimePickers = () => {-->
<!-- timeDataList.value.push({-->
<!-- value1: '',-->
<!-- value2: [new Date(), new Date()]-->
<!-- });-->
<!--};-->
<!--const deleteTimePicker = (index: number) => {-->
<!-- timeDataList.value.splice(index, 1);-->
<!--};-->
<!--</script>-->
<!--<style scoped>-->
<!--.demo-date-picker {-->
<!-- display: flex;-->
<!-- width: 100%;-->
<!-- padding: 0;-->
<!-- flex-wrap: wrap;-->
<!--}-->
<!--.demo-date-picker .block {-->
<!-- padding: 30px 0;-->
<!-- text-align: center;-->
<!-- border-right: solid 1px var(&#45;&#45;el-border-color);-->
<!-- flex: 1;-->
<!--}-->
<!--.demo-date-picker .block:last-child {-->
<!-- border-right: none;-->
<!--}-->
<!--.demo-date-picker .demonstration {-->
<!-- display: block;-->
<!-- color: var(&#45;&#45;el-text-color-secondary);-->
<!-- font-size: 14px;-->
<!-- margin-bottom: 20px;-->
<!--}-->
<!--.example-basic .el-date-editor {-->
<!-- margin: 8px;-->
<!--}-->
<!--.is-selected {-->
<!-- color: #1989fa;-->
<!-- position: relative;-->
<!--}-->
<!--.is-selected::after {-->
<!-- content: '✔️';-->
<!-- position: absolute;-->
<!-- right: 5px;-->
<!-- top: 5px;-->
<!--}-->
<!--.disabled {-->
<!-- color: #ccc;-->
<!-- cursor: not-allowed;-->
<!--}-->
<!--</style>-->
<template>
<el-calendar :disabled-date="disabledDate">
<template #date-cell="{ data }">
<p
:class="[
selectedDates.includes(data.day) ? 'is-selected' : '',
isFutureDate(data.day) ? '' : 'disabled'
]"
@click="handleDateClick(data.day)"
class="calendar-date-cell"
>
{{ data.day.split('-').slice(1).join('-') }}
<span v-if="selectedDates.includes(data.day)"></span>
</p>
</template>
</el-calendar>
</template> </template>
<script setup lang="ts"> <script setup>
import { ref } from 'vue' import { ref } from 'vue';
import { Plus } from '@element-plus/icons-vue';
const dayList = ref([0,1,2,3]) // const selectedDates = ref([]); //
const timeList = ref([
[ //
{ const disabledDate = (date) => {
startTime: '', const today = new Date();
endTime: '' const dateString = date.toISOString().split('T')[0]; // YYYY-MM-DD
const todayString = today.toISOString().split('T')[0];
return dateString < todayString; //
};
//
const isFutureDate = (date) => {
const today = new Date().toISOString().split('T')[0]; // : YYYY-MM-DD
return date >= today; //
};
//
const handleDateClick = (date) => {
if (isFutureDate(date)) {
//
if (selectedDates.value.includes(date)) {
selectedDates.value = selectedDates.value.filter(d => d !== date);
} else {
//
selectedDates.value.push(date);
} }
], }
[ };
{
startTime: '',
endTime: ''
}
],
[
{
startTime: '',
endTime: ''
}
],
[
{
startTime: '',
endTime: ''
}
]
])
const numberRange = ref([])
const addList = (index: any, row: any) => {
if ( timeList.value[index].length < 6) {
timeList.value[index].push({
startTime:'',
endTime:''
})
}
}
const subList = (index: number, row: number) => {
console.log(index,row);
timeList.value[index].splice(row, 1)
}
</script> </script>
<style lang="scss" scoped> <style scoped>
.calendar-date-cell {
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
.is-selected {
color: black;
border-radius: 50%;
}
.disabled {
color: #dcdfe6;
pointer-events: none;
}
.custom-calendar /deep/ .el-calendar-table .el-calendar-day{
height: 50px;
}
</style> </style>