|
|
@ -8,9 +8,9 @@ import { |
|
|
|
delObjectContents, |
|
|
|
delObjectContents, |
|
|
|
addObjectContents, |
|
|
|
addObjectContents, |
|
|
|
getObjectContent, |
|
|
|
getObjectContent, |
|
|
|
|
|
|
|
getObjectType, |
|
|
|
} from '@/api/user/object' |
|
|
|
} from '@/api/user/object' |
|
|
|
import { useRoute } from 'vue-router' |
|
|
|
import { useRoute } from 'vue-router' |
|
|
|
// import { ITEM_RENDER_EVT } from 'element-plus/es/components/virtual-list/src/defaults.mjs' |
|
|
|
|
|
|
|
const route = useRoute() |
|
|
|
const route = useRoute() |
|
|
|
// const router = useRouter() |
|
|
|
// const router = useRouter() |
|
|
|
const courseId = ref() |
|
|
|
const courseId = ref() |
|
|
@ -23,39 +23,52 @@ const params = ref({ |
|
|
|
objectiveId: '', |
|
|
|
objectiveId: '', |
|
|
|
}) |
|
|
|
}) |
|
|
|
// 获取目标列表 |
|
|
|
// 获取目标列表 |
|
|
|
|
|
|
|
const list = ref([]) |
|
|
|
const getObject = async () => { |
|
|
|
const getObject = async () => { |
|
|
|
const res = await getObjectList({ id: courseId.value }) |
|
|
|
const res = await getObjectList({ id: courseId.value }) |
|
|
|
console.log(res, 'objectres') |
|
|
|
console.log(res, 'objectres') |
|
|
|
data.value = res.data[0].courseObjectivesTrees |
|
|
|
data.value = res.data[0].courseObjectivesTrees |
|
|
|
params.value = res.data[0].contents[0] |
|
|
|
console.log(data, 'data'); |
|
|
|
console.log(params.value, 'params.value') |
|
|
|
|
|
|
|
|
|
|
|
console.log(res.data, 'res.data[0].contents[0]'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object.assign(params.value, res.data[0].contents[0]) |
|
|
|
|
|
|
|
// params.value = res.data[0].contents[0] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
list.value = data.value.map(item => item.contents).flat() |
|
|
|
|
|
|
|
console.log(list.value, 'list.value '); |
|
|
|
|
|
|
|
|
|
|
|
console.log(data.value, 'data.value') |
|
|
|
|
|
|
|
// content.value = res.data[0].contents[0].content |
|
|
|
// content.value = res.data[0].contents[0].content |
|
|
|
} |
|
|
|
// console.log(content.value, 'content.value') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
// 获取目标类型 |
|
|
|
// 获取目标类型 |
|
|
|
// const type = ref({ |
|
|
|
const type = ref({ |
|
|
|
// id: '', |
|
|
|
id: '', |
|
|
|
// typeName: '', |
|
|
|
name: '', |
|
|
|
// }) |
|
|
|
}) |
|
|
|
// const getType = async () => { |
|
|
|
const getType = async () => { |
|
|
|
// const res = await getObjectType() |
|
|
|
console.log(courseId, 'typecourse') |
|
|
|
// type.value = res.data.slice(1, 5) |
|
|
|
const res = await getObjectType(courseId.value) |
|
|
|
// console.log(type.value, 'typeres') |
|
|
|
|
|
|
|
// } |
|
|
|
type.value = res.data |
|
|
|
|
|
|
|
console.log(res, 'typeres') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
onMounted(() => { |
|
|
|
courseId.value = route.query.id |
|
|
|
courseId.value = route.query.id |
|
|
|
console.log(courseId.value, 'courseid.vlue') |
|
|
|
console.log(courseId.value, 'courseid.vlue') |
|
|
|
getObject() |
|
|
|
getObject() |
|
|
|
|
|
|
|
getType() |
|
|
|
}) |
|
|
|
}) |
|
|
|
// 修改目标内容 |
|
|
|
// 修改目标内容 |
|
|
|
const isEditing = ref(false) |
|
|
|
const isEditing = ref(false) |
|
|
|
|
|
|
|
const content = ref('') |
|
|
|
const updateContent = () => { |
|
|
|
const updateContent = () => { |
|
|
|
isEditing.value = true |
|
|
|
isEditing.value = true |
|
|
|
content.value = params.value.content |
|
|
|
content.value = params.value.content |
|
|
|
} |
|
|
|
} |
|
|
|
const content = ref('') |
|
|
|
|
|
|
|
// 保存修改 |
|
|
|
// 保存修改 |
|
|
|
const saveContent = async () => { |
|
|
|
const saveContent = async () => { |
|
|
|
console.log(params.value.content, ' params.value.content') |
|
|
|
console.log(params.value.content, ' params.value.content') |
|
|
@ -73,6 +86,9 @@ const saveContent = async () => { |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(async () => { |
|
|
|
.then(async () => { |
|
|
|
params.value.content = content.value |
|
|
|
params.value.content = content.value |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const res = await updateContents({ |
|
|
|
const res = await updateContents({ |
|
|
|
id: params.value.id, |
|
|
|
id: params.value.id, |
|
|
|
objectiveId: params.value.objectiveId, |
|
|
|
objectiveId: params.value.objectiveId, |
|
|
@ -81,8 +97,10 @@ const saveContent = async () => { |
|
|
|
console.log(res, 'res') |
|
|
|
console.log(res, 'res') |
|
|
|
ElMessage.success('保存成功!') |
|
|
|
ElMessage.success('保存成功!') |
|
|
|
isEditing.value = false |
|
|
|
isEditing.value = false |
|
|
|
}) |
|
|
|
|
|
|
|
.catch(() => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, () => { |
|
|
|
// 点击取消后的操作 |
|
|
|
// 点击取消后的操作 |
|
|
|
ElMessage.info('您已取消操作') |
|
|
|
ElMessage.info('您已取消操作') |
|
|
|
}) |
|
|
|
}) |
|
|
@ -101,6 +119,9 @@ const delObject = async (id: any) => { |
|
|
|
await delObjectContents(id).then(() => { |
|
|
|
await delObjectContents(id).then(() => { |
|
|
|
ElMessage.success('删除成功') |
|
|
|
ElMessage.success('删除成功') |
|
|
|
getObject() |
|
|
|
getObject() |
|
|
|
|
|
|
|
}).catch((err: any) => { |
|
|
|
|
|
|
|
// console.log(id, 'id') |
|
|
|
|
|
|
|
ElMessage.error(err.response.data.message) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
// 添加目标 |
|
|
|
// 添加目标 |
|
|
@ -126,7 +147,9 @@ const objectiveIds = ref(0) |
|
|
|
const addObject = (item: any) => { |
|
|
|
const addObject = (item: any) => { |
|
|
|
// console.log(id, 'id') |
|
|
|
// console.log(id, 'id') |
|
|
|
dialogVisible.value = true |
|
|
|
dialogVisible.value = true |
|
|
|
|
|
|
|
|
|
|
|
flog.value = false |
|
|
|
flog.value = false |
|
|
|
|
|
|
|
type.value.name = '' |
|
|
|
formData.value.description = '' |
|
|
|
formData.value.description = '' |
|
|
|
// updateDisabledStatus() |
|
|
|
// updateDisabledStatus() |
|
|
|
objectiveIds.value = item.id |
|
|
|
objectiveIds.value = item.id |
|
|
@ -157,6 +180,7 @@ const submit = async () => { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
console.log(objectiveIds, 'objectiveIds') |
|
|
|
console.log(objectiveIds, 'objectiveIds') |
|
|
|
await addObjectContents({ |
|
|
|
await addObjectContents({ |
|
|
|
|
|
|
|
// id: type.value.id, |
|
|
|
objectiveId: objectiveIds.value, |
|
|
|
objectiveId: objectiveIds.value, |
|
|
|
content: formData.value.description, |
|
|
|
content: formData.value.description, |
|
|
|
}) |
|
|
|
}) |
|
|
@ -181,13 +205,7 @@ const submit = async () => { |
|
|
|
<template #header> |
|
|
|
<template #header> |
|
|
|
<div class="card-header"> |
|
|
|
<div class="card-header"> |
|
|
|
<span>整体目标</span> |
|
|
|
<span>整体目标</span> |
|
|
|
<el-button |
|
|
|
<el-button type="primary" :icon="Edit" circle plain @click="updateContent"></el-button> |
|
|
|
type="primary" |
|
|
|
|
|
|
|
:icon="Edit" |
|
|
|
|
|
|
|
circle |
|
|
|
|
|
|
|
plain |
|
|
|
|
|
|
|
@click="updateContent" |
|
|
|
|
|
|
|
></el-button> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<div class="el-card__body" style=""> |
|
|
|
<div class="el-card__body" style=""> |
|
|
@ -204,7 +222,7 @@ const submit = async () => { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="typeObject"> |
|
|
|
<div class="typeObject"> |
|
|
|
<ul v-for="item in data" :key="item.id"> |
|
|
|
<!-- <ul v-for="item in data" :key="item.id"> |
|
|
|
<li> |
|
|
|
<li> |
|
|
|
<div class="all"> |
|
|
|
<div class="all"> |
|
|
|
<div class="left"> |
|
|
|
<div class="left"> |
|
|
@ -243,24 +261,36 @@ const submit = async () => { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<el-divider style="margin: 0; width: 100%" /> |
|
|
|
<el-divider style="margin: 0; width: 100%" /> |
|
|
|
</li> |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
</ul> --> |
|
|
|
<el-dialog |
|
|
|
<el-scrollbar> |
|
|
|
v-if="dialogVisible" |
|
|
|
<li v-for="(obj, i) in list" :key="obj.id"> |
|
|
|
v-model="dialogVisible" |
|
|
|
<span>目标{{ i + 1 }}:{{ obj.content }}</span> |
|
|
|
:title="flog ? '编辑' : '新增'" |
|
|
|
<div class="icon"> |
|
|
|
width="500" |
|
|
|
<el-button type="primary" :icon="Edit" circle size="small" plain @click="updateObjectContent(obj.id)" /> |
|
|
|
:before-close="handleClose" |
|
|
|
<el-button type="danger" :icon="Delete" circle size="small" plain @click="delObject(obj.id)" /> |
|
|
|
> |
|
|
|
<span>【{{ data.name }}】</span> |
|
|
|
<el-form |
|
|
|
</div> |
|
|
|
:model="formData" |
|
|
|
|
|
|
|
label-width="auto" |
|
|
|
</li> |
|
|
|
style="max-width: 600px" |
|
|
|
</el-scrollbar> |
|
|
|
> |
|
|
|
<el-button @click="addObject" circle size="small" type="primary" plain class="addbutton"> |
|
|
|
<el-form-item label="内容" prop="description"> |
|
|
|
<el-icon :size="15"> |
|
|
|
<el-input |
|
|
|
<Plus /> |
|
|
|
v-model="formData.description" |
|
|
|
</el-icon> |
|
|
|
placeholder="请输入内容" |
|
|
|
</el-button> |
|
|
|
></el-input> |
|
|
|
<el-dialog v-if="dialogVisible" v-model="dialogVisible" :title="flog ? '编辑' : '新增'" width="500" |
|
|
|
|
|
|
|
:before-close="handleClose"> |
|
|
|
|
|
|
|
<el-form :model="type"> |
|
|
|
|
|
|
|
<el-form-item label="目标类别"> |
|
|
|
|
|
|
|
<el-select v-model="type.name" placeholder="请选择目标类别"> |
|
|
|
|
|
|
|
<el-option v-for="item in type" :key="item.id" :label="item.name" :value="item.name"></el-option> |
|
|
|
|
|
|
|
</el-select> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</el-form> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form :model="formData" label-width="auto" style="max-width: 600px"> |
|
|
|
|
|
|
|
<el-form-item label="目标内容" prop="description"> |
|
|
|
|
|
|
|
<el-input v-model="formData.description" placeholder="请输入内容"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
</el-form> |
|
|
|
<template #footer> |
|
|
|
<template #footer> |
|
|
@ -268,6 +298,7 @@ const submit = async () => { |
|
|
|
<el-button @click="close">取消</el-button> |
|
|
|
<el-button @click="close">取消</el-button> |
|
|
|
<el-button type="primary" @click="submit">确定</el-button> |
|
|
|
<el-button type="primary" @click="submit">确定</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</el-dialog> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -275,6 +306,10 @@ const submit = async () => { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<style lang="scss" scoped> |
|
|
|
<style lang="scss" scoped> |
|
|
|
|
|
|
|
li { |
|
|
|
|
|
|
|
list-style-type: none; //去掉标签默认的左边符号 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.el-tabs__item { |
|
|
|
.el-tabs__item { |
|
|
|
padding: 0 50px; |
|
|
|
padding: 0 50px; |
|
|
|
} |
|
|
|
} |
|
|
@ -367,65 +402,81 @@ const submit = async () => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.typeObject { |
|
|
|
.typeObject { |
|
|
|
width: 70%; |
|
|
|
width: 60%; |
|
|
|
// height: 80%; |
|
|
|
height: 80%; |
|
|
|
text-align: center; |
|
|
|
// text-align: center; |
|
|
|
|
|
|
|
|
|
|
|
// align-items: center; |
|
|
|
|
|
|
|
ul:nth-child(-n + 3) { |
|
|
|
|
|
|
|
border-bottom: none; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ul { |
|
|
|
|
|
|
|
width: 90%; |
|
|
|
|
|
|
|
border: 1px solid #dcdfe6; |
|
|
|
border: 1px solid #dcdfe6; |
|
|
|
|
|
|
|
margin-right: 35px; |
|
|
|
|
|
|
|
padding: 20px; |
|
|
|
|
|
|
|
position: relative; |
|
|
|
|
|
|
|
|
|
|
|
// box-shadow: 1px -5px 6px rgba(153, 150, 150, 0.5); |
|
|
|
.icon { |
|
|
|
|
|
|
|
margin-left: 700px; |
|
|
|
|
|
|
|
// display: inline-block; |
|
|
|
|
|
|
|
// position: absolute; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.all { |
|
|
|
.addbutton { |
|
|
|
display: flex; |
|
|
|
position: absolute; |
|
|
|
width: 100%; |
|
|
|
right: 20px; |
|
|
|
// box-shadow: 1px 1px 6px rgba(153, 150, 150, 0.5); |
|
|
|
bottom: 20px; |
|
|
|
// align-content: center; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.left { |
|
|
|
// align-items: center; |
|
|
|
width: 20%; |
|
|
|
// ul:nth-child(-n + 3) { |
|
|
|
display: flex; |
|
|
|
// border-bottom: none; |
|
|
|
justify-content: center; |
|
|
|
// } |
|
|
|
border-right: 1px solid #dcdfe6; |
|
|
|
|
|
|
|
flex-wrap: wrap; |
|
|
|
|
|
|
|
align-content: center; |
|
|
|
|
|
|
|
letter-spacing: 1px; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.icon { |
|
|
|
// ul { |
|
|
|
margin-left: 10px; |
|
|
|
// width: 90%; |
|
|
|
} |
|
|
|
// border: 1px solid #dcdfe6; |
|
|
|
|
|
|
|
|
|
|
|
.icon:hover { |
|
|
|
// // box-shadow: 1px -5px 6px rgba(153, 150, 150, 0.5); |
|
|
|
cursor: pointer; |
|
|
|
// } |
|
|
|
color: red; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.objectdetails { |
|
|
|
// .all { |
|
|
|
padding-right: 20px; |
|
|
|
// display: flex; |
|
|
|
width: 100%; |
|
|
|
// width: 100%; |
|
|
|
// border: 1px solid #8a8b99; |
|
|
|
// // box-shadow: 1px 1px 6px rgba(153, 150, 150, 0.5); |
|
|
|
|
|
|
|
// // align-content: center; |
|
|
|
|
|
|
|
|
|
|
|
li { |
|
|
|
// .left { |
|
|
|
width: 100%; |
|
|
|
// width: 20%; |
|
|
|
display: flex; |
|
|
|
// display: flex; |
|
|
|
justify-content: space-between; |
|
|
|
// justify-content: center; |
|
|
|
flex-wrap: wrap; |
|
|
|
// border-right: 1px solid #dcdfe6; |
|
|
|
|
|
|
|
// flex-wrap: wrap; |
|
|
|
// align-content: center; |
|
|
|
// align-content: center; |
|
|
|
align-items: center; |
|
|
|
// letter-spacing: 1px; |
|
|
|
line-height: 1; |
|
|
|
|
|
|
|
margin-top: 2px; |
|
|
|
// .icon { |
|
|
|
letter-spacing: 1px; |
|
|
|
// margin-left: 10px; |
|
|
|
} |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
// .icon:hover { |
|
|
|
|
|
|
|
// cursor: pointer; |
|
|
|
|
|
|
|
// color: red; |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// .objectdetails { |
|
|
|
|
|
|
|
// padding-right: 20px; |
|
|
|
|
|
|
|
// width: 100%; |
|
|
|
|
|
|
|
// // border: 1px solid #8a8b99; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// li { |
|
|
|
|
|
|
|
// width: 100%; |
|
|
|
|
|
|
|
// display: flex; |
|
|
|
|
|
|
|
// justify-content: space-between; |
|
|
|
|
|
|
|
// flex-wrap: wrap; |
|
|
|
|
|
|
|
// // align-content: center; |
|
|
|
|
|
|
|
// align-items: center; |
|
|
|
|
|
|
|
// line-height: 1; |
|
|
|
|
|
|
|
// margin-top: 2px; |
|
|
|
|
|
|
|
// letter-spacing: 1px; |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// } |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|