feat(发票管理): 新增发票详情功能和优化发票信息展示

- 在会员API中添加获取发票详情的接口
- 更新发票模态框,支持电子普通发票和增值税专用发票的详细信息展示
- 在订单详情页和支付页面优化发票信息的显示逻辑
- 增加发票信息的校验和格式化处理
This commit is contained in:
田香琪
2026-04-13 18:52:32 +08:00
parent 2e8d257140
commit b6a2dbc23a
7 changed files with 1069 additions and 382 deletions

View File

@@ -1,5 +1,6 @@
<style lang="scss">
@import "./ossManage.scss";
.group-row {
padding-top: 10px;
border-top: 1px solid #ededed;
@@ -7,94 +8,111 @@
display: flex;
align-items: center;
justify-content: center;
> * {
margin-right: 10px;
}
}
.article-category {
flex: 2;
min-width: 200px;
}
.table {
flex: 11;
}
.ivu-card {
width: 100%;
}
.modal-footer {
text-align: center;
> * {
margin: 0 10px;
}
}
.tab-empty {
padding: 48px 0;
color: #999;
text-align: center;
}
.tabs-card {
margin-bottom: 16px;
}
</style>
<template>
<div class="search">
<Card class="tabs-card">
<Tabs v-model="activeRoleTab" @on-click="handleRoleTabChange">
<TabPane label="管理员" name="MANAGER"></TabPane>
<TabPane label="商家" name="STORE"></TabPane>
<TabPane label="用户" name="MEMBER"></TabPane>
<TabPane label="客服" name="CUSTOMER"></TabPane>
</Tabs>
</Card>
<Row>
<Card>
<div class="operation">
<Row @keydown.enter.native="handleSearch">
<Form
ref="searchForm"
:label-width="85"
:model="searchForm"
class="search-form"
inline
>
<Form-item label="上传时间">
<DatePicker
v-model="selectDate"
clearable
format="yyyy-MM-dd"
placeholder="选择起始时间"
style="width: 240px"
type="daterange"
@on-change="selectDateRange"
></DatePicker>
</Form-item>
<Form-item label="上传人" prop="ownerName">
<Input
type="text"
v-model="searchForm.ownerName"
placeholder="图片拥有者名称"
clearable
style="width: 240px"
/>
</Form-item>
<Button
class="search-btn"
icon="ios-search"
type="primary"
@click="handleSearch"
>搜索
</Button>
</Form>
</Row>
</div></Card><Card><div>
<div>
<div class="operation">
<Row @keydown.enter.native="handleSearch">
<Form
ref="searchForm"
:label-width="85"
:model="searchForm"
class="search-form"
inline
>
<Form-item label="上传时间">
<DatePicker
v-model="selectDate"
clearable
format="yyyy-MM-dd"
placeholder="选择起始时间"
style="width: 240px"
type="daterange"
@on-change="selectDateRange"
></DatePicker>
</Form-item>
<Button
class="search-btn"
icon="ios-search"
type="primary"
@click="handleSearch"
>搜索
</Button>
</Form>
</Row>
</div>
<Row class="oss-manage-box">
<Col :span="isComponent?5:4">
<Col v-if="canShowGroups" :span="isComponent?5:4">
<div class="file-list">
<div class="article-category mr_10">
<Tree :data="treeData" :render="renderContent" @on-select-change.self="handleCateChange" class="demo-tree-render"></Tree>
<Tree :data="treeData" :render="renderContent" @on-select-change.self="handleCateChange"
class="demo-tree-render"></Tree>
<div class="group-row flex" v-if="!isComponent">
<Button @click="handleClickAddGroup">添加分组</Button>
</div>
</div>
</div>
</Col>
<Col :span="isComponent?19:20">
<Col :span="canShowGroups ? (isComponent ? 19 : 20) : 24">
<div class="pic-list">
<div>
<div class="oss-operation padding-row" style="display: flex;flex-direction: row-reverse;">
<div>
<Upload
v-if="canUploadImages"
ref="up"
:action="commonUrl + '/common/common/upload/file'"
:data="{
directoryPath: searchForm.fileDirectoryId,
}"
:data="uploadData"
:headers="accessToken"
:before-upload="beforeUpload"
:max-size="20480"
:on-error="handleError"
:on-exceeded-size="handleMaxSize"
@@ -105,18 +123,7 @@
>
<Button>上传图片</Button>
</Upload>
<Dropdown @on-click="handleDropdown" v-if="!isComponent">
<Button>
更多操作
<Icon type="md-arrow-dropdown"/>
</Button>
<DropdownMenu slot="list">
<DropdownItem name="refresh">刷新</DropdownItem>
<DropdownItem v-show="showType == 'list'" name="removeAll"
>批量删除
</DropdownItem>
</DropdownMenu>
</Dropdown>
<Button v-if="!isComponent && showType == 'list'" @click="removeAll">批量删除</Button>
</div>
</div>
</div>
@@ -126,20 +133,33 @@
<div v-for="(item, index) in data" :key="index" class="img-item">
<Checkbox :label="item.id+','+item.url" class="check-box">
<template>
<div class="card" @mouseenter.active="onMouseOver(item, index)" @mouseleave.active="onMouseOut(item, index)">
<div class="card" @mouseenter.active="onMouseOver(item, index)"
@mouseleave.active="onMouseOut(item, index)">
<!--<div class="custom-checkbox-card-mask"><div class="custom-checkbox-card-mask-dot"/></div>-->
<img :src="item.url" alt="" />
<img :src="item.url" alt=""/>
<div v-if="item.isShowPreview" class="preview">
<div @click.prevent="download(item)"><Tooltip content="下载"><Icon type="md-cloud-download" size="18" /></Tooltip></div>
<div @click.prevent="remove(item)"><Tooltip content="删除"><Icon type="md-trash" size="18" /></Tooltip></div>
<div @click.prevent="showPic(item)"><Tooltip content="预览"><Icon type="ios-eye" size="22" /></Tooltip></div>
<div @click.prevent="download(item)">
<Tooltip content="下载">
<Icon type="md-cloud-download" size="18"/>
</Tooltip>
</div>
<div @click.prevent="remove(item)">
<Tooltip content="删除">
<Icon type="md-trash" size="18"/>
</Tooltip>
</div>
<div @click.prevent="showPic(item)">
<Tooltip content="预览">
<Icon type="ios-eye" size="22"/>
</Tooltip>
</div>
</div>
</div>
</template>
</Checkbox>
<div>
<Tooltip :content="item.name" placement="bottom">
<div class="text">{{item.name}}</div>
<div class="text">{{ item.name }}</div>
</Tooltip>
</div>
</div>
@@ -147,173 +167,172 @@
</CheckboxGroup>
</div>
<div class="page-box">
<Page :total="total" :page-size="searchForm.pageSize" show-elevator @on-change="pageChange" size="small" />
<Page :total="total" :page-size="searchForm.pageSize" show-elevator @on-change="pageChange"
size="small"/>
</div>
</div>
</Col>
</Row>
<!--<div class="oss-operation padding-row">-->
<!--<div>-->
<!--<Upload-->
<!--ref="up"-->
<!--:action="commonUrl + '/common/common/upload/file'"-->
<!--:data="{-->
<!--directoryPath: searchForm.fileDirectoryId,-->
<!--}"-->
<!--:headers="accessToken"-->
<!--:max-size="20480"-->
<!--:on-error="handleError"-->
<!--:on-exceeded-size="handleMaxSize"-->
<!--:on-success="handleSuccess"-->
<!--:show-upload-list="false"-->
<!--multiple-->
<!--style="display: inline-block"-->
<!--&gt;-->
<!--<Button>上传图片</Button>-->
<!--</Upload>-->
<!--<Dropdown @on-click="handleDropdown" v-if="!isComponent">-->
<!--<Button>-->
<!--更多操作-->
<!--<Icon type="md-arrow-dropdown"/>-->
<!--</Button>-->
<!--<DropdownMenu slot="list">-->
<!--<DropdownItem name="refresh">刷新</DropdownItem>-->
<!--<DropdownItem v-show="showType == 'list'" name="removeAll"-->
<!--&gt;批量删除-->
<!--</DropdownItem>-->
<!--</DropdownMenu>-->
<!--</Dropdown>-->
<!--</div>-->
<!--<div>-->
<!--<Upload-->
<!--ref="up"-->
<!--:action="commonUrl + '/common/common/upload/file'"-->
<!--:data="{-->
<!--directoryPath: searchForm.fileDirectoryId,-->
<!--}"-->
<!--:headers="accessToken"-->
<!--:max-size="20480"-->
<!--:on-error="handleError"-->
<!--:on-exceeded-size="handleMaxSize"-->
<!--:on-success="handleSuccess"-->
<!--:show-upload-list="false"-->
<!--multiple-->
<!--style="display: inline-block"-->
<!--&gt;-->
<!--<Button>上传图片</Button>-->
<!--</Upload>-->
<!--<Dropdown @on-click="handleDropdown" v-if="!isComponent">-->
<!--<Button>-->
<!--更多操作-->
<!--<Icon type="md-arrow-dropdown"/>-->
<!--</Button>-->
<!--<DropdownMenu slot="list">-->
<!--<DropdownItem name="refresh">刷新</DropdownItem>-->
<!--<DropdownItem v-show="showType == 'list'" name="removeAll"-->
<!--&gt;批量删除-->
<!--</DropdownItem>-->
<!--</DropdownMenu>-->
<!--</Dropdown>-->
<!--</div>-->
<!--</div>-->
</div>
<!--<Alert show-icon v-if="!isComponent">-->
<!--已选择-->
<!--<span>{{ selectCount }}</span> -->
<!--<a class="select-clear" @click="clearSelectAll">清空</a>-->
<!--<span v-if="selectCount > 0" style="margin-left: 15px"-->
<!--&gt;共计 {{ totalSize }} 存储量</span-->
<!--&gt;-->
<!--已选择-->
<!--<span>{{ selectCount }}</span> -->
<!--<a class="select-clear" @click="clearSelectAll">清空</a>-->
<!--<span v-if="selectCount > 0" style="margin-left: 15px"-->
<!--&gt;共计 {{ totalSize }} 存储量</span-->
<!--&gt;-->
<!--</Alert>-->
<!--<div v-show="showType === 'list'" >-->
<!--<div class="flex">-->
<!--<div class="article-category mr_10">-->
<!--<Tree-->
<!--:data="treeData"-->
<!--@on-contextmenu="handleContextMenu"-->
<!--@on-select-change="handleCateChange"-->
<!--&gt;-->
<!--<template slot="contextMenu" v-if="!isComponent">-->
<!--<DropdownItem @click.native="handleContextMenuEdit"-->
<!--&gt;编辑-->
<!--</DropdownItem-->
<!--&gt;-->
<!--<DropdownItem-->
<!--style="color: #ed4014"-->
<!--@click.native="handleContextMenuDelete"-->
<!--&gt;删除-->
<!--</DropdownItem-->
<!--&gt;-->
<!--</template>-->
<!--</Tree>-->
<!--<Alert v-if="!isComponent">鼠标右键编辑/删除分组</Alert>-->
<!--<div class="group-row flex" v-if="!isComponent">-->
<!--<Button @click="handleClickAddGroup">添加分组</Button>-->
<!--</div>-->
<!--</div>-->
<!--<div class="flex">-->
<!--<div class="article-category mr_10">-->
<!--<Tree-->
<!--:data="treeData"-->
<!--@on-contextmenu="handleContextMenu"-->
<!--@on-select-change="handleCateChange"-->
<!--&gt;-->
<!--<template slot="contextMenu" v-if="!isComponent">-->
<!--<DropdownItem @click.native="handleContextMenuEdit"-->
<!--&gt;编辑-->
<!--</DropdownItem-->
<!--&gt;-->
<!--<DropdownItem-->
<!--style="color: #ed4014"-->
<!--@click.native="handleContextMenuDelete"-->
<!--&gt;删除-->
<!--</DropdownItem-->
<!--&gt;-->
<!--</template>-->
<!--</Tree>-->
<!--<Alert v-if="!isComponent">鼠标右键编辑/删除分组</Alert>-->
<!--<div class="group-row flex" v-if="!isComponent">-->
<!--<Button @click="handleClickAddGroup">添加分组</Button>-->
<!--</div>-->
<!--</div>-->
<!--<Table-->
<!--ref="table"-->
<!--:columns="isComponent ? viewColumns : columns"-->
<!--:data="data"-->
<!--:loading="loading"-->
<!--border-->
<!--class="table"-->
<!--sortable="custom"-->
<!--@on-sort-change="changeSort"-->
<!--@on-selection-change="changeSelect"-->
<!--&gt;-->
<!--<template slot="fileKey" slot-scope="{ row }">-->
<!--<a @click="copyFileUrl(row)">{{ row.fileKey }}</a>-->
<!--</template>-->
<!--</Table>-->
<!--</div>-->
<!--<Table-->
<!--ref="table"-->
<!--:columns="isComponent ? viewColumns : columns"-->
<!--:data="data"-->
<!--:loading="loading"-->
<!--border-->
<!--class="table"-->
<!--sortable="custom"-->
<!--@on-sort-change="changeSort"-->
<!--@on-selection-change="changeSelect"-->
<!--&gt;-->
<!--<template slot="fileKey" slot-scope="{ row }">-->
<!--<a @click="copyFileUrl(row)">{{ row.fileKey }}</a>-->
<!--</template>-->
<!--</Table>-->
<!--</div>-->
<!--</div>-->
<!--<div v-show="showType === 'thumb'">-->
<!--<div class="oss-wrapper">-->
<!--<Card v-for="(item, i) in data" :key="i" class="oss-card">-->
<!--<div class="content">-->
<!--<img-->
<!--v-if="item.fileType.indexOf('image') >= 0"-->
<!--:src="item.url"-->
<!--class="img"-->
<!--@click="showPic(item)"-->
<!--/>-->
<!--<div-->
<!--v-else-if="item.fileType.indexOf('video') >= 0"-->
<!--class="video"-->
<!--@click="showVideo(item)"-->
<!--&gt;-->
<!--&lt;!&ndash; 文件小于5MB显示video &ndash;&gt;-->
<!--<video v-if="item.fileSize < 1024 * 1024 * 5" class="cover">-->
<!--<source :src="item.url"/>-->
<!--</video>-->
<!--<img class="play" src="@/assets/play.png"/>-->
<!--</div>-->
<!--<div v-else class="other">-->
<!--<div class="name">{{ item.name }}</div>-->
<!--<div class="key">{{ item.fileKey }}</div>-->
<!--<div class="info">-->
<!--文件类型{{ item.fileType }} 文件大小{{-->
<!--((item.fileSize * 1.0) / (1024 * 1024)).toFixed(2)-->
<!--}}-->
<!--MB 创建时间{{ item.createTime }}-->
<!--</div>-->
<!--</div>-->
<!--<div class="actions">-->
<!--<div class="btn">-->
<!--<Tooltip content="下载" placement="top">-->
<!--<Icon-->
<!--size="16"-->
<!--type="md-download"-->
<!--@click="download(item)"-->
<!--/>-->
<!--</Tooltip>-->
<!--</div>-->
<!--<div class="btn">-->
<!--<Tooltip content="重命名" placement="top">-->
<!--<Icon size="16" type="md-create" @click="rename(item)"/>-->
<!--</Tooltip>-->
<!--</div>-->
<!--<div class="btn-no">-->
<!--<Tooltip content="删除" placement="top">-->
<!--<Icon size="16" type="md-trash" @click="remove(item)"/>-->
<!--</Tooltip>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</Card>-->
<!--</div>-->
<!--<div class="oss-wrapper">-->
<!--<Card v-for="(item, i) in data" :key="i" class="oss-card">-->
<!--<div class="content">-->
<!--<img-->
<!--v-if="item.fileType.indexOf('image') >= 0"-->
<!--:src="item.url"-->
<!--class="img"-->
<!--@click="showPic(item)"-->
<!--/>-->
<!--<div-->
<!--v-else-if="item.fileType.indexOf('video') >= 0"-->
<!--class="video"-->
<!--@click="showVideo(item)"-->
<!--&gt;-->
<!--&lt;!&ndash; 文件小于5MB显示video &ndash;&gt;-->
<!--<video v-if="item.fileSize < 1024 * 1024 * 5" class="cover">-->
<!--<source :src="item.url"/>-->
<!--</video>-->
<!--<img class="play" src="@/assets/play.png"/>-->
<!--</div>-->
<!--<div v-else class="other">-->
<!--<div class="name">{{ item.name }}</div>-->
<!--<div class="key">{{ item.fileKey }}</div>-->
<!--<div class="info">-->
<!--文件类型{{ item.fileType }} 文件大小{{-->
<!--((item.fileSize * 1.0) / (1024 * 1024)).toFixed(2)-->
<!--}}-->
<!--MB 创建时间{{ item.createTime }}-->
<!--</div>-->
<!--</div>-->
<!--<div class="actions">-->
<!--<div class="btn">-->
<!--<Tooltip content="下载" placement="top">-->
<!--<Icon-->
<!--size="16"-->
<!--type="md-download"-->
<!--@click="download(item)"-->
<!--/>-->
<!--</Tooltip>-->
<!--</div>-->
<!--<div class="btn">-->
<!--<Tooltip content="重命名" placement="top">-->
<!--<Icon size="16" type="md-create" @click="rename(item)"/>-->
<!--</Tooltip>-->
<!--</div>-->
<!--<div class="btn-no">-->
<!--<Tooltip content="删除" placement="top">-->
<!--<Icon size="16" type="md-trash" @click="remove(item)"/>-->
<!--</Tooltip>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</Card>-->
<!--</div>-->
<!--</div>-->
<!--<Row class="mt_10" justify="end" type="flex">-->
<!--<Page-->
<!--:current="searchForm.pageNumber"-->
<!--:page-size="searchForm.pageSize"-->
<!--:page-size-opts="pageSizeOpts"-->
<!--:total="total"-->
<!--show-elevator-->
<!--show-sizer-->
<!--show-total-->
<!--size="small"-->
<!--@on-change="changePage"-->
<!--@on-page-size-change="changePageSize"-->
<!--&gt;</Page>-->
<!--<Page-->
<!--:current="searchForm.pageNumber"-->
<!--:page-size="searchForm.pageSize"-->
<!--:page-size-opts="pageSizeOpts"-->
<!--:total="total"-->
<!--show-elevator-->
<!--show-sizer-->
<!--show-total-->
<!--size="small"-->
<!--@on-change="changePage"-->
<!--@on-page-size-change="changePageSize"-->
<!--&gt;</Page>-->
<!--</Row>-->
</Card>
</Row>
@@ -416,7 +435,7 @@ import {
updateFileDirectory,
} from "@/api/index";
import DPlayer from "dplayer";
import { commonUrl } from "@/libs/axios";
import {commonUrl} from "@/libs/axios";
const config = require("@/config/index");
@@ -478,12 +497,13 @@ export default {
picTitle: "", // 图片title
videoTitle: "", // 视频title
modalTitle: "", // 添加或编辑标题
activeRoleTab: "MANAGER",
searchForm: {
// 搜索框对应data对象
name: "",
fileKey: "",
fileType: "",
ownerName: "",
userEnums: "MANAGER",
pageNumber: 1, // 当前页数
pageSize: 20, // 页面大小
sort: "createTime", // 默认排序字段
@@ -618,9 +638,11 @@ export default {
if (params.row.userEnums == "MANAGER") {
m = "[管理员]";
} else if (params.row.userEnums == "STORE") {
m = "[店铺]";
m = "[商家]";
} else if (params.row.userEnums == "CUSTOMER") {
m = "[客服]";
} else {
m = "[会员]";
m = "[用户]";
}
m += params.row.createBy;
return h("span", m);
@@ -800,9 +822,11 @@ export default {
if (params.row.userEnums == "MANAGER") {
m = "[管理员]";
} else if (params.row.userEnums == "STORE") {
m = "[店铺]";
m = "[商家]";
} else if (params.row.userEnums == "CUSTOMER") {
m = "[客服]";
} else {
m = "[会员]";
m = "[用户]";
}
m += params.row.createBy;
return h("span", m);
@@ -856,17 +880,33 @@ export default {
{
title: 'parent 1',
expand: true,
render: (h, { root, node, data }) => {
render: (h, {root, node, data}) => {
return h('span', {style: {display: 'inline-block', width: '100%'}}, [
h('span', [h("Icon", {type: 'ios-folder-outline', style: {marginRight: '8px'}}), h('span', data.title)]),
h('span', {style: {display: 'inline-block', float: 'right', marginRight: '32px'}},
[h("Button", {...this.buttonProps, icon: 'ios-add', type: 'primary', style: {width: '64px'}, onClick: () => { this.append(data) }})
])
[h("Button", {
...this.buttonProps,
icon: 'ios-add',
type: 'primary',
style: {width: '64px'},
onClick: () => {
this.append(data)
}
})
])
]);
},
children: [
{title: 'child 1-1', expand: true, children: [{title: 'leaf 1-1-1', expand: true}, {title: 'leaf 1-1-2', expand: true}]},
{title: 'child 1-2', expand: true, children: [{title: 'leaf 1-2-1', expand: true}, {title: 'leaf 1-2-1', expand: true}]}
{
title: 'child 1-1',
expand: true,
children: [{title: 'leaf 1-1-1', expand: true}, {title: 'leaf 1-1-2', expand: true}]
},
{
title: 'child 1-2',
expand: true,
children: [{title: 'leaf 1-2-1', expand: true}, {title: 'leaf 1-2-1', expand: true}]
}
]
}
],
@@ -882,7 +922,7 @@ export default {
},
selectedOss(val) {
if (val && val.length) {
this.$emit("callback", {url: val[val.length-1].split(',')[1]});
this.$emit("callback", {url: val[val.length - 1].split(',')[1]});
}
},
// 初始化监听 是否清空所选图片
@@ -897,8 +937,30 @@ export default {
}
},
},
computed: {
canShowGroups() {
return this.activeRoleTab === "MANAGER";
},
canUploadImages() {
return this.activeRoleTab === "MANAGER";
},
uploadData() {
return {
directoryPath: this.searchForm.fileDirectoryId,
userEnums: this.activeRoleTab,
directoryType: this.activeRoleTab,
};
},
},
methods: {
beforeUpload() {
if (!this.canUploadImages) {
this.$Message.warning("仅管理员模块支持上传图片");
return false;
}
return true;
},
onMouseOver(item, index) {
this.$set(this.data[index], 'isShowPreview', true);
this.$forceUpdate();
@@ -906,10 +968,53 @@ export default {
onMouseOut(item, index) {
this.$set(this.data[index], 'isShowPreview', false);
},
handleRoleTabChange(name) {
this.activeRoleTab = name;
this.searchForm.pageNumber = 1;
this.searchForm.userEnums = name;
delete this.searchForm.fileDirectoryId;
this.selectedGroupData = "";
this.defaultValue = [];
this.groupFormValidate.id = [];
this.groupFormValidate.level = 0;
this.$set(this, "selectedOss", []);
this.updateTreeDataByRole();
this.getDataList();
},
updateTreeDataByRole() {
const currentTree = this.filterTreeByRole(this.treeDataDefault, this.activeRoleTab);
this.treeData = [
{
title: "全部图片",
label: "全部分类",
value: "0",
type: this.activeRoleTab,
level: 0,
children: currentTree,
id: "0",
categoryId: 0,
},
];
},
filterTreeByRole(tree = [], role) {
if (!tree || !tree.length) return [];
return tree.reduce((arr, item) => {
const children = this.filterTreeByRole(item.children || [], role);
if (item.type === role || children.length) {
arr.push({
...item,
children,
});
}
return arr;
}, []);
},
// 复选框值改变时触发
selectOssChange(e) {
if (e) {
this.selectList = e.map(item => {return { id: item.split(',')[0]}});
this.selectList = e.map(item => {
return {id: item.split(',')[0]}
});
this.selectCount = e.length;
// let size = 0;
// e.forEach((item) => {size += item.fileSize * 1.0;});
@@ -924,7 +1029,7 @@ export default {
this.getDataList();
},
// 自定义tree节点显示内容和交互
renderContent (h, { root, node, data }) {
renderContent(h, {root, node, data}) {
if (data.value === '0') {
return h('span', {style: {display: 'inline-block', width: '100%'}},
[
@@ -940,11 +1045,31 @@ export default {
[
h("Dropdown", {style: {marginLeft: "4px"}},
[
h("Icon", {props: {type: 'ios-more', size: "20",}, style: {display: 'inline-block'}, on:{click: () => {}}}),
h("DropdownMenu", {slot: "list"
h("Icon", {
props: {type: 'ios-more', size: "20",},
style: {display: 'inline-block'},
on: {
click: () => {
}
}
}),
h("DropdownMenu", {
slot: "list"
}, [
h("DropdownItem", { nativeOn:{click: () => {this.handleContextMenuEdit(root, node, data)}} }, "编辑"),
h("DropdownItem", { nativeOn:{click: () => {this.handleContextMenuDelete()}} }, "删除"),
h("DropdownItem", {
nativeOn: {
click: () => {
this.handleContextMenuEdit(root, node, data)
}
}
}, "编辑"),
h("DropdownItem", {
nativeOn: {
click: () => {
this.handleContextMenuDelete()
}
}
}, "删除"),
])
]),
])
@@ -955,8 +1080,6 @@ export default {
},
handleContextMenu(val) {
console.log('handleContextMenu', val);
this.selectedGroupData = val;
@@ -988,10 +1111,10 @@ export default {
},
treeDataChange(value, selectedData) {
if (value && value.length) {
if (value[value.length -1] == '0') {
if (value[value.length - 1] == '0') {
this.groupFormValidate.level = 0;
} else {
this.groupFormValidate.level = Number(selectedData[selectedData.length -1].level) + 1;
this.groupFormValidate.level = Number(selectedData[selectedData.length - 1].level) + 1;
}
}
},
@@ -1000,7 +1123,8 @@ export default {
this.$refs["formValidate"].validate(async (valid) => {
if (valid) {
let res
const params = { ...this.groupFormValidate };
const params = {...this.groupFormValidate};
params.directoryType = (this.selectedGroupData && this.selectedGroupData.type) || this.activeRoleTab;
if (this.insertOrUpdate === "insert") {
params.parentId = params.id[params.id.length - 1];
delete params.id;
@@ -1054,17 +1178,8 @@ export default {
getFileDirectory(parent_id).then((res) => {
this.loading = false;
if (res.success) {
this.treeData = this.getTree(res.result);
this.treeDataDefault = this.getTree(res.result);
this.treeData.unshift({
title: "全部图片",
label: "全部分类",
value: "0",
level: 0,
children: [],
id: "0",
categoryId: 0,
});
this.updateTreeDataByRole();
}
});
},
@@ -1103,7 +1218,7 @@ export default {
} else {
this.groupFormValidate.level = Number(level) + 1;
}
this.searchForm.userEnums = type;
this.searchForm.userEnums = type || this.activeRoleTab;
this.getDataList();
this.$set(this, 'selectedOss', []);
}
@@ -1114,19 +1229,12 @@ export default {
selectedParams(val) {
this.$emit("callback", val);
},
// 更多操作
handleDropdown(name) {
if (name === "refresh") {
this.getDataList('refresh');
} else if (name === "removeAll") {
this.removeAll();
}
},
// 初始化数据
init() {
this.accessToken = {
accessToken: this.getStore("accessToken"),
};
this.searchForm.userEnums = this.activeRoleTab;
this.getDataList();
this.getAllList();
},
@@ -1207,9 +1315,6 @@ export default {
this.data = res.result.records;
this.total = res.result.total;
if (type === 'refresh') {
this.$Message.success('刷新成功!');
}
});
},
// 搜索
@@ -1244,6 +1349,10 @@ export default {
},
// 上传成功回调
handleSuccess(res, file) {
if (!this.canUploadImages) {
this.$Message.warning("仅管理员模块支持上传图片");
return;
}
if (res.success) {
this.$Message.success("上传文件 " + file.name + " 成功");
this.getDataList();
@@ -1281,7 +1390,9 @@ export default {
loading: true,
onOk: () => {
let ids = "";
this.selectList.forEach(function (e) {ids += e.id + ",";});
this.selectList.forEach(function (e) {
ids += e.id + ",";
});
ids = ids.substring(0, ids.length - 1);
deleteFile(ids).then((res) => {
this.$Modal.remove();
@@ -1374,7 +1485,7 @@ export default {
// 是组件的话,初始化不调用接口
this.init();
} else {
this.searchForm.pageSize =18; // 页面大小
this.searchForm.pageSize = 18; // 页面大小
}
},
};