mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-15 13:56:45 +08:00
-- 项目模板修改
This commit is contained in:
@@ -967,6 +967,7 @@ export default defineComponent({
|
|||||||
state.taskSyllabus = [];
|
state.taskSyllabus = [];
|
||||||
console.log(res);
|
console.log(res);
|
||||||
state.projectInfo.name = res.data.data.projectTemplateInfo.name;
|
state.projectInfo.name = res.data.data.projectTemplateInfo.name;
|
||||||
|
state.projectInfo.projectTemplateId = res.data.data.projectTemplateInfo.projectTemplateId;
|
||||||
state.projectInfo.beginTime = res.data.data.projectTemplateInfo.beginTime;
|
state.projectInfo.beginTime = res.data.data.projectTemplateInfo.beginTime;
|
||||||
state.projectInfo.endTime = res.data.data.projectTemplateInfo.endTime;
|
state.projectInfo.endTime = res.data.data.projectTemplateInfo.endTime;
|
||||||
state.projectInfo.manager = res.data.data.projectTemplateInfo.manager;
|
state.projectInfo.manager = res.data.data.projectTemplateInfo.manager;
|
||||||
@@ -1080,8 +1081,7 @@ export default defineComponent({
|
|||||||
routered.push({
|
routered.push({
|
||||||
path: "/templateAdd",
|
path: "/templateAdd",
|
||||||
query: {
|
query: {
|
||||||
projectId: state.projectId,
|
projectTemplateId: state.projectInfo.projectTemplateId,
|
||||||
name: state.name,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
<div class="header">
|
<div class="header">
|
||||||
<span class="title">创建/编辑单层模板</span>
|
<span class="title">创建/编辑单层模板</span>
|
||||||
<div
|
<div
|
||||||
@click="backPage"
|
@click="backPage"
|
||||||
style="cursor: pointer"
|
style="cursor: pointer"
|
||||||
to="/manage/libraryAdd"
|
to="/manage/libraryAdd"
|
||||||
class="goback"
|
class="goback"
|
||||||
>
|
>
|
||||||
<span class="return"></span><span class="returntext">返回</span>
|
<span class="return"></span><span class="returntext">返回</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -17,164 +17,119 @@
|
|||||||
<div class="name">
|
<div class="name">
|
||||||
<div class="namebox">
|
<div class="namebox">
|
||||||
<img
|
<img
|
||||||
class="nameimg"
|
class="nameimg"
|
||||||
src="../../assets/images/basicinfo/asterisk.png"
|
src="../../assets/images/basicinfo/asterisk.png"
|
||||||
/>
|
/>
|
||||||
<div class="inname">模板名称</div>
|
<div class="inname">模板名称</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<a-input
|
<a-input
|
||||||
v-model:value="projectInfo.name"
|
v-model:value="projectInfo.name"
|
||||||
placeholder="请输入模板名称"
|
placeholder="请输入模板名称"
|
||||||
show-count
|
show-count
|
||||||
:maxlength="30"
|
:maxlength="30"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<div class="namebox">
|
<div class="namebox">
|
||||||
<img
|
<img
|
||||||
class="nameimg"
|
class="nameimg"
|
||||||
src="../../assets/images/basicinfo/asterisk.png"
|
src="../../assets/images/basicinfo/asterisk.png"
|
||||||
/>
|
/>
|
||||||
<div class="inname">分类</div>
|
<div class="inname">分类</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="in select">
|
<div class="in select">
|
||||||
<a-select
|
<ProjectClass v-model:value="projectInfo.category"></ProjectClass>
|
||||||
:getPopupContainer="
|
|
||||||
(triggerNode) => {
|
|
||||||
return triggerNode.parentNode || document.body;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
v-model:value="projectInfo.category"
|
|
||||||
style="width: 100%"
|
|
||||||
:options="classifyList"
|
|
||||||
@change="classificationChange"
|
|
||||||
allowClear
|
|
||||||
showSearch
|
|
||||||
>
|
|
||||||
</a-select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="name">
|
<div class="name" style="align-items: flex-start;">
|
||||||
<div class="namebox">
|
<div class="namebox" style="margin-top: 10px">
|
||||||
<img
|
<img
|
||||||
class="nameimg"
|
class="nameimg"
|
||||||
src="../../assets/images/basicinfo/asterisk.png"
|
src="../../assets/images/basicinfo/asterisk.png"
|
||||||
/>
|
/>
|
||||||
<div class="inname">封面图</div>
|
<div class="inname">封面图</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div class="in select" style="flex:1">
|
||||||
class="box"
|
<a-select
|
||||||
style="
|
:getPopupContainer="
|
||||||
width: 100px;
|
(triggerNode) => {
|
||||||
height: 100px;
|
return triggerNode.parentNode || document.body;
|
||||||
border: 1px solid rgba(78, 166, 255, 1);
|
}
|
||||||
border-radius: 5px;
|
"
|
||||||
cursor: pointer;
|
v-model:value="projectInfo.picUrl"
|
||||||
position: relative;
|
dropdownClassName="dropdown-style"
|
||||||
overflow: hidden;
|
style="width: 440px"
|
||||||
"
|
placeholder="请选择"
|
||||||
>
|
:options="projectPic"
|
||||||
<a-upload
|
@change="handleChangeSelect"
|
||||||
v-model:file-list="fileList"
|
allowClear
|
||||||
name="file"
|
></a-select>
|
||||||
list-type="picture-card"
|
<img
|
||||||
class="avatar-uploader"
|
style="width:100px;height:100px;margin-top:20px;border-radius: 8px"
|
||||||
:show-upload-list="false"
|
v-if="projectInfo.picUrl"
|
||||||
action="/api/file/upload"
|
:src="projectInfo.picUrl"
|
||||||
:before-upload="beforeUpload"
|
|
||||||
@change="handleChange"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
style="
|
|
||||||
width: 100px;
|
|
||||||
height: 100px;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
margin-right: 4px;
|
|
||||||
"
|
|
||||||
v-if="imageUrl"
|
|
||||||
:src="imageUrl"
|
|
||||||
alt="avatar"
|
alt="avatar"
|
||||||
/>
|
/>
|
||||||
<div v-else>
|
<div class="i_bottom">
|
||||||
<!-- <loading-outlined v-if="loading"></loading-outlined> -->
|
<span style="color: #999ba3">
|
||||||
<!-- <plus-outlined v-else></plus-outlined> -->
|
高宽比为16:9 (如:800*450) png或jpg图片
|
||||||
<div class="box1"></div>
|
</span>
|
||||||
<div class="box2"></div>
|
</div>
|
||||||
<!-- <div class="ant-upload-text"></div> -->
|
|
||||||
</div>
|
|
||||||
</a-upload>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<div class="namebox">
|
<div class="namebox">
|
||||||
<img
|
<img
|
||||||
class="nameimg"
|
class="nameimg"
|
||||||
src="../../assets/images/basicinfo/asterisk.png"
|
src="../../assets/images/basicinfo/asterisk.png"
|
||||||
/>
|
/>
|
||||||
<div class="inname">项目时间</div>
|
<div class="inname">项目时间</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<a-range-picker
|
<a-range-picker
|
||||||
separator="至"
|
separator="至"
|
||||||
:placeholder="[' 开始时间', ' 结束时间']"
|
:placeholder="[' 开始时间', ' 结束时间']"
|
||||||
v-model:value="projectInfo.choosedTime"
|
v-model:value="projectInfo.rangeTime"
|
||||||
format="YYYY-MM-DD"
|
style="width: 100%; height: 40px; border-radius: 5px"
|
||||||
style="width: 100%; height: 40px; border-radius: 5px"
|
valueFormat="YYYY-MM-DD HH:mm:ss"
|
||||||
|
@change="timeChange"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<div class="namebox">
|
<div class="namebox">
|
||||||
<img
|
<img
|
||||||
class="nameimg"
|
class="nameimg"
|
||||||
src="../../assets/images/basicinfo/asterisk.png"
|
src="../../assets/images/basicinfo/asterisk.png"
|
||||||
/>
|
/>
|
||||||
<div class="inname">项目经理</div>
|
<div class="inname">项目经理</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<a-select
|
<ProjectManager
|
||||||
:getPopupContainer="
|
v-model:value="projectInfo.managerId"
|
||||||
(triggerNode) => {
|
v-model:name="projectInfo.manager"
|
||||||
return triggerNode.parentNode || document.body;
|
@onChange="managerChange"
|
||||||
}
|
mode="multiple"
|
||||||
"
|
></ProjectManager>
|
||||||
|
|
||||||
:value="classifySelect1"
|
|
||||||
mode="multiple"
|
|
||||||
placeholder="请选择项目经理"
|
|
||||||
style="width: 100%"
|
|
||||||
:options="classifyList1"
|
|
||||||
@change="classificationChange1"
|
|
||||||
allowClear
|
|
||||||
showSearch
|
|
||||||
>
|
|
||||||
</a-select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<div class="namebox">
|
<div class="namebox">
|
||||||
<img
|
<img
|
||||||
class="nameimg"
|
class="nameimg"
|
||||||
src="../../assets/images/basicinfo/asterisk.png"
|
src="../../assets/images/basicinfo/asterisk.png"
|
||||||
/>
|
/>
|
||||||
<div class="inname">资源归属</div>
|
<div class="inname">资源归属</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="in select">
|
<div class="in select">
|
||||||
<a-select
|
<OrgClass
|
||||||
:getPopupContainer="
|
v-model:value="projectInfo.sourceBelongId"
|
||||||
(triggerNode) => {
|
v-model:name="projectInfo.sourceBelongName"
|
||||||
return triggerNode.parentNode || document.body;
|
></OrgClass>
|
||||||
}
|
|
||||||
"
|
|
||||||
v-model:value="projectInfo.sourceBelongId"
|
|
||||||
placeholder="项目一"
|
|
||||||
:options="classifyList2"
|
|
||||||
@change="classificationChange2"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="name name2">
|
<div class="name name2">
|
||||||
@@ -183,11 +138,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<a-textarea
|
<a-textarea
|
||||||
v-model:value="projectInfo.remark"
|
v-model:value="projectInfo.remark"
|
||||||
style="height: 80px"
|
style="height: 80px"
|
||||||
placeholder="请输入说明"
|
placeholder="请输入说明"
|
||||||
show-count
|
show-count
|
||||||
:maxlength="200"
|
:maxlength="200"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -196,523 +151,157 @@
|
|||||||
<div class="inname">同步学习记录</div>
|
<div class="inname">同步学习记录</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<a-radio
|
<a-checkbox
|
||||||
@click="changeChecked"
|
v-model:checked="projectInfo.courseSyncFlag"
|
||||||
v-model:checked="projectInfo.courseSyncFlag"
|
><span
|
||||||
><span
|
|
||||||
style="
|
style="
|
||||||
width: 100%;
|
width: 100%;
|
||||||
color: rgba(109, 117, 132, 1);
|
color: rgba(109, 117, 132, 1);
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
"
|
"
|
||||||
>同步课程学习记录(如学员在课程库中拥有课程的学习记录,自动免修该课程)</span
|
>同步课程学习记录(如学员在课程库中拥有课程的学习记录,自动免修该课程)</span
|
||||||
></a-radio
|
></a-checkbox
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<div class="namebox">
|
<div class="namebox">
|
||||||
<img
|
<img
|
||||||
class="nameimg"
|
class="nameimg"
|
||||||
src="../../assets/images/basicinfo/asterisk.png"
|
src="../../assets/images/basicinfo/asterisk.png"
|
||||||
/>
|
/>
|
||||||
<div class="inname">项目级别</div>
|
<div class="inname">项目级别</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="in select">
|
<div class="in select">
|
||||||
<a-select
|
<ProjectLevel v-model:value="projectInfo.level"></ProjectLevel>
|
||||||
:getPopupContainer="
|
|
||||||
(triggerNode) => {
|
|
||||||
return triggerNode.parentNode || document.body;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
v-model:value="projectInfo.level"
|
|
||||||
:options="classifyList3"
|
|
||||||
@change="classificationChange3"
|
|
||||||
placeholder="集团级/组织级/现地级/部门级"
|
|
||||||
:disabled="viewDetail ? true : false"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<div class="namebox">
|
<div class="namebox">
|
||||||
<img
|
<img
|
||||||
class="nameimg"
|
class="nameimg"
|
||||||
src="../../assets/images/basicinfo/asterisk.png"
|
src="../../assets/images/basicinfo/asterisk.png"
|
||||||
/>
|
/>
|
||||||
<div class="inname">培训体系</div>
|
<div class="inname">培训体系</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="in select">
|
<div class="in select">
|
||||||
<a-select
|
<TrainClass v-model:value="projectInfo.systemId"></TrainClass>
|
||||||
:getPopupContainer="
|
|
||||||
(triggerNode) => {
|
|
||||||
return triggerNode.parentNode || document.body;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
v-model:value="projectInfo.systemId"
|
|
||||||
:options="classifyList4"
|
|
||||||
@change="classificationChange4"
|
|
||||||
placeholder="集团级/组织级/现地级/部门级"
|
|
||||||
:disabled="viewDetail ? true : false"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="name">
|
<div class="name">
|
||||||
<div class="namebox">
|
<div class="namebox">
|
||||||
<img
|
<img
|
||||||
class="nameimg"
|
class="nameimg"
|
||||||
src="../../assets/images/basicinfo/asterisk.png"
|
src="../../assets/images/basicinfo/asterisk.png"
|
||||||
/>
|
/>
|
||||||
<div class="inname">是否BOEU实施</div>
|
<div class="inname">是否BOEU实施</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="in">
|
<div class="in">
|
||||||
<a-radio
|
<a-radio-group
|
||||||
@click="changeChecked1"
|
v-model:value="projectInfo.boeFlag"
|
||||||
v-model:checked="projectInfo.boeFlag"
|
|
||||||
:disabled="viewDetail ? true : false"
|
|
||||||
><span
|
|
||||||
style="
|
|
||||||
width: 100%;
|
|
||||||
color: rgba(109, 117, 132, 1);
|
|
||||||
font-size: 14px;
|
|
||||||
"
|
|
||||||
>BOEU实施</span
|
|
||||||
></a-radio
|
|
||||||
>
|
>
|
||||||
|
<a-radio :value="1">是</a-radio>
|
||||||
|
<a-radio :value="0">否</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="name name2">
|
|
||||||
<div class="namebox" style="margin-top: 8px">
|
|
||||||
<img class="nameimg" src="../../assets/images/basicinfo/asterisk.png" />
|
|
||||||
<div class="inname">附件</div>
|
|
||||||
</div>
|
|
||||||
<div class="filebox">
|
|
||||||
<div>
|
|
||||||
<img v-if="fileList1.length < 6" class="fileimg" src="../../assets/images/projectadd/enclosure.png" />
|
|
||||||
<a-upload :disabled="fileList1.length > 5" :before-upload="beforeUpload1" v-model:file-list="fileList1"
|
|
||||||
@remove="removeFile" name="file" action="/api/file/upload" :headers="headers" @change="handleChange1">
|
|
||||||
<span v-if="fileList1.length > 5" class="filetext">上传数量已经达到最大值</span>
|
|
||||||
<span v-else class="filetext">上传附件</span>
|
|
||||||
</a-upload>
|
|
||||||
</div>
|
|
||||||
<div class="support">
|
|
||||||
支持.pdf,.ppt,.pptx,.doc,.docx,.xls,.xlsx,.jpg,.jpeg,.png,.gif,.zip
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<div class="btn">
|
<div class="btn">
|
||||||
<a-button v-on:click="createProject" type="primary" class="btn1"
|
<a-button v-on:click="createProject" type="primary" class="btn1"
|
||||||
>确定</a-button
|
>确定
|
||||||
|
</a-button
|
||||||
>
|
>
|
||||||
<a-button @click="backPage" class="btn2">取消</a-button>
|
<a-button @click="backPage" class="btn2">取消</a-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
import { reactive, toRefs, ref,onMounted } from "vue";
|
|
||||||
import { message } from "ant-design-vue";
|
import {useStore} from "vuex";
|
||||||
import { useRouter, useRoute } from "vue-router";
|
import {ref, onMounted, watch} from "vue";
|
||||||
// import dayjs from "dayjs";
|
import {message} from "ant-design-vue";
|
||||||
|
import {useRouter, useRoute} from "vue-router";
|
||||||
import * as api from "../../api/indexTemplate";
|
import * as api from "../../api/indexTemplate";
|
||||||
import { storage } from "../../api/storage";
|
import ProjectClass from "@/components/project/ProjectClass";
|
||||||
// import { toDate } from "../../api/method";
|
import TrainClass from "@/components/project/TrainClass";
|
||||||
import dayjs from "dayjs";
|
import OrgClass from "@/components/project/OrgClass";
|
||||||
|
import ProjectManager from "@/components/project/ProjectManagerNew";
|
||||||
|
import ProjectLevel from "@/components/project/ProjectLevel";
|
||||||
|
|
||||||
export default {
|
const route = useRoute();
|
||||||
name: "projectAdd",
|
const router = useRouter();
|
||||||
setup() {
|
const store = useStore();
|
||||||
// 编辑页面跳转过来时候,自动填充表格
|
const projectInfo = ref({})
|
||||||
const routers = useRoute();
|
const projectPic = ref([])
|
||||||
const isEdit = ref(false);
|
|
||||||
// let peojectID = "";
|
|
||||||
|
|
||||||
if (routers.query.projectId) {
|
onMounted(() => {
|
||||||
storage.set("projectAddId", routers.query.projectId);
|
getDetail()
|
||||||
isEdit.value = true;
|
projectPic.value = store.state.projectPic.map((e) => ({value: e.dictValue, label: e.dictName}));
|
||||||
// peojectID = routers.query.projectId;
|
})
|
||||||
} else {
|
|
||||||
if (storage.get("projectAddId")) {
|
|
||||||
isEdit.value = true;
|
|
||||||
// peojectID = storage.get("projectAddId");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const backPage = () => {
|
watch(() => route.query.projectTemplateId, () => {
|
||||||
storage.remove("projectAddId");
|
getDetail()
|
||||||
setTimeout(() => {
|
})
|
||||||
router.push({
|
|
||||||
path: "/libraryAdd",
|
|
||||||
});
|
|
||||||
}, 400);
|
|
||||||
};
|
|
||||||
|
|
||||||
const router = useRouter();
|
const getDetail = () => route.query.projectTemplateId && api.templateDetail(route.query.projectTemplateId)
|
||||||
const state = reactive({
|
.then((res) => {
|
||||||
classifySelect: null,
|
projectInfo.value = res.data.data.projectTemplateInfo;
|
||||||
classifySelectId: null,
|
projectInfo.value.rangeTime = [projectInfo.value.beginTime, projectInfo.value.endTime]
|
||||||
checked: false,
|
|
||||||
checked1: false,
|
|
||||||
valueE: null,
|
|
||||||
valueE1: null,
|
|
||||||
valueE2: null,
|
|
||||||
classifySelect1: ['李俊国'],
|
|
||||||
classifySelect2: [],
|
|
||||||
classifySelect3: [],
|
|
||||||
classifySelect4: [],
|
|
||||||
rangevalue: [],
|
|
||||||
|
|
||||||
currentPage: 1, //当前页
|
|
||||||
tableDataTotal: -1, //模版列表总数
|
|
||||||
pageSize: 10, //每页10条数据
|
|
||||||
totalPages: 0, //总页数
|
|
||||||
viewDetail: routers.query.viewDetail ? routers.query.viewDetail : null,
|
|
||||||
projectInfo:{
|
|
||||||
choosedTime:'',
|
|
||||||
name: null,
|
|
||||||
manager: null,
|
|
||||||
notice: null,
|
|
||||||
sourceBelongId: 1,
|
|
||||||
category:1,
|
|
||||||
remark: "",
|
|
||||||
courseSyncFlag: false,
|
|
||||||
level: 1,
|
|
||||||
systemId: 2,
|
|
||||||
boeFlag: false,
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const projectName = ref("");
|
|
||||||
|
|
||||||
const classifyList = ref([
|
|
||||||
{ value: 1, label: "管理者" },
|
|
||||||
{ value: 2, label: "领军者" },
|
|
||||||
{ value: 3, label: "产业人" },
|
|
||||||
]);
|
|
||||||
|
|
||||||
// let projectType = "";
|
|
||||||
|
|
||||||
const classificationChange = (value) => {
|
|
||||||
console.log(`selected ${value}`);
|
|
||||||
// projectType = value;
|
|
||||||
};
|
|
||||||
|
|
||||||
function getBase64(img, callback) {
|
|
||||||
const reader = new FileReader();
|
|
||||||
reader.addEventListener("load", () => callback(reader.result));
|
|
||||||
reader.readAsDataURL(img);
|
|
||||||
}
|
|
||||||
|
|
||||||
const fileList = ref([]);
|
|
||||||
const fileList1 = ref([]);
|
|
||||||
const loading = ref(false);
|
|
||||||
const imageUrl = ref("");
|
|
||||||
// let picUrl = "";
|
|
||||||
|
|
||||||
const handleChange = (info) => {
|
|
||||||
if (info.file.status === "uploading") {
|
|
||||||
loading.value = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (info.file.status === "done") {
|
|
||||||
console.log("上传图片返回的信息 %o", info);
|
|
||||||
// picUrl = info.file.response.data;
|
|
||||||
// Get this url from response in real world.
|
|
||||||
getBase64(info.file.originFileObj, (base64Url) => {
|
|
||||||
imageUrl.value = base64Url;
|
|
||||||
loading.value = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (info.file.status === "error") {
|
|
||||||
loading.value = false;
|
|
||||||
message.error("upload error");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let uplodaFileCount = false;
|
|
||||||
|
|
||||||
// let attach = "";
|
|
||||||
let attachData = "";
|
|
||||||
const handleChange1 = (info) => {
|
|
||||||
if (info.file.status === "uploading") {
|
|
||||||
loading.value = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (info.file.status === "done") {
|
|
||||||
console.log(
|
|
||||||
"上传附件返回的信息 %o",
|
|
||||||
info,
|
|
||||||
info.fileList.length,
|
|
||||||
uplodaFileCount
|
|
||||||
);
|
|
||||||
|
|
||||||
let attachStr = "";
|
|
||||||
attachData = info.fileList;
|
|
||||||
for (let i = 0; i < attachData.length; i++) {
|
|
||||||
if (attachData.length - 1 == i) {
|
|
||||||
attachStr += attachData[i].response.data;
|
|
||||||
} else {
|
|
||||||
attachStr += attachData[i].response.data + ",";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log(attachStr);
|
|
||||||
// attach = attachStr;
|
|
||||||
|
|
||||||
if (info.fileList.length > 5) {
|
|
||||||
uplodaFileCount = true;
|
|
||||||
} else {
|
|
||||||
uplodaFileCount = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (info.file.status === "error") {
|
|
||||||
loading.value = false;
|
|
||||||
message.error("upload error");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const beforeUpload = (file) => {
|
|
||||||
const isJpgOrPng =
|
|
||||||
file.type === "image/jpeg" || file.type === "image/png";
|
|
||||||
if (!isJpgOrPng) {
|
|
||||||
message.error("You can only upload JPG file!");
|
|
||||||
}
|
|
||||||
const isLt2M = file.size / 1024 / 1024 < 1;
|
|
||||||
if (!isLt2M) {
|
|
||||||
message.error("Image must smaller than 1MB!");
|
|
||||||
}
|
|
||||||
return isJpgOrPng && isLt2M;
|
|
||||||
};
|
|
||||||
|
|
||||||
const beforeUpload1 = () => {
|
|
||||||
return new Promise((resovle, reject) => {
|
|
||||||
if (uplodaFileCount) {
|
|
||||||
message.warning("上传文件数量已达最大数量");
|
|
||||||
return reject(false);
|
|
||||||
}
|
|
||||||
return resovle(true);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const dateFormatList = ["YYYY/MM/DD"];
|
|
||||||
|
|
||||||
const onRangeChange = (value, dateString) => {
|
|
||||||
console.log("Selected Time: ", value);
|
|
||||||
// 项目时间选择函数
|
|
||||||
console.log("Formatted Selected Time: ", dateString);
|
|
||||||
console.log(
|
|
||||||
"Formatted Selected TimeStamp",
|
|
||||||
new Date(dateString[0]).getTime()
|
|
||||||
);
|
|
||||||
// beginTime = new Date(dateString[0]).getTime() / 1000;
|
|
||||||
// endTime = new Date(dateString[1]).getTime() / 1000;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 项目经理 后续接口调用
|
|
||||||
const classifyList1 = ref([
|
|
||||||
{ value: 1, label: "李俊国" },
|
|
||||||
{ value: 2, label: "将小米" },
|
|
||||||
{ value: 3, label: "刘孟君" },
|
|
||||||
]);
|
|
||||||
|
|
||||||
const classificationChange1 = (key, options) => {
|
|
||||||
console.log(`selected ${key}`, options);
|
|
||||||
let mstr = "";
|
|
||||||
let midstr = "";
|
|
||||||
for (let i = 0; i < key.length; i++) {
|
|
||||||
if (key.length - 1 !== i) {
|
|
||||||
midstr += key[i] + ",";
|
|
||||||
mstr += classifyList1.value[i].label + ",";
|
|
||||||
} else {
|
|
||||||
midstr += key[i];
|
|
||||||
mstr += classifyList1.value[i].label;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log(mstr, midstr);
|
|
||||||
state.classifySelect1 = options;
|
|
||||||
let newoptions = [];
|
|
||||||
for (let i = 0; i < state.classifySelect1.length; i++) {
|
|
||||||
if (state.classifySelect1[i].value) {
|
|
||||||
newoptions.push(state.classifySelect1[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
state.classifySelect1 = newoptions;
|
|
||||||
// manager = mstr;
|
|
||||||
// managerId = midstr;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 资源归属 sourceBelongId 后续给接口
|
|
||||||
const classifyList2 = ref([
|
|
||||||
{ value: 1, label: "项目一" },
|
|
||||||
{ value: 2, label: "项目二" },
|
|
||||||
{ value: 3, label: "项目三" },
|
|
||||||
]);
|
|
||||||
|
|
||||||
// let sourceBelongIdC = "";
|
|
||||||
const classificationChange2 = (key) => {
|
|
||||||
console.log(`selected ${key}`, classifyList2);
|
|
||||||
// sourceBelongIdC = key;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 项目级别
|
|
||||||
const classifyList3 = ref([
|
|
||||||
{ value: 1, label: "集团级" },
|
|
||||||
{ value: 2, label: "组织级" },
|
|
||||||
{ value: 3, label: "现地级" },
|
|
||||||
{ value: 4, label: "部门级" },
|
|
||||||
]);
|
|
||||||
|
|
||||||
// let levels = "";
|
|
||||||
const classificationChange3 = (key) => {
|
|
||||||
console.log(`selected ${key}`, classifyList3);
|
|
||||||
// levels = key;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 培训体系
|
|
||||||
const classifyList4 = ref([
|
|
||||||
{ value: 1, label: "集团级" },
|
|
||||||
{ value: 2, label: "组织级" },
|
|
||||||
{ value: 3, label: "现地级" },
|
|
||||||
{ value: 4, label: "部门级" },
|
|
||||||
]);
|
|
||||||
|
|
||||||
// let systemid = "";
|
|
||||||
const classificationChange4 = (key) => {
|
|
||||||
console.log(`selected ${key}`, classifyList4);
|
|
||||||
// systemid = key;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// const removeFile = (file) => {
|
|
||||||
// const index = fileList1.value.indexOf(file);
|
|
||||||
// const newFileList = fileList1.value.slice();
|
|
||||||
// newFileList.splice(index, 1);
|
|
||||||
// fileList1.value = newFileList;
|
|
||||||
|
|
||||||
// let attachStr = "";
|
|
||||||
// if (newFileList.length == 0) {
|
|
||||||
// attachStr = "";
|
|
||||||
// }
|
|
||||||
// for (let i = 0; i < fileList1["value"].length; i++) {
|
|
||||||
// console.log(fileList1["value"][i].response.data);
|
|
||||||
// if (fileList1["value"].length - 1 == i) {
|
|
||||||
// attachStr += fileList1["value"][i].response.data;
|
|
||||||
// } else {
|
|
||||||
// attachStr += fileList1["value"][i].response.data + ",";
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// attach = attachStr;
|
|
||||||
// };
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const errorMsgs = {
|
const backPage = () => {
|
||||||
name: "请输入模板名称",
|
router.back();
|
||||||
category: "请选择模板分类",
|
|
||||||
picUrl: "请上传项目封面图",
|
|
||||||
beginTime: "请选择项目开始时间",
|
|
||||||
endTime: "请选择项目结束时间",
|
|
||||||
manager: "请选择项目经理",
|
|
||||||
managerId: "请选择项目经理",
|
|
||||||
sourceBelongId: "请选择资源归属",
|
|
||||||
level: "请填写项目级别",
|
|
||||||
systemId: "请填写项目培训体系",
|
|
||||||
boeFlag: "请选择是否BOE实施",
|
|
||||||
};
|
|
||||||
|
|
||||||
const createProject = () => {
|
|
||||||
console.log("我要编辑项目", isEdit.value);
|
|
||||||
let obj = {
|
|
||||||
"name": state.projectInfo.name,
|
|
||||||
"category": state.projectInfo.category,
|
|
||||||
"picUrl": "x",
|
|
||||||
"beginTime": Number(dayjs(state.projectInfo.choosedTime[0]).format("YYYY-MM-DD")) || 1,
|
|
||||||
"endTime": Number(dayjs(state.projectInfo.choosedTime[1]).format("YYYY-MM-DD")) || 1,
|
|
||||||
"manager": state.classifySelect1.toString(),
|
|
||||||
"managerId": state.projectInfo.managerId || 0,
|
|
||||||
"sourceBelongId": state.projectInfo.sourceBelongId,
|
|
||||||
"level": state.projectInfo.level,
|
|
||||||
"systemId": state.projectInfo.systemId,
|
|
||||||
"boeFlag": state.projectInfo.boeFlag ? 1:0,
|
|
||||||
"courseSyncFlag": state.projectInfo.courseSyncFlag? 1:0,
|
|
||||||
"notice": "",
|
|
||||||
"noticeFlag": 0,
|
|
||||||
"projectTemplateId": localStorage.getItem("projectTemplateId"),
|
|
||||||
"remark": "",
|
|
||||||
"status": 0,
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log(obj);
|
|
||||||
|
|
||||||
for (let i in errorMsgs) {
|
|
||||||
console.log(obj[i]);
|
|
||||||
if (obj[i] === "" || obj[i] === undefined) {
|
|
||||||
message.destroy();
|
|
||||||
message.warning(errorMsgs[i]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
api
|
|
||||||
.templateEdit(obj)
|
|
||||||
.then((res) => {
|
|
||||||
console.log(res);
|
|
||||||
if (res.status == 200 && res.data.code == 200) {
|
|
||||||
message.destroy();
|
|
||||||
message.success("编辑成功");
|
|
||||||
setTimeout(() => {
|
|
||||||
router.push({
|
|
||||||
path: "/projectmanage",
|
|
||||||
});
|
|
||||||
}, 1000);
|
|
||||||
} else {
|
|
||||||
message.destroy();
|
|
||||||
message.error("编辑失败,请检查当前网络状态。");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log(err);
|
|
||||||
message.destroy();
|
|
||||||
message.error("编辑失败,请检查当前网络状态。");
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
|
||||||
...toRefs(state),
|
|
||||||
projectName,
|
|
||||||
classifyList,
|
|
||||||
classificationChange,
|
|
||||||
classificationChange1,
|
|
||||||
classificationChange2,
|
|
||||||
classificationChange3,
|
|
||||||
classificationChange4,
|
|
||||||
fileList,
|
|
||||||
fileList1,
|
|
||||||
loading,
|
|
||||||
imageUrl,
|
|
||||||
handleChange,
|
|
||||||
handleChange1,
|
|
||||||
beforeUpload,
|
|
||||||
beforeUpload1,
|
|
||||||
onRangeChange,
|
|
||||||
classifyList1,
|
|
||||||
classifyList2,
|
|
||||||
classifyList3,
|
|
||||||
classifyList4,
|
|
||||||
uplodaFileCount,
|
|
||||||
createProject,
|
|
||||||
// removeFile,
|
|
||||||
isEdit,
|
|
||||||
backPage,
|
|
||||||
dateFormatList,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleChangeSelect = (value) => {
|
||||||
|
projectInfo.value.picUrl = value
|
||||||
|
}
|
||||||
|
|
||||||
|
function timeChange(e) {
|
||||||
|
if (e && e.length === 2) {
|
||||||
|
projectInfo.value.beginTime = e[0];
|
||||||
|
projectInfo.value.endTime = e[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const errorMsgs = {
|
||||||
|
name: "请输入模板名称",
|
||||||
|
category: "请选择模板分类",
|
||||||
|
picUrl: "请上传项目封面图",
|
||||||
|
beginTime: "请选择项目开始时间",
|
||||||
|
endTime: "请选择项目结束时间",
|
||||||
|
manager: "请选择项目经理",
|
||||||
|
managerId: "请选择项目经理",
|
||||||
|
sourceBelongId: "请选择资源归属",
|
||||||
|
level: "请填写项目级别",
|
||||||
|
systemId: "请填写项目培训体系",
|
||||||
|
boeFlag: "请选择是否BOE实施",
|
||||||
|
};
|
||||||
|
|
||||||
|
const createProject = () => {
|
||||||
|
for (let i in errorMsgs) {
|
||||||
|
if (projectInfo.value[i] === "" || projectInfo.value[i] === undefined) {
|
||||||
|
message.destroy();
|
||||||
|
message.warning(errorMsgs[i]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
api.templateEdit({...projectInfo.value, courseSyncFlag: projectInfo.value.courseSyncFlag ? 1 : 0}).then(() => {
|
||||||
|
message.destroy();
|
||||||
|
message.success("编辑成功");
|
||||||
|
router.back()
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
function managerChange(e, l, d) {
|
||||||
|
projectInfo.value.valuesourceBelongId = d
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.projectAdd {
|
.projectAdd {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
// height: inherit;
|
// height: inherit;
|
||||||
|
|||||||
Reference in New Issue
Block a user