From d3448506c32079101d4eea68494becebae704bf5 Mon Sep 17 00:00:00 2001 From: wuyx Date: Mon, 31 Oct 2022 16:49:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E9=BB=98=E8=AE=A4token=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E3=80=81=E5=A2=9E=E5=8A=A0=E5=88=9B=E5=BB=BA=E5=8D=95=E5=B1=82?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=99=84=E4=BB=B6=E4=B8=8A=E4=BC=A0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/config.js | 2 + src/api/index.js | 12 ++- src/views/projectcenter/ProjectAdd.vue | 116 +++++++++++++++++++------ 3 files changed, 100 insertions(+), 30 deletions(-) diff --git a/src/api/config.js b/src/api/config.js index 3e659a63..bb964595 100644 --- a/src/api/config.js +++ b/src/api/config.js @@ -16,6 +16,8 @@ http.interceptors.request.use( config.headers.token = token; } else { console.log("当前请求页面无token,请执行操作!!!") + // 此处测试默认配置token + config.headers.token = "123456"; } return config; }, diff --git a/src/api/index.js b/src/api/index.js index acd6f5c5..ca3a832a 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -51,13 +51,21 @@ export const createProject = (obj) => http.post('/admin/project/edit', { "name": obj.name, "notice": obj.notice, "noticeFlag": obj.noticeFlag, - "parentId": obj.parentId, "picUrl": obj.picUrl, - "projectId": obj.projectId, "remark": obj.remark, "sourceBelongId": obj.sourceBelongId, "status": obj.status, "systemId": obj.systemId, "templateId": obj.templateId, "type": obj.type +}) + +// 创建多层项目 +export const createStoreyProject = () => http.post('/admin/project/edit', { + +}) + +// 获取项目列表 +export const getProjectList = () => http.post('/admin/project/list', { + }) \ No newline at end of file diff --git a/src/views/projectcenter/ProjectAdd.vue b/src/views/projectcenter/ProjectAdd.vue index 0c570b97..8866da75 100644 --- a/src/views/projectcenter/ProjectAdd.vue +++ b/src/views/projectcenter/ProjectAdd.vue @@ -77,8 +77,8 @@
+ }" :value="classifySelect1" placeholder="请选择项目经理" style="width: 100%" :options="classifyList1" + @change="classificationChange1" allowClear showSearch>
@@ -118,7 +118,7 @@
项目级别
- +
@@ -127,7 +127,7 @@
培训体系
- +
@@ -152,7 +152,7 @@
+ @remove="removeFile" name="file" action="/api/file/upload" :headers="headers" @change="handleChange1"> 上传数量已经达到最大值 @@ -196,7 +196,10 @@ export default { classifySelect: null, classifySelectId: null, checked: false, - checked1: false + checked1: false, + valueE: null, + valueE1: null, + valueE2: null }); const projectName = ref(''); @@ -224,6 +227,7 @@ export default { const fileList1 = ref([]); const loading = ref(false); const imageUrl = ref(''); + let picUrl = ''; const handleChange = (info) => { if (info.file.status === 'uploading') { @@ -232,6 +236,7 @@ export default { } 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; @@ -246,6 +251,8 @@ export default { let uplodaFileCount = false; + let attach = ""; + let attachData = ""; const handleChange1 = (info) => { if (info.file.status === 'uploading') { loading.value = true; @@ -253,6 +260,19 @@ export default { } 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 { @@ -287,12 +307,18 @@ export default { }) }; + let beginTime = ""; + let endTime = ""; 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(); + endTime = new Date(dateString[1]).getTime(); }; + // 项目经理 后续接口调用 const classifyList1 = ref([ { value: 1, label: '李俊国' }, @@ -300,22 +326,56 @@ export default { { value: 3, label: '刘孟君' }, ]); + let manager = ""; + let managerId = ""; + const classificationChange1 = (key) => { + console.log(`selected ${key}`); + console.log(classifyList1.value[key - 1].label) + manager = String(classifyList1.value[key - 1].label) + managerId = String(key) + }; + // 资源归属 sourceBelongId 后续给接口 // 项目说明 const remark = ref(''); - + let courseSyncFlag = 0; const changeChecked = () => { console.log(state.checked) state.checked ? state.checked = false : state.checked = true; + courseSyncFlag = state.checked ? 1 : 0; } + let boeFlag = 0; const changeChecked1 = () => { console.log(state.checked1) state.checked1 ? state.checked1 = false : state.checked1 = true; + boeFlag = state.checked1 ? 1 : 0; } + 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; + } + + const errorMsgs = { "name": "请输入项目名称", "type": "请选择项目分类", @@ -333,31 +393,29 @@ export default { const createProject = () => { let obj = { - "attach": "1", - "beginTime": 0, - "boeFlag": 0, - "category": 0, - "courseSyncFlag": 0, - "endTime": 0, - "level": 0, - "manager": "", - "managerId": "", "name": projectName["value"], + "type": projectType, + "picUrl": picUrl, + "beginTime": beginTime, + "endTime": endTime, + "manager": manager, + "managerId": managerId, + "sourceBelongId": 11, + "remark": remark["value"], + "courseSyncFlag": courseSyncFlag, + "level": 3, + "systemId": 4, + "boeFlag": boeFlag, + "attach": attach, + "templateId": 10, + + "category": 0, "notice": "", "noticeFlag": 0, - "parentId": 0, - "picUrl": "", - "projectId": 0, - "remark": remark["value"], - "sourceBelongId": 0, - "status": 0, - "systemId": 0, - "templateId": 0, - "type": projectType + "status": 0 } console.log('提交的数据格式 %o', obj) - - for (let i in obj) { + for (let i in errorMsgs) { console.log(obj[i]) if (obj[i] === "") { message.destroy() @@ -378,6 +436,7 @@ export default { projectName, classifyList, classificationChange, + classificationChange1, fileList, fileList1, loading, @@ -392,7 +451,8 @@ export default { changeChecked, changeChecked1, uplodaFileCount, - createProject + createProject, + removeFile }; } }; From f2a3f6376517d1d7236abeb9f43eb674b00b7cb6 Mon Sep 17 00:00:00 2001 From: wuyx Date: Mon, 31 Oct 2022 18:21:26 +0800 Subject: [PATCH 2/2] =?UTF-8?q?style:=E4=BF=AE=E6=94=B9antd=20upload?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E3=80=81=E5=A2=9E=E5=8A=A0=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=A4=9A=E5=B1=82=E9=A1=B9=E7=9B=AE=E5=88=9B=E5=BB=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E8=8E=B7=E5=8F=96=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/projectcenter/ProjectAdd.vue | 6 + src/views/projectcenter/ProjectManage.vue | 6201 ++++++++++----------- 2 files changed, 3079 insertions(+), 3128 deletions(-) diff --git a/src/views/projectcenter/ProjectAdd.vue b/src/views/projectcenter/ProjectAdd.vue index 8866da75..57078111 100644 --- a/src/views/projectcenter/ProjectAdd.vue +++ b/src/views/projectcenter/ProjectAdd.vue @@ -42,6 +42,7 @@ border: 1px solid rgba(78, 166, 255, 1); border-radius: 5px; cursor: pointer; + position: relative; overflow: hidden; ">