AddMedicinePrompt.vue 27 KB

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