响应结果集结构更改

master
DongZeLiang 2023-09-29 15:56:38 +08:00
parent 146e5b6b88
commit e766adb916
29 changed files with 89 additions and 89 deletions

View File

@ -46,4 +46,4 @@ function install() {
export default { export default {
install, install,
} }

View File

@ -172,11 +172,11 @@ export default {
// //
let quill = this.Quill; let quill = this.Quill;
// //
if (res.code == 200) { if (res.data.code == 200) {
// //
let length = quill.getSelection().index; let length = quill.getSelection().index;
// res.url // res.data.url
quill.insertEmbed(length, "image", process.env.VUE_APP_BASE_API + res.fileName); quill.insertEmbed(length, "image", process.env.VUE_APP_BASE_API + res.data.fileName);
// //
quill.setSelection(length + 1); quill.setSelection(length + 1);
} else { } else {

View File

@ -146,13 +146,13 @@ export default {
}, },
// //
handleUploadSuccess(res, file) { handleUploadSuccess(res, file) {
if (res.code === 200) { if (res.data.code === 200) {
this.uploadList.push({ name: res.fileName, url: res.fileName }); this.uploadList.push({ name: res.data.fileName, url: res.data.fileName });
this.uploadedSuccessfully(); this.uploadedSuccessfully();
} else { } else {
this.number--; this.number--;
this.$modal.closeLoading(); this.$modal.closeLoading();
this.$modal.msgError(res.msg); this.$modal.msgError(res.data.msg);
this.$refs.fileUpload.handleRemove(file); this.$refs.fileUpload.handleRemove(file);
this.uploadedSuccessfully(); this.uploadedSuccessfully();
} }

View File

@ -19,7 +19,7 @@
> >
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
</el-upload> </el-upload>
<!-- 上传提示 --> <!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="showTip"> <div class="el-upload__tip" slot="tip" v-if="showTip">
请上传 请上传
@ -154,13 +154,13 @@ export default {
}, },
// //
handleUploadSuccess(res, file) { handleUploadSuccess(res, file) {
if (res.code === 200) { if (res.data.code === 200) {
this.uploadList.push({ name: res.fileName, url: res.fileName }); this.uploadList.push({ name: res.data.fileName, url: res.data.fileName });
this.uploadedSuccessfully(); this.uploadedSuccessfully();
} else { } else {
this.number--; this.number--;
this.$modal.closeLoading(); this.$modal.closeLoading();
this.$modal.msgError(res.msg); this.$modal.msgError(res.data.msg);
this.$refs.imageUpload.handleRemove(file); this.$refs.imageUpload.handleRemove(file);
this.uploadedSuccessfully(); this.uploadedSuccessfully();
} }

View File

@ -19,7 +19,7 @@ export default {
const isBlob = blobValidate(res.data); const isBlob = blobValidate(res.data);
if (isBlob) { if (isBlob) {
const blob = new Blob([res.data]) const blob = new Blob([res.data])
this.saveAs(blob, decodeURIComponent(res.headers['download-filename'])) this.saveAs(blob, decodeURIComponent(res.data.headers['download-filename']))
} else { } else {
this.printErrMsg(res.data); this.printErrMsg(res.data);
} }
@ -36,7 +36,7 @@ export default {
const isBlob = blobValidate(res.data); const isBlob = blobValidate(res.data);
if (isBlob) { if (isBlob) {
const blob = new Blob([res.data]) const blob = new Blob([res.data])
this.saveAs(blob, decodeURIComponent(res.headers['download-filename'])) this.saveAs(blob, decodeURIComponent(res.data.headers['download-filename']))
} else { } else {
this.printErrMsg(res.data); this.printErrMsg(res.data);
} }

View File

@ -41,8 +41,8 @@ const user = {
const uuid = userInfo.uuid const uuid = userInfo.uuid
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => { login(username, password, code, uuid).then(res => {
setToken(res.token) setToken(res.data)
commit('SET_TOKEN', res.token) commit('SET_TOKEN', res.data)
resolve() resolve()
}).catch(error => { }).catch(error => {
reject(error) reject(error)
@ -54,11 +54,11 @@ const user = {
GetInfo({ commit, state }) { GetInfo({ commit, state }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getInfo().then(res => { getInfo().then(res => {
const user = res.user const user = res.data.user
const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar; const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar;
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组 if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.roles) commit('SET_ROLES', res.data.roles)
commit('SET_PERMISSIONS', res.permissions) commit('SET_PERMISSIONS', res.data.permissions)
} else { } else {
commit('SET_ROLES', ['ROLE_DEFAULT']) commit('SET_ROLES', ['ROLE_DEFAULT'])
} }

View File

@ -38,7 +38,7 @@ export const options = {
function responseConverter(response, dictMeta) { function responseConverter(response, dictMeta) {
const dicts = response.content instanceof Array ? response.content : response const dicts = response.content instanceof Array ? response.content : response
if (dicts === undefined) { if (dicts === undefined) {
console.warn(`no dict data of "${dictMeta.type}" found in the response`) console.warn(`在响应中未找到“${dictMeta.type}”的字典数据`)
return [] return []
} }
return dicts.map(d => dictConverter(d, dictMeta)) return dicts.map(d => dictConverter(d, dictMeta))

View File

@ -110,10 +110,10 @@ export default {
methods: { methods: {
getCode() { getCode() {
getCodeImg().then(res => { getCodeImg().then(res => {
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled; this.captchaEnabled = res.data.captchaEnabled === undefined ? true : res.data.captchaEnabled;
if (this.captchaEnabled) { if (this.captchaEnabled) {
this.codeUrl = "data:image/gif;base64," + res.img; this.codeUrl = "data:image/gif;base64," + res.data.img;
this.loginForm.uuid = res.uuid; this.loginForm.uuid = res.data.uuid;
} }
}); });
}, },

View File

@ -356,8 +356,8 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
listJob(this.queryParams).then(response => { listJob(this.queryParams).then(response => {
this.jobList = response.rows; this.jobList = response.data.rows;
this.total = response.total; this.total = response.data.total;
this.loading = false; this.loading = false;
}); });
}, },

View File

@ -233,8 +233,8 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
listJobLog(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listJobLog(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.jobLogList = response.rows; this.jobLogList = response.data.rows;
this.total = response.total; this.total = response.data.total;
this.loading = false; this.loading = false;
} }
); );

View File

@ -175,8 +175,8 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
list(this.addDateRange(this.queryParams, this.dateRange)).then(response => { list(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.list = response.rows; this.list = response.data.rows;
this.total = response.total; this.total = response.data.total;
this.loading = false; this.loading = false;
} }
); );

View File

@ -92,8 +92,8 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
list(this.queryParams).then(response => { list(this.queryParams).then(response => {
this.list = response.rows; this.list = response.data.rows;
this.total = response.total; this.total = response.data.total;
this.loading = false; this.loading = false;
}); });
}, },

View File

@ -254,8 +254,8 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
list(this.addDateRange(this.queryParams, this.dateRange)).then( response => { list(this.addDateRange(this.queryParams, this.dateRange)).then( response => {
this.list = response.rows; this.list = response.data.rows;
this.total = response.total; this.total = response.data.total;
this.loading = false; this.loading = false;
} }
); );

View File

@ -113,10 +113,10 @@ export default {
methods: { methods: {
getCode() { getCode() {
getCodeImg().then(res => { getCodeImg().then(res => {
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled; this.captchaEnabled = res.data.captchaEnabled === undefined ? true : res.data.captchaEnabled;
if (this.captchaEnabled) { if (this.captchaEnabled) {
this.codeUrl = "data:image/gif;base64," + res.img; this.codeUrl = "data:image/gif;base64," + res.data.img;
this.registerForm.uuid = res.uuid; this.registerForm.uuid = res.data.uuid;
} }
}); });
}, },

View File

@ -240,8 +240,8 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.configList = response.rows; this.configList = response.data.rows;
this.total = response.total; this.total = response.data.total;
this.loading = false; this.loading = false;
} }
); );

View File

@ -295,8 +295,8 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
listData(this.queryParams).then(response => { listData(this.queryParams).then(response => {
this.dataList = response.rows; this.dataList = response.data.rows;
this.total = response.total; this.total = response.data.total;
this.loading = false; this.loading = false;
}); });
}, },
@ -399,4 +399,4 @@ export default {
} }
} }
}; };
</script> </script>

View File

@ -244,8 +244,8 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.typeList = response.rows; this.typeList = response.data.rows;
this.total = response.total; this.total = response.data.total;
this.loading = false; this.loading = false;
} }
); );
@ -344,4 +344,4 @@ export default {
} }
} }
}; };
</script> </script>

View File

@ -224,8 +224,8 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
listNotice(this.queryParams).then(response => { listNotice(this.queryParams).then(response => {
this.noticeList = response.rows; this.noticeList = response.data.rows;
this.total = response.total; this.total = response.data.total;
this.loading = false; this.loading = false;
}); });
}, },

View File

@ -214,8 +214,8 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
listPost(this.queryParams).then(response => { listPost(this.queryParams).then(response => {
this.postList = response.rows; this.postList = response.data.rows;
this.total = response.total; this.total = response.data.total;
this.loading = false; this.loading = false;
}); });
}, },

View File

@ -143,8 +143,8 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
allocatedUserList(this.queryParams).then(response => { allocatedUserList(this.queryParams).then(response => {
this.userList = response.rows; this.userList = response.data.rows;
this.total = response.total; this.total = response.data.total;
this.loading = false; this.loading = false;
} }
); );
@ -196,4 +196,4 @@ export default {
} }
} }
}; };
</script> </script>

View File

@ -349,8 +349,8 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
listRole(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listRole(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.roleList = response.rows; this.roleList = response.data.rows;
this.total = response.total; this.total = response.data.total;
this.loading = false; this.loading = false;
} }
); );
@ -382,14 +382,14 @@ export default {
/** 根据角色ID查询菜单树结构 */ /** 根据角色ID查询菜单树结构 */
getRoleMenuTreeselect(roleId) { getRoleMenuTreeselect(roleId) {
return roleMenuTreeselect(roleId).then(response => { return roleMenuTreeselect(roleId).then(response => {
this.menuOptions = response.menus; this.menuOptions = response.data.menus;
return response; return response;
}); });
}, },
/** 根据角色ID查询部门树结构 */ /** 根据角色ID查询部门树结构 */
getDeptTree(roleId) { getDeptTree(roleId) {
return deptTreeSelect(roleId).then(response => { return deptTreeSelect(roleId).then(response => {
this.deptOptions = response.depts; this.deptOptions = response.data.depts;
return response; return response;
}); });
}, },
@ -514,7 +514,7 @@ export default {
this.open = true; this.open = true;
this.$nextTick(() => { this.$nextTick(() => {
roleMenu.then(res => { roleMenu.then(res => {
let checkedKeys = res.checkedKeys let checkedKeys = res.data.checkedKeys
checkedKeys.forEach((v) => { checkedKeys.forEach((v) => {
this.$nextTick(()=>{ this.$nextTick(()=>{
this.$refs.menu.setChecked(v, true ,false); this.$refs.menu.setChecked(v, true ,false);
@ -540,7 +540,7 @@ export default {
this.openDataScope = true; this.openDataScope = true;
this.$nextTick(() => { this.$nextTick(() => {
deptTreeSelect.then(res => { deptTreeSelect.then(res => {
this.$refs.dept.setCheckedKeys(res.checkedKeys); this.$refs.dept.setCheckedKeys(res.data.checkedKeys);
}); });
}); });
this.title = "分配数据权限"; this.title = "分配数据权限";
@ -602,4 +602,4 @@ export default {
} }
} }
}; };
</script> </script>

View File

@ -103,8 +103,8 @@ export default {
// //
getList() { getList() {
unallocatedUserList(this.queryParams).then(res => { unallocatedUserList(this.queryParams).then(res => {
this.userList = res.rows; this.userList = res.data.rows;
this.total = res.total; this.total = res.data.total;
}); });
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
@ -126,8 +126,8 @@ export default {
return; return;
} }
authUserSelectAll({ roleId: roleId, userIds: userIds }).then(res => { authUserSelectAll({ roleId: roleId, userIds: userIds }).then(res => {
this.$modal.msgSuccess(res.msg); this.$modal.msgSuccess(res.data.msg);
if (res.code === 200) { if (res.data.code === 200) {
this.visible = false; this.visible = false;
this.$emit("ok"); this.$emit("ok");
} }

View File

@ -33,7 +33,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-show="total>0" :total="total" :page.sync="pageNum" :limit.sync="pageSize" /> <pagination v-show="total>0" :total="total" :page.sync="pageNum" :limit.sync="pageSize" />
<el-form label-width="100px"> <el-form label-width="100px">
@ -71,8 +71,8 @@ export default {
if (userId) { if (userId) {
this.loading = true; this.loading = true;
getAuthRole(userId).then((response) => { getAuthRole(userId).then((response) => {
this.form = response.user; this.form = response.data.user;
this.roles = response.roles; this.roles = response.data.roles;
this.total = this.roles.length; this.total = this.roles.length;
this.$nextTick(() => { this.$nextTick(() => {
this.roles.forEach((row) => { this.roles.forEach((row) => {
@ -114,4 +114,4 @@ export default {
}, },
}, },
}; };
</script> </script>

View File

@ -462,7 +462,7 @@ export default {
this.getList(); this.getList();
this.getDeptTree(); this.getDeptTree();
this.getConfigKey("sys.user.initPassword").then(response => { this.getConfigKey("sys.user.initPassword").then(response => {
this.initPassword = response.msg; this.initPassword = response.data.msg;
}); });
}, },
methods: { methods: {
@ -470,8 +470,8 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.userList = response.rows; this.userList = response.data.rows;
this.total = response.total; this.total = response.data.total;
this.loading = false; this.loading = false;
} }
); );
@ -562,8 +562,8 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
getUser().then(response => { getUser().then(response => {
this.postOptions = response.posts; this.postOptions = response.data.posts;
this.roleOptions = response.roles; this.roleOptions = response.data.roles;
this.open = true; this.open = true;
this.title = "添加用户"; this.title = "添加用户";
this.form.password = this.initPassword; this.form.password = this.initPassword;
@ -574,11 +574,11 @@ export default {
this.reset(); this.reset();
const userId = row.userId || this.ids; const userId = row.userId || this.ids;
getUser(userId).then(response => { getUser(userId).then(response => {
this.form = response.data; this.form = response.data.sysUser;
this.postOptions = response.posts; this.postOptions = response.data.posts;
this.roleOptions = response.roles; this.roleOptions = response.data.roles;
this.$set(this.form, "postIds", response.postIds); this.$set(this.form, "postIds", response.data.postIds);
this.$set(this.form, "roleIds", response.roleIds); this.$set(this.form, "roleIds", response.data.roleIds);
this.open = true; this.open = true;
this.title = "修改用户"; this.title = "修改用户";
this.form.password = ""; this.form.password = "";
@ -658,7 +658,7 @@ export default {
this.upload.open = false; this.upload.open = false;
this.upload.isUploading = false; this.upload.isUploading = false;
this.$refs.upload.clearFiles(); this.$refs.upload.clearFiles();
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true }); this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.data.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
this.getList(); this.getList();
}, },
// //
@ -667,4 +667,4 @@ export default {
} }
} }
}; };
</script> </script>

View File

@ -81,9 +81,9 @@ export default {
methods: { methods: {
getUser() { getUser() {
getUserProfile().then(response => { getUserProfile().then(response => {
this.user = response.data; this.user = response.data.sysUser;
this.roleGroup = response.roleGroup; this.roleGroup = response.data.roleGroup;
this.postGroup = response.postGroup; this.postGroup = response.data.postGroup;
}); });
} }
} }

View File

@ -135,7 +135,7 @@ export default {
formData.append("avatarfile", data); formData.append("avatarfile", data);
uploadAvatar(formData).then(response => { uploadAvatar(formData).then(response => {
this.open = false; this.open = false;
this.options.img = process.env.VUE_APP_BASE_API + response.imgUrl; this.options.img = process.env.VUE_APP_BASE_API + response.data.imgUrl;
store.commit('SET_AVATAR', this.options.img); store.commit('SET_AVATAR', this.options.img);
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.visible = false; this.visible = false;

View File

@ -183,7 +183,7 @@ export default {
const basicForm = this.$refs.basicInfo.$refs.basicInfoForm; const basicForm = this.$refs.basicInfo.$refs.basicInfoForm;
const genForm = this.$refs.genInfo.$refs.genInfoForm; const genForm = this.$refs.genInfo.$refs.genInfoForm;
Promise.all([basicForm, genForm].map(this.getFormPromise)).then(res => { Promise.all([basicForm, genForm].map(this.getFormPromise)).then(res => {
const validateResult = res.every(item => !!item); const validateResult = res.data.every(item => !!item);
if (validateResult) { if (validateResult) {
const genTable = Object.assign({}, basicForm.model, genForm.model); const genTable = Object.assign({}, basicForm.model, genForm.model);
genTable.columns = this.columns; genTable.columns = this.columns;
@ -194,8 +194,8 @@ export default {
parentMenuId: genTable.parentMenuId parentMenuId: genTable.parentMenuId
}; };
updateGenTable(genTable).then(res => { updateGenTable(genTable).then(res => {
this.$modal.msgSuccess(res.msg); this.$modal.msgSuccess(res.data.msg);
if (res.code === 200) { if (res.data.code === 200) {
this.close(); this.close();
} }
}); });

View File

@ -85,8 +85,8 @@ export default {
getList() { getList() {
listDbTable(this.queryParams).then(res => { listDbTable(this.queryParams).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.dbTableList = res.rows; this.dbTableList = res.data.rows;
this.total = res.total; this.total = res.data.total;
} }
}); });
}, },

View File

@ -244,8 +244,8 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
listTable(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listTable(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.tableList = response.rows; this.tableList = response.data.rows;
this.total = response.total; this.total = response.data.total;
this.loading = false; this.loading = false;
} }
); );