MedicinePrompt.vue 12 KB

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