This commit is contained in:
2025-12-24 15:26:01 +08:00
2 changed files with 108 additions and 142 deletions

View File

@@ -1,28 +1,53 @@
<template> <template>
<el-dialog v-model="dialogVisible" title="选择图片" width="50%"> <el-dialog v-model="dialogVisible" title="选择图片" width="50%">
<el-container> <el-container>
<el-aside style="background-color: #fff;border-right: 1px solid #ccc;" width="150px"> <el-aside style="background-color: #fff; border-right: 1px solid #ccc" width="150px">
<el-button @click="addtype">新增分类</el-button> <el-button @click="addtype">新增分类</el-button>
<ul style="padding-left: 0;margin: 0;"> <ul style="padding-left: 0; margin: 0">
<li style="cursor: pointer;width: 90%;margin: 10px 0 ;" v-for="item in options" :key="item.id" <li
:class="[activedata == item.id ? 'activedata' : '']" @click="changeEvent(item.id)"> style="cursor: pointer; width: 90%; margin: 10px 0"
<div style="display: flex;align-items: center;justify-content: space-between;"> v-for="item in options"
:key="item.id"
:class="[activedata == item.id ? 'activedata' : '']"
@click="changeEvent(item.id)"
>
<div style="display: flex; align-items: center; justify-content: space-between">
{{ item.name }} {{ item.name }}
<div> <div>
<span @click="edittype(item)" v-if="activedata == item.id && item.isSystem != 1" <span
style="color: #999;">修改</span>&nbsp; @click="edittype(item)"
<span @click="deletetype(item.id)" v-if="activedata == item.id && item.isSystem != 1" v-if="activedata == item.id && item.isSystem != 1"
style="color: #999;">删除</span>&nbsp; style="color: #999"
>
修改
</span>
&nbsp;
<span
@click="deletetype(item.id)"
v-if="activedata == item.id && item.isSystem != 1"
style="color: #999"
>
删除
</span>
&nbsp;
</div> </div>
</div> </div>
</li> </li>
</ul> </ul>
</el-aside> </el-aside>
<el-main> <el-main>
<imageComponent v-if="activedata" @onSelectImage="onSelectImage" @getList="getList" :activedata="activedata" <imageComponent
:list='dataImages'> v-if="activedata"
</imageComponent> @onSelectImage="onSelectImage"
<mypagination :total="total" v-if="activedata" @gopageEvent="handleCurrentChange"></mypagination> @getList="getList"
:activedata="activedata"
:list="dataImages"
></imageComponent>
<mypagination
:total="total"
v-if="activedata"
@gopageEvent="handleCurrentChange"
></mypagination>
</el-main> </el-main>
</el-container> </el-container>
<template #footer> <template #footer>
@@ -38,14 +63,16 @@
</template> </template>
<script> <script>
import API from './addImgconfig/gallery' import API from "./addImgconfig/gallery";
import API2 from './addImgconfig/picture' import API2 from "./addImgconfig/picture";
import myDialog from './myDialog.vue' import myDialog from "./myDialog.vue";
import imageComponent from './addImgconfig/imageComponent.vue' import imageComponent from "./addImgconfig/imageComponent.vue";
import mypagination from './addImgconfig/mypagination.vue' import mypagination from "./addImgconfig/mypagination.vue";
export default { export default {
components: { components: {
imageComponent, mypagination, myDialog imageComponent,
mypagination,
myDialog,
}, },
data() { data() {
return { return {
@@ -57,127 +84,122 @@ export default {
dataImages: [], dataImages: [],
options: [], options: [],
fileList: [], fileList: [],
editId: '', editId: "",
// 新增分类 // 新增分类
typedata: '', typedata: "",
showUpload: false, showUpload: false,
page: 1, page: 1,
total: 0, total: 0,
pageSize: 18, pageSize: 18,
activedata: '', activedata: "",
title: '新增分类', title: "新增分类",
};
}
}, },
async mounted() { async mounted() {
await this.getType() await this.getType();
this.getList() // this.getList();
}, },
methods: { methods: {
async subitgood() { async subitgood() {
if (this.typedata) { if (this.typedata) {
let res = '' let res = "";
if (this.title == '新增分类') { if (this.title == "新增分类") {
res = await API.add({ res = await API.add({
sort: '1', sort: "1",
name: this.typedata name: this.typedata,
}); });
} else { } else {
res = await API.update({ res = await API.update({
sort: '1', sort: "1",
name: this.typedata, name: this.typedata,
id: this.editId id: this.editId,
}); });
} }
if (res.code == 200) { if (res.code == 200) {
this.getType() this.getType();
ElMessage({ ElMessage({
type: 'success', type: "success",
message: '成功', message: "成功",
}) });
this.$refs.myDialogRef.close() this.$refs.myDialogRef.close();
this.typedata = '' this.typedata = "";
} }
} }
}, },
changeEvent(id) { changeEvent(id) {
this.page = 1 this.page = 1;
this.pageSize = 18 this.pageSize = 18;
this.activedata = id this.activedata = id;
this.getList() this.getList();
}, },
handleCurrentChange(i) { handleCurrentChange(i) {
this.page = i this.page = i;
this.getList() this.getList();
}, },
Confirm() { Confirm() {
this.dialogVisible = false this.dialogVisible = false;
console.log(1111111111111, this.selectImage) console.log(1111111111111, this.selectImage);
this.$emit('successEvent', this.selectImage) this.$emit("successEvent", this.selectImage);
}, },
handleBeforeRemove(file, fileList) { handleBeforeRemove(file, fileList) {
let index = this.files.findIndex(ele => ele.name == file.name) let index = this.files.findIndex((ele) => ele.name == file.name);
this.files.splice(index, 1); this.files.splice(index, 1);
}, },
handleSuccess(response, file, fileList) { handleSuccess(response, file, fileList) {
this.files.push(file) this.files.push(file);
}, },
async deletetype(id) { async deletetype(id) {
ElMessageBox.confirm( ElMessageBox.confirm("删除该类型, 是否继续?", "提示", {
'删除该类型, 是否继续?', confirmButtonText: "确定",
'提示', cancelButtonText: "取消",
{ type: "warning",
confirmButtonText: '确定', })
cancelButtonText: '取消',
type: 'warning',
}
)
.then(async () => { .then(async () => {
const res = await API.deleteByIds(id); const res = await API.deleteByIds(id);
if (res.code == 200) { if (res.code == 200) {
ElMessage({ ElMessage({
type: 'success', type: "success",
message: '成功', message: "成功",
}) });
this.getType() this.getType();
} }
})
.catch(() => {
}) })
.catch(() => {});
}, },
addtype() { addtype() {
this.title = '新增分类' this.title = "新增分类";
this.$refs.myDialogRef.open() this.$refs.myDialogRef.open();
}, },
show() { show() {
this.dialogVisible = true this.dialogVisible = true;
}, },
edittype(item) { edittype(item) {
this.editId = item.id this.editId = item.id;
this.typedata = item.name this.typedata = item.name;
this.title = '修改分类' this.title = "修改分类";
this.$refs.myDialogRef.open() this.$refs.myDialogRef.open();
}, },
async getList() { async getList() {
const res = await API2.getPage({ pictureClassifyId: this.activedata, page: this.page, size: this.pageSize }); const res = await API2.getPage({
this.dataImages = res.records pictureClassifyId: this.activedata,
this.total = res.totalRow page: this.page,
size: this.pageSize,
});
this.dataImages = res.records;
this.total = res.totalRow;
}, },
async getType() { async getType() {
const res = await API.getList({}); const res = await API.getList({});
this.options = res this.options = res;
this.activedata = res[0].id this.activedata = res[0].id;
this.getList() this.getList();
}, },
onSelectImage(d) { onSelectImage(d) {
this.selectImage = [d] this.selectImage = [d];
} },
} },
} };
</script> </script>
<style scoped> <style scoped>
.activedata { .activedata {

View File

@@ -304,62 +304,6 @@ onMounted(() => {
gethaocaiList(); gethaocaiList();
}); });
if (isSyncStatus()) {
contentConfig.toolbar[0].hidden = true;
contentConfig.toolbar[1].hidden = false;
contentConfig.cols[contentConfig.cols.length - 1].operat[2].hidden = true;
} else {
contentConfig.toolbar[0].hidden = false;
contentConfig.toolbar[1].hidden = true;
contentConfig.cols[contentConfig.cols.length - 1].operat[2].hidden = false;
}
onMounted(() => {
console.log(route.query);
if (route.query.id) {
contentRef.value?.fetchPageData({ id: route.query.id });
}
// 获取耗材列表
gethaocaiList();
});
if (isSyncStatus()) {
contentConfig.toolbar[0].hidden = true;
contentConfig.toolbar[1].hidden = false;
contentConfig.cols[contentConfig.cols.length - 1].operat[2].hidden = true;
} else {
contentConfig.toolbar[0].hidden = false;
contentConfig.toolbar[1].hidden = true;
contentConfig.cols[contentConfig.cols.length - 1].operat[2].hidden = false;
}
onMounted(() => {
console.log(route.query);
if (route.query.id) {
contentRef.value?.fetchPageData({ id: route.query.id });
}
// 获取耗材列表
gethaocaiList();
});
if (isSyncStatus()) {
contentConfig.toolbar[0].hidden = true;
contentConfig.toolbar[1].hidden = false;
contentConfig.cols[contentConfig.cols.length - 1].operat[2].hidden = true;
} else {
contentConfig.toolbar[0].hidden = false;
contentConfig.toolbar[1].hidden = true;
contentConfig.cols[contentConfig.cols.length - 1].operat[2].hidden = false;
}
onMounted(() => {
console.log(route.query);
if (route.query.id) {
contentRef.value?.fetchPageData({ id: route.query.id });
}
// 获取耗材列表
gethaocaiList();
});
function newHandleQueryClick(e: IObject | undefined) { function newHandleQueryClick(e: IObject | undefined) {
const filterParams = contentRef.value?.getFilterParams(); const filterParams = contentRef.value?.getFilterParams();
contentRef.value?.fetchPageData({ ...e, ...filterParams }, true); contentRef.value?.fetchPageData({ ...e, ...filterParams }, true);