mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-14 05:16:45 +08:00
feat:创建测评 创建评估 接口对接
This commit is contained in:
63
src/api/indexEval.js
Normal file
63
src/api/indexEval.js
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import http from "./config";
|
||||||
|
// import qs from 'qs';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口传参数方式(get)
|
||||||
|
* axios.get('/user', {
|
||||||
|
* params: {
|
||||||
|
* id: 12345,
|
||||||
|
* name: user
|
||||||
|
* }
|
||||||
|
* }).then(res => console.log(res))
|
||||||
|
*
|
||||||
|
* 接口传参三种方式(post/put/patch)
|
||||||
|
*
|
||||||
|
* 1.'Content-Type'= 'multipart/form-data',传参格式为 formData。
|
||||||
|
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded')
|
||||||
|
* (request的Header:'Content-Type'= 'multipart/form-data')
|
||||||
|
* var formData=new FormData();
|
||||||
|
* formData.append('user',123456);formData.append('pass',12345678);
|
||||||
|
* axios.post("/notice",formData).then()
|
||||||
|
*
|
||||||
|
* 2.'Content-Type'= 'application/x-www-form-urlencoded',传参格式为 query 形式,使用$qs.stringify。
|
||||||
|
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded')
|
||||||
|
* (request的Header:'Content-Type'= 'application/x-www-form-urlencoded')
|
||||||
|
* let data = {"code":"1234","name":"yyyy"};
|
||||||
|
* axios.post(`${this.$url}/test/testRequest`,qs.stringify({data})).then()
|
||||||
|
*
|
||||||
|
* 3.'Content-Type'= 'application/json,传参格式为 raw (JSON格式)。
|
||||||
|
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded')
|
||||||
|
* (request的Header:'Content-Type'= 'application/json;charset=UTF-8')
|
||||||
|
* let data = {"code":"1234","name":"yyyy"}
|
||||||
|
* axios.post(`${this.$url}/test/testRequest`,data).then()
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// 接口-请求
|
||||||
|
|
||||||
|
//创建测评
|
||||||
|
export const createEvaluation = (obj) => http.post('/evaluation/createEvaluation', obj,);
|
||||||
|
|
||||||
|
//上传组件
|
||||||
|
export const fileUp = (obj) => http.post('/file/upload', obj,);
|
||||||
|
|
||||||
|
//删除测评信息
|
||||||
|
export const deleteEvaluationById = (obj) => http.post('/evaluation/deleteEvaluationById', { params: obj })
|
||||||
|
|
||||||
|
|
||||||
|
//根据ID获取测评信息详情
|
||||||
|
export const queryEvaluationDetailById = (obj) => http.post('/evaluation/queryEvaluationDetailById', { params: obj })
|
||||||
|
|
||||||
|
//修改测评信息
|
||||||
|
export const updateEvaluation = (obj) => http.post('/evaluation/updateEvaluation', obj)
|
||||||
|
|
||||||
|
|
||||||
|
// 测试方法
|
||||||
|
// import * as api from '../../api/index'
|
||||||
|
// api.getLearnPath({}).then(res => {
|
||||||
|
// console.log(res)
|
||||||
|
// }).catch(err => {
|
||||||
|
// console.log(err)
|
||||||
|
// })
|
||||||
60
src/api/indexInvist.js
Normal file
60
src/api/indexInvist.js
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
import http from "./config";
|
||||||
|
// import qs from 'qs';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口传参数方式(get)
|
||||||
|
* axios.get('/user', {
|
||||||
|
* params: {
|
||||||
|
* id: 12345,
|
||||||
|
* name: user
|
||||||
|
* }
|
||||||
|
* }).then(res => console.log(res))
|
||||||
|
*
|
||||||
|
* 接口传参三种方式(post/put/patch)
|
||||||
|
*
|
||||||
|
* 1.'Content-Type'= 'multipart/form-data',传参格式为 formData。
|
||||||
|
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded')
|
||||||
|
* (request的Header:'Content-Type'= 'multipart/form-data')
|
||||||
|
* var formData=new FormData();
|
||||||
|
* formData.append('user',123456);formData.append('pass',12345678);
|
||||||
|
* axios.post("/notice",formData).then()
|
||||||
|
*
|
||||||
|
* 2.'Content-Type'= 'application/x-www-form-urlencoded',传参格式为 query 形式,使用$qs.stringify。
|
||||||
|
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded')
|
||||||
|
* (request的Header:'Content-Type'= 'application/x-www-form-urlencoded')
|
||||||
|
* let data = {"code":"1234","name":"yyyy"};
|
||||||
|
* axios.post(`${this.$url}/test/testRequest`,qs.stringify({data})).then()
|
||||||
|
*
|
||||||
|
* 3.'Content-Type'= 'application/json,传参格式为 raw (JSON格式)。
|
||||||
|
* (全局请求头:'Content-Type'= 'application/x-www-form-urlencoded')
|
||||||
|
* (request的Header:'Content-Type'= 'application/json;charset=UTF-8')
|
||||||
|
* let data = {"code":"1234","name":"yyyy"}
|
||||||
|
* axios.post(`${this.$url}/test/testRequest`,data).then()
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// 接口-请求
|
||||||
|
|
||||||
|
//创建评估
|
||||||
|
export const createAppraiseMessage = (obj) => http.post('/survey/createAppraiseMessage', obj,);
|
||||||
|
|
||||||
|
//删除评估信息
|
||||||
|
export const deleteAppraise = (obj) => http.post('/survey/deleteAppraise', { params: obj })
|
||||||
|
|
||||||
|
|
||||||
|
//根据ID获取评估信息详情
|
||||||
|
export const queryAppraiseDetailById = (obj) => http.post('/survey/queryAppraiseDetailById', { params: obj })
|
||||||
|
|
||||||
|
//修改评估信息
|
||||||
|
export const updateAppraiseMessage = (obj) => http.post('/survey/updateAppraiseMessage', obj)
|
||||||
|
|
||||||
|
|
||||||
|
// 测试方法
|
||||||
|
// import * as api from '../../api/index'
|
||||||
|
// api.getLearnPath({}).then(res => {
|
||||||
|
// console.log(res)
|
||||||
|
// }).catch(err => {
|
||||||
|
// console.log(err)
|
||||||
|
// })
|
||||||
0
src/api/indexVote.js
Normal file
0
src/api/indexVote.js
Normal file
@@ -61,7 +61,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="btnbox">
|
<div class="btnbox">
|
||||||
<a-range-picker
|
<a-range-picker
|
||||||
style="width: 424px;"
|
style="width: 424px"
|
||||||
|
v-model:value="time"
|
||||||
|
format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
@change="onChange"
|
||||||
:placeholder="[' 开始时间', ' 结束时间']"
|
:placeholder="[' 开始时间', ' 结束时间']"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -77,7 +80,7 @@
|
|||||||
list-type="picture-card"
|
list-type="picture-card"
|
||||||
class="avatar-uploader"
|
class="avatar-uploader"
|
||||||
:show-upload-list="false"
|
:show-upload-list="false"
|
||||||
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
|
action="/api/file/upload"
|
||||||
:before-upload="beforeUpload"
|
:before-upload="beforeUpload"
|
||||||
@change="handleChange"
|
@change="handleChange"
|
||||||
>
|
>
|
||||||
@@ -93,14 +96,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="main_btns">
|
<div class="main_btns">
|
||||||
<button class="btn1">取消</button>
|
<button class="btn1" @click="closeDrawer">取消</button>
|
||||||
<button class="btn2">确定</button>
|
<button class="btn2" @click="createEvalText">确定</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { reactive, toRefs, ref } from "vue";
|
import { reactive, toRefs, ref } from "vue";
|
||||||
|
import { useRouter } from "vue-router";
|
||||||
|
import * as api from "../../api/indexEval";
|
||||||
|
import { message } from "ant-design-vue";
|
||||||
|
// import { toDate } from "../../api/method";
|
||||||
|
const router = useRouter();
|
||||||
const rowSelection = ref({
|
const rowSelection = ref({
|
||||||
checkStrictly: false,
|
checkStrictly: false,
|
||||||
onChange: (selectedRowKeys, selectedRows) => {
|
onChange: (selectedRowKeys, selectedRows) => {
|
||||||
@@ -117,6 +125,11 @@
|
|||||||
console.log(selected, selectedRows, changeRows);
|
console.log(selected, selectedRows, changeRows);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
function getBase64(img, callback) {
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.addEventListener('load', () => callback(reader.result));
|
||||||
|
reader.readAsDataURL(img);
|
||||||
|
}
|
||||||
export default {
|
export default {
|
||||||
name: "AddEval",
|
name: "AddEval",
|
||||||
// components: {
|
// components: {
|
||||||
@@ -131,18 +144,120 @@
|
|||||||
const state = reactive({
|
const state = reactive({
|
||||||
inputV1: "",
|
inputV1: "",
|
||||||
inputV2: "",
|
inputV2: "",
|
||||||
|
time: undefined,
|
||||||
|
endTime: undefined,
|
||||||
|
startTime: undefined,
|
||||||
});
|
});
|
||||||
const closeDrawer = () => {
|
const closeDrawer = () => {
|
||||||
ctx.emit("update:addevalVisible", false);
|
ctx.emit("update:addevalVisible", false);
|
||||||
|
state.inputV1 = "";
|
||||||
|
state.inputV2 = "";
|
||||||
|
state.time = undefined;
|
||||||
};
|
};
|
||||||
const afterVisibleChange = (bool) => {
|
const afterVisibleChange = (bool) => {
|
||||||
console.log("state", bool);
|
console.log("state", bool);
|
||||||
};
|
};
|
||||||
|
const onChange = () => {
|
||||||
|
state.endTime = state.time[0].$d.toString;
|
||||||
|
state.startTime = state.time[1].$d.toString;
|
||||||
|
}
|
||||||
|
//上传组件
|
||||||
|
const fileList = ref([]);
|
||||||
|
const loading = ref(false);
|
||||||
|
const imageUrl = ref('');
|
||||||
|
|
||||||
|
const handleChange = info => {
|
||||||
|
if (info.file.status === 'uploading') {
|
||||||
|
loading.value = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.file.status === 'done') {
|
||||||
|
// 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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 < 2;
|
||||||
|
|
||||||
|
if (!isLt2M) {
|
||||||
|
message.error('Image must smaller than 2MB!');
|
||||||
|
}
|
||||||
|
|
||||||
|
return isJpgOrPng && isLt2M;
|
||||||
|
}
|
||||||
|
// const fileUp = () => {
|
||||||
|
// let obj = {
|
||||||
|
// file
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//创建测评信息
|
||||||
|
const createEvalText = () => {
|
||||||
|
if (!state.inputV1) return message.info("请输入测评名称");
|
||||||
|
console.log(state.time);
|
||||||
|
console.log(state.time[0]);
|
||||||
|
console.log(state.time[0].$d.toString);
|
||||||
|
console.log(state.time[1].$d.toString);
|
||||||
|
let obj = {
|
||||||
|
evaluationName: state.inputV1,
|
||||||
|
createTime: "",
|
||||||
|
createUser: 0,
|
||||||
|
evaluationEndTime: state.endTime,
|
||||||
|
evaluationFlag: "",
|
||||||
|
evaluationId: "",
|
||||||
|
evaluationPictureAddress: "",
|
||||||
|
evaluationStartTime: state.startTime,
|
||||||
|
evaluationTag: "",
|
||||||
|
evaluationTypeId: 0,
|
||||||
|
evaluationTypeName: "",
|
||||||
|
updateTime: "",
|
||||||
|
updateUser: 0,
|
||||||
|
};
|
||||||
|
api
|
||||||
|
.createEvaluation(obj)
|
||||||
|
.then((res) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log("创建成功", res);
|
||||||
|
message.success("创建成功");
|
||||||
|
console.log(obj);
|
||||||
|
// state.createLoading = false;
|
||||||
|
router.push("/leveladd");
|
||||||
|
// getLearnPath();
|
||||||
|
}, 1000);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log("创建失败", err);
|
||||||
|
// state.createLoading = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
afterVisibleChange,
|
afterVisibleChange,
|
||||||
closeDrawer,
|
closeDrawer,
|
||||||
rowSelection,
|
rowSelection,
|
||||||
|
createEvalText,
|
||||||
|
onChange,
|
||||||
|
//上传组件
|
||||||
|
fileList,
|
||||||
|
loading,
|
||||||
|
imageUrl,
|
||||||
|
handleChange,
|
||||||
|
beforeUpload,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -85,14 +85,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="main_btns">
|
<div class="main_btns">
|
||||||
<button class="btn1">取消</button>
|
<button class="btn1" @click="closeDrawer">取消</button>
|
||||||
<button class="btn2">确定</button>
|
<button class="btn2" @click="createInvist">确定</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { reactive, toRefs, ref } from "vue";
|
import { reactive, toRefs, ref } from "vue";
|
||||||
|
import { useRouter } from "vue-router";
|
||||||
|
import * as api from "../../api/indexInvist";
|
||||||
|
import { message } from "ant-design-vue";
|
||||||
|
const router = useRouter();
|
||||||
const options1 = ref([
|
const options1 = ref([
|
||||||
{
|
{
|
||||||
value: "value1",
|
value: "value1",
|
||||||
@@ -132,16 +136,56 @@ export default {
|
|||||||
});
|
});
|
||||||
const closeDrawer = () => {
|
const closeDrawer = () => {
|
||||||
ctx.emit("update:addinvistVisible", false);
|
ctx.emit("update:addinvistVisible", false);
|
||||||
|
state.inputV1 = "";
|
||||||
|
state.textV1 = "";
|
||||||
};
|
};
|
||||||
const afterVisibleChange = (bool) => {
|
const afterVisibleChange = (bool) => {
|
||||||
console.log("state", bool);
|
console.log("state", bool);
|
||||||
};
|
};
|
||||||
|
//创建评估信息
|
||||||
|
const createInvist = () => {
|
||||||
|
if (!state.inputV1) return message.info("请输入测评名称");
|
||||||
|
// if (!state.inputV2) return message.info("请选择测评");
|
||||||
|
// if (!state.organizationSelectName) return message.info("请选择归属组织");
|
||||||
|
// state.createLoading = true;
|
||||||
|
let obj = {
|
||||||
|
appraiseName: state.inputV1,
|
||||||
|
appraiseEndTime: "",
|
||||||
|
appraiseExplain: state.textV1,
|
||||||
|
appraiseFlag: "",
|
||||||
|
appraiseId: 0,
|
||||||
|
appraiseStartTime: "",
|
||||||
|
appraiseTag: "",
|
||||||
|
createTime: "",
|
||||||
|
createUser: 0,
|
||||||
|
researchId: 0,
|
||||||
|
researchName: "",
|
||||||
|
updateTime: "",
|
||||||
|
updateUser: 0,
|
||||||
|
};
|
||||||
|
api
|
||||||
|
.createAppraiseMessage(obj)
|
||||||
|
.then((res) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log("创建成功", res);
|
||||||
|
message.success("创建成功");
|
||||||
|
// state.createLoading = false;
|
||||||
|
router.push("/leveladd");
|
||||||
|
// getLearnPath();
|
||||||
|
}, 1000);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log("创建失败", err);
|
||||||
|
// state.createLoading = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
return {
|
return {
|
||||||
...toRefs(state),
|
...toRefs(state),
|
||||||
afterVisibleChange,
|
afterVisibleChange,
|
||||||
closeDrawer,
|
closeDrawer,
|
||||||
rowSelection,
|
rowSelection,
|
||||||
options1,
|
options1,
|
||||||
|
createInvist,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user