MedicinePrompt.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  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/icss.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.clearFilter();
  126. that.getDataList();
  127. that.getDicList();
  128. });
  129. // this.typeList = config.emData;
  130. // 非首页 编辑页返回 设置 this.currentPage
  131. if (Object.keys(this.$route.params).length !== 0) {
  132. this.currentPage = this.$route.params.currentPage;
  133. }
  134. },
  135. watch: {
  136. filter: {
  137. handler: function() {
  138. this.searched = false;
  139. },
  140. deep: true
  141. }
  142. },
  143. beforeRouteEnter(to, from, next) {
  144. next(vm => {
  145. //const pm = to.param;
  146. Object.assign(vm, to.params);
  147. vm.inCurrentPage = to.params.currentPage;
  148. });
  149. },
  150. methods: {
  151. // 获取字典类型
  152. getDicList() {
  153. api.getDicList().then(res => {
  154. // console.log(res, '字典类型');
  155. if (res.data.code === '0') {
  156. this.typeList = res.data.data && res.data.data['10'];
  157. // console.log(this.typeList,'this.typeList');
  158. }
  159. });
  160. },
  161. handleSizeChange(val) {
  162. this.pageSize = val;
  163. this.currentPage = utils.getCurrentPage(
  164. this.currentPage,
  165. this.total,
  166. this.pageSize
  167. );
  168. this.getDataList();
  169. },
  170. addMedicalPrompt() {
  171. const pam = this.searched
  172. ? {
  173. currentPage: this.currentPage,
  174. pageSize: this.pageSize,
  175. filter: this.filter
  176. }
  177. : { currentPage: this.currentPage, pageSize: this.pageSize };
  178. this.$router.push({ name: 'AddMedicinePrompt', params: pam });
  179. },
  180. toEditProduct(row) {
  181. const pam = this.searched
  182. ? {
  183. currentPage: this.currentPage,
  184. pageSize: this.pageSize,
  185. filter: this.filter
  186. }
  187. : { currentPage: this.currentPage, pageSize: this.pageSize };
  188. this.$router.push({
  189. name: 'AddMedicinePrompt',
  190. params: Object.assign(pam, { data: row, isEdit: true })
  191. });
  192. },
  193. toCopyProduct(row) {
  194. const pam = this.searched
  195. ? {
  196. currentPage: this.currentPage,
  197. pageSize: this.pageSize,
  198. filter: this.filter
  199. }
  200. : { currentPage: this.currentPage, pageSize: this.pageSize };
  201. this.$router.push({
  202. name: 'AddMedicinePrompt',
  203. params: Object.assign(pam, { data: row, isCopy: true })
  204. });
  205. },
  206. filterDatas() {
  207. this.currentPage = 1;
  208. this.getDataList();
  209. },
  210. getDataList(isTurnPage) {
  211. const param = this.getFilterItems(isTurnPage);
  212. this.searched = true;
  213. const loading = this.$loading({
  214. lock: true,
  215. text: 'Loading',
  216. spinner: 'el-icon-loading',
  217. background: 'rgba(0, 0, 0, 0.7)'
  218. });
  219. api
  220. .getConceptKnowledgeList(param)
  221. .then(res => {
  222. loading.close();
  223. if (res.data.code == '0') {
  224. const data = res.data.data;
  225. // 类型:1-诊断、2-药品、3-检验套餐、4-检验细项、5-检查、6-手术和操作
  226. let temp = [
  227. '',
  228. '诊断',
  229. '药品',
  230. '检验套餐',
  231. '检验细项',
  232. '检查',
  233. '检查子项',
  234. '手术和操作',
  235. ];
  236. this.list = data.records = data.records.filter(item => {
  237. item.typeName = temp[item.type];
  238. return item;
  239. });
  240. this.cacheData[param.current] = data.records;
  241. this.total = data.total;
  242. if (this.inCurrentPage !== undefined) {
  243. this.currentPage = this.inCurrentPage;
  244. this.inCurrentPage = undefined;
  245. }
  246. }
  247. })
  248. .catch(error => {
  249. if (error.code === '900010001') {
  250. return false;
  251. }
  252. console.log(error);
  253. });
  254. },
  255. clearFilter() {
  256. this.filter = {
  257. term: '',
  258. title: '',
  259. status: '',
  260. libType: ''
  261. };
  262. },
  263. getFilterItems(isTurnPage) {
  264. //翻页时筛选条件没点确定则清空
  265. if (isTurnPage && !this.searched) {
  266. this.clearFilter();
  267. }
  268. const param = {
  269. name: this.filter.term.trim(),
  270. title: this.filter.title,
  271. current: this.inCurrentPage || this.currentPage,
  272. size: this.pageSize,
  273. status: this.filter.status,
  274. type: this.filter.libType
  275. };
  276. return param;
  277. },
  278. indexMethod(index) {
  279. return (this.currentPage - 1) * this.pageSize + index + 1;
  280. },
  281. currentChange(next) {
  282. this.currentPage = next;
  283. /*if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  284. this.list = this.cacheData[next];
  285. } else {*/
  286. this.getDataList(true);
  287. //}
  288. },
  289. warning(msg, type) {
  290. this.$message({
  291. showClose: true,
  292. message: msg,
  293. type: type || 'warning'
  294. });
  295. },
  296. showConfirmDialog(msg, resolve, type) {
  297. let showInfo = '启用';
  298. let btnNameClass = 'confirmBtn1';
  299. if (type === 'Del') {
  300. showInfo = '禁用';
  301. btnNameClass = 'delBtn';
  302. }
  303. this.$confirm(msg, '提示', {
  304. confirmButtonText: showInfo,
  305. cancelButtonText: '取消',
  306. cancelButtonClass: 'cancelBtn',
  307. confirmButtonClass: btnNameClass,
  308. type: 'warning'
  309. })
  310. .then(() => {
  311. resolve();
  312. })
  313. .catch(() => {});
  314. },
  315. showDelDialog(row) {
  316. this.showConfirmDialog(
  317. '确定禁用该静态知识?',
  318. () => {
  319. api
  320. .delConceptInfo({ id: row.id, status: 0 })
  321. .then(res => {
  322. if (res.data.code == '0') {
  323. if (!this.searched) {
  324. //未点确认时清空搜索条件
  325. this.clearFilter();
  326. }
  327. this.warning(res.data.msg || '操作成功', 'success');
  328. this.getDataList();
  329. } else {
  330. this.warning(res.data.msg);
  331. }
  332. })
  333. .catch(error => {
  334. if (error.code === '900010001') {
  335. return false;
  336. }
  337. this.warning(error);
  338. });
  339. },
  340. 'Del'
  341. );
  342. },
  343. showReuseDialog(row) {
  344. this.showConfirmDialog(
  345. '确定启用该静态知识?',
  346. () => {
  347. api
  348. .delConceptInfo({ id: row.id, status: 1 })
  349. .then(res => {
  350. if (res.data.code == '0') {
  351. this.currentPage = 1; //恢复数据跳转到筛选条件下首页
  352. this.warning(res.data.msg || '操作成功', 'success');
  353. this.getDataList();
  354. } else {
  355. this.warning(res.data.msg);
  356. }
  357. })
  358. .catch(error => {
  359. if (error.code === '900010001') {
  360. return false;
  361. }
  362. this.warning(error);
  363. });
  364. },
  365. 'Reuse'
  366. );
  367. }
  368. }
  369. };
  370. </script>
  371. <style lang="less">
  372. @import '../../less/admin.less';
  373. .status-span {
  374. font-size: 12px;
  375. margin-right: 10px;
  376. color: unset;
  377. }
  378. .dododo {
  379. margin-top: 1px !important;
  380. }
  381. .pagepage {
  382. .el-input.el-input--mini.el-input--suffix input {
  383. height: 28px;
  384. line-height: 28px;
  385. }
  386. .el-pagination__sizes {
  387. margin-right: 20px !important;
  388. }
  389. }
  390. .el-message-box {
  391. /deep/ .cancelBtn {
  392. background-color: #d7d7d7;
  393. border-color: transparent;
  394. }
  395. /deep/ .delBtn {
  396. background-color: #ff545b !important;
  397. border-color: transparent !important;
  398. }
  399. /deep/ .confirmBtn1 {
  400. position: relative;
  401. right: 0px !important;
  402. }
  403. }
  404. .selectMedicine {
  405. /deep/ .el-input__suffix-inner {
  406. position: relative;
  407. top: -1px;
  408. }
  409. /deep/ .el-icon-circle-close {
  410. position: relative;
  411. top: -2px;
  412. }
  413. }
  414. body {
  415. .el-tooltip__popper {
  416. max-width: 400px;
  417. }
  418. }
  419. </style>