提交 64d4716f 编写于 作者: zhentian.jia's avatar zhentian.jia

入口编辑页 对接api

上级 6e260644
......@@ -270,5 +270,16 @@ const vueFilter = {
list = list.substring(0, list.length - 1);
return list
},
entryStatusType: (value) => {
if(value == 1) {
return '草稿';
} else if(value == 2) {
return '未上架';
} else if(value == 3) {
return '已上架';
} else if(value == 4) {
return '已下架';
}
}
}
export default vueFilter
\ No newline at end of file
......@@ -4,8 +4,8 @@
<div class="component-content screenSet" id="screenSet">
<div class="header-title">{{ title }}</div>
<div class="button-group">
<el-button size="small" @click="complete(0)">暂存</el-button>
<el-button type="primary" size="small" @click="complete(1)">完成</el-button>
<el-button size="small" @click="complete(1)">暂存</el-button>
<el-button type="primary" size="small" @click="complete(2)">完成</el-button>
</div>
<el-form
ref="formData"
......@@ -52,9 +52,9 @@
</el-form-item>
<el-form-item label="项目时间:" required>
<el-col :span="5">
<el-form-item prop="projectBegintime">
<el-form-item prop="entryBegintime">
<el-date-picker
v-model="formData.projectBegintime"
v-model="formData.entryBegintime"
size="small"
type="datetime"
placeholder="请选择开始时间"
......@@ -67,9 +67,9 @@
</el-col>
<el-col class="line" :span="1">~</el-col>
<el-col :span="5">
<el-form-item label prop="projectEndtime">
<el-form-item label prop="entryEndtime">
<el-date-picker
v-model="formData.projectEndtime"
v-model="formData.entryEndtime"
size="small"
type="datetime"
placeholder="请选择结束时间"
......@@ -82,18 +82,18 @@
</el-form-item>
</el-col>
</el-form-item>
<el-form-item label="项目简介:" prop="projectIntro">
<el-form-item label="项目简介:" prop="entryIntro">
<el-col :span="13">
<el-input
size="small"
type="textarea"
:autosize="{ minRows: 5}"
placeholder="请输入项目简介"
v-model="formData.projectIntro"
v-model="formData.entryIntro"
style="width:83%;"
:disabled="peopleLevel == 'L3'"
></el-input>
<span class="word-num">{{(formData.projectIntro).replace(/\s+/g,"").length}}/200</span>
<span class="word-num">{{(formData.entryIntro).replace(/\s+/g,"").length}}/200</span>
</el-col>
</el-form-item>
<div class="basic-item-icon">
......@@ -266,7 +266,7 @@ export default {
curmbSecond: "项目组件",
curmbThird: "新建入口",
title: "",
projectId: null,
entryId: null,
peopleLevel: null,
uploadImgMessage: false,
uploadImgMessage2: false,
......@@ -275,26 +275,29 @@ export default {
organizationContent: "云鹊医",
formData: {
entryName: "",
projectBegintime: "",
projectEndtime: "",
projectIntro: "",
entryBegintime: "",
entryEndtime: "",
entryIntro: "",
type: 1,
attachmentUrl1: "",
attachmentUrl2: "",
attachmentMore1: {},
attachmentMore2: {},
organizationName: "",
project: []
},
optionsProject: [],
tagsProject: [],
visibleName: false,
entryOptionData: {},
pickerOptions0: {
disabledDate: time => {
if (
this.formData.projectEndtime != "" &&
this.formData.projectEndtime != null
this.formData.entryEndtime != "" &&
this.formData.entryEndtime != null
) {
return (
time.getTime() > new Date(this.formData.projectEndtime).getTime()
time.getTime() > new Date(this.formData.entryEndtime).getTime()
);
}
}
......@@ -302,7 +305,7 @@ export default {
pickerOptions1: {
disabledDate: time => {
return (
time.getTime() < new Date(this.formData.projectBegintime).getTime()
time.getTime() < new Date(this.formData.entryBegintime).getTime()
); //减去一天的时间代表可以选择同一天;
}
},
......@@ -326,14 +329,14 @@ export default {
trigger: "blur"
}
],
projectBegintime: [
entryBegintime: [
{
required: true,
message: "请选择时间",
trigger: "change"
}
],
projectEndtime: [
entryEndtime: [
{
required: true,
message: "请选择时间",
......@@ -348,7 +351,7 @@ export default {
trigger: "change"
}
],
projectIntro: [
entryIntro: [
{ required: true, message: "请填写项目简介", trigger: "blur" },
{ min: 1, max: 200, message: "超出可输入的最大长度", trigger: "blur" }
],
......@@ -366,17 +369,18 @@ export default {
},
created() {
vm = this;
vm.projectId = vm.getUrlSearch(window.location.href, "projectId");
vm.entryId = vm.getUrlSearch(window.location.href, "entryId");
vm.peopleLevel = vm.getUrlSearch(window.location.href, "level");
vm.initTitle();
vm.initOption();
vm.getEntryData();
},
mounted: function() {
commonUtil.resizeHeight();
},
methods: {
initTitle() {
if (vm.projectId == null) {
if (vm.entryId == null) {
vm.title = "新建入口";
vm.curmbThird = "新建入口";
} else {
......@@ -503,6 +507,7 @@ export default {
attachmentExt: path.ext,
attachmentSize: path.size
};
console.log("!!!" + vm.formData[fileLimit.key]);
vm.$message.success("上传成功");
});
}
......@@ -559,7 +564,7 @@ export default {
},
changeOrganizationName() {
let textLength = vm.formData.organizationName.length;
console.log("文字长度", textLength);
// console.log("文字长度", textLength);
if (textLength == 0) {
vm.visibleName = true;
} else {
......@@ -568,15 +573,15 @@ export default {
},
tagDrop() {
this.$nextTick(function() {
if(vm.tagsProject.length > 0) {
const ele = document.querySelector('.check-project .el-col-10');
if (vm.tagsProject.length > 0) {
const ele = document.querySelector(".check-project .el-col-10");
// console.log('ele',ele);
Sortable.create(ele, {
onEnd({ newIndex, oldIndex }) {
const currRow = vm.tagsProject.splice(oldIndex, 1)[0]
vm.tagsProject.splice(newIndex, 0, currRow)
const currRow = vm.tagsProject.splice(oldIndex, 1)[0];
vm.tagsProject.splice(newIndex, 0, currRow);
}
})
});
}
});
},
......@@ -606,13 +611,160 @@ export default {
vm.formData.project[j] = vm.tagsProject[j].value;
}
},
getEntryData() {
if (vm.entryId == null) {
return;
}
let req = {
entryId: vm.entryId
};
openLoading(vm);
vm.GET("portal/entryInfo/getEntry", req).then(res => {
closeLoading(vm);
if (res.code == "000000") {
vm.setEditData(res.data);
vm.entryOptionData = res.data;
console.log("portalEntryUniInfo", vm.entryOptionData);
} else {
vm.$message(res.message);
}
});
},
setEditData(data) {
vm.formData = {
entryName: data.portalEntry.entryName,
organizationName: data.portalEntry.organizationName,
entryBegintime: data.portalEntry.entryBegintime,
entryEndtime: data.portalEntry.entryEndtime,
entryIntro: data.portalEntry.entryIntro,
// type: 1,
// attachmentUrl1: "",
// attachmentUrl2: "",
type: data.attachments[1].attachmentType,
attachmentUrl1: data.attachments[0].attachmentUrl,
attachmentUrl2: data.attachments[1].attachmentUrl,
attachmentMore1: {
attachmentName: data.attachments[0].attachmentName,
},
attachmentMore2: {
attachmentName: data.attachments[1].attachmentName,
}
};
},
complete(type) {
console.log("type:" + type);
if (type == 1) {
//1是暂存,2是完成
if (type == 2) {
if (!vm.formData.attachmentUrl1) {
vm.uploadImgMessage = true;
} else {
vm.uploadImgMessage = false;
}
if (!vm.formData.attachmentUrl2) {
vm.uploadImgMessage2 = true;
} else {
vm.uploadImgMessage2 = false;
}
let completeState = vm.submitForm("formData");
if (
completeState === true &&
vm.formData.attachmentUrl1 != "" &&
vm.formData.attachmentUrl2 != ""
) {
vm.insertOrUpdate(type);
}
//完成
} else {
//暂存
}
},
insertOrUpdate(isCompleted) {
//option
let portalEntryUniInfo = {};
if (vm.entryId == null) {
portalEntryUniInfo = {
portalEntry: {
entryBegintime: vm.formData.entryBegintime,
entryEndtime: vm.formData.entryEndtime,
entryIntro: vm.formData.entryIntro,
entryName: vm.formData.entryName,
organizationName: vm.formData.organizationName
},
attachments: [
{
attachmentType: 1,
attachmentUrl: vm.formData.attachmentUrl1,
attachmentName: vm.formData.attachmentMore1.attachmentName,
// attachmentExt: vm.formData.attachmentMore1.attachmentExt,
// attachmentSize: vm.formData.attachmentMore1.attachmentSize,
kind: 1,
// seqNo: 1
},
{
attachmentType: vm.formData.type,
attachmentUrl: vm.formData.attachmentUrl2,
attachmentName: vm.formData.attachmentMore2.attachmentName,
// attachmentExt: vm.formData.attachmentMore2.attachmentExt,
// attachmentSize: vm.formData.attachmentMore2.attachmentSize,
kind: 2,
// seqNo: 1
}
],
subprojects: []
};
} else {
portalEntryUniInfo = {
portalEntry: {
createdId: vm.entryOptionData.portalEntry.createdId,
createdName: vm.entryOptionData.portalEntry.createdName,
createdTime: vm.entryOptionData.portalEntry.createdTime,
deleteFlag: vm.entryOptionData.portalEntry.deleteFlag,
entryBegintime: vm.formData.entryBegintime,
entryEndtime: vm.formData.entryEndtime,
entryIntro: vm.formData.entryIntro,
entryName: vm.formData.entryName,
entryStatus: vm.entryOptionData.portalEntry.entryStatus,
id: vm.entryOptionData.portalEntry.id,
// modifiedId: 0,
// modifiedTime: "2019-11-11T05:51:12.811Z",
organizationId: vm.entryOptionData.portalEntry.createdId,
organizationName: vm.formData.organizationName
},
attachments: [
{
attachmentType: 1,
attachmentUrl: vm.formData.attachmentUrl1,
attachmentName: vm.formData.attachmentMore1.attachmentName,
entryId: vm.entryOptionData.portalEntry.id,
id: vm.entryOptionData.portalEntry.id,
kind: 1,
// seqNo: 1
},
{
attachmentType: vm.formData.type,
attachmentUrl: vm.formData.attachmentUrl2,
attachmentName: vm.formData.attachmentMore2.attachmentName,
entryId: vm.entryOptionData.portalEntry.id,
id: vm.entryOptionData.portalEntry.id,
kind: 2,
// seqNo: 1
}
],
subprojects: []
};
}
console.log("portalEntryUniInfo", portalEntryUniInfo);
openLoading(vm);
vm.POST(
"portal/entryInfo/updateInsertEntry?isCompleted=" + isCompleted,
portalEntryUniInfo
).then(res => {
closeLoading(vm);
if (res.code == "000000") {
vm.$router.push("entry-manager");
} else {
vm.$message.error(res.message);
}
});
}
}
};
......
......@@ -2,37 +2,54 @@
<div class="entry-manager">
<bread-crumb :curmbFirst="curmbFirst"></bread-crumb>
<div class="component-content screenSet" id="screenSet">
<el-form :model="formInline" ref="formInline" label-width="75px" class="form-inline">
<el-col :span="6">
<el-form-item label="入口名称:">
<el-input size="small" v-model="formInline.name" placeholder="请输入名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="2"></el-col>
<el-col :span="12">
<el-button type="primary" size="small">查询</el-button>
</el-col>
<el-col :span="4" style="padding:0;text-align:right;padding-right:10px;">
<el-button type="primary" size="small" @click="toPage()">新建入口</el-button>
</el-col>
</el-form>
<el-row>
<el-form :model="formInline" ref="formInline" label-width="75px" class="form-inline">
<el-col :span="8">
<el-form-item label="入口名称:">
<el-input size="small" v-model="formInline.entryName" placeholder="请输入名称"></el-input>
</el-form-item>
</el-col>
<el-col :span="16" style="padding:0;text-align:right;padding-right:10px;">
<el-button type="primary" @click="search()" size="small">查询</el-button>
<el-button type="primary" @click="resetForm()" size="small">重置</el-button>
</el-col>
</el-form>
</el-row>
<el-row>
<el-button class="button-jump" type="primary" size="small" @click="toPage()">新建入口</el-button>
</el-row>
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="id" label="ID编号" align="center"></el-table-column>
<el-table-column prop="project" label="入口名称" align="center"></el-table-column>
<el-table-column prop="name" label="创建人" align="center"></el-table-column>
<el-table-column prop="createTime" label="创建时间" align="center"></el-table-column>
<el-table-column prop="desc" label="入口介绍" align="center"></el-table-column>
<el-table-column prop="startTime" label="开始时间" align="center"></el-table-column>
<el-table-column prop="endTime" label="介绍时间" align="center"></el-table-column>
<el-table-column prop="status" label="状态" align="center">
<template slot-scope="scope">{{ scope.row.status | shieldStatus }}</template>
<el-table-column prop="createdTime" width="100" label="入口创建时间" align="center"></el-table-column>
<el-table-column prop="entryName" label="入口名称" align="center"></el-table-column>
<el-table-column prop="createdName" label="创建人" align="center"></el-table-column>
<el-table-column prop="entryIntro" label="入口介绍" align="center"></el-table-column>
<el-table-column prop="entryBegintime" width="100" label="开始时间" align="center"></el-table-column>
<el-table-column prop="entryEndtime" width="100" label="结束时间" align="center"></el-table-column>
<el-table-column prop="entryStatus" label="状态" align="center">
<template slot-scope="scope">{{ scope.row.entryStatus | entryStatusType }}</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="350" align="center">
<el-table-column fixed="right" label="操作" width="250" align="center">
<template slot-scope="scope">
<el-button type="primary" @click="toPage(scope.row.id)" size="small">编辑</el-button>
<el-button type="primary" @click="openDialog('up',scope.row)" size="small">上架</el-button>
<el-button type="primary" size="small">下架</el-button>
<el-button type="primary" size="small">删除</el-button>
<el-button
type="primary"
v-show="showButton(scope.row.entryStatus,1)"
@click="openDialog('up',scope.row)"
size="small"
>上架</el-button>
<el-button
type="primary"
v-show="showButton(scope.row.entryStatus,2)"
@click="changeStatus(scope.row.id, 4)"
size="small"
>下架</el-button>
<el-button
type="primary"
v-show="showButton(scope.row.entryStatus,3)"
@click="delEntry(scope.row, 5)"
size="small"
>删除</el-button>
</template>
</el-table-column>
</el-table>
......@@ -54,12 +71,20 @@
<p v-if="childrenNum == 0" class="dialog_p">该项目已关联0个子项目</p>
<p v-if="childrenNum == 0" class="dialog_p">继续上架,将在APP端无法显示该项目</p>
<span v-if="childrenNum > 0" slot="footer" class="dialog-footer">
<el-button @click="dialogUp = false">确认上架</el-button>
<el-button type="primary" @click="dialogUp = false">取消</el-button>
<el-button @click="dialogUp = false">取消</el-button>
<el-button type="primary" @click="changeStatus(null,3)">确定上架</el-button>
</span>
<span v-if="childrenNum == 0" slot="footer" class="dialog-footer">
<el-button @click="dialogUp = false">取消</el-button>
<el-button type="primary" @click="dialogUp = false">确定上架</el-button>
<el-button @click="changeStatus(null,3)">确认上架</el-button>
<el-button type="primary" @click="dialogUp = false">取消</el-button>
</span>
</el-dialog>
<el-dialog title="确认上架" :visible.sync="dialogDel" width="30%" center>
<p class="dialog_p">删除后,该项目将不存在</p>
<p class="dialog_p">同时释放该项目关联的所有子项目</p>
<span slot="footer" class="dialog-footer">
<el-button @click="changeStatus(null,5)">确认上架</el-button>
<el-button type="primary" @click="dialogDel = false">取消</el-button>
</span>
</el-dialog>
</div>
......@@ -81,25 +106,15 @@ export default {
curmbFirst: "入口管理",
totalRows: 0,
formInline: {
name: "",
entryName: "",
pageNo: 1,
pageSize: 10
},
tableData: [
{
id: 123,
project: "小何同学的项目",
name: "小王同学",
createTime: "2019-09-09",
desc: "小王同学",
startTime: "2019-10-10",
endTime: "2019-12-10",
status: 1
}
],
tableData: [],
dialogUp: false,
dialogDel: false,
childrenNum: 1,
scopeRow: {},
scopeRow: {}
};
},
computed: {
......@@ -107,11 +122,51 @@ export default {
},
created() {
vm = this;
vm.search();
},
mounted: function() {
commonUtil.resizeHeight();
},
methods: {
searchData() {
vm.formInline.pageNo = 1;
vm.search();
},
search() {
let req = {};
req = vm.formInline;
openLoading(vm);
vm.GET("portal/entryInfo/getEntryList", req).then(res => {
closeLoading(vm);
if (res.code == "000000") {
vm.tableData = res.data.data;
vm.totalRows = res.data.totalRows;
} else {
vm.$message(res.message);
}
});
},
showButton(status, option) {
//status 1.草稿,2.未上架,3.已上架,4.已下架
//option 0.编辑,1上架,2下架,3删除
status = status - 1;
let showArray = [
[true, false, false, true],
[true, true, false, true],
[true, false, true, false],
[true, true, false, true]
];
let showType = showArray[status][option];
return showType;
},
resetForm() {
vm.formInline = {
entryName: "",
pageNo: 1, //当前是第几页
pageSize: 10 //页面总数
};
vm.search();
},
handleSizeChange(val) {
console.log(`每页 ${val} 条`);
this.formInline.pageSize = val;
......@@ -125,12 +180,46 @@ export default {
if (id === undefined) {
this.$router.push("edit-entry");
} else {
this.$router.push("edit-entry?projectId=" + id);
this.$router.push("edit-entry?entryId=" + id);
}
},
openDialog(type,row) {
openDialog(type, row) {
vm.scopeRow = row;
vm.dialogUp = true;
},
changeStatus(id, changeTo) {
vm.dialogUp = false;
let req = {};
let entryId = id;
if (entryId == null) {
entryId = vm.scopeRow.id;
}
openLoading(vm);
vm.POST(
"portal/entryInfo/changeStatus?entryId=" +
entryId +
"&changeTo=" +
changeTo,
req
).then(res => {
closeLoading(vm);
if (res.code == "000000") {
vm.$message(res.message);
} else {
vm.$message(res.message);
}
vm.search();
});
},
delEntry(row, changeTo) {
vm.scopeRow = row;
vm.$nextTick(() => {
if (vm.scopeRow.entryStatus == 4) {
vm.dialogDel = true;
} else {
vm.changeStatus(vm.scopeRow.id, changeTo);
}
});
}
}
};
......@@ -143,6 +232,11 @@ export default {
.dialog_p {
text-align: center;
}
.button-jump {
margin-right: 10px;
margin-bottom: 10px;
float: right;
}
}
}
</style>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册