血透系统PC前端

druguse.vue 34KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs='crumbs'></bread-crumb>
  5. </div>
  6. <div class="tab-container">
  7. <el-tabs >
  8. <el-tab-pane label="医嘱模板">
  9. <div >
  10. <div class="filter-container">
  11. <el-button
  12. class="filter-item"
  13. style="margin-left: 10px;"
  14. @click="handleCreateTemplate"
  15. type="primary"
  16. size="small"
  17. icon="el-icon-circle-plus-outline"
  18. >{{$t('table.add')}}</el-button>
  19. </div>
  20. <el-table
  21. :data="adviceTemplates"
  22. v-loading="listLoading"
  23. border
  24. fit
  25. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  26. highlight-current-row
  27. style="width: 100%;min-height:500px;"
  28. >
  29. <el-table-column align="center" label="医嘱名称">
  30. <template slot-scope="scope">
  31. <span>{{scope.row.advice_name}}</span>
  32. </template>
  33. </el-table-column>
  34. <!-- <el-table-column align="center" label="医嘱内容">
  35. <template slot-scope="scope">
  36. <span>{{scope.row.advice_desc}}</span>
  37. </template>
  38. </el-table-column> -->
  39. <el-table-column align="center" label="单次用量">
  40. <template slot-scope="scope">
  41. <span>{{scope.row.single_dose}} {{scope.row.single_dose_unit}}</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column align="center" label="开药数量">
  45. <template slot-scope="scope">
  46. <span>{{scope.row.prescribing_number}} {{scope.row.prescribing_number_unit}}</span>
  47. </template>
  48. </el-table-column>
  49. <el-table-column align="center" label="给药途径">
  50. <template slot-scope="scope">
  51. <span>{{scope.row.delivery_way}}</span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column align="center" label="执行频率">
  55. <template slot-scope="scope">
  56. <span>{{scope.row.execution_frequency}}</span>
  57. </template>
  58. </el-table-column>
  59. <el-table-column
  60. align="center"
  61. :label="$t('table.actions')"
  62. width="230"
  63. class-name="small-padding fixed-width"
  64. >
  65. <template slot-scope="scope">
  66. <el-button
  67. type="primary"
  68. size="small"
  69. icon="el-icon-edit-outline"
  70. @click="handleUpdateAdviceTemplate(scope.row, scope.$index)"
  71. ></el-button>
  72. <el-button
  73. v-if="scope.row.status!='deleted'"
  74. size="small"
  75. type="danger"
  76. icon="el-icon-delete"
  77. @click="handleDeleteAdviceTemplate(scope.row, scope.$index)"
  78. ></el-button>
  79. </template>
  80. </el-table-column>
  81. </el-table>
  82. <el-dialog :title="dialogTitle" :visible.sync="templateFormVisible" width="700px">
  83. <el-form
  84. ref="templateForm"
  85. :rules="templateRules"
  86. :model="templateForm"
  87. label-width="90px"
  88. >
  89. <el-row>
  90. <el-col :span="12">
  91. <el-form-item label="医嘱名称 :" required prop="advice_name">
  92. <el-input v-model="templateForm.advice_name" style="width:50%"></el-input>
  93. </el-form-item>
  94. </el-col>
  95. <!-- <el-form-item label="医嘱内容 :" prop="advice_desc">
  96. <el-input v-model="templateForm.advice_desc" style="width:50%"></el-input>
  97. </el-form-item> -->
  98. <el-col :span="12">
  99. <el-form-item label="单次用量 :" prop="single_dose">
  100. <el-col :span="8">
  101. <el-input v-model="templateForm.single_dose"></el-input>
  102. </el-col>
  103. <el-col class="line" :span="2">&nbsp;</el-col>
  104. <el-col :span="14">
  105. <el-select
  106. v-model="templateForm.single_dose_unit"
  107. filterable
  108. clearable
  109. allow-create
  110. placeholder="选择"
  111. >
  112. <el-option
  113. v-for="item in unitsOption"
  114. :key="item.id"
  115. :label="item.name "
  116. :value="item.name"
  117. ></el-option>
  118. </el-select>
  119. </el-col>
  120. </el-form-item>
  121. </el-col>
  122. </el-row>
  123. <el-row>
  124. <el-col :span="12">
  125. <el-form-item label="开药数量 :" prop="prescribing_number">
  126. <el-col :span="8">
  127. <el-input v-model="templateForm.prescribing_number"></el-input>
  128. </el-col>
  129. <el-col class="line" :span="2">&nbsp;</el-col>
  130. <el-col :span="14">
  131. <el-select
  132. v-model="templateForm.prescribing_number_unit"
  133. filterable
  134. clearable
  135. allow-create
  136. placeholder="选择"
  137. >
  138. <el-option
  139. v-for="item in unitsOption"
  140. :key="item.id"
  141. :label="item.name "
  142. :value="item.name"
  143. ></el-option>
  144. </el-select>
  145. </el-col>
  146. </el-form-item>
  147. </el-col>
  148. <el-col :span="12">
  149. <el-form-item label="给药途径 :" prop="delivery_way">
  150. <el-select
  151. v-model="templateForm.delivery_way"
  152. filterable
  153. clearable
  154. allow-create
  155. placeholder="请选择(输入可搜索)"
  156. style="width:90%"
  157. >
  158. <el-option
  159. v-for="item in drugways"
  160. :key="item.id"
  161. :label="item.name "
  162. :value="item.name"
  163. ></el-option>
  164. </el-select>
  165. </el-form-item>
  166. </el-col>
  167. </el-row>
  168. <el-row>
  169. <el-col :span="12">
  170. <el-form-item label="执行频率 :" prop="execution_frequency">
  171. <el-select
  172. v-model="templateForm.execution_frequency"
  173. clearable
  174. allow-create
  175. filterable
  176. placeholder="请选择(输入可搜索)"
  177. style="width:90%"
  178. >
  179. <el-option
  180. v-for="item in executionFrequencyOptions"
  181. :key="item.id"
  182. :label="item.name"
  183. :value="item.name"
  184. ></el-option>
  185. </el-select>
  186. </el-form-item>
  187. </el-col>
  188. </el-row>
  189. </el-form>
  190. <div slot="footer" class="dialog-footer">
  191. <el-button @click="templateFormVisible = false">取消</el-button>
  192. <el-button type="primary" @click="submitTemplate('templateForm')">保 存</el-button>
  193. </div>
  194. </el-dialog>
  195. <el-dialog :title="dialogTitle" :visible.sync="drugdicFormVisible" width="700px">
  196. <el-form
  197. ref="drugdicForm"
  198. :rules="drugdicRules"
  199. :model="drugdicForm"
  200. label-width="90px"
  201. >
  202. <el-form-item label="医嘱名称 :" required prop="name">
  203. <el-input v-model="drugdicForm.name" style="width:50%" placeholder="如:阿莫西林"></el-input>
  204. </el-form-item>
  205. <el-form-item label="医嘱内容 :" prop="spec">
  206. <el-input v-model="drugdicForm.spec" style="width:50%" placeholder="如:10克x9袋"></el-input>
  207. </el-form-item>
  208. <el-form-item label="医嘱类型 :" prop="form">
  209. <el-select
  210. v-model="drugdicForm.form"
  211. clearable
  212. allow-create
  213. filterable
  214. placeholder="请选择(输入可搜索)"
  215. >
  216. <el-option
  217. :label="item.name"
  218. :key="item.label"
  219. :value="item.name"
  220. v-for="item in drugforms"
  221. ></el-option>
  222. </el-select>
  223. </el-form-item>
  224. <el-row>
  225. <el-col :span="12">
  226. <el-form-item label="单次单位 :" prop="spec_unit">
  227. <el-select
  228. v-model="drugdicForm.spec_unit"
  229. clearable
  230. allow-create
  231. filterable
  232. placeholder="选择(输入可搜索)"
  233. >
  234. <el-option
  235. v-for="item in unitsOption"
  236. :key="item.label"
  237. :label="item.name "
  238. :value="item.name"
  239. ></el-option>
  240. </el-select>
  241. </el-form-item>
  242. </el-col>
  243. <el-col :span="12">
  244. <el-form-item label="开药单位 :" prop="form_unit">
  245. <el-select
  246. v-model="drugdicForm.form_unit"
  247. clearable
  248. allow-create
  249. filterable
  250. placeholder="选择(输入可搜索)"
  251. >
  252. <el-option
  253. v-for="item in unitsOption"
  254. :key="item.label"
  255. :label="item.name "
  256. :value="item.name"
  257. ></el-option>
  258. </el-select>
  259. </el-form-item>
  260. </el-col>
  261. </el-row>
  262. </el-form>
  263. <div slot="footer" class="dialog-footer">
  264. <el-button @click="drugdicFormVisible = false">取消</el-button>
  265. <el-button type="primary" @click="submitDrugDic('drugdicForm')">保 存</el-button>
  266. </div>
  267. </el-dialog>
  268. </div>
  269. </el-tab-pane>
  270. <el-tab-pane label="给药途径">
  271. <div class="app-container">
  272. <div class="filter-container">
  273. <el-button
  274. class="filter-item"
  275. style="margin-left: 10px;"
  276. @click="handleCreateDrugWay"
  277. type="primary"
  278. size="small"
  279. icon="el-icon-circle-plus-outline"
  280. >{{$t('table.add')}}</el-button>
  281. </div>
  282. <el-table
  283. :data="drugways"
  284. v-loading="listLoading"
  285. border
  286. fit
  287. highlight-current-row
  288. style="width: 100%;min-height:500px;"
  289. >
  290. <el-table-column align="center" label="名称">
  291. <template slot-scope="scope">
  292. <span>{{scope.row.name}}</span>
  293. </template>
  294. </el-table-column>
  295. <el-table-column
  296. align="center"
  297. :label="$t('table.actions')"
  298. width="230"
  299. class-name="small-padding fixed-width"
  300. >
  301. <template slot-scope="scope">
  302. <el-button type="text" size="mini" v-show="scope.row.org_id==0" disabled>系统设定</el-button>
  303. <el-button
  304. v-show="scope.row.org_id!=0"
  305. type="primary"
  306. size="small"
  307. icon="el-icon-edit-outline"
  308. @click="handleUpdateDrugWay(scope.row, scope.$index)"
  309. ></el-button>
  310. <el-button
  311. v-show="scope.row.org_id!=0"
  312. size="small"
  313. type="danger"
  314. icon="el-icon-delete"
  315. @click="handleDeleteDrugWay(scope.row, scope.$index)"
  316. ></el-button>
  317. </template>
  318. </el-table-column>
  319. </el-table>
  320. <el-dialog :title="dialogTitle" :visible.sync="drugwayFormVisible" width="700px">
  321. <el-form
  322. ref="drugwayForm"
  323. :rules="drugwayRules"
  324. :model="drugwayForm"
  325. label-width="90px"
  326. >
  327. <el-form-item label="给药途径 :" required prop="name">
  328. <el-input v-model="drugwayForm.name" placeholder="给药途径"></el-input>
  329. </el-form-item>
  330. </el-form>
  331. <div slot="footer" class="dialog-footer">
  332. <el-button @click="drugwayFormVisible = false">取消</el-button>
  333. <el-button type="primary" @click="submitDrugWay('drugwayForm')">保 存</el-button>
  334. </div>
  335. </el-dialog>
  336. </div>
  337. </el-tab-pane>
  338. <el-tab-pane label="执行频率">
  339. <div class="">
  340. <div class="filter-container">
  341. <el-button
  342. class="filter-item"
  343. style="margin-left: 10px;"
  344. @click="handleCreateEF"
  345. type="primary"
  346. size="small"
  347. icon="el-icon-circle-plus-outline"
  348. >{{$t('table.add')}}</el-button>
  349. </div>
  350. <el-table
  351. :data="executionFrequencyOptions"
  352. v-loading="listLoading"
  353. border
  354. fit
  355. highlight-current-row
  356. style="width: 100%;min-height:500px;"
  357. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  358. >
  359. <el-table-column align="center" label="名称">
  360. <template slot-scope="scope">
  361. <span>{{scope.row.name}}</span>
  362. </template>
  363. </el-table-column>
  364. <el-table-column
  365. align="center"
  366. :label="$t('table.actions')"
  367. width="230"
  368. class-name="small-padding fixed-width"
  369. >
  370. <template slot-scope="scope">
  371. <el-button type="text" size="mini" v-show="scope.row.org_id==0" disabled>系统设定</el-button>
  372. <el-button
  373. v-show="scope.row.org_id!=0"
  374. type="primary"
  375. size="small"
  376. icon="el-icon-edit-outline"
  377. @click="handleUpdateEF(scope.row, scope.$index)"
  378. ></el-button>
  379. <el-button
  380. v-show="scope.row.org_id!=0"
  381. size="small"
  382. type="danger"
  383. icon="el-icon-delete"
  384. @click="handleDeleteEF(scope.row, scope.$index)"
  385. ></el-button>
  386. </template>
  387. </el-table-column>
  388. </el-table>
  389. <el-dialog :title="dialogTitle" :visible.sync="efFormVisible" width="700px">
  390. <el-form ref="efForm" :rules="efRules" :model="efForm" label-width="90px">
  391. <el-form-item label="执行频率 :" required prop="name">
  392. <el-input v-model="efForm.name" placeholder="执行频率"></el-input>
  393. </el-form-item>
  394. </el-form>
  395. <div slot="footer" class="dialog-footer">
  396. <el-button @click="efFormVisible = false">取 消</el-button>
  397. <el-button type="primary" @click="submitEF('efForm')">保 存</el-button>
  398. </div>
  399. </el-dialog>
  400. </div>
  401. </el-tab-pane>
  402. </el-tabs>
  403. </div>
  404. </template>
  405. <script>
  406. import {
  407. getAdviceConfig,
  408. CreateDrugDic,
  409. UpdateDrugDic,
  410. DeleteDrugDic,
  411. CreateDrugWay,
  412. UpdateDrugWay,
  413. DeleteDrugWay,
  414. CreateExecutionFrequency,
  415. UpdateExecutionFrequency,
  416. DeleteExecutionFrequency,
  417. CreateAdviceTemplate,
  418. UpdateAdviceTemplate,
  419. DeleteAdviceTemplate
  420. } from "@/api/advice";
  421. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  422. export default {
  423. name: "tab",
  424. components: {BreadCrumb},
  425. data() {
  426. return {
  427. crumbs: [
  428. { path: false, name: '数据字典' },
  429. { path: '/patients/patients', name: '字段配置' },
  430. ],
  431. currentIndex: -1,
  432. isEdit: false,
  433. dialogTitle: "",
  434. drugdicFormVisible: false,
  435. drugwayFormVisible: false,
  436. templateFormVisible: false,
  437. efFormVisible: false,
  438. listLoading: true,
  439. activeName: "drugdic",
  440. createdTimes: 0,
  441. drugdics: [],
  442. adviceTemplates:[],
  443. drugways: [],
  444. executionFrequencyOptions: [],
  445. drugdicRules: {
  446. name: [{ required: true, message: "请填写医嘱名称" }]
  447. },
  448. drugwayRules: {
  449. name: [{ required: true, message: "请填写给药途径" }]
  450. },
  451. efRules: {
  452. name: [{ required: true, message: "请填写执行频率" }]
  453. },
  454. templateRules: {
  455. advice_name: [{ required: true, message: "请填写医嘱名称" }]
  456. },
  457. templateForm: {
  458. advice_name: "",
  459. advice_desc: "",
  460. single_dose: "",
  461. single_dose_unit: "",
  462. prescribing_number: "",
  463. prescribing_number_unit: "",
  464. delivery_way: "",
  465. execution_frequency: "",
  466. id: 0
  467. },
  468. drugdicForm: {
  469. name: "",
  470. spec: "",
  471. spec_unit: "",
  472. form: "",
  473. form_unit: "",
  474. id: 0
  475. },
  476. drugwayForm: {
  477. name: "",
  478. id: 0
  479. },
  480. efForm: {
  481. name: "",
  482. id: 0
  483. },
  484. unitsOption: [
  485. { lable: 1, name: "盒" },
  486. { lable: 2, name: "支" },
  487. { lable: 3, name: "瓶" },
  488. { lable: 4, name: "片" },
  489. { lable: 5, name: "袋" },
  490. { lable: 6, name: "g" },
  491. { lable: 7, name: "mg" },
  492. { lable: 8, name: "u" },
  493. { lable: 9, name: "ml" },
  494. { lable: 10, name: "枚" },
  495. { lable: 11, name: "粒" },
  496. { lable: 12, name: "μg" },
  497. { lable: 13, name: "iu" },
  498. { lable: 14, name: "包" },
  499. { lable: 15, name: "丸" }
  500. ],
  501. drugforms: [
  502. { lable: 1, name: "胶囊" },
  503. { lable: 2, name: "注射剂" },
  504. { lable: 3, name: "片剂" },
  505. { lable: 4, name: "注射液" },
  506. { lable: 5, name: "栓剂" },
  507. { lable: 6, name: "膏" },
  508. { lable: 7, name: "颗粒剂" },
  509. { lable: 8, name: "粉剂" },
  510. { lable: 9, name: "口服液" },
  511. { lable: 10, name: "干混悬剂" },
  512. { lable: 11, name: "丸剂" },
  513. { lable: 12, name: "气雾剂" },
  514. { lable: 13, name: "内服溶液" },
  515. { lable: 14, name: "外用溶液" },
  516. { lable: 15, name: "软膏剂" },
  517. { lable: 16, name: "胶剂" }
  518. ]
  519. };
  520. },
  521. created() {
  522. this.getAdviceConfig();
  523. },
  524. methods: {
  525. showCreatedTimes() {
  526. this.createdTimes = this.createdTimes + 1;
  527. },
  528. handleUpdateDrugDic(row, index) {
  529. this.currentIndex = index;
  530. this.drugdicForm = {
  531. name: row.name,
  532. spec: row.spec,
  533. spec_unit: row.spec_unit,
  534. form: row.form,
  535. form_unit: row.form_unit,
  536. id: row.id
  537. };
  538. this.drugdicFormVisible = true;
  539. this.dialogTitle = "编辑医嘱模版";
  540. this.isEdit = true;
  541. },
  542. handleCreateDrugDic() {
  543. this.drugdicForm = {
  544. name: "",
  545. spec: "",
  546. spec_unit: "",
  547. form: "",
  548. form_unit: "",
  549. id: 0
  550. };
  551. this.drugdicFormVisible = true;
  552. this.dialogTitle = "新增医嘱模版";
  553. this.isEdit = false;
  554. },
  555. handleCreateTemplate() {
  556. this.templateForm = {
  557. advice_name: "",
  558. advice_desc: "",
  559. single_dose: "",
  560. single_dose_unit: "",
  561. prescribing_number: "",
  562. prescribing_number_unit: "",
  563. delivery_way: "",
  564. execution_frequency: "",
  565. id: 0
  566. };
  567. this.templateFormVisible = true;
  568. this.dialogTitle = "新增医嘱模版";
  569. this.isEdit = false;
  570. },
  571. handleUpdateAdviceTemplate(row, index){
  572. this.templateForm = {
  573. advice_name: row.advice_name,
  574. advice_desc: row.advice_desc,
  575. single_dose: row.single_dose,
  576. single_dose_unit: row.single_dose_unit,
  577. prescribing_number: row.prescribing_number,
  578. prescribing_number_unit: row.prescribing_number_unit,
  579. delivery_way: row.delivery_way,
  580. execution_frequency: row.execution_frequency,
  581. id: row.id,
  582. };
  583. this.templateFormVisible = true;
  584. this.dialogTitle = "编辑医嘱模版";
  585. this.isEdit = true;
  586. this.currentIndex = index;
  587. },
  588. resetForm(formName) {
  589. this.$refs[formName].resetFields();
  590. },
  591. handleDeleteDrugDic(row, index) {
  592. this.$confirm("确认删除此医嘱模板?", "删除", {
  593. confirmButtonText: "确 定",
  594. cancelButtonText: "取 消",
  595. type: "warning"
  596. })
  597. .then(() => {
  598. DeleteDrugDic(row.id).then(response => {
  599. if (response.data.state == 0) {
  600. this.$message.error(response.data.msg);
  601. return false;
  602. } else {
  603. this.$notify({
  604. title: "成功",
  605. message: "医嘱模板已经删除",
  606. type: "success",
  607. duration: 2000
  608. });
  609. this.drugdics.splice(index, 1);
  610. }
  611. });
  612. })
  613. .catch(() => {});
  614. },
  615. handleDeleteAdviceTemplate(row, index) {
  616. this.$confirm("确认删除此医嘱模板?", "删除", {
  617. confirmButtonText: "确 定",
  618. cancelButtonText: "取 消",
  619. type: "warning"
  620. })
  621. .then(() => {
  622. DeleteAdviceTemplate(row.id).then(response => {
  623. if (response.data.state == 0) {
  624. this.$message.error(response.data.msg);
  625. return false;
  626. } else {
  627. this.$notify({
  628. title: "成功",
  629. message: "医嘱模板已经删除",
  630. type: "success",
  631. duration: 2000
  632. });
  633. this.adviceTemplates.splice(index, 1);
  634. }
  635. });
  636. })
  637. .catch(() => {});
  638. },
  639. submitDrugDic(formName) {
  640. this.$refs[formName].validate(valid => {
  641. if (valid) {
  642. if (this.isEdit) {
  643. UpdateDrugDic(this.drugdicForm.id, this.drugdicForm).then(
  644. response => {
  645. if (response.data.state == 0) {
  646. this.$message.error(response.data.msg);
  647. return false;
  648. } else {
  649. this.$notify({
  650. title: "成功",
  651. message: "修改成功",
  652. type: "success",
  653. duration: 2000
  654. });
  655. this.drugdicFormVisible = false;
  656. this.resetForm(formName);
  657. var drugdic = response.data.data.drugdic;
  658. this.drugdics[this.currentIndex].name = drugdic.name;
  659. this.drugdics[this.currentIndex].spec = drugdic.spec;
  660. this.drugdics[this.currentIndex].spec_unit =
  661. drugdic.spec_unit;
  662. this.drugdics[this.currentIndex].form = drugdic.form;
  663. this.drugdics[this.currentIndex].form_unit =
  664. drugdic.form_unit;
  665. this.drugdics[this.currentIndex].updated_time =
  666. drugdic.updated_time;
  667. this.currentIndex = -1;
  668. return false;
  669. }
  670. }
  671. );
  672. } else {
  673. CreateDrugDic(this.drugdicForm).then(response => {
  674. if (response.data.state == 0) {
  675. this.$message.error(response.data.msg);
  676. return false;
  677. } else {
  678. this.$notify({
  679. title: "成功",
  680. message: "添加成功",
  681. type: "success",
  682. duration: 2000
  683. });
  684. this.drugdicFormVisible = false;
  685. this.resetForm(formName);
  686. this.drugdics.unshift(response.data.data.drugdic);
  687. return false;
  688. }
  689. });
  690. }
  691. }
  692. });
  693. },
  694. submitTemplate(formName){
  695. this.$refs[formName].validate(valid => {
  696. this.templateForm.single_dose = parseFloat(this.templateForm.single_dose);
  697. this.templateForm.prescribing_number = parseFloat(this.templateForm.prescribing_number);
  698. if(isNaN(this.templateForm.single_dose)) {
  699. this.templateForm.single_dose = 0;
  700. }
  701. if(isNaN(this.templateForm.prescribing_number)) {
  702. this.templateForm.prescribing_number = 0;
  703. }
  704. if (valid) {
  705. if (this.isEdit) {
  706. UpdateAdviceTemplate(this.templateForm.id, this.templateForm).then(
  707. response => {
  708. if (response.data.state == 0) {
  709. this.$message.error(response.data.msg);
  710. return false;
  711. } else {
  712. this.$notify({
  713. title: "成功",
  714. message: "修改成功",
  715. type: "success",
  716. duration: 2000
  717. });
  718. this.templateFormVisible = false;
  719. this.resetForm(formName);
  720. var template = response.data.data.template;
  721. this.adviceTemplates[this.currentIndex].advice_name = template.advice_name;
  722. this.adviceTemplates[this.currentIndex].advice_desc = template.advice_desc;
  723. this.adviceTemplates[this.currentIndex].single_dose = template.single_dose;
  724. this.adviceTemplates[this.currentIndex].single_dose_unit = template.single_dose_unit;
  725. this.adviceTemplates[this.currentIndex].delivery_way = template.delivery_way;
  726. this.adviceTemplates[this.currentIndex].execution_frequency = template.execution_frequency;
  727. this.adviceTemplates[this.currentIndex].prescribing_number = template.prescribing_number;
  728. this.adviceTemplates[this.currentIndex].prescribing_number_unit = template.prescribing_number_unit;
  729. this.currentIndex = -1;
  730. return false;
  731. }
  732. }
  733. );
  734. } else {
  735. CreateAdviceTemplate(this.templateForm).then(response => {
  736. if (response.data.state == 0) {
  737. this.$message.error(response.data.msg);
  738. return false;
  739. } else {
  740. this.$notify({
  741. title: "成功",
  742. message: "添加成功",
  743. type: "success",
  744. duration: 2000
  745. });
  746. this.templateFormVisible = false;
  747. this.resetForm(formName);
  748. this.adviceTemplates.unshift(response.data.data.template);
  749. return false;
  750. }
  751. });
  752. }
  753. }
  754. });
  755. },
  756. handleCreateDrugWay() {
  757. this.drugwayForm = {
  758. name: "",
  759. id: 0
  760. };
  761. this.drugwayFormVisible = true;
  762. this.dialogTitle = "新增给药途径";
  763. this.isEdit = false;
  764. },
  765. handleUpdateDrugWay(row, index) {
  766. this.currentIndex = index;
  767. this.drugwayForm = {
  768. name: row.name,
  769. id: row.id
  770. };
  771. this.drugwayFormVisible = true;
  772. this.dialogTitle = "编辑给药途径";
  773. this.isEdit = true;
  774. },
  775. submitDrugWay(formName) {
  776. this.$refs[formName].validate(valid => {
  777. if (valid) {
  778. if (this.isEdit) {
  779. UpdateDrugWay(this.drugwayForm.id, this.drugwayForm).then(
  780. response => {
  781. if (response.data.state == 0) {
  782. this.$message.error(response.data.msg);
  783. return false;
  784. } else {
  785. this.$notify({
  786. title: "成功",
  787. message: "修改成功",
  788. type: "success",
  789. duration: 2000
  790. });
  791. this.drugwayFormVisible = false;
  792. this.resetForm(formName);
  793. var drugway = response.data.data.drugway;
  794. this.drugways[this.currentIndex].name = drugway.name;
  795. this.drugways[this.currentIndex].updated_time =
  796. drugway.updated_time;
  797. this.currentIndex = -1;
  798. return false;
  799. }
  800. }
  801. );
  802. } else {
  803. CreateDrugWay(this.drugwayForm).then(response => {
  804. if (response.data.state == 0) {
  805. this.$message.error(response.data.msg);
  806. return false;
  807. } else {
  808. this.$notify({
  809. title: "成功",
  810. message: "添加成功",
  811. type: "success",
  812. duration: 2000
  813. });
  814. this.drugwayFormVisible = false;
  815. this.resetForm(formName);
  816. this.drugways.unshift(response.data.data.drugway);
  817. return false;
  818. }
  819. });
  820. }
  821. }
  822. });
  823. },
  824. handleDeleteDrugWay(row, index) {
  825. this.$confirm("确认删除此给药途径?", "删除", {
  826. confirmButtonText: "确 定",
  827. cancelButtonText: "取 消",
  828. type: "warning"
  829. })
  830. .then(() => {
  831. DeleteDrugWay(row.id).then(response => {
  832. if (response.data.state == 0) {
  833. this.$message.error(response.data.msg);
  834. return false;
  835. } else {
  836. this.$notify({
  837. title: "成功",
  838. message: "给药途径已经删除",
  839. type: "success",
  840. duration: 2000
  841. });
  842. this.drugways.splice(index, 1);
  843. }
  844. });
  845. })
  846. .catch(() => {});
  847. },
  848. handleCreateEF() {
  849. this.efForm = {
  850. name: "",
  851. id: 0
  852. };
  853. this.efFormVisible = true;
  854. this.dialogTitle = "新增执行频率";
  855. this.isEdit = false;
  856. },
  857. handleUpdateEF(row, index) {
  858. this.currentIndex = index;
  859. this.efForm = {
  860. name: row.name,
  861. id: row.id
  862. };
  863. this.efFormVisible = true;
  864. this.dialogTitle = "编辑执行频率";
  865. this.isEdit = true;
  866. },
  867. submitEF(formName) {
  868. this.$refs[formName].validate(valid => {
  869. if (valid) {
  870. if (this.isEdit) {
  871. UpdateExecutionFrequency(this.efForm.id, this.efForm).then(
  872. response => {
  873. if (response.data.state == 0) {
  874. this.$message.error(response.data.msg);
  875. return false;
  876. } else {
  877. this.$notify({
  878. title: "成功",
  879. message: "修改成功",
  880. type: "success",
  881. duration: 2000
  882. });
  883. this.efFormVisible = false;
  884. this.resetForm(formName);
  885. var ef = response.data.data.ef;
  886. this.executionFrequencyOptions[this.currentIndex].name =
  887. ef.name;
  888. this.executionFrequencyOptions[
  889. this.currentIndex
  890. ].updated_time = ef.updated_time;
  891. this.currentIndex = -1;
  892. return false;
  893. }
  894. }
  895. );
  896. } else {
  897. CreateExecutionFrequency(this.efForm).then(response => {
  898. if (response.data.state == 0) {
  899. this.$message.error(response.data.msg);
  900. return false;
  901. } else {
  902. this.$notify({
  903. title: "成功",
  904. message: "添加成功",
  905. type: "success",
  906. duration: 2000
  907. });
  908. this.efFormVisible = false;
  909. this.resetForm(formName);
  910. this.executionFrequencyOptions.unshift(response.data.data.ef);
  911. return false;
  912. }
  913. });
  914. }
  915. }
  916. });
  917. },
  918. handleDeleteEF(row, index) {
  919. this.$confirm("确认删除此执行频率?", "删除", {
  920. confirmButtonText: "确 定",
  921. cancelButtonText: "取 消",
  922. type: "warning"
  923. })
  924. .then(() => {
  925. DeleteExecutionFrequency(row.id).then(response => {
  926. if (response.data.state == 0) {
  927. this.$message.error(response.data.msg);
  928. return false;
  929. } else {
  930. this.$notify({
  931. title: "成功",
  932. message: "执行频率已经删除",
  933. type: "success",
  934. duration: 2000
  935. });
  936. this.executionFrequencyOptions.splice(index, 1);
  937. }
  938. });
  939. })
  940. .catch(() => {});
  941. },
  942. getAdviceConfig() {
  943. getAdviceConfig().then(response => {
  944. if (response.data.state == 1) {
  945. this.drugways = response.data.data.drugways;
  946. this.executionFrequencyOptions = response.data.data.efs;
  947. this.drugdics = response.data.data.drugs;
  948. this.adviceTemplates = response.data.data.advice_templates;
  949. this.listLoading = false;
  950. }
  951. });
  952. }
  953. }
  954. };
  955. </script>
  956. <style scoped>
  957. .tab-container {
  958. margin: 30px;
  959. }
  960. </style>