--fix 项目草稿

This commit is contained in:
yuping
2023-02-16 19:26:29 +08:00
parent 40dc5f939e
commit e21c4a03ab
3 changed files with 166 additions and 215 deletions

View File

@@ -52,7 +52,6 @@ function beforeunloadHandler() {
function init() {
getUserInfo();
getMemberInfo();
getUserPermission();
initDict("content_type"); //内容分类
initDict("project_level"); //项目级别
@@ -70,19 +69,6 @@ function unloadHandler() {
}
}
async function getMemberInfo() {
const list = localStorage.getItem("memberInitInfo");
if (list) {
store.commit("SET_MEMBER_INFO", JSON.parse(list));
return;
}
const memberInitInfo = await api1
.getMemberInfo({keyWord: "", pageNo: 1, pageSize: 10})
.then((res) => res.data.data.rows);
store.commit("SET_MEMBER_INFO", memberInitInfo);
localStorage.setItem("memberInitInfo", JSON.stringify(memberInitInfo));
}
async function getUserInfo() {
const userInfo = await api2.userInfo();
store.commit("SET_USER", userInfo.data.data);

View File

@@ -1,172 +1,172 @@
<template>
<a-select
:getPopupContainer="
(triggerNode) => {
return triggerNode.parentNode || document.body;
}
"
v-model:value="managerArray"
:placeholder="placeholder"
:filterOption="false"
style="width: 100%"
:options="options"
allowClear
showSearch
:mode="mode"
:disabled="disabled"
@popupScroll="memberScroll"
@search="searchMember"
@change="change"
>
<template v-if="loading" #notFoundContent>
<a-spin size="small" />
</template>
</a-select>
</template>
<script>
import { onMounted, reactive, toRefs, watch } from "vue";
import { scrollLoad, throttle } from "@/api/method";
import * as api1 from "@/api/index1";
<!--<template>-->
<!-- <a-select-->
<!-- :getPopupContainer="-->
<!-- (triggerNode) => {-->
<!-- return triggerNode.parentNode || document.body;-->
<!-- }-->
<!-- "-->
<!-- v-model:value="managerArray"-->
<!-- :placeholder="placeholder"-->
<!-- :filterOption="false"-->
<!-- style="width: 100%"-->
<!-- :options="options"-->
<!-- allowClear-->
<!-- showSearch-->
<!-- :mode="mode"-->
<!-- :disabled="disabled"-->
<!-- @popupScroll="memberScroll"-->
<!-- @search="searchMember"-->
<!-- @change="change"-->
<!-- >-->
<!-- <template v-if="loading" #notFoundContent>-->
<!-- <a-spin size="small" />-->
<!-- </template>-->
<!-- </a-select>-->
<!--</template>-->
<!--<script>-->
<!--import { onMounted, reactive, toRefs, watch } from "vue";-->
<!--import { scrollLoad, throttle } from "@/api/method";-->
<!--import * as api1 from "@/api/index1";-->
export default {
name: "ProjectClass",
<!--export default {-->
<!-- name: "ProjectClass",-->
props: {
value: {
type: String,
default: "",
},
name: {
type: String,
default: "",
},
disabled: {
type: Boolean,
default: false,
},
placeholder: {
type: String,
default: "请选择",
},
// 'multiple' | 'tags'
mode: {
type: String,
default: "select",
},
},
setup(props, ctx) {
const state = reactive({
options: [],
managerArray: [],
memberParam: { keyWord: "", pageNo: 1, pageSize: 10 },
loading: false,
init: false,
});
<!-- props: {-->
<!-- value: {-->
<!-- type: String,-->
<!-- default: "",-->
<!-- },-->
<!-- name: {-->
<!-- type: String,-->
<!-- default: "",-->
<!-- },-->
<!-- disabled: {-->
<!-- type: Boolean,-->
<!-- default: false,-->
<!-- },-->
<!-- placeholder: {-->
<!-- type: String,-->
<!-- default: "请选择",-->
<!-- },-->
<!-- // 'multiple' | 'tags'-->
<!-- mode: {-->
<!-- type: String,-->
<!-- default: "select",-->
<!-- },-->
<!-- },-->
<!-- setup(props, ctx) {-->
<!-- const state = reactive({-->
<!-- options: [],-->
<!-- managerArray: [],-->
<!-- memberParam: { keyWord: "", pageNo: 1, pageSize: 10 },-->
<!-- loading: false,-->
<!-- init: false,-->
<!-- });-->
watch(() => state.memberParam.keyWord, throttle(getMember, 500));
watch(() => state.memberParam.pageNo, throttle(getPushMember, 500));
watch(props, init);
<!-- watch(() => state.memberParam.keyWord, throttle(getMember, 500));-->
<!-- watch(() => state.memberParam.pageNo, throttle(getPushMember, 500));-->
<!-- watch(props, init);-->
onMounted(() => {
console.log("onMounted");
init();
});
<!-- onMounted(() => {-->
<!-- console.log("onMounted");-->
<!-- init();-->
<!-- });-->
function getMember() {
state.loading = true;
state.options = [];
getMemberData();
}
<!-- function getMember() {-->
<!-- state.loading = true;-->
<!-- state.options = [];-->
<!-- getMemberData();-->
<!-- }-->
function getPushMember() {
state.loading = true;
getMemberData();
}
<!-- function getPushMember() {-->
<!-- state.loading = true;-->
<!-- getMemberData();-->
<!-- }-->
function getMemberData() {
console.log("getMemberData");
api1.getMemberInfo(state.memberParam).then((res) => {
const list = res.data.data.rows
.filter((e) => !(props.value + "")?.includes(e.id + ""))
.map((e) => ({
label: e.realName,
value: e.id,
}));
if (state.memberParam.pageNo === 1 && props.value) {
const arrManagerId = (props.value + "").split(",");
const arrManager = props.name.split(",");
state.options = [
...arrManager.map((e, i) => ({ label: e, value: arrManagerId[i] })),
...list,
];
} else state.options.push(...list);
state.loading = false;
});
}
<!-- function getMemberData() {-->
<!-- console.log("getMemberData");-->
<!-- api1.getMemberInfo(state.memberParam).then((res) => {-->
<!-- const list = res.data.data.rows-->
<!-- .filter((e) => !(props.value + "")?.includes(e.id + ""))-->
<!-- .map((e) => ({-->
<!-- label: e.realName,-->
<!-- value: e.id,-->
<!-- }));-->
<!-- if (state.memberParam.pageNo === 1 && props.value) {-->
<!-- const arrManagerId = (props.value + "").split(",");-->
<!-- const arrManager = props.name.split(",");-->
<!-- state.options = [-->
<!-- ...arrManager.map((e, i) => ({ label: e, value: arrManagerId[i] })),-->
<!-- ...list,-->
<!-- ];-->
<!-- } else state.options.push(...list);-->
<!-- state.loading = false;-->
<!-- });-->
<!-- }-->
const memberScroll = (e) => {
let num = scrollLoad(e);
if (num === 2) {
// 如果滑到底部,则加载下一页
state.memberParam.pageNo++;
}
};
<!-- const memberScroll = (e) => {-->
<!-- let num = scrollLoad(e);-->
<!-- if (num === 2) {-->
<!-- // 如果滑到底部,则加载下一页-->
<!-- state.memberParam.pageNo++;-->
<!-- }-->
<!-- };-->
//搜索学员
const searchMember = (keyWord) => {
keyWord && (state.memberParam = { keyWord, pageNo: 1, pageSize: 10 });
};
<!-- //搜索学员-->
<!-- const searchMember = (keyWord) => {-->
<!-- keyWord && (state.memberParam = { keyWord, pageNo: 1, pageSize: 10 });-->
<!-- };-->
function init() {
console.log("init--", props);
console.log(Array.isArray(state.managerArray));
if (
props.value + "" !==
(Array.isArray(state.managerArray)
? state.managerArray.join(",")
: state.managerArray + "")
) {
if (props.value) {
const arrManager = props.name.split(",");
const arrManagerId = (props.value + "").split(",");
state.managerArray =
props.mode === "select" ? props.value : arrManagerId;
state.options = arrManager.map((e, i) => ({
label: e,
value: arrManagerId[i],
}));
} else {
state.managerArray = [];
}
// getMemberData();
return;
}
if (!props.value) {
if (!(state.options && state.options.length)) {
state.options = [];
// getMember();
}
return;
}
}
<!-- function init() {-->
<!-- console.log("init&#45;&#45;", props);-->
<!-- console.log(Array.isArray(state.managerArray));-->
<!-- if (-->
<!-- props.value + "" !==-->
<!-- (Array.isArray(state.managerArray)-->
<!-- ? state.managerArray.join(",")-->
<!-- : state.managerArray + "")-->
<!-- ) {-->
<!-- if (props.value) {-->
<!-- const arrManager = props.name.split(",");-->
<!-- const arrManagerId = (props.value + "").split(",");-->
<!-- state.managerArray =-->
<!-- props.mode === "select" ? props.value : arrManagerId;-->
<!-- state.options = arrManager.map((e, i) => ({-->
<!-- label: e,-->
<!-- value: arrManagerId[i],-->
<!-- }));-->
<!-- } else {-->
<!-- state.managerArray = [];-->
<!-- }-->
<!-- // getMemberData();-->
<!-- return;-->
<!-- }-->
<!-- if (!props.value) {-->
<!-- if (!(state.options && state.options.length)) {-->
<!-- state.options = [];-->
<!-- // getMember();-->
<!-- }-->
<!-- return;-->
<!-- }-->
<!-- }-->
function change(e, l) {
console.log("change", l);
if (Array.isArray(l)) {
ctx.emit("update:value", l.map((t) => t.value).join(","));
ctx.emit("update:name", l.map((t) => t.label).join(","));
} else {
ctx.emit("update:value", l.value);
ctx.emit("update:name", l.label);
}
}
<!-- function change(e, l) {-->
<!-- console.log("change", l);-->
<!-- if (Array.isArray(l)) {-->
<!-- ctx.emit("update:value", l.map((t) => t.value).join(","));-->
<!-- ctx.emit("update:name", l.map((t) => t.label).join(","));-->
<!-- } else {-->
<!-- ctx.emit("update:value", l.value);-->
<!-- ctx.emit("update:name", l.label);-->
<!-- }-->
<!-- }-->
return {
...toRefs(state),
searchMember,
memberScroll,
change,
};
},
};
</script>
<!-- return {-->
<!-- ...toRefs(state),-->
<!-- searchMember,-->
<!-- memberScroll,-->
<!-- change,-->
<!-- };-->
<!-- },-->
<!--};-->
<!--</script>-->

View File

@@ -3974,28 +3974,13 @@ export default {
const getTaskInfo = () => {
getTask({
projectId: state.projectId,
useTask: "N",
}).then((res) => {
console.log("get task", res.data.data);
if (res.data.code === 200) {
// 判断当前审核是否通过
if (
res.data.data.projectAuditLogDtoList &&
res.data.data.projectAuditLogDtoList.length
) {
console.log("审核信息是什么", res.data.data.projectAuditLogDtoList);
let dataset = res.data.data.projectAuditLogDtoList;
state.passInfo = dataset[dataset.length - 1].description;
/**
for (let i = 0; i < dataset.length; i++) {
if (dataset[i].status == -5) {
state.isPass = true;
state.passInfo = dataset[i].description;
}
// isPass passInfo
}
*/
}
state.stage = res.data.data.stageList.map((e) => ({
id: e.stageId,
@@ -4003,9 +3988,7 @@ export default {
}));
let info = res.data.data.projectInfo;
state.permissions = info.permissions;
// let start = toDate(info.beginTime / 1000, "Y-M-D h:m");
let start = info.beginTime;
// let end = toDate(info.endTime / 1000, "Y-M-D h:m");
let end = info.endTime;
state.tstartTime = info.beginTime;
state.tendTime = info.endTime;
@@ -4021,9 +4004,9 @@ export default {
state.tlevel = info.level;
state.systemId = info.systemId;
state.tsystemId = info.systemId;
state.checkedSty = info.courseSyncFlag == 1 ? true : false;
state.checkedSty = info.courseSyncFlag == 1;
state.courseSyncFlag = info.courseSyncFlag;
state.checkedBOEU = info.boeFlag == 1 ? true : false;
state.checkedBOEU = info.boeFlag == 1;
state.boeFlag = info.boeFlag;
state.picUrl = info.picUrl;
state.managerId = info.managerId;
@@ -4032,34 +4015,16 @@ export default {
state.type = info.type;
state.category = info.category;
state.noticeFlag = info.noticeFlag;
state.switchopen = info.attachSwitch == 1 ? true : false;
state.docChecked = info.attachSwitch == 1 ? true : false;
state.switchopen = info.attachSwitch == 1;
state.docChecked = info.attachSwitch === 1;
state.hasTask = !!res.data.data?.stageList.some(
({ taskList }) => taskList.length
);
// state.attach = info.attach;
// state.templateId = info.templateId;
state.sourceBelong =
(info.sourceBelongFullName || "") + info.sourceBelongName;
state.sourceBelong = (info.sourceBelongFullName || "") + info.sourceBelongName;
// state.fileList=info.attach.split(",")
let d = info.attach.indexOf(",");
// console.log(info.attach, "xgo", info.attach.length);
if (info.attach.length == 0) {
return;
} else if (info.attach.length !== 0 && d == -1) {
return;
} else {
// console.log(info.attach, "xgo");
// let str = JSON.parse(info.attach)
// console.log("赚回来",str)
// let luj = info.attach.split(",")
let luj = info.attach;
// console.log("lulj", luj);
console.log("赚回来", JSON.parse(luj));
state.fileList = JSON.parse(luj);
// state.fileList = luj
}
}
state.fileList = info.attach?JSON.parse(info.attach):[];
});
};
//获取小组列表