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

入口编辑页 对接api

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