feat : 模板列表数据获取,模板编辑修改

This commit is contained in:
王熙东
2022-11-23 15:35:00 +08:00
parent 97b357066c
commit 1636fbfd6f
5 changed files with 58 additions and 151 deletions

View File

@@ -311,17 +311,19 @@
</div>
</template>
<script>
import { reactive, toRefs, ref } from "vue";
import { reactive, toRefs, ref,onMounted } from "vue";
import { message } from "ant-design-vue";
import { useRouter, useRoute } from "vue-router";
// import dayjs from "dayjs";
import * as api from "../../api/indexTemplate";
import { storage } from "../../api/storage";
import {useStore} from "vuex";
// import { toDate } from "../../api/method";
export default {
name: "projectAdd",
setup() {
const store = useStore();
// 编辑页面跳转过来时候,自动填充表格
const routers = useRoute();
const isEdit = ref(false);
@@ -580,23 +582,7 @@ export default {
console.log(`selected ${key}`, classifyList4);
// systemid = key;
};
//模版滚动加载信息
const templateScroll = (e) => {
// console.log("滚动", e, b);
const { target } = e;
const scrllHeight = target.scrollHeight - target.scrollTop;
const clientHeight = target.clientHeight;
// console.log("scrllHeight", scrllHeight, clientHeight);
if (scrllHeight === 0 && clientHeight === 0) {
state.currentPage = 1;
} else if (scrllHeight - clientHeight == 0) {
// 下拉到底部时
if (state.currentPage < state.totalPages) {
// 如果滑到底部,则加载下一页
state.currentPage++;
}
}
};
// const removeFile = (file) => {
// const index = fileList1.value.indexOf(file);
@@ -619,6 +605,9 @@ export default {
// attach = attachStr;
// };
onMounted(() => {
})
const errorMsgs = {
name: "请输入模板名称",
category: "请选择模板分类",
@@ -646,11 +635,11 @@ export default {
"sourceBelongId": state.projectInfo.sourceBelongId,
"level": state.projectInfo.level,
"systemId": state.projectInfo.systemId,
"boeFlag": state.projectInfo.boeFlag,
"courseSyncFlag": state.projectInfo.courseSyncFlag,
"boeFlag": state.projectInfo.boeFlag ? 1:0,
"courseSyncFlag": state.projectInfo.courseSyncFlag? 1:0,
"notice": "",
"noticeFlag": 0,
"projectTemplateId": 0,
"projectTemplateId": store.state.projectTemplateId,
"remark": "",
"status": 0,
@@ -667,25 +656,7 @@ export default {
}
}
api
.templateEdit({
"beginTime": 0,
"boeFlag": 0,
"category": 0,
"courseSyncFlag": 0,
"endTime": 0,
"level": 0,
"manager": "",
"managerId": "",
"name": "",
"notice": "",
"noticeFlag": 0,
"picUrl": "",
"projectTemplateId": 0,
"remark": "",
"sourceBelongId": 0,
"status": 0,
"systemId": 0
})
.templateEdit(obj)
.then((res) => {
console.log(res);
if (res.status == 200 && res.data.code == 200) {
@@ -708,35 +679,6 @@ export default {
});
};
// 编辑项目模板
const editTemplate = () => {
let obj = {
"beginTime": state.projectInfo.time,
"boeFlag": state.projectInfo.boeFlag,
"category": 0,
"courseSyncFlag": state.projectInfo.courseSyncFlag,
"endTime": state.projectInfo.time,
"level": state.projectInfo.level,
"manager": state.projectInfo.manager,
"managerId": "",
"name": state.projectInfo.name,
"notice": "",
"noticeFlag": 0,
"picUrl": "",
"projectTemplateId": 0,
"remark": state.projectInfo.remark,
"sourceBelongId": state.projectInfo.sourceBelongId,
"status": 0,
"systemId": state.projectInfo.systemId
};
api.templateEdit(obj).methods(obj).then(res => {
message.success("编辑成功")
console.log(res)
}).catch(err => {
message.error("编辑失败"+err)
console.log(err)
})
}
return {
...toRefs(state),
@@ -766,8 +708,6 @@ export default {
isEdit,
backPage,
dateFormatList,
editTemplate,
templateScroll,
};
},
};