no message
This commit is contained in:
parent
235bc2c547
commit
a459a9d4d2
@ -110,7 +110,7 @@
|
||||
filterObj(){
|
||||
const obj = {}
|
||||
this.filter.forEach((item) => {
|
||||
if (this.data[item.name] === undefined || this.data[item.name] === null || JSON.stringify(this.data[item.name]) === '') {
|
||||
if (this.data[item.name] === undefined || this.data[item.name] === '' || JSON.stringify(this.data[item.name]) === '') {
|
||||
return ; // 跳过当前迭代,继续下一次迭代
|
||||
}
|
||||
if (item.options && item.options.items && item.options.items.length>0) {
|
||||
|
@ -9,6 +9,7 @@ import config from "@/config"
|
||||
import NProgress from 'nprogress'
|
||||
import 'nprogress/nprogress.css'
|
||||
import tool from '@/utils/tool';
|
||||
import store from '@/store'
|
||||
import api from '@/api'
|
||||
import systemRouter from './systemRouter';
|
||||
import userRoutes from '@/config/route';
|
||||
@ -67,24 +68,27 @@ router.beforeEach(async (to, from, next) => {
|
||||
if (!isGetRouter) {
|
||||
// 重新获取菜单路
|
||||
api.system.index.get().then((response) => {
|
||||
|
||||
for (const key in response.data) {
|
||||
if (Object.prototype.hasOwnProperty.call(response.data, key)) {
|
||||
if (response.code==200) {
|
||||
// 缓存
|
||||
for (const key in response.data) {
|
||||
tool.data.set(key, response.data[key]);
|
||||
if (key=='layout') {
|
||||
store.commit("SET_layout", response.data[key])
|
||||
}
|
||||
}
|
||||
var menu = router.sc_getMenu();
|
||||
var menuRouter = filterAsyncRouter(menu)
|
||||
menuRouter = flatAsyncRoutes(menuRouter)
|
||||
menuRouter.forEach(item => {
|
||||
router.addRoute("layout", item)
|
||||
})
|
||||
routes_404_r = router.addRoute(routes_404)
|
||||
if (to.matched.length == 0) {
|
||||
router.push(to.fullPath);
|
||||
}
|
||||
isGetRouter = true;
|
||||
}
|
||||
|
||||
var menu = router.sc_getMenu();
|
||||
var menuRouter = filterAsyncRouter(menu)
|
||||
menuRouter = flatAsyncRoutes(menuRouter)
|
||||
menuRouter.forEach(item => {
|
||||
router.addRoute("layout", item)
|
||||
})
|
||||
routes_404_r = router.addRoute(routes_404)
|
||||
if (to.matched.length == 0) {
|
||||
router.push(to.fullPath);
|
||||
}
|
||||
isGetRouter = true;
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
|
@ -62,6 +62,7 @@
|
||||
account: this.form.account,
|
||||
password: this.$tool.crypto.BASE64.encrypt( this.$tool.crypto.BASE64.encrypt( this.form.password ) + this.$tool.crypto.BASE64.encrypt( this.form.account ) )
|
||||
}
|
||||
|
||||
//获取token
|
||||
var user = await this.$api.auth.token.post(data)
|
||||
if(user.code !== 200){
|
||||
@ -75,40 +76,42 @@
|
||||
})
|
||||
|
||||
//获取菜单
|
||||
var menu = null
|
||||
menu = await this.$api.system.index.get()
|
||||
// var menu = null
|
||||
// menu = await this.$api.system.index.get()
|
||||
|
||||
if(menu.code == 200){
|
||||
if(menu.data.menu.length==0){
|
||||
this.islogin = false
|
||||
this.$alert("当前用户无任何菜单权限,请联系系统管理员", "无权限访问", {
|
||||
type: 'error',
|
||||
center: true
|
||||
})
|
||||
return false
|
||||
}
|
||||
// if(menu.code == 200){
|
||||
|
||||
for (const key in menu.data) {
|
||||
if (Object.prototype.hasOwnProperty.call(menu.data, key)) {
|
||||
this.$tool.data.set(key, menu.data[key]);
|
||||
}
|
||||
}
|
||||
// if(menu.data.menu.length==0){
|
||||
// this.islogin = false
|
||||
// this.$alert("当前用户无任何菜单权限,请联系系统管理员", "无权限访问", {
|
||||
// type: 'error',
|
||||
// center: true
|
||||
// })
|
||||
// return false
|
||||
// }
|
||||
|
||||
}else{
|
||||
// for (const key in menu.data) {
|
||||
// if (Object.prototype.hasOwnProperty.call(menu.data, key)) {
|
||||
// this.$tool.data.set(key, menu.data[key]);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
|
||||
// 获取登录前的URL
|
||||
const redirect = this.$route.query.redirect || '/'
|
||||
this.$router.replace({
|
||||
path: redirect
|
||||
})
|
||||
|
||||
this.$message.success("Login Success 登录成功")
|
||||
this.islogin = false
|
||||
this.$message.warning(menu.message)
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
// 获取登录前的URL
|
||||
const redirect = this.$route.query.redirect || '/'
|
||||
this.$router.replace({
|
||||
path: redirect
|
||||
})
|
||||
|
||||
this.$message.success("Login Success 登录成功")
|
||||
this.islogin = false
|
||||
// }
|
||||
// this.islogin = false
|
||||
// this.$message.warning(menu.message)
|
||||
// return false
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -148,43 +148,38 @@
|
||||
expires: 86400*360
|
||||
})
|
||||
|
||||
//获取菜单
|
||||
var menu = null
|
||||
menu = await this.$api.system.index.get()
|
||||
// //获取菜单
|
||||
// var menu = null
|
||||
// menu = await this.$api.system.index.get()
|
||||
|
||||
if(menu.code == 200){
|
||||
if(menu.data.menu.length==0){
|
||||
this.islogin = false
|
||||
this.$alert("当前用户无任何菜单权限,请联系系统管理员", "无权限访问", {
|
||||
type: 'error',
|
||||
center: true
|
||||
})
|
||||
return false
|
||||
}
|
||||
// if(menu.code == 200){
|
||||
|
||||
// if(menu.data.menu.length==0){
|
||||
// this.islogin = false
|
||||
// this.$alert("当前用户无任何菜单权限,请联系系统管理员", "无权限访问", {
|
||||
// type: 'error',
|
||||
// center: true
|
||||
// })
|
||||
// return false
|
||||
// }
|
||||
// for (const key in menu.data) {
|
||||
// if (Object.prototype.hasOwnProperty.call(menu.data, key)) {
|
||||
// this.$tool.data.set(key, menu.data[key]);
|
||||
// }
|
||||
// }
|
||||
|
||||
for (const key in menu.data) {
|
||||
if (Object.prototype.hasOwnProperty.call(menu.data, key)) {
|
||||
this.$tool.data.set(key, menu.data[key]);
|
||||
}
|
||||
}
|
||||
// 获取登录前的URL
|
||||
const redirect = this.$route.query.redirect || '/'
|
||||
this.$router.replace({
|
||||
path: redirect
|
||||
})
|
||||
|
||||
|
||||
}else{
|
||||
this.$message.success("Login Success 登录成功")
|
||||
this.islogin = false
|
||||
this.$message.warning(menu.message)
|
||||
return false
|
||||
}
|
||||
|
||||
// 获取登录前的URL
|
||||
const redirect = this.$route.query.redirect || '/'
|
||||
this.$router.replace({
|
||||
path: redirect
|
||||
})
|
||||
|
||||
this.$message.success("Login Success 登录成功")
|
||||
this.islogin = false
|
||||
|
||||
return false
|
||||
// }
|
||||
// this.islogin = false
|
||||
// this.$message.warning(menu.message)
|
||||
}
|
||||
},1000)
|
||||
|
||||
|
@ -9,46 +9,46 @@
|
||||
</el-main>
|
||||
</el-aside>
|
||||
<el-container>
|
||||
<el-header class="header-tabs" v-if="tabs.length>0">
|
||||
<el-tabs type="card" v-model="search.status" @tab-change="tabChange">
|
||||
<el-tab-pane v-for="item in tabs" :key="item.value" :label="item.label" :name="item.value"> </el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-header>
|
||||
<el-header v-if="operation.plus || operation.batchdeletion || filter.length>0">
|
||||
<div class="left-panel">
|
||||
<el-button v-if="operation.plus" type="primary" icon="el-icon-plus" @click="plus"></el-button>
|
||||
<el-button v-if="operation.batchdeletion" type="danger" @click="batchdeletion" plain icon="el-icon-delete"></el-button>
|
||||
</div>
|
||||
<div class="right-panel" v-if="filter.length>0">
|
||||
<el-button v-for="(s,index) in statList" :key="index" @click="openStat(s)" v-bind="s">{{ s.label }}</el-button>
|
||||
<scFilterBar v-if="filter.length>0" v-model="search" :filterName="$route.meta.tablename" :options="filter" @filterChange="filterChange">
|
||||
</scFilterBar>
|
||||
</div>
|
||||
</el-header>
|
||||
<el-header class="header-tabs" v-if="tabs.length>0">
|
||||
<el-tabs type="card" v-model="search.status" @tab-change="tabChange">
|
||||
<el-tab-pane v-for="item in tabs" :key="item.value" :label="item.label" :name="item.value"> </el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-header>
|
||||
<el-header v-if="operation.plus || operation.batchdeletion || filter.length>0">
|
||||
<div class="left-panel">
|
||||
<el-button v-if="operation.plus" type="primary" icon="el-icon-plus" @click="plus"></el-button>
|
||||
<el-button v-if="operation.batchdeletion" type="danger" @click="batchdeletion" plain icon="el-icon-delete"></el-button>
|
||||
</div>
|
||||
<div class="right-panel" v-if="filter.length>0">
|
||||
<el-button v-for="(s,index) in statList" :key="index" @click="openStat(s)" v-bind="s">{{ s.label }}</el-button>
|
||||
<scFilterBar v-if="filter.length>0" v-model="search" :filterName="$route.meta.tablename" :options="filter" @filterChange="filterChange">
|
||||
</scFilterBar>
|
||||
</div>
|
||||
</el-header>
|
||||
|
||||
<el-header style="height:120px;" v-if="typeof chartoption === 'object' && Object.keys(chartoption).length > 0">
|
||||
<scEcharts height="100%" :option="chartoption"></scEcharts>
|
||||
</el-header>
|
||||
<el-header style="height:120px;" v-if="typeof chartoption === 'object' && Object.keys(chartoption).length > 0">
|
||||
<scEcharts height="100%" :option="chartoption"></scEcharts>
|
||||
</el-header>
|
||||
|
||||
<el-main class="nopadding">
|
||||
<scTable ref="table" :tableColumn="column" :params="search" :columnSetting="columnSetting" :api="api" :row-key="key" @selection-change="selectionChange" :remoteSort="true" :remoteFilter="true" stripe>
|
||||
<el-table-column v-if="isselection" type="selection" width="50"></el-table-column>
|
||||
<el-table-column :label="operation.label || '操作'" :width="operation.width || 124" :fixed="operation.fixed || 'right'" :align="operation.align || 'left'" v-if="operation.edit || operation.delete">
|
||||
<template #default="scope">
|
||||
<el-button-group>
|
||||
<el-button v-if="operation.edit" :type="operation.edit.type || 'primary'" :size="operation.edit.size || 'small'" @click="operationEdit(scope.row, scope.$index)">{{ operation.edit.label || '编辑' }}</el-button>
|
||||
<el-popconfirm v-if="operation.delete" :title="operation.delete.title || '确定删除吗?'" @confirm="operationDelete(scope.row, scope.$index)">
|
||||
<template #reference>
|
||||
<el-button :type="operation.delete.type || 'info'" :size="operation.delete.size || 'small'">{{ operation.delete.label || '删除' }}</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</el-button-group>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
<el-main class="nopadding">
|
||||
<scTable ref="table" :tableColumn="column" :params="search" :columnSetting="columnSetting" :api="api" :row-key="key" @selection-change="selectionChange" :remoteSort="true" :remoteFilter="true" stripe>
|
||||
<el-table-column v-if="isselection" type="selection" width="50"></el-table-column>
|
||||
<el-table-column :label="operation.label || '操作'" :width="operation.width || 124" :fixed="operation.fixed || 'right'" :align="operation.align || 'left'" v-if="operation.edit || operation.delete">
|
||||
<template #default="scope">
|
||||
<el-button-group>
|
||||
<el-button v-if="operation.edit" :type="operation.edit.type || 'primary'" :size="operation.edit.size || 'small'" @click="operationEdit(scope.row, scope.$index)">{{ operation.edit.label || '编辑' }}</el-button>
|
||||
<el-popconfirm v-if="operation.delete" :title="operation.delete.title || '确定删除吗?'" @confirm="operationDelete(scope.row, scope.$index)">
|
||||
<template #reference>
|
||||
<el-button :type="operation.delete.type || 'info'" :size="operation.delete.size || 'small'">{{ operation.delete.label || '删除' }}</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</el-button-group>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
<save-dialog v-if="dialog.save" :column="column" ref="saveDialog" @success="handleSuccess" @closed="dialog.save=false"></save-dialog>
|
||||
<stat-dialog v-if="dialog.stat" ref="statDialog" @closed="dialog.stat=false"></stat-dialog>
|
||||
</template>
|
||||
@ -59,9 +59,6 @@
|
||||
import scFilterBar from '@/components/scFilterBar';
|
||||
import scEcharts from '@/components/scEcharts'
|
||||
import XItem from '@/components/scForm/item'
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
name: 'propertyAuth',
|
||||
components: {
|
||||
@ -139,9 +136,7 @@
|
||||
},
|
||||
//树点击事件
|
||||
groupClick(data){
|
||||
|
||||
this.search[this.aside.searchkey||'groupid'] = data[this.aside.key || 'id'];
|
||||
|
||||
this.$refs.table.reload(this.search)
|
||||
},
|
||||
// 筛选回调
|
||||
@ -153,10 +148,6 @@
|
||||
tabChange(){
|
||||
this.$refs.table.reload(this.search)
|
||||
},
|
||||
//搜索
|
||||
upsearch(){
|
||||
this.$refs.table.reload(this.search)
|
||||
},
|
||||
//增加
|
||||
plus(){
|
||||
this.dialog.save = true
|
||||
@ -253,7 +244,6 @@
|
||||
//本地更新数据
|
||||
handleSuccess(data, mode){
|
||||
|
||||
|
||||
if (!this.operation.edit.url) {
|
||||
this.$alert('没有编辑相关配置', "提示", {type: 'error'});
|
||||
return;
|
||||
@ -290,6 +280,5 @@
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
|
@ -173,6 +173,69 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</sc-form-table>
|
||||
|
||||
<sc-title title="筛选条件"></sc-title>
|
||||
<sc-form-table v-model="form.filter" :addTemplate="addfilterTemplate" drag-sort placeholder="暂无数据">
|
||||
<el-table-column prop="label" label="名称">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.label" placeholder="名称"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="component" label="表单组件" width="120">
|
||||
<template #default="scope">
|
||||
<el-select v-model="scope.row.component" placeholder="选择">
|
||||
<el-option value="input" key="input" label="Input"> Input </el-option>
|
||||
<el-option value="select" key="select" label="下拉"> 下拉 </el-option>
|
||||
<el-option value="switch" key="switch" label="开关"> 开关 </el-option>
|
||||
<el-option value="date" key="date" label="日期选择"> 日期选择 </el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="字段">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.name" placeholder="字段名"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="selected" label="置顶" width="70" align="center">
|
||||
<template #default="scope">
|
||||
<el-switch v-model="scope.row.selected"></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="width" label="宽" width="80">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.width" v-show="scope.row.selected" placeholder="宽"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="operator" label="默认筛选" width="110">
|
||||
<template #default="scope">
|
||||
<el-select v-model="scope.row.filter" placeholder="选择">
|
||||
<el-option value="<" key="<" label="小于"> 小于 </el-option>
|
||||
<el-option value="<=" key="<=" label="小于"> 小于等于 </el-option>
|
||||
<el-option value=">" key=">" label="大于"> 大于 </el-option>
|
||||
<el-option value=">=" key=">=" label="大于等于"> 大于等于 </el-option>
|
||||
<el-option value="!=" key="!=" label="不等于"> 不等于 </el-option>
|
||||
<el-option value="=" key="=" label="等于"> 等于 </el-option>
|
||||
<el-option value="notin" key="notin" label="Input"> 不包含 </el-option>
|
||||
<el-option value="in" key="in" label="包含"> 包含 </el-option>
|
||||
<el-option value="like" key="like" label="模糊查询"> 模糊查询 </el-option>
|
||||
<el-option value="between" key="between" label="区间查询"> 区间查询 </el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="options" label="选项" width="80" align="center">
|
||||
<template #default="scope">
|
||||
<el-button text size="small" :type="Object.keys(scope.row.options).length==0?'':'primary'" @click="setoptions(scope.row)">
|
||||
选项
|
||||
<el-badge :hidden="Object.keys(scope.row.options).length==0" :value="Object.keys(scope.row.options).length" class="badge" type="danger"></el-badge>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</sc-form-table>
|
||||
|
||||
|
||||
<sc-title title="Column表格"></sc-title>
|
||||
<sc-form-table v-model="form.column" :addTemplate="addcolumnTemplate" drag-sort placeholder="暂无数据">
|
||||
<el-table-column prop="label" label="名称">
|
||||
@ -241,22 +304,6 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="operator" label="筛选" width="110">
|
||||
<template #default="scope">
|
||||
<el-select v-model="scope.row.filter" placeholder="选择">
|
||||
<el-option value="<" key="<" label="小于"> 小于 </el-option>
|
||||
<el-option value="<=" key="<=" label="小于"> 小于等于 </el-option>
|
||||
<el-option value=">" key=">" label="大于"> 大于 </el-option>
|
||||
<el-option value=">=" key=">=" label="大于等于"> 大于等于 </el-option>
|
||||
<el-option value="!=" key="!=" label="不等于"> 不等于 </el-option>
|
||||
<el-option value="=" key="=" label="等于"> 等于 </el-option>
|
||||
<el-option value="notin" key="notin" label="Input"> 不包含 </el-option>
|
||||
<el-option value="in" key="in" label="包含"> 包含 </el-option>
|
||||
<el-option value="like" key="like" label="模糊查询"> 模糊查询 </el-option>
|
||||
<el-option value="between" key="between" label="区间查询"> 区间查询 </el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="options" label="选项" width="80" align="center">
|
||||
<template #default="scope">
|
||||
<el-button text size="small" :type="Object.keys(scope.row.options).length==0?'':'primary'" @click="setoptions(scope.row)">
|
||||
@ -273,17 +320,20 @@
|
||||
<el-button @click="visible=false">取消</el-button>
|
||||
</el-footer>
|
||||
</el-container>
|
||||
<images ref="images" @success="function(a,o){o.close()}"></images>
|
||||
<videos ref="videos" @success="function(a,o){o.close()}"></videos>
|
||||
<options ref="options"></options>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
import options from './options'
|
||||
|
||||
|
||||
export default {
|
||||
emits: ['success', 'closed'],
|
||||
components: {
|
||||
options,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -299,6 +349,7 @@
|
||||
stat:[],
|
||||
tabs:[],
|
||||
column:[],
|
||||
filter:[],
|
||||
title:'',
|
||||
name:'',
|
||||
api:'',
|
||||
@ -334,10 +385,19 @@
|
||||
width:'',
|
||||
hide:'',
|
||||
span:'',
|
||||
filter:'',
|
||||
options:{},
|
||||
},
|
||||
addfilterTemplate: {
|
||||
label:'',
|
||||
name:'',
|
||||
selected:false,
|
||||
component:'',
|
||||
operator:'',
|
||||
options:{},
|
||||
operators:[],
|
||||
},
|
||||
visible: false,
|
||||
dialog: false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -350,6 +410,9 @@
|
||||
this.visible = true;
|
||||
return this;
|
||||
},
|
||||
dialogclose(){
|
||||
this.dialog = false;
|
||||
},
|
||||
close(){
|
||||
this.visible = false;
|
||||
},
|
||||
@ -390,8 +453,9 @@
|
||||
},
|
||||
//设置过滤项
|
||||
setoptions(o){
|
||||
this.dialog = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.videos.open().setData(o)
|
||||
this.$refs.options.open().setData(o)
|
||||
})
|
||||
},
|
||||
}
|
||||
|
@ -68,7 +68,12 @@
|
||||
<el-table-column label="操作" fixed="right" align="left" width="170">
|
||||
<template #default="scope">
|
||||
<el-button-group>
|
||||
<el-button type="warning" size="small" @click="table_copy(scope.row, scope.$index)">复制</el-button>
|
||||
<el-popconfirm :title="'确定复制吗?'" @confirm="table_copy(scope.row, scope.$index)">
|
||||
<template #reference>
|
||||
<el-button :type="'warning'" :size="'small'">复制</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
|
||||
<el-button type="primary" size="small" @click="table_edit(scope.row, scope.$index)">编辑</el-button>
|
||||
<el-popconfirm :title="'确定删除吗?'" @confirm="table_del(scope.row, scope.$index)">
|
||||
<template #reference>
|
||||
|
80
src/views/system/tablegen/options.vue
Normal file
80
src/views/system/tablegen/options.vue
Normal file
@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<el-drawer :size="800" @closed="$emit('closed', data)" :destroy-on-close="true" title="选项" v-model="visible">
|
||||
<el-container v-loading="loading">
|
||||
<el-main style="padding:0 6px 6px 6px">
|
||||
<el-alert title="扩展配置为系统业务所有的配置" type="warning" style="margin-bottom: 15px;"></el-alert>
|
||||
<el-input placeholder="请填写JSON" type="textarea" rows="20" v-model="jsonData"></el-input>
|
||||
|
||||
<!-- <sc-code-editor ref="editor" v-model="jsonData" mode="javascript" :height="500"></sc-code-editor> -->
|
||||
</el-main>
|
||||
<el-footer>
|
||||
<el-button @click="submit" type="primary">
|
||||
提交
|
||||
</el-button>
|
||||
</el-footer>
|
||||
</el-container>
|
||||
</el-drawer>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
import { defineAsyncComponent } from 'vue';
|
||||
const scCodeEditor = defineAsyncComponent(() => import('@/components/scCodeEditor'));
|
||||
|
||||
|
||||
export default {
|
||||
emits: ['success', 'closed'],
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
issave: false,
|
||||
data:{},
|
||||
jsonData:'',
|
||||
filtersAddTemplate: {
|
||||
key: null,
|
||||
value: null,
|
||||
},
|
||||
}
|
||||
},
|
||||
components: {
|
||||
scCodeEditor
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
close(){
|
||||
this.visible = false;
|
||||
},
|
||||
//表单提交方法
|
||||
submit(){
|
||||
|
||||
try {
|
||||
this.data.options = JSON.parse(this.jsonData);
|
||||
|
||||
this.close()
|
||||
this.$emit('success', this.data, this)
|
||||
|
||||
|
||||
} catch (error) {
|
||||
|
||||
this.$alert('无效的 JSON 数据: ' + error, "提示", {type: 'error'});
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
//显示
|
||||
open(){
|
||||
this.visible = true;
|
||||
return this;
|
||||
},
|
||||
//表单注入数据
|
||||
setData(o){
|
||||
this.data = o
|
||||
this.jsonData = JSON.stringify(o.options, null, 4)
|
||||
// this.$refs.editor.init
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
</style>
|
Loading…
Reference in New Issue
Block a user