mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-12 12:26:47 +08:00
fix:修改路径编辑回显
This commit is contained in:
92
src/App.vue
92
src/App.vue
@@ -1,27 +1,27 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="container" v-if="!isLogin">
|
<div id="container" v-if="!isLogin">
|
||||||
<nav-top/>
|
<nav-top />
|
||||||
<div style="display: flex">
|
<div style="display: flex">
|
||||||
<nav-left/>
|
<nav-left />
|
||||||
<div style="flex: 1; display: flex; flex-direction: column; width: 0">
|
<div style="flex: 1; display: flex; flex-direction: column; width: 0">
|
||||||
<open-pages/>
|
<open-pages />
|
||||||
<bread-crumb/>
|
<bread-crumb />
|
||||||
<main>
|
<main>
|
||||||
<a-config-provider :locale="zhCN">
|
<a-config-provider :locale="zhCN">
|
||||||
<router-view/>
|
<router-view />
|
||||||
</a-config-provider>
|
</a-config-provider>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="container" v-if="isLogin">
|
<div id="container" v-if="isLogin">
|
||||||
<router-view/>
|
<router-view />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {computed, defineComponent, ref, watch} from "vue";
|
import { computed, defineComponent, ref, watch } from "vue";
|
||||||
import {useRouter, useRoute} from "vue-router";
|
import { useRouter, useRoute } from "vue-router";
|
||||||
import {useStore} from "vuex";
|
import { useStore } from "vuex";
|
||||||
import NavLeft from "@/components/NavLeft";
|
import NavLeft from "@/components/NavLeft";
|
||||||
import NavTop from "@/components/NavTop";
|
import NavTop from "@/components/NavTop";
|
||||||
import OpenPages from "@/components/OpenPages";
|
import OpenPages from "@/components/OpenPages";
|
||||||
@@ -49,45 +49,48 @@ export default defineComponent({
|
|||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.path,
|
() => route.path,
|
||||||
() => {
|
() => {
|
||||||
route.path === "/login" && (isLogin.value = true);
|
route.path === "/login" && (isLogin.value = true);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const currentRouteName = computed(() => route.name);
|
const currentRouteName = computed(() => route.name);
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
console.log(store)
|
console.log(store);
|
||||||
initDict('faceclassPic')
|
initDict("faceclassPic");
|
||||||
initDict('faceclassClass')
|
initDict("faceclassClass");
|
||||||
initDict('faceclassScene')
|
initDict("faceclassScene");
|
||||||
initDict('projectLevel')
|
initDict("projectLevel");
|
||||||
initDict('projectSys')
|
initDict("projectSys");
|
||||||
getOrgTree()
|
initDict("pathmapPic");
|
||||||
|
getOrgTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function initDict(key) {
|
async function initDict(key) {
|
||||||
let list = localStorage.getItem(key)
|
let list = localStorage.getItem(key);
|
||||||
if (list) {
|
if (list) {
|
||||||
store.commit('SET_DICT', {key, data:JSON.parse(list)});
|
store.commit("SET_DICT", { key, data: JSON.parse(list) });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
list = await getDictList(key)
|
list = await getDictList(key);
|
||||||
localStorage.setItem(key, JSON.stringify(list));
|
localStorage.setItem(key, JSON.stringify(list));
|
||||||
store.commit('SET_DICT', {key, data:list});
|
store.commit("SET_DICT", { key, data: list });
|
||||||
}
|
}
|
||||||
|
|
||||||
const getDictList = (param) => api1.getDict({
|
const getDictList = (param) =>
|
||||||
pageNo: 1,
|
api1
|
||||||
pageSize: 20,
|
.getDict({
|
||||||
setCode: param
|
pageNo: 1,
|
||||||
}).then((res) => res.data.data.rows)
|
pageSize: 20,
|
||||||
|
setCode: param,
|
||||||
|
})
|
||||||
|
.then((res) => res.data.data.rows);
|
||||||
|
|
||||||
//获取组织树
|
//获取组织树
|
||||||
const getOrgTree = () => {
|
const getOrgTree = () => {
|
||||||
const orgtreeList = localStorage.getItem("orgtreeList")
|
const orgtreeList = localStorage.getItem("orgtreeList");
|
||||||
if (orgtreeList) {
|
if (orgtreeList) {
|
||||||
store.commit("getOrgtreeList", JSON.parse(orgtreeList));
|
store.commit("getOrgtreeList", JSON.parse(orgtreeList));
|
||||||
return;
|
return;
|
||||||
@@ -98,18 +101,19 @@ export default defineComponent({
|
|||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
};
|
};
|
||||||
api.getOrgInfo(obj)
|
api
|
||||||
.then((res) => {
|
.getOrgInfo(obj)
|
||||||
console.log("组织树获取成功", res);
|
.then((res) => {
|
||||||
if (res.data.code === 200) {
|
console.log("组织树获取成功", res);
|
||||||
// state.treeData = res.data.data;
|
if (res.data.code === 200) {
|
||||||
localStorage.setItem("orgtreeList", JSON.stringify(res.data.data));
|
// state.treeData = res.data.data;
|
||||||
store.commit("getOrgtreeList", res.data.data);
|
localStorage.setItem("orgtreeList", JSON.stringify(res.data.data));
|
||||||
}
|
store.commit("getOrgtreeList", res.data.data);
|
||||||
})
|
}
|
||||||
.catch((err) => {
|
})
|
||||||
console.log("组织树获取失败", err);
|
.catch((err) => {
|
||||||
});
|
console.log("组织树获取失败", err);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
init();
|
init();
|
||||||
@@ -128,7 +132,7 @@ export default defineComponent({
|
|||||||
// font-family: MicrosoftYaHei, Microsoft YaHei, Avenir, Helvetica, Arial,
|
// font-family: MicrosoftYaHei, Microsoft YaHei, Avenir, Helvetica, Arial,
|
||||||
// sans-serif;
|
// sans-serif;
|
||||||
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
|
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
|
||||||
Microsoft YaHei, Arial, sans-serif;
|
Microsoft YaHei, Arial, sans-serif;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
color: #2c3e50;
|
color: #2c3e50;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: lixg lixg@dongwu-inc.com
|
* @Author: lixg lixg@dongwu-inc.com
|
||||||
* @Date: 2022-11-09 09:26:26
|
* @Date: 2022-11-09 09:26:26
|
||||||
* @LastEditors: lixg lixg@dongwu-inc.com
|
* @LastEditors: lixg lixg@dongwu-inc.com
|
||||||
* @LastEditTime: 2022-11-26 20:20:03
|
* @LastEditTime: 2022-12-02 14:09:43
|
||||||
* @FilePath: /fe-manage/src/store/index.js
|
* @FilePath: /fe-manage/src/store/index.js
|
||||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||||
*/
|
*/
|
||||||
@@ -29,6 +29,7 @@ export default createStore({
|
|||||||
faceclassScene: [],
|
faceclassScene: [],
|
||||||
projectLevel: [],//项目级别
|
projectLevel: [],//项目级别
|
||||||
projectSys: [],//培训分类
|
projectSys: [],//培训分类
|
||||||
|
pathmapPic: [],//学习路径背景图
|
||||||
},
|
},
|
||||||
getters: {},
|
getters: {},
|
||||||
mutations: {
|
mutations: {
|
||||||
@@ -50,7 +51,7 @@ export default createStore({
|
|||||||
getOrgtreeList(state, data) {
|
getOrgtreeList(state, data) {
|
||||||
state.orgtreeList = data
|
state.orgtreeList = data
|
||||||
},
|
},
|
||||||
SET_DICT(state,{key,data}){
|
SET_DICT(state, { key, data }) {
|
||||||
state[key] = data
|
state[key] = data
|
||||||
},
|
},
|
||||||
SET_projectTemplateId(state, projectTemplateId) {
|
SET_projectTemplateId(state, projectTemplateId) {
|
||||||
|
|||||||
@@ -867,7 +867,7 @@ export default {
|
|||||||
state.editPathId = null;
|
state.editPathId = null;
|
||||||
};
|
};
|
||||||
const chooseImg = (item) => {
|
const chooseImg = (item) => {
|
||||||
// console.log(item);
|
console.log(item);
|
||||||
state.pathBgId = item.dictCode;
|
state.pathBgId = item.dictCode;
|
||||||
state.pathBg = item.dictValue;
|
state.pathBg = item.dictValue;
|
||||||
};
|
};
|
||||||
@@ -1148,7 +1148,7 @@ export default {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
// console.log("text.record", text.record);
|
// console.log("text.record", text.record);
|
||||||
|
|
||||||
getLearnPathInfo(text.record);
|
getLearnPathInfo(text.record.id);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
@@ -1409,8 +1409,8 @@ export default {
|
|||||||
};
|
};
|
||||||
const selectorganization = (e, v) => {
|
const selectorganization = (e, v) => {
|
||||||
console.log("eee", e, v);
|
console.log("eee", e, v);
|
||||||
state.organizationSelectName = e;
|
state.organizationSelectName = v[0];
|
||||||
state.organizationSelectId = v.id;
|
state.organizationSelectId = e;
|
||||||
};
|
};
|
||||||
//创建学习路径图
|
//创建学习路径图
|
||||||
const createLearnPath = () => {
|
const createLearnPath = () => {
|
||||||
@@ -1429,37 +1429,42 @@ export default {
|
|||||||
state.lpLoading = true;
|
state.lpLoading = true;
|
||||||
let obj = {
|
let obj = {
|
||||||
name: state.pathName,
|
name: state.pathName,
|
||||||
picUrl: "",
|
|
||||||
remark: state.pathIntro,
|
remark: state.pathIntro,
|
||||||
status: 0,
|
status: 0,
|
||||||
|
organizationId: state.organizationSelectId,
|
||||||
|
organizationName: state.organizationSelectName,
|
||||||
|
picUrl: state.pathBg,
|
||||||
};
|
};
|
||||||
api
|
api
|
||||||
.createLearnPath(obj)
|
.createLearnPath(obj)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let chapterObj = {
|
console.log("创建学习路径成功", res);
|
||||||
name: "关卡一",
|
if (res.data.code === 200) {
|
||||||
remark: "",
|
let chapterObj = {
|
||||||
routerId: res.data.data.routerId,
|
name: "关卡一",
|
||||||
};
|
remark: "",
|
||||||
//创建关卡
|
routerId: res.data.data.routerId,
|
||||||
api
|
};
|
||||||
.editChapter(chapterObj)
|
//创建关卡
|
||||||
.then((chapterRes) => {
|
api
|
||||||
console.log("关卡创建成功", chapterRes);
|
.editChapter(chapterObj)
|
||||||
setTimeout(() => {
|
.then((chapterRes) => {
|
||||||
console.log("创建成功", res);
|
console.log("关卡创建成功", chapterRes);
|
||||||
message.destroy();
|
setTimeout(() => {
|
||||||
message.success("创建成功");
|
console.log("创建成功", res);
|
||||||
state.lpLoading = false;
|
message.destroy();
|
||||||
state.currentPage = 1;
|
message.success("创建成功");
|
||||||
router.push("/leveladd");
|
state.lpLoading = false;
|
||||||
storage.set("routerId", res.data.data.routerId);
|
state.currentPage = 1;
|
||||||
// getLearnPath();
|
router.push("/leveladd");
|
||||||
}, commonData.timeout);
|
storage.set("routerId", res.data.data.routerId);
|
||||||
})
|
// getLearnPath();
|
||||||
.catch((chapterErr) => {
|
}, commonData.timeout);
|
||||||
console.log("关卡创建失败", chapterErr);
|
})
|
||||||
});
|
.catch((chapterErr) => {
|
||||||
|
console.log("关卡创建失败", chapterErr);
|
||||||
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log("创建失败", err);
|
console.log("创建失败", err);
|
||||||
@@ -1525,23 +1530,36 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//获取路径图详细信息
|
//获取路径图详细信息
|
||||||
const getLearnPathInfo = (item) => {
|
const getLearnPathInfo = (id) => {
|
||||||
console.log("item", item);
|
// console.log("编辑学习路径图id", id);
|
||||||
|
//获取学习路径详情
|
||||||
|
api
|
||||||
|
.getRouterDetail(id)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.data.code === 200) {
|
||||||
|
let detail = res.data.data.routerInfo;
|
||||||
|
// console.log("获取详情成功", detail);
|
||||||
|
state.pathName = detail.name;
|
||||||
|
state.pathBg = detail.picUrl;
|
||||||
|
state.pathBgId = "";
|
||||||
|
state.organizationSelectName = detail.organizationName;
|
||||||
|
state.organizationSelectId = detail.organizationId;
|
||||||
|
state.pathIntro = detail.remark;
|
||||||
|
state.editPathId = id;
|
||||||
|
// console.log("state.imgData", state.imgData);
|
||||||
|
let arr = state.imgData;
|
||||||
|
for (let i = 0; i < arr.length; i++) {
|
||||||
|
// console.log("arr[i].dictValue", arr[i].dictValue, state.pathBg);
|
||||||
|
if (arr[i].dictValue === state.pathBg) {
|
||||||
|
state.pathBgId = arr[i].dictCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log("获取详情失败", err);
|
||||||
|
});
|
||||||
state.out1 = true;
|
state.out1 = true;
|
||||||
state.pathName = item.manager;
|
|
||||||
state.pathBg = "";
|
|
||||||
state.pathBgId = "";
|
|
||||||
state.organizationSelectName = null;
|
|
||||||
state.organizationSelectId = null;
|
|
||||||
state.pathIntro = item.remark;
|
|
||||||
state.editPathId = item.id;
|
|
||||||
console.log("state.imgData", state.imgData);
|
|
||||||
let arr = state.imgData;
|
|
||||||
for (let i = 0; i < arr.length; i++) {
|
|
||||||
if (arr[i].dictCode === state.pathBgId) {
|
|
||||||
state.pathBgId = arr[i].dictValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
//编辑学习路径图
|
//编辑学习路径图
|
||||||
const editLearnPath = () => {
|
const editLearnPath = () => {
|
||||||
@@ -1557,12 +1575,21 @@ export default {
|
|||||||
message.destroy();
|
message.destroy();
|
||||||
return message.warning("请选择背景图");
|
return message.warning("请选择背景图");
|
||||||
}
|
}
|
||||||
|
// state.pathName = detail.name;
|
||||||
|
// state.pathBg = detail.picUrl;
|
||||||
|
// state.pathBgId = "";
|
||||||
|
// state.organizationSelectName = detail.organizationName;
|
||||||
|
// state.organizationSelectId = detail.organizationId;
|
||||||
|
// state.pathIntro = detail.remark;
|
||||||
|
// state.editPathId = id;
|
||||||
// state.createLoading = true;
|
// state.createLoading = true;
|
||||||
let obj = {
|
let obj = {
|
||||||
routerId: state.editPathId,
|
routerId: state.editPathId,
|
||||||
name: state.pathName,
|
name: state.pathName,
|
||||||
picUrl: "",
|
picUrl: state.pathBg,
|
||||||
remark: state.pathIntro,
|
remark: state.pathIntro,
|
||||||
|
organizationName: state.organizationSelectName,
|
||||||
|
organizationId: state.organizationSelectId,
|
||||||
status: 0,
|
status: 0,
|
||||||
};
|
};
|
||||||
api
|
api
|
||||||
@@ -1642,30 +1669,30 @@ export default {
|
|||||||
// }
|
// }
|
||||||
// choiceEvaluation()
|
// choiceEvaluation()
|
||||||
|
|
||||||
//字典获取路径图背景
|
// //字典获取路径图背景
|
||||||
const getDictList = (param) => {
|
// const getDictList = (param) => {
|
||||||
let obj = {
|
// let obj = {
|
||||||
pageNo: 1,
|
// pageNo: 1,
|
||||||
pageSize: 20,
|
// pageSize: 20,
|
||||||
setCode: param,
|
// setCode: param,
|
||||||
};
|
// };
|
||||||
api
|
// api
|
||||||
.getDict(obj)
|
// .getDict(obj)
|
||||||
.then((res) => {
|
// .then((res) => {
|
||||||
console.log("获取字典成功", res);
|
// console.log("获取字典成功", res);
|
||||||
if (res.status === 200) {
|
// if (res.status === 200) {
|
||||||
if (param === "pathmapPic") {
|
// if (param === "pathmapPic") {
|
||||||
if (res.data.data.rows.length > 0) {
|
// if (res.data.data.rows.length > 0) {
|
||||||
state.imgData = [res.data.data.rows[0]];
|
// state.imgData = [res.data.data.rows[0]];
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
.catch((err) => {
|
// .catch((err) => {
|
||||||
console.log("获取字典失败", err);
|
// console.log("获取字典失败", err);
|
||||||
});
|
// });
|
||||||
};
|
// };
|
||||||
getDictList("pathmapPic");
|
// getDictList("pathmapPic");
|
||||||
//显示更多路径背景弹窗
|
//显示更多路径背景弹窗
|
||||||
const showLearnBgMore = () => {
|
const showLearnBgMore = () => {
|
||||||
state.learnBgMore = true;
|
state.learnBgMore = true;
|
||||||
@@ -1677,6 +1704,10 @@ export default {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// console.log("执行");
|
// console.log("执行");
|
||||||
getLearnPath();
|
getLearnPath();
|
||||||
|
if (store.state.pathmapPic.length > 0) {
|
||||||
|
console.log("store.state.pathmapPic", store.state.pathmapPic);
|
||||||
|
state.imgData = [store.state.pathmapPic[0]];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
//添加权限
|
//添加权限
|
||||||
watch(
|
watch(
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div class="addhead">
|
<div class="addhead">
|
||||||
<div class="leftimg">
|
<div class="leftimg">
|
||||||
<!-- <img class="img" :src="picUrl" /> -->
|
<!-- <img class="img" :src="picUrl" /> -->
|
||||||
<img class="img" src="../../assets/images/leveladd/1.png" />
|
<img class="img" :src="picUrl" />
|
||||||
</div>
|
</div>
|
||||||
<div class="imgfor">
|
<div class="imgfor">
|
||||||
<div class="forz">{{ styTitle }}</div>
|
<div class="forz">{{ styTitle }}</div>
|
||||||
@@ -1855,6 +1855,7 @@ export default {
|
|||||||
};
|
};
|
||||||
const reget = () => {
|
const reget = () => {
|
||||||
GetRouterDetail(state.routerId).then((res) => {
|
GetRouterDetail(state.routerId).then((res) => {
|
||||||
|
// console.log("获取路径图详情", res);
|
||||||
state.styTitle = res.data.data.routerInfo.name;
|
state.styTitle = res.data.data.routerInfo.name;
|
||||||
state.cretime = toDate(
|
state.cretime = toDate(
|
||||||
res.data.data.routerInfo.createTime / 1000,
|
res.data.data.routerInfo.createTime / 1000,
|
||||||
|
|||||||
@@ -174,7 +174,7 @@
|
|||||||
<div class="filt">
|
<div class="filt">
|
||||||
<div class="le">
|
<div class="le">
|
||||||
<div class="leftimg">
|
<div class="leftimg">
|
||||||
<img class="img" src="../../assets/images/leveladd/1.png" />
|
<img class="img" :src="picUrl" />
|
||||||
</div>
|
</div>
|
||||||
<div class="imgfor">
|
<div class="imgfor">
|
||||||
<div class="forz">{{ styTitle }}</div>
|
<div class="forz">{{ styTitle }}</div>
|
||||||
@@ -964,7 +964,7 @@
|
|||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="inhe">
|
<div class="inhe">
|
||||||
<div class="mod"></div>
|
<div class="mod"></div>
|
||||||
<div class="tz">选择任务移动到阶段</div>
|
<div class="tz">选择任务移动到关卡</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mid">
|
<div class="mid">
|
||||||
@@ -1201,6 +1201,8 @@ export default {
|
|||||||
|
|
||||||
unlockModeVisible: false, //切换模式抽屉
|
unlockModeVisible: false, //切换模式抽屉
|
||||||
chooseProjectList: null, //选择的阶段下的任务列表
|
chooseProjectList: null, //选择的阶段下的任务列表
|
||||||
|
|
||||||
|
curLevel: null, //选择移动到的关卡名称
|
||||||
});
|
});
|
||||||
|
|
||||||
const showModal = (element) => {
|
const showModal = (element) => {
|
||||||
@@ -1755,6 +1757,7 @@ export default {
|
|||||||
console.log("移动失败", err);
|
console.log("移动失败", err);
|
||||||
});
|
});
|
||||||
state.visiblene = false;
|
state.visiblene = false;
|
||||||
|
state.curLevel = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//编辑的按钮
|
//编辑的按钮
|
||||||
@@ -1825,10 +1828,12 @@ export default {
|
|||||||
};
|
};
|
||||||
const closeChangeModal = () => {
|
const closeChangeModal = () => {
|
||||||
state.visiblene = false;
|
state.visiblene = false;
|
||||||
|
state.curLevel = null;
|
||||||
};
|
};
|
||||||
const handleChangeStage = (value, option) => {
|
const handleChangeStage = (value, option) => {
|
||||||
console.log("阶段改变", value, option);
|
console.log("阶段改变", value, option);
|
||||||
state.removeStageId = option.chapterId;
|
state.removeStageId = option.chapterId;
|
||||||
|
state.curLevel = option.name;
|
||||||
};
|
};
|
||||||
|
|
||||||
//显示切换模式抽屉
|
//显示切换模式抽屉
|
||||||
|
|||||||
Reference in New Issue
Block a user