xy 2 years ago
parent 31cbdc675b
commit c946ae5ab4

@ -5,9 +5,10 @@
<!--清除浏览器中的缓存 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Expires" content="0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= webpackConfig.name %></title>
</head>

@ -0,0 +1,41 @@
import request from '@/utils/request'
export function index (params) {
return request({
method: "get",
url: "/api/admin/regulation/article-index",
params
})
}
export function show (params) {
return request({
method: "get",
url: "/api/admin/regulation/article-show",
params
})
}
export function save (data) {
return request({
method: "post",
url: "/api/admin/regulation/article-save",
data
})
}
export function store (data) {
return request({
method: "post",
url: "/api/admin/regulation/article-store",
data
})
}
export function destroy (params) {
return request({
method: "get",
url: "/api/admin/regulation/article-destroy",
params
})
}

@ -0,0 +1,41 @@
import request from '@/utils/request'
export function index (params) {
return request({
method: "get",
url: "/api/admin/regulation/index",
params
})
}
export function show (params) {
return request({
method: "get",
url: "/api/admin/regulation/show",
params
})
}
export function save (data) {
return request({
method: "post",
url: "/api/admin/regulation/save",
data
})
}
export function store (data) {
return request({
method: "post",
url: "/api/admin/regulation/store",
data
})
}
export function destroy (params) {
return request({
method: "get",
url: "/api/admin/regulation/destroy",
params
})
}

@ -0,0 +1,37 @@
import request from '@/utils/request'
export function index (params,noloading=true) {
return request({
method: "get",
url: "/api/admin/diy_menu/index",
params,
noloading
})
}
export function show (params,noloading=true) {
return request({
method: "get",
url: "/api/admin/diy_menu/show",
params,
noloading
})
}
export function save (data,noloading=true) {
return request({
method: "post",
url: "/api/admin/diy_menu/save",
data,
noloading
})
}
export function destroy(params,noloading=true) {
return request({
method: "get",
url: "/api/admin/diy_menu/destroy",
params,
noloading
})
}

@ -2597,7 +2597,7 @@ export default {
this.getContracts();
},
//
async getContracts(is_export,noloading=false) {
async getContracts(is_export,noloading=false,isopenOa=false) {
if (/contractLedger/g.test(this.$route.path)) {
this.select.is_contract = 1
} else {
@ -2632,6 +2632,24 @@ export default {
this.tableTotal.planPriceTotal = Number(res.plan_price_total)
.toFixed(2)
.replace(/(\d)(?=(\d{3})+\.)/g, "$1,");
//oa
if (isopenOa) {
if (res.list.data[0]) {
if (
res.list.data[0].is_simple !== 1 &&
res.list.data[0].purchase_status === 1 &&
((res.list.data[0].req_status === 3 && res.list.data[0].is_plan === 0) ||
res.list.data[0].is_plan === 1) &&
!res.list.data[0].is_substitute
) {
}
await this.buyProcess(res.list.data[0])
}
}
},
//
@ -2807,7 +2825,7 @@ export default {
this.selections = [];
this.$refs["addContract"].reset();
this.$refs["planTable"].clearSelection();
this.getContracts();
this.getContracts(false,false,true);
});
},

@ -0,0 +1,17 @@
<template>
<div>
</div>
</template>
<script>
export default {
data() {
return {}
},
methods: {},
computed: {}
}
</script>
<style scoped lang="scss">
</style>

@ -0,0 +1,272 @@
<template>
<div>
<xy-dialog
ref="dialog"
:is-show.sync="isShow"
type="form"
:title="type === 'add' ? '新增制度文件' : '编辑制度文件'"
:form="form"
:rules="rules"
@submit="submit"
>
<template v-slot:title>
<div class="xy-table-item">
<div class="xy-table-item-label">标题 </div>
<div class="xy-table-item-content">
<el-input
v-model="form.title"
clearable
placeholder="请输入标题"
style="width: 300px"
></el-input>
</div>
</div>
</template>
<template v-slot:menu_id>
<div class="xy-table-item">
<div class="xy-table-item-label">目录 </div>
<div class="xy-table-item-content">
<el-select
v-model="form.menu_id"
clearable
placeholder="请选择目录"
style="width: 300px"
>
<el-option
v-for="item in menu_ids"
:key="item.id"
:label="item.value"
:value="item.id"
></el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:content>
<div class="xy-table-item">
<div class="xy-table-item-label">内容 </div>
<div class="xy-table-item-content">
<el-input
type="textarea"
:autosize="{ minRows: 2 }"
v-model="form.content"
clearable
placeholder="请输入内容"
style="width: 300px"
></el-input>
</div>
</div>
</template>
<template v-slot:type>
<div class="xy-table-item">
<div class="xy-table-item-label">类型 </div>
<div class="xy-table-item-content">
<el-input
v-model="form.type"
clearable
placeholder="请输入类型"
style="width: 300px"
></el-input>
</div>
</div>
</template>
<template v-slot:file_list>
<div class="xy-table-item">
<div class="xy-table-item-label">文件 </div>
<div class="xy-table-item-content">
<el-upload
style="width: 300px"
ref="upload"
multiple
:on-success="
(response, file, fileList) =>
successHandle(response, file, fileList, 'file_list')
"
:before-upload="uploadBefore"
accept=".rar,.zip,.doc,.docx,.pdf,.jpg,.png,.gif,.mp4,.xls,.xlsx"
:action="action"
:file-list="file_list"
:auto-upload="false"
:on-remove="
(file, fileList) => removeHande(file, fileList, 'file_list')
"
>
<el-button slot="trigger" size="small" type="primary"
>选取文件</el-button
>
<el-button
style="margin-left: 10px"
size="small"
type="success"
@click="$refs['upload'].submit()"
>开始上传</el-button
>
<div slot="tip" class="el-upload__tip">
支持文件格式.rar .zip .doc .docx .pdf .jpg .png .gif .mp4 .xls
.xlsx
<br />单个文件不能超过20M
</div>
</el-upload>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import { show, save, store } from "@/api/sysManage/article";
export default {
props: {
menu_ids: {
type: Array,
default: () => [],
},
},
data() {
return {
isShow: false,
id: "",
type: "",
action: process.env.VUE_APP_UPLOAD_API,
file_list: [],
form: {
title: "",
menu_id: "",
content: "",
type: "",
file_list: "",
},
rules: {},
};
},
methods: {
show() {
this.isShow = true;
},
hidden() {
this.isShow = false;
},
init() {
for (let key in this.form) {
if (this.form[key] instanceof Array) {
this.form[key] = [];
} else {
this.form[key] = "";
}
}
this.$refs["dialog"].clearValidate();
},
setId(id) {
if (typeof id == "number") {
this.id = id;
} else {
console.error("error typeof id: " + typeof id);
}
},
getId() {
return this.id;
},
setType(type = "add") {
let types = ["add", "editor"];
if (types.includes(type)) {
this.type = type;
} else {
console.warn("Unknown type: " + type);
}
},
setForm(key = [], value = []) {
if (key instanceof Array) {
key.forEach((key, index) => {
this.form[key] = value[index] ?? "";
});
}
if (typeof key === "string") {
this.form[key] = value;
}
if (!key) {
this.init();
}
},
//
successHandle(response, file, fileList, key) {
this[key] = fileList;
},
removeHande(file, fileList, key) {
this[key] = fileList;
},
uploadBefore(file) {
console.log(file);
if (file.size / 1000 > 20 * 1024) {
this.$message({
type: "warning",
message: "上传图片大小超过20MB",
});
return false;
}
},
async getDetail() {
const res = await show({ id: this.id });
this.$integrateData(this.form, res);
},
submit() {
if (this.type === "add") {
if (this.form.hasOwnProperty("id")) {
delete this.form.id;
}
store(this.form).then((res) => {
this.$message({
type: "success",
message:
this.type === "add" ? "新增制度文件" : "编辑制度文件" + "成功",
});
this.isShow = false;
this.$emit("refresh");
});
}
if (this.type === "editor") {
Object.defineProperty(this.form, "id", {
value: this.id,
enumerable: true,
configurable: true,
writable: true,
});
save(this.form).then((res) => {
this.$message({
type: "success",
message:
this.type === "add" ? "新增制度文件" : "编辑制度文件" + "成功",
});
this.isShow = false;
this.$emit("refresh");
});
}
},
},
watch: {
isShow(val) {
if (val) {
if (this.type === "editor") {
this.getDetail();
}
} else {
this.id = "";
this.type = "";
this.init();
this.$refs["dialog"].clearValidate();
delete this.form.id;
}
},
},
};
</script>
<style scoped lang="scss">
::v-deep .el-input__inner {
text-align: left;
}
</style>

@ -0,0 +1,210 @@
<!--收入登记-->
<template>
<div style="padding: 0 20px">
<lx-header
icon="md-apps"
style="margin-bottom: 10px; border: 0px; margin-top: 15px"
text="收入登记"
>
<div slot="content"></div>
<slot>
<div class="select-bar">
<div>
<span style="padding: 0 6px">类型</span>
<span>
</span>
</div>
<Button
style="margin-left: 10px"
type="primary"
@click="
$refs['add'].setType('add'),
$refs['add'].show()
"
>新增</Button
>
<Button style="margin-left: 10px" type="primary" @click="getList"
>查询</Button
>
<Button style="margin-left: 10px" type="primary" @click="init"
>重置
</Button>
</div>
</slot>
</lx-header>
<xy-table
:list="list"
:table-item="table"
@delete="(row) => destroy(row.id)"
@editor="
"
>
<template #btns>
<el-table-column
fixed="right"
header-align="center"
label="操作"
width="200"
>
<template slot-scope="{ row }">
<div class="slot-btns">
<Button
size="small"
type="primary"
@click="
$refs['add'].setId(row.id),
$refs['add'].setType('editor'),
$refs['add'].show()
"
>
编辑
</Button>
<Button @click="$refs['add'].setId(row.id),$refs['add'].show()" size="small" type="info">
查看
</Button>
<Poptip
:transfer="true"
confirm
placement="bottom"
title="确认要删除吗"
@on-ok="destroy(row.id)"
>
<Button class="slot-btns-item" size="small" type="error"
>删除</Button
>
</Poptip>
</div>
</template>
</el-table-column>
</template>
</xy-table>
<div style="display: flex; justify-content: flex-end; padding: 10px 0">
<Page
:total="total"
@on-change="
(e) => {
select.page = e;
getList();
}
"
show-elevator
show-sizer
@on-page-size-change="
(e) => {
select.page_size = e;
select.page = 1;
getList();
}
"
/>
</div>
<add ref="add" :pids="list" @refresh="getList"></add>
</div>
</template>
<script>
import add from "./component/addFile.vue"
import { index, destroy } from "@/api/sysManage/article"
export default {
components: {
add
},
data() {
return {
total: 0,
select: {
show_tree: 1,
type: ""
},
list: [],
table: [
{
prop: "title",
label: "标题",
width: 180,
fixed: "left",
},
{
prop: "type",
label: "类型",
width: 120
},
{
prop: "content",
label: "内容",
minWidth: 220
},
{
prop: "admin.name",
label: "经办人",
width: 140,
},
{
prop: "created_at",
label: "创建日期",
width: 180,
},
],
};
},
methods: {
init() {
for (let key in this.select) {
if (this.select[key] instanceof Array) {
this.select[key] = [];
} else {
this.select[key] = "";
}
}
this.select.page = 1;
this.select.page_size = 10;
},
async getList() {
const res = await index(this.select);
this.list = res.data;
this.total = res.total;
},
destroy(id) {
destroy({
id,
}).then((_) => {
this.getList();
});
},
},
computed: {},
created() {
this.getList();
},
};
</script>
<style scoped lang="scss">
.select-bar {
display: flex;
flex-wrap: wrap;
align-items: center;
& > div {
margin: 4px;
}
}
.slot-btns {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
align-content: flex-start;
& > Button {
margin: 2px 4px;
}
}
</style>

@ -0,0 +1,225 @@
<template>
<div>
<xy-dialog
ref="dialog"
:is-show.sync="isShow"
type="form"
:title="type === 'add' ? '新增制度目录' : '编辑制度目录'"
:form="form"
:rules="rules"
@submit="submit"
>
<template v-slot:name>
<div class="xy-table-item">
<div class="xy-table-item-label">名称 </div>
<div class="xy-table-item-content">
<el-input
v-model="form.name"
clearable
placeholder="请输入名称"
style="width: 300px"
></el-input>
</div>
</div>
</template>
<template v-slot:pid>
<div class="xy-table-item">
<div class="xy-table-item-label">上级 </div>
<div class="xy-table-item-content">
<el-cascader
:key="cascaderId_pid"
clearable
style="width: 300px"
:show-all-levels="false"
v-model="form.pid"
:options="pidsRoot"
:props="{ value: 'id', label: 'name', checkStrictly: true }"
@change="pidCascaderHandler"
></el-cascader>
</div>
</div>
</template>
<template v-slot:type>
<div class="xy-table-item">
<div class="xy-table-item-label">类型 </div>
<div class="xy-table-item-content">
<el-input
v-model="form.type"
clearable
placeholder="请输入类型"
style="width: 300px"
></el-input>
</div>
</div>
</template>
<template v-slot:remark>
<div class="xy-table-item">
<div class="xy-table-item-label">备注 </div>
<div class="xy-table-item-content">
<el-input
type="textarea"
:autosize="{ minRows: 2 }"
v-model="form.remark"
clearable
placeholder="请输入备注"
style="width: 300px"
></el-input>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import { show, save, store } from "@/api/sysManage/menu";
export default {
props: {
pids: {
type: Array,
default: () => [],
},
},
data() {
return {
isShow: false,
id: "",
type: "",
cascaderId_pid: "",
form: {
name: "",
pid: 0,
type: "",
remark: "",
},
rules: {},
};
},
methods: {
show() {
this.isShow = true;
},
hidden() {
this.isShow = false;
},
init() {
for (let key in this.form) {
if (this.form[key] instanceof Array) {
this.form[key] = [];
} else {
this.form[key] = "";
}
}
this.$refs["dialog"].clearValidate();
},
setId(id) {
if (typeof id == "number") {
this.id = id;
} else {
console.error("error typeof id: " + typeof id);
}
},
getId() {
return this.id;
},
setType(type = "add") {
let types = ["add", "editor"];
if (types.includes(type)) {
this.type = type;
} else {
console.warn("Unknown type: " + type);
}
},
setForm(key = [], value = []) {
if (key instanceof Array) {
key.forEach((key, index) => {
this.form[key] = value[index] ?? "";
});
}
if (typeof key === "string") {
this.form[key] = value;
}
if (!key) {
this.init();
}
},
pidCascaderHandler(e) {
if (e.length > 0) {
this.form.pid = e.at(-1);
} else {
this.form.pid = "";
}
},
async getDetail() {
const res = await show({ id: this.id });
this.$integrateData(this.form, res);
},
submit() {
if (this.type === "add") {
if (this.form.hasOwnProperty("regulation_menu_id")) {
delete this.form.regulation_menu_id;
}
store(this.form).then((res) => {
this.$message({
type: "success",
message:
this.type === "add" ? "新增制度目录" : "编辑制度目录" + "成功",
});
this.isShow = false;
this.$emit("refresh");
});
}
if (this.type === "editor") {
Object.defineProperty(this.form, "regulation_menu_id", {
value: this.id,
enumerable: true,
configurable: true,
writable: true,
});
save(this.form).then((res) => {
this.$message({
type: "success",
message:
this.type === "add" ? "新增制度目录" : "编辑制度目录" + "成功",
});
this.isShow = false;
this.$emit("refresh");
});
}
},
},
computed: {
pidsRoot () {
return [{ id: 0, name: '根目录', children: this.pids }]
}
},
watch: {
isShow(val) {
if (val) {
if (this.type === "editor") {
this.getDetail();
}
} else {
this.id = "";
this.type = "";
this.init();
this.$refs["dialog"].clearValidate();
delete this.form.regulation_menu_id;
}
},
pids() {
++this.cascaderId_pid;
},
},
};
</script>
<style scoped lang="scss">
::v-deep .el-input__inner {
text-align: left;
}
</style>

@ -0,0 +1,199 @@
<!--收入登记-->
<template>
<div style="padding: 0 20px">
<lx-header
icon="md-apps"
style="margin-bottom: 10px; border: 0px; margin-top: 15px"
text="收入登记"
>
<div slot="content"></div>
<slot>
<div class="select-bar">
<div>
<span style="padding: 0 6px">类型</span>
<span>
</span>
</div>
<Button
style="margin-left: 10px"
type="primary"
@click="
$refs['add'].setType('add'),
$refs['add'].show()
"
>新增</Button
>
<Button style="margin-left: 10px" type="primary" @click="getList"
>查询</Button
>
<Button style="margin-left: 10px" type="primary" @click="init"
>重置
</Button>
</div>
</slot>
</lx-header>
<xy-table
:list="list"
:table-item="table"
@delete="(row) => destroy(row.id)"
@editor="
"
>
<template #btns>
<el-table-column
fixed="right"
header-align="center"
label="操作"
width="200"
>
<template slot-scope="{ row }">
<div class="slot-btns">
<Button
size="small"
type="primary"
@click="
$refs['add'].setId(row.id),
$refs['add'].setType('editor'),
$refs['add'].show()
"
>
编辑
</Button>
<Button @click="$refs['add'].setId(row.id),$refs['add'].show()" size="small" type="info">
查看
</Button>
<Poptip
:transfer="true"
confirm
placement="bottom"
title="确认要删除吗"
@on-ok="destroy(row.id)"
>
<Button class="slot-btns-item" size="small" type="error"
>删除</Button
>
</Poptip>
</div>
</template>
</el-table-column>
</template>
</xy-table>
<div style="display: flex; justify-content: flex-end; padding: 10px 0">
<Page
:total="total"
@on-change="
(e) => {
select.page = e;
getList();
}
"
show-elevator
show-sizer
@on-page-size-change="
(e) => {
select.page_size = e;
select.page = 1;
getList();
}
"
/>
</div>
<add ref="add" :pids="list" @refresh="getList"></add>
</div>
</template>
<script>
import add from "./component/addMenu.vue"
import { index, destroy } from "@/api/sysManage/menu"
export default {
components: {
add
},
data() {
return {
total: 0,
select: {
show_tree: 1,
type: ""
},
list: [],
table: [
{
prop: "name",
label: "收入项目",
width: 180,
fixed: "left",
},
{
prop: "admin.name",
label: "经办人",
width: 140,
},
{
prop: "created_at",
label: "创建日期",
width: 180,
},
],
};
},
methods: {
init() {
for (let key in this.select) {
if (this.select[key] instanceof Array) {
this.select[key] = [];
} else {
this.select[key] = "";
}
}
this.select.page = 1;
this.select.page_size = 10;
},
async getList() {
const res = await index(this.select);
this.list = res;
},
destroy(id) {
destroy({
id,
}).then((_) => {
this.getList();
});
},
},
computed: {},
created() {
this.getList();
},
};
</script>
<style scoped lang="scss">
.select-bar {
display: flex;
flex-wrap: wrap;
align-items: center;
& > div {
margin: 4px;
}
}
.slot-btns {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
align-content: flex-start;
& > Button {
margin: 2px 4px;
}
}
</style>

@ -0,0 +1,342 @@
<template>
<el-card class="box-card" shadow="hover">
<div slot="header" class="clearfix">
<span style="border-left: 3px solid #338de3ff; padding-left: 6px"
>快捷菜单</span
>
<Button v-if="/^\/system+/.test($route.path)" style="float: right" size="small" type="primary" @click="isShow = true"></Button>
</div>
<div class="menu-container">
<div v-for="(item, index) in myMenus" :key="item.id" class="menu-item">
<div style="display: flex;align-items: center;" @click="linkTo(item)">
<el-image v-if="item.image" style="max-width: 26px;margin-right: 6px;" fit="contain" :src="item.image ? item.image.url : ''">
<template #error>
<Icon type="ios-alert" />
</template>
</el-image>
{{ item.name }}
</div>
<div class="operate-btn" v-if="/^\/system+/.test($route.path)">
<Icon color="#4d8bdc" class="operate-btn__item" type="ios-create-outline" @click="editMenu(item)"/>
<Icon color="#4d8bdc" class="operate-btn__item" type="ios-trash-outline" @click="destroyMenu(item)"/>
</div>
</div>
</div>
<template v-if="/^\/system+/.test($route.path)">
<xy-dialog title="快捷菜单" type="form" :is-show.sync="isShow" :form="form" :rules="rule" @submit="submit">
<template #url>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>菜单
</div>
<div class="xy-table-item-content">
<el-cascader :value="form.url"
:show-all-levels="false"
ref="cascaderInput"
:options="menus"
style="width: 300px;"
@change="cascaderPick"
:props="{ label: 'name',value: 'path' }">
</el-cascader>
</div>
</div>
</template>
<template #name>
<div class="xy-table-item">
<div class="xy-table-item-label">
描述
</div>
<div class="xy-table-item-content">
<el-input v-model="form.name" clearable style="width: 300px;">
</el-input>
</div>
</div>
</template>
<template #sort>
<div class="xy-table-item">
<div class="xy-table-item-label">
排序
</div>
<div class="xy-table-item-content">
<el-input-number :controls="false" :precision="0" v-model="form.sort" clearable style="width: 300px;">
</el-input-number>
</div>
</div>
</template>
<template #status>
<div class="xy-table-item">
<div class="xy-table-item-label">
状态
</div>
<div class="xy-table-item-content">
<el-switch style="width: 300px;" v-model="form.status" :inactive-value="0" :active-value="1" inactive-text="禁用" active-text="启用"></el-switch>
</div>
</div>
</template>
<template #method>
<div class="xy-table-item">
<div class="xy-table-item-label">
打开方式
</div>
<div class="xy-table-item-content">
<el-select v-model="form.method" style="width: 300px;">
<el-option v-for="(item) in [{ label: '跳转',value: 'self' },{ label: '新页面',value: 'blank' }]" :value="item.value" :label="item.label">
</el-option>
</el-select>
</div>
</div>
</template>
<template #image_id>
<div class="xy-table-item">
<div class="xy-table-item-label">
图标
</div>
<div class="xy-table-item-content">
<el-upload
style="width: 300px"
ref="upload"
:limit="1"
:on-success="successHandle"
:before-upload="uploadBefore"
accept=".jpg,.png,.gif"
:action="action"
:file-list="fileList"
:auto-upload="false"
:on-remove="removeHande"
>
<el-button slot="trigger" size="small" type="primary"
>选取文件</el-button
>
<el-button
style="margin-left: 10px"
size="small"
type="success"
@click="$refs['upload'].submit()"
>开始上传</el-button
>
<div slot="tip" class="el-upload__tip">
支持文件格式 .jpg .png .gif
<br />单个文件不能超过50M
</div>
</el-upload>
</div>
</div>
</template>
</xy-dialog>
</template>
</el-card>
</template>
<script>
import { index, show, save, destroy } from "@/api/system/diyMenu";
import { listmenu } from "@/api/system/menu";
import { deepCopy } from '@/utils'
export default {
name: "card7",
layout: {
x: 0,
y: 0,
w: 4,
h: 5,
i: "8",
name: "快捷菜单",
},
data() {
return {
fileList: [],
action: process.env.VUE_APP_UPLOAD_API,
myMenus: [],
isShow: false,
menus: [],
form: {
url: "",
name: "",
sort: "",
status: "",
method: "",
image_id: "",
fileList: [],
},
rule: {
url: [
{
required: true,
message: "请选择菜单",
},
]
}
}
},
methods: {
linkTo (item) {
if (item.method === 'self') {
this.$router.push(item.url)
return
}
if (item.method === 'blank') {
window.open(this.$router.resolve({
path: item.url
}).href,'_blank')
}
},
//
successHandle(response, file, fileList) {
this.fileList = fileList;
},
removeHande(file, fileList) {
this.fileList = fileList;
},
uploadBefore(file) {
console.log(file);
if (file.size / 1000 > 50 * 1024) {
this.$message({
type: "warning",
message: "上传图片大小超过50M",
});
return false;
}
},
async getMenu () {
const formatMenu = (arr) => {
arr.forEach(item => {
if (item.children) {
item.children.length === 0 ? delete item.children : formatMenu(item.children)
}
})
}
this.menus = (await listmenu())
formatMenu(this.menus)
},
async getDiymenu () {
this.myMenus = (await index({
page: 1,
page_size: 999,
sort_name: "sort"
},true)).data
},
cascaderPick (e) {
const pathHandler = (path) => {
if(!path || path?.includes('#') || path == ''){
return '/'
}
if(/^\^/.test(path)){
return path.replace(/^\^+/g,"")
}
if(/^\$/.test(path)){
return path.replace(/^\$+/g,"")
}
return path
}
this.form.url = pathHandler(e?.at(-1)) || ''
this.$nextTick(() => {
this.form.name = this.$refs['cascaderInput']?.presentText
})
},
async submit () {
this.form.image_id = this.fileList[0]?.response?.id
await save(this.form)
this.$message({
type: "success",
message: "保存成功"
})
await this.getDiymenu()
this.isShow = false;
this.form = {
url: "",
name: "",
sort: "",
status: "",
method: ""
}
},
destroyMenu (item) {
this.$confirm('确认要删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
destroy({
id: item.id
}).then(res => {
this.$message({
type: 'success',
message: '删除成功!'
});
this.getDiymenu()
})
})
},
async editMenu (item) {
const res = deepCopy(item)
this.form = Object.assign({
url: "",
name: "",
sort: "",
status: "",
method: ""
},res)
this.isShow = true;
}
},
computed: {
},
created() {
this.getMenu()
this.getDiymenu()
}
}
</script>
<style scoped lang="scss">
::v-deep .el-input__inner {
text-align: left;
}
.xy-table-item-label {
width: 158px;
}
.menu-container {
display: flex;
flex-wrap: wrap;
.menu-item {
background: $primaryColor;
color: #fff;
border-radius: 5px;
padding: 10px 20px;
position: relative;
margin: 5px;
.operate-btn {
display: flex;
position: absolute;
top: -10px;
left: 8%;
&__item {
background: #fff;
zoom: .95;
border: 1px $primaryColor solid;
padding: 3px;
border-radius: 100%;
cursor: pointer;
margin-right: 8px;
}
}
}
}
</style>
Loading…
Cancel
Save