提交 19de8a58 authored 作者: taojinlong's avatar taojinlong

Merge branch 'main' of github.com:dataease/dataease into main

...@@ -23,4 +23,6 @@ public class SysUserEntity implements Serializable { ...@@ -23,4 +23,6 @@ public class SysUserEntity implements Serializable {
private String email; private String email;
private String phone; private String phone;
private String language;
} }
...@@ -35,5 +35,7 @@ public class SysUser implements Serializable { ...@@ -35,5 +35,7 @@ public class SysUser implements Serializable {
private Long updateTime; private Long updateTime;
private String language;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
...@@ -1083,6 +1083,76 @@ public class SysUserExample { ...@@ -1083,6 +1083,76 @@ public class SysUserExample {
addCriterion("update_time not between", value1, value2, "updateTime"); addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andLanguageIsNull() {
addCriterion("`language` is null");
return (Criteria) this;
}
public Criteria andLanguageIsNotNull() {
addCriterion("`language` is not null");
return (Criteria) this;
}
public Criteria andLanguageEqualTo(String value) {
addCriterion("`language` =", value, "language");
return (Criteria) this;
}
public Criteria andLanguageNotEqualTo(String value) {
addCriterion("`language` <>", value, "language");
return (Criteria) this;
}
public Criteria andLanguageGreaterThan(String value) {
addCriterion("`language` >", value, "language");
return (Criteria) this;
}
public Criteria andLanguageGreaterThanOrEqualTo(String value) {
addCriterion("`language` >=", value, "language");
return (Criteria) this;
}
public Criteria andLanguageLessThan(String value) {
addCriterion("`language` <", value, "language");
return (Criteria) this;
}
public Criteria andLanguageLessThanOrEqualTo(String value) {
addCriterion("`language` <=", value, "language");
return (Criteria) this;
}
public Criteria andLanguageLike(String value) {
addCriterion("`language` like", value, "language");
return (Criteria) this;
}
public Criteria andLanguageNotLike(String value) {
addCriterion("`language` not like", value, "language");
return (Criteria) this;
}
public Criteria andLanguageIn(List<String> values) {
addCriterion("`language` in", values, "language");
return (Criteria) this;
}
public Criteria andLanguageNotIn(List<String> values) {
addCriterion("`language` not in", values, "language");
return (Criteria) this;
}
public Criteria andLanguageBetween(String value1, String value2) {
addCriterion("`language` between", value1, value2, "language");
return (Criteria) this;
}
public Criteria andLanguageNotBetween(String value1, String value2) {
addCriterion("`language` not between", value1, value2, "language");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<result column="pwd_reset_time" jdbcType="BIGINT" property="pwdResetTime" /> <result column="pwd_reset_time" jdbcType="BIGINT" property="pwdResetTime" />
<result column="create_time" jdbcType="BIGINT" property="createTime" /> <result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" /> <result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="language" jdbcType="VARCHAR" property="language" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
...@@ -78,7 +79,7 @@ ...@@ -78,7 +79,7 @@
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
user_id, dept_id, username, nick_name, gender, phone, email, `password`, is_admin, user_id, dept_id, username, nick_name, gender, phone, email, `password`, is_admin,
enabled, create_by, update_by, pwd_reset_time, create_time, update_time enabled, create_by, update_by, pwd_reset_time, create_time, update_time, `language`
</sql> </sql>
<select id="selectByExample" parameterType="io.dataease.base.domain.SysUserExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="io.dataease.base.domain.SysUserExample" resultMap="BaseResultMap">
select select
...@@ -115,14 +116,14 @@ ...@@ -115,14 +116,14 @@
nick_name, gender, phone, nick_name, gender, phone,
email, `password`, is_admin, email, `password`, is_admin,
enabled, create_by, update_by, enabled, create_by, update_by,
pwd_reset_time, create_time, update_time pwd_reset_time, create_time, update_time,
) `language`)
values (#{userId,jdbcType=BIGINT}, #{deptId,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, values (#{userId,jdbcType=BIGINT}, #{deptId,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR},
#{nickName,jdbcType=VARCHAR}, #{gender,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{nickName,jdbcType=VARCHAR}, #{gender,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
#{email,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{isAdmin,jdbcType=BIT}, #{email,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{isAdmin,jdbcType=BIT},
#{enabled,jdbcType=BIGINT}, #{createBy,jdbcType=VARCHAR}, #{updateBy,jdbcType=VARCHAR}, #{enabled,jdbcType=BIGINT}, #{createBy,jdbcType=VARCHAR}, #{updateBy,jdbcType=VARCHAR},
#{pwdResetTime,jdbcType=BIGINT}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT} #{pwdResetTime,jdbcType=BIGINT}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
) #{language,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.dataease.base.domain.SysUser"> <insert id="insertSelective" parameterType="io.dataease.base.domain.SysUser">
insert into sys_user insert into sys_user
...@@ -172,6 +173,9 @@ ...@@ -172,6 +173,9 @@
<if test="updateTime != null"> <if test="updateTime != null">
update_time, update_time,
</if> </if>
<if test="language != null">
`language`,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null"> <if test="userId != null">
...@@ -219,6 +223,9 @@ ...@@ -219,6 +223,9 @@
<if test="updateTime != null"> <if test="updateTime != null">
#{updateTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
</if> </if>
<if test="language != null">
#{language,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="io.dataease.base.domain.SysUserExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.dataease.base.domain.SysUserExample" resultType="java.lang.Long">
...@@ -275,6 +282,9 @@ ...@@ -275,6 +282,9 @@
<if test="record.updateTime != null"> <if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT},
</if> </if>
<if test="record.language != null">
`language` = #{record.language,jdbcType=VARCHAR},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
...@@ -296,7 +306,8 @@ ...@@ -296,7 +306,8 @@
update_by = #{record.updateBy,jdbcType=VARCHAR}, update_by = #{record.updateBy,jdbcType=VARCHAR},
pwd_reset_time = #{record.pwdResetTime,jdbcType=BIGINT}, pwd_reset_time = #{record.pwdResetTime,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=BIGINT}, create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT} update_time = #{record.updateTime,jdbcType=BIGINT},
`language` = #{record.language,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
...@@ -346,6 +357,9 @@ ...@@ -346,6 +357,9 @@
<if test="updateTime != null"> <if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
</if> </if>
<if test="language != null">
`language` = #{language,jdbcType=VARCHAR},
</if>
</set> </set>
where user_id = #{userId,jdbcType=BIGINT} where user_id = #{userId,jdbcType=BIGINT}
</update> </update>
...@@ -364,7 +378,8 @@ ...@@ -364,7 +378,8 @@
update_by = #{updateBy,jdbcType=VARCHAR}, update_by = #{updateBy,jdbcType=VARCHAR},
pwd_reset_time = #{pwdResetTime,jdbcType=BIGINT}, pwd_reset_time = #{pwdResetTime,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT} update_time = #{updateTime,jdbcType=BIGINT},
`language` = #{language,jdbcType=VARCHAR}
where user_id = #{userId,jdbcType=BIGINT} where user_id = #{userId,jdbcType=BIGINT}
</update> </update>
</mapper> </mapper>
\ No newline at end of file
...@@ -6,7 +6,6 @@ import io.dataease.auth.api.dto.CurrentRoleDto; ...@@ -6,7 +6,6 @@ import io.dataease.auth.api.dto.CurrentRoleDto;
import io.dataease.auth.entity.SysUserEntity; import io.dataease.auth.entity.SysUserEntity;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
public interface AuthMapper { public interface AuthMapper {
......
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
<select id="findUser" resultMap="baseMap"> <select id="findUser" resultMap="baseMap">
select user_id, username,nick_name, dept_id, password, enabled,email, phone from sys_user where user_id = #{userId} select user_id, username,nick_name, dept_id, password, enabled,email, phone, language from sys_user where user_id = #{userId}
</select> </select>
<select id="findUserByName" resultMap="baseMap"> <select id="findUserByName" resultMap="baseMap">
select user_id, username,nick_name, dept_id, password, enabled,email, phone from sys_user where username = #{username} select user_id, username,nick_name, dept_id, password, enabled,email, phone, language from sys_user where username = #{username}
</select> </select>
<select id="roleCodes" resultType="String"> <select id="roleCodes" resultType="String">
......
...@@ -19,6 +19,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -19,6 +19,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Optional;
@RestController @RestController
@Api(tags = "系统:用户管理") @Api(tags = "系统:用户管理")
...@@ -89,4 +90,15 @@ public class SysUserController { ...@@ -89,4 +90,15 @@ public class SysUserController {
public void updatePersonInfo(@RequestBody SysUserCreateRequest request){ public void updatePersonInfo(@RequestBody SysUserCreateRequest request){
sysUserService.updatePersonInfo(request); sysUserService.updatePersonInfo(request);
} }
@ApiOperation("设置语言")
@PostMapping("/setLanguage/{language}")
public void setLanguage(@PathVariable String language) {
CurrentUserDto user = AuthUtils.getUser();
Optional.ofNullable(language).ifPresent(currentLanguage -> {
if (!currentLanguage.equals(user.getLanguage())) {
sysUserService.setLanguage(user.getUserId(), currentLanguage);
}
});
}
} }
...@@ -60,12 +60,12 @@ public class MysqlQueryProvider extends QueryProvider { ...@@ -60,12 +60,12 @@ public class MysqlQueryProvider extends QueryProvider {
@Override @Override
public String createQueryCountSQLAsTmp(String sql) { public String createQueryCountSQLAsTmp(String sql) {
return createQueryCountSQL(" (" + sql + ") AS tmp "); return createQueryCountSQL(" (" + sqlFix(sql) + ") AS tmp ");
} }
@Override @Override
public String createSQLPreview(String sql, String orderBy) { public String createSQLPreview(String sql, String orderBy) {
return "SELECT * FROM (" + sql + ") AS tmp ORDER BY " + orderBy + " LIMIT 0,1000"; return "SELECT * FROM (" + sqlFix(sql) + ") AS tmp ORDER BY " + orderBy + " LIMIT 0,1000";
} }
@Override @Override
...@@ -94,7 +94,7 @@ public class MysqlQueryProvider extends QueryProvider { ...@@ -94,7 +94,7 @@ public class MysqlQueryProvider extends QueryProvider {
@Override @Override
public String createQuerySQLAsTmp(String sql, List<DatasetTableField> fields) { public String createQuerySQLAsTmp(String sql, List<DatasetTableField> fields) {
return createQuerySQL(" (" + sql + ") AS tmp ", fields); return createQuerySQL(" (" + sqlFix(sql) + ") AS tmp ", fields);
} }
@Override @Override
...@@ -228,7 +228,7 @@ public class MysqlQueryProvider extends QueryProvider { ...@@ -228,7 +228,7 @@ public class MysqlQueryProvider extends QueryProvider {
@Override @Override
public String getSQLAsTmp(String sql, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartExtFilterRequest> extFilterRequestList) { public String getSQLAsTmp(String sql, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartExtFilterRequest> extFilterRequestList) {
return getSQL(" (" + sql + ") AS tmp ", xAxis, yAxis, extFilterRequestList); return getSQL(" (" + sqlFix(sql) + ") AS tmp ", xAxis, yAxis, extFilterRequestList);
} }
@Override @Override
...@@ -298,4 +298,11 @@ public class MysqlQueryProvider extends QueryProvider { ...@@ -298,4 +298,11 @@ public class MysqlQueryProvider extends QueryProvider {
} }
return filter.toString(); return filter.toString();
} }
private String sqlFix(String sql) {
if (sql.lastIndexOf(";") == (sql.length() - 1)) {
sql = sql.substring(0, sql.length() - 1);
}
return sql;
}
} }
...@@ -201,4 +201,12 @@ public class SysUserService { ...@@ -201,4 +201,12 @@ public class SysUserService {
return userIds.stream().map(sysUserMapper::selectByPrimaryKey).collect(Collectors.toList()); return userIds.stream().map(sysUserMapper::selectByPrimaryKey).collect(Collectors.toList());
} }
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #userId")
public void setLanguage(Long userId,String language) {
SysUser sysUser = new SysUser();
sysUser.setUserId(userId);
sysUser.setLanguage(language);
sysUserMapper.updateByPrimaryKeySelective(sysUser);
}
} }
...@@ -43,3 +43,10 @@ export function uiImage(imageId) { ...@@ -43,3 +43,10 @@ export function uiImage(imageId) {
method: 'get' method: 'get'
}) })
} }
export function languageApi(language) {
return request({
url: '/api/user/setLanguage/' + language,
method: 'post'
})
}
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
methods: { methods: {
handleSetLanguage(lang) { handleSetLanguage(lang) {
this.$i18n.locale = lang this.$i18n.locale = lang
this.$store.dispatch('app/setLanguage', lang) this.$store.dispatch('user/setLanguage', lang)
this.$message({ this.$message({
message: 'Switch Language Success', message: 'Switch Language Success',
type: 'success' type: 'success'
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<size-select id="size-select" class="right-menu-item hover-effect" /> <size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip> --> </el-tooltip> -->
<!-- <lang-select class="right-menu-item hover-effect" />--> <lang-select class="right-menu-item hover-effect" />
</template> </template>
<el-dropdown class="top-dropdown" style="display: flex;align-items: center;"> <el-dropdown class="top-dropdown" style="display: flex;align-items: center;">
...@@ -72,15 +72,15 @@ import { isExternal } from '@/utils/validate' ...@@ -72,15 +72,15 @@ import { isExternal } from '@/utils/validate'
// import Doc from '@/components/Doc' // import Doc from '@/components/Doc'
// import Screenfull from '@/components/Screenfull' // import Screenfull from '@/components/Screenfull'
// import SizeSelect from '@/components/SizeSelect' // import SizeSelect from '@/components/SizeSelect'
// import LangSelect from '@/components/LangSelect' import LangSelect from '@/components/LangSelect'
import { getSysUI } from '@/utils/auth' import { getSysUI } from '@/utils/auth'
export default { export default {
name: 'Topbar', name: 'Topbar',
components: { components: {
AppLink AppLink,
// Screenfull, // Screenfull,
// SizeSelect, // SizeSelect,
// LangSelect LangSelect
// Doc // Doc
}, },
data() { data() {
......
const getters = { const getters = {
sidebar: state => state.app.sidebar, sidebar: state => state.app.sidebar,
language: state => state.app.language, language: state => state.user.language,
size: state => state.app.size, size: state => state.app.size,
device: state => state.app.device, device: state => state.app.device,
token: state => state.user.token, token: state => state.user.token,
......
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
import { getLanguage } from '@/lang/index'
const state = { const state = {
sidebar: { sidebar: {
opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true, opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
...@@ -7,7 +7,7 @@ const state = { ...@@ -7,7 +7,7 @@ const state = {
hide: false hide: false
}, },
device: 'desktop', device: 'desktop',
language: getLanguage(),
size: Cookies.get('size') || 'small' size: Cookies.get('size') || 'small'
} }
...@@ -32,10 +32,7 @@ const mutations = { ...@@ -32,10 +32,7 @@ const mutations = {
SET_SIDEBAR_HIDE: (state, status) => { SET_SIDEBAR_HIDE: (state, status) => {
state.sidebar.hide = status state.sidebar.hide = status
}, },
SET_LANGUAGE: (state, language) => {
state.language = language
Cookies.set('language', language)
},
SET_SIZE: (state, size) => { SET_SIZE: (state, size) => {
state.size = size state.size = size
Cookies.set('size', size) Cookies.set('size', size)
...@@ -57,9 +54,6 @@ const actions = { ...@@ -57,9 +54,6 @@ const actions = {
}, },
setSize({ commit }, size) { setSize({ commit }, size) {
commit('SET_SIZE', size) commit('SET_SIZE', size)
},
setLanguage({ commit }, language) {
commit('SET_LANGUAGE', language)
} }
} }
......
import { login, logout, getInfo, getUIinfo } from '@/api/user' import { login, logout, getInfo, getUIinfo, languageApi } from '@/api/user'
import { getToken, setToken, removeToken, setSysUI } from '@/utils/auth' import { getToken, setToken, removeToken, setSysUI } from '@/utils/auth'
import { resetRouter } from '@/router' import { resetRouter } from '@/router'
import { format } from '@/utils/formatUi' import { format } from '@/utils/formatUi'
import { getLanguage } from '@/lang/index'
import Cookies from 'js-cookie'
const getDefaultState = () => { const getDefaultState = () => {
return { return {
token: getToken(), token: getToken(),
...@@ -14,7 +15,7 @@ const getDefaultState = () => { ...@@ -14,7 +15,7 @@ const getDefaultState = () => {
loadMenus: false, loadMenus: false,
// 当前用户拥有哪些资源权限 // 当前用户拥有哪些资源权限
permissions: [], permissions: [],
language: getLanguage(),
uiInfo: null uiInfo: null
} }
} }
...@@ -51,6 +52,10 @@ const mutations = { ...@@ -51,6 +52,10 @@ const mutations = {
}, },
SET_UI_INFO: (state, info) => { SET_UI_INFO: (state, info) => {
state.uiInfo = info state.uiInfo = info
},
SET_LANGUAGE: (state, language) => {
state.language = language
Cookies.set('language', language)
} }
} }
...@@ -87,13 +92,15 @@ const actions = { ...@@ -87,13 +92,15 @@ const actions = {
const currentUser = data const currentUser = data
commit('SET_USER', currentUser) commit('SET_USER', currentUser)
const { roles, nickName, permissions } = data const { roles, nickName, permissions, language } = data
commit('SET_ROLES', roles) commit('SET_ROLES', roles)
commit('SET_NAME', nickName) commit('SET_NAME', nickName)
// commit('SET_AVATAR', avatar) // commit('SET_AVATAR', avatar)
commit('SET_PERMISSIONS', permissions) commit('SET_PERMISSIONS', permissions)
commit('SET_LANGUAGE', language)
resolve(data) resolve(data)
}).catch(error => { }).catch(error => {
reject(error) reject(error)
...@@ -144,6 +151,11 @@ const actions = { ...@@ -144,6 +151,11 @@ const actions = {
}, },
setLoginMsg({ commit, msg }) { setLoginMsg({ commit, msg }) {
commit('SET_LOGIN_MSG', msg) commit('SET_LOGIN_MSG', msg)
},
setLanguage({ commit }, language) {
languageApi(language).then(() => {
commit('SET_LANGUAGE', language)
})
} }
} }
......
...@@ -115,7 +115,7 @@ import { get } from '@/api/panel/panel' ...@@ -115,7 +115,7 @@ import { get } from '@/api/panel/panel'
// 引入样式 // 引入样式
import '@/components/canvas/assets/iconfont/iconfont.css' import '@/components/canvas/assets/iconfont/iconfont.css'
import '@/components/canvas/styles/animate.css' import '@/components/canvas/styles/animate.css'
import '@/components/canvas/styles/reset.css' // import '@/components/canvas/styles/reset.css'
import { ApplicationContext } from '@/utils/ApplicationContext' import { ApplicationContext } from '@/utils/ApplicationContext'
import FilterDialog from '../filter/filterDialog' import FilterDialog from '../filter/filterDialog'
......
<template> <template>
<div> <div>
<el-table <el-table
class="de-filter-data-table" class="de-filter-data-table"
:data="starDatas" :data="starDatas"
:show-header="false" :show-header="false"
...@@ -52,7 +51,7 @@ export default { ...@@ -52,7 +51,7 @@ export default {
}) })
}, },
resetID(data) { resetID(data) {
if( data ) { if (data) {
data.forEach(item => { data.forEach(item => {
item.id = uuid.v1() item.id = uuid.v1()
}) })
......
...@@ -2,17 +2,17 @@ ...@@ -2,17 +2,17 @@
<el-row> <el-row>
<el-row v-if="editPanel.optType==='new' && editPanel.panelInfo.nodeType==='panel'"> <el-row v-if="editPanel.optType==='new' && editPanel.panelInfo.nodeType==='panel'">
<el-col :span="18" style="height: 40px"> <el-col :span="18" style="height: 40px">
<el-radio v-model="inputType" label="self"> {{ $t(panel.custom) }}</el-radio> <el-radio v-model="inputType" label="self"> {{ $t('panel.custom') }}</el-radio>
<el-radio v-model="inputType" label="import">{{ $t(panel.import_template) }} </el-radio> <el-radio v-model="inputType" label="import">{{ $t('panel.import_template') }} </el-radio>
<el-radio v-model="inputType" label="copy">{{ $t(panel.copy_template) }} </el-radio> <el-radio v-model="inputType" label="copy">{{ $t('panel.copy_template') }} </el-radio>
</el-col> </el-col>
<el-col v-if="inputType==='import'" :span="6"> <el-col v-if="inputType==='import'" :span="6">
<el-button class="el-icon-upload" size="small" type="primary" @click="goFile">{{ $t(panel.upload_template) }}</el-button> <el-button class="el-icon-upload" size="small" type="primary" @click="goFile">{{ $t('panel.upload_template') }}</el-button>
<input id="input" ref="files" type="file" accept=".DE" hidden @change="handleFileChange"> <input id="input" ref="files" type="file" accept=".DE" hidden @change="handleFileChange">
</el-col> </el-col>
</el-row> </el-row>
<el-row style="margin-top: 5px"> <el-row style="margin-top: 5px">
<el-col :span="4">{{ editPanel.titleSuf }} {{ $t(commons.name) }}</el-col> <el-col :span="4">{{ editPanel.titleSuf }} {{ $t('commons.name') }}</el-col>
<el-col :span="20"> <el-col :span="20">
<el-input v-model="editPanel.panelInfo.name" clearable size="mini" /> <el-input v-model="editPanel.panelInfo.name" clearable size="mini" />
</el-col> </el-col>
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
</el-row> </el-row>
<el-row v-if="inputType==='import'" class="preview" :style="classBackground" /> <el-row v-if="inputType==='import'" class="preview" :style="classBackground" />
<el-row class="root-class"> <el-row class="root-class">
<el-button @click="cancel()">{{ $t(commons.cancel) }}</el-button> <el-button size="mini" @click="cancel()">{{ $t('commons.cancel') }}</el-button>
<el-button type="primary" @click="save()">{{ $t(commons.confirm) }}</el-button> <el-button type="primary" size="mini" @click="save()">{{ $t('commons.confirm') }}</el-button>
</el-row> </el-row>
</el-row> </el-row>
</template> </template>
...@@ -101,7 +101,7 @@ export default { ...@@ -101,7 +101,7 @@ export default {
}, },
save() { save() {
if (!this.editPanel.panelInfo.name) { if (!this.editPanel.panelInfo.name) {
this.$warning( this.$t('commons.name_can_not_empty')) this.$warning(this.$t('chart.name_can_not_empty'))
return false return false
} }
panelSave(this.editPanel.panelInfo).then(response => { panelSave(this.editPanel.panelInfo).then(response => {
......
<template xmlns:el-col="http://www.w3.org/1999/html"> <template xmlns:el-col="http://www.w3.org/1999/html">
<el-col> <el-col style="padding: 0 10px 0 10px;">
<!-- panel list --> <!-- panel list -->
<el-col> <el-col>
<el-row> <el-row>
...@@ -28,7 +28,10 @@ ...@@ -28,7 +28,10 @@
</el-row> </el-row>
<el-row> <el-row>
<span class="header-title">{{ $t('panel.panel') }}</span> <span class="header-title">
{{ $t('panel.panel') }}
<el-button style="float: right;padding-right: 7px;" type="text" icon="el-icon-circle-plus" @click="showEditPanel(newFolder)" />
</span>
</el-row> </el-row>
<el-col class="custom-tree-container"> <el-col class="custom-tree-container">
<div class="block"> <div class="block">
...@@ -248,6 +251,16 @@ export default { ...@@ -248,6 +251,16 @@ export default {
panelData: '[]' panelData: '[]'
} }
}, },
newFolder: {
type: 'folder',
data: {
id: null,
pid: null,
level: 0
},
node: {},
optType: 'newFirstFolder'
},
linkTitle: '链接分享', linkTitle: '链接分享',
linkVisible: false, linkVisible: false,
linkResourceId: null, linkResourceId: null,
...@@ -319,6 +332,12 @@ export default { ...@@ -319,6 +332,12 @@ export default {
this.editPanel.panelInfo.pid = param.data.id this.editPanel.panelInfo.pid = param.data.id
this.editPanel.panelInfo.level = param.data.level + 1 this.editPanel.panelInfo.level = param.data.level + 1
break break
case 'newFirstFolder':
this.editPanel.titlePre = this.$t('commons.create')
this.editPanel.panelInfo.name = ''
this.editPanel.panelInfo.pid = null
this.editPanel.panelInfo.level = 0
break
case 'edit': case 'edit':
case 'rename': case 'rename':
this.editPanel.titlePre = this.$t('commons.edit') this.editPanel.titlePre = this.$t('commons.edit')
...@@ -525,7 +544,9 @@ export default { ...@@ -525,7 +544,9 @@ export default {
flex: 1; flex: 1;
color: #606266; color: #606266;
font-weight: bold; font-weight: bold;
display: block;
height: 100%;
line-height: 36px;
} }
.el-divider--horizontal { .el-divider--horizontal {
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</span> </span>
<span v-if="hasStar && panelInfo" style="float: right;margin-right: 10px"> <span v-if="hasStar && panelInfo" style="float: right;margin-right: 10px">
<el-tooltip :content="$t('commons.cancle')"> <el-tooltip :content="$t('commons.cancel')">
<el-button class="el-icon-star-on" size="mini" circle @click="unstar" /> <el-button class="el-icon-star-on" size="mini" circle @click="unstar" />
</el-tooltip> </el-tooltip>
</span> </span>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论