Browse Source

临时保存看别的

master
dai 3 years ago
parent
commit
33abdafe12
  1. 93
      src/views/modules/communityParty/article/index.vue
  2. 63
      src/views/modules/cpts/base/cpts/edit.vue

93
src/views/modules/communityParty/article/index.vue

@ -25,6 +25,7 @@
import basePage from "@/views/modules/cpts/base/index"; import basePage from "@/views/modules/cpts/base/index";
import { getItemByIdInCascader, collapse } from "@/utils/cascader"; import { getItemByIdInCascader, collapse } from "@/utils/cascader";
import { requestPost } from "@/js/dai/request"; import { requestPost } from "@/js/dai/request";
import dateFormat from "dai-js/tools/dateFormat.js";
export default { export default {
props: {}, props: {},
@ -243,12 +244,95 @@ export default {
} else { } else {
} }
}, },
rules: [
{
required: true,
message: "发布范围不能为空",
trigger: "blur",
},
],
}, },
{ {
field: "发布时间", field: "发布时间",
keyName: "publishDate", keyName: "publishDate",
type: "date", type: "date",
maxlength: 50, value: dateFormat(new Date(), "yyyy-MM-dd"),
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: agencyId,
value: agencyName,
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: "文章标签", field: "文章标签",
@ -271,6 +355,13 @@ export default {
field: "内容", field: "内容",
keyName: "content", keyName: "content",
type: "rich-text", type: "rich-text",
rules: [
{
required: true,
message: "内容不能为空",
trigger: "blur",
},
],
}, },
{ {
field: "置顶", field: "置顶",

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

@ -121,18 +121,51 @@
:multiple="item.multiple || false" :multiple="item.multiple || false"
:filterable="item.filterable || false" :filterable="item.filterable || false"
:allowCreate="item.allowCreate || false" :allowCreate="item.allowCreate || false"
default-first-option
@change="(e) => handleChangeSelect(e, item)" @change="(e) => handleChangeSelect(e, item)"
> >
<el-option <template v-if="item.optionType == 'group'">
v-for="(subItem, subIndex) in item.optionList" <el-option-group
:key="subItem.value + subIndex" v-for="group in item.optionList"
:label="subItem.label" :key="group.label"
:value="subItem.value" :label="group.label"
> >
</el-option> <el-option
v-for="subItem in group.optionList"
:key="subItem.value"
:label="subItem.label"
:value="subItem.value"
>
</el-option>
</el-option-group>
</template>
<template v-else>
<el-option
v-for="(subItem, subIndex) in item.optionList"
:key="subItem.value + subIndex"
:label="subItem.label"
:value="subItem.value"
>
</el-option>
</template>
</el-select> </el-select>
</template> </template>
<template v-else-if="item.type == 'rich-text'">
<Tinymce
class="tinymce_view"
v-if="formType != 'D'"
:ref="'richText' + item.keyName"
:id="'richText' + item.keyName"
v-model="fmData[item.keyName]"
:height="450"
:customerId="customerId"
:placeholder="item.placeholder || '请输入'"
/>
<p v-else class="text_p" v-html="fmData[item.keyName]"></p>
</template>
<template v-else-if="item.type == 'cascader'"> <template v-else-if="item.type == 'cascader'">
<el-cascader <el-cascader
v-model="fmData[item.keyName]" v-model="fmData[item.keyName]"
@ -247,6 +280,7 @@
import { requestPost } from "@/js/dai/request"; import { requestPost } from "@/js/dai/request";
import nextTick from "dai-js/tools/nextTick"; import nextTick from "dai-js/tools/nextTick";
import Schema from "async-validator"; import Schema from "async-validator";
import Tinymce from "@c/tinymce2/index.vue";
var map; var map;
var search; var search;
@ -255,6 +289,8 @@ var infoWindowList;
var geocoder; // var geocoder; //
export default { export default {
components: { Tinymce },
props: { props: {
formId: { formId: {
type: String, type: String,
@ -322,7 +358,6 @@ export default {
customerId: localStorage.getItem("customerId"), customerId: localStorage.getItem("customerId"),
}; };
}, },
components: {},
computed: {}, computed: {},
watch: { watch: {
editParams: { editParams: {
@ -614,6 +649,18 @@ export default {
window.open(src); window.open(src);
}, },
dormatHtml(content) {
if (
content.startsWith(
"<!DOCTYPE html>\n<html>\n<head>\n</head>\n<body>\n"
) &&
content.endsWith("\n</body>\n</html>")
) {
content = content.slice(45, -16);
}
return content;
},
async handleComfirm() { async handleComfirm() {
this.btnDisable = true; this.btnDisable = true;
setTimeout(() => { setTimeout(() => {

Loading…
Cancel
Save