This commit is contained in:
yuping
2022-12-01 18:50:41 +08:00
parent 07be52e211
commit 13e9312069
4 changed files with 459 additions and 429 deletions

View File

@@ -28,6 +28,8 @@ import OpenPages from "@/components/OpenPages";
import BreadCrumb from "@/components/BreadCrumb";
import zhCN from "ant-design-vue/es/locale/zh_CN";
import * as api from "./api/index1";
import * as api1 from "@/api/index1";
export default defineComponent({
components: {
NavLeft,
@@ -55,20 +57,53 @@ export default defineComponent({
const currentRouteName = computed(() => route.name);
function init() {
console.log(store)
initDict('faceclassPic')
initDict('faceclassClass')
initDict('faceclassScene')
initDict('projectLevel')
initDict('projectSys')
getOrgTree()
}
async function initDict(key) {
let list = localStorage.getItem(key)
if (list) {
store.commit('SET_DICT', {key, data:JSON.parse(list)});
return;
}
list = await getDictList(key)
localStorage.setItem(key, JSON.stringify(list));
store.commit('SET_DICT', {key, data:list});
}
const getDictList = (param) => api1.getDict({
pageNo: 1,
pageSize: 20,
setCode: param
}).then((res) => res.data.data.rows)
//获取组织树
const getOrgTree = () => {
const orgtreeList = localStorage.getItem("orgtreeList")
if (orgtreeList) {
store.commit("getOrgtreeList", JSON.parse(orgtreeList));
return;
}
let obj = {
keyWord: "",
id: -1,
pageNo: 1,
pageSize: 20,
};
api
.getOrgInfo(obj)
api.getOrgInfo(obj)
.then((res) => {
console.log("组织树获取成功", res);
if (res.data.code === 200) {
// state.treeData = res.data.data;
localStorage.setItem("orgtreeList", JSON.stringify(res.data.data));
store.commit("getOrgtreeList", res.data.data);
}
})
@@ -77,7 +112,7 @@ export default defineComponent({
});
};
getOrgTree();
init();
return {
isLogin,
@@ -125,6 +160,7 @@ export default defineComponent({
background: #ffffff;
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.07);
}
// @media screen and (max-width: 1366px) {
// .cmMain {
// width: 750px;

View File

@@ -181,6 +181,8 @@ export default {
noticeFlag: null, //未改
templateId: null, //未改
attach: null,
calssifyList:[],
faceclassScene:[]
});
const closeDrawer = () => {
@@ -291,7 +293,8 @@ export default {
setCode: param
}).then((res) => res.data.data.rows)
onMounted(async () => {
state.calssifyList = (await getDictList("faceclassClass")).map(e => ({ label: e.dictName, value: e.dictCode }))
state.calssifyList = (await getDictList("faceclassClass")).map(e => ({ label: e.dictName, value: e.dictCode })) //内容
state.faceclassScene = (await getDictList("faceclassScene")).map(e => ({ label: e.dictName, value: e.dictCode })) //场景
});
return {
...toRefs(state),

View File

@@ -24,6 +24,11 @@ export default createStore({
routerId: null,
projectTemplateId: null,
orgtreeList: [],
faceclassPic: null,
faceclassClass: [],
faceclassScene: [],
projectLevel: [],//项目级别
projectSys: [],//培训分类
},
getters: {},
mutations: {
@@ -45,6 +50,9 @@ export default createStore({
getOrgtreeList(state, data) {
state.orgtreeList = data
},
SET_DICT(state,{key,data}){
state[key] = data
},
SET_projectTemplateId(state, projectTemplateId) {
state.projectTemplateId = projectTemplateId;
}

View File

@@ -189,12 +189,12 @@
return triggerNode.parentNode || document.body;
}
"
v-model:value="classifySelect2"
v-model:value="projectInfo.sourceBelongId"
style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
placeholder="自动带出 可修改"
allow-clear
:tree-data="classifyList2"
:tree-data="orgtreeList"
:fieldNames="{
children: 'treeChildList',
label: 'name',
@@ -274,16 +274,11 @@
return triggerNode.parentNode || document.body;
}
"
v-model:value="classifySelect3"
v-model:value="projectInfo.level"
:options="classifyList3"
style="width: 100%"
@change="classificationChange3"
placeholder="请选择项目级别"
:disabled="viewDetail ? true : false"
:fieldNames="{
label: 'dictName',
value: 'dictCode',
}"
/>
</div>
</div>
@@ -302,16 +297,11 @@
return triggerNode.parentNode || document.body;
}
"
v-model:value="classifySelect4"
:options="classifyList4"
v-model:value="projectInfo.systemId"
:options="systemOption"
style="width: 100%"
@change="classificationChange4"
placeholder="请选择培训分类"
:disabled="viewDetail ? true : false"
:fieldNames="{
label: 'dictName',
value: 'dictCode',
}"
/>
</div>
</div>
@@ -403,7 +393,8 @@
<div class="footer">
<div class="btn">
<a-button v-on:click="createProject" type="primary" class="btn1"
>确定</a-button
>确定
</a-button
>
<a-button @click="backPage" class="btn2">取消</a-button>
</div>
@@ -411,7 +402,7 @@
</div>
</template>
<script>
import { reactive, toRefs, ref, onUnmounted, computed } from "vue";
import {reactive, toRefs, ref, onUnmounted, onMounted} from "vue";
import {message} from "ant-design-vue";
import {useRouter, useRoute} from "vue-router";
import dayjs from "dayjs";
@@ -420,6 +411,7 @@ import * as api1 from "../../api/index1";
import {storage} from "../../api/storage";
import {toDate, scrollLoad} from "../../api/method";
import {useStore} from "vuex";
export default {
name: "projectAdd",
setup() {
@@ -445,17 +437,24 @@ export default {
viewDetail: routers.query.viewDetail ? routers.query.viewDetail : null,
currentPage1: 1, //项目经理
pageSize1: 10, //项目经理
pageSize1: 10, //项目经理,
orgtreeList: [],
projectInfo: {},
classifyList3: [],
systemOption: []
});
onMounted(() => {
console.log('onMounted')
state.orgtreeList = [...store.state.orgtreeList]
state.classifyList3 = store.state.projectLevel.map(e => ({value: parseInt(e.dictCode), label: e.dictName}))
state.systemOption = store.state.projectSys.map(e => ({value: parseInt(e.dictCode), label: e.dictName}))
})
//分类列表
const classifyList = ref([]);
//项目封面
const imageUrl = ref("");
// 项目级别
const classifyList3 = ref([
// { value: 1, label: "集团级" },
]);
// 培训分类
const classifyList4 = ref([
@@ -482,16 +481,13 @@ export default {
picUrl = res.data.data.rows[0].dictValue;
}
}
if (param === "projectLevel") {
classifyList3.value = res.data.data.rows;
}
if (param === "projectSys") {
classifyList4.value = res.data.data.rows;
}
if (
classifyList.value &&
imageUrl.value &&
classifyList3.value &&
classifyList4.value
) {
getDictInfo();
@@ -504,7 +500,6 @@ export default {
};
getDictList("projectClass");
getDictList("projectPic");
getDictList("projectLevel");
getDictList("projectSys");
//获取分类、封面图、项目级别、培训分类---------------字典配置---------------------------
//分类、封面图、项目级别、培训分类回显
@@ -530,7 +525,6 @@ export default {
const isEdit = ref(false);
let peojectID = ""; //项目id
console.log("store.state.orgtreeList", store.state.orgtreeList);
const editProject = () => {
if (routers.query.projectId) {
storage.set("projectAddId", routers.query.projectId);
@@ -542,6 +536,7 @@ export default {
.then((res) => {
if (res.status == 200 && res.data.code == 200) {
let info = res.data.data.projectInfo;
state.projectInfo = info;
console.log(
"classifyList.value.find(item=>item.dictCode===info.category)",
classifyList.value.find((item) => {
@@ -581,21 +576,17 @@ export default {
}
console.log(optionsManage);
state.classifySelect1 = optionsManage;
state.classifySelect2 =
classifyList2.value[info.sourceBelongId - 1];
state.classifySelect2 = info.sourceBelongId
remark.value = info.remark;
state.checked = info.boeFlag ? info.boeFlag : false;
state.classifySelect3 = classifyList3.value[info.level];
state.classifySelect4 = classifyList4.value[info.systemId - 1];
state.checked1 = info.boeFlag ? info.boeFlag : false;
// fileList1.value = info.attach.split(",");
state.orgtreeList.unshift({id: info.sourceBelongId, name: info.sourceBelongName})
picUrl = info.picUrl;
beginTime = Number(info.beginTime / 1000);
endTime = Number(info.endTime / 1000);
manager = info.manager;
managerId = info.managerId;
sourceBelongIdC = Number(info.sourceBelongId);
courseSyncFlag = info.courseSyncFlag;
levels = info.level;
systemid = info.systemId;
@@ -615,6 +606,7 @@ export default {
.then((res) => {
if (res.status == 200 && res.data.code == 200) {
let info = res.data.data.projectInfo;
state.projectInfo = info;
console.log("我是从本地存储获取的id", info);
projectName.value = info.name;
state.classifySelect = classifyList.value[1]; // info.category 分类选择的信息
@@ -640,11 +632,10 @@ export default {
}
console.log(optionsManage);
state.classifySelect1 = optionsManage;
state.classifySelect2 =
classifyList2.value[info.sourceBelongId - 1];
state.classifySelect2 = info.sourceBelongId
state.orgtreeList.unshift({id: info.sourceBelongId, name: info.sourceBelongName})
remark.value = info.remark;
state.checked = info.boeFlag ? info.boeFlag : false;
state.classifySelect3 = classifyList3.value[info.level];
state.classifySelect4 = classifyList4.value[info.systemId - 1];
state.checked1 = info.boeFlag ? info.boeFlag : false;
@@ -653,7 +644,6 @@ export default {
endTime = Number(info.endTime / 1000);
manager = info.manager;
managerId = info.managerId;
sourceBelongIdC = Number(info.sourceBelongId);
courseSyncFlag = info.courseSyncFlag;
levels = info.level;
systemid = info.systemId;
@@ -870,21 +860,13 @@ export default {
managerId = midstr;
};
// 资源归属 sourceBelongId 后续给接口
const classifyList2 = computed(() => {
return store.state.orgtreeList ? store.state.orgtreeList : ref([]);
});
let sourceBelongIdC = "";
const classificationChange2 = (key) => {
console.log(`selected ${key}`, classifyList2);
sourceBelongIdC = key;
const classificationChange2 = (key, obj) => {
state.projectInfo.sourceBelongName = obj[0]
};
//选择项目级别
let levels = "";
const classificationChange3 = (key) => {
console.log(`selected ${key}`, classifyList3);
levels = key;
};
@@ -941,11 +923,10 @@ export default {
}
console.log(optionsManage);
state.classifySelect1 = optionsManage;
state.classifySelect2 =
classifyList2.value[info.sourceBelongId - 1];
state.classifySelect2 = info.sourceBelongId
state.orgtreeList.unshift({id: info.sourceBelongId, name: info.sourceBelongName})
remark.value = info.remark;
state.checked = info.boeFlag ? info.boeFlag : false;
state.classifySelect3 = classifyList3.value[info.level];
state.classifySelect4 = classifyList4.value[info.systemId - 1];
state.checked1 = info.boeFlag ? info.boeFlag : false;
// fileList1.value = info.attach.split(",");
@@ -955,7 +936,6 @@ export default {
endTime = Number(info.endTime / 1000);
manager = info.manager;
managerId = info.managerId;
sourceBelongIdC = Number(info.sourceBelongId);
courseSyncFlag = info.courseSyncFlag;
levels = info.level;
systemid = info.systemId;
@@ -1077,11 +1057,12 @@ export default {
endTime: endTime,
manager: manager,
managerId: managerId,
sourceBelongId: sourceBelongIdC,
sourceBelongId: state.projectInfo.sourceBelongId,
sourceBelongName: state.projectInfo.sourceBelongName,
remark: remark["value"],
courseSyncFlag: courseSyncFlag,
level: levels,
systemId: systemid,
level: state.projectInfo.level,
systemId: state.projectInfo.systemId,
boeFlag: boeFlag,
attach: attach,
type: 3,
@@ -1134,7 +1115,8 @@ export default {
endTime: endTime,
manager: manager,
managerId: managerId,
sourceBelongId: sourceBelongIdC,
sourceBelongId: state.projectInfo.sourceBelongId,
sourceBelongName: state.projectInfo.sourceBelongName,
remark: remark["value"],
courseSyncFlag: courseSyncFlag,
level: levels,
@@ -1207,8 +1189,6 @@ export default {
beforeUpload1,
onRangeChange,
classifyList1,
classifyList2,
classifyList3,
classifyList4,
classifyList5,
remark,
@@ -1522,16 +1502,19 @@ export default {
}
}
}
.treeDropdown {
// width: 240px !important;
// border-radius: 5px;
// min-height: 600px !important;
.ant-select-tree-list-scrollbar {
width: 5px !important;
.ant-select-tree-list-scrollbar-thumb {
background-color: #4ea6ff !important;
}
}
.ant-select-tree-indent-unit {
width: 7px !important;
}