MedicinePrompt.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. <template>
  2. <div>
  3. <crumbs title="医学术语静态知识维护">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="术语分类:" class="selectMedicine">
  6. <el-select size="mini" v-model="filter.libType" placeholder="请选择" clearable>
  7. <el-option
  8. v-for="item in typeList"
  9. :label="item.name"
  10. :value="item.orderNo"
  11. :key="item.orderNo"
  12. ></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="标准术语:">
  16. <el-input size="mini" maxlength="50" v-model="filter.term" placeholder="请输入" clearable></el-input>
  17. </el-form-item>
  18. <el-form-item label="状态:" class="selectMedicine">
  19. <el-select size="mini" v-model="filter.status" placeholder="请选择" clearable>
  20. <el-option v-for="item in stateList" :label="item.name" :value="item.id" :key="item.id"></el-option>
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item class="dododo">
  24. <el-button size="mini" @click="filterDatas">检索</el-button>
  25. <el-button
  26. size="mini"
  27. type="warning"
  28. style="margin:0 10px"
  29. @click="addMedicalPrompt"
  30. >添加静态知识</el-button>
  31. </el-form-item>
  32. </el-form>
  33. </crumbs>
  34. <div class="contents">
  35. <el-table :data="list" border style="width: 100%">
  36. <el-table-column type="index" :index="indexMethod" label="编号" width="60"></el-table-column>
  37. <el-table-column prop="gmtModified" label="操作时间" width="180" ></el-table-column>
  38. <el-table-column prop="name" label="标准术语" :show-overflow-tooltip="true"></el-table-column>
  39. <el-table-column prop="typeName" label="术语分类" width="120"></el-table-column>
  40. <el-table-column prop="title" label="内容概览" width="240" :show-overflow-tooltip="true"></el-table-column>
  41. <el-table-column label="状态" width="160">
  42. <template slot-scope="scope">
  43. <span v-if="scope.row.status===1">启用</span>
  44. <span v-if="scope.row.status===0">禁用</span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="操作" width="140">
  48. <template slot-scope="scope">
  49. <el-button v-if="scope.row.status===0" type="text" size="small" class="is-disabled">修改</el-button>
  50. <el-button
  51. v-if="scope.row.status===1"
  52. type="text"
  53. size="small"
  54. @click="toEditProduct(scope.row)"
  55. >修改</el-button>
  56. <!-- <span style="margin:0 3px;">|</span>
  57. <el-button v-if="scope.row.isDeleted=='Y' || scope.row.typeId === 82 || scope.row.typeId === 83" type="text" size="small" class="is-disabled">复制</el-button>
  58. <el-button v-if="scope.row.isDeleted=='N'&&scope.row.typeId !== 82 && scope.row.typeId !== 83" type="text" size="small" @click="toCopyProduct(scope.row)">复制</el-button>-->
  59. <span style="margin:0 3px;">|</span>
  60. <el-button
  61. v-if="scope.row.status===0"
  62. type="text"
  63. size="small"
  64. @click="showReuseDialog(scope.row)"
  65. >启用</el-button>
  66. <el-button
  67. v-if="scope.row.status===1"
  68. type="text"
  69. size="small"
  70. class="delete"
  71. @click="showDelDialog(scope.row)"
  72. >禁用</el-button>
  73. </template>
  74. </el-table-column>
  75. </el-table>
  76. <el-pagination
  77. :current-page.sync="currentPage"
  78. @current-change="currentChange"
  79. background
  80. :page-size="pageSize"
  81. class="pagepage pagepage"
  82. :page-sizes="pageSizeArr"
  83. @size-change="handleSizeChange"
  84. :layout="pageLayout"
  85. :total="total"
  86. ></el-pagination>
  87. </div>
  88. </div>
  89. </template>
  90. <script>
  91. import api from '@api/cdss.js';
  92. import config from '@api/config.js';
  93. import utils from '@api/utils.js';
  94. export default {
  95. name: 'MedicinePrompt',
  96. data: function() {
  97. return {
  98. list: [],
  99. cacheData: {},
  100. currentPage: 1,
  101. pageSize: config.pageSize,
  102. pageSizeArr: config.pageSizeArr,
  103. pageLayout: config.pageLayout,
  104. total: 0,
  105. linkIn: [],
  106. pays: [],
  107. typeList: [],
  108. stateList: [
  109. { id: 1, name: '启用' },
  110. { id: 0, name: '禁用' }
  111. ],
  112. searched: false,
  113. filter: {
  114. term: '',
  115. title: '',
  116. status: '',
  117. libType: ''
  118. }
  119. };
  120. },
  121. created() {
  122. const that = this;
  123. //返回时避免参数未赋值就获取列表
  124. setTimeout(function() {
  125. that.getDataList();
  126. that.getListDicCDSS()
  127. });
  128. // this.typeList = config.emData;
  129. // 非首页 编辑页返回 设置 this.currentPage
  130. if (Object.keys(this.$route.params).length !== 0) {
  131. this.currentPage = this.$route.params.currentPage;
  132. }
  133. },
  134. watch: {
  135. filter: {
  136. handler: function() {
  137. this.searched = false;
  138. },
  139. deep: true
  140. }
  141. },
  142. beforeRouteEnter(to, from, next) {
  143. next(vm => {
  144. //const pm = to.param;
  145. Object.assign(vm, to.params);
  146. vm.inCurrentPage = to.params.currentPage;
  147. });
  148. },
  149. methods: {
  150. getListDicCDSS() {
  151. api.getListDicCDSS().then(res => {
  152. if (res.data.code === '0') {
  153. this.typeList = res.data.data && res.data.data['10'];
  154. }
  155. });
  156. },
  157. handleSizeChange(val) {
  158. this.pageSize = val;
  159. this.currentPage = utils.getCurrentPage(
  160. this.currentPage,
  161. this.total,
  162. this.pageSize
  163. );
  164. this.getDataList();
  165. },
  166. addMedicalPrompt() {
  167. const pam = this.searched
  168. ? {
  169. currentPage: this.currentPage,
  170. pageSize: this.pageSize,
  171. filter: this.filter
  172. }
  173. : { currentPage: this.currentPage, pageSize: this.pageSize };
  174. this.$router.push({ name: 'AddMedicinePromptCDSS', params: pam });
  175. },
  176. toEditProduct(row) {
  177. const pam = this.searched
  178. ? {
  179. currentPage: this.currentPage,
  180. pageSize: this.pageSize,
  181. filter: this.filter
  182. }
  183. : { currentPage: this.currentPage, pageSize: this.pageSize };
  184. this.$router.push({
  185. name: 'AddMedicinePromptCDSS',
  186. params: Object.assign(pam, { data: row, isEdit: true })
  187. });
  188. },
  189. toCopyProduct(row) {
  190. const pam = this.searched
  191. ? {
  192. currentPage: this.currentPage,
  193. pageSize: this.pageSize,
  194. filter: this.filter
  195. }
  196. : { currentPage: this.currentPage, pageSize: this.pageSize };
  197. this.$router.push({
  198. name: 'AddMedicinePrompt',
  199. params: Object.assign(pam, { data: row, isCopy: true })
  200. });
  201. },
  202. filterDatas() {
  203. this.currentPage = 1;
  204. this.getDataList();
  205. },
  206. getDataList(isTurnPage) {
  207. const param = this.getFilterItems(isTurnPage);
  208. this.searched = true;
  209. const loading = this.$loading({
  210. lock: true,
  211. text: 'Loading',
  212. spinner: 'el-icon-loading',
  213. background: 'rgba(0, 0, 0, 0.7)'
  214. });
  215. api
  216. .getConceptKnowledgeList(param)
  217. .then(res => {
  218. loading.close();
  219. if (res.data.code == '0') {
  220. const data = res.data.data;
  221. // 类型:1-诊断、2-药品、3-检验套餐、4-检验细项、5-检查、6-手术和操作
  222. let temp = [
  223. '',
  224. '诊断',
  225. '药品',
  226. '检验套餐',
  227. '检验细项',
  228. '检查',
  229. '检查子项',
  230. '手术和操作',
  231. ];
  232. this.list = data.records = data.records.filter(item => {
  233. item.typeName = temp[item.type];
  234. return item;
  235. });
  236. this.cacheData[param.current] = data.records;
  237. this.total = data.total;
  238. if (this.inCurrentPage !== undefined) {
  239. this.currentPage = this.inCurrentPage;
  240. this.inCurrentPage = undefined;
  241. }
  242. }
  243. })
  244. .catch(error => {
  245. if (error.code === '900010001') {
  246. return false;
  247. }
  248. console.log(error);
  249. });
  250. },
  251. clearFilter() {
  252. this.filter = {
  253. term: '',
  254. title: '',
  255. status: '',
  256. libType: ''
  257. };
  258. },
  259. getFilterItems(isTurnPage) {
  260. //翻页时筛选条件没点确定则清空
  261. if (isTurnPage && !this.searched) {
  262. this.clearFilter();
  263. }
  264. const param = {
  265. name: this.filter.term.trim(),
  266. title: this.filter.title,
  267. current: this.inCurrentPage || this.currentPage,
  268. size: this.pageSize,
  269. status: this.filter.status,
  270. type: this.filter.libType
  271. };
  272. return param;
  273. },
  274. indexMethod(index) {
  275. return (this.currentPage - 1) * this.pageSize + index + 1;
  276. },
  277. currentChange(next) {
  278. this.currentPage = next;
  279. /*if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  280. this.list = this.cacheData[next];
  281. } else {*/
  282. this.getDataList(true);
  283. //}
  284. },
  285. warning(msg, type) {
  286. this.$message({
  287. showClose: true,
  288. message: msg,
  289. type: type || 'warning'
  290. });
  291. },
  292. showConfirmDialog(msg, resolve, type) {
  293. let showInfo = '启用';
  294. let btnNameClass = 'confirmBtn1';
  295. if (type === 'Del') {
  296. showInfo = '禁用';
  297. btnNameClass = 'delBtn';
  298. }
  299. this.$alert(msg, '提示', {
  300. confirmButtonText: showInfo,
  301. // cancelButtonText: '取消',
  302. // cancelButtonClass: 'cancelBtn',
  303. // confirmButtonClass: btnNameClass,
  304. type: 'warning'
  305. })
  306. .then(() => {
  307. resolve();
  308. })
  309. .catch(() => {});
  310. },
  311. showDelDialog(row) {
  312. this.showConfirmDialog(
  313. '确定禁用该静态知识?',
  314. () => {
  315. api
  316. .delConceptInfo({ id: row.id, status: 0 })
  317. .then(res => {
  318. if (res.data.code == '0') {
  319. if (!this.searched) {
  320. //未点确认时清空搜索条件
  321. this.clearFilter();
  322. }
  323. this.warning(res.data.msg || '操作成功', 'success');
  324. this.getDataList();
  325. } else {
  326. this.warning(res.data.msg);
  327. }
  328. })
  329. .catch(error => {
  330. if (error.code === '900010001') {
  331. return false;
  332. }
  333. this.warning(error);
  334. });
  335. },
  336. 'Del'
  337. );
  338. },
  339. showReuseDialog(row) {
  340. this.showConfirmDialog(
  341. '确定启用该静态知识?',
  342. () => {
  343. api
  344. .delConceptInfo({ id: row.id, status: 1 })
  345. .then(res => {
  346. if (res.data.code == '0') {
  347. this.currentPage = 1; //恢复数据跳转到筛选条件下首页
  348. this.warning(res.data.msg || '操作成功', 'success');
  349. this.getDataList();
  350. } else {
  351. this.warning(res.data.msg);
  352. }
  353. })
  354. .catch(error => {
  355. if (error.code === '900010001') {
  356. return false;
  357. }
  358. this.warning(error);
  359. });
  360. },
  361. 'Reuse'
  362. );
  363. }
  364. }
  365. };
  366. </script>
  367. <style lang="less" scoped>
  368. @import '../../less/admin.less';
  369. .status-span {
  370. font-size: 12px;
  371. margin-right: 10px;
  372. color: unset;
  373. }
  374. .dododo {
  375. margin-top: 1px !important;
  376. }
  377. .pagepage {
  378. .el-input.el-input--mini.el-input--suffix input {
  379. height: 28px;
  380. line-height: 28px;
  381. }
  382. .el-pagination__sizes {
  383. margin-right: 20px !important;
  384. }
  385. }
  386. .el-message-box {
  387. /deep/ .cancelBtn {
  388. background-color: #d7d7d7;
  389. border-color: transparent;
  390. }
  391. /deep/ .delBtn {
  392. background-color: #ff545b !important;
  393. border-color: transparent !important;
  394. }
  395. /deep/ .confirmBtn1 {
  396. position: relative;
  397. right: 0px !important;
  398. }
  399. }
  400. .selectMedicine {
  401. // /deep/ .el-input__suffix-inner {
  402. // position: relative;
  403. // top: -1px;
  404. // }
  405. /deep/ .el-icon-circle-close {
  406. position: relative;
  407. // top: -2px;
  408. left:12px;
  409. }
  410. }
  411. body {
  412. .el-tooltip__popper{
  413. max-width: 400px;
  414. }
  415. }
  416. </style>