treatmentSummaryDialog.vue 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. <template>
  2. <el-dialog
  3. class="newDialog"
  4. title="治疗小结"
  5. width="854px"
  6. :visible.sync="isVisibility"
  7. :modal-append-to-body="false"
  8. >
  9. <div class="warnTxt" v-if="showTxt != ''">{{ showTxt }}</div>
  10. <el-form :model="treatmentSummary">
  11. <el-row :gutter="20">
  12. <el-col :span="24" v-if="isShow('宣教知识')">
  13. <el-form-item label="宣教知识:">
  14. <el-select @change="dialysisAfterTeachSelectChange" v-model="value">
  15. <el-option
  16. v-for="(item, index) in education"
  17. :label="item.text"
  18. :value="item.value"
  19. :key="index"
  20. ></el-option>
  21. </el-select>
  22. </el-form-item>
  23. </el-col>
  24. </el-row>
  25. <el-row :gutter="20">
  26. <el-col v-if="isShow('宣教知识')">
  27. <el-form-item>
  28. <el-input
  29. type="textarea"
  30. v-model="treatmentSummary.mission"
  31. :rows="4"
  32. ></el-input>
  33. </el-form-item>
  34. </el-col>
  35. </el-row>
  36. <el-row :gutter="20">
  37. <el-col :span="24" v-if="isShow('透析小结')">
  38. <el-form-item label="透析小结:">
  39. <el-select @change="dialysisSummarySelectChange" v-model="value2">
  40. <el-option
  41. v-for="(item, index) in summary"
  42. :label="item.text"
  43. :value="item.value"
  44. :key="index"
  45. ></el-option>
  46. </el-select>
  47. </el-form-item>
  48. </el-col>
  49. </el-row>
  50. <el-row :gutter="20">
  51. <el-col v-if="isShow('透析小结')">
  52. <el-form-item>
  53. <el-input
  54. type="textarea"
  55. v-model="treatmentSummary.dialysis_summary"
  56. :rows="4"
  57. ></el-input>
  58. </el-form-item>
  59. </el-col>
  60. </el-row>
  61. <el-row :gutter="20">
  62. <el-col :span="24" v-if="isShow('透析护理记录')">
  63. <el-form-item label="透析护理记录:">
  64. <el-select
  65. @change="dialysisNusingRecordSelectChange"
  66. v-model="value3"
  67. >
  68. <el-option
  69. v-for="(item, index) in nursingRecord"
  70. :label="item.text"
  71. :value="item.value"
  72. :key="index"
  73. ></el-option>
  74. </el-select>
  75. </el-form-item>
  76. </el-col>
  77. </el-row>
  78. <el-row :gutter="20">
  79. <el-col v-if="isShow('透析护理记录')">
  80. <el-form-item>
  81. <el-input
  82. type="textarea"
  83. v-model="treatmentSummary.nursing_record"
  84. :rows="4"
  85. ></el-input>
  86. </el-form-item>
  87. </el-col>
  88. </el-row>
  89. <el-row :gutter="20">
  90. <el-col :span="24" v-if="isShow('特殊记录')">
  91. <el-form-item label="特殊记录:">
  92. <el-select
  93. @change="dialysisSpecialRecordSelectChange"
  94. v-model="value4"
  95. >
  96. <el-option
  97. v-for="(item, index) in specialRecord"
  98. :label="item.text"
  99. :value="item.value"
  100. :key="index"
  101. ></el-option>
  102. </el-select>
  103. </el-form-item>
  104. </el-col>
  105. </el-row>
  106. <el-row :gutter="20">
  107. <el-col v-if="isShow('特殊记录')">
  108. <el-form-item>
  109. <el-input
  110. type="textarea"
  111. v-model="treatmentSummary.special_record"
  112. :rows="4"
  113. ></el-input>
  114. </el-form-item>
  115. </el-col>
  116. </el-row>
  117. </el-form>
  118. <div slot="footer" class="dialog-footer">
  119. <el-button @click="handleCancle">取 消</el-button>
  120. <el-button type="primary" @click="handleComfirm" v-if="hasPermission"
  121. >保 存</el-button
  122. >
  123. </div>
  124. </el-dialog>
  125. </template>
  126. <script>
  127. import { getDataConfig } from '@/utils/data'
  128. import { postTreatmentsummary } from '@/api/dialysis'
  129. import { uParseTime } from '@/utils/tools'
  130. import store from '@/store'
  131. import request from '@/utils/request'
  132. export default {
  133. name: 'treatmentSummaryDialog',
  134. props: {
  135. treatment_summary: {
  136. // 治疗小结
  137. type: Object,
  138. default: () => {
  139. return { id: 0 }
  140. }
  141. },
  142. patient: {
  143. // 患者信息
  144. type: Object,
  145. default: () => {
  146. return { id: 0 }
  147. }
  148. },
  149. },
  150. data() {
  151. return {
  152. showTxt: '',
  153. hasPermission: true,
  154. value: '',
  155. value2: '',
  156. value3: '',
  157. value4: '',
  158. isVisibility: false,
  159. record_date: '',
  160. education: [],
  161. summary: [],
  162. nursingRecord: [],
  163. specialRecord: [],
  164. treatmentSummary: {
  165. mission: '',
  166. dialysis_summary: '',
  167. sj_nurse: '',
  168. zl_nurse: '',
  169. hd_nurse: '',
  170. xj_nurse: '',
  171. zl_doctor: '',
  172. nursing_record: '',
  173. special_record: ''
  174. },
  175. //
  176. date:''
  177. }
  178. },
  179. methods: {
  180. show(record,date) {
  181. this.isVisibility = true
  182. this.record = record
  183. console.log(111111111111111,date)
  184. if(date){
  185. this.date = date
  186. this.record_date = uParseTime(this.date, '{y}-{m}-{d}')
  187. console.log(22222222222,this.record_date)
  188. }
  189. console.log('治疗小结', record)
  190. this.getPermission()
  191. },
  192. hide() {
  193. this.isVisibility = false
  194. },
  195. dialysisAfterTeachSelectChange: function(values) {
  196. if (this.treatmentSummary.mission == '') {
  197. this.treatmentSummary.mission = values
  198. } else {
  199. if (this.treatmentSummary.mission.indexOf(values) == -1) {
  200. if (
  201. this.treatmentSummary.mission
  202. .charAt(this.treatmentSummary.mission.length - 1)
  203. .indexOf('。') == -1
  204. ) {
  205. this.treatmentSummary.mission =
  206. this.treatmentSummary.mission + ',' + values
  207. } else {
  208. this.treatmentSummary.mission =
  209. this.treatmentSummary.mission + values
  210. }
  211. }
  212. }
  213. },
  214. dialysisSummarySelectChange: function(values) {
  215. if (this.treatmentSummary.dialysis_summary == '') {
  216. this.treatmentSummary.dialysis_summary = values
  217. } else {
  218. if (this.treatmentSummary.dialysis_summary.indexOf(values) == -1) {
  219. if (
  220. this.treatmentSummary.dialysis_summary
  221. .charAt(this.treatmentSummary.dialysis_summary.length - 1)
  222. .indexOf('。') == -1
  223. ) {
  224. this.treatmentSummary.dialysis_summary =
  225. this.treatmentSummary.dialysis_summary + ',' + values
  226. } else {
  227. this.treatmentSummary.dialysis_summary =
  228. this.treatmentSummary.dialysis_summary + ',' + values
  229. this.treatmentSummary.dialysis_summary =
  230. this.treatmentSummary.dialysis_summary + values
  231. }
  232. }
  233. }
  234. },
  235. dialysisNusingRecordSelectChange: function(values) {
  236. if (this.treatmentSummary.nursing_record == '') {
  237. this.treatmentSummary.nursing_record = values
  238. } else {
  239. if (this.treatmentSummary.nursing_record.indexOf(values) == -1) {
  240. if (
  241. this.treatmentSummary.nursing_record
  242. .charAt(this.treatmentSummary.nursing_record.length - 1)
  243. .indexOf('。') == -1
  244. ) {
  245. this.treatmentSummary.nursing_record =
  246. this.treatmentSummary.nursing_record + ',' + values
  247. } else {
  248. this.treatmentSummary.nursing_record =
  249. this.treatmentSummary.nursing_record + ',' + values
  250. this.treatmentSummary.nursing_record =
  251. this.treatmentSummary.nursing_record + values
  252. }
  253. }
  254. }
  255. },
  256. dialysisSpecialRecordSelectChange(values) {
  257. if (this.treatmentSummary.special_record == '') {
  258. this.treatmentSummary.special_record = values
  259. } else {
  260. if (this.treatmentSummary.special_record.indexOf(values) == -1) {
  261. if (
  262. this.treatmentSummary.special_record
  263. .charAt(this.treatmentSummary.special_record.length - 1)
  264. .indexOf('。') == -1
  265. ) {
  266. this.treatmentSummary.special_record =
  267. this.treatmentSummary.special_record + ',' + values
  268. } else {
  269. this.treatmentSummary.special_record =
  270. this.treatmentSummary.special_record + ',' + values
  271. this.treatmentSummary.special_record =
  272. this.treatmentSummary.special_record + values
  273. }
  274. }
  275. }
  276. },
  277. handleCancle: function() {
  278. this.isVisibility = false
  279. },
  280. handleComfirm: function() {
  281. const ParamsQuery = this.treatmentSummary
  282. ParamsQuery['patient'] = this.patient.id
  283. ParamsQuery['record_date'] = this.record_date
  284. ParamsQuery['mode'] = '1'
  285. if (this.treatment_summary.id > 0) {
  286. ParamsQuery['mode'] = '2'
  287. if (
  288. this.treatment_summary.creater != this.$store.getters.xt_user.user.id
  289. ) {
  290. ParamsQuery['mode'] = '3'
  291. }
  292. }
  293. postTreatmentsummary(ParamsQuery).then(response => {
  294. if (response.data.state == 0) {
  295. this.$message.error(response.data.msg)
  296. return false
  297. } else {
  298. this.$notify({
  299. title: '成功',
  300. message: '提交成功',
  301. type: 'success',
  302. duration: 2000
  303. })
  304. const summary_resp = response.data.data.summary
  305. // prop
  306. var treatment_summary = this.treatment_summary
  307. for (var index in summary_resp) {
  308. // treatment_summary[index] = summary_resp[index];
  309. this.$set(treatment_summary, index, summary_resp[index])
  310. }
  311. this.hide()
  312. }
  313. })
  314. },
  315. getPermission() {
  316. request
  317. .get('/api/func_per/get', {
  318. params: {
  319. create_url: '/api/dialysis/treatmentsummary?mode=1',
  320. modify_url: '/api/dialysis/treatmentsummary?mode=2',
  321. modify_other_url: '/api/dialysis/treatmentsummary?mode=3',
  322. module: 9
  323. }
  324. })
  325. .then(res => {
  326. if (res.data.state == 0) {
  327. this.hasPermission = false
  328. } else if (res.data.state == 1) {
  329. if (this.record.id != '' && this.record.creater != 0) {
  330. // 有数据
  331. if (this.record.creater == this.$store.getters.user.admin.id) {
  332. // 创建人是自己
  333. if (res.data.data.is_has_modify == false) {
  334. this.hasPermission = false
  335. this.showTxt = '你没有修改治疗小结权限'
  336. }
  337. } else {
  338. // 创建人不是自己
  339. if (res.data.data.is_has_modify_other == false) {
  340. this.hasPermission = false
  341. this.showTxt = '你没有修改他人治疗小结权限'
  342. }
  343. }
  344. } else if (this.record.id == '' || this.record.creater == 0) {
  345. if (res.data.data.is_has_create == false) {
  346. this.hasPermission = false
  347. this.showTxt = '你没有新增治疗小结权限'
  348. }
  349. }
  350. }
  351. })
  352. },
  353. isShow(name) {
  354. var filedList = store.getters.xt_user.fileds
  355. for (let i = 0; i < filedList.length; i++) {
  356. if (
  357. filedList[i].module == 6 &&
  358. filedList[i].filed_name_cn == name &&
  359. filedList[i].is_show == 1
  360. ) {
  361. return true
  362. }
  363. }
  364. return false
  365. }
  366. },
  367. watch: {
  368. isVisibility(val) {},
  369. 'treatment_summary.id': {
  370. immediate: true,
  371. deep:true,
  372. handler(oldVal,newVal) {
  373. if(oldVal == newVal){
  374. for (var index in this.treatmentSummary) {
  375. this.treatmentSummary[index] = this.treatment_summary[index]
  376. }
  377. }
  378. if (this.treatment_summary.id > 0) {
  379. for (var index in this.treatmentSummary) {
  380. this.value = ''
  381. this.value2 = ''
  382. this.value3 = ''
  383. this.value4 = ''
  384. this.treatmentSummary[index] = this.treatment_summary[index]
  385. }
  386. }else if(this.treatment_summary.id == 0){
  387. for (var index in this.treatmentSummary) {
  388. // this.treatmentSummary[index] = this.treatment_summary[index]
  389. this.value = ''
  390. this.value2 = ''
  391. this.value3 = ''
  392. this.value4 = ''
  393. this.treatmentSummary = {
  394. mission: '',
  395. dialysis_summary: '',
  396. sj_nurse: '',
  397. zl_nurse: '',
  398. hd_nurse: '',
  399. xj_nurse: '',
  400. zl_doctor: '',
  401. nursing_record: '',
  402. special_record: ''
  403. }
  404. }
  405. }
  406. }
  407. }
  408. },
  409. created() {
  410. this.education = getDataConfig('education', 'education')
  411. this.summary = getDataConfig('summary', 'summary')
  412. this.nursingRecord = getDataConfig('nursing_record', 'nursing_record')
  413. this.specialRecord = getDataConfig('special_record', 'special_record')
  414. // var date = this.$route.query && this.$route.query.date
  415. // this.record_date = uParseTime(date, '{y}-{m}-{d}')
  416. if(this.$route.query && this.$route.query.date){
  417. var date = this.$route.query && this.$route.query.date
  418. this.record_date = uParseTime(date, '{y}-{m}-{d}')
  419. }
  420. }
  421. }
  422. </script>
  423. <style scoped>
  424. .warnTxt {
  425. text-align: center;
  426. margin: 0 auto;
  427. background: #faa331;
  428. max-width: 240px;
  429. padding: 10px 20px;
  430. border-radius: 4px;
  431. margin-bottom: 10px;
  432. color: #fff;
  433. }
  434. </style>
  435. <style lang="scss">
  436. .newDialog {
  437. .el-dialog__body {
  438. padding: 10px 20px 30px;
  439. }
  440. }
  441. </style>