Commit 483fe6b2 by yuwei

2.0.0项目初始化

parent 60ce609a
package cn.datax.common.dictionary.utils;
import cn.datax.common.redis.service.RedisService;
import cn.datax.common.utils.SpringContextHolder;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class ConfigUtil {
private ConfigUtil() {}
private static volatile ConfigUtil instance;
public static ConfigUtil getInstance() {
if(instance == null) {
synchronized (ConfigUtil.class) {
if(instance == null) {
instance = new ConfigUtil();
}
}
}
return instance;
}
private RedisService redisService = SpringContextHolder.getBean(RedisService.class);
/**
* 获取参数
* @param code
*/
public Object getConfig(String code) {
String key = "data:system:configs";
Object object = redisService.get(key);
if (null == object) {
return null;
}
JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(object));
Object o = jsonArray.stream().filter(obj -> ((JSONObject) obj).get("configKey").equals(code))
.findFirst().orElse(null);
return o;
}
}
...@@ -2,7 +2,9 @@ package cn.datax.service.system.config; ...@@ -2,7 +2,9 @@ package cn.datax.service.system.config;
import cn.datax.common.core.DataConstant; import cn.datax.common.core.DataConstant;
import cn.datax.common.redis.service.RedisService; import cn.datax.common.redis.service.RedisService;
import cn.datax.service.system.api.entity.ConfigEntity;
import cn.datax.service.system.api.entity.DictEntity; import cn.datax.service.system.api.entity.DictEntity;
import cn.datax.service.system.dao.ConfigDao;
import cn.datax.service.system.dao.DictDao; import cn.datax.service.system.dao.DictDao;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -27,6 +29,8 @@ public class StartedUpRunner implements ApplicationRunner { ...@@ -27,6 +29,8 @@ public class StartedUpRunner implements ApplicationRunner {
private RedisService redisService; private RedisService redisService;
@Autowired @Autowired
private DictDao dictDao; private DictDao dictDao;
@Autowired
private ConfigDao configDao;
@Override @Override
public void run(ApplicationArguments args) { public void run(ApplicationArguments args) {
...@@ -39,11 +43,17 @@ public class StartedUpRunner implements ApplicationRunner { ...@@ -39,11 +43,17 @@ public class StartedUpRunner implements ApplicationRunner {
System.out.println(banner); System.out.println(banner);
// 项目启动时,初始化缓存 // 项目启动时,初始化缓存
String key = "data:system:dicts"; String dictKey = "data:system:dicts";
Boolean hasKey = redisService.hasKey(key); Boolean hasDictKey = redisService.hasKey(dictKey);
if (!hasKey) { if (!hasDictKey) {
List<DictEntity> dictEntityList = dictDao.queryDictList(DataConstant.EnableState.ENABLE.getKey()); List<DictEntity> dictEntityList = dictDao.queryDictList(DataConstant.EnableState.ENABLE.getKey());
redisService.set(key, dictEntityList); redisService.set(dictKey, dictEntityList);
}
String configKey = "data:system:configs";
Boolean hasConfigKey = redisService.hasKey(configKey);
if (!hasConfigKey) {
List<ConfigEntity> configEntityList = configDao.queryConfigList(DataConstant.EnableState.ENABLE.getKey());
redisService.set(configKey, configEntityList);
} }
} }
} }
......
...@@ -2,6 +2,7 @@ package cn.datax.service.system.controller; ...@@ -2,6 +2,7 @@ package cn.datax.service.system.controller;
import cn.datax.common.core.JsonPage; import cn.datax.common.core.JsonPage;
import cn.datax.common.core.R; import cn.datax.common.core.R;
import cn.datax.common.dictionary.utils.ConfigUtil;
import cn.datax.common.validate.ValidationGroups; import cn.datax.common.validate.ValidationGroups;
import cn.datax.service.system.api.dto.ConfigDto; import cn.datax.service.system.api.dto.ConfigDto;
import cn.datax.service.system.api.entity.ConfigEntity; import cn.datax.service.system.api.entity.ConfigEntity;
...@@ -69,7 +70,7 @@ public class ConfigController extends BaseController { ...@@ -69,7 +70,7 @@ public class ConfigController extends BaseController {
@ApiImplicitParam(name = "configQuery", value = "查询实体configQuery", required = true, dataTypeClass = ConfigQuery.class) @ApiImplicitParam(name = "configQuery", value = "查询实体configQuery", required = true, dataTypeClass = ConfigQuery.class)
}) })
@GetMapping("/page") @GetMapping("/page")
public R getSysConfigPage(ConfigQuery configQuery) { public R getConfigPage(ConfigQuery configQuery) {
QueryWrapper<ConfigEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ConfigEntity> queryWrapper = new QueryWrapper<>();
IPage<ConfigEntity> page = configService.page(new Page<>(configQuery.getPageNum(), configQuery.getPageSize()), queryWrapper); IPage<ConfigEntity> page = configService.page(new Page<>(configQuery.getPageNum(), configQuery.getPageSize()), queryWrapper);
List<ConfigVo> collect = page.getRecords().stream().map(configMapper::toVO).collect(Collectors.toList()); List<ConfigVo> collect = page.getRecords().stream().map(configMapper::toVO).collect(Collectors.toList());
...@@ -85,7 +86,7 @@ public class ConfigController extends BaseController { ...@@ -85,7 +86,7 @@ public class ConfigController extends BaseController {
@ApiOperation(value = "添加信息", notes = "根据config对象添加信息") @ApiOperation(value = "添加信息", notes = "根据config对象添加信息")
@ApiImplicitParam(name = "config", value = "详细实体config", required = true, dataType = "ConfigDto") @ApiImplicitParam(name = "config", value = "详细实体config", required = true, dataType = "ConfigDto")
@PostMapping() @PostMapping()
public R saveSysConfig(@RequestBody @Validated({ValidationGroups.Insert.class}) ConfigDto config) { public R saveConfig(@RequestBody @Validated({ValidationGroups.Insert.class}) ConfigDto config) {
ConfigEntity configEntity = configService.saveConfig(config); ConfigEntity configEntity = configService.saveConfig(config);
return R.ok().setData(configMapper.toVO(configEntity)); return R.ok().setData(configMapper.toVO(configEntity));
} }
...@@ -101,7 +102,7 @@ public class ConfigController extends BaseController { ...@@ -101,7 +102,7 @@ public class ConfigController extends BaseController {
@ApiImplicitParam(name = "config", value = "详细实体config", required = true, dataType = "ConfigDto") @ApiImplicitParam(name = "config", value = "详细实体config", required = true, dataType = "ConfigDto")
}) })
@PutMapping("/{id}") @PutMapping("/{id}")
public R updateSysConfig(@PathVariable String id, @RequestBody @Validated({ValidationGroups.Update.class}) ConfigDto config) { public R updateConfig(@PathVariable String id, @RequestBody @Validated({ValidationGroups.Update.class}) ConfigDto config) {
ConfigEntity configEntity = configService.updateConfig(config); ConfigEntity configEntity = configService.updateConfig(config);
return R.ok().setData(configMapper.toVO(configEntity)); return R.ok().setData(configMapper.toVO(configEntity));
} }
...@@ -114,7 +115,7 @@ public class ConfigController extends BaseController { ...@@ -114,7 +115,7 @@ public class ConfigController extends BaseController {
@ApiOperation(value = "删除", notes = "根据url的id来指定删除对象") @ApiOperation(value = "删除", notes = "根据url的id来指定删除对象")
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path") @ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
public R deleteSysConfigById(@PathVariable String id) { public R deleteConfigById(@PathVariable String id) {
configService.deleteConfigById(id); configService.deleteConfigById(id);
return R.ok(); return R.ok();
} }
...@@ -122,8 +123,30 @@ public class ConfigController extends BaseController { ...@@ -122,8 +123,30 @@ public class ConfigController extends BaseController {
@ApiOperation(value = "批量删除", notes = "根据url的ids来批量删除对象") @ApiOperation(value = "批量删除", notes = "根据url的ids来批量删除对象")
@ApiImplicitParam(name = "ids", value = "ID集合", required = true, dataType = "List", paramType = "path") @ApiImplicitParam(name = "ids", value = "ID集合", required = true, dataType = "List", paramType = "path")
@DeleteMapping("/batch/{ids}") @DeleteMapping("/batch/{ids}")
public R deletePostBatch(@PathVariable List<String> ids) { public R deleteConfigBatch(@PathVariable List<String> ids) {
configService.deleteConfigBatch(ids); configService.deleteConfigBatch(ids);
return R.ok(); return R.ok();
} }
/**
* 获取参数
*
* @return
*/
@GetMapping("/key/{key}")
public R getConfig(@PathVariable String key) {
Object obj = ConfigUtil.getInstance().getConfig(key);
return R.ok().setData(obj);
}
/**
* 刷新参数缓存
*
* @return
*/
@GetMapping("/refresh")
public R refreshConfig() {
configService.refreshConfig();
return R.ok();
}
} }
...@@ -143,7 +143,7 @@ public class DictController extends BaseController { ...@@ -143,7 +143,7 @@ public class DictController extends BaseController {
} }
/** /**
* 刷新字典 * 刷新字典缓存
* *
* @return * @return
*/ */
......
...@@ -3,6 +3,9 @@ package cn.datax.service.system.dao; ...@@ -3,6 +3,9 @@ package cn.datax.service.system.dao;
import cn.datax.common.base.BaseDao; import cn.datax.common.base.BaseDao;
import cn.datax.service.system.api.entity.ConfigEntity; import cn.datax.service.system.api.entity.ConfigEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p> * <p>
...@@ -15,4 +18,11 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -15,4 +18,11 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface ConfigDao extends BaseDao<ConfigEntity> { public interface ConfigDao extends BaseDao<ConfigEntity> {
/**
* 查询有效参数集合
*
* @return
* @param status
*/
List<ConfigEntity> queryConfigList(@Param("status") String status);
} }
...@@ -25,4 +25,6 @@ public interface ConfigService extends BaseService<ConfigEntity> { ...@@ -25,4 +25,6 @@ public interface ConfigService extends BaseService<ConfigEntity> {
void deleteConfigById(String id); void deleteConfigById(String id);
void deleteConfigBatch(List<String> ids); void deleteConfigBatch(List<String> ids);
void refreshConfig();
} }
package cn.datax.service.system.service.impl; package cn.datax.service.system.service.impl;
import cn.datax.common.core.DataConstant;
import cn.datax.common.redis.service.RedisService;
import cn.datax.service.system.api.dto.ConfigDto; import cn.datax.service.system.api.dto.ConfigDto;
import cn.datax.service.system.api.entity.ConfigEntity; import cn.datax.service.system.api.entity.ConfigEntity;
import cn.datax.service.system.service.ConfigService; import cn.datax.service.system.service.ConfigService;
...@@ -31,6 +33,9 @@ public class ConfigServiceImpl extends BaseServiceImpl<ConfigDao, ConfigEntity> ...@@ -31,6 +33,9 @@ public class ConfigServiceImpl extends BaseServiceImpl<ConfigDao, ConfigEntity>
@Autowired @Autowired
private ConfigMapper configMapper; private ConfigMapper configMapper;
@Autowired
private RedisService redisService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ConfigEntity saveConfig(ConfigDto sysConfigDto) { public ConfigEntity saveConfig(ConfigDto sysConfigDto) {
...@@ -64,4 +69,15 @@ public class ConfigServiceImpl extends BaseServiceImpl<ConfigDao, ConfigEntity> ...@@ -64,4 +69,15 @@ public class ConfigServiceImpl extends BaseServiceImpl<ConfigDao, ConfigEntity>
public void deleteConfigBatch(List<String> ids) { public void deleteConfigBatch(List<String> ids) {
configDao.deleteBatchIds(ids); configDao.deleteBatchIds(ids);
} }
@Override
public void refreshConfig() {
String key = "data:system:configs";
Boolean hasKey = redisService.hasKey(key);
if (hasKey) {
redisService.del(key);
}
List<ConfigEntity> configEntityList = configDao.queryConfigList(DataConstant.EnableState.ENABLE.getKey());
redisService.set(key, configEntityList);
}
} }
...@@ -27,4 +27,10 @@ ...@@ -27,4 +27,10 @@
remark, config_name, config_key, config_value remark, config_name, config_key, config_value
</sql> </sql>
<select id="queryConfigList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"/>
FROM sys_config
WHERE status = #{status}
</select>
</mapper> </mapper>
import request from '@/utils/request' import request from '@/utils/request'
// 根据参数键名查询参数值
export function getConfigKey (configKey) {
return request({
url: '/system/configs/key/' + configKey,
method: 'get'
})
}
// 刷新参数缓存
export function refreshConfig () {
return request({
url: '/system/configs/refresh',
method: 'get'
})
}
export function pageConfig (data) { export function pageConfig (data) {
return request({ return request({
url: '/system/configs/page', url: '/system/configs/page',
......
...@@ -8,6 +8,14 @@ export function getDicts (dictCode) { ...@@ -8,6 +8,14 @@ export function getDicts (dictCode) {
}) })
} }
// 刷新字典缓存
export function refreshDict () {
return request({
url: '/system/dicts/refresh',
method: 'get'
})
}
export function pageDict (data) { export function pageDict (data) {
return request({ return request({
url: '/system/dicts/page', url: '/system/dicts/page',
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button> <el-button size="mini" icon="el-icon-plus" round @click="submitForm" :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled">{{loadingOptions.loadingText}}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -60,6 +60,12 @@ export default { ...@@ -60,6 +60,12 @@ export default {
showEdit: false, showEdit: false,
showDetail: false showDetail: false
}, },
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数 // 表单参数
form: { form: {
status: '1' status: '1'
...@@ -95,6 +101,9 @@ export default { ...@@ -95,6 +101,9 @@ export default {
submitForm: function () { submitForm: function () {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
addConfig(this.form).then(response => { addConfig(this.form).then(response => {
if (response.success) { if (response.success) {
this.$message.success('保存成功') this.$message.success('保存成功')
...@@ -104,6 +113,9 @@ export default { ...@@ -104,6 +113,9 @@ export default {
}, 2000) }, 2000)
} else { } else {
this.$message.error('保存失败') this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
} }
}) })
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button> <el-button size="mini" icon="el-icon-plus" round @click="submitForm" :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled">{{loadingOptions.loadingText}}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -60,6 +60,12 @@ export default { ...@@ -60,6 +60,12 @@ export default {
showEdit: false, showEdit: false,
showDetail: false showDetail: false
}, },
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
...@@ -103,6 +109,9 @@ export default { ...@@ -103,6 +109,9 @@ export default {
submitForm: function () { submitForm: function () {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
updateConfig(this.form).then(response => { updateConfig(this.form).then(response => {
if (response.success) { if (response.success) {
this.$message.success('保存成功') this.$message.success('保存成功')
...@@ -112,6 +121,9 @@ export default { ...@@ -112,6 +121,9 @@ export default {
}, 2000) }, 2000)
} else { } else {
this.$message.error('保存失败') this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
} }
}) })
} }
......
...@@ -160,7 +160,7 @@ ...@@ -160,7 +160,7 @@
</template> </template>
<script> <script>
import { pageConfig } from '@/api/system/config' import { pageConfig, delConfig, delConfigs } from '@/api/system/config'
export default { export default {
name: 'ConfigList', name: 'ConfigList',
...@@ -298,6 +298,10 @@ export default { ...@@ -298,6 +298,10 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
delConfig(row.id)
}).then(() => {
this.$message.success('删除成功')
this.getList()
}).catch(() => { }).catch(() => {
}) })
}, },
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button> <el-button size="mini" icon="el-icon-plus" round @click="submitForm" :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled">{{loadingOptions.loadingText}}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -64,6 +64,12 @@ export default { ...@@ -64,6 +64,12 @@ export default {
showEdit: false, showEdit: false,
showDetail: false showDetail: false
}, },
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数 // 表单参数
form: { form: {
status: '1', status: '1',
...@@ -130,6 +136,9 @@ export default { ...@@ -130,6 +136,9 @@ export default {
submitForm: function () { submitForm: function () {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
addDept(this.form).then(response => { addDept(this.form).then(response => {
if (response.success) { if (response.success) {
this.$message.success('保存成功') this.$message.success('保存成功')
...@@ -139,6 +148,9 @@ export default { ...@@ -139,6 +148,9 @@ export default {
}, 2000) }, 2000)
} else { } else {
this.$message.error('保存失败') this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
} }
}) })
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button> <el-button size="mini" icon="el-icon-plus" round @click="submitForm" :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled">{{loadingOptions.loadingText}}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -64,6 +64,12 @@ export default { ...@@ -64,6 +64,12 @@ export default {
showEdit: false, showEdit: false,
showDetail: false showDetail: false
}, },
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
...@@ -136,6 +142,9 @@ export default { ...@@ -136,6 +142,9 @@ export default {
submitForm: function () { submitForm: function () {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
updateDept(this.form).then(response => { updateDept(this.form).then(response => {
if (response.success) { if (response.success) {
this.$message.success('保存成功') this.$message.success('保存成功')
...@@ -145,6 +154,9 @@ export default { ...@@ -145,6 +154,9 @@ export default {
}, 2000) }, 2000)
} else { } else {
this.$message.error('保存失败') this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
} }
}) })
} }
......
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
</template> </template>
<script> <script>
import { listDept } from '@/api/system/dept' import { listDept, delDept, delDepts } from '@/api/system/dept'
import { construct } from '@/utils/json-tree' import { construct } from '@/utils/json-tree'
export default { export default {
...@@ -227,6 +227,10 @@ export default { ...@@ -227,6 +227,10 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
delDept(row.id)
}).then(() => {
this.$message.success('删除成功')
this.getList()
}).catch(() => { }).catch(() => {
}) })
}, },
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button> <el-button size="mini" icon="el-icon-plus" round @click="submitForm" :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled">{{loadingOptions.loadingText}}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -61,6 +61,12 @@ export default { ...@@ -61,6 +61,12 @@ export default {
showItemEdit: false, showItemEdit: false,
showItemDetail: false showItemDetail: false
}, },
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数 // 表单参数
form: { form: {
status: '1' status: '1'
...@@ -93,6 +99,9 @@ export default { ...@@ -93,6 +99,9 @@ export default {
submitForm: function () { submitForm: function () {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
addDict(this.form).then(response => { addDict(this.form).then(response => {
if (response.success) { if (response.success) {
this.$message.success('保存成功') this.$message.success('保存成功')
...@@ -102,6 +111,9 @@ export default { ...@@ -102,6 +111,9 @@ export default {
}, 2000) }, 2000)
} else { } else {
this.$message.error('保存失败') this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
} }
}) })
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button> <el-button size="mini" icon="el-icon-plus" round @click="submitForm" :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled">{{loadingOptions.loadingText}}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -61,6 +61,12 @@ export default { ...@@ -61,6 +61,12 @@ export default {
showItemEdit: false, showItemEdit: false,
showItemDetail: false showItemDetail: false
}, },
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
...@@ -101,6 +107,9 @@ export default { ...@@ -101,6 +107,9 @@ export default {
submitForm: function () { submitForm: function () {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
updateDict(this.form).then(response => { updateDict(this.form).then(response => {
if (response.success) { if (response.success) {
this.$message.success('保存成功') this.$message.success('保存成功')
...@@ -110,6 +119,9 @@ export default { ...@@ -110,6 +119,9 @@ export default {
}, 2000) }, 2000)
} else { } else {
this.$message.error('保存失败') this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
} }
}) })
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button> <el-button size="mini" icon="el-icon-plus" round @click="submitForm" :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled">{{loadingOptions.loadingText}}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -64,6 +64,12 @@ export default { ...@@ -64,6 +64,12 @@ export default {
showItemEdit: false, showItemEdit: false,
showItemDetail: false showItemDetail: false
}, },
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数 // 表单参数
form: { form: {
status: '1', status: '1',
...@@ -99,6 +105,9 @@ export default { ...@@ -99,6 +105,9 @@ export default {
submitForm: function () { submitForm: function () {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
addDictItem(this.form).then(response => { addDictItem(this.form).then(response => {
if (response.success) { if (response.success) {
this.$message.success('保存成功') this.$message.success('保存成功')
...@@ -108,6 +117,9 @@ export default { ...@@ -108,6 +117,9 @@ export default {
}, 2000) }, 2000)
} else { } else {
this.$message.error('保存失败') this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
} }
}) })
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button> <el-button size="mini" icon="el-icon-plus" round @click="submitForm" :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled">{{loadingOptions.loadingText}}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -64,6 +64,12 @@ export default { ...@@ -64,6 +64,12 @@ export default {
showItemEdit: false, showItemEdit: false,
showItemDetail: false showItemDetail: false
}, },
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
...@@ -104,6 +110,9 @@ export default { ...@@ -104,6 +110,9 @@ export default {
submitForm: function () { submitForm: function () {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
updateDictItem(this.form).then(response => { updateDictItem(this.form).then(response => {
if (response.success) { if (response.success) {
this.$message.success('保存成功') this.$message.success('保存成功')
...@@ -113,6 +122,9 @@ export default { ...@@ -113,6 +122,9 @@ export default {
}, 2000) }, 2000)
} else { } else {
this.$message.error('保存失败') this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
} }
}) })
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回主表</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -239,6 +240,9 @@ export default { ...@@ -239,6 +240,9 @@ export default {
this.initCols() this.initCols()
}, },
methods: { methods: {
showCard () {
this.$emit('showCard', this.showOptions)
},
/** 查询参数列表 */ /** 查询参数列表 */
getList () { getList () {
this.loading = true this.loading = true
...@@ -333,6 +337,10 @@ export default { ...@@ -333,6 +337,10 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
delDictItem(row.id)
}).then(() => {
this.$message.success('删除成功')
this.getList()
}).catch(() => { }).catch(() => {
}) })
}, },
......
...@@ -341,6 +341,10 @@ export default { ...@@ -341,6 +341,10 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
delDict(row.id)
}).then(() => {
this.$message.success('删除成功')
this.getList()
}).catch(() => { }).catch(() => {
}) })
}, },
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button> <el-button size="mini" icon="el-icon-plus" round @click="submitForm" :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled">{{loadingOptions.loadingText}}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -91,6 +91,12 @@ export default { ...@@ -91,6 +91,12 @@ export default {
showEdit: false, showEdit: false,
showDetail: false showDetail: false
}, },
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数 // 表单参数
form: { form: {
status: '1', status: '1',
...@@ -166,6 +172,9 @@ export default { ...@@ -166,6 +172,9 @@ export default {
submitForm: function () { submitForm: function () {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
addMenu(this.form).then(response => { addMenu(this.form).then(response => {
if (response.success) { if (response.success) {
this.$message.success('保存成功') this.$message.success('保存成功')
...@@ -175,6 +184,9 @@ export default { ...@@ -175,6 +184,9 @@ export default {
}, 2000) }, 2000)
} else { } else {
this.$message.error('保存失败') this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
} }
}) })
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button> <el-button size="mini" icon="el-icon-plus" round @click="submitForm" :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled">{{loadingOptions.loadingText}}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -91,6 +91,12 @@ export default { ...@@ -91,6 +91,12 @@ export default {
showEdit: false, showEdit: false,
showDetail: false showDetail: false
}, },
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
...@@ -170,6 +176,9 @@ export default { ...@@ -170,6 +176,9 @@ export default {
submitForm: function () { submitForm: function () {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
updateMenu(this.form).then(response => { updateMenu(this.form).then(response => {
if (response.success) { if (response.success) {
this.$message.success('保存成功') this.$message.success('保存成功')
...@@ -179,6 +188,9 @@ export default { ...@@ -179,6 +188,9 @@ export default {
}, 2000) }, 2000)
} else { } else {
this.$message.error('保存失败') this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
} }
}) })
} }
......
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
</template> </template>
<script> <script>
import { listMenu } from '@/api/system/menu' import { listMenu, delMenu, delMenus } from '@/api/system/menu'
import { construct } from '@/utils/json-tree' import { construct } from '@/utils/json-tree'
export default { export default {
...@@ -241,6 +241,10 @@ export default { ...@@ -241,6 +241,10 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
delMenu(row.id)
}).then(() => {
this.$message.success('删除成功')
this.getList()
}).catch(() => { }).catch(() => {
}) })
}, },
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button> <el-button size="mini" icon="el-icon-plus" round @click="submitForm" :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled">{{loadingOptions.loadingText}}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -54,6 +54,12 @@ export default { ...@@ -54,6 +54,12 @@ export default {
showEdit: false, showEdit: false,
showDetail: false showDetail: false
}, },
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数 // 表单参数
form: { form: {
status: '1' status: '1'
...@@ -83,6 +89,9 @@ export default { ...@@ -83,6 +89,9 @@ export default {
submitForm: function () { submitForm: function () {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
addPost(this.form).then(response => { addPost(this.form).then(response => {
if (response.success) { if (response.success) {
this.$message.success('保存成功') this.$message.success('保存成功')
...@@ -92,6 +101,9 @@ export default { ...@@ -92,6 +101,9 @@ export default {
}, 2000) }, 2000)
} else { } else {
this.$message.error('保存失败') this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
} }
}) })
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button> <el-button size="mini" icon="el-icon-plus" round @click="submitForm" :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled">{{loadingOptions.loadingText}}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -54,6 +54,12 @@ export default { ...@@ -54,6 +54,12 @@ export default {
showEdit: false, showEdit: false,
showDetail: false showDetail: false
}, },
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
...@@ -91,6 +97,9 @@ export default { ...@@ -91,6 +97,9 @@ export default {
submitForm: function () { submitForm: function () {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
updatePost(this.form).then(response => { updatePost(this.form).then(response => {
if (response.success) { if (response.success) {
this.$message.success('保存成功') this.$message.success('保存成功')
...@@ -100,6 +109,9 @@ export default { ...@@ -100,6 +109,9 @@ export default {
}, 2000) }, 2000)
} else { } else {
this.$message.error('保存失败') this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
} }
}) })
} }
......
...@@ -160,7 +160,7 @@ ...@@ -160,7 +160,7 @@
</template> </template>
<script> <script>
import { pagePost } from '@/api/system/post' import { pagePost, delPost, delPosts } from '@/api/system/post'
export default { export default {
name: 'PostList', name: 'PostList',
...@@ -296,6 +296,10 @@ export default { ...@@ -296,6 +296,10 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
delPost(row.id)
}).then(() => {
this.$message.success('删除成功')
this.getList()
}).catch(() => { }).catch(() => {
}) })
}, },
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button> <el-button size="mini" icon="el-icon-plus" round @click="submitForm" :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled">{{loadingOptions.loadingText}}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -97,6 +97,12 @@ export default { ...@@ -97,6 +97,12 @@ export default {
showEdit: false, showEdit: false,
showDetail: false showDetail: false
}, },
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数 // 表单参数
form: { form: {
status: '1', status: '1',
...@@ -199,6 +205,9 @@ export default { ...@@ -199,6 +205,9 @@ export default {
submitForm: function () { submitForm: function () {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
this.form.menuList = this.getMenuAllCheckedKeys() this.form.menuList = this.getMenuAllCheckedKeys()
this.form.deptList = this.getDeptAllCheckedKeys() this.form.deptList = this.getDeptAllCheckedKeys()
addRole(this.form).then(response => { addRole(this.form).then(response => {
...@@ -210,6 +219,9 @@ export default { ...@@ -210,6 +219,9 @@ export default {
}, 2000) }, 2000)
} else { } else {
this.$message.error('保存失败') this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
} }
}) })
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button> <el-button size="mini" icon="el-icon-plus" round @click="submitForm" :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled">{{loadingOptions.loadingText}}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -97,6 +97,12 @@ export default { ...@@ -97,6 +97,12 @@ export default {
showEdit: false, showEdit: false,
showDetail: false showDetail: false
}, },
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
...@@ -206,6 +212,9 @@ export default { ...@@ -206,6 +212,9 @@ export default {
submitForm: function () { submitForm: function () {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
this.form.menuList = this.getMenuAllCheckedKeys() this.form.menuList = this.getMenuAllCheckedKeys()
this.form.deptList = this.getDeptAllCheckedKeys() this.form.deptList = this.getDeptAllCheckedKeys()
updateRole(this.form).then(response => { updateRole(this.form).then(response => {
...@@ -217,6 +226,9 @@ export default { ...@@ -217,6 +226,9 @@ export default {
}, 2000) }, 2000)
} else { } else {
this.$message.error('保存失败') this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
} }
}) })
} }
......
...@@ -160,7 +160,7 @@ ...@@ -160,7 +160,7 @@
</template> </template>
<script> <script>
import { pageRole } from '@/api/system/role' import { pageRole, delRole, delRoles } from '@/api/system/role'
export default { export default {
name: 'RoleList', name: 'RoleList',
...@@ -303,6 +303,10 @@ export default { ...@@ -303,6 +303,10 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
delRole(row.id)
}).then(() => {
this.$message.success('删除成功')
this.getList()
}).catch(() => { }).catch(() => {
}) })
}, },
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button> <el-button size="mini" icon="el-icon-plus" round @click="submitForm" :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled">{{loadingOptions.loadingText}}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -105,6 +105,12 @@ export default { ...@@ -105,6 +105,12 @@ export default {
showEdit: false, showEdit: false,
showDetail: false showDetail: false
}, },
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数 // 表单参数
form: { form: {
status: '1', status: '1',
...@@ -208,6 +214,9 @@ export default { ...@@ -208,6 +214,9 @@ export default {
submitForm: function () { submitForm: function () {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
addUser(this.form).then(response => { addUser(this.form).then(response => {
if (response.success) { if (response.success) {
this.$message.success('保存成功') this.$message.success('保存成功')
...@@ -217,6 +226,9 @@ export default { ...@@ -217,6 +226,9 @@ export default {
}, 2000) }, 2000)
} else { } else {
this.$message.error('保存失败') this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
} }
}) })
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round @click="submitForm">保存</el-button> <el-button size="mini" icon="el-icon-plus" round @click="submitForm" :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled">{{loadingOptions.loadingText}}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -102,6 +102,12 @@ export default { ...@@ -102,6 +102,12 @@ export default {
showEdit: false, showEdit: false,
showDetail: false showDetail: false
}, },
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数 // 表单参数
form: { form: {
postList: [], postList: [],
...@@ -215,6 +221,9 @@ export default { ...@@ -215,6 +221,9 @@ export default {
submitForm: function () { submitForm: function () {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
updateUser(this.form).then(response => { updateUser(this.form).then(response => {
if (response.success) { if (response.success) {
this.$message.success('保存成功') this.$message.success('保存成功')
...@@ -224,6 +233,9 @@ export default { ...@@ -224,6 +233,9 @@ export default {
}, 2000) }, 2000)
} else { } else {
this.$message.error('保存失败') this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
} }
}) })
} }
......
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
</template> </template>
<script> <script>
import { pageUser } from '@/api/system/user' import { pageUser, delUser, delUsers } from '@/api/system/user'
import { listDept } from '@/api/system/dept' import { listDept } from '@/api/system/dept'
import { construct } from '@/utils/json-tree' import { construct } from '@/utils/json-tree'
...@@ -379,6 +379,10 @@ export default { ...@@ -379,6 +379,10 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
delUser(row.id)
}).then(() => {
this.$message.success('删除成功')
this.getList()
}).catch(() => { }).catch(() => {
}) })
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment