Browse Source

新增,显示列表

V4.3.3
是小王呀\24601 2 years ago
parent
commit
0fc09f31f3
  1. 334
      src/views/modules/communityParty/comPromotion/index.vue
  2. 14
      src/views/modules/cpts/base/cpts/edit.vue
  3. 1
      src/views/modules/cpts/base/index.vue

334
src/views/modules/communityParty/comPromotion/index.vue

@ -1,23 +1,23 @@
<template>
<div>
<base-page ref="basePage" :tableData="tableData" :searchParams="searchParams" :tableParams="tableParams" :tableUrl="tableUrl"
<base-page ref="basePage" :cookTableData="cookTableData" :searchParams="searchParams" :tableParams="tableParams" :tableUrl="tableUrl"
:addUrl="addUrl" :editUrl="editUrl" :delUrl="delUrl" :editAuth="editAuth" :delAuth="delAuth" :infoUrl="infoUrl"
:exportUrl="exportUrl" :importUrl="importUrl" :mubanUrl="mubanUrl" :editParams="editParams"
:editFixedParams="editFixedParams" :editElseRules="editElseRules" :editConfig="editConfig" :editParamsDiv="5"
:editBtnName="(item) => '修改'" :formBtnFixed="true" idName="articleId">
<template v-slot:editOperateSup="{ id, formType, info }">
<!-- <template v-slot:editOperateSup="{ id, formType, info }">
<el-button v-if="formType == 'add'" type="warning" size="small" :disabled="draftBtnDisable"
@click="handleClickDraft(info)">存草稿</el-button>
</template>
</template> -->
<template v-slot:listBtnSup="{ item }">
<el-button v-if="item.statusFlag == 'published' &&
<el-button v-if="item.status == 'published' &&
item.agencyId == $store.state.user.agencyId
" @click="handleOfflineShow(item)" type="text" size="small" style="color: #666">下线</el-button>
</template>
<template v-slot:listBtnbefore="{ item }">
<el-button v-if="item.isTop == '1'" v-show="item.statusFlag == 'published'"
<el-button v-if="item.Top == '1'" v-show="item.statusFlag == 'published'"
@click="handleCancleTopArticle(item, 'cancel_top')" type="text" size="small"
style="color: #fe6252">取消置顶</el-button>
<el-button v-show="item.statusFlag == 'published'" v-else @click="handleTopArticle(item, 'top')" type="text"
@ -127,29 +127,54 @@ export default {
{ field: "文章标题", keyName: "title", type: "text" },
{
field: "标签",
keyName: "tagNameList",
type: "array",
keyName: "tagId",
type: "text",
arrayDiv: "、",
},
{ field: "状态", keyName: "statusFlagName", type: "text" },
{ field: "状态", keyName: "status", type: "text" },
{ field: "发布单位", keyName: "publisherName", type: "text" },
{ field: "发布时间", keyName: "publishDate", type: "text" },
{ field: "发布时间", keyName: "releaseTime", type: "text" },
{
field: "发布范围",
keyName: "publishRangeDesc",
type: "text",
},
{ field: "置顶", keyName: "isTopName", type: "text" },
{ field: "置顶", keyName: "top", type: "text" },
{ field: "点赞数", keyName: "likeCount", type: "text" },
{ field: "转发量", keyName: "forwardCount", type: "text" },
],
tableUrl: "/gov/voice/article/articleListV2",
cookTableData(tableData) {
let tabledata= tableData.map((item) => {
console.log(item)
item.status=item.status?"已发布":"已下线"
item.top=item.top?"是":"否"
return item;
}
)
console.log(tabledata)
return tabledata;
},
cookParams(params) {
let newParams = {};
if (params.publishRangeType == "grid") {
newParams["gridId"] = params.publishRangeId;
} else {
newParams["agencyId"] = params.publishRangeId;
}
newParams["startDate"] = params.startDate;
newParams["endDate"] = params.endDate;
return newParams;
},
tableUrl: "/actual/base/communityPublicity/page",
mubanUrl: "",
importUrl: "",
exportUrl: "",
addUrl: "/gov/voice/article/addOrSaveDraft",
editUrl: "/gov/voice/article/updateArticle",
addUrl: "/actual/base/communityPublicity/save",
editUrl: "/actual/base/communityPublicity/update",
infoUrl: "/gov/voice/article/detailV2",
delUrl: "/gov/voice/article/delete批量",
editAuth(item) {
@ -184,7 +209,7 @@ export default {
rules: [],
value: () => [],
uploadUrl: window.SITE_CONFIG["apiURL"] + "/oss/file/article/upload",
supKeys: ["imgUrlArr", "imgUrl"],
supKeys: ["imgUrlArr", "coverPic"],
supValues: [() => [], ""],
beforeImgUpload(file, item, that) {
console.log(file);
@ -202,67 +227,67 @@ export default {
return true;
},
},
{
field: "发布范围",
keyName: "gridIdList",
type: "cascader",
value: () => [],
supKeys: ["publishRangeDesc"],
supValues: [""],
optionUrl: "/gov/org/customeragency/agencygridtree",
optionUrlParams: {
agencyId: this.$store.state.user.agencyId,
},
optionList: [],
optionProps: {
multiple: true,
value: "agencyId",
label: "agencyName",
children: "subAgencyList",
checkStrictly: false,
emitPath: false,
},
optionCook(obj) {
return [obj];
},
handleChangeFn(vals, item, that) {
console.log("handleChangeFn", vals);
const { optionList } = item;
const optionPlaneList = collapse(optionList, "subAgencyList");
if (vals.length > 0) {
let selectedList = vals.map(
(v) =>
getItemByIdInCascader(
optionPlaneList,
[v],
"agencyId",
"subAgencyList"
)[0]
);
console.log("handleChangeFn", selectedList);
let selectedFilterList = selectedList.filter(
(a) => a.level == "grid"
);
that.fmData[item["keyName"]] = selectedFilterList.map(
(a) => a.agencyId
);
that.fmData[item["supKeys"][0]] = selectedFilterList
.map((a) => a.agencyName)
.join("、");
} else {
}
},
rules: [
{
required: true,
message: "发布范围不能为空",
trigger: "blur",
},
],
},
// {
// field: "",
// keyName: "gridIdList",
// type: "cascader",
// value: () => [],
// supKeys: ["publishRangeDesc"],
// supValues: [""],
// optionUrl: "/gov/org/customeragency/agencygridtree",
// optionUrlParams: {
// agencyId: this.$store.state.user.agencyId,
// },
// optionList: [],
// optionProps: {
// multiple: true,
// value: "agencyId",
// label: "agencyName",
// children: "subAgencyList",
// checkStrictly: false,
// emitPath: false,
// },
// optionCook(obj) {
// return [obj];
// },
// handleChangeFn(vals, item, that) {
// console.log("handleChangeFn", vals);
// const { optionList } = item;
// const optionPlaneList = collapse(optionList, "subAgencyList");
// if (vals.length > 0) {
// let selectedList = vals.map(
// (v) =>
// getItemByIdInCascader(
// optionPlaneList,
// [v],
// "agencyId",
// "subAgencyList"
// )[0]
// );
// console.log("handleChangeFn", selectedList);
// let selectedFilterList = selectedList.filter(
// (a) => a.level == "grid"
// );
// that.fmData[item["keyName"]] = selectedFilterList.map(
// (a) => a.agencyId
// );
// that.fmData[item["supKeys"][0]] = selectedFilterList
// .map((a) => a.agencyName)
// .join("");
// } else {
// }
// },
// rules: [
// {
// required: true,
// message: "",
// trigger: "blur",
// },
// ],
// },
{
field: "发布时间",
keyName: "publishDate",
keyName: "releaseTime",
type: "date",
value: dateFormat(new Date(), "yyyy-MM-dd"),
pickerOptions: {
@ -278,91 +303,100 @@ export default {
},
],
},
{
field: "发布单位",
keyName: "publisher",
type: "select",
optionUrl: "/gov/voice/article/publishagencylist",
optionList: [],
optionType: "group",
supKeys: ["publisherName", "publisherType"],
supValues: ["", ""],
optionCook(data) {
let ret = [];
const { agencyDeptList, agencyGridList, agencyId, agencyName } =
data;
if (agencyId) {
ret.push({
label: "以组织名义",
optionList: [
{
label: agencyName,
value: agencyId,
type: "agency",
},
],
});
}
if (Array.isArray(agencyDeptList) && agencyDeptList.length > 0) {
ret.push({
label: "以部门名义",
optionList: [
...agencyDeptList.map((d) => ({
label: d.agencyDeptName,
value: d.departmentId,
type: "department",
})),
],
});
}
if (Array.isArray(agencyGridList) && agencyGridList.length > 0) {
ret.push({
label: "以网格名义",
optionList: [
...agencyGridList.map((d) => ({
label: d.agencyGridName,
value: d.gridId,
type: "grid",
})),
],
});
}
return ret;
},
handleChangeFn(vals, item, that) {
const { optionList } = item;
let opts = [];
optionList.forEach((g) => {
opts = [...opts, ...g.optionList];
});
let publisher = opts.find((p) => vals == p.value);
that.fmData[item["supKeys"][0]] = publisher.label;
that.fmData[item["supKeys"][1]] = publisher.type;
},
rules: [
{
required: true,
message: "发布单位不能为空",
trigger: "blur",
},
],
},
// {
// field: "",
// keyName: "publisher",
// type: "select",
// optionUrl: "/gov/voice/article/publishagencylist",
// optionList: [],
// optionType: "group",
// supKeys: ["publisherName", "publisherType"],
// supValues: ["", ""],
// optionCook(data) {
// let ret = [];
// const { agencyDeptList, agencyGridList, agencyId, agencyName } =
// data;
// if (agencyId) {
// ret.push({
// label: "",
// optionList: [
// {
// label: agencyName,
// value: agencyId,
// type: "agency",
// },
// ],
// });
// }
// if (Array.isArray(agencyDeptList) && agencyDeptList.length > 0) {
// ret.push({
// label: "",
// optionList: [
// ...agencyDeptList.map((d) => ({
// label: d.agencyDeptName,
// value: d.departmentId,
// type: "department",
// })),
// ],
// });
// }
// if (Array.isArray(agencyGridList) && agencyGridList.length > 0) {
// ret.push({
// label: "",
// optionList: [
// ...agencyGridList.map((d) => ({
// label: d.agencyGridName,
// value: d.gridId,
// type: "grid",
// })),
// ],
// });
// }
// return ret;
// },
// handleChangeFn(vals, item, that) {
// const { optionList } = item;
// let opts = [];
// optionList.forEach((g) => {
// opts = [...opts, ...g.optionList];
// });
// let publisher = opts.find((p) => vals == p.value);
// that.fmData[item["supKeys"][0]] = publisher.label;
// that.fmData[item["supKeys"][1]] = publisher.type;
// },
// rules: [
// {
// required: true,
// message: "",
// trigger: "blur",
// },
// ],
// },
{
field: "文章标签",
keyName: "tagNameList",
keyName: "tagId",
type: "select",
multiple: true,
multiple: false,
filterable: true,
allowCreate: true,
optionUrl: "/gov/voice/tag/taglist",
optionUrlParams: {},
optionList: [],
optionList: [ { label: '标签1', value: 'tag1' },
{ label: '标签2', value: 'tag2' },
{ label: '标签3', value: 'tag3' }],
optionCook(list) {
return list.map((item) => ({
label: item.tagName,
value: item.tagName,
}));
},
// rules: [
// {
// required: true,
// message: "",
// trigger: "blur",
// },
// ],
},
{
field: "内容",
@ -378,20 +412,22 @@ export default {
},
{
field: "置顶",
keyName: "isTop",
keyName: "top",
type: "switch",
activeValue: "1",
inactiveValue: "0",
},
{
field: "消息推送",
keyName: "isPush",
keyName: "sendMsg",
type: "checkbox",
optionList:"是否通过公众号推送给社区居民"
optionList:"是否通过公众号推送给社区居民",
},
],
editFixedParams: {
type: "article",
// type: "article",
status:"0"
},
editElseRules: {},
editConfig: {

14
src/views/modules/cpts/base/cpts/edit.vue

@ -21,6 +21,17 @@
:prop="item.keyName"
:rules="item.rules || []"
>
<template v-if="item.type == 'checkbox'">
<el-switch
v-model.trim="fmData[item.keyName]"
size="small"
:active-text="item.activeText || ''"
:inactive-text="item.inactiveText || ''"
:active-value="item.activeValue || true"
:inactive-value="item.inactiveValue || false"
>
</el-switch>
</template>
<template v-if="item.type == 'switch'">
<el-switch
v-model.trim="fmData[item.keyName]"
@ -33,6 +44,7 @@
</el-switch>
</template>
<template v-if="item.type == 'input'">
<el-input
v-if="
@ -871,7 +883,7 @@ export default {
...editFixedParams,
// serviceType: this.fmData.serviceTypeArr.join(","),
};
console.log(fmData)
params = this.cookBeforeSubmit(params);
if (this.formType === "add") {

1
src/views/modules/cpts/base/index.vue

@ -203,6 +203,7 @@
type="text"
size="small"
class=".div-table-button--detail">查看</el-button>
<el-button v-if="editUrl && editAuth(scope.row)"
@click="handleEdit(scope.row)"
type="text"

Loading…
Cancel
Save