addChoiceness.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774
  1. <template>
  2. <!-- 报告精选添加/编辑 -->
  3. <div class="add-choiceness">
  4. <el-card>
  5. <!-- 更新方式继承第几期 -->
  6. <el-row :gutter="24">
  7. <el-col :span="12">
  8. <el-select v-model="updateMode" placeholder="请选择更新方式" clearable @change="updateModeChange">
  9. <el-option label="重新编辑" value="重新编辑"></el-option>
  10. <el-option label="继承往期" value="继承往期"></el-option>
  11. </el-select>
  12. </el-col>
  13. <el-col :span="12">
  14. <el-select v-if="updateMode == '继承往期'" v-model="inheritNum" placeholder="选择继承第几期" clearable @change="getDetail">
  15. <el-option v-for="item in updateModeList" :key="item.Periods" :label="item.InheritPeriodsName" :value="item.Periods"></el-option>
  16. </el-select>
  17. </el-col>
  18. </el-row>
  19. <div v-show="updateMode">
  20. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" class="demo-ruleForm">
  21. <!-- 标题 / 作者 /发布时间 -->
  22. <el-row :gutter="24" style="margin-top: 30px">
  23. <el-col :span="12">
  24. <el-form-item prop="title">
  25. <el-input v-model="ruleForm.title" placeholder="请输入标题"></el-input>
  26. </el-form-item>
  27. </el-col>
  28. <el-col :span="6">
  29. <el-form-item prop="author">
  30. <el-input v-model="ruleForm.author" placeholder="请输入作者"></el-input>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :span="6">
  34. <el-form-item prop="time">
  35. <el-date-picker type="date" placeholder="选择发布时间" value-format="yyyy-MM-dd" v-model="ruleForm.time"></el-date-picker>
  36. </el-form-item>
  37. </el-col>
  38. </el-row>
  39. <!-- 产品说明 -->
  40. <el-form-item prop="explain" style="margin-top: 10px">
  41. <el-input v-model="ruleForm.explain" placeholder="请输入产品说明"></el-input>
  42. </el-form-item>
  43. <!-- 变更说明 -->
  44. <!-- 富文本 -->
  45. <rich-text ref="oneRich" v-model="marketStrategy" :spareId="contentValue" :isText="contentText" />
  46. <el-form-item prop="reportLink">
  47. <div style="display: flex; align-items: center; margin-top: 10px">
  48. <span style="flex-shrink: 0">详细报告链接:</span>
  49. <el-input style="margin: 10px 0" v-model="ruleForm.reportLink" placeholder="请输入报告链接(弘则研报管理栏目下)"></el-input>
  50. </div>
  51. </el-form-item>
  52. </el-form>
  53. <!-- 产业/标的 模块 -->
  54. <div class="content-module">
  55. <draggable v-model="industryList" animation="300" @update="sortChange">
  56. <div class="content-industry" v-for="(item, index) in industryList" :key="item.ChartPermissionId">
  57. <div class="content-name" :class="industryIndex == index ? 'active' : ''" @click="industryBtn(item, index)">{{ item.ChartPermissionName }}</div>
  58. </div>
  59. </draggable>
  60. <div v-for="(item, index) in industryList" :key="item.ChartPermissionId">
  61. <div v-show="industryIndex == index">
  62. <RichText v-model="item.BodyChartSummary" :ref="'logic' + index" :spareId="'logictest' + index" :isText="contentTextLogic" />
  63. <draggable :list="item.List" animation="300" class="classification" filter=".addIndustrial" :move="onMove" @update="ificationSortChange">
  64. <div v-for="(val, num) in item.List" :key="val.ShowName" class="industrial" @click="ificationIndustrialBtn(val, num)" :class="num == ificationIndustrial ? 'pitch' : ''">
  65. <span style="margin-right: 19px">{{ val.ShowName }}</span>
  66. <span v-if="num == ificationIndustrial">
  67. <img src="~@/assets/img/icons/edit1.png" style="width: 12px; height: 12px; marginright: 10px" @click="editText(val, num)" />
  68. <i class="el-icon-close" @click="deleteClassify(val, num)"></i>
  69. </span>
  70. </div>
  71. <div class="addIndustrial" @click="addMulti" v-if="industryIndex == index">
  72. <i class="el-icon-plus"></i>
  73. <span>添加标的/赛道</span>
  74. </div>
  75. </draggable>
  76. <template v-for="(val, num) in item.List">
  77. <div :key="val.IndustrialSubjectId" v-show="industryIndex == index">
  78. <div class="industrial-is-new" v-show="num == ificationIndustrial">
  79. <el-checkbox v-model="val.IsNew" :true-label="1" :false-label="0">显示new标签</el-checkbox>
  80. </div>
  81. <div style="margin-bottom: 20px; display: flex; align-items: center" v-show="num == ificationIndustrial">
  82. <div style="display: flex; align-items: center" v-for="(son, num) in val.CompanyLabel" :key="num">
  83. <el-input style="width: 260px; margin-right: 15px" v-model="son.name" placeholder="请输入公司标签"></el-input>
  84. <img class="delete-item-icon" v-if="num > 0" @click="deleteLabelItem(val, num)" src="~@/assets/img/icons/delete-Item.png" alt="" />
  85. </div>
  86. <el-tooltip class="item" effect="dark" content="添加标签" placement="top-start">
  87. <img @click="addLabelClick(val)" class="editsty" src="~@/assets/img/set_m/add_ico.png" />
  88. </el-tooltip>
  89. </div>
  90. <rich-text :ref="'twoRich' + num" v-model="val.Body" :spareId="contentValueTwo" :isText="contentTextTwo" v-show="num == ificationIndustrial" />
  91. </div>
  92. </template>
  93. </div>
  94. </div>
  95. </div>
  96. <div>
  97. <div class="content-resource">
  98. <span class="resource">产业资源包:</span>
  99. <span class="show">{{ industrialSubjectName }}</span>
  100. </div>
  101. <div class="content-resource">
  102. <span class="resource">综述报告:</span>
  103. <span class="show">{{ overviewList.Title }}</span>
  104. <div style="margin-left: 20px">
  105. <el-switch @change="switchChangeHandler" v-model="overviewList.IsShowOverviewArticle" :active-value="1" :inactive-value="0" active-text="显示链接" inactive-text="不显示链接">
  106. </el-switch>
  107. </div>
  108. </div>
  109. </div>
  110. <div class="content-bottom">
  111. <el-button type="primary" @click="confirm('预览')">预览</el-button>
  112. <el-button type="primary" @click="confirm('保存')">保存</el-button>
  113. <el-button v-if="isShowStatus" type="primary" @click="confirm('发布')">发布</el-button>
  114. <el-button type="" @click="cancel">取消</el-button>
  115. </div>
  116. </div>
  117. </el-card>
  118. <!-- 弹框部分 -->
  119. <el-dialog v-dialogDrag :close-on-click-modal="false" :modal-append-to-body="false" center :visible.sync="addDialogVisible" width="560px" :before-close="handleClose">
  120. <div slot="title" style="display: flex; align-items: center">
  121. <img :src="dialogText == '编辑' ? $icons.editicon : $icons.add" style="color: #fff; width: 16px; height: 16px; margin-right: 5px" />
  122. <span style="font-size: 16px">{{ dialogText }}</span>
  123. </div>
  124. <div class="dlg-content">
  125. <el-autocomplete class="inline-input" v-model="stateValue" :trigger-on-focus="false" :fetch-suggestions="handleSearchResult" placeholder="请输入标的或赛道名称" clearable></el-autocomplete>
  126. </div>
  127. <span slot="footer" class="dialog-footer">
  128. <el-button v-if="dialogText == '编辑'" type="primary" @click="editconfirmPerson">确定</el-button>
  129. <el-button v-else type="primary" @click="confirmPerson">确定</el-button>
  130. <el-button @click="handleClose">取消</el-button>
  131. </span>
  132. </el-dialog>
  133. </div>
  134. </template>
  135. <script>
  136. import RichText from "./richText.vue";
  137. import { raiInterface } from "@/api/api.js";
  138. import draggable from "vuedraggable";
  139. import TemplateMessage from "./apply/templateMessage.vue";
  140. export default {
  141. name: "",
  142. components: { RichText, draggable, TemplateMessage },
  143. props: {},
  144. data() {
  145. return {
  146. contentValue: "one",
  147. contentText: "市场策略核心逻辑汇总",
  148. contentValueTwo: "two",
  149. contentTextTwo: "公司核心逻辑汇总",
  150. contentTextLogic: "行业核心逻辑汇总",
  151. updateMode: "", //更新方式
  152. inheritNum: "", //继承第几
  153. ruleForm: {
  154. title: "", //标题
  155. author: "", //作者
  156. time: "", //时间
  157. explain: "", //说明
  158. reportLink: "", //变更
  159. },
  160. rules: {
  161. title: [{ required: true, message: "请输入标题", trigger: "blur" }],
  162. },
  163. industryList: [], //行业
  164. industryIndex: 0, //
  165. ificationIndustrial: 0,
  166. addDialogVisible: false,
  167. dialogText: "",
  168. stateValue: "",
  169. companyList: [],
  170. timeout: null,
  171. isShowStatus: true,
  172. industrialSubjectName: "",
  173. chartPermissionId: "", //分类id
  174. subjectList: [],
  175. updateModeList: [], //期数的数组
  176. editNum: "",
  177. overviewList: {},
  178. marketStrategy: "",
  179. timeInterval: null, // 定时器
  180. };
  181. },
  182. computed: {},
  183. mounted() {
  184. if (this.$route.query.id) {
  185. this.isShowStatus = this.$route.query.status == 0;
  186. this.getDetail();
  187. } else {
  188. this.getNoTacticsfirst();
  189. this.dataInit();
  190. }
  191. this.getListPeriods();
  192. },
  193. methods: {
  194. // 报告的缓存处理数据
  195. dataInit() {
  196. if (sessionStorage.getItem("addChoicenessQY")) {
  197. let data = JSON.parse(sessionStorage.getItem("addChoicenessQY"));
  198. setTimeout(async () => {
  199. this.industryList = data.industryList;
  200. this.industryIndex = data.industryIndex;
  201. this.ificationIndustrial = data.ificationIndustrial;
  202. this.updateMode = data.updateMode;
  203. this.inheritNum = data.inheritNum;
  204. this.companyList = data.companyList;
  205. this.industrialSubjectName = data.industrialSubjectName;
  206. this.chartPermissionId = data.chartPermissionId;
  207. this.subjectList = data.subjectList;
  208. this.updateModeList = data.updateModeList;
  209. this.editNum = data.editNum;
  210. this.overviewList = data.overviewList;
  211. this.ruleForm = data.ruleForm;
  212. this.marketStrategy = data.MarketStrategy;
  213. }, 200);
  214. }
  215. this.timeInterval = setInterval(() => {
  216. let params = {
  217. industryList: this.industryList,
  218. industryIndex: this.industryIndex,
  219. ificationIndustrial: this.ificationIndustrial,
  220. updateMode: this.updateMode,
  221. inheritNum: this.inheritNum,
  222. companyList: this.companyList,
  223. industrialSubjectName: this.industrialSubjectName,
  224. chartPermissionId: this.chartPermissionId,
  225. subjectList: this.subjectList,
  226. updateModeList: this.updateModeList,
  227. editNum: this.editNum,
  228. overviewList: this.overviewList,
  229. ruleForm: this.ruleForm,
  230. MarketStrategy: this.marketStrategy,
  231. };
  232. sessionStorage.setItem("addChoicenessQY", JSON.stringify(params));
  233. }, 120000);
  234. },
  235. updateModeChange() {
  236. if (this.updateMode == "重新编辑") {
  237. this.init();
  238. this.industryList = [];
  239. this.getNoTacticsfirst();
  240. }
  241. },
  242. //获取编辑详情
  243. async getDetail() {
  244. const res = await raiInterface.reportSelectionDetail({ ArticleId: this.$route.query.id || "", Periods: this.inheritNum || "" });
  245. if (res.Ret === 200) {
  246. res.Data.List.forEach((item) => {
  247. if (!item.List || !item.List.length > 0) {
  248. item.List = [];
  249. }
  250. });
  251. this.updateMode = this.inheritNum ? this.updateMode : res.Data.AddType == "1" ? "重新编辑" : "继承往期";
  252. this.ruleForm = {
  253. title: res.Data.Title, //标题
  254. author: res.Data.Department, //作者
  255. time: res.Data.PublishDate, //时间
  256. explain: res.Data.ProductDescription, //说明
  257. reportLink: res.Data.ReportLink, //变更
  258. };
  259. this.marketStrategy = res.Data.MarketStrategy;
  260. this.inheritNum = this.inheritNum ? this.inheritNum : res.Data.InheritPeriods;
  261. this.industryList = res.Data.List;
  262. setTimeout(() => {
  263. res.Data.List.forEach((item, index) => {
  264. item.List.forEach((key, i) => {
  265. key.CompanyLabel = key.CompanyLabel
  266. ? key.CompanyLabel.map((val, i) => {
  267. let obj = {
  268. name: val,
  269. value: i + 1,
  270. };
  271. return obj;
  272. })
  273. : [
  274. {
  275. name: "",
  276. value: 1,
  277. },
  278. ];
  279. });
  280. });
  281. }, 300);
  282. this.chartPermissionId = res.Data.List[0].ChartPermissionId;
  283. this.industrialSubjectName = res.Data.List[0].List ? res.Data.List[0].List[0].IndustrialManagementName : "";
  284. this.overviewList = {
  285. ArticleId: res.Data.List[0].List && res.Data.List[0].List[0].OverviewArticleId,
  286. Title: res.Data.List[0].List && res.Data.List[0].List[0].OverviewArticleTitle,
  287. IsShowOverviewArticle: res.Data.List[0].List && res.Data.List[0].List[0].IsShowOverviewArticle,
  288. };
  289. }
  290. },
  291. //获取模版
  292. async getNoTacticsfirst() {
  293. const res = await raiInterface.reportSereportSelectiondDetailTemplate();
  294. if (res.Ret === 200) {
  295. this.industryList = res.Data.List;
  296. this.chartPermissionId = res.Data.List[0].ChartPermissionId;
  297. }
  298. },
  299. //点击产业的事件
  300. industryBtn(item, index) {
  301. if (index !== this.industryIndex) {
  302. this.industryIndex = index;
  303. this.chartPermissionId = item.ChartPermissionId;
  304. this.ificationIndustrial = 0;
  305. }
  306. },
  307. //标的的点击事件 处理
  308. ificationIndustrialBtn(item, index) {
  309. if (index !== this.ificationIndustrial) {
  310. this.ificationIndustrial = index;
  311. this.industrialSubjectName = item.IndustrialManagementName || "";
  312. this.overviewList = {
  313. ArticleId: item.OverviewArticleId,
  314. Title: item.OverviewArticleTitle,
  315. IsShowOverviewArticle: item.IsShowOverviewArticle,
  316. };
  317. }
  318. },
  319. //编辑标的
  320. editText(item, index) {
  321. this.dialogText = "编辑";
  322. this.chartPermissionId = item.ChartPermissionId;
  323. this.stateValue = item.IndustrialSubjectName || item.ShowName;
  324. this.addDialogVisible = true;
  325. this.editNum = index;
  326. },
  327. //删除标的
  328. deleteClassify(item, index) {
  329. this.$confirm("确定要删除该标的吗?", "提示", {
  330. confirmButtonText: "确定",
  331. cancelButtonText: "取消",
  332. type: "warning",
  333. })
  334. .then(() => {
  335. this.industryList[this.industryIndex].List.splice(index, 1);
  336. this.ificationIndustrial = 0;
  337. let itemList = this.industryList[0].List[0];
  338. this.industrialSubjectName = itemList.IndustrialManagementName || "";
  339. this.overviewList = {
  340. ArticleId: itemList.OverviewArticleId,
  341. Title: itemList.OverviewArticleTitle,
  342. IsShowOverviewArticle: itemList.IsShowOverviewArticle,
  343. };
  344. this.$message({
  345. type: "success",
  346. message: "删除成功!",
  347. });
  348. })
  349. .catch(() => {
  350. this.$message({
  351. type: "info",
  352. message: "已取消删除",
  353. });
  354. });
  355. },
  356. //添加产业
  357. addMulti() {
  358. this.dialogText = "添加标的/赛道";
  359. this.addDialogVisible = true;
  360. },
  361. //弹框的取消事件
  362. handleClose() {
  363. this.stateValue = "";
  364. this.addDialogVisible = false;
  365. },
  366. //弹框的确认事件
  367. async confirmPerson() {
  368. if (this.stateValue) {
  369. const arr = this.subjectList.find((item) => item.ShowName === this.stateValue);
  370. let overviewList = {};
  371. const res = !arr
  372. ? await raiInterface.getReportSelectionThird_name({
  373. ThirdName: this.stateValue,
  374. ChartPermissionId: this.chartPermissionId,
  375. })
  376. : await raiInterface.getReportSelectionArticle({
  377. IndustrialSubjectId: arr.IndustrialSubjectId,
  378. });
  379. if (res.Ret === 200) {
  380. overviewList = res.Data;
  381. this.industryList.forEach((item) => {
  382. if (item.ChartPermissionId == this.chartPermissionId) {
  383. if (item.List.length > 0) {
  384. var isNext = item.List.some((item) => item.ShowName == (arr ? arr.ShowName : res.Data.ThirdName));
  385. }
  386. if (isNext) return this.$message.error("标的重复!");
  387. item.List.push({
  388. Body: "",
  389. ChartPermissionId: this.chartPermissionId,
  390. IndustrialManagementId: arr ? arr.IndustrialManagementId + "" : "",
  391. IndustrialManagementName: arr ? arr.IndustryName : "",
  392. IndustrialSubjectId: arr ? arr.IndustrialSubjectId + "" : "",
  393. IndustrialSubjectName: arr ? arr.SubjectName : "",
  394. ShowName: arr ? arr.ShowName || arr.IndustryName : res.Data.ThirdName,
  395. ThirdId: res.Data.ThirdId || "",
  396. ThirdName: res.Data.ThirdName || "",
  397. CompanyLabel: [{ name: "", value: item.List.length + 1 }],
  398. OverviewArticleId: overviewList.ArticleId || 0,
  399. OverviewArticleTitle: overviewList.Title || "",
  400. IsShowOverviewArticle: overviewList.IsShowOverviewArticle || 0,
  401. });
  402. }
  403. });
  404. }
  405. }
  406. this.stateValue = "";
  407. this.addDialogVisible = false;
  408. },
  409. async editconfirmPerson() {
  410. if (this.stateValue) {
  411. const arr = this.subjectList.find((item) => item.ShowName === this.stateValue);
  412. let overviewList = {};
  413. const res = !arr
  414. ? await raiInterface.getReportSelectionThird_name({
  415. ThirdName: this.stateValue,
  416. ChartPermissionId: this.chartPermissionId,
  417. })
  418. : await raiInterface.getReportSelectionArticle({
  419. IndustrialSubjectId: arr.IndustrialSubjectId,
  420. });
  421. if (res.Ret === 200) {
  422. overviewList = res.Data;
  423. this.overviewList = overviewList;
  424. this.industryList.forEach((item) => {
  425. if (item.ChartPermissionId == this.chartPermissionId) {
  426. if (item.List.length > 0) {
  427. var isNext = item.List.some((item) => item.ShowName == (arr ? arr.ShowName : res.Data.ThirdName));
  428. }
  429. if (isNext) return this.$message.error("标的重复!");
  430. const obj = {
  431. Body: (this.$refs.twoRich && this.$refs.twoRich.value) || "",
  432. ChartPermissionId: this.chartPermissionId,
  433. IndustrialManagementId: arr ? arr.IndustrialManagementId + "" : "",
  434. IndustrialManagementName: arr ? arr.IndustryName : "",
  435. IndustrialSubjectId: arr ? arr.IndustrialSubjectId + "" : "",
  436. IndustrialSubjectName: arr ? arr.SubjectName : "",
  437. ShowName: arr ? arr.ShowName || arr.IndustryName : res.Data.ThirdName,
  438. ThirdId: res.Data.ThirdId || "",
  439. ThirdName: res.Data.ThirdName || "",
  440. CompanyLabel:
  441. item.List[this.editNum].CompanyLabel && item.List[this.editNum].CompanyLabel.length > 0 ? item.List[this.editNum].CompanyLabel : [{ name: "", value: item.List.length + 1 }],
  442. OverviewArticleId: overviewList.ArticleId || 0,
  443. OverviewArticleTitle: overviewList.Title || "",
  444. IsShowOverviewArticle: overviewList.IsShowOverviewArticle || 0,
  445. };
  446. item.List.splice(this.editNum, 1, obj);
  447. this.industrialSubjectName = arr ? arr.IndustryName : res.Data.ThirdName || "";
  448. }
  449. });
  450. }
  451. }
  452. this.stateValue = "";
  453. this.addDialogVisible = false;
  454. },
  455. // 申请内容搜索
  456. async handleSearchResult(data, cb) {
  457. if (data) {
  458. cb([]);
  459. let res = await raiInterface.industrialAndSubjectSearch({ KeyWord: data, ChartPermissionId: this.chartPermissionId });
  460. if (res.Ret === 200) {
  461. if (res.Data.List && res.Data.List.length > 0) {
  462. let arr = res.Data.List.map((item) => {
  463. return { value: item.ShowName, ...item };
  464. });
  465. this.subjectList = arr;
  466. cb(arr);
  467. }
  468. }
  469. }
  470. },
  471. //保存 发布
  472. confirm: _.debounce(function (type) {
  473. this.$refs.ruleForm.validate(async (val) => {
  474. if (val) {
  475. let isText = [];
  476. this.industryList.forEach((item) => {
  477. item.List.forEach((key) => {
  478. key.CompanyLabel && key.CompanyLabel.length > 0 && isText.push(key.CompanyLabel.some((val) => val.name));
  479. });
  480. });
  481. if (isText && isText.includes(false)) {
  482. return this.$message.error("请输入公司标签");
  483. }
  484. let params = this.dataHandle(type);
  485. if (type == "预览") {
  486. sessionStorage.setItem("choicenessPre", JSON.stringify(params));
  487. let { href } = this.$router.resolve({ name: "预览报告精选" });
  488. window.open(href, "_blank");
  489. } else {
  490. const res = await raiInterface.industrialSubjectPreserveAndPublish(params);
  491. if (res.Ret === 200) {
  492. clearInterval(this.timeInterval);
  493. sessionStorage.removeItem("addChoicenessQY");
  494. this.$message.success("操作成功!");
  495. type != "保存" && this.init();
  496. this.$router.back();
  497. }
  498. }
  499. }
  500. });
  501. }, 500),
  502. //取消
  503. cancel() {
  504. clearInterval(this.timeInterval);
  505. sessionStorage.removeItem("addChoicenessQY");
  506. this.$refs["ruleForm"].resetFields();
  507. this.$router.back();
  508. },
  509. async getListPeriods() {
  510. const res = await raiInterface.industrialSubjectListPeriods();
  511. if (res.Ret === 200) {
  512. this.updateModeList = res.Data.List || [];
  513. }
  514. },
  515. init() {
  516. this.ruleForm = {
  517. title: "", //标题
  518. author: "", //作者
  519. time: "", //时间
  520. explain: "", //说明
  521. reportLink: "", //变更
  522. };
  523. this.$refs["ruleForm"].resetFields();
  524. this.marketStrategy = "";
  525. },
  526. // 标的下添加公司标签
  527. addLabelClick(item) {
  528. item.CompanyLabel.push({ name: "", value: item.CompanyLabel.length + 1 });
  529. },
  530. // 处理保存的数据
  531. dataHandle(type) {
  532. let industryList = _.cloneDeep(this.industryList);
  533. const arr = [];
  534. let ListChartSummary = [];
  535. industryList.forEach((item) => {
  536. item.List.forEach((key) => {
  537. key.CompanyLabel && (key.CompanyLabel = key.CompanyLabel.map((val) => val.name));
  538. arr.push(key);
  539. });
  540. ListChartSummary.push({
  541. ChartPermissionId: item.ChartPermissionId,
  542. BodyChartSummary: item.BodyChartSummary,
  543. ChartPermissionName: item.ChartPermissionName,
  544. ListSubject: [...item.List],
  545. });
  546. });
  547. if (this.marketStrategy == "") {
  548. this.$message.error("市场策略核心逻辑汇总不能为空");
  549. }
  550. let params = {
  551. AddType: this.updateMode == "重新编辑" ? "1" : "2",
  552. ArticleId: this.$route.query.id ? Number(this.$route.query.id) : 0,
  553. Department: this.ruleForm.author,
  554. Title: this.ruleForm.title,
  555. DoType: type == "发布" ? 1 : 0,
  556. MarketStrategy: this.marketStrategy,
  557. InheritPeriods: this.inheritNum,
  558. List: arr,
  559. ProductDescription: this.ruleForm.explain,
  560. PublishDate: this.ruleForm.time,
  561. ReportLink: this.ruleForm.reportLink,
  562. ListChartSummary,
  563. };
  564. return params;
  565. },
  566. deleteLabelItem(item, index) {
  567. item.CompanyLabel.splice(index, 1);
  568. },
  569. switchChangeHandler(e) {
  570. this.industryList.forEach((_) => {
  571. _.List.forEach((item) => {
  572. if (item.OverviewArticleId === this.overviewList.ArticleId) {
  573. item.IsShowOverviewArticle = e;
  574. }
  575. });
  576. });
  577. },
  578. // 拖拽排序更新
  579. sortChange({ oldIndex, newIndex }) {
  580. this.industryIndex = this.sortChangeFun(this.industryIndex, oldIndex, newIndex);
  581. },
  582. //标的拖拽排序更新
  583. ificationSortChange({ oldIndex, newIndex }) {
  584. this.ificationIndustrial = this.sortChangeFun(this.ificationIndustrial, oldIndex, newIndex);
  585. },
  586. // 排序更新后的逻辑
  587. sortChangeFun(currentIndex, oldIndex, newIndex) {
  588. let bigger, smaller;
  589. if (oldIndex > newIndex) {
  590. bigger = oldIndex;
  591. smaller = newIndex;
  592. } else {
  593. bigger = newIndex;
  594. smaller = oldIndex;
  595. }
  596. // 当前算中tab的排序 小于较小的 大于较大的 则不用做变动
  597. if (currentIndex < smaller || currentIndex > bigger) return currentIndex;
  598. // 移动的是当前选中的
  599. if (currentIndex == oldIndex) return newIndex;
  600. if (oldIndex > newIndex) {
  601. // 向左移 加加
  602. currentIndex++;
  603. } else if (oldIndex < newIndex) {
  604. // 向右移 减减
  605. currentIndex--;
  606. }
  607. return currentIndex;
  608. },
  609. onMove(e) {
  610. // 返回false表示不允许停靠
  611. return !!e.relatedContext.element;
  612. },
  613. },
  614. // 路由离开了 清除定时器
  615. beforeRouteLeave(to, from, next) {
  616. clearInterval(this.timeInterval);
  617. next();
  618. },
  619. };
  620. </script>
  621. <style lang="scss">
  622. .add-choiceness {
  623. .el-date-editor.el-input,
  624. .el-select {
  625. width: 100%;
  626. }
  627. .content-resource {
  628. margin: 30px 0 60px;
  629. display: flex;
  630. line-height: 40px;
  631. .resource {
  632. width: 105px;
  633. }
  634. .show {
  635. flex: 1;
  636. height: 40px;
  637. border: 1px solid #aab4cc;
  638. border-radius: 4px;
  639. padding-left: 20px;
  640. }
  641. }
  642. .content-bottom {
  643. width: 100%;
  644. display: flex;
  645. justify-content: center;
  646. .el-button {
  647. padding: 0 30px;
  648. height: 40px;
  649. margin-left: 30px;
  650. }
  651. }
  652. .dlg-content {
  653. width: 100%;
  654. margin: 40px 0 70px;
  655. .inline-input {
  656. width: 100% !important;
  657. }
  658. .el-input {
  659. width: 100% !important;
  660. }
  661. }
  662. .content-module {
  663. margin-top: 30px;
  664. .content-industry {
  665. display: inline-block;
  666. margin: 30px 0;
  667. .content-name {
  668. display: inline-block;
  669. box-sizing: border-box;
  670. padding: 0 24px;
  671. line-height: 38px;
  672. height: 40px;
  673. background: #ecf5ff;
  674. border: 1px solid #b3d8ff;
  675. opacity: 1;
  676. font-weight: 500;
  677. font-size: 16px;
  678. color: #409eff;
  679. border-radius: 4px;
  680. margin-right: 30px;
  681. }
  682. .active {
  683. background-color: #409eff;
  684. color: #fff;
  685. }
  686. }
  687. .addIndustrial {
  688. box-sizing: border-box;
  689. width: 96px;
  690. height: 60px;
  691. padding-top: 10px;
  692. text-align: center;
  693. background: #ecf5ff;
  694. border: 1px solid #b3d8ff;
  695. opacity: 1;
  696. border-radius: 4px;
  697. color: #409eff;
  698. i {
  699. color: #409eff;
  700. font-weight: 700;
  701. padding-bottom: 5px;
  702. }
  703. span {
  704. display: inline-block;
  705. width: 100%;
  706. }
  707. }
  708. }
  709. .classification {
  710. display: flex;
  711. flex-wrap: wrap;
  712. margin-top: 20px;
  713. .industrial {
  714. position: relative;
  715. box-sizing: border-box;
  716. margin-bottom: 15px;
  717. width: 290px;
  718. height: 60px;
  719. line-height: 60px;
  720. text-align: center;
  721. background: #ecf5ff;
  722. font-size: 14px;
  723. margin-right: 30px;
  724. color: #409eff;
  725. border-radius: 4px;
  726. border: 1px solid #b3d8ff;
  727. }
  728. .pitch {
  729. display: flex;
  730. padding: 0 20px;
  731. justify-content: space-between;
  732. background-color: #409eff;
  733. border: none;
  734. color: #fff !important;
  735. }
  736. .addIndustrial {
  737. box-sizing: border-box;
  738. width: 96px;
  739. height: 60px;
  740. padding-top: 10px;
  741. text-align: center;
  742. background: #ecf5ff;
  743. border: 1px solid #b3d8ff;
  744. opacity: 1;
  745. border-radius: 4px;
  746. color: #409eff;
  747. margin-bottom: 15px;
  748. i {
  749. color: #409eff;
  750. font-weight: 700;
  751. padding-bottom: 5px;
  752. }
  753. span {
  754. display: inline-block;
  755. width: 100%;
  756. }
  757. }
  758. }
  759. .industrial-is-new {
  760. margin-bottom: 20px;
  761. }
  762. .delete-item-icon {
  763. width: 20px;
  764. height: 20px;
  765. margin-right: 20px;
  766. }
  767. }
  768. </style>