addChoiceness.vue 28 KB

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