AddPlan.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830
  1. <template>
  2. <el-scrollbar style="height: 100%" ref="elscrollbar">
  3. <div class="AddPlanWrapper clearfix" @click="close">
  4. <crumbs
  5. :title="isEdit ? '电子病历方案配置-修改方案' : '电子病历方案配置-添加方案'"
  6. class="topBack"
  7. :param="$route.params"
  8. linkTo="Plan"
  9. ></crumbs>
  10. <div class="AddPlanBox">
  11. <el-row :gutter="20">
  12. <el-col :span="16">
  13. <el-form ref="form" :model="form" label-width="80px" :rules="rules">
  14. <!-- <el-form-item label="医院名称" prop="hoipitalName">
  15. <el-input v-model="form.planName" placeholder="2-30位,可输入汉字、字母、数字和下划线"></el-input>
  16. </el-form-item>-->
  17. <el-form-item label="医院名称" class="selectMedicine" prop="hospitalId">
  18. <el-select
  19. v-model="form.hospitalId"
  20. placeholder="请选择"
  21. clearable
  22. style="width: 100%"
  23. >
  24. <el-option
  25. v-for="item in HospitalInfoList"
  26. :label="item.name"
  27. :value="item.id"
  28. :key="item.id"
  29. ></el-option>
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item label="方案名称" prop="planName">
  33. <el-input v-model="form.planName" placeholder="2-30位,可输入汉字、字母、数字和下划线"></el-input>
  34. </el-form-item>
  35. <el-form-item label="方案编码" prop="planCode">
  36. <el-input v-model="form.planCode" placeholder="可输入字母、数字和下划线"></el-input>
  37. </el-form-item>
  38. <el-form-item label="方案配置">
  39. <ul>
  40. <li>
  41. <div class="title">
  42. <div class="handleIcon" @click="openPlanItems">
  43. <img
  44. src="../../../images/multi.png"
  45. alt="辅助信息"
  46. :class="{'open' : isOpenCloseItems}"
  47. />
  48. </div>
  49. <h4>辅助信息</h4>
  50. <div class="titlwSwitch">
  51. <el-switch
  52. v-model="switchSubStatus"
  53. :active-value="1"
  54. :inactive-value="0"
  55. active-color="#4BC4D7"
  56. inactive-color="#BBBBBB"
  57. ></el-switch>
  58. <span class="titlwSwitchStatus">{{switchSubStatus === 1 ? '启用中' : '未启用'}}</span>
  59. </div>
  60. </div>
  61. <transition name="plus-icon">
  62. <div v-if="isOpenCloseItems">
  63. <ul class="sub" v-for="(item,index) in planDefaultList" :key="item.id">
  64. <li class="planItem">
  65. <div class="sort" v-if="item.ismove">
  66. <div class="top">
  67. <img
  68. :src="isTopLight !== index ? require('../../../images/icon_default_top.png') : require('../../../images/icon_hover_top.png')"
  69. alt="上升"
  70. v-if="index !== 0"
  71. @click="sortPlan(item,index,'top')"
  72. @mouseover="handleMouseEnter1(index)"
  73. @mouseleave="handleMouseLeave1(index)"
  74. />
  75. </div>
  76. <div class="down">
  77. <img
  78. :src="isDownLight !== index ? require('../../../images/icon_default_down.png') : require('../../../images/icon_hover_down.png')"
  79. alt="下降"
  80. v-if="index !== planDefaultList.length - 1"
  81. @click="sortPlan(item,index,'down')"
  82. @mouseover="handleMouseEnter(index)"
  83. @mouseleave="handleMouseLeave(index)"
  84. />
  85. </div>
  86. </div>
  87. <div class="sort" v-else></div>
  88. <div class="openOrClose">
  89. <span class="planInfo">{{item.name}}</span>
  90. <!-- <span class="planInfo">{{i.name}}</span> -->
  91. <div class="switch">
  92. <el-switch
  93. v-model="item.status"
  94. :active-value="1"
  95. :inactive-value="0"
  96. active-color="#4BC4D7"
  97. inactive-color="#BBBBBB"
  98. ></el-switch>
  99. </div>
  100. <span class="planStatus">{{item.status === 1 ? '启用中' : '未启用'}}</span>
  101. </div>
  102. <div class="showNum" v-if="item.number">
  103. <span style="marginRight:8px;">默认显示个数</span>
  104. <el-select
  105. v-model="item.number"
  106. placeholder="请选择"
  107. size="small"
  108. :disabled="item.status !== 1 ? true: false"
  109. >
  110. <el-option label="1" value="1"></el-option>
  111. <el-option label="2" value="2"></el-option>
  112. <el-option label="3" value="3"></el-option>
  113. <el-option label="4" value="4"></el-option>
  114. <el-option label="5" value="5"></el-option>
  115. <el-option label="6" value="6"></el-option>
  116. </el-select>
  117. </div>
  118. </li>
  119. <li
  120. class="planItem"
  121. v-if="item.arr.length>0"
  122. v-for="i in item.arr"
  123. :key="i.id"
  124. >
  125. <div class="sort"></div>
  126. <div class="openOrClose">
  127. <span class="planInfo">{{i.name}}</span>
  128. <div class="switch">
  129. <el-switch
  130. v-model="i.status"
  131. :active-value="1"
  132. :inactive-value="0"
  133. active-color="#4BC4D7"
  134. inactive-color="#BBBBBB"
  135. ></el-switch>
  136. </div>
  137. <span class="planStatus">{{i.status === 1 ? '启用中' : '未启用'}}</span>
  138. </div>
  139. <div class="showNum" v-if="item.number">
  140. <span style="marginRight:8px;">默认显示个数</span>
  141. <el-select
  142. v-model="item.number"
  143. placeholder="请选择"
  144. size="small"
  145. :disabled="item.status !== 1 ? true: false"
  146. >
  147. <el-option label="1" value="1"></el-option>
  148. <el-option label="2" value="2"></el-option>
  149. <el-option label="3" value="3"></el-option>
  150. <el-option label="4" value="4"></el-option>
  151. <el-option label="5" value="5"></el-option>
  152. <el-option label="6" value="6"></el-option>
  153. </el-select>
  154. </div>
  155. </li>
  156. </ul>
  157. </div>
  158. </transition>
  159. </li>
  160. <li>
  161. <div class="title">
  162. <div class="handleIcon">
  163. <img src="../../../images/multi.png" alt="医学知识" />
  164. </div>
  165. <h4>医学知识</h4>
  166. <div class="titlwSwitch">
  167. <el-switch
  168. v-model="switchMedStatus"
  169. :active-value="1"
  170. :inactive-value="0"
  171. active-color="#4BC4D7"
  172. inactive-color="#BBBBBB"
  173. ></el-switch>
  174. <span class="titlwSwitchStatus">{{switchMedStatus === 1 ? '启用中' : '未启用'}}</span>
  175. </div>
  176. </div>
  177. </li>
  178. <li>
  179. <div class="title">
  180. <div class="handleIcon">
  181. <img src="../../../images/multi.png" alt="医学知识" />
  182. </div>
  183. <h4>随访计划</h4>
  184. <div class="titlwSwitch">
  185. <el-switch
  186. v-model="switchFollowStatus"
  187. :active-value="1"
  188. :inactive-value="0"
  189. active-color="#4BC4D7"
  190. inactive-color="#BBBBBB"
  191. ></el-switch>
  192. <span class="titlwSwitchStatus">{{switchFollowStatus === 1 ? '启用中' : '未启用'}}</span>
  193. </div>
  194. </div>
  195. </li>
  196. </ul>
  197. </el-form-item>
  198. <el-form-item>
  199. <el-button type="primary" @click="onSubmit" :disabled="saveDisable">确定</el-button>
  200. </el-form-item>
  201. </el-form>
  202. </el-col>
  203. </el-row>
  204. </div>
  205. </div>
  206. </el-scrollbar>
  207. </template>
  208. <script>
  209. import api from '@api/cdss.js';
  210. export default {
  211. name: 'AddPlan',
  212. data() {
  213. var numreg = /^[a-zA-Z0-9_\u4e00-\u9fa5]+$/;
  214. var numreg1 = /^[0-9a-zA-Z_]{1,}$/;
  215. var validatePass = (rule, value, callback) => {
  216. if (!numreg.test(value)) {
  217. callback(new Error('汉字、字母、数字和下划线'));
  218. } else {
  219. callback();
  220. }
  221. };
  222. var validatePass1 = (rule, value, callback) => {
  223. if (!numreg1.test(value)) {
  224. callback(new Error('字母、数字和下划线'));
  225. } else {
  226. callback();
  227. }
  228. };
  229. return {
  230. form: {
  231. hospitalId: '',
  232. planName: '',
  233. planCode: ''
  234. },
  235. saveDisable: false, //保存按钮禁止点击
  236. rules: {
  237. planName: [
  238. { required: true, message: '方案名称不能为空', trigger: 'change' },
  239. { min: 2, max: 30, message: '长度2-30位', trigger: 'blur' },
  240. { required: true, validator: validatePass, trigger: 'blur' }
  241. ],
  242. hospitalId: [
  243. { required: true, message: '医院名称不能为空', trigger: 'change' }
  244. // { min: 2, max: 30, message: '长度2-30位', trigger: 'blur' },
  245. // { required: true, validator: validatePass, trigger: 'blur' }
  246. ],
  247. planCode: [
  248. { required: true, message: '方案编码不能为空', trigger: 'change' },
  249. { required: true, validator: validatePass1, trigger: 'blur' }
  250. ]
  251. },
  252. planDefaultList: [],
  253. // hospitalId: '',
  254. isEdit: false, // 是否处于编辑页面 false--新增 true--编辑
  255. switchSubStatus: 0, // 辅助信息
  256. switchMedStatus: 0, // 医学知识
  257. switchFollowStatus: 0, //随访计划
  258. isOpenCloseItems: true, // 是否展开方案配置项
  259. isDownLight: -1,
  260. isTopLight: -1,
  261. flag: 1,
  262. editCount: -1, // 页面会否被编辑 >0被编辑 =0 未编辑
  263. isSaveSuccess: false, // 是否保存成功
  264. HospitalInfoList: []
  265. };
  266. },
  267. beforeRouteLeave(to, from, next) {
  268. console.log(this.editCount, 'this.editCount');
  269. if (
  270. (this.editCount > 3 && !this.isSaveSuccess && this.isEdit) ||
  271. (this.editCount > 1 && !this.isSaveSuccess && !this.isEdit)
  272. ) {
  273. // console.log('页面被编辑了');
  274. this.$alert('还有未保存的内容,确定要退出当前页面吗?', '提示', {
  275. confirmButtonText: '确定',
  276. // cancelButtonText: '取消',
  277. // cancelButtonClass: 'leaveBtn',
  278. // customClass: 'leaveBox',
  279. type: 'warning'
  280. })
  281. .then(() => {
  282. next();
  283. })
  284. .catch(() => {});
  285. } else {
  286. next();
  287. }
  288. },
  289. watch: {
  290. form: {
  291. handler(newName, oldName) {
  292. this.editCount++;
  293. },
  294. deep: true
  295. // immediate: true
  296. },
  297. planDefaultList: {
  298. handler(newName, oldName) {
  299. // console.log(newName,'newName');
  300. // console.log(oldName,'oldName');
  301. this.editCount++;
  302. },
  303. deep: true,
  304. immediate: true
  305. }
  306. },
  307. async created() {
  308. const { isEdit, data } = this.$route.params;
  309. console.log(data, '编辑页传递的data');
  310. this._getHospitalInfo(); // 获取医院下拉列表
  311. // let res = await api.getHospitalInfo(); // 同步获取医院信息
  312. // this.hospitalId = res.data.data.id;
  313. if (isEdit) {
  314. // 编辑页面
  315. this.isEdit = true;
  316. this.form.hospitalId = data.hospitalId;
  317. let params = {
  318. hospitalId: data.hospitalId,
  319. id: data.id
  320. };
  321. this._getPlanInfoIds(params);
  322. } else {
  323. // 新增页面
  324. this._getDefaultPlans(); // 获取默认配置信息
  325. }
  326. },
  327. methods: {
  328. close() {},
  329. // 获取医院下拉列表
  330. _getHospitalInfo() {
  331. api.getHospitalInfo().then(res => {
  332. if (res.data.code === '0') {
  333. this.HospitalInfoList = res.data.data;
  334. }
  335. });
  336. },
  337. // 方案配置排序
  338. sortPlan(item, index, type) {
  339. console.log('排序', item, index, type);
  340. let tempList = [...this.planDefaultList];
  341. if (type === 'down') {
  342. tempList.splice(index + 2, 0, item);
  343. tempList.splice(index, 1);
  344. [tempList[index + 1].orderNo, tempList[index].orderNo] = [
  345. tempList[index].orderNo,
  346. tempList[index + 1].orderNo
  347. ];
  348. this.planDefaultList = tempList;
  349. // 降序
  350. // let plan = tempList.find(item => {
  351. // console.log(item)
  352. // return item.orderNo === index + 1;
  353. // });
  354. // console.log(item);
  355. // let tempPlan = { ...plan };
  356. // let planNext = tempList.find(item => {
  357. // return item.orderNo === index + 2;
  358. // });
  359. // let tempPlanNext = { ...planNext };
  360. // plan = tempPlanNext;
  361. // plan.orderNo -= 1;
  362. // planNext = tempPlan;
  363. // planNext.orderNo += 1;
  364. // let arr = tempList.map((i, idx) => {
  365. // if (idx === index) {
  366. // return { ...plan };
  367. // } else if (idx === index + 1) {
  368. // return { ...planNext };
  369. // } else {
  370. // return i;
  371. // }
  372. // });
  373. // this.planDefaultList = [...arr];
  374. } else {
  375. tempList.splice(index - 1, 0, item);
  376. tempList.splice(index+1, 1);
  377. [tempList[index - 1].orderNo, tempList[index].orderNo] = [
  378. tempList[index].orderNo,
  379. tempList[index - 1].orderNo
  380. ];
  381. this.planDefaultList = tempList;
  382. // 升序
  383. // let plan = tempList.find(item => {
  384. // return item.orderNo === index + 1;
  385. // });
  386. // let tempPlan = { ...plan };
  387. // let planPre = tempList.find(item => {
  388. // return item.orderNo === index;
  389. // });
  390. // let tempPlanPre = { ...planPre };
  391. // plan = tempPlanPre;
  392. // plan.orderNo += 1;
  393. // planPre = tempPlan;
  394. // planPre.orderNo -= 1;
  395. // let arr = tempList.map((i, idx) => {
  396. // if (idx === index) {
  397. // return { ...plan };
  398. // } else if (idx === index - 1) {
  399. // return { ...planPre };
  400. // } else {
  401. // return i;
  402. // }
  403. // });
  404. // this.planDefaultList = [...arr];
  405. }
  406. },
  407. // 展开列表项
  408. openPlanItems() {
  409. this.isOpenCloseItems = !this.isOpenCloseItems;
  410. },
  411. // 鼠标移入
  412. handleMouseEnter(index) {
  413. this.isDownLight = index;
  414. },
  415. // 鼠标移除
  416. handleMouseLeave(index) {
  417. this.isDownLight = -1;
  418. },
  419. // 鼠标移入
  420. handleMouseEnter1(index) {
  421. this.isTopLight = index;
  422. },
  423. // 鼠标移除
  424. handleMouseLeave1(index) {
  425. this.isTopLight = -1;
  426. },
  427. // 添加 获取默认方案配置
  428. _getDefaultPlans() {
  429. api.getDefaultPlans().then(res => {
  430. // console.log(res, '获取默认的方案配置');
  431. if (res.data.code === '0') {
  432. this.planDefaultList =
  433. res.data.data &&
  434. res.data.data.planDetailDefault.length !== 0 &&
  435. res.data.data.planDetailDefault[0].planDetails;
  436. let planDefaultList = this.planDefaultList.map((item, index) => {
  437. if (
  438. item.name == '高危' ||
  439. item.name == '危急值提醒' ||
  440. item.name == '其他提醒'
  441. ) {
  442. return {
  443. ismove: false,
  444. ...item
  445. };
  446. } else {
  447. return {
  448. arr: [],
  449. ismove: true,
  450. ...item
  451. };
  452. }
  453. });
  454. // this.planDefaultList = JSON.parse(JSON.stringify(planDefaultList)) ;
  455. planDefaultList
  456. .slice()
  457. .reverse()
  458. .forEach((item, i, arr) => {
  459. if (
  460. item.name == '高危' ||
  461. item.name == '危急值提醒' ||
  462. item.name == '其他提醒'
  463. ) {
  464. planDefaultList.splice(arr.length - 1 - i, 1);
  465. planDefaultList
  466. .find(items => {
  467. return items.name == '开单合理性';
  468. })
  469. .arr.unshift(item);
  470. }
  471. });
  472. this.planDefaultList = planDefaultList;
  473. this.switchSubStatus =
  474. res.data.data &&
  475. res.data.data.planDetailDefault.length !== 0 &&
  476. res.data.data.planDetailDefault[0].status;
  477. this.switchMedStatus =
  478. res.data.data &&
  479. res.data.data.planDetailDefault.length !== 0 &&
  480. res.data.data.planDetailDefault[1].status;
  481. this.switchFollowStatus =
  482. res.data.data &&
  483. res.data.data.planDetailDefault.length !== 0 &&
  484. res.data.data.planDetailDefault[2].status;
  485. }
  486. });
  487. },
  488. // 编辑页面 根据id获取方案配置
  489. async _getPlanInfoIds(params) {
  490. // 先获取默认的所有方案
  491. let tempArr = [];
  492. let newPlan = [];
  493. let res = await api.getDefaultPlans();
  494. if (res.data.code === '0') {
  495. tempArr =
  496. res.data.data &&
  497. res.data.data.planDetailDefault.length !== 0 &&
  498. res.data.data.planDetailDefault[0].planDetails;
  499. }
  500. let res1 = await api.getPlanInfoIds(params);
  501. if (res1.data.code === '0') {
  502. newPlan = res1.data.data[0].sysSetInfo[0].planDetails;
  503. this.form.planName = res1.data.data[0].planName;
  504. this.form.planCode = res1.data.data[0].planCode;
  505. this.switchSubStatus = res1.data.data[0].sysSetInfo[0].status;
  506. this.switchMedStatus = res1.data.data[0].sysSetInfo[1].status;
  507. this.switchFollowStatus = res1.data.data[0].sysSetInfo[2].status;
  508. // this.planDefaultList = res1.data.data[0].sysSetInfo[0].planDetails;
  509. }
  510. let arr = [];
  511. let arrTemp = [];
  512. let arrTemp1 = []; // 不同index
  513. for (var i = 0; i < tempArr.length; i++) {
  514. arrTemp.push(i);
  515. }
  516. for (var i = 0; i < tempArr.length; i++) {
  517. for (var j = 0; j < newPlan.length; j++) {
  518. if (tempArr[i].code === newPlan[j].code) {
  519. arr.push(i);
  520. }
  521. }
  522. }
  523. arrTemp1 = arr
  524. .filter(x => arrTemp.indexOf(x) == -1)
  525. .concat(arrTemp.filter(x => arr.indexOf(x) == -1));
  526. let endArr = [...newPlan];
  527. for (var j = 0; j < arrTemp1.length; j++) {
  528. let temp = tempArr[arrTemp1[j]];
  529. temp.orderNo = arr.length + j + 1;
  530. temp.status = 0;
  531. endArr.push(temp);
  532. }
  533. // console.log(endArr,'-=-=-=-=-=');
  534. this.planDefaultList = endArr;
  535. let planDefaultList = this.planDefaultList.map((item, index) => {
  536. if (
  537. item.name == '高危' ||
  538. item.name == '危急值提醒' ||
  539. item.name == '其他提醒'
  540. ) {
  541. return {
  542. ismove: false,
  543. ...item
  544. };
  545. } else {
  546. return {
  547. arr: [],
  548. ismove: true,
  549. ...item
  550. };
  551. }
  552. });
  553. planDefaultList
  554. .slice()
  555. .reverse()
  556. .forEach((item, i, arr) => {
  557. if (
  558. item.name == '高危' ||
  559. item.name == '危急值提醒' ||
  560. item.name == '其他提醒'
  561. ) {
  562. planDefaultList.splice(arr.length - 1 - i, 1);
  563. planDefaultList
  564. .find(items => {
  565. return items.name == '开单合理性';
  566. })
  567. .arr.unshift(item);
  568. }
  569. });
  570. this.planDefaultList = planDefaultList;
  571. },
  572. // format处理细项数据
  573. handleSendData() {
  574. this.planDefaultList.forEach((item, i) => {
  575. if(item.name == '开单合理性'){
  576. item.arr.slice().reverse().forEach(items => {
  577. if (items.name == '高危' ||items.name == '危急值提醒' ||items.name == '其他提醒') {
  578. console.log(i)
  579. this.planDefaultList.splice(i+1, 0, items);
  580. }
  581. })
  582. item.arr = []
  583. }
  584. })
  585. console.log(this.planDefaultList)
  586. let TempPlanDetail = [];
  587. TempPlanDetail = this.planDefaultList.map((item, index) => {
  588. return {
  589. code: item.code,
  590. hospitalId: this.form.hospitalId,
  591. name: item.name,
  592. number: item.number,
  593. orderNo: item.orderNo,
  594. planId: item.planId,
  595. remark: item.remark,
  596. status: item.status,
  597. value: item.value
  598. };
  599. });
  600. return TempPlanDetail;
  601. console.log(TempPlanDetail, 'TempPlanDetail');
  602. },
  603. // 处理保存活动信息参数
  604. _getParams() {
  605. let params = {
  606. hospitalId: this.form.hospitalId,
  607. planCode: this.form.planCode,
  608. planDetailParent: [
  609. {
  610. code: 'auxiliary',
  611. hospitalId: this.form.hospitalId,
  612. name: '辅助信息',
  613. number: 0,
  614. orderNo: 1,
  615. planDetailSub: this.handleSendData(),
  616. status: this.switchSubStatus
  617. },
  618. {
  619. code: 'medical',
  620. hospitalId: this.form.hospitalId,
  621. name: '医学知识',
  622. orderNo: 3,
  623. planDetailSub: [{}],
  624. status: this.switchMedStatus
  625. },
  626. {
  627. code: 'followup',
  628. hospitalId: this.form.hospitalId,
  629. name: '随访计划',
  630. orderNo: 4,
  631. planDetailSub: [{}],
  632. status: this.switchFollowStatus
  633. }
  634. ], // 方案配置信息
  635. planName: this.form.planName,
  636. planStatus: 1 // 1 启用 默认启用
  637. };
  638. if (this.isEdit) {
  639. // 编辑状态,需要额外添加ID
  640. const { data } = this.$route.params;
  641. params = { ...params, id: data.id };
  642. }
  643. return params;
  644. },
  645. onSubmit() {
  646. this.$refs.form.validate(valid => {
  647. if (valid) {
  648. this.saveDisable = true;
  649. let params = this._getParams();
  650. // console.log(params, 'params');
  651. // return;
  652. api.savePlanInfoDatas(params).then(res => {
  653. if (res.data.code === '0') {
  654. this.$message({
  655. showClose: true,
  656. message: '保存成功',
  657. type: 'success',
  658. duration: 1000
  659. });
  660. this.isSaveSuccess = true; // 保存成功,可正常退出
  661. this.$router.push({
  662. name: 'Plan',
  663. params: Object.assign({}, this.$route.params, {
  664. currentPage: 1
  665. })
  666. });
  667. } else if (res.data.code === '00020007') {
  668. // 方案名/方案编码已存在
  669. this.$message({
  670. showClose: true,
  671. message: res.data.msg,
  672. type: 'error',
  673. duration: 1000
  674. });
  675. }
  676. this.saveDisable = false;
  677. });
  678. } else {
  679. this.saveDisable = false;
  680. var div = this.$refs['elscrollbar'].$refs['wrap'];
  681. this.$nextTick(() => {
  682. div.scrollTop = 0;
  683. });
  684. return false;
  685. }
  686. });
  687. }
  688. }
  689. };
  690. </script>
  691. <style lang="less" scoped>
  692. .AddPlanWrapper {
  693. min-width: 940px;
  694. .AddPlanBox {
  695. padding: 20px 60px 120px 60px;
  696. margin: 70px 20px 0 20px;
  697. background: #fff;
  698. }
  699. color: #606266;
  700. .topBack {
  701. top: 0;
  702. }
  703. .title {
  704. background-color: #f2f2f2;
  705. display: flex;
  706. .handleIcon {
  707. width: 30px;
  708. cursor: pointer;
  709. height: 40px;
  710. display: flex;
  711. justify-content: center;
  712. align-items: center;
  713. img {
  714. width: 20px;
  715. height: 20px;
  716. }
  717. .open {
  718. transform: rotate(180deg);
  719. }
  720. .close {
  721. transform: rotate(0deg);
  722. }
  723. }
  724. .titlwSwitch {
  725. width: 120px;
  726. }
  727. h4 {
  728. flex: 1;
  729. }
  730. .titlwSwitchStatus {
  731. margin-left: 16px;
  732. }
  733. }
  734. .sub {
  735. .planItem {
  736. display: flex;
  737. .sort {
  738. width: 60px;
  739. display: flex;
  740. .top {
  741. display: flex;
  742. justify-content: center;
  743. align-items: center;
  744. width: 30px;
  745. cursor: pointer;
  746. img {
  747. width: 10px;
  748. height: 14px;
  749. }
  750. }
  751. .down {
  752. width: 30px;
  753. cursor: pointer;
  754. display: flex;
  755. justify-content: center;
  756. align-items: center;
  757. img {
  758. width: 10px;
  759. height: 14px;
  760. }
  761. }
  762. }
  763. .openOrClose {
  764. display: flex;
  765. flex: 1;
  766. .planInfo {
  767. width: 140px;
  768. }
  769. .switch {
  770. }
  771. .planStatus {
  772. margin-left: 16px;
  773. }
  774. }
  775. .showNum {
  776. display: flex;
  777. width: 160px;
  778. /deep/.el-input--small {
  779. width: 60px;
  780. }
  781. }
  782. }
  783. }
  784. .el-button {
  785. float: right;
  786. }
  787. .plus-icon-enter-active {
  788. transition: all 0.8s;
  789. }
  790. .plus-icon-enter {
  791. opacity: 0;
  792. margin-top: 12px;
  793. }
  794. .plus-icon-leave-active {
  795. transition: all 0.8s;
  796. }
  797. .plus-icon-leave-active {
  798. opacity: 0;
  799. margin-top: 12px;
  800. }
  801. }
  802. .leaveBox {
  803. /deep/ .leaveBtn {
  804. // margin-right: 46px;
  805. background-color: #d7d7d7 !important;
  806. border-color: transparent;
  807. }
  808. }
  809. .selectMedicine {
  810. /deep/ .el-input__suffix-inner {
  811. position: relative;
  812. top: -1px;
  813. }
  814. /deep/ .el-icon-circle-close {
  815. position: relative;
  816. top: -2px;
  817. }
  818. }
  819. </style>