添加注释,测试功能,选择部门组件报错,会员详情积分字段展示错误,售后原因添加标识判断是新增还是编辑

This commit is contained in:
mabo
2021-07-26 14:47:18 +08:00
parent 9130485631
commit a198fc0161
43 changed files with 1291 additions and 5696 deletions

View File

@@ -1,305 +1,322 @@
<template>
<div>
<div class="operation mb_10">
<Button @click="addParent" icon="md-add">添加一级分类</Button>
<div>
<Card>
<div class="operation mb_10">
<Button @click="addParent" type="primary" icon="md-add">添加一级分类</Button>
</div>
<tree-table
ref="treeTable"
size="default"
:loading="loading"
:data="tableData"
:columns="columns"
:border="true"
:show-index="false"
:is-fold="true"
:expand-type="false"
primary-key="id"
>
<template slot="action" slot-scope="scope">
<Button
type="info"
@click="edit(scope.row)"
size="small"
style="margin-right: 5px"
>编辑
</Button>
<Button
type="error"
@click="remove(scope.row)"
size="small"
style="margin-right: 5px"
>删除
</Button>
<Button
v-show="scope.row.level != 2"
type="success"
@click="addChildren(scope.row)"
size="small"
style="margin-right: 5px"
>添加子分类
</Button>
</template>
</tree-table>
</Card>
<Modal
:title="modalTitle"
v-model="modalVisible"
:mask-closable="false"
:width="500"
>
<Form
ref="form"
:model="formAdd"
:label-width="100"
:rules="formValidate"
>
<div v-if="showParent">
<FormItem label="上级分类" prop="parentId">
{{ parentTitle }}
<Input
v-model="formAdd.parentId"
clearable
style="width: 100%; display: none"
/>
</FormItem>
</div>
<tree-table
ref="treeTable"
size="default"
:loading="loading"
:data="tableData"
:columns="columns"
:border="true"
:show-index="false"
:is-fold="true"
:expand-type="false"
primary-key="id">
<template slot="action" slot-scope="scope">
<Button
type="info"
@click="edit(scope.row)"
size="small"
style="margin-right:5px"
>编辑
</Button>
<Button
type="error"
@click="remove(scope.row)"
size="small"
style="margin-right:5px"
>删除
</Button>
<Button
v-show="scope.row.level != 2 "
type="success"
@click="addChildren(scope.row)"
size="small"
style="margin-right:5px"
>添加子分类
</Button>
</template>
</tree-table>
<Modal :title="modalTitle" v-model="modalVisible" :mask-closable='false' :width="500">
<Form ref="form" :model="formAdd" :label-width="100" :rules="formValidate">
<div v-if="showParent">
<FormItem label="上级分类" prop="parentId">
{{parentTitle}}
<Input v-model="formAdd.parentId" clearable style="width:100%;display:none"/>
</FormItem>
</div>
<FormItem label="分类名称" prop="name">
<Input v-model="formAdd.articleCategoryName" clearable style="width:100%"/>
</FormItem>
<FormItem label="排序值" prop="sort" style="width:345px">
<InputNumber v-model="formAdd.sort"></InputNumber>
</FormItem>
</Form>
<div slot="footer">
<Button type="text" @click="modalVisible=false">取消</Button>
<Button type="primary" :loading="submitLoading" @click="Submit">提交</Button>
</div>
</Modal>
</div>
<FormItem label="分类名称" prop="name">
<Input
v-model="formAdd.articleCategoryName"
clearable
style="width: 100%"
/>
</FormItem>
<FormItem label="排序值" prop="sort" style="width: 345px">
<InputNumber v-model="formAdd.sort"></InputNumber>
</FormItem>
</Form>
<div slot="footer">
<Button type="text" @click="modalVisible = false">取消</Button>
<Button type="primary" :loading="submitLoading" @click="Submit"
>提交</Button
>
</div>
</Modal>
</div>
</template>
<script>
import {
saveArticleCategory,
getArticleCategory,
delArticleCategory,
updateArticleCategory
} from "@/api/pages";
import TreeTable from "@/views/my-components/tree-table/Table/Table";
import uploadPicInput from "@/views/my-components/lili/upload-pic-input";
import {
saveArticleCategory,
getArticleCategory,
delArticleCategory,
updateArticleCategory,
} from "@/api/pages";
import TreeTable from "@/views/my-components/tree-table/Table/Table";
import uploadPicInput from "@/views/my-components/lili/upload-pic-input";
export default {
name: "lili-components",
components: {
TreeTable,
uploadPicInput
export default {
name: "lili-components",
components: {
TreeTable,
uploadPicInput,
},
data() {
return {
loading: false, // 加载状态
expandLevel: 1, // 展开的层级
modalType: 0, // 添加或编辑标识
modalVisible: false, // 添加或编辑显示
modalTitle: "", // 添加或编辑标题
showParent: false, // 是否展示上级菜单
parentTitle: "", // 父级菜单名称
formAdd: {
// 添加或编辑表单对象初始化数据
parentId: "",
name: "",
sort: 1,
level: 0,
},
// 表单验证规则
formValidate: {},
columns: [
{
title: "分类名称",
key: "articleCategoryName",
witt: "100px",
},
data() {
return {
currView: "index", // 展示哪一类
loading: false, // 加载状态
brands: [], //品牌集合
Specifications: [], //规格集合
expandLevel: 1, // 展开的层级
modalType: 0, // 添加或编辑标识
modalVisible: false, // 添加或编辑显示
modalTitle: "", // 添加或编辑标题
showParent: false, // 是否展示上级菜单
parentTitle: "", // 父级菜单名称
formAdd: { // 添加或编辑表单对象初始化数据
parentId: "",
name: "",
sort: 1,
level: 0,
},
// 表单验证规则
formValidate: {},
columns: [
{
title: "分类名称",
key: "articleCategoryName",
witt: "100px",
},
{
title: "排序",
key: "sort",
width: "100px",
},
{
title: "操作",
key: "action",
align: "center",
headerAlign: "center",
width: "400px",
type: "template",
template: "action",
}
],
tableData: []
};
{
title: "排序",
key: "sort",
width: "100px",
},
methods: {
init() {
this.getAllList();
// this.getBrandList();
// this.getSpecList()
},
addChildren(v) {
this.modalType = 0;
this.modalTitle = "添加子分类";
this.formAdd.articleCategoryName = "";
this.parentTitle = v.articleCategoryName;
this.formAdd.level = eval(v.level + "+1");
this.showParent = true;
delete this.formAdd.id;
this.formAdd.parentId = v.id;
this.modalVisible = true;
},
edit(v) {
console.log(v);
this.modalType = 1;
this.modalTitle = "编辑";
this.formAdd.id = v.id;
this.formAdd.articleCategoryName = v.articleCategoryName;
this.formAdd.level = v.level;
this.formAdd.parentId = v.parentId;
this.formAdd.sort = v.sort;
this.showParent = false;
this.modalVisible = true;
},
addParent() {
this.modalType = 0;
this.modalTitle = "添加一级分类";
this.parentTitle = "顶级分类";
this.showParent = true;
this.$refs.form.resetFields();
delete this.formAdd.id;
this.formAdd.parentId = 0;
this.modalVisible = true;
},
Submit() {
this.$refs.form.validate(valid => {
if (valid) {
this.submitLoading = true;
if (this.modalType === 0) {
// 添加 避免编辑后传入id等数据 记得删除
delete this.formAdd.id;
saveArticleCategory(this.formAdd).then(res => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("添加成功");
this.formAdd={}
} else {
// this.$Message.error(res.message);
}
this.getAllList();
this.modalVisible = false;
});
} else {
// 编辑
updateArticleCategory(this.formAdd, this.formAdd.id).then(res => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("修改成功");
} else {
// this.$Message.error(res.message);
}
this.getAllList();
this.modalVisible = false;
this.$refs.form.resetFields();
});
}
}
});
},
remove(v) {
this.$Modal.confirm({
title: "确认删除",
// 记得确认修改此处
content: "您确认要删除 " + v.articleCategoryName + " ?",
loading: true,
onOk: () => {
// 删除
delArticleCategory(v.id).then(res => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getAllList();
}
});
}
});
},
getAllList() {
this.loading = true;
getArticleCategory().then(res => {
this.loading = false;
if (res.success) {
// 仅展开指定级数 默认后台已展开所有
let expandLevel = this.expandLevel;
res.result.forEach(function (e) {
if (expandLevel == 1) {
if (e.level == 0) {
e.expand = false;
}
if (e.children && e.children.length > 0) {
e.children.forEach(function (c) {
if (c.level == 1) {
c.expand = false;
}
if (c.children && c.children.length > 0) {
c.children.forEach(function (b) {
if (b.level == 2) {
b.expand = false;
}
});
}
});
}
} else if (expandLevel == 2) {
if (e.level == 0) {
e.expand = true;
}
if (e.children && e.children.length > 0) {
e.children.forEach(function (c) {
if (c.level == 1) {
c.expand = false;
}
if (c.children && c.children.length > 0) {
c.children.forEach(function (b) {
if (b.level == 2) {
b.expand = false;
}
});
}
});
}
} else if (expandLevel == 3) {
if (e.level == 0) {
e.expand = true;
}
if (e.children && e.children.length > 0) {
e.children.forEach(function (c) {
if (c.level == 1) {
c.expand = true;
}
if (c.children && c.children.length > 0) {
c.children.forEach(function (b) {
if (b.level == 2) {
b.expand = false;
}
});
}
});
}
}
});
this.tableData = res.result;
}
});
},
{
title: "操作",
key: "action",
align: "center",
headerAlign: "center",
width: "400px",
type: "template",
template: "action",
},
mounted() {
this.init();
}
],
tableData: [] // 表格数据
};
},
methods: {
// 初始化数据
init() {
this.getAllList();
},
// 添加子分类
addChildren(v) {
this.modalType = 0;
this.modalTitle = "添加子分类";
this.formAdd.articleCategoryName = "";
this.parentTitle = v.articleCategoryName;
this.formAdd.level = eval(v.level + "+1");
this.showParent = true;
delete this.formAdd.id;
this.formAdd.parentId = v.id;
this.modalVisible = true;
},
// 编辑分类
edit(v) {
this.modalType = 1;
this.modalTitle = "编辑";
this.formAdd.id = v.id;
this.formAdd.articleCategoryName = v.articleCategoryName;
this.formAdd.level = v.level;
this.formAdd.parentId = v.parentId;
this.formAdd.sort = v.sort;
this.showParent = false;
this.modalVisible = true;
},
// 添加一级分类
addParent() {
this.modalType = 0;
this.modalTitle = "添加一级分类";
this.parentTitle = "顶级分类";
this.showParent = true;
this.$refs.form.resetFields();
delete this.formAdd.id;
this.formAdd.parentId = 0;
this.modalVisible = true;
},
// 提交
Submit() {
this.$refs.form.validate((valid) => {
if (valid) {
this.submitLoading = true;
if (this.modalType === 0) {
// 添加 避免编辑后传入id等数据 记得删除
delete this.formAdd.id;
saveArticleCategory(this.formAdd).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("添加成功");
this.formAdd = {};
} else {
// this.$Message.error(res.message);
}
this.getAllList();
this.modalVisible = false;
});
} else {
// 编辑
updateArticleCategory(this.formAdd, this.formAdd.id).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("修改成功");
} else {
// this.$Message.error(res.message);
}
this.getAllList();
this.modalVisible = false;
this.$refs.form.resetFields();
});
}
}
});
},
// 删除分类
remove(v) {
this.$Modal.confirm({
title: "确认删除",
content: "您确认要删除 " + v.articleCategoryName + " ?",
loading: true,
onOk: () => {
// 删除
delArticleCategory(v.id).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getAllList();
}
});
},
});
},
// 获取分类数据
getAllList() {
this.loading = true;
getArticleCategory().then((res) => {
this.loading = false;
if (res.success) {
// 仅展开指定级数 默认后台已展开所有
let expandLevel = this.expandLevel;
res.result.forEach(function (e) {
if (expandLevel == 1) {
if (e.level == 0) {
e.expand = false;
}
if (e.children && e.children.length > 0) {
e.children.forEach(function (c) {
if (c.level == 1) {
c.expand = false;
}
if (c.children && c.children.length > 0) {
c.children.forEach(function (b) {
if (b.level == 2) {
b.expand = false;
}
});
}
});
}
} else if (expandLevel == 2) {
if (e.level == 0) {
e.expand = true;
}
if (e.children && e.children.length > 0) {
e.children.forEach(function (c) {
if (c.level == 1) {
c.expand = false;
}
if (c.children && c.children.length > 0) {
c.children.forEach(function (b) {
if (b.level == 2) {
b.expand = false;
}
});
}
});
}
} else if (expandLevel == 3) {
if (e.level == 0) {
e.expand = true;
}
if (e.children && e.children.length > 0) {
e.children.forEach(function (c) {
if (c.level == 1) {
c.expand = true;
}
if (c.children && c.children.length > 0) {
c.children.forEach(function (b) {
if (b.level == 2) {
b.expand = false;
}
});
}
});
}
}
});
this.tableData = res.result;
}
});
},
},
mounted() {
this.init();
},
};
</script>
<style lang="scss" scoped>
.article {
font-size: 16px;
font-weight: 400;
margin: 12px 0;
}
.article {
font-size: 16px;
font-weight: 400;
margin: 12px 0;
}
</style>

View File

@@ -1,9 +1,8 @@
<template>
<div class="wrapper">
<Row>
<Col style=" height: 100%;" span="4">
<Card class="article-category">
<Card class="article-category mr_10">
<Tree :data="treeData" @on-select-change="handleCateChange"></Tree>
</Card>
</Col>
@@ -20,7 +19,7 @@
<Row class="operation padding-row">
<Button @click="add" type="primary">添加</Button>
</Row>
<Table :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom" @on-selection-change="changeSelect">
<Table :loading="loading" border :columns="columns" :data="data" ref="table">
<!-- 页面展示 -->
<template slot="openStatusSlot" slot-scope="scope">
<div>
@@ -38,46 +37,44 @@
</Page>
</Row>
<template v-if="!selected">
<Modal :title="modalTitle" v-model="modalVisible" :mask-closable="false" :width="1100">
<Form ref="form" :model="form" :label-width="100">
<FormItem label="文章标题" prop="title">
<Input v-model="form.title" clearable style="width: 40%" />
</FormItem>
<FormItem label="文章分类" prop="categoryId">
<Select v-model="treeValue" placeholder="请选择" clearable style="width: 180px">
<Option :value="treeValue" style="display: none">{{
treeValue
}}
</Option>
<Tree :data="treeData" @on-select-change="handleCheckChange"></Tree>
</Select>
</FormItem>
<FormItem label="文章排序" prop="sort">
<Input type="number" v-model="form.sort" clearable style="width: 10%" />
</FormItem>
<FormItem class="form-item-view-el" label="文章内容" prop="content">
<editor openXss v-model="form.content"></editor>
</FormItem>
<FormItem label="是否展示" prop="openStatus">
<i-switch size="large" v-model="form.openStatus" :true-value="open" :false-value="close">
<span slot="open">展示</span>
<span slot="close">隐藏</span>
</i-switch>
</FormItem>
</Form>
<div slot="footer">
<Button type="text" @click="modalVisible = false">取消</Button>
<Button type="primary" :loading="submitLoading" @click="handleSubmit">提交</Button>
</div>
</Modal>
</template>
</Card>
</Col>
</Row>
<template v-if="!selected">
<Modal :title="modalTitle" v-model="modalVisible" :mask-closable="false" :width="1100">
<Form ref="form" :model="form" :label-width="100">
<FormItem label="文章标题" prop="title">
<Input v-model="form.title" clearable style="width: 40%" />
</FormItem>
<FormItem label="文章分类" prop="categoryId">
<Select v-model="treeValue" placeholder="请选择" clearable style="width: 180px">
<Option :value="treeValue" style="display: none">{{
treeValue
}}
</Option>
<Tree :data="treeData" @on-select-change="handleCheckChange"></Tree>
</Select>
</FormItem>
<FormItem label="文章排序" prop="sort">
<Input type="number" v-model="form.sort" clearable style="width: 10%" />
</FormItem>
<FormItem class="form-item-view-el" label="文章内容" prop="content">
<editor openXss v-model="form.content"></editor>
</FormItem>
<FormItem label="是否展示" prop="openStatus">
<i-switch size="large" v-model="form.openStatus" :true-value="open" :false-value="close">
<span slot="open">展示</span>
<span slot="close">隐藏</span>
</i-switch>
</FormItem>
</Form>
<div slot="footer">
<Button type="text" @click="modalVisible = false">取消</Button>
<Button type="primary" :loading="submitLoading" @click="handleSubmit">提交</Button>
</div>
</Modal>
</template>
</div>
</template>
@@ -135,8 +132,6 @@ export default {
//树结构
treeData: [],
submitLoading: false, // 添加或编辑提交状态
selectList: [], // 多选数据
selectCount: 0, // 多选计数
columns: [
// 表头
{
@@ -293,10 +288,10 @@ export default {
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
// 改变页码
changePageSize(v) {
this.selected.pageNumber = 1;
this.searchForm.pageSize = v;
this.getDataList();
},
@@ -306,15 +301,6 @@ export default {
this.searchForm.pageSize = 10;
this.getDataList();
},
// 取消全选
clearSelectAll() {
this.$refs.table.selectAll(false);
},
// 列表选择回调
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
// 获取全部文章分类
getAllList(parent_id) {
this.loading = true;
@@ -353,7 +339,6 @@ export default {
getDataList(val) {
if (val) this.form = {};
this.loading = true;
// 带多条件搜索参数获取表单数据 请自行修改接口
getArticle(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
@@ -434,10 +419,10 @@ export default {
}
});
},
// 删除文章
remove(v) {
this.$Modal.confirm({
title: "确认删除",
// 记得确认修改此处
content: "您确认要删除么?",
loading: true,
onOk: () => {

View File

@@ -8,15 +8,12 @@
:columns="columns"
:data="data"
ref="table"
sortable="custom"
@on-sort-change="changeSort"
@on-selection-change="changeSelect"
></Table>
<Row type="flex" justify="end" class="mt_10">
<Page
:current="pageNumber"
:current="searchForm.pageNumber"
:total="total"
:page-size="pageSize"
:page-size="searchForm.pageSize"
@on-change="changePage"
@on-page-size-change="changePageSize"
:page-size-opts="[10, 20, 50]"
@@ -28,7 +25,7 @@
</Row>
</Card>
<!-- 修改模态框 -->
<Modal v-model="formValidate" :title="modalTitle" @on-ok="" width="500">
<Modal v-model="formValidate" title="详细信息" width="500">
<Form
ref="formValidate"
:model="form"
@@ -54,7 +51,7 @@
暂无
</div>
<div v-else>
<span v-for="(item, index) in this.form.images.split(',')">
<span v-for="(item, index) in this.form.images.split(',')" :key="index">
<Avatar shape="square" icon="ios-person" size="large" style="width: 80px;height: 90px;margin-right: 5px" :src="item"
/>
</span>
@@ -75,25 +72,17 @@
} from "@/api/other";
export default {
name: "role-manage",
name: "feedback",
data() {
return {
loading: true, // 加载状态
modalType: 0, // 0 添加 1 编辑
form: {}, // 表单数据
searchForm: { // 请求参数
pageNumber: 1,
pageSize: 10,
},
modalTitle: "详细", // modal标题
formValidate: false, // modal显隐
images: [], // 图片列表
columns: [ // 表头
{
type: "selection",
width: 60,
align: "center",
},
{
title: "会员名称",
key: "userName",
@@ -140,7 +129,6 @@
title: "操作",
key: "action",
align: "center",
fixed: "right",
width: 130,
render: (h, params) => {
return h("div", [
@@ -166,42 +154,27 @@
},
},
],
data: [],
pageNumber: 1,
pageSize: 10,
total: 0,
permData: [],
editRolePermId: "",
selectAllFlag: false,
depData: [],
dataType: 0,
editDepartments: [],
data: [], // 表格数据
total: 0 // 数据总数
saveRoleWay: [], //用户保存用户点击的菜单
};
},
methods: {
// 初始化数据
init() {
this.getFeedback();
},
// 分页 修改页码
changePage(v) {
this.searchForm.pageNumber = v;
this.getFeedback();
},
// 分页 修改页数
changePageSize(v) {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = v;
this.getFeedback();
},
changeSort(e) {
this.sortColumn = e.key;
this.sortType = e.order;
if (e.order == "normal") {
this.sortType = "";
}
this.getFeedback();
},
/**
* 查询意见反馈
*/
@@ -226,7 +199,6 @@
this.formValidate = true
}
});
}
},
mounted() {