AddDevKnow.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104
  1. <template>
  2. <el-scrollbar style="height: 100%" ref="elscrollbar" id="message-container">
  3. <div class="NoiseTemplateWrapper TemplateWrapper knowledgeWrapper">
  4. <crumbs
  5. :title="'医学术语静态知识维护-' + title"
  6. class="topBack"
  7. :param="$route.params"
  8. linkTo="StaticInfo"
  9. ></crumbs>
  10. <div class="info-container">
  11. <el-form
  12. :rules="rules1"
  13. :model="form"
  14. label-width="160px"
  15. ref="groups1"
  16. size="mini"
  17. >
  18. <div class="container_top">
  19. <div v-if="!isEdit" style="margin-right: 40px">
  20. <el-form-item label="选择标准术语:" prop="selectedTerm">
  21. <el-select
  22. v-model="form.selectedTerm"
  23. filterable
  24. remote
  25. clearable
  26. :loading="showDrop"
  27. loading-text="加载中..."
  28. @change="changeWord"
  29. @visible-change="handleVisible"
  30. value-key="id"
  31. @clear="handleClear"
  32. ref="termName"
  33. placeholder="搜索"
  34. :remote-method="searchTerms"
  35. >
  36. <el-option
  37. v-for="(term, idx) in terms"
  38. :key="idx"
  39. :label="
  40. term.name +
  41. (term.typeName ? '(' + term.typeName + ')' : '')
  42. "
  43. :value="term"
  44. :title="
  45. term.name +
  46. (term.typeName ? '(' + term.typeName + ')' : '')
  47. "
  48. ></el-option>
  49. </el-select>
  50. </el-form-item>
  51. </div>
  52. <el-form-item
  53. label="已选择标准术语:"
  54. label-width="160px"
  55. >{{ form.selectedTermName }}</el-form-item
  56. >
  57. </div>
  58. </el-form>
  59. <p class="line"></p>
  60. <div class="tabs">
  61. <div
  62. class="tabs_pane"
  63. :style="
  64. tabActive == 'one' ? { color: '#fff', background: '#00c7da' } : ''
  65. "
  66. @click="tabActiveChange('one')"
  67. >
  68. 静态信息
  69. </div>
  70. <div
  71. class="tabs_pane"
  72. :style="
  73. tabActive == 'two' ? { color: '#fff', background: '#00c7da' } : ''
  74. "
  75. @click="tabActiveChange('two')"
  76. v-if="AssesComSHow"
  77. >
  78. 评估内容
  79. </div>
  80. </div>
  81. <div class="tab_box_left" v-show="tabActive == 'one'">
  82. <el-form
  83. :rules="rules"
  84. :model="form"
  85. label-width="160px"
  86. ref="groups"
  87. size="mini"
  88. >
  89. <div
  90. v-if="
  91. form.selectedTerm &&
  92. (form.typeId == 1 ||
  93. form.typeId == 3 ||
  94. form.typeId == 4 ||
  95. form.typeId == 5 ||
  96. form.typeId == 6)
  97. "
  98. >
  99. <el-form-item
  100. :label="titleChange"
  101. prop="titleChange"
  102. label-width="160px"
  103. style="margin-bottom: 20px"
  104. >
  105. <el-input v-model="form.titleChange"></el-input>
  106. </el-form-item>
  107. </div>
  108. <div v-if="!upload">
  109. <DevInfo
  110. v-for="(f, i) in form.prags"
  111. :key="(i + 1) * 10000 + showType"
  112. :data="f"
  113. :index="i"
  114. :total="form.prags.length"
  115. :isEdit="isEdit"
  116. :isCopy="isCopy"
  117. ref="subForm"
  118. @add="addParagraph(i)"
  119. @del="delParagraph"
  120. @reOrder="reOrder"
  121. :showType="showType"
  122. ></DevInfo>
  123. </div>
  124. <div v-if="upload">
  125. <el-form-item
  126. label="标题名称搜索:"
  127. prop="fileTitle"
  128. label-width="160px"
  129. >
  130. <el-input v-model="form.fileTitle"></el-input>
  131. </el-form-item>
  132. </div>
  133. <div>
  134. <el-form-item
  135. v-if="upload"
  136. label="上传文件:"
  137. ref="upload"
  138. prop="fileList"
  139. label-width="160px"
  140. >
  141. <el-upload
  142. @mouseenter.native="handleMouseenter"
  143. @mouseleave.native="handleMouseleave"
  144. class="upload-demo"
  145. :action="config.urls.promptServer"
  146. name="upfile"
  147. :multiple="false"
  148. :limit="1"
  149. :on-preview="handlePreview"
  150. :on-remove="handleRemove"
  151. :before-upload="handleBeforeUpLoad"
  152. :before-remove="beforeRemove"
  153. :on-change="handleChange"
  154. :on-success="handleSuccess"
  155. :show-file-list="showFileList"
  156. :file-list="form.fileList"
  157. >
  158. <el-button size="small" type="primary" v-if="showUpLoad"
  159. >点击上传</el-button
  160. >
  161. <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> -->
  162. </el-upload>
  163. <span class="tipInfo" v-show="isShowTip">{{
  164. form.fileList[0] && form.fileList[0].name
  165. }}</span>
  166. <!-- <el-button size="small" type="primary" >点击上传</el-button> -->
  167. </el-form-item>
  168. </div>
  169. <el-form-item label-width="160px">
  170. <div class="uploadInfo" v-if="isSuccessUpload === 1">
  171. 文件上传中,请稍等...
  172. </div>
  173. </el-form-item>
  174. </el-form>
  175. </div>
  176. <div v-if="AssesComSHow" v-show="tabActive == 'two'">
  177. <AddAssess :childScaleData="scaleData" ref="assessRef" />
  178. </div>
  179. </div>
  180. <div class="btn">
  181. <el-button type="primary" :disabled="saveDisable" @click="submitForm"
  182. >确 定</el-button
  183. >
  184. </div>
  185. </div>
  186. </el-scrollbar>
  187. </template>
  188. <script>
  189. /**
  190. *
  191. */
  192. import api from "@api/knowledgeTree.js";
  193. import DevInfo from "./DevInfo";
  194. import config from "@api/config";
  195. import $ from "jquery";
  196. import AddAssess from "./AddAssess";
  197. import { resolve } from "path";
  198. export default {
  199. name: "AddDevKnow",
  200. components: {
  201. DevInfo,
  202. AddAssess
  203. },
  204. data() {
  205. return {
  206. AssesComSHow: false,
  207. toAssesTermId: null,
  208. scaleData: null,
  209. isFixedTop: true,
  210. isEdit: false,
  211. isCopy: false,
  212. title: "添加",
  213. termTypes: [],
  214. terms: [], //术语列表
  215. form: {
  216. conceptId: "", //术语id
  217. isTip: 0, //是否要覆盖,0不覆盖,1覆盖
  218. selectedTerm: "", //术语标签
  219. termType: "",
  220. typeId: "",
  221. selectedTermName: "",
  222. selectedTermType: "",
  223. // titleChange: '',
  224. fileList: [],
  225. name: "",
  226. prags: [
  227. {
  228. //单个段落相关
  229. title: "",
  230. content: "",
  231. isReason: 0,
  232. orderNo: 0,
  233. position: [],
  234. text: ""
  235. }
  236. ],
  237. fileTitle: "",
  238. titleChange: ""
  239. },
  240. rules1: {
  241. selectedTerm: [
  242. { required: true, message: "请选择标准术语", trigger: "change" }
  243. ]
  244. },
  245. rules: {
  246. fileTitle: [
  247. { required: true, message: "请输入标题名称", trigger: "change" },
  248. {
  249. validator: (rule, value, callback) => {
  250. if (value.trim().length > 30) {
  251. callback(new Error("标题名称不能超过30字"));
  252. } else {
  253. callback();
  254. }
  255. },
  256. trigger: "change"
  257. }
  258. ],
  259. fileList: [
  260. { required: true, message: "请上传文件", trigger: "change" }
  261. ],
  262. titleChange: [
  263. // {
  264. // validator: (rule, value, callback) => {
  265. // if (!value.trim()) {
  266. // callback(
  267. // new Error('请输入' + this.titleChange.replace(':', ''))
  268. // );
  269. // } else {
  270. // callback();
  271. // }
  272. // },
  273. // trigger: 'change'
  274. // },
  275. { max: 30, message: "标题最多30字", trigger: "change" }
  276. ]
  277. },
  278. saveDisable: false, //保存按钮禁止点击
  279. showDrop: false, //下拉框显示文字bug1774
  280. config: config,
  281. showUpLoad: true,
  282. showFileList: false,
  283. upload: false,
  284. showConfirm: true,
  285. isSuccessUpload: 0, //是否上传成功 0: 不在上传 1: 上传过程中 2: 上传成功
  286. isShowTip: false,
  287. showType: -1, // 1 诊断 2 药品 3检验套餐 4检验细项 5检查 6检查子 7手术和操作 8量表
  288. editCount: -1, // 页面会否被编辑 >0被编辑 =0 未编辑
  289. startCount: -1,
  290. isSaveSuccess: false, // 是否保存成功
  291. tabActive: "one"
  292. };
  293. },
  294. watch: {
  295. showType: {
  296. handler(newVal, oldVal) {
  297. if (newVal !== oldVal) {
  298. this.form.prags = this.form.prags.map((item) => {
  299. return { ...item, position: [] };
  300. });
  301. }
  302. }
  303. },
  304. form: {
  305. handler(newName, oldName) {
  306. this.editCount++;
  307. },
  308. deep: true,
  309. immediate: true
  310. }
  311. },
  312. created: function () {
  313. const { isEdit, data, isCopy } = this.$route.params;
  314. if (isEdit || isCopy) {
  315. this.showType = data.type; // 编辑页确认显示类型
  316. this.isEdit = isEdit;
  317. this.isCopy = isCopy;
  318. this.title = isEdit ? "修改" : isCopy ? "复制" : "添加";
  319. (isEdit || isCopy) && this.changeWord(data);
  320. if (isCopy) {
  321. const _this = this;
  322. setTimeout(() => {
  323. _this.handleClear();
  324. }, 300);
  325. }
  326. api
  327. .getBaseRecordById({ id: data.id })
  328. .then((res) => {
  329. if (res.data.code == "0") {
  330. const data = res.data.data;
  331. this.scaleData = data.scale;
  332. if (this.form.typeId === 82 || this.form.typeId === 83) {
  333. // console.log('data',data)
  334. this.form.fileList =
  335. data &&
  336. data.map((it) => {
  337. return JSON.parse(it.content);
  338. });
  339. this.showFileList = true;
  340. this.showUpLoad = false;
  341. } else {
  342. this.conceptId = data.id;
  343. this.form.typeId = data.type;
  344. this.form.name = data.name;
  345. this.form.titleChange =
  346. data.type == 1
  347. ? data.clinicalPathwayName
  348. : data.type == 3 ||
  349. data.type == 4 ||
  350. data.type == 5 ||
  351. data.type == 6
  352. ? data.noticeName
  353. : "";
  354. this.form.selectedTermName =
  355. data.name + (data.typeName ? "(" + data.typeName + ")" : "");
  356. this.form.selectedTerm =
  357. data.name + (data.typeName ? "(" + data.typeName + ")" : "");
  358. this.form.prags =
  359. data &&
  360. data.details.map((it) => {
  361. return {
  362. title: it.title,
  363. position: this.mapStringToNum(it.contentType),
  364. content: it.content.replace(
  365. /{imageUrlPrefix}/g,
  366. config.imgHost
  367. ),
  368. // isReason:it.isReason,
  369. text: it.text,
  370. disabled: true
  371. };
  372. });
  373. }
  374. }
  375. })
  376. .catch((error) => {
  377. if (error.code === "900010001") {
  378. return false;
  379. }
  380. console.log(error);
  381. });
  382. }
  383. setTimeout(() => {
  384. this.startCount = this.editCount;
  385. }, 500);
  386. },
  387. mounted() {},
  388. beforeRouteLeave(to, from, next) {
  389. // if (this.isSuccessUpload === 1) {
  390. // this.$confirm('文件正在上传,是否确定返回?', '提示', {
  391. // confirmButtonText: '确定',
  392. // cancelButtonText: '取消',
  393. // cancelButtonClass: 'cancel',
  394. // type: 'warning'
  395. // })
  396. // .then(() => {
  397. // next();
  398. // })
  399. // .catch(() => {});
  400. // // this.warning('还有未保存的文件,是否确定返回?');
  401. // } else if (this.isSuccessUpload === 2) {
  402. // this.$confirm('还有未保存的文件,是否确定返回?', '提示', {
  403. // confirmButtonText: '确定',
  404. // cancelButtonText: '取消',
  405. // cancelButtonClass: 'cancel',
  406. // type: 'warning'
  407. // })
  408. // .then(() => {
  409. // next();
  410. // })
  411. // .catch(() => {});
  412. // } else {
  413. // next();
  414. // }
  415. if (this.startCount !== this.editCount && !this.isSaveSuccess) {
  416. this.$alert("还有未保存的内容,确定要退出当前页面吗?", "提示", {
  417. confirmButtonText: "确定",
  418. // cancelButtonText: '取消',
  419. // cancelButtonClass: 'leaveBtn',
  420. // customClass: 'leaveBox',
  421. type: "warning"
  422. })
  423. .then(() => {
  424. next();
  425. })
  426. .catch(() => {});
  427. } else {
  428. next();
  429. }
  430. },
  431. methods: {
  432. tabActiveChange(type) {
  433. this.tabActive = type;
  434. if (type == "two") {
  435. this.$refs.assessRef.resizeTable();
  436. }
  437. },
  438. handleClear() {
  439. this.form.selectedTermName = "";
  440. this.form.selectedTerm = "";
  441. this.form.titleChange = "";
  442. // console.log('处理清空的操作');
  443. },
  444. handleMouseenter() {
  445. if (this.form.fileList.length !== 0) {
  446. this.isShowTip = true;
  447. }
  448. },
  449. handleMouseleave() {
  450. this.isShowTip = false;
  451. },
  452. changeWord(newVal) {
  453. // console.log(newVal, '选中');
  454. if (newVal.typeName == "量表") {
  455. this.AssesComSHow = true;
  456. } else {
  457. this.AssesComSHow = false;
  458. this.tabActive = "one";
  459. }
  460. this.toAssesTermId = newVal.id;
  461. this.showType = newVal.type || -1;
  462. const name = newVal.name;
  463. const typeName = newVal.typeName;
  464. const type = newVal.type;
  465. this.form.selectedTermName =
  466. name + (typeName ? "(" + typeName + ")" : "");
  467. // this.form.selectedTerm = name + (typeName ? '(' + typeName + ')' : '');
  468. this.form.name = name;
  469. this.form.fileList = [];
  470. this.showFileList = false;
  471. this.form.typeId = type || "";
  472. this.showUpLoad = true;
  473. this.titleChange =
  474. type == 1
  475. ? "临床路径标题:"
  476. : type == 3 || type == 4 || type == 5 || type == 6
  477. ? "注意事项标题:"
  478. : "";
  479. this.form.fileTitle = "";
  480. if (newVal.typeId === 82 || newVal.typeId === 83) {
  481. this.upload = true;
  482. this.form.fileTitle = newVal.title;
  483. } else {
  484. this.upload = false;
  485. }
  486. },
  487. handleVisible(flag) {
  488. if (!flag) {
  489. this.terms = [];
  490. }
  491. },
  492. reOrder(isUp, i) {
  493. // isUp: 1 上升 0 下降
  494. let div = this.$refs["elscrollbar"].$refs["wrap"];
  495. let temp = {},
  496. it = {};
  497. if (isUp === 1) {
  498. if (i === 0) {
  499. this.warning("已经是第一个,不能再升啦!");
  500. return;
  501. }
  502. temp = Object.assign(this.form.prags[i - 1]);
  503. it = Object.assign(this.form.prags[i]);
  504. this.form.prags.splice(i - 1, 2, it, temp);
  505. this.$nextTick(() => {
  506. div.scrollTop = this.$refs.subForm[i - 1].$el.offsetTop - 48;
  507. });
  508. } else {
  509. if (i === this.form.prags.length - 1) {
  510. this.warning("已经是最后一个,不能再降啦!");
  511. return;
  512. }
  513. temp = Object.assign(this.form.prags[i + 1]);
  514. it = Object.assign(this.form.prags[i]);
  515. this.form.prags.splice(i, 2, temp, it);
  516. }
  517. },
  518. addParagraph(i) {
  519. this.form.prags.splice(i + 1, 0, {
  520. title: "",
  521. content: "",
  522. isReason: 0,
  523. position: [],
  524. text: ""
  525. });
  526. //添加段落光标自动落到新增的段落中
  527. setTimeout(() => {
  528. this.$refs.subForm[i + 1].$el
  529. .getElementsByClassName("el-input__inner")[0]
  530. .focus();
  531. });
  532. },
  533. delParagraph(i) {
  534. if (this.form.prags.length == 1) {
  535. this.warning("只剩一个段落,不能再删啦!");
  536. return;
  537. }
  538. this.showConfirmDialog("确定要删除该段落?", () => {
  539. this.form.prags.splice(i, 1);
  540. });
  541. },
  542. back() {
  543. this.$router.go(-1);
  544. },
  545. searchTerms(query) {
  546. if (!query.trim()) {
  547. this.form.terms = [];
  548. return;
  549. }
  550. //搜索术语列表
  551. this.showDrop = true;
  552. api
  553. .staticKnowledgeBaseInfo({ inputStr: query.trim(), types: [0] })
  554. .then((res) => {
  555. this.showDrop = false;
  556. if (res.data.code === "0") {
  557. this.terms = res.data.data;
  558. } else {
  559. this.warning("数据获取失败");
  560. }
  561. });
  562. },
  563. mapStringToNum(str) {
  564. return str.split(",").map((it) => {
  565. return +it;
  566. });
  567. },
  568. // 额外的表单检验
  569. formVal() {
  570. let positiontemp = this.form.prags.map((item) => {
  571. return [...item.position];
  572. });
  573. let positionArr = positiontemp.reduce(function (a, b) {
  574. return a.concat(b);
  575. }); // 所有被选中的值集合
  576. console.log(positionArr, "positionArr");
  577. console.log(this.showType, "当前页的显示类型");
  578. let isVisFlag = positionArr.some((item) => item === 2);
  579. let isDiagFlag = positionArr.some((item) => item === 3);
  580. console.log(isVisFlag, "isVisFlag是否显示");
  581. if (
  582. (this.showType == 3 ||
  583. this.showType == 4 ||
  584. this.showType == 5 ||
  585. this.showType == 6) &&
  586. isVisFlag
  587. ) {
  588. console.log("进入校验");
  589. //若医学术语为检验/检查,且内容类型选择了注意事项,此时“注意事项标题”是必填项
  590. this.$refs.groups.clearValidate();
  591. this.rules.titleChange.push({
  592. required: true,
  593. message: "请输入注意事项标题",
  594. trigger: "change"
  595. });
  596. this.$refs.groups.validateField("titleChange");
  597. this.$refs.groups.validateField("selectedTerm");
  598. this.rules.titleChange = this.rules.titleChange.slice(0, 1);
  599. if (this.form.titleChange.trim() !== "") {
  600. // console.log('内容不为空');
  601. return true;
  602. } else {
  603. var div = this.$refs["elscrollbar"].$refs["wrap"];
  604. this.$nextTick(() => {
  605. div.scrollTop = 0;
  606. });
  607. return false;
  608. }
  609. // return;
  610. } else if (isDiagFlag && this.showType == 1) {
  611. // 若医学术语为诊断,且内容类型选择了临床路径,此时“临床路径标题”是必填项
  612. this.$refs.groups.clearValidate();
  613. this.rules.titleChange.push({
  614. required: true,
  615. message: "请输入临床路径标题",
  616. trigger: "change"
  617. });
  618. this.$refs.groups.validateField("titleChange");
  619. this.$refs.groups.validateField("selectedTerm");
  620. this.rules.titleChange = this.rules.titleChange.slice(0, 1);
  621. if (this.form.titleChange.trim() !== "") {
  622. // console.log('内容不为空');
  623. return true;
  624. } else {
  625. var div = this.$refs["elscrollbar"].$refs["wrap"];
  626. this.$nextTick(() => {
  627. div.scrollTop = 0;
  628. });
  629. return false;
  630. }
  631. }
  632. },
  633. async submitForm() {
  634. if (this.isSuccessUpload === 1) {
  635. this.warning("文件上传中,请稍等");
  636. return;
  637. }
  638. let flagVal = this.formVal(); // 额外的表单校验
  639. if (flagVal === false) return;
  640. //验证外层表单
  641. let goOn = true,
  642. it = null;
  643. let outIsVia = true; // 外层验证是否通过
  644. let fvalidate = new Promise((resolve, reject) => {
  645. //wanglei 添加promise
  646. this.$refs.groups.validate((valid) => {
  647. console.log("valid", valid);
  648. if (valid) {
  649. resolve();
  650. } else {
  651. console.log("???????!!!");
  652. reject("f");
  653. return false;
  654. }
  655. });
  656. });
  657. let fvalidate1 = new Promise((resolve, reject) => {
  658. //wanglei 添加promise
  659. this.$refs.groups1.validate((valid) => {
  660. console.log("valid1", valid);
  661. if (valid) {
  662. resolve();
  663. } else {
  664. console.log("???????!!!");
  665. reject("f");
  666. return false;
  667. }
  668. });
  669. });
  670. // end....
  671. //验证段落表单
  672. // return;
  673. let viewHeight = 0; // 定位到表单校验的高度
  674. let viewHeightArr = []; // 表单校验出错高度的所有数组
  675. let fvalidate3 = null;
  676. if (this.form.typeId !== 82 && this.form.typeId !== 83) {
  677. fvalidate3 = new Promise((resolve, reject) => {
  678. for (let i = 0; i < this.$refs.subForm.length; i++) {
  679. it = this.$refs.subForm[i];
  680. viewHeight += it.$el.offsetHeight;
  681. it.$refs.form.validate((valid) => {
  682. if (!valid) {
  683. reject("f");
  684. goOn = false;
  685. viewHeightArr.push(viewHeight);
  686. } else {
  687. resolve();
  688. }
  689. });
  690. }
  691. });
  692. }
  693. // 表单验证
  694. let all = [fvalidate, fvalidate1, fvalidate3];
  695. if (this.$refs.assessRef) {
  696. all.push(...this.$refs.assessRef.assessCommit());
  697. }
  698. await Promise.all(all)
  699. .then(() => {})
  700. .catch((err) => {
  701. // 跳转到未校验通过的tab页
  702. if (err == "f") {
  703. this.tabActive = "one";
  704. } else if (err == "c") {
  705. this.tabActive = "two";
  706. }
  707. goOn = false;
  708. outIsVia = false;
  709. });
  710. // console.log(viewHeightArr,'viewHeightArr');
  711. if (!goOn) {
  712. var div = this.$refs["elscrollbar"].$refs["wrap"];
  713. if (outIsVia) {
  714. // 外层校验通过,跳转至下层校验具体位置
  715. this.$nextTick(() => {
  716. div.scrollTop = +viewHeightArr[0] - 150;
  717. });
  718. } else {
  719. // 外层校验没通过,页面滚动到顶部
  720. this.$nextTick(() => {
  721. div.scrollTop = 0;
  722. });
  723. }
  724. return;
  725. }
  726. //通过必填验证,提交保存
  727. const item = this.form.prags;
  728. let param = [];
  729. if (this.form.typeId === 82 || this.form.typeId === 83) {
  730. if (this.form.fileList.length === 0) {
  731. this.warning("文件未上传,不存储数据");
  732. return;
  733. }
  734. param.push(
  735. Object.assign(
  736. {},
  737. {
  738. position: this.form.typeId === 82 ? "8" : "9",
  739. conceptId: this.form.conceptId,
  740. title: this.form.fileTitle,
  741. orderNo: 0,
  742. content: JSON.stringify(this.form.fileList[0])
  743. }
  744. )
  745. );
  746. } else {
  747. let data = this.form.prags,
  748. tempArr = [],
  749. paramsAll = {},
  750. types = this.form.typeId;
  751. for (let i = 0; i < data.length; i++) {
  752. let obj = {};
  753. obj.content = data[i].content;
  754. obj.text = data[i].text;
  755. obj.conceptId = data[i].conceptId;
  756. obj.orderNo = i;
  757. obj.title = data[i].title;
  758. obj.contentType = data[i].position.join(",");
  759. tempArr.push(obj);
  760. }
  761. paramsAll.clinicalPathwayName = types == 1 ? this.form.titleChange : "";
  762. paramsAll.id = this.conceptId;
  763. paramsAll.name = this.form.name;
  764. paramsAll.noticeName =
  765. types == 3 || types == 4 || types == 5 || types == 6
  766. ? this.form.titleChange
  767. : "";
  768. paramsAll.type = this.form.typeId;
  769. paramsAll.details = tempArr;
  770. param = paramsAll;
  771. }
  772. // this.showSaveDialog(param,'是否'+(this.isEdit?'修改':'保存')+'该静态知识?');
  773. // 评估内容的数据
  774. if (this.AssesComSHow) {
  775. const assessParam = this.$refs.assessRef.formtParams();
  776. param.scale = assessParam;
  777. param.scale.conceptId = this.toAssesTermId;
  778. const userInfo = localStorage.getItem("userLoginDTO");
  779. param.scale.modifier = userInfo.linkman;
  780. }
  781. // console.log("param-------");
  782. // console.dir(param);
  783. // return;
  784. if (!this.isEdit) {
  785. // 新增页面
  786. this.saveDisable = true;
  787. this.sendSaveOrEdit(param);
  788. return;
  789. }
  790. this.showSaveDialog(
  791. param,
  792. '<div><p style="color: #333333">确定保存修改内容?</p><p style="color: #D70A25">保存后将覆盖原有数据,且原有数据无法恢复。</p></div>'
  793. );
  794. },
  795. showSaveDialog(param, msg) {
  796. this.showConfirmDialog(msg, () => {
  797. this.saveDisable = true; //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
  798. this.sendSaveOrEdit(param);
  799. });
  800. },
  801. //保存编辑 接口
  802. sendSaveOrEdit(param) {
  803. this.isCopy && (param.id = undefined);
  804. api
  805. .saveBaseOrUpdateRecord(param)
  806. .then((res) => {
  807. if (res.data.code === "0") {
  808. this.isSuccessUpload = 0; // 修改文件上传状态为0
  809. this.warning(res.data.msg || "保存成功", "success");
  810. this.isSaveSuccess = true; // 保存成功,可正常退出
  811. //返回带搜索条件的首页
  812. this.$router.push({
  813. name: "StaticInfo",
  814. params: Object.assign({}, this.$route.params, {
  815. currentPage: 1
  816. })
  817. });
  818. } else {
  819. this.warning(res.data.msg);
  820. }
  821. this.saveDisable = false;
  822. })
  823. .catch((err) => {
  824. if (err.code === "900010001") {
  825. return false;
  826. }
  827. this.saveDisable = false;
  828. this.warning(err);
  829. });
  830. },
  831. // 弹出窗
  832. showConfirmDialog(msg, resolve) {
  833. this.$alert(msg, "提示", {
  834. confirmButtonText: "确定",
  835. // cancelButtonText: '取消',
  836. // cancelButtonClass: 'cancel',
  837. // confirmButtonClass: 'confirmBtn',
  838. dangerouslyUseHTMLString: true,
  839. type: "warning"
  840. })
  841. .then(() => {
  842. resolve();
  843. })
  844. .catch(() => {});
  845. },
  846. warning(msg, type) {
  847. this.$message({
  848. showClose: true,
  849. message: msg,
  850. type: type || "warning"
  851. });
  852. },
  853. handleChange(file, fileList) {
  854. // if(fileList&&fileList[0]&&fileList[0].response&&fileList[0].response.code==='0'){
  855. // this.showUpLoad = false
  856. // this.showFileList = true
  857. // }else{
  858. // this.showUpLoad = true
  859. // this.showFileList = false
  860. // }
  861. // console.log(fileList,this.form.fileList,'aa')
  862. },
  863. handleSuccess(response, file, fileList) {
  864. if (response.code == "0") {
  865. this.showFileList = true;
  866. this.form.fileList = [];
  867. this.form.fileList.push({
  868. name: response.data.title,
  869. url: response.data.url,
  870. size: response.data.size
  871. });
  872. this.showUpLoad = false;
  873. if (!this.form.fileTitle) {
  874. this.form.fileTitle = response.data.title;
  875. }
  876. this.isSuccessUpload = 2; // 上传成功状态
  877. this.$refs.upload && this.$refs.upload.clearValidate(); // 清除校验
  878. } else {
  879. this.warning(response.msg || "上传失败");
  880. // this.form.fileList = []
  881. this.showUpLoad = true;
  882. this.showFileList = false;
  883. this.form.fileList = [];
  884. }
  885. },
  886. handleRemove(file, fileList) {
  887. this.showUpLoad = true;
  888. this.form.fileList = [];
  889. this.isSuccessUpload = 0;
  890. },
  891. handleBeforeUpLoad(file) {
  892. // 上传过程中 上传按钮 隐藏
  893. this.isSuccessUpload = 1; // 上传过程中
  894. this.showFileList = true; // 新增 进度条 显示
  895. this.$refs.upload && this.$refs.upload.clearValidate(); // 清除校验
  896. this.showUpLoad = false;
  897. if (file.size / 1024 / 1024 >= 500) {
  898. this.warning("文件上传失败,超出大小限制500MB");
  899. this.form.fileList = [];
  900. this.showConfirm = false;
  901. return false;
  902. } else {
  903. this.showConfirm = true;
  904. }
  905. },
  906. handlePreview(file) {},
  907. beforeRemove(file, fileList) {
  908. if (this.showConfirm) {
  909. return this.$alert(`确定移除 ${file.name}?`, "", {
  910. cancelButtonClass: "cacelBtn"
  911. });
  912. }
  913. }
  914. }
  915. };
  916. </script>
  917. <style lang="less" scoped>
  918. @import "../../less/common.less";
  919. .cell .el-button.delete:focus {
  920. color: red !important;
  921. }
  922. .topBack {
  923. top: 0;
  924. }
  925. .info-container {
  926. // background: #fff;
  927. // padding: 20px 0;
  928. margin: 70px 20px -20px 20px;
  929. min-width: 960px;
  930. .el-input__inner {
  931. width: 200px;
  932. }
  933. .el-form-item__label {
  934. text-align: left;
  935. }
  936. .add-prg .el-form-item {
  937. margin-bottom: 20px;
  938. }
  939. // .el-form-item {
  940. // margin-bottom: 8px !important;
  941. // }
  942. }
  943. // .cancel span {
  944. // color: #22ccc8;
  945. // }
  946. .line {
  947. // border-top: 1px #dcdfe6 solid;
  948. background: #dcdfe6;
  949. height: 12px;
  950. }
  951. .NoiseTemplateWrapper .info-container .el-input__inner {
  952. width: 250px;
  953. }
  954. // .NoiseTemplateWrapper .el-select .el-input .el-icon-circle-close{
  955. // display: inherit!important;
  956. // }
  957. .cacelBtn {
  958. color: #22ccc8 !important;
  959. }
  960. .upload-demo {
  961. width: 300px;
  962. /deep/.el-upload-list__item .el-icon-close-tip {
  963. display: none !important;
  964. }
  965. /deep/.el-upload-list__item .el-upload-list__item-name {
  966. max-width: 250px;
  967. white-space: nowrap;
  968. overflow: hidden;
  969. text-overflow: ellipsis;
  970. }
  971. /deep/ .focusing {
  972. // border: 1px solid transparent !important;
  973. outline: transparent !important;
  974. }
  975. }
  976. .uploadInfo {
  977. margin-top: -20px;
  978. color: #606266;
  979. }
  980. .tipInfo {
  981. position: absolute;
  982. // position: relative;
  983. line-height: 24px;
  984. top: -56px;
  985. left: 20px;
  986. // background-color: transparent;
  987. // color: #606266;
  988. padding: 3px 10px;
  989. border-radius: 4px;
  990. margin: 100px auto;
  991. background-color: #4d4d4d;
  992. text-align: center;
  993. color: #fff;
  994. font-size: 14px;
  995. }
  996. .tipInfo:before {
  997. content: "";
  998. display: block;
  999. position: absolute;
  1000. // bottom: 9px;
  1001. top: -10px;
  1002. left: 18px;
  1003. border-bottom: 6px solid #4d4d4d;
  1004. border-top: 6px solid transparent;
  1005. border-left: 6px solid transparent;
  1006. border-right: 6px solid transparent;
  1007. // border-right: 6px solid #4D4D4D;
  1008. }
  1009. .btn {
  1010. text-align: right;
  1011. margin: 0 20px;
  1012. padding: 30px;
  1013. background: #fff;
  1014. }
  1015. .el-message-box {
  1016. /deep/ .el-icon-warning {
  1017. background-color: transparent !important;
  1018. // display: none;
  1019. }
  1020. /deep/ .el-message-box__message {
  1021. margin: 24px 0px;
  1022. }
  1023. // /deep/ .confirmBtn {
  1024. // // position: relative;
  1025. // // right: 240px !important;
  1026. // // top: 0px;
  1027. // background-color: #fff !important;
  1028. // span {
  1029. // color: #48c5d7 !important;
  1030. // }
  1031. // }
  1032. /deep/ .cancel {
  1033. background-color: #d7d7d7;
  1034. border-color: transparent !important;
  1035. span {
  1036. color: #fff;
  1037. }
  1038. }
  1039. }
  1040. /deep/ .el-tabs__header {
  1041. padding: 0 10px !important;
  1042. }
  1043. .container_top {
  1044. display: flex;
  1045. padding: 20px 30px;
  1046. align-items: center;
  1047. }
  1048. .tabs {
  1049. display: flex;
  1050. margin: 15px 30px;
  1051. font-size: 14px;
  1052. height: 31px;
  1053. border-bottom: 1px solid #e6e6e6;
  1054. .tabs_pane {
  1055. width: 92px;
  1056. height: 32px;
  1057. border-radius: 6px 6px 0px 0px;
  1058. border: 1px solid #00c7da;
  1059. text-align: center;
  1060. line-height: 32px;
  1061. margin-right: 15px;
  1062. box-sizing: border-box;
  1063. color: #00c7da;
  1064. cursor: pointer;
  1065. }
  1066. }
  1067. .tab_box_left {
  1068. padding: 0 30px;
  1069. }
  1070. /deep/ .el-form-item.is-success .el-input__inner,
  1071. .el-form-item.is-success .el-textarea__inner {
  1072. border-color: #c9c9c9 !important;
  1073. }
  1074. /deep/ .el-form-item.is-success .el-textarea__inner {
  1075. border-color: #c9c9c9 !important;
  1076. }
  1077. /deep/ .el-form-item.is-success .el-textarea__inner {
  1078. border-color: #c9c9c9 !important;
  1079. }
  1080. </style>