| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682 |
- <template>
- <div class="modal-backdrop">
- <div class="modal">
- <div class="modal-header">
- <span>编辑</span>
- </div>
- <div class="modal-body">
- <div class="bodyRow">
- <span>资料名称</span>
- <div>{{ ziliaoName }}</div>
- <!-- <select v-model="ziliaoId">
- <option
- v-for="(item, index) in dataName"
- :key="index"
- :value="item.id"
- >
- {{ item.informationName }}
- </option>
- </select> -->
- </div>
- <div class="bodyRow timeWidth">
- <span>发布时间</span
- ><input type="date" placeholder="选择时间" v-model="ziliaoTime" />
- </div>
- <div class="bodyRow">
- <div class="contentCol1">
- <span>车系</span
- ><select v-model="carS" @change="chooseCarSeries">
- <option
- v-for="(item, index) in carSeries"
- :key="index"
- :value="item.typeName"
- >
- {{ item.typeName }}
- </option>
- </select>
- </div>
- <div class="contentCol2">
- <span>车型</span
- ><select v-model="carT">
- <option
- v-for="(item, index) in carType"
- :key="index"
- :value="item.typeName"
- >
- {{ item.typeName }}
- </option>
- </select>
- </div>
- </div>
- <div class="bodyRow">
- <div class="contentCol1">
- <span>发布渠道</span>
- <div>{{ selectedPlatform }}</div>
- </div>
- <div class="contentCol2">
- <span>平台版块</span
- ><select name="" id="" v-model="releaseP">
- <option
- v-for="(item, index) in releaseMedia"
- :key="index"
- :value="item.platformName"
- >
- {{ item.platformName }}
- </option>
- </select>
- </div>
- </div>
- <!-- <div class="bodyRow">
- <span>项目分类</span
- ><select name="" id="">
- <option value="">请选择</option>
- </select>
- </div> -->
- <div class="bodyRow">
- <div class="contentCol1">
- <span>稿件类别</span
- ><select name="" id="" v-model="contentName1">
- <option
- v-for="(item, index) in content1"
- :key="index"
- :value="item.dictName"
- >
- {{ item.dictName }}
- </option>
- </select>
- </div>
- <div class="contentCol2">
- <span>内容分类</span
- ><select name="" id="" v-model="contentName2">
- <option
- v-for="(item, index) in content2"
- :key="index"
- :value="item.dictName"
- >
- {{ item.dictName }}
- </option>
- </select>
- </div>
- </div>
- <div class="bodyRow">
- <div class="contentCol1">
- <span>阅读量</span>
- <input type="number" placeholder="" v-model="readCount" />
- </div>
- <div class="contentCol2">
- <span>点赞</span>
- <input type="number" placeholder="" v-model="goodCount" />
- </div>
- </div>
- <div class="bodyRow">
- <div class="contentCol1">
- <span>评论</span>
- <input type="number" placeholder="" v-model="bbsCount" />
- </div>
- <div class="contentCol2">
- <span>在看/转发</span>
- <input type="number" placeholder="" v-model="lookingCount" />
- </div>
- </div>
- <div class="bodyRow longInput">
- <span>标题</span>
- <input type="text" placeholder="文章标题" v-model="mediaTitle" />
- </div>
- <div class="bodyRow longInput">
- <span>链接</span>
- <input type="text" placeholder="文章发布地址" v-model="mediaUrl" />
- </div>
- </div>
- <div class="modal-footer">
- <!-- <button type="button" class="btn-confirm" @click="confirm">确认</button> -->
- <button type="button" class="btn-confirm" @click="testUrl()">
- 确认
- </button>
- <button type="button" class="btn-close" @click="closeSelf">取消</button>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: "Modal",
- props: {
- LinkData: {
- type: Object,
- default: () => {
- return {};
- },
- },
- selectedPlatform: {
- type: String,
- default: () => {
- return "";
- },
- },
- releaseMedia: {
- type: Array,
- default: () => {
- return [];
- },
- },
- },
- data() {
- return {
- dataName: [],
- carSeries: [],
- carType: [],
- content1: [],
- content2: [],
- carS: "",
- carT: "",
- releaseP: "",
- ziliaoId: "",
- content1Id: "",
- content2Id: "",
- carTypeId: "",
- contentTypeName: "",
- informationId: "",
- mediaTitle: "",
- mediaUrl: "",
- projectTypeName: "",
- publishDate: "",
- publishSourceName: "",
- ziliaoName: "",
- ziliaoTime: "",
- contentName1: "",
- contentName2: "",
- readCount: "",
- goodCount: "",
- bbsCount: "",
- lookingCount: "",
- };
- },
- methods: {
- closeSelf() {
- this.$emit("closeme");
- // console.log(this.LinkData);
- },
- edit: function () {
- let obj = {};
- //获取资料名
- let idVal = this.ziliaoId;
- obj = this.dataName.find(function (item) {
- return item.id === idVal;
- });
- this.ziliaoName = obj.informationName;
- //获取车系 id
- let nameCarS = this.carS;
- obj = this.carSeries.find(function (item) {
- return item.typeName === nameCarS;
- });
- console.log("chexi ", obj);
- //carTypeId 表示车系 id
- this.carTypeId = obj.id;
- //获取车型名 this.carT
- //获取平台名 this.selectedPlatform,
- //当前月份
- let date = new Date();
- let m = date.getMonth() + 1;
- let y = date.getFullYear();
- let d = y + "/" + m;
- let config = {
- url: "",
- data: {
- id: "", //主键值
- month: d,
- dealerId: "254",
- dataId: this.ziliaoId,
- informationName: this.ziliaoName,
- releaseTime: this.ziliaoTime,
- carService: this.carS,
- carType: this.carT,
- //发布板块
- releasePlate: this.releaseP,
- //发布平台
- releaseMedia: this.selectedPlatform,
- draftGenre: this.contentName1,
- //内容分类2?
- contentClass: this.contentName2,
- articleTitle: this.mediaTitle,
- articleLink: this.mediaUrl,
- readCount: this.readCount,
- goodCount: this.goodCount,
- bbsCount: this.bbsCount,
- lookingCount: this.lookingCount,
- },
- };
- if (this.LinkData.id) {
- //编辑
- config.url = "/updateDealerFeedback";
- config.data.id = this.LinkData.id;
- console.log(config.url);
- } else {
- //新增
- config.url = "/dealerFeedback";
- }
- this.$emit("update", config);
- this.$emit("closeme");
- },
- addInfo: function () {
- let obj = {};
- //获取资料名
- let idVal = this.ziliaoId;
- obj = this.dataName.find(function (item) {
- return item.id === idVal;
- });
- this.ziliaoName = obj.informationName;
- //获取车系 id
- let nameCarS = this.carS;
- obj = this.carSeries.find(function (item) {
- return item.typeName === nameCarS;
- });
- console.log("chexi ", obj);
- //carTypeId 表示车系 id
- this.carTypeId = obj.id;
- //获取车型名 this.carT
- //获取平台名 this.selectedPlatform,
- //当前月份
- let date = new Date();
- let m = date.getMonth() + 1;
- let y = date.getFullYear();
- let d = y + "/" + m;
- let config = {
- url: "/dealerFeedback",
- data: {
- // id: "", //主键值
- month: d,
- dealerId: "254",
- dataId: this.ziliaoId,
- informationName: this.ziliaoName,
- releaseTime: this.ziliaoTime,
- carService: this.carS,
- carType: this.carT,
- //releasePlate: this.selectedPlatform,
- //releaseMedia: this.releaseP,
- //发布板块
- releasePlate: this.releaseP,
- //发布平台
- releaseMedia: this.selectedPlatform,
- draftGenre: this.contentName1,
- //内容分类2?
- contentClass: this.contentName2,
- articleTitle: this.mediaTitle,
- articleLink: this.mediaUrl,
- readCount: this.readCount,
- goodCount: this.goodCount,
- bbsCount: this.bbsCount,
- lookingCount: this.lookingCount,
- },
- };
- this.$emit("update", config);
- this.$emit("closeme");
- },
- //资料名称列表
- chooseDataName: function () {
- this.$http({
- url: "/firmsUploadListByAgent",
- //url: "/firmsLinkUpload",
- method: "post",
- data: {
- download: true,
- //report: false,
- },
- })
- .then((res) => {
- if (res.data.code === 200) {
- this.dataName = res.data.data;
- console.log(this.dataName);
- //获取资料名
- let obj = {};
- let idVal = this.ziliaoId;
- obj = this.dataName.find(function (item) {
- return item.id === idVal;
- });
- this.ziliaoName = obj.informationName;
- }
- })
- .catch((err) => {
- console.log(err);
- });
- },
- //发布版块
- /* chooseReleasePlate: function () {}, */
- //不分页查询车系车型信息
- chooseCarSeries: function () {
- this.$http({
- url: "/base/carTypeManager/selectCarTypeList",
- method: "post",
- data: {},
- })
- .then((res) => {
- if (res.data.code === 200) {
- this.carSeries = res.data.data;
- this.chooseCarType();
- }
- })
- .catch((err) => {
- console.log(err);
- });
- },
- chooseCarType: function () {
- //清空下级select
- this.carT = "";
- //获取车系 id
- let obj = {};
- let nameCarS = this.carS;
- obj = this.carSeries.find(function (item) {
- return item.typeName === nameCarS;
- });
- console.log(this.carSeries, obj);
- this.carTypeId = obj.id;
- this.$http({
- url: "/base/carTypeManager/selectCarTypeList",
- method: "post",
- data: {
- parentId: this.carTypeId || -1,
- },
- })
- .then((res) => {
- if (res.data.code === 200) {
- this.carType = res.data.data;
- this.carT = this.LinkData.carPlatformName;
- }
- })
- .catch((err) => {
- console.log(err);
- });
- },
- //不分页查询发布平台信息 内容分类1
- //初次调用获得 content ID 用作 parentID
- firstContent1Classify: function () {
- this.$http({
- url: "/sys/dataDict/selectSysDataDictList",
- method: "post",
- data: {
- dictCode: "content1",
- },
- })
- .then((res) => {
- if (res.data.code === 200) {
- this.content1Id = res.data.data[0].id;
- this.secondContent1Classify();
- }
- console.log("contentClassify1", res.data.data[0].id);
- })
- .catch((err) => {
- console.log(err);
- });
- },
- secondContent1Classify: function () {
- this.$http({
- url: "/sys/dataDict/selectSysDataDictList",
- method: "post",
- data: {
- parentId: this.content1Id,
- },
- })
- .then((res) => {
- if (res.data.code === 200) {
- this.content1 = res.data.data;
- }
- console.log("second contentClassify1", res.data.data);
- })
- .catch((err) => {
- console.log(err);
- });
- },
- //不分页查询发布平台信息 内容分类2
- firstContent2Classify: function () {
- this.$http({
- url: "/sys/dataDict/selectSysDataDictList",
- method: "post",
- data: {
- dictCode: "content2",
- },
- })
- .then((res) => {
- if (res.data.code === 200) {
- this.content2Id = res.data.data[0].id;
- this.secondContent2Classify();
- }
- console.log("contentClassify2", res.data.data[0].id);
- })
- .catch((err) => {
- console.log(err);
- });
- },
- secondContent2Classify: function () {
- this.$http({
- url: "/sys/dataDict/selectSysDataDictList",
- method: "post",
- data: {
- parentId: this.content2Id,
- },
- })
- .then((res) => {
- if (res.data.code === 200) {
- this.content2 = res.data.data;
- }
- console.log("second contentClassify2", res.data.data);
- })
- .catch((err) => {
- console.log(err);
- });
- },
- initialData: function () {
- this.ziliaoId = this.LinkData.informationId;
- this.mediaTitle = this.LinkData.mediaTitle;
- this.mediaUrl = this.LinkData.mediaUrl;
- this.carS = this.LinkData.carTypeName;
- this.carT = this.LinkData.carPlatformName;
- let time = this.LinkData.publishDate; //发布时间
- if (time.length > 4) {
- let y = time.slice(0, 4);
- let m = time.slice(5, 7);
- let d = time.slice(8, 10);
- let temp = y + "-" + m + "-" + d;
- this.ziliaoTime = temp;
- }
- //console.log("console.log(this.forceUpdate);", typeof time, m, y);
- //缺少对应列表值 已有资料名在数据中无法查询到
- //publishSourceName 发布板块
- this.releaseP = this.LinkData.publishSourceName;
- this.contentName1 = this.LinkData.mediaTypeName;
- this.contentName2 = this.LinkData.contentTypeName;
- this.readCount = this.LinkData.readCount;
- this.goodCount = this.LinkData.goodCount;
- this.bbsCount = this.LinkData.bbsCount;
- this.lookingCount = this.LinkData.lookingCount;
- },
- testUrl: function () {
- var regex = /^http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?$/;
- let flag = regex.test(this.mediaUrl);
- // console.log(flag, regex);
- if (flag) {
- if (flag
- /* this.ziliaoName &&
- this.ziliaoTime &&
- this.carS &&
- this.carT &&
- this.releaseP &&
- this.selectedPlatform &&
- this.contentName1 &&
- this.contentName2 &&
- this.mediaTitle &&
- this.mediaUrl &&
- this.readCount &&
- this.goodCount &&
- this.bbsCount &&
- this.lookingCount */
- ) {
- this.edit();
- } else {
- alert("请将信息补充完整!");
- }
- } else {
- alert("链接输入有误!\n示例:https://www.baidu.com");
- }
- /*
- this.ziliaoName && this.ziliaoTime &&this.carS &&this.carT&&
- this.releaseP&& this.selectedPlatform&& this.contentName1&&
- this.contentName2&& this.mediaTitle&& this.mediaUrl&&
- this.readCount&&this.goodCount&& this.bbsCount&& this.lookingCount */
- },
- },
- mounted() {
- this.chooseDataName();
- this.chooseCarSeries();
- this.firstContent1Classify();
- this.firstContent2Classify();
- //this.chooseReleasePlate();
- this.initialData();
- },
- };
- </script>
- <style>
- .modal-backdrop {
- position: fixed;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- background-color: #7d9191;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .modal {
- background-color: #eeeeee;
- box-shadow: 2px 2px 20px 1px;
- overflow-x: auto;
- display: flex;
- flex-direction: column;
- border-radius: 0px;
- width: 1030px;
- }
- .modal-header {
- border-bottom: 1px solid #eee;
- color: #313131;
- justify-content: space-between;
- padding: 15px;
- display: flex;
- border-bottom: 1px solid #e3e3e3;
- }
- .modal-header span {
- font-size: 16px;
- font-weight: bold;
- }
- .modal-footer {
- border-top: 1px solid #eee;
- justify-content: center;
- padding: 15px;
- display: flex;
- }
- .modal-footer button {
- width: 90px;
- margin-left: 0px;
- }
- .modal-footer button:nth-child(1) {
- margin-right: 80px;
- }
- .modal-body {
- position: relative;
- padding: 20px 120px 20px 180px;
- }
- .modal-body span,
- select,
- input,
- div {
- font-size: 14px;
- }
- .btn-close,
- .btn-confirm {
- border-radius: 8px;
- margin-left: 16px;
- width: 56px;
- height: 36px;
- border: none;
- cursor: pointer;
- }
- .btn-close {
- color: #313131;
- background-color: gray;
- }
- .btn-confirm {
- color: #fff;
- background-color: #0056a0;
- }
- .bodyRow {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- padding: 4px;
- }
- .bodyRow span {
- width: 80px;
- margin: 10px;
- }
- .bodyRow select {
- width: 120px;
- }
- .bodyRow input {
- width: 112px;
- }
- .longInput input {
- width: 476px;
- }
- .bodyRow select,
- input {
- padding: 2px;
- }
- .contentCol1 {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- }
- .contentCol1 span {
- width: 80px;
- margin: 10px;
- }
- .contentCol1 div {
- width: 120px;
- }
- .contentCol2 {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- width: 363px;
- }
- .timeWidth input {
- width: 150px;
- }
- </style>
|