血透系统PC前端

druguseTemplate.vue 99KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs='crumbs'></bread-crumb>
  5. </div>
  6. <el-dialog title="透析处方长期医嘱医生确认推送提醒" :visible.sync="dialogConfigVisible">
  7. <el-form>
  8. <el-form-item label="是否开启推送:">
  9. <el-radio-group v-model="is_open_remind" @change="changeRemind">
  10. <el-radio :label="1">开启</el-radio>
  11. <el-radio :label="2">不开启</el-radio>
  12. </el-radio-group>
  13. </el-form-item>
  14. </el-form>
  15. </el-dialog>
  16. <div class="app-container">
  17. <el-tabs>
  18. <el-tab-pane label="医嘱模板 ">
  19. <div>
  20. <div class="filter-container">
  21. <el-button size="small"
  22. style="float: right;"
  23. @click="dialogConfigVisible = true"
  24. type="primary">长期医嘱提醒配置
  25. </el-button>
  26. <el-button
  27. class="filter-item"
  28. style="margin-left: 10px;margin-right: 10px"
  29. @click="handleCreateTemplate"
  30. type="primary"
  31. size="small"
  32. icon="el-icon-circle-plus-outline"
  33. >{{$t('table.add')}}
  34. </el-button>
  35. </div>
  36. <el-table
  37. :data="adviceTemplates"
  38. border
  39. fit
  40. :row-style="{ color: '#303133' }"
  41. :header-cell-style="{
  42. backgroundColor: 'rgb(245, 247, 250)',
  43. color: '#606266'
  44. }"
  45. @cell-mouse-leave="cellMouseLeave"
  46. @cell-mouse-enter="cellMouseEnter"
  47. :row-class-name="tableRowClassNames"
  48. :span-method="merge"
  49. style="width: 100%;min-height:500px;"
  50. >
  51. <el-table-column
  52. prop="id"
  53. label="模版名称"
  54. align="center"
  55. width="100">
  56. <template slot-scope="scope">
  57. <span v-if="isShow(scope.$index, scope.row)">{{scope.row.name}}</span>
  58. <span v-else></span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column
  62. label="模版类型"
  63. align="center"
  64. width="100"
  65. >
  66. <template slot-scope="scope">
  67. <div>{{scope.row.advice_type == 1 ? '长期' : '临时'}}</div>
  68. </template>
  69. </el-table-column>
  70. <el-table-column
  71. prop="amount1"
  72. align="center"
  73. label="医嘱内容">
  74. <template slot-scope="scope">
  75. <el-dropdown trigger="click" v-if="scope.row.parent_id == 0">
  76. <span class="el-dropdown-link" v-if="scope.row.parent_id == 0">
  77. {{scope.row.advice_name}}<i class="el-icon-arrow-down el-icon--right"></i>
  78. </span>
  79. <el-dropdown-menu slot="dropdown">
  80. <el-dropdown-item @click.native="openEdit(scope.$index, scope.row)">修改医嘱</el-dropdown-item>
  81. <el-dropdown-item @click.native="openDelete(scope.$index, scope.row)">删除医嘱</el-dropdown-item>
  82. <el-dropdown-item @click.native="openNewChild(scope.$index, scope.row)">新增子药</el-dropdown-item>
  83. </el-dropdown-menu>
  84. </el-dropdown>
  85. <el-dropdown trigger="click" v-if="scope.row.parent_id > 0">
  86. <span class="el-dropdown-link">
  87. &emsp;&emsp;{{ scope.row.advice_name }}<i class="el-icon-arrow-down el-icon--right"></i>
  88. </span>
  89. <el-dropdown-menu slot="dropdown">
  90. <el-dropdown-item
  91. @click.native="openEdit(scope.$index, scope.row)">修改子药
  92. </el-dropdown-item>
  93. <el-dropdown-item
  94. @click.native="openDeleteChild(scope.$index, scope.row)">删除子药
  95. </el-dropdown-item>
  96. </el-dropdown-menu>
  97. </el-dropdown>
  98. </template>
  99. </el-table-column>
  100. <el-table-column
  101. prop="amount1"
  102. align="center"
  103. label="药品规格">
  104. <!-- {{drugDesc(scope.row)}} -->
  105. <template slot-scope="scope">
  106. <span v-if="scope.row.advice_desc">{{scope.row.advice_desc}}{{scope.row.drug_spec_unit}}</span>
  107. </template>
  108. </el-table-column>
  109. <el-table-column
  110. prop="amount2"
  111. width="90"
  112. align="center"
  113. label="开药数量">
  114. <template slot-scope="scope" v-if="scope.row.prescribing_number != ''">
  115. <span>{{scope.row.prescribing_number}}{{scope.row.prescribing_number_unit}}</span>
  116. </template>
  117. </el-table-column>
  118. <el-table-column
  119. prop="amount2"
  120. width="90"
  121. align="center"
  122. label="单次用量">
  123. <template slot-scope="scope" v-if="scope.row.single_dose != ''">
  124. <span>{{scope.row.single_dose}}{{scope.row.single_dose_unit}}</span>
  125. </template>
  126. </el-table-column>
  127. <el-table-column
  128. prop="amount3"
  129. align="center"
  130. label="给药途径">
  131. <template slot-scope="scope" v-if="scope.row.parent_id == 0">
  132. <span>{{scope.row.delivery_way}}</span>
  133. </template>
  134. </el-table-column>
  135. <el-table-column
  136. prop="amount3"
  137. align="center"
  138. label="执行频率">
  139. <template slot-scope="scope" v-if="scope.row.parent_id == 0">
  140. <span>{{scope.row.execution_frequency}}</span>
  141. </template>
  142. </el-table-column>
  143. <el-table-column prop="blood_flow_volume" align="center" label="提醒频率">
  144. <template slot-scope="scope">
  145. <span v-if="scope.row.frequency_type == 1">每次必推</span>
  146. <span v-if="scope.row.frequency_type == 2">{{scope.row.day_count}}天/1次</span>
  147. <span v-if="scope.row.frequency_type == 3">每周{{scope.row.week_days}}</span>
  148. </template>
  149. </el-table-column>
  150. <el-table-column
  151. align="center"
  152. label="操作"
  153. width="180"
  154. class-name="small-padding fixed-width"
  155. >
  156. <template slot-scope="scope">
  157. <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  158. <el-button
  159. type="primary"
  160. size="small"
  161. icon="el-icon-edit-outline"
  162. v-if="isShow(scope.$index, scope.row)"
  163. @click="handleUpdateAdviceTemplate(scope.row, scope.$index)"
  164. >
  165. </el-button>
  166. </el-tooltip>
  167. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  168. <el-button
  169. size="small"
  170. type="danger"
  171. icon="el-icon-delete"
  172. @click="handleDeleteAdviceTemplate(scope.row, scope.$index)"
  173. >
  174. </el-button>
  175. </el-tooltip>
  176. </template>
  177. </el-table-column>
  178. </el-table>
  179. <!--增删改查都是本地处理的dialog-->
  180. <el-dialog title="新增医嘱模版" :visible.sync="templateTableVisible" width="700px" :close-on-click-modal="false">
  181. <div>
  182. <el-form ref="form" :model="form" :rule="formRules" label-width="100px">
  183. <el-form-item label="模版名称" style="width: 300px" prop="name">
  184. <el-input v-model="form.name"></el-input>
  185. </el-form-item>
  186. <el-form-item label="模版类型" prop="advice_type">
  187. <el-radio-group v-model="form.advice_type">
  188. <el-radio :label="0">临时</el-radio>
  189. <el-radio :label="1">长期</el-radio>
  190. </el-radio-group>
  191. </el-form-item>
  192. </el-form>
  193. <div class="txsj" style="text-align: center;margin-bottom: 30px">
  194. <el-button round @click="newRecordAction">新增医嘱内容</el-button>
  195. <el-button round @click="modifyRecordAction">修改医嘱内容</el-button>
  196. <el-button round @click="deleteRecordAction">删除医嘱内容</el-button>
  197. </div>
  198. <el-table
  199. ref="table" :data="adviceTableData"
  200. border
  201. highlight-current-row
  202. max-height="300"
  203. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  204. :row-class-name="tableRow"
  205. @row-click="onRowClick"
  206. style="width: 100%">
  207. <el-table-column label="医嘱内容" align="center" width="144">
  208. <template slot-scope="scope">
  209. {{scope.row.advice_name}}
  210. </template>
  211. </el-table-column>
  212. <el-table-column align="center" label="药品规格">
  213. <template slot-scope="scope">
  214. <span v-if="scope.row.advice_desc">{{scope.row.advice_desc}}{{scope.row.drug_spec_unit}}</span>
  215. </template>
  216. </el-table-column>
  217. <el-table-column prop="prescribing_number" align="center" label="开药数量">
  218. <template slot-scope="scope" v-if="scope.row.prescribing_number != ''">
  219. {{scope.row.prescribing_number}}{{scope.row.prescribing_number_unit}}
  220. </template>
  221. </el-table-column>
  222. <el-table-column prop="single_dose" align="center" label="单次用量">
  223. <template slot-scope="scope" v-if="scope.row.single_dose != ''">
  224. {{scope.row.single_dose}}{{scope.row.single_dose_unit}}
  225. </template>
  226. </el-table-column>
  227. <el-table-column prop="breathing_rate" align="center" label="给药途径">
  228. <template slot-scope="scope">
  229. {{scope.row.delivery_way}}
  230. </template>
  231. </el-table-column>
  232. <el-table-column prop="blood_flow_volume" align="center" label="执行频率">
  233. <template slot-scope="scope">
  234. {{scope.row.execution_frequency}}
  235. </template>
  236. </el-table-column>
  237. <el-table-column prop="blood_flow_volume" align="center" label="提醒频率" v-if="form.advice_type == 1">
  238. <template slot-scope="scope">
  239. <span v-if="scope.row.frequency_type == 1">每次必推</span>
  240. <span v-if="scope.row.frequency_type == 2">{{scope.row.day_count}}天/1次</span>
  241. <span v-if="scope.row.frequency_type == 3">每周{{scope.row.weekdays}}</span>
  242. </template>
  243. </el-table-column>
  244. </el-table>
  245. </div>
  246. <div slot="footer" class="dialog-footer">
  247. <el-button @click="cancelTableHandle">取消</el-button>
  248. <el-button type="primary" @click="submitTableTemplate('form')">保 存</el-button>
  249. </div>
  250. </el-dialog>
  251. <el-dialog :title="dialogTitle" :visible.sync="templateFormVisible" width="700px">
  252. <el-form
  253. ref="templateForm"
  254. :rules="templateRules"
  255. :model="templateForm"
  256. label-width="90px"
  257. >
  258. <el-row>
  259. <el-col :span="12">
  260. <el-form-item label="医嘱内容 :" required prop="advice_name">
  261. <el-input v-model="templateForm.advice_name"></el-input>
  262. </el-form-item>
  263. </el-col>
  264. <el-col :span="12">
  265. <el-form-item label="药品规格 :" prop="advice_desc">
  266. <el-col :span="8">
  267. <el-input v-model="templateForm.advice_desc"></el-input>
  268. </el-col>
  269. <el-col class="line" :span="2">&nbsp;</el-col>
  270. <el-col :span="14">
  271. <el-select
  272. v-model="templateForm.drug_spec_unit"
  273. filterable
  274. clearable
  275. allow-create
  276. placeholder="选择"
  277. >
  278. <el-option
  279. v-for="item in unitsOption"
  280. :key="item.id"
  281. :label="item.name "
  282. :value="item.name"
  283. ></el-option>
  284. </el-select>
  285. </el-col>
  286. </el-form-item>
  287. </el-col>
  288. <el-col :span="12">
  289. <el-form-item label="开药数量 :" prop="prescribing_number">
  290. <el-col :span="9">
  291. <el-input v-model="templateForm.prescribing_number"></el-input>
  292. </el-col>
  293. <el-col class="line" :span="1">&nbsp;</el-col>
  294. <el-col :span="14">
  295. <el-select
  296. v-model="templateForm.prescribing_number_unit"
  297. filterable
  298. clearable
  299. allow-create
  300. placeholder="选择"
  301. >
  302. <el-option
  303. v-for="item in unitsOption"
  304. :key="item.id"
  305. :label="item.name "
  306. :value="item.name"
  307. ></el-option>
  308. </el-select>
  309. </el-col>
  310. </el-form-item>
  311. </el-col>
  312. <el-col :span="12">
  313. <el-form-item label="单次用量 :" prop="single_dose">
  314. <el-col :span="9">
  315. <el-input v-model="templateForm.single_dose"></el-input>
  316. </el-col>
  317. <el-col class="line" :span="1">&nbsp;</el-col>
  318. <el-col :span="14">
  319. <el-select
  320. v-model="templateForm.single_dose_unit"
  321. filterable
  322. clearable
  323. allow-create
  324. placeholder="选择"
  325. >
  326. <el-option
  327. v-for="item in unitsOption"
  328. :key="item.id"
  329. :label="item.name "
  330. :value="item.name"
  331. ></el-option>
  332. </el-select>
  333. </el-col>
  334. </el-form-item>
  335. </el-col>
  336. <el-col :span="12" v-if="!isAddChild">
  337. <el-form-item label="给药途径 :" prop="delivery_way">
  338. <el-select
  339. v-model="templateForm.delivery_way"
  340. filterable
  341. clearable
  342. allow-create
  343. placeholder="请选择(输入可搜索)"
  344. style="width:100%"
  345. >
  346. <el-option
  347. v-for="item in drugways"
  348. :key="item.id"
  349. :label="item.name "
  350. :value="item.name"
  351. ></el-option>
  352. </el-select>
  353. </el-form-item>
  354. </el-col>
  355. <el-col :span="12" v-if="!isAddChild">
  356. <el-form-item label="执行频率 :" prop="execution_frequency">
  357. <el-select
  358. v-model="templateForm.execution_frequency"
  359. clearable
  360. allow-create
  361. filterable
  362. placeholder="请选择(输入可搜索)"
  363. style="width:100%"
  364. >
  365. <el-option
  366. v-for="item in executionFrequencyOptions"
  367. :key="item.id"
  368. :label="item.name"
  369. :value="item.name"
  370. ></el-option>
  371. </el-select>
  372. </el-form-item>
  373. </el-col>
  374. <el-col :span="24" v-if="form.advice_type&&!isAddChild">
  375. <el-form-item label="周期提醒 :">
  376. <el-radio-group v-model="templateForm.frequency_type">
  377. <el-radio :label="1">每次必推</el-radio>
  378. <el-radio :label="2">天数频率</el-radio>
  379. <el-radio :label="3">星期频率</el-radio>
  380. </el-radio-group>
  381. </el-form-item>
  382. </el-col>
  383. <el-col :span="12" v-if="templateForm.frequency_type == 2">
  384. <el-form-item prop="day_count">
  385. <el-input style="width: 50px" v-model="templateForm.day_count"></el-input>&nbsp;
  386. 天/一次
  387. </el-form-item>
  388. </el-col>
  389. <el-col :span="24" v-if="templateForm.frequency_type == 3">
  390. <el-form-item prop="weekday">
  391. <el-checkbox-group v-model="templateForm.weekday">
  392. <el-checkbox label="周一" name="type"></el-checkbox>
  393. <el-checkbox label="周二" name="type"></el-checkbox>
  394. <el-checkbox label="周三" name="type"></el-checkbox>
  395. <el-checkbox label="周四" name="type"></el-checkbox>
  396. <el-checkbox label="周五" name="type"></el-checkbox>
  397. <el-checkbox label="周六" name="type"></el-checkbox>
  398. <el-checkbox label="周日" name="type"></el-checkbox>
  399. </el-checkbox-group>
  400. </el-form-item>
  401. </el-col>
  402. </el-row>
  403. </el-form>
  404. <div slot="footer" class="dialog-footer">
  405. <el-button @click="cancelHandle('templateForm')">取消</el-button>
  406. <el-button type="primary" @click="submitTemplate('templateForm')">保 存</el-button>
  407. </div>
  408. </el-dialog>
  409. <!--TODO-->
  410. <el-dialog :title="editDialogTitle" :visible.sync="templateEditFormVisible" width="700px">
  411. <el-form
  412. ref="templateFormEdit"
  413. :rules="templateEditRules"
  414. :model="templateFormEdit"
  415. label-width="90px"
  416. >
  417. <el-row>
  418. <el-col :span="12">
  419. <el-form-item :label="edit_advice_name" required prop="advice_name">
  420. <el-input v-model="templateFormEdit.advice_name"></el-input>
  421. </el-form-item>
  422. </el-col>
  423. <el-col :span="12">
  424. <el-form-item label="药品规格 :" prop="advice_desc">
  425. <el-col :span="8">
  426. <el-input v-model="templateFormEdit.advice_desc"></el-input>
  427. </el-col>
  428. <el-col class="line" :span="1">&nbsp;</el-col>
  429. <el-col :span="14">
  430. <el-select
  431. v-model="templateFormEdit.drug_spec_unit"
  432. filterable
  433. clearable
  434. allow-create
  435. placeholder="选择"
  436. >
  437. <el-option
  438. v-for="item in unitsOption"
  439. :key="item.id"
  440. :label="item.name "
  441. :value="item.name"
  442. ></el-option>
  443. </el-select>
  444. </el-col>
  445. </el-form-item>
  446. </el-col>
  447. <el-col :span="12">
  448. <el-form-item label="开药数量 :" prop="prescribing_number">
  449. <el-col :span="9">
  450. <el-input v-model="templateFormEdit.prescribing_number"></el-input>
  451. </el-col>
  452. <el-col class="line" :span="1">&nbsp;</el-col>
  453. <el-col :span="14">
  454. <el-select
  455. v-model="templateFormEdit.prescribing_number_unit"
  456. filterable
  457. clearable
  458. allow-create
  459. placeholder="选择"
  460. >
  461. <el-option
  462. v-for="item in unitsOption"
  463. :key="item.id"
  464. :label="item.name "
  465. :value="item.name"
  466. ></el-option>
  467. </el-select>
  468. </el-col>
  469. </el-form-item>
  470. </el-col>
  471. <el-col :span="12">
  472. <el-form-item label="单次用量 :" prop="single_dose">
  473. <el-col :span="9">
  474. <el-input v-model="templateFormEdit.single_dose"></el-input>
  475. </el-col>
  476. <el-col class="line" :span="1">&nbsp;</el-col>
  477. <el-col :span="14">
  478. <el-select
  479. v-model="templateFormEdit.single_dose_unit"
  480. filterable
  481. clearable
  482. allow-create
  483. placeholder="选择"
  484. >
  485. <el-option
  486. v-for="item in unitsOption"
  487. :key="item.id"
  488. :label="item.name "
  489. :value="item.name"
  490. ></el-option>
  491. </el-select>
  492. </el-col>
  493. </el-form-item>
  494. </el-col>
  495. <el-col :span="12" v-if="templateFormEdit.parent_id == 0">
  496. <el-form-item label="给药途径 :" prop="delivery_way">
  497. <el-select
  498. v-model="templateFormEdit.delivery_way"
  499. filterable
  500. clearable
  501. allow-create
  502. placeholder="请选择(输入可搜索)"
  503. style="width:100%"
  504. >
  505. <el-option
  506. v-for="item in drugways"
  507. :key="item.id"
  508. :label="item.name "
  509. :value="item.name"
  510. ></el-option>
  511. </el-select>
  512. </el-form-item>
  513. </el-col>
  514. <el-col :span="12" v-if="templateFormEdit.parent_id == 0">
  515. <el-form-item label="执行频率 :" prop="execution_frequency">
  516. <el-select
  517. v-model="templateFormEdit.execution_frequency"
  518. clearable
  519. allow-create
  520. filterable
  521. placeholder="请选择(输入可搜索)"
  522. style="width:100%"
  523. >
  524. <el-option
  525. v-for="item in executionFrequencyOptions"
  526. :key="item.id"
  527. :label="item.name"
  528. :value="item.name"
  529. ></el-option>
  530. </el-select>
  531. </el-form-item>
  532. </el-col>
  533. <el-col :span="24">
  534. <el-form-item label="周期提醒 :">
  535. <el-radio-group v-model="templateFormEdit.frequency_type">
  536. <el-radio :label="1">每次必推</el-radio>
  537. <el-radio :label="2">天数频率</el-radio>
  538. <el-radio :label="3">星期频率</el-radio>
  539. </el-radio-group>
  540. </el-form-item>
  541. </el-col>
  542. <el-col :span="12" v-if="templateFormEdit.frequency_type == 2">
  543. <el-form-item prop="day_count">
  544. <el-input style="width: 50px" v-model="templateFormEdit.day_count"></el-input>&nbsp;
  545. 天/一次
  546. </el-form-item>
  547. </el-col>
  548. <el-col :span="24" v-if="templateFormEdit.frequency_type == 3">
  549. <el-form-item>
  550. <el-checkbox-group v-model="templateFormEdit.weekday">
  551. <el-checkbox label="周一" name="type"></el-checkbox>
  552. <el-checkbox label="周二" name="type"></el-checkbox>
  553. <el-checkbox label="周三" name="type"></el-checkbox>
  554. <el-checkbox label="周四" name="type"></el-checkbox>
  555. <el-checkbox label="周五" name="type"></el-checkbox>
  556. <el-checkbox label="周六" name="type"></el-checkbox>
  557. <el-checkbox label="周日" name="type"></el-checkbox>
  558. </el-checkbox-group>
  559. </el-form-item>
  560. </el-col>
  561. </el-row>
  562. </el-form>
  563. <div slot="footer" class="dialog-footer">
  564. <el-button @click="cancelEditHandle">取消</el-button>
  565. <el-button type="primary" @click="submitEditTemplate('templateFormEdit')">保 存</el-button>
  566. </div>
  567. </el-dialog>
  568. <!--增删改查都请求网络类型的dialog-->
  569. <el-dialog title="编辑医嘱模版" :visible.sync="templateTableTwoVisible" width="800px">
  570. <div>
  571. <!--<el-form ref="form" :model="form" :rule="formRules" label-width="100px">-->
  572. <!--<el-form-item label="模版名称" style="width: 300px" prop="name">-->
  573. <!--<el-input v-model="form.name" ></el-input>-->
  574. <!--</el-form-item>-->
  575. <!--</el-form>-->
  576. <div class="txsj" style="text-align: center;margin-bottom: 30px">
  577. <el-button round @click="newRecordActionTwo">新增医嘱内容</el-button>
  578. <!--<el-button round @click="deleteRecordActionTwo">删除医嘱内容</el-button>-->
  579. <!--<el-button round @click="modifyRecordActionTwo">修改医嘱内容</el-button>-->
  580. </div>
  581. <el-table :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}" ref="table"
  582. :data="adviceTableDataTwo" border highlight-current-row max-height="300">
  583. <el-table-column label="医嘱内容">
  584. <template slot-scope="scope">
  585. <span v-if="scope.row.parent_id == 0">{{scope.row.advice_name}}</span>
  586. <span v-if="scope.row.parent_id > 0"> &emsp;{{scope.row.advice_name}}</span>
  587. </template>
  588. </el-table-column>
  589. <el-table-column align="center" label="药品规格">
  590. <!-- {{drugDesc(scope.row)}} -->
  591. <template slot-scope="scope">
  592. <span v-if="scope.row.advice_desc">{{scope.row.advice_desc}}{{scope.row.drug_spec_unit}}</span>
  593. </template>
  594. </el-table-column>
  595. <el-table-column prop="prescribing_number" align="center" label="开药数量">
  596. <template slot-scope="scope" v-if="scope.row.prescribing_number != ''">
  597. {{scope.row.prescribing_number}}{{scope.row.prescribing_number_unit}}
  598. </template>
  599. </el-table-column>
  600. <el-table-column align="center" label="单次用量">
  601. <template slot-scope="scope" v-if="scope.row.single_dose != ''">
  602. {{scope.row.single_dose}}{{scope.row.single_dose_unit}}
  603. </template>
  604. </el-table-column>
  605. <el-table-column align="center" label="给药途径">
  606. <template slot-scope="scope">
  607. <span v-if="scope.row.parent_id == 0">{{scope.row.delivery_way}}</span>
  608. </template>
  609. </el-table-column>
  610. <el-table-column align="center" label="执行频率">
  611. <template slot-scope="scope">
  612. <span v-if="scope.row.parent_id == 0">{{scope.row.execution_frequency}}</span>
  613. </template>
  614. </el-table-column>
  615. <el-table-column align="center" label="提醒频率" v-if="form.advice_type == 1">
  616. <template slot-scope="scope">
  617. <span v-if="scope.row.frequency_type == 1">每次必推</span>
  618. <span v-if="scope.row.frequency_type == 2">{{scope.row.day_count}}天/1次</span>
  619. <span v-if="scope.row.frequency_type == 3">每周{{scope.row.week_days}}</span>
  620. </template>
  621. </el-table-column>
  622. </el-table>
  623. </div>
  624. <div slot="footer" class="dialog-footer">
  625. <el-button @click="cancelTableHandleTwo">取消</el-button>
  626. <el-button type="primary" @click="modifyTemplateName">保 存</el-button>
  627. </div>
  628. </el-dialog>
  629. <el-dialog title="新增医嘱" :visible.sync="templateFormTwoVisible" width="700px">
  630. <el-form
  631. ref="templateForm"
  632. :rules="templateEditRules"
  633. :model="templateForm"
  634. label-width="90px"
  635. >
  636. <el-row>
  637. <el-col :span="12">
  638. <el-form-item label="医嘱内容 :" required prop="advice_name">
  639. <el-input v-model="templateForm.advice_name"></el-input>
  640. </el-form-item>
  641. </el-col>
  642. <el-col :span="12">
  643. <el-form-item label="药品规格 :" prop="advice_desc">
  644. <el-col :span="9">
  645. <el-input v-model="templateForm.advice_desc"></el-input>
  646. </el-col>
  647. <el-col class="line" :span="1">&nbsp;</el-col>
  648. <el-col :span="14">
  649. <el-select
  650. v-model="templateForm.drug_spec_unit"
  651. filterable
  652. clearable
  653. allow-create
  654. placeholder="选择"
  655. >
  656. <el-option
  657. v-for="item in unitsOption"
  658. :key="item.id"
  659. :label="item.name "
  660. :value="item.name"
  661. ></el-option>
  662. </el-select>
  663. </el-col>
  664. </el-form-item>
  665. </el-col>
  666. <el-col :span="12">
  667. <el-form-item label="开药数量 :" prop="prescribing_number">
  668. <el-col :span="9">
  669. <el-input v-model="templateForm.prescribing_number"></el-input>
  670. </el-col>
  671. <el-col class="line" :span="1">&nbsp;</el-col>
  672. <el-col :span="14">
  673. <el-select
  674. v-model="templateForm.prescribing_number_unit"
  675. filterable
  676. clearable
  677. allow-create
  678. placeholder="选择"
  679. >
  680. <el-option
  681. v-for="item in unitsOption"
  682. :key="item.id"
  683. :label="item.name "
  684. :value="item.name"
  685. ></el-option>
  686. </el-select>
  687. </el-col>
  688. </el-form-item>
  689. </el-col>
  690. <el-col :span="12">
  691. <el-form-item label="单次用量 :" prop="single_dose">
  692. <el-col :span="9">
  693. <el-input v-model="templateForm.single_dose"></el-input>
  694. </el-col>
  695. <el-col class="line" :span="1">&nbsp;</el-col>
  696. <el-col :span="14">
  697. <el-select
  698. v-model="templateForm.single_dose_unit"
  699. filterable
  700. clearable
  701. allow-create
  702. placeholder="选择"
  703. >
  704. <el-option
  705. v-for="item in unitsOption"
  706. :key="item.id"
  707. :label="item.name "
  708. :value="item.name"
  709. ></el-option>
  710. </el-select>
  711. </el-col>
  712. </el-form-item>
  713. </el-col>
  714. <el-col :span="12">
  715. <el-form-item label="给药途径 :" prop="delivery_way">
  716. <el-select
  717. v-model="templateForm.delivery_way"
  718. filterable
  719. clearable
  720. allow-create
  721. placeholder="请选择(输入可搜索)"
  722. style="width:100%"
  723. >
  724. <el-option
  725. v-for="item in drugways"
  726. :key="item.id"
  727. :label="item.name "
  728. :value="item.name"
  729. ></el-option>
  730. </el-select>
  731. </el-form-item>
  732. </el-col>
  733. <el-col :span="12">
  734. <el-form-item label="执行频率 :" prop="execution_frequency">
  735. <el-select
  736. v-model="templateForm.execution_frequency"
  737. clearable
  738. allow-create
  739. filterable
  740. placeholder="请选择(输入可搜索)"
  741. style="width:100%"
  742. >
  743. <el-option
  744. v-for="item in executionFrequencyOptions"
  745. :key="item.id"
  746. :label="item.name"
  747. :value="item.name"
  748. ></el-option>
  749. </el-select>
  750. </el-form-item>
  751. </el-col>
  752. <el-col :span="24" v-if="form.advice_type == 1">
  753. <el-form-item label="周期提醒 :">
  754. <el-radio-group v-model="templateForm.frequency_type">
  755. <el-radio :label="1">每次必推</el-radio>
  756. <el-radio :label="2">天数频率</el-radio>
  757. <el-radio :label="3">星期频率</el-radio>
  758. </el-radio-group>
  759. </el-form-item>
  760. </el-col>
  761. <el-col :span="12" v-if="templateForm.frequency_type == 2">
  762. <el-form-item prop="day_count">
  763. <el-input style="width: 50px" v-model="templateForm.day_count"></el-input>&nbsp;
  764. 天/一次
  765. </el-form-item>
  766. </el-col>
  767. <el-col :span="24" v-if="templateForm.frequency_type == 3">
  768. <el-form-item>
  769. <el-checkbox-group v-model="templateForm.weekday">
  770. <el-checkbox label="周一" name="type"></el-checkbox>
  771. <el-checkbox label="周二" name="type"></el-checkbox>
  772. <el-checkbox label="周三" name="type"></el-checkbox>
  773. <el-checkbox label="周四" name="type"></el-checkbox>
  774. <el-checkbox label="周五" name="type"></el-checkbox>
  775. <el-checkbox label="周六" name="type"></el-checkbox>
  776. <el-checkbox label="周日" name="type"></el-checkbox>
  777. </el-checkbox-group>
  778. </el-form-item>
  779. </el-col>
  780. </el-row>
  781. </el-form>
  782. <div slot="footer" class="dialog-footer">
  783. <el-button @click="cancelHandleTwo">取消</el-button>
  784. <el-button type="primary" @click="submitTemplateTwo('templateForm')">保 存</el-button>
  785. </div>
  786. </el-dialog>
  787. <!--<el-dialog title="编辑医嘱" :visible.sync="templateEditFormTwoVisible" width="700px">-->
  788. <!--<el-form-->
  789. <!--ref="templateFormEdit"-->
  790. <!--:rules="templateEditRules"-->
  791. <!--:model="templateFormEdit"-->
  792. <!--label-width="90px"-->
  793. <!--&gt;-->
  794. <!--<el-form-item label="医嘱名称 :" required prop="advice_name">-->
  795. <!--<el-input v-model="templateFormEdit.advice_name" style="width:50%"></el-input>-->
  796. <!--</el-form-item>-->
  797. <!--<el-row>-->
  798. <!--<el-col :span="12">-->
  799. <!--<el-form-item label="药品规格 :" prop="drug_spec">-->
  800. <!--<el-col :span="8">-->
  801. <!--<el-input v-model="templateFormEdit.drug_spec"></el-input>-->
  802. <!--</el-col>-->
  803. <!--<el-col class="line" :span="2">&nbsp;</el-col>-->
  804. <!--<el-col :span="14">-->
  805. <!--<el-select-->
  806. <!--v-model="templateFormEdit.drug_spec_unit"-->
  807. <!--filterable-->
  808. <!--clearable-->
  809. <!--allow-create-->
  810. <!--placeholder="选择"-->
  811. <!--&gt;-->
  812. <!--<el-option-->
  813. <!--v-for="item in unitsOption"-->
  814. <!--:key="item.id"-->
  815. <!--:label="item.name "-->
  816. <!--:value="item.name"-->
  817. <!--&gt;</el-option>-->
  818. <!--</el-select>-->
  819. <!--</el-col>-->
  820. <!--</el-form-item>-->
  821. <!--</el-col>-->
  822. <!--<el-col :span="12">-->
  823. <!--<el-form-item label="单次用量 :" prop="single_dose">-->
  824. <!--<el-col :span="8">-->
  825. <!--<el-input v-model="templateFormEdit.single_dose"></el-input>-->
  826. <!--</el-col>-->
  827. <!--<el-col class="line" :span="2">&nbsp;</el-col>-->
  828. <!--<el-col :span="14">-->
  829. <!--<el-select-->
  830. <!--v-model="templateFormEdit.single_dose_unit"-->
  831. <!--filterable-->
  832. <!--clearable-->
  833. <!--allow-create-->
  834. <!--placeholder="选择"-->
  835. <!--&gt;-->
  836. <!--<el-option-->
  837. <!--v-for="item in unitsOption"-->
  838. <!--:key="item.id"-->
  839. <!--:label="item.name "-->
  840. <!--:value="item.name"-->
  841. <!--&gt;</el-option>-->
  842. <!--</el-select>-->
  843. <!--</el-col>-->
  844. <!--</el-form-item>-->
  845. <!--</el-col>-->
  846. <!--<el-col :span="12">-->
  847. <!--<el-form-item label="开药数量 :" prop="prescribing_number">-->
  848. <!--<el-col :span="8">-->
  849. <!--<el-input v-model="templateFormEdit.prescribing_number"></el-input>-->
  850. <!--</el-col>-->
  851. <!--<el-col class="line" :span="2">&nbsp;</el-col>-->
  852. <!--<el-col :span="14">-->
  853. <!--<el-select-->
  854. <!--v-model="templateFormEdit.prescribing_number_unit"-->
  855. <!--filterable-->
  856. <!--clearable-->
  857. <!--allow-create-->
  858. <!--placeholder="选择"-->
  859. <!--&gt;-->
  860. <!--<el-option-->
  861. <!--v-for="item in unitsOption"-->
  862. <!--:key="item.id"-->
  863. <!--:label="item.name "-->
  864. <!--:value="item.name"-->
  865. <!--&gt;</el-option>-->
  866. <!--</el-select>-->
  867. <!--</el-col>-->
  868. <!--</el-form-item>-->
  869. <!--</el-col>-->
  870. <!--<el-col :span="12">-->
  871. <!--<el-form-item label="给药途径 :" prop="delivery_way">-->
  872. <!--<el-select-->
  873. <!--v-model="templateFormEdit.delivery_way"-->
  874. <!--filterable-->
  875. <!--clearable-->
  876. <!--allow-create-->
  877. <!--placeholder="请选择(输入可搜索)"-->
  878. <!--style="width:90%"-->
  879. <!--&gt;-->
  880. <!--<el-option-->
  881. <!--v-for="item in drugways"-->
  882. <!--:key="item.id"-->
  883. <!--:label="item.name "-->
  884. <!--:value="item.name"-->
  885. <!--&gt;</el-option>-->
  886. <!--</el-select>-->
  887. <!--</el-form-item>-->
  888. <!--</el-col>-->
  889. <!--</el-row>-->
  890. <!--<el-row>-->
  891. <!--<el-col :span="12">-->
  892. <!--<el-form-item label="执行频率 :" prop="execution_frequency">-->
  893. <!--<el-select-->
  894. <!--v-model="templateFormEdit.execution_frequency"-->
  895. <!--clearable-->
  896. <!--allow-create-->
  897. <!--filterable-->
  898. <!--placeholder="请选择(输入可搜索)"-->
  899. <!--style="width:90%"-->
  900. <!--&gt;-->
  901. <!--<el-option-->
  902. <!--v-for="item in executionFrequencyOptions"-->
  903. <!--:key="item.id"-->
  904. <!--:label="item.name"-->
  905. <!--:value="item.name"-->
  906. <!--&gt;</el-option>-->
  907. <!--</el-select>-->
  908. <!--</el-form-item>-->
  909. <!--</el-col>-->
  910. <!--</el-row>-->
  911. <!--</el-form>-->
  912. <!--<div slot="footer" class="dialog-footer">-->
  913. <!--<el-button @click="cancelEditHandleTwo">取消</el-button>-->
  914. <!--<el-button type="primary" @click="submitEditTemplateTwo('templateFormEdit')">保 存</el-button>-->
  915. <!--</div>-->
  916. <!--</el-dialog>-->
  917. </div>
  918. </el-tab-pane>
  919. <el-tab-pane label="给药途径">
  920. <div class="">
  921. <div class="filter-container">
  922. <el-button
  923. class="filter-item"
  924. style="margin-left: 10px;"
  925. @click="handleCreateDrugWay"
  926. type="primary"
  927. icon="el-icon-circle-plus-outline"
  928. size="small"
  929. >{{$t('table.add')}}
  930. </el-button>
  931. </div>
  932. <el-table
  933. :data="drugways"
  934. border
  935. fit
  936. :row-style="{ color: '#303133' }"
  937. :header-cell-style="{
  938. backgroundColor: 'rgb(245, 247, 250)',
  939. color: '#606266'
  940. }"
  941. highlight-current-row
  942. style="width: 100%;min-height:500px;"
  943. >
  944. <el-table-column align="center" label="名称">
  945. <template slot-scope="scope">
  946. <span>{{scope.row.name}}</span>
  947. </template>
  948. </el-table-column>
  949. <el-table-column
  950. align="center"
  951. :label="$t('table.actions')"
  952. width="230"
  953. class-name="small-padding fixed-width"
  954. >
  955. <template slot-scope="scope">
  956. <el-button type="text" size="mini" v-show="scope.row.org_id==0" disabled>系统设定</el-button>
  957. <el-button
  958. v-show="scope.row.org_id!=0"
  959. type="primary"
  960. size="small"
  961. icon="el-icon-edit-outline"
  962. @click="handleUpdateDrugWay(scope.row, scope.$index)"
  963. >
  964. </el-button>
  965. <el-button
  966. v-show="scope.row.org_id!=0"
  967. size="small"
  968. type="danger"
  969. icon="el-icon-delete"
  970. @click="handleDeleteDrugWay(scope.row, scope.$index)"
  971. >
  972. </el-button>
  973. </template>
  974. </el-table-column>
  975. </el-table>
  976. <el-dialog :title="dialogTitle" :visible.sync="drugwayFormVisible" width="700px">
  977. <el-form
  978. ref="drugwayForm"
  979. :rules="drugwayRules"
  980. :model="drugwayForm"
  981. label-width="90px"
  982. >
  983. <el-form-item label="给药途径 :" required prop="name">
  984. <el-input v-model="drugwayForm.name" placeholder="给药途径"></el-input>
  985. </el-form-item>
  986. </el-form>
  987. <div slot="footer" class="dialog-footer">
  988. <el-button @click="drugwayFormVisible = false">取消</el-button>
  989. <el-button type="primary" @click="submitDrugWay('drugwayForm')">保 存</el-button>
  990. </div>
  991. </el-dialog>
  992. </div>
  993. </el-tab-pane>
  994. <el-tab-pane label="执行频率">
  995. <div class="">
  996. <div class="filter-container">
  997. <el-button
  998. class="filter-item"
  999. style="margin-left: 10px;"
  1000. @click="handleCreateEF"
  1001. type="primary"
  1002. icon="el-icon-circle-plus-outline"
  1003. size="small"
  1004. >{{$t('table.add')}}
  1005. </el-button>
  1006. </div>
  1007. <el-table
  1008. :data="executionFrequencyOptions"
  1009. border
  1010. fit
  1011. :row-style="{ color: '#303133' }"
  1012. :header-cell-style="{
  1013. backgroundColor: 'rgb(245, 247, 250)',
  1014. color: '#606266'
  1015. }"
  1016. highlight-current-row
  1017. style="width: 100%;min-height:500px;"
  1018. >
  1019. <el-table-column align="center" label="名称">
  1020. <template slot-scope="scope">
  1021. <span>{{scope.row.name}}</span>
  1022. </template>
  1023. </el-table-column>
  1024. <el-table-column
  1025. align="center"
  1026. :label="$t('table.actions')"
  1027. width="230"
  1028. class-name="small-padding fixed-width"
  1029. >
  1030. <template slot-scope="scope">
  1031. <el-button type="text" size="mini" v-show="scope.row.org_id==0" disabled>系统设定</el-button>
  1032. <el-button
  1033. v-show="scope.row.org_id!=0"
  1034. type="primary"
  1035. size="small"
  1036. icon="el-icon-edit-outline"
  1037. @click="handleUpdateEF(scope.row, scope.$index)"
  1038. >
  1039. </el-button>
  1040. <el-button
  1041. v-show="scope.row.org_id!=0"
  1042. size="small"
  1043. type="danger"
  1044. icon="el-icon-delete"
  1045. @click="handleDeleteEF(scope.row, scope.$index)"
  1046. >
  1047. </el-button>
  1048. </template>
  1049. </el-table-column>
  1050. </el-table>
  1051. <el-dialog :title="dialogTitle" :visible.sync="efFormVisible" width="700px">
  1052. <el-form ref="efForm" :rules="efRules" :model="efForm" label-width="90px">
  1053. <el-form-item label="执行频率 :" required prop="name">
  1054. <el-input v-model="efForm.name" placeholder="执行频率"></el-input>
  1055. </el-form-item>
  1056. </el-form>
  1057. <div slot="footer" class="dialog-footer">
  1058. <el-button @click="efFormVisible = false">取消</el-button>
  1059. <el-button type="primary" @click="submitEF('efForm')">保 存</el-button>
  1060. </div>
  1061. </el-dialog>
  1062. </div>
  1063. </el-tab-pane>
  1064. </el-tabs>
  1065. </div>
  1066. </div>
  1067. </template>
  1068. <style>
  1069. @import "../../../static/css/table_row.css";
  1070. .filter-item {
  1071. float: right;
  1072. }
  1073. </style>
  1074. <script>
  1075. import {
  1076. CreateAdviceTemplate,
  1077. CreateDrugDic,
  1078. CreateDrugWay,
  1079. CreateExecutionFrequency,
  1080. CreateSingleAdviceTemplate,
  1081. CreateSubAdvice,
  1082. DeleteAdviceTemplate,
  1083. DeleteDrugDic,
  1084. DeleteDrugWay,
  1085. DeleteExecutionFrequency,
  1086. DeleteParentAdviceTemplate,
  1087. getAllAdviceConfig,
  1088. getAllAdviceTemplate,
  1089. postAdviceTemplate,
  1090. UpdateAdviceTemplate,
  1091. UpdateDrugDic,
  1092. UpdateDrugWay,
  1093. UpdateExecutionFrequency,
  1094. updateTemplateName,
  1095. getDoctorAdviceConfig,
  1096. postDoctorAdviceConfig
  1097. } from '@/api/advice'
  1098. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  1099. import { getDataConfig } from '@/utils/data'
  1100. export default {
  1101. name: 'tab',
  1102. components: { BreadCrumb },
  1103. data() {
  1104. return {
  1105. day_count: '',
  1106. crumbs: [
  1107. { path: false, name: '数据字典' },
  1108. { path: 'data/druguse', name: '医嘱模版' }
  1109. ],
  1110. rowIndex: -1,
  1111. current_template_id: 0,
  1112. currentObject: {},
  1113. tempArr: [],
  1114. sameRowArr: [],
  1115. advice_content_name: '',
  1116. table_current_index: -1,
  1117. adviceTableData: [],
  1118. templateName: '',
  1119. adviceTableDataTwo: [],
  1120. table_current_index_two: -1,
  1121. currentIndex: -1,
  1122. isEdit: false,
  1123. dialogTitle: '',
  1124. is_open_remind:0,
  1125. isAddChild: false,
  1126. parent_id: 0,
  1127. editDialogTitle: '编辑医嘱',
  1128. drugdicFormVisible: false,
  1129. drugwayFormVisible: false,
  1130. templateFormVisible: false,
  1131. templateTableTwoVisible: false,
  1132. templateEditFormVisible: false,
  1133. edit_advice_name: '',
  1134. templateTableVisible: false,
  1135. templateFormTwoVisible: false,
  1136. templateEditFormTwoVisible: false,
  1137. efFormVisible: false,
  1138. activeName: 'drugdic',
  1139. hoverOrderArr: [],
  1140. createdTimes: 0,
  1141. drugdics: [],
  1142. adviceTemplates: [],
  1143. current_template_name: '',
  1144. editForm: {
  1145. name: ''
  1146. },
  1147. drugways: [],
  1148. executionFrequencyOptions: [],
  1149. drugdicRules: {
  1150. name: [{ required: true, message: '请填写医嘱内容' }]
  1151. },
  1152. formRules: {
  1153. name: [
  1154. { required: true, message: '请输入模版名称', trigger: 'blur' }
  1155. ],
  1156. advice_type: [
  1157. { required: true, message: '请选择模版类型', trigger: 'change' }
  1158. ]
  1159. },
  1160. drugwayRules: {
  1161. name: [{ required: true, message: '请填写给药途径' }]
  1162. },
  1163. efRules: {
  1164. name: [{ required: true, message: '请填写执行频率' }]
  1165. },
  1166. templateRules: {
  1167. advice_name: [{ required: true, message: '请填写医嘱内容' }]
  1168. },
  1169. templateEditRules: {
  1170. advice_name: [{ required: true, message: '请填写医嘱内容' }]
  1171. },
  1172. templateForm: {
  1173. frequency_type: 1,
  1174. day_count: '',
  1175. weekday: [],
  1176. drug_spec: '',
  1177. drug_spec_unit: '',
  1178. advice_name: '',
  1179. advice_desc: '',
  1180. single_dose: '',
  1181. single_dose_unit: '',
  1182. prescribing_number: '',
  1183. prescribing_number_unit: '',
  1184. delivery_way: '',
  1185. execution_frequency: '',
  1186. id: 0
  1187. },
  1188. dialogConfigVisible:false,
  1189. templateFormEdit: {
  1190. frequency_type: 0,
  1191. day_count: '',
  1192. weekday: [],
  1193. week_days: '',
  1194. drug_spec: '',
  1195. drug_spec_unit: '',
  1196. advice_name: '',
  1197. advice_desc: '',
  1198. single_dose: '',
  1199. single_dose_unit: '',
  1200. prescribing_number: '',
  1201. prescribing_number_unit: '',
  1202. delivery_way: '',
  1203. execution_frequency: '',
  1204. id: 0
  1205. },
  1206. drugdicForm: {
  1207. name: '',
  1208. spec: '',
  1209. spec_unit: '',
  1210. form: '',
  1211. form_unit: '',
  1212. id: 0
  1213. },
  1214. form: {
  1215. name: '',
  1216. advice_type: 0
  1217. },
  1218. drugwayForm: {
  1219. name: '',
  1220. id: 0
  1221. },
  1222. efForm: {
  1223. name: '',
  1224. id: 0
  1225. },
  1226. drugforms: [
  1227. { lable: 1, name: '胶囊' },
  1228. { lable: 2, name: '注射剂' },
  1229. { lable: 3, name: '片剂' },
  1230. { lable: 4, name: '注射液' },
  1231. { lable: 5, name: '栓剂' },
  1232. { lable: 6, name: '膏' },
  1233. { lable: 7, name: '颗粒剂' },
  1234. { lable: 8, name: '粉剂' },
  1235. { lable: 9, name: '口服液' },
  1236. { lable: 10, name: '干混悬剂' },
  1237. { lable: 11, name: '丸剂' },
  1238. { lable: 12, name: '气雾剂' },
  1239. { lable: 13, name: '内服溶液' },
  1240. { lable: 14, name: '外用溶液' },
  1241. { lable: 15, name: '软膏剂' },
  1242. { lable: 16, name: '胶剂' }
  1243. ]
  1244. }
  1245. },
  1246. created() {
  1247. this.getAdviceConfig()
  1248. this.unitsOption = getDataConfig('hemodialysis', 'units')
  1249. this.getDoctorAdviceConfig()
  1250. },
  1251. methods: {
  1252. getDoctorAdviceConfig(){
  1253. getDoctorAdviceConfig().then(response => {
  1254. if (response.data.state == 1) {
  1255. this.is_open_remind = response.data.data.config.is_open_remind
  1256. } else {
  1257. this.$message.error(response.data.msg)
  1258. }
  1259. })
  1260. },
  1261. adviceNameShow({ row, column, rowIndex, columnIndex }) {
  1262. if (columnIndex == 1) {
  1263. return 'templateadvicenamedisplay'
  1264. } else {
  1265. return ''
  1266. }
  1267. },
  1268. showCreatedTimes() {
  1269. this.createdTimes = this.createdTimes + 1
  1270. },
  1271. handleUpdateDrugDic(row, index) {
  1272. this.currentIndex = index
  1273. this.drugdicForm = {
  1274. name: row.name,
  1275. spec: row.spec,
  1276. spec_unit: row.spec_unit,
  1277. form: row.form,
  1278. form_unit: row.form_unit,
  1279. id: row.id
  1280. }
  1281. this.drugdicFormVisible = true
  1282. this.dialogTitle = '编辑医嘱模版'
  1283. this.isEdit = true
  1284. },
  1285. handleCreateDrugDic() {
  1286. this.drugdicForm = {
  1287. name: '',
  1288. spec: '',
  1289. spec_unit: '',
  1290. form: '',
  1291. form_unit: '',
  1292. id: 0
  1293. }
  1294. this.drugdicFormVisible = true
  1295. this.dialogTitle = '新增医嘱模版'
  1296. this.isEdit = false
  1297. },
  1298. cancelHandle(formName) {
  1299. this.table_current_index = -1
  1300. this.resetForm(formName)
  1301. if (this.isAddChild) {
  1302. this.templateFormVisible = false
  1303. } else {
  1304. this.templateFormVisible = false
  1305. this.templateTableVisible = true
  1306. }
  1307. },
  1308. handleCreateTemplate() {
  1309. this.form.advice_type = 0
  1310. this.templateTableVisible = true
  1311. },
  1312. newRecordAction() {
  1313. this.dialogTitle = '新增医嘱内容'
  1314. this.advice_content_name = '医嘱内容'
  1315. this.isEdit = false
  1316. this.parent_id = 0
  1317. this.isAddChild = false
  1318. this.templateTableVisible = false
  1319. this.templateFormVisible = true
  1320. }, deleteRecordAction: function() {
  1321. if (this.table_current_index == -1) {
  1322. this.$message.error('请选择一条医嘱记录')
  1323. return
  1324. }
  1325. this.$confirm('删除记录', '是否删除该医嘱记录', {
  1326. confirmButtonText: '确 定',
  1327. cancelButtonText: '取 消',
  1328. type: 'warning'
  1329. }).then(() => {
  1330. this.adviceTableData.splice(this.table_current_index, 1)
  1331. this.table_current_index = -1
  1332. }).catch(() => {
  1333. })
  1334. }, tableRow({ row, rowIndex }) {
  1335. // 把每一行的索引放进row
  1336. row.index = rowIndex
  1337. },
  1338. onRowClick(row, event, column) {
  1339. this.table_current_index = row.index
  1340. }, modifyRecordAction: function() {
  1341. if (this.table_current_index == -1) {
  1342. this.$message.error('请选择一条医嘱记录')
  1343. return
  1344. }
  1345. this.isEdit = true
  1346. const adviceTable = this.adviceTableData[this.table_current_index]
  1347. for (var index in adviceTable) {
  1348. this.templateForm[index] = adviceTable[index]
  1349. }
  1350. this.templateForm.weekday = adviceTable.weekdays.split(',')
  1351. this.templateFormVisible = true
  1352. this.templateTableVisible = false
  1353. this.dialogTitle = '编辑医嘱内容'
  1354. this.advice_content_name = '医嘱内容'
  1355. }, cancelTableHandle: function() {
  1356. this.$confirm('放弃编辑', '是否放弃编辑,已编辑的数据将无法恢复', {
  1357. confirmButtonText: '确 定',
  1358. cancelButtonText: '取 消',
  1359. type: 'warning'
  1360. }).then(() => {
  1361. this.adviceTableData = []
  1362. this.form.name = ''
  1363. this.templateFormVisible = false
  1364. this.templateTableVisible = false
  1365. }).catch(() => {
  1366. })
  1367. }, submitTableTemplate(formName) {
  1368. if (this.adviceTableData.length <= 0) {
  1369. this.$message.error('至少添加一条医嘱信息')
  1370. return
  1371. }
  1372. const params = {
  1373. 'data': this.adviceTableData
  1374. }
  1375. this.form.name = encodeURIComponent(this.form.name)
  1376. postAdviceTemplate(params, this.form.name, this.form.advice_type).then(response => {
  1377. if (response.data.state == 0) {
  1378. this.$message.error(response.data.msg)
  1379. return false
  1380. } else {
  1381. this.$message.success('添加模版成功')
  1382. var template = response.data.data.template
  1383. if (template.DoctorAdviceTemplate.length > 0) {
  1384. for (let i = 0; i < template.DoctorAdviceTemplate.length; i++) {
  1385. const object = {}
  1386. const DoctorAdviceTemplate = template.DoctorAdviceTemplate[i]
  1387. for (const key in DoctorAdviceTemplate) {
  1388. object[key] = DoctorAdviceTemplate[key]
  1389. }
  1390. object['name'] = template.name
  1391. object['isNoSub'] = 2
  1392. this.adviceTemplates.unshift(object)
  1393. }
  1394. }
  1395. this.handleSpanTempArr()
  1396. this.form.name = ''
  1397. this.adviceTableData = []
  1398. this.templateFormVisible = false
  1399. this.templateTableVisible = false
  1400. }
  1401. })
  1402. },
  1403. resetForm(formName) {
  1404. this.$refs[formName].resetFields()
  1405. },
  1406. handleDeleteDrugDic(row, index) {
  1407. this.$confirm('确认删除此医嘱模板?', '删除', {
  1408. confirmButtonText: '确 定',
  1409. cancelButtonText: '取 消',
  1410. type: 'warning'
  1411. })
  1412. .then(() => {
  1413. DeleteDrugDic(row.id).then(response => {
  1414. if (response.data.state == 0) {
  1415. this.$message.error(response.data.msg)
  1416. return false
  1417. } else {
  1418. this.$message.success('删除成功')
  1419. this.drugdics.splice(index, 1)
  1420. }
  1421. })
  1422. })
  1423. .catch(() => {
  1424. })
  1425. },
  1426. handleDeleteAdviceTemplate(row, index) {
  1427. this.$confirm('确认删除此医嘱模板?', '删除', {
  1428. confirmButtonText: '确 定',
  1429. cancelButtonText: '取 消',
  1430. type: 'warning'
  1431. })
  1432. .then(() => {
  1433. DeleteParentAdviceTemplate(row.template_id).then(response => {
  1434. if (response.data.state == 0) {
  1435. this.$message.error(response.data.msg)
  1436. return false
  1437. } else {
  1438. this.$message.success('删除成功')
  1439. // console.log(this.adviceTemplates.length)
  1440. // for(let i = 0;i < this.adviceTemplates.length; i++){
  1441. // if(this.adviceTemplates[i].template_id == row.template_id){
  1442. // this.adviceTemplates.splice(i,1);
  1443. // }
  1444. // }
  1445. this.getAdviceConfig()
  1446. }
  1447. })
  1448. })
  1449. .catch(() => {
  1450. })
  1451. },
  1452. submitDrugDic(formName) {
  1453. this.$refs[formName].validate(valid => {
  1454. if (valid) {
  1455. if (this.isEdit) {
  1456. UpdateDrugDic(this.drugdicForm.id, this.drugdicForm).then(
  1457. response => {
  1458. if (response.data.state == 0) {
  1459. this.$message.error(response.data.msg)
  1460. return false
  1461. } else {
  1462. this.$message.success('修改成功')
  1463. this.drugdicFormVisible = false
  1464. this.resetForm(formName)
  1465. var drugdic = response.data.data.drugdic
  1466. this.drugdics[this.currentIndex].name = drugdic.name
  1467. this.drugdics[this.currentIndex].spec = drugdic.spec
  1468. this.drugdics[this.currentIndex].spec_unit =
  1469. drugdic.spec_unit
  1470. this.drugdics[this.currentIndex].form = drugdic.form
  1471. this.drugdics[this.currentIndex].form_unit =
  1472. drugdic.form_unit
  1473. this.drugdics[this.currentIndex].updated_time =
  1474. drugdic.updated_time
  1475. this.currentIndex = -1
  1476. return false
  1477. }
  1478. }
  1479. )
  1480. } else {
  1481. CreateDrugDic(this.drugdicForm).then(response => {
  1482. if (response.data.state == 0) {
  1483. this.$message.error(response.data.msg)
  1484. return false
  1485. } else {
  1486. this.$message.success('添加成功')
  1487. this.drugdicFormVisible = false
  1488. this.resetForm(formName)
  1489. this.drugdics.unshift(response.data.data.drugdic)
  1490. return false
  1491. }
  1492. })
  1493. }
  1494. }
  1495. })
  1496. },
  1497. submitTemplate(formName) {
  1498. this.$refs[formName].validate(valid => {
  1499. this.templateForm.single_dose = parseFloat(this.templateForm.single_dose)
  1500. this.templateForm.prescribing_number = parseFloat(this.templateForm.prescribing_number)
  1501. if (isNaN(this.templateForm.single_dose)) {
  1502. this.templateForm.single_dose = 0
  1503. }
  1504. if (isNaN(this.templateForm.prescribing_number)) {
  1505. this.templateForm.prescribing_number = 0
  1506. }
  1507. if (valid) {
  1508. const templateFormTwo = {}
  1509. templateFormTwo.template_id = this.current_template_id
  1510. templateFormTwo.advice_name = this.templateForm.advice_name
  1511. templateFormTwo.advice_desc = this.templateForm.advice_desc
  1512. templateFormTwo.drug_spec = this.templateForm.drug_spec
  1513. templateFormTwo.drug_spec_unit = this.templateForm.drug_spec_unit
  1514. templateFormTwo.single_dose = this.templateForm.single_dose
  1515. templateFormTwo.single_dose_unit = this.templateForm.single_dose_unit
  1516. templateFormTwo.prescribing_number = this.templateForm.prescribing_number
  1517. templateFormTwo.prescribing_number_unit = this.templateForm.prescribing_number_unit
  1518. templateFormTwo.delivery_way = this.templateForm.delivery_way
  1519. templateFormTwo.execution_frequency = this.templateForm.execution_frequency
  1520. templateFormTwo.parent_id = this.parent_id
  1521. if (this.isAddChild) {
  1522. CreateSubAdvice(templateFormTwo).then(response => {
  1523. if (response.data.state == 0) {
  1524. this.$message.error(response.data.msg)
  1525. return false
  1526. } else {
  1527. this.$message.success('添加成功')
  1528. var spliceIndex = -1
  1529. for (let index = this.adviceTemplates.length - 1; ; index--) {
  1530. if (this.adviceTemplates[index].parent_id === templateFormTwo.parent_id) {
  1531. spliceIndex = index
  1532. break
  1533. } else if (this.adviceTemplates[index].id === templateFormTwo.parent_id) {
  1534. spliceIndex = index
  1535. break
  1536. }
  1537. }
  1538. if (spliceIndex > -1) {
  1539. spliceIndex += 1
  1540. if (spliceIndex === this.adviceTemplates.length) {
  1541. const template = response.data.data.template
  1542. template['isNoSub'] = 2
  1543. this.adviceTemplates.push(template)
  1544. } else {
  1545. const template = response.data.data.template
  1546. template['isNoSub'] = 2
  1547. var swapData = this.adviceTemplates.splice(spliceIndex)
  1548. this.adviceTemplates.push(template)
  1549. this.adviceTemplates = this.adviceTemplates.concat(swapData)
  1550. }
  1551. }
  1552. this.handleSpanTempArr()
  1553. this.templateFormVisible = false
  1554. this.resetForm(formName)
  1555. return false
  1556. }
  1557. })
  1558. } else {
  1559. const templateFormTwo = {}
  1560. templateFormTwo.advice_name = this.templateForm.advice_name
  1561. templateFormTwo.advice_desc = this.templateForm.advice_desc
  1562. templateFormTwo.drug_spec = this.templateForm.drug_spec
  1563. templateFormTwo.drug_spec_unit = this.templateForm.drug_spec_unit
  1564. templateFormTwo.single_dose = this.templateForm.single_dose
  1565. templateFormTwo.single_dose_unit = this.templateForm.single_dose_unit
  1566. templateFormTwo.prescribing_number = this.templateForm.prescribing_number
  1567. templateFormTwo.prescribing_number_unit = this.templateForm.prescribing_number_unit
  1568. templateFormTwo.delivery_way = this.templateForm.delivery_way
  1569. templateFormTwo.execution_frequency = this.templateForm.execution_frequency
  1570. templateFormTwo.parent_id = this.parent_id
  1571. if (this.templateForm.frequency_type == 1) {
  1572. templateFormTwo.frequency_type = this.templateForm.frequency_type
  1573. templateFormTwo.day_count = '0'
  1574. templateFormTwo.weekdays = ''
  1575. } else if (this.templateForm.frequency_type == 2) {
  1576. templateFormTwo.frequency_type = this.templateForm.frequency_type
  1577. templateFormTwo.day_count = this.templateForm.day_count
  1578. templateFormTwo.weekdays = ''
  1579. } else if (this.templateForm.frequency_type == 3) {
  1580. templateFormTwo.frequency_type = this.templateForm.frequency_type
  1581. templateFormTwo.day_count = '0'
  1582. templateFormTwo.weekdays = this.templateForm.weekday.filter(function(s) {
  1583. return s && s.trim()
  1584. }).join(',')
  1585. }
  1586. this.templateForm.advice_name = ''
  1587. this.templateForm.advice_desc = ''
  1588. this.templateForm.frequency_type = 1
  1589. this.templateForm.day_count = ''
  1590. this.templateForm.weekday = []
  1591. console.log(templateFormTwo)
  1592. if (this.isEdit) {
  1593. for (let i = 0; i < this.adviceTableData.length; i++) {
  1594. if (i == this.table_current_index) {
  1595. this.adviceTableData[i].advice_name = templateFormTwo.advice_name
  1596. this.adviceTableData[i].advice_desc = templateFormTwo.advice_desc
  1597. this.adviceTableData[i].drug_spec = templateFormTwo.drug_spec
  1598. this.adviceTableData[i].drug_spec_unit = templateFormTwo.drug_spec_unit
  1599. this.adviceTableData[i].single_dose = templateFormTwo.single_dose
  1600. this.adviceTableData[i].single_dose_unit = templateFormTwo.single_dose_unit
  1601. this.adviceTableData[i].prescribing_number = templateFormTwo.prescribing_number
  1602. this.adviceTableData[i].prescribing_number_unit = templateFormTwo.prescribing_number_unit
  1603. this.adviceTableData[i].delivery_way = templateFormTwo.delivery_way
  1604. this.adviceTableData[i].execution_frequency = templateFormTwo.execution_frequency
  1605. this.adviceTableData[i].frequency_type = templateFormTwo.frequency_type
  1606. this.adviceTableData[i].day_count = templateFormTwo.day_count
  1607. this.adviceTableData[i].weekdays = templateFormTwo.weekdays
  1608. }
  1609. }
  1610. } else {
  1611. this.adviceTableData.unshift(templateFormTwo)
  1612. console.log(this.adviceTableData)
  1613. }
  1614. this.templateFormVisible = false
  1615. this.templateTableVisible = true
  1616. }
  1617. this.$refs[formName].resetFields()
  1618. }
  1619. })
  1620. },
  1621. handleCreateDrugWay() {
  1622. this.drugwayForm = {
  1623. name: '',
  1624. id: 0
  1625. }
  1626. this.drugwayFormVisible = true
  1627. this.dialogTitle = '新增给药途径'
  1628. this.isEdit = false
  1629. },
  1630. handleUpdateDrugWay(row, index) {
  1631. this.currentIndex = index
  1632. this.drugwayForm = {
  1633. name: row.name,
  1634. id: row.id
  1635. }
  1636. this.drugwayFormVisible = true
  1637. this.dialogTitle = '编辑给药途径'
  1638. this.isEdit = true
  1639. },
  1640. submitDrugWay(formName) {
  1641. this.$refs[formName].validate(valid => {
  1642. if (valid) {
  1643. if (this.isEdit) {
  1644. UpdateDrugWay(this.drugwayForm.id, this.drugwayForm).then(
  1645. response => {
  1646. if (response.data.state == 0) {
  1647. this.$message.error(response.data.msg)
  1648. return false
  1649. } else {
  1650. this.$message.success('修改成功')
  1651. this.drugwayFormVisible = false
  1652. this.resetForm(formName)
  1653. var drugway = response.data.data.drugway
  1654. this.drugways[this.currentIndex].name = drugway.name
  1655. this.drugways[this.currentIndex].updated_time =
  1656. drugway.updated_time
  1657. this.currentIndex = -1
  1658. return false
  1659. }
  1660. }
  1661. )
  1662. } else {
  1663. CreateDrugWay(this.drugwayForm).then(response => {
  1664. if (response.data.state == 0) {
  1665. this.$message.error(response.data.msg)
  1666. return false
  1667. } else {
  1668. this.$message.success('添加成功')
  1669. this.drugwayFormVisible = false
  1670. this.resetForm(formName)
  1671. this.drugways.unshift(response.data.data.drugway)
  1672. return false
  1673. }
  1674. })
  1675. }
  1676. }
  1677. })
  1678. },
  1679. handleDeleteDrugWay(row, index) {
  1680. this.$confirm('确认删除此给药途径?', '删除', {
  1681. confirmButtonText: '确 定',
  1682. cancelButtonText: '取 消',
  1683. type: 'warning'
  1684. })
  1685. .then(() => {
  1686. DeleteDrugWay(row.id).then(response => {
  1687. if (response.data.state == 0) {
  1688. this.$message.error(response.data.msg)
  1689. return false
  1690. } else {
  1691. this.$message.success('删除成功')
  1692. this.drugways.splice(index, 1)
  1693. }
  1694. })
  1695. })
  1696. .catch(() => {
  1697. })
  1698. },
  1699. handleCreateEF() {
  1700. this.efForm = {
  1701. name: '',
  1702. id: 0
  1703. }
  1704. this.efFormVisible = true
  1705. this.dialogTitle = '新增执行频率'
  1706. this.isEdit = false
  1707. },
  1708. handleUpdateEF(row, index) {
  1709. this.currentIndex = index
  1710. this.efForm = {
  1711. name: row.name,
  1712. id: row.id
  1713. }
  1714. this.efFormVisible = true
  1715. this.dialogTitle = '编辑执行频率'
  1716. this.isEdit = true
  1717. },
  1718. submitEF(formName) {
  1719. this.$refs[formName].validate(valid => {
  1720. if (valid) {
  1721. if (this.isEdit) {
  1722. UpdateExecutionFrequency(this.efForm.id, this.efForm).then(
  1723. response => {
  1724. if (response.data.state == 0) {
  1725. this.$message.error(response.data.msg)
  1726. return false
  1727. } else {
  1728. this.$message.success('修改成功')
  1729. this.efFormVisible = false
  1730. this.resetForm(formName)
  1731. var ef = response.data.data.ef
  1732. this.executionFrequencyOptions[this.currentIndex].name =
  1733. ef.name
  1734. this.executionFrequencyOptions[
  1735. this.currentIndex
  1736. ].updated_time = ef.updated_time
  1737. this.currentIndex = -1
  1738. return false
  1739. }
  1740. }
  1741. )
  1742. } else {
  1743. CreateExecutionFrequency(this.efForm).then(response => {
  1744. if (response.data.state == 0) {
  1745. this.$message.error(response.data.msg)
  1746. return false
  1747. } else {
  1748. this.$message.error('添加成功')
  1749. this.efFormVisible = false
  1750. this.resetForm(formName)
  1751. this.executionFrequencyOptions.unshift(response.data.data.ef)
  1752. return false
  1753. }
  1754. })
  1755. }
  1756. }
  1757. })
  1758. },
  1759. handleDeleteEF(row, index) {
  1760. this.$confirm('确认删除此执行频率?', '删除', {
  1761. confirmButtonText: '确 定',
  1762. cancelButtonText: '取 消',
  1763. type: 'warning'
  1764. })
  1765. .then(() => {
  1766. DeleteExecutionFrequency(row.id).then(response => {
  1767. if (response.data.state == 0) {
  1768. this.$message.error(response.data.msg)
  1769. return false
  1770. } else {
  1771. this.$message.error('删除成功')
  1772. this.executionFrequencyOptions.splice(index, 1)
  1773. }
  1774. })
  1775. })
  1776. .catch(() => {
  1777. })
  1778. },
  1779. getAdviceConfig() {
  1780. this.adviceTemplates = []
  1781. getAllAdviceConfig().then(response => {
  1782. if (response.data.state == 1) {
  1783. this.drugways = response.data.data.drugways
  1784. this.executionFrequencyOptions = response.data.data.efs
  1785. this.drugdics = response.data.data.drugs
  1786. const len = response.data.data.advice_templates.length
  1787. for (let i = 0; i < len; i++) {
  1788. // 对于空医嘱模版的处理
  1789. if (response.data.data.advice_templates[i] != null && response.data.data.advice_templates[i].DoctorAdviceTemplate.length == 0) {
  1790. const object = {}
  1791. object['name'] = response.data.data.advice_templates[i].name
  1792. object['isNoSub'] = 1
  1793. object['template_id'] = response.data.data.advice_templates[i].id
  1794. this.adviceTemplates.push(object)
  1795. }
  1796. // 非空模版的处理
  1797. for (let y = 0; y < response.data.data.advice_templates[i].DoctorAdviceTemplate.length; y++) {
  1798. if (response.data.data.advice_templates[i].id == response.data.data.advice_templates[i].DoctorAdviceTemplate[y].template_id) {
  1799. const object = {}
  1800. const DoctorAdviceTemplate = response.data.data.advice_templates[i].DoctorAdviceTemplate[y]
  1801. for (const key in DoctorAdviceTemplate) {
  1802. object[key] = DoctorAdviceTemplate[key]
  1803. }
  1804. object['isNoSub'] = 2
  1805. object['name'] = response.data.data.advice_templates[i].name
  1806. this.adviceTemplates.push(object)
  1807. }
  1808. }
  1809. }
  1810. console.log(this.adviceTemplates)
  1811. // 处理单元格合并的数据
  1812. this.handleSpanTempArr()
  1813. }
  1814. })
  1815. }, isShow(index, row) {
  1816. if (index > 0 && row.name == this.adviceTemplates[index - 1].name) {
  1817. return false
  1818. }
  1819. return true
  1820. }, cancelEditHandle() {
  1821. // this.templateTableVisible = true
  1822. this.templateEditFormVisible = false
  1823. }, submitEditTemplate(formName) {
  1824. this.$refs[formName].validate(valid => {
  1825. this.templateFormEdit.single_dose = parseFloat(this.templateFormEdit.single_dose)
  1826. this.templateFormEdit.prescribing_number = parseFloat(this.templateFormEdit.prescribing_number)
  1827. if (isNaN(this.templateFormEdit.single_dose)) {
  1828. this.templateFormEdit.single_dose = 0
  1829. }
  1830. if (isNaN(this.templateFormEdit.prescribing_number)) {
  1831. this.templateFormEdit.prescribing_number = 0
  1832. }
  1833. if (valid) {
  1834. console.log(this.templateFormEdit)
  1835. if (this.templateFormEdit.frequency_type == 1) {
  1836. this.templateFormEdit.day_count = 0
  1837. this.templateFormEdit.week_days = ''
  1838. } else if (this.templateFormEdit.frequency_type == 2) {
  1839. this.templateFormEdit.day_count = parseInt(this.templateFormEdit.day_count)
  1840. this.templateFormEdit.week_days = ''
  1841. } else if (this.templateFormEdit.frequency_type == 3) {
  1842. this.templateFormEdit.day_count = 0
  1843. this.templateFormEdit.week_days = this.templateFormEdit.weekday.filter(function(s) {
  1844. return s && s.trim()
  1845. }).join(',')
  1846. }
  1847. UpdateAdviceTemplate(this.templateFormEdit.id, this.templateFormEdit).then(
  1848. response => {
  1849. if (response.data.state == 0) {
  1850. this.$message.error(response.data.msg)
  1851. return false
  1852. } else {
  1853. this.$message.success('修改成功')
  1854. this.templateEditFormVisible = false
  1855. this.resetForm(formName)
  1856. var template = response.data.data.template
  1857. this.adviceTemplates[this.currentIndex].advice_name = template.advice_name
  1858. this.adviceTemplates[this.currentIndex].advice_desc = template.advice_desc
  1859. this.adviceTemplates[this.currentIndex].drug_spec = template.drug_spec
  1860. this.adviceTemplates[this.currentIndex].drug_spec_unit = template.drug_spec_unit
  1861. this.adviceTemplates[this.currentIndex].single_dose = template.single_dose
  1862. this.adviceTemplates[this.currentIndex].single_dose_unit = template.single_dose_unit
  1863. this.adviceTemplates[this.currentIndex].delivery_way = template.delivery_way
  1864. this.adviceTemplates[this.currentIndex].execution_frequency = template.execution_frequency
  1865. this.adviceTemplates[this.currentIndex].prescribing_number = template.prescribing_number
  1866. this.adviceTemplates[this.currentIndex].prescribing_number_unit = template.prescribing_number_unit
  1867. this.adviceTemplates[this.currentIndex].day_count = template.day_count
  1868. this.adviceTemplates[this.currentIndex].week_days = template.week_days
  1869. this.adviceTemplates[this.currentIndex].frequency_type = template.frequency_type
  1870. this.currentIndex = -1
  1871. return false
  1872. }
  1873. }
  1874. )
  1875. }
  1876. })
  1877. }, drugDesc(row) {
  1878. if (row.isNoSub == 2) {
  1879. if (row.drug_spec.length <= 0) {
  1880. return ''
  1881. } else {
  1882. if (row.prescribing_number == 0) {
  1883. return row.drug_spec + '' + row.drug_spec_unit
  1884. } else {
  1885. return row.drug_spec + '' + row.drug_spec_unit + ' * ' + row.prescribing_number + row.prescribing_number_unit
  1886. }
  1887. }
  1888. }
  1889. }, drugDescTwo(row) {
  1890. if (row.drug_spec.length <= 0) {
  1891. return ''
  1892. } else {
  1893. if (row.prescribing_number == 0) {
  1894. return row.drug_spec + '' + row.drug_spec_unit
  1895. } else {
  1896. return row.drug_spec + '' + row.drug_spec_unit + ' * ' + row.prescribing_number + row.prescribing_number_unit
  1897. }
  1898. }
  1899. }, newRecordActionTwo() {
  1900. this.templateFormTwoVisible = true
  1901. }, deleteRecordActionTwo() {
  1902. if (this.table_current_index_two == -1) {
  1903. this.$message.error('请选择一条医嘱记录')
  1904. return
  1905. }
  1906. this.$confirm('删除记录', '是否删除该医嘱记录', {
  1907. confirmButtonText: '确 定',
  1908. cancelButtonText: '取 消',
  1909. type: 'warning'
  1910. }).then(() => {
  1911. const id = this.adviceTableDataTwo[this.table_current_index_two].id
  1912. const template_id = this.adviceTableDataTwo[this.table_current_index_two].template_id
  1913. DeleteAdviceTemplate(id, template_id).then(response => {
  1914. if (response.data.state == 0) {
  1915. this.$message.error(response.data.msg)
  1916. return false
  1917. } else {
  1918. this.$message.success('删除成功')
  1919. for (let i = 0; i < this.adviceTemplates.length; i++) {
  1920. console.log(this.adviceTemplates[i].id)
  1921. if (this.adviceTemplates[i].id == this.adviceTableDataTwo[this.table_current_index_two].id) {
  1922. this.adviceTemplates.splice(i, 1)
  1923. }
  1924. }
  1925. this.adviceTableDataTwo.splice(this.table_current_index_two, 1)
  1926. this.table_current_index_two = -1
  1927. }
  1928. })
  1929. }).catch(() => {
  1930. })
  1931. }, modifyRecordActionTwo() {
  1932. if (this.table_current_index_two == -1) {
  1933. this.$message.error('请选择一条医嘱记录')
  1934. return
  1935. }
  1936. this.templateFormEdit = {
  1937. drug_spec: this.adviceTableDataTwo[this.table_current_index_two].drug_spec,
  1938. drug_spec_unit: this.adviceTableDataTwo[this.table_current_index_two].drug_spec_unit,
  1939. advice_name: this.adviceTableDataTwo[this.table_current_index_two].advice_name,
  1940. advice_desc: this.adviceTableDataTwo[this.table_current_index_two].advice_desc,
  1941. single_dose: this.adviceTableDataTwo[this.table_current_index_two].single_dose,
  1942. single_dose_unit: this.adviceTableDataTwo[this.table_current_index_two].single_dose_unit,
  1943. prescribing_number: this.adviceTableDataTwo[this.table_current_index_two].prescribing_number,
  1944. prescribing_number_unit: this.adviceTableDataTwo[this.table_current_index_two].prescribing_number_unit,
  1945. delivery_way: this.adviceTableDataTwo[this.table_current_index_two].delivery_way,
  1946. execution_frequency: this.adviceTableDataTwo[this.table_current_index_two].execution_frequency,
  1947. id: this.adviceTableDataTwo[this.table_current_index_two].id
  1948. }
  1949. this.templateEditFormTwoVisible = true
  1950. }, tableRowClassNameTwo({ row, rowIndex }) {
  1951. // 把每一行的索引放进row
  1952. row.index = rowIndex
  1953. },
  1954. onRowClickTwo(row, event, column) {
  1955. this.table_current_index_two = row.index
  1956. }, cancelHandleTwo() {
  1957. this.templateFormTwoVisible = false
  1958. }, submitTemplateTwo(formName) {
  1959. this.templateForm['template_id'] = this.current_template_id
  1960. this.templateForm['advice_type'] = this.form.advice_type
  1961. if (this.templateForm.frequency_type == 1) {
  1962. this.templateForm.day_count = 0
  1963. this.templateForm.week_days = ''
  1964. } else if (this.templateForm.frequency_type == 2) {
  1965. this.templateForm.day_count = parseInt(this.templateForm.day_count)
  1966. this.templateForm.week_days = ''
  1967. } else if (this.templateForm.frequency_type == 3) {
  1968. this.templateForm.day_count = 0
  1969. this.templateForm.week_days = this.templateForm.weekday.filter(function(s) {
  1970. return s && s.trim()
  1971. }).join(',')
  1972. }
  1973. CreateSingleAdviceTemplate(this.templateForm).then(response => {
  1974. if (response.data.state == 0) {
  1975. this.$message.error(response.data.msg)
  1976. return false
  1977. } else {
  1978. const source = response.data.data.template
  1979. const objects = {}
  1980. for (const keys in source) {
  1981. objects[keys] = source[keys]
  1982. }
  1983. objects['name'] = this.current_template_name
  1984. objects['isNoSub'] = 2
  1985. this.adviceTableDataTwo.unshift(response.data.data.template)
  1986. this.getAdviceConfig()
  1987. this.resetForm(formName)
  1988. this.templateFormTwoVisible = false
  1989. this.$message.success('添加成功')
  1990. this.templateForm.day_count = ''
  1991. this.templateForm.weekday = []
  1992. this.templateForm.frequency_type = 1
  1993. return false
  1994. }
  1995. })
  1996. }, cancelTableHandleTwo() {
  1997. this.templateTableTwoVisible = false
  1998. this.adviceTableDataTwo = []
  1999. }, cancelEditHandleTwo() {
  2000. this.templateEditFormTwoVisible = false
  2001. }, submitEditTemplateTwo(formName) {
  2002. this.$refs[formName].validate(valid => {
  2003. this.templateFormEdit.single_dose = parseFloat(this.templateFormEdit.single_dose)
  2004. this.templateFormEdit.prescribing_number = parseFloat(this.templateFormEdit.prescribing_number)
  2005. if (isNaN(this.templateFormEdit.single_dose)) {
  2006. this.templateFormEdit.single_dose = 0
  2007. }
  2008. if (isNaN(this.templateFormEdit.prescribing_number)) {
  2009. this.templateFormEdit.prescribing_number = 0
  2010. }
  2011. if (valid) {
  2012. UpdateAdviceTemplate(this.templateFormEdit.id, this.templateFormEdit).then(
  2013. response => {
  2014. if (response.data.state == 0) {
  2015. this.$message.error(response.data.msg)
  2016. return false
  2017. } else {
  2018. this.$message.success('修改成功')
  2019. this.templateEditFormTwoVisible = false
  2020. this.resetForm(formName)
  2021. var template = response.data.data.template
  2022. this.adviceTableDataTwo[this.table_current_index_two].advice_name = template.advice_name
  2023. this.adviceTableDataTwo[this.table_current_index_two].advice_desc = template.advice_desc
  2024. this.adviceTableDataTwo[this.table_current_index_two].drug_spec = template.drug_spec
  2025. this.adviceTableDataTwo[this.table_current_index_two].drug_spec_unit = template.drug_spec_unit
  2026. this.adviceTableDataTwo[this.table_current_index_two].single_dose = template.single_dose
  2027. this.adviceTableDataTwo[this.table_current_index_two].single_dose_unit = template.single_dose_unit
  2028. this.adviceTableDataTwo[this.table_current_index_two].delivery_way = template.delivery_way
  2029. this.adviceTableDataTwo[this.table_current_index_two].execution_frequency = template.execution_frequency
  2030. this.adviceTableDataTwo[this.table_current_index_two].prescribing_number = template.prescribing_number
  2031. this.adviceTableDataTwo[this.table_current_index_two].prescribing_number_unit = template.prescribing_number_unit
  2032. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2033. if (this.adviceTemplates[i].id == this.adviceTableDataTwo[this.table_current_index_two].id) {
  2034. this.adviceTemplates[i].advice_name = template.advice_name
  2035. this.adviceTemplates[i].advice_desc = template.advice_desc
  2036. this.adviceTemplates[i].drug_spec = template.drug_spec
  2037. this.adviceTemplates[i].drug_spec_unit = template.drug_spec_unit
  2038. this.adviceTemplates[i].single_dose = template.single_dose
  2039. this.adviceTemplates[i].single_dose_unit = template.single_dose_unit
  2040. this.adviceTemplates[i].delivery_way = template.delivery_way
  2041. this.adviceTemplates[i].execution_frequency = template.execution_frequency
  2042. this.adviceTemplates[i].prescribing_number = template.prescribing_number
  2043. this.adviceTemplates[i].prescribing_number_unit = template.prescribing_number_unit
  2044. }
  2045. }
  2046. return false
  2047. }
  2048. }
  2049. )
  2050. }
  2051. })
  2052. }, merge({ row, column, rowIndex, columnIndex }) {
  2053. if (columnIndex === 0 || columnIndex === 1 || columnIndex === 9) {
  2054. const _row = this.tempArr[rowIndex]
  2055. const _col = _row > 0 ? 1 : 0
  2056. return {
  2057. rowspan: _row,
  2058. colspan: _col
  2059. }
  2060. }
  2061. }, tableRowClassNames({ row, rowIndex }) {
  2062. const arr = this.hoverOrderArr
  2063. for (let i = 0; i < arr.length; i++) {
  2064. if (rowIndex == arr[i]) {
  2065. return 'success-row'
  2066. }
  2067. }
  2068. }, cellMouseEnter: function(row, column, cell, event) {
  2069. if (column.label == '模版名称') {
  2070. this.sameRowArr.forEach((arr, i) => {
  2071. if (arr.indexOf(row.index) != -1) {
  2072. this.hoverOrderArr = arr
  2073. }
  2074. })
  2075. } else if (column.label == '操作') {
  2076. this.sameRowArr.forEach((arr, i) => {
  2077. if (arr.indexOf(row.index) != -1) {
  2078. this.hoverOrderArr = arr
  2079. }
  2080. })
  2081. } else {
  2082. this.hoverOrderArr = []
  2083. }
  2084. }, cellMouseLeave: function(row, column, cell, event) {
  2085. this.hoverOrderArr = []
  2086. }, openEdit(index, row) {
  2087. console.log(row)
  2088. this.hoverOrderArr = []
  2089. this.currentIndex = index
  2090. this.templateFormEdit.drug_spec_unit = row.drug_spec_unit
  2091. this.templateFormEdit.drug_spec = row.drug_spec
  2092. this.templateFormEdit.advice_desc = row.advice_desc
  2093. this.templateFormEdit.advice_name = row.advice_name
  2094. this.templateFormEdit.delivery_way = row.delivery_way
  2095. this.templateFormEdit.execution_frequency = row.execution_frequency
  2096. this.templateFormEdit.prescribing_number = row.prescribing_number
  2097. this.templateFormEdit.prescribing_number_unit = row.prescribing_number_unit
  2098. this.templateFormEdit.single_dose = row.single_dose
  2099. this.templateFormEdit.single_dose_unit = row.single_dose_unit
  2100. this.templateFormEdit.id = row.id
  2101. this.templateFormEdit.parent_id = row.parent_id
  2102. this.templateFormEdit.day_count = row.day_count
  2103. this.templateFormEdit.frequency_type = row.frequency_type
  2104. this.templateFormEdit.weekday = row.week_days.split(',')
  2105. this.templateEditFormVisible = true
  2106. if (row.parent_id > 0) {
  2107. this.editDialogTitle = '编辑子药'
  2108. this.edit_advice_name = '子药名称'
  2109. } else {
  2110. this.editDialogTitle = '编辑医嘱'
  2111. this.edit_advice_name = '医嘱内容'
  2112. }
  2113. }, openDelete(index, row) {
  2114. this.hoverOrderArr = []
  2115. this.$confirm('删除记录', '是否删除该医嘱', {
  2116. confirmButtonText: '确 定',
  2117. cancelButtonText: '取 消',
  2118. type: 'warning'
  2119. }).then(() => {
  2120. const id = row.id
  2121. const template_id = row.template_id
  2122. const parent_id = row.parent_id
  2123. DeleteAdviceTemplate(id, template_id, parent_id).then(response => {
  2124. if (response.data.state == 0) {
  2125. this.$message.error(response.data.msg)
  2126. return false
  2127. } else {
  2128. this.$message.success('删除成功')
  2129. if (row.parent_id > 0) { // 删除子医嘱
  2130. this.adviceTemplates.splice(index, 1)
  2131. } else { // 如果医嘱下面包含子医嘱,删除医嘱和子医嘱
  2132. // 删除子医嘱
  2133. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2134. if (this.adviceTemplates[i].parent_id == row.id) {
  2135. this.adviceTemplates.splice(i--, 1)
  2136. }
  2137. }
  2138. // 删除医嘱
  2139. this.adviceTemplates.splice(index, 1)
  2140. // 当该模版下没有医嘱的时候,创建一个空模版
  2141. let count = 0 // 用于计数
  2142. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2143. if (this.adviceTemplates[i].template_id == row.template_id) {
  2144. count = count + 1
  2145. }
  2146. }
  2147. if (count == 0) {
  2148. const object = {}
  2149. object['name'] = row.name
  2150. object['isNoSub'] = 1
  2151. object['template_id'] = row.template_id
  2152. this.adviceTemplates.splice(index, 0, object)
  2153. }
  2154. }
  2155. // 处理单元格合并的数据
  2156. this.handleSpanTempArr()
  2157. }
  2158. })
  2159. }).catch(() => {
  2160. })
  2161. }, openDeleteChild(index, row) {
  2162. this.hoverOrderArr = []
  2163. this.$confirm('删除子药', '是否删除该子药', {
  2164. confirmButtonText: '确 定',
  2165. cancelButtonText: '取 消',
  2166. type: 'warning'
  2167. }).then(() => {
  2168. const id = row.id
  2169. const template_id = row.template_id
  2170. const parent_id = row.parent_id
  2171. DeleteAdviceTemplate(id, template_id, parent_id).then(response => {
  2172. if (response.data.state == 0) {
  2173. this.$message.error(response.data.msg)
  2174. return false
  2175. } else {
  2176. this.$message.success('删除成功')
  2177. if (row.parent_id > 0) { // 删除子医嘱
  2178. this.adviceTemplates.splice(index, 1)
  2179. } else { // 如果医嘱下面包含子医嘱,删除医嘱和子医嘱
  2180. // 删除子医嘱
  2181. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2182. if (this.adviceTemplates[i].parent_id == row.id) {
  2183. this.adviceTemplates.splice(i--, 1)
  2184. }
  2185. }
  2186. // 删除医嘱
  2187. this.adviceTemplates.splice(index, 1)
  2188. // 当该模版下没有医嘱的时候,创建一个空模版
  2189. let count = 0 // 用于计数
  2190. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2191. if (this.adviceTemplates[i].template_id == row.template_id) {
  2192. count = count + 1
  2193. }
  2194. }
  2195. if (count == 0) {
  2196. const object = {}
  2197. object['name'] = row.name
  2198. object['isNoSub'] = 1
  2199. object['template_id'] = row.template_id
  2200. this.adviceTemplates.splice(index, 0, object)
  2201. }
  2202. }
  2203. // 处理单元格合并的数据
  2204. this.handleSpanTempArr()
  2205. }
  2206. })
  2207. }).catch(() => {
  2208. })
  2209. },
  2210. openNewChild(index, row) {
  2211. this.hoverOrderArr = []
  2212. this.current_template_id = row.template_id
  2213. this.parent_id = row.id
  2214. this.isAddChild = true
  2215. this.isEdit = false
  2216. this.templateFormVisible = true
  2217. this.dialogTitle = '新增子药'
  2218. this.advice_content_name = '子药名称'
  2219. }, deleteRecordAction: function() {
  2220. if (this.table_current_index == -1) {
  2221. this.$message.error('请选择一条医嘱记录')
  2222. return
  2223. }
  2224. this.$confirm('删除记录', '是否删除该医嘱记录', {
  2225. confirmButtonText: '确 定',
  2226. cancelButtonText: '取 消',
  2227. type: 'warning'
  2228. }).then(() => {
  2229. this.adviceTableData.splice(this.table_current_index, 1)
  2230. this.table_current_index = -1
  2231. }).catch(() => {
  2232. })
  2233. }, handleSpanTempArr() {
  2234. this.tempArr = []
  2235. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2236. if (i === 0) {
  2237. this.tempArr.push(1)
  2238. this.pos = 0
  2239. } else {
  2240. // 判断当前元素与上一个元素是否相同
  2241. if (this.adviceTemplates[i].template_id === this.adviceTemplates[i - 1].template_id) {
  2242. this.tempArr[this.pos] += 1
  2243. this.tempArr.push(0)
  2244. } else {
  2245. this.tempArr.push(1)
  2246. this.pos = i
  2247. }
  2248. }
  2249. }
  2250. let sameRowArr = [], sIdx = 0
  2251. this.adviceTemplates.forEach((item, index) => {
  2252. item.index = index
  2253. if (index === 0) {
  2254. sameRowArr.push([index])
  2255. } else {
  2256. if (item.template_id === this.adviceTemplates[index - 1].template_id) {
  2257. sameRowArr[sIdx].push(index)
  2258. } else {
  2259. sIdx = sIdx + 1
  2260. sameRowArr.push([index])
  2261. }
  2262. }
  2263. })
  2264. this.sameRowArr = sameRowArr
  2265. }, handleUpdateAdviceTemplate(row, index) {
  2266. this.current_template_id = row.template_id
  2267. this.current_template_name = row.name
  2268. this.form.name = row.name
  2269. this.form.advice_type = row.advice_type
  2270. this.templateTableTwoVisible = true
  2271. this.adviceTableDataTwo = []
  2272. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2273. if (this.adviceTemplates[i].template_id == row.template_id) {
  2274. this.adviceTableDataTwo.push(this.adviceTemplates[i])
  2275. }
  2276. }
  2277. }, modifyTemplateName() {
  2278. const params = {
  2279. template_name: this.form.name,
  2280. template_id: this.current_template_id
  2281. }
  2282. updateTemplateName(params).then(response => {
  2283. if (response.data.state == 0) {
  2284. this.$message.error(response.data.msg)
  2285. return false
  2286. } else {
  2287. this.$message.success('修改成功')
  2288. this.templateTableTwoVisible = false
  2289. for (let i = 0; i < this.adviceTemplates.length; i++) {
  2290. if (this.adviceTemplates[i].template_id == this.current_template_id) {
  2291. this.adviceTemplates[i].name = response.data.data.template_name
  2292. }
  2293. }
  2294. }
  2295. })
  2296. }, changeRemind(val) {
  2297. let params = {
  2298. 'is_open_remind': val,
  2299. }
  2300. postDoctorAdviceConfig(params).then(response => {
  2301. if (response.data.state == 1) {
  2302. this.is_open_remind = response.data.data.is_open_remind
  2303. if (response.data.data.is_open_remind == 1) {
  2304. this.$message.success('开启成功')
  2305. } else {
  2306. this.$message.success('关闭成功')
  2307. }
  2308. } else {
  2309. this.$message.error(response.data.msg)
  2310. }
  2311. })
  2312. }
  2313. }
  2314. }
  2315. </script>
  2316. <style>
  2317. .center th .cell {
  2318. text-align: center !important;
  2319. }
  2320. .templateadvicenamedisplay .cell {
  2321. float: left;
  2322. text-align: left;
  2323. }
  2324. .el-table td,
  2325. .el-table th.is-leaf,
  2326. .el-table--border,
  2327. .el-table--group {
  2328. border-color: #d0d3da;
  2329. }
  2330. .el-table--border::after,
  2331. .el-table--group::after,
  2332. .el-table::before {
  2333. background-color: #d0d3da;
  2334. }
  2335. </style>