血透系统pad前端

TreatmentDialog.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <template>
  2. <div>
  3. <div class="Dialog" v-show="isShowDialog">
  4. <div class="DialogTit">
  5. <span @click="close()" class="iconfont">&#xe6e9;</span>
  6. <h1 class="name">治疗小结</h1>
  7. <span @click="commitInfo" class="success">保存</span>
  8. </div>
  9. <div class="DialogContent choose" id="dialogTop">
  10. <el-form :model="dialysisSummary" label-width="120px">
  11. <el-form-item label="透后宣教 : ">
  12. <!-- <el-select @change="dialysisAfterTeachSelectChange" v-model="dialysisSummary.text1" placeholder="请选择">
  13. <el-option v-for="(s, index) in teach" :label="s.text" :value="s.value" :key="index"></el-option>
  14. </el-select>-->
  15. <el-input
  16. class="treatmentInput"
  17. readonly
  18. v-model="dialysisSummary.propagandaAndEducationContentSelect"
  19. placeholder="请选择"
  20. @focus="showSubMenu('education')"
  21. ></el-input>
  22. </el-form-item>
  23. <el-form-item label-width="0">
  24. <el-input
  25. class="newTextarea treatmentInput"
  26. type="textarea"
  27. v-model="dialysisSummary.propagandaAndEducationContent"
  28. :rows="5"
  29. ></el-input>
  30. </el-form-item>
  31. <el-form-item label="透析小结 : ">
  32. <el-input
  33. readonly
  34. class="treatmentInput"
  35. v-model="dialysisSummary.summaryContentSelect"
  36. placeholder="请选择"
  37. @focus="showSubMenu('summary')"
  38. ></el-input>
  39. </el-form-item>
  40. <el-form-item label-width="0">
  41. <el-input
  42. class="newTextarea treatmentInput"
  43. @focus="lastInputFocus"
  44. @blur="lastInputBlur"
  45. type="textarea"
  46. v-model="dialysisSummary.summaryContent"
  47. :rows="5"
  48. ></el-input>
  49. </el-form-item>
  50. </el-form>
  51. <!-- <div class="button">
  52. <button @click="commitInfo" class="submitButton">提交</button>
  53. </div>-->
  54. </div>
  55. </div>
  56. <check-box-sub-menu
  57. :visibility="visibility"
  58. v-on:menu-cancle="menuCancle"
  59. v-on:menu-comfirm="menuComfirm"
  60. :propsForm="propForm"
  61. ></check-box-sub-menu>
  62. </div>
  63. </template>
  64. <script>
  65. import { commitTreatmentSummary } from "@/api/dialysis";
  66. import { Toast } from "vant";
  67. import CheckBoxSubMenu from "./subMenu/checkBoxSubMenu";
  68. import { getDataConfig } from "@/utils/data";
  69. export default {
  70. name: "TreatmentDialog",
  71. data() {
  72. return {
  73. isShowDialog: true,
  74. visibility: false,
  75. propForm: {
  76. title: "",
  77. list: [],
  78. optionList: [],
  79. isMultiple: 2,
  80. result: [], //选中的值
  81. type: 1, //用来区分不同子菜单,方便对返回值进行赋值
  82. selectId: 0
  83. },
  84. dialysisSummary: {
  85. text: "",
  86. propagandaAndEducationContent: "",
  87. propagandaAndEducationContentSelect: "",
  88. text2: "",
  89. summaryContent: "",
  90. summaryContentSelect: "",
  91. changeMedicalNurse: "",
  92. treatNurse: "",
  93. checkStaff: "",
  94. deboardNurse: "",
  95. treatDoctor: ""
  96. },
  97. summary: [],
  98. summaryObj: {},
  99. teach: [],
  100. teachObj: {},
  101. title: "治疗小结 ",
  102. record_date: "",
  103. patient: {
  104. id: 0
  105. }
  106. };
  107. },
  108. props: {
  109. record: {
  110. type: Object
  111. },
  112. patient_prop: {
  113. type: Object
  114. }
  115. },
  116. created() {
  117. // this.summary = this.$store.getters.summary;
  118. this.summary = getDataConfig("summary", "summary");
  119. // console.log("this.summary",this.summary)
  120. // this.teach = this.$store.getters.teach;
  121. this.teach = getDataConfig("education", "education");
  122. if (this.teach.length > 0) {
  123. var tlen = this.teach.length;
  124. for (let index = 0; index < tlen; index++) {
  125. this.teach[index].name = this.teach[index].text;
  126. this.teachObj[this.teach[index].id] = this.teach[index];
  127. }
  128. }
  129. if (this.summary.length > 0) {
  130. var tlen = this.summary.length;
  131. for (let index = 0; index < tlen; index++) {
  132. this.summary[index].name = this.summary[index].text;
  133. this.summaryObj[this.summary[index].id] = this.summary[index];
  134. }
  135. }
  136. var date = this.$route.query && this.$route.query.date;
  137. date *= 1000;
  138. var newDate = new Date(date);
  139. var y = newDate.getFullYear();
  140. var m = newDate.getMonth() + 1;
  141. var d = newDate.getDate();
  142. if (isNaN(y) || isNaN(m) || isNaN(d)) {
  143. newDate = new Date();
  144. y = newDate.getFullYear();
  145. m = newDate.getMonth() + 1;
  146. d = newDate.getDate();
  147. }
  148. this.record_date =
  149. y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d);
  150. // this.patient.id = this.patient_prop.id
  151. if (this.record != null && this.record.id != "") {
  152. for (const key in this.record) {
  153. this.dialysisSummary[key] = this.record[key];
  154. }
  155. if (this.record.mission != "undefined") {
  156. this.dialysisSummary.propagandaAndEducationContent = this.record.mission;
  157. }
  158. if (this.record.dialysis_summary != "undefined") {
  159. this.dialysisSummary.summaryContent = this.record.dialysis_summary;
  160. }
  161. }
  162. },
  163. methods: {
  164. lastInputFocus: function(event) {
  165. var input = event.target;
  166. setTimeout(function() {
  167. input.style.marginBottom = "2rem";
  168. input.parentNode.scrollIntoView();
  169. }, 0);
  170. },
  171. lastInputBlur: function(event) {
  172. var input = event.target;
  173. setTimeout(function() {
  174. input.style.marginBottom = "";
  175. }, 0);
  176. },
  177. showSubMenu: function(val) {
  178. switch (val) {
  179. case "education":
  180. this.propForm.type = 1;
  181. this.isShowDialog = false;
  182. this.propForm.title = "透后宣教";
  183. this.visibility = true;
  184. this.propForm.list = [];
  185. this.propForm.optionList = this.teach;
  186. this.propForm.isMultiple = 1;
  187. this.propForm.selectId = this.dialysisSummary.xjid;
  188. break;
  189. case "summary":
  190. this.propForm.type = 2;
  191. this.isShowDialog = false;
  192. this.propForm.title = "透析小结";
  193. this.visibility = true;
  194. this.propForm.list = [];
  195. this.propForm.optionList = this.summary;
  196. this.propForm.isMultiple = 1;
  197. this.propForm.selectId = this.dialysisSummary.xxjid;
  198. break;
  199. }
  200. },
  201. menuCancle: function() {
  202. this.visibility = false;
  203. this.isShowDialog = true;
  204. },
  205. menuComfirm: function(val) {
  206. this.visibility = false;
  207. this.isShowDialog = true;
  208. switch (val.type) {
  209. case 1:
  210. if (val.selectId in this.teachObj) {
  211. var theValue = this.teachObj[val.selectId].value;
  212. this.dialysisAfterTeachSelectChange(theValue);
  213. this.dialysisSummary.xjid = val.selectId;
  214. this.dialysisSummary.propagandaAndEducationContentSelect = this.teachObj[
  215. val.selectId
  216. ].name;
  217. }
  218. break;
  219. case 2:
  220. if (val.selectId in this.summaryObj) {
  221. var theValue = this.summaryObj[val.selectId].value;
  222. this.dialysisSummarySelectChange(theValue);
  223. this.dialysisSummary.xxjid = val.selectId;
  224. this.dialysisSummary.summaryContentSelect = this.summaryObj[
  225. val.selectId
  226. ].name;
  227. }
  228. break;
  229. }
  230. },
  231. dialysisSummarySelectChange: function(values) {
  232. if(this.dialysisSummary.summaryContent == null){
  233. this.dialysisSummary.summaryContent == ""
  234. }
  235. if (this.dialysisSummary.summaryContent == "") {
  236. this.dialysisSummary.summaryContent = values;
  237. } else {
  238. if (this.dialysisSummary.summaryContent.indexOf(values) == -1) {
  239. if (
  240. this.dialysisSummary.summaryContent
  241. .charAt(this.dialysisSummary.summaryContent.length - 1)
  242. .indexOf("。") == -1
  243. ) {
  244. this.dialysisSummary.summaryContent =
  245. this.dialysisSummary.summaryContent + "," + values;
  246. } else {
  247. this.dialysisSummary.summaryContent =
  248. this.dialysisSummary.summaryContent + values;
  249. }
  250. }
  251. }
  252. },
  253. dialysisAfterTeachSelectChange: function(values) {
  254. if(this.dialysisSummary.propagandaAndEducationContent == null){
  255. this.dialysisSummary.propagandaAndEducationContent == ""
  256. }
  257. if (this.dialysisSummary.propagandaAndEducationContent == "") {
  258. this.dialysisSummary.propagandaAndEducationContent = values;
  259. } else {
  260. if (this.dialysisSummary.propagandaAndEducationContent.indexOf(values) == -1) {
  261. if (
  262. this.dialysisSummary.propagandaAndEducationContent.charAt(this.dialysisSummary.propagandaAndEducationContent.length - 1).indexOf("。") == -1) {
  263. this.dialysisSummary.propagandaAndEducationContent =
  264. this.dialysisSummary.propagandaAndEducationContent + "," + values;
  265. } else {
  266. this.dialysisSummary.propagandaAndEducationContent =
  267. this.dialysisSummary.propagandaAndEducationContent + values;
  268. }
  269. }
  270. }
  271. },
  272. commitInfo: function() {
  273. Toast.loading({ forbidClick: true, duration: 0 });
  274. let ParamsQuery = this.dialysisSummary;
  275. ParamsQuery["patient"] = this.$route.query.patient_id;
  276. ParamsQuery["record_date"] = this.record_date;
  277. commitTreatmentSummary(ParamsQuery).then(response => {
  278. if (response.data.state == 0) {
  279. Toast.fail(response.data.msg);
  280. return false;
  281. } else {
  282. Toast.success("提交成功");
  283. this.$emit("did_update", response.data.data.summary);
  284. for (const key in response.data.data.summary) {
  285. this.record[key] = response.data.data.summary[key];
  286. }
  287. }
  288. });
  289. },
  290. close: function() {
  291. this.$emit("close");
  292. },
  293. open: function() {
  294. this.isShowDialog = true;
  295. this.visibility = false;
  296. var dialogTop = document.querySelector("#dialogTop");
  297. if (dialogTop != null) {
  298. this.$nextTick(() => {
  299. dialogTop.scrollTop = 0;
  300. });
  301. }
  302. }
  303. },
  304. components: {
  305. CheckBoxSubMenu
  306. }
  307. };
  308. </script>
  309. <style style="stylesheet/scss" lang="scss" scoped>
  310. .choose {
  311. padding: 0.6rem 0.6rem 0 0.6rem;
  312. .button {
  313. text-align: center;
  314. .submitButton {
  315. width: 3rem;
  316. height: 0.8rem;
  317. line-height: 0.8rem;
  318. background: $main-color;
  319. color: #fff;
  320. font-size: 0.3rem;
  321. text-align: center;
  322. border-radius: 6px;
  323. }
  324. }
  325. }
  326. </style>
  327. <style lang="scss">
  328. .newTextarea {
  329. font-size: 0.45rem;
  330. }
  331. .treatmentInput {
  332. .el-input__inner {
  333. font-size: 0.45rem;
  334. }
  335. .el-textarea__inner {
  336. font-size: 0.45rem;
  337. }
  338. }
  339. </style>