MedicinePrompt.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <div>
  3. <crumbs title="医学术语静态知识维护">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="标准术语归属:">
  6. <el-select size="mini" v-model="filter.libType" placeholder="标准术语归属" clearable>
  7. <el-option v-for="item in typeList" :label="item.name" :value="item.key" :key="item.key"></el-option>
  8. </el-select>
  9. </el-form-item>
  10. <el-form-item label="标准术语:">
  11. <el-input size="mini" v-model="filter.term" placeholder="标准术语" clearable></el-input>
  12. </el-form-item>
  13. <el-form-item label="状态:">
  14. <el-select size="mini" v-model="filter.status" placeholder="状态" clearable>
  15. <el-option v-for="item in stateList" :label="item.name" :value="item.id" :key="item.id"></el-option>
  16. </el-select>
  17. </el-form-item>
  18. <el-form-item>
  19. <el-button size="mini" @click="filterDatas">确认</el-button>
  20. <el-button size="mini" type="warning" style="margin:0 10px" @click="addMedicalPrompt">添加静态知识</el-button>
  21. </el-form-item>
  22. </el-form>
  23. </crumbs>
  24. <div class="contents">
  25. <el-table :data="list"
  26. border
  27. style="width: 100%">
  28. <el-table-column
  29. type="index"
  30. :index="indexMethod"
  31. label="编号"
  32. width="60">
  33. </el-table-column>
  34. <el-table-column
  35. prop="gmtModified"
  36. label="操作时间"
  37. width="180"
  38. :show-overflow-tooltip="true">
  39. </el-table-column>
  40. <el-table-column
  41. prop="libName"
  42. label="标准术语">
  43. </el-table-column>
  44. <el-table-column
  45. prop="type"
  46. label="标准术语归属"
  47. width="120">
  48. </el-table-column>
  49. <el-table-column
  50. prop="title"
  51. label="关联标题"
  52. width="240">
  53. </el-table-column>
  54. <el-table-column
  55. label="状态">
  56. <template slot-scope="scope">
  57. <span v-if="scope.row.isDeleted=='N'">启用中</span>
  58. <span v-if="scope.row.isDeleted=='Y'" class="delete">已删除</span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column
  62. prop="modifier"
  63. label="操作人"
  64. width="80">
  65. </el-table-column>
  66. <el-table-column
  67. label="操作" width="140">
  68. <template slot-scope="scope">
  69. <el-button v-if="scope.row.isDeleted=='Y'" type="text" size="small" class="is-disabled">修改</el-button>
  70. <el-button v-if="scope.row.isDeleted=='N'" type="text" size="small" @click="toEditProduct(scope.row)">修改</el-button>
  71. <span style="margin:0 3px;">|</span>
  72. <el-button v-if="scope.row.isDeleted=='Y'" type="text" size="small" class="is-disabled">复制</el-button>
  73. <el-button v-if="scope.row.isDeleted=='N'" type="text" size="small" @click="toCopyProduct(scope.row)">复制</el-button>
  74. <span style="margin:0 3px;">|</span>
  75. <el-button v-if="scope.row.isDeleted=='Y'" type="text" size="small" @click="showReuseDialog(scope.row)">恢复</el-button>
  76. <el-button v-if="scope.row.isDeleted=='N'" type="text" size="small" class="delete" @click="showDelDialog(scope.row)">删除</el-button>
  77. </template>
  78. </el-table-column>
  79. </el-table>
  80. <el-pagination v-if="total>pageSize"
  81. :current-page.sync="currentPage"
  82. @current-change="currentChange"
  83. background
  84. :page-size="pageSize"
  85. layout="total,prev, pager, next, jumper"
  86. :total="total">
  87. </el-pagination>
  88. </div>
  89. </div>
  90. </template>
  91. <script>
  92. import api from '@api/icss.js';
  93. export default {
  94. name: 'MedicinePrompt',
  95. data: function () {
  96. return {
  97. list: [],
  98. cacheData: {},
  99. currentPage: 1,
  100. pageSize: 10,
  101. total: 0,
  102. linkIn:[],
  103. pays:[],
  104. typeList:[],
  105. stateList:[
  106. {id:'N',name:'启用中'},
  107. {id:'Y',name:'已删除'},
  108. ],
  109. searched: false,
  110. filter: {
  111. term: '',
  112. title:'',
  113. status:'',
  114. libType:'',
  115. }
  116. }
  117. },
  118. created() {
  119. const that = this;
  120. //返回时避免参数未赋值就获取列表
  121. setTimeout(function(){
  122. that.getDataList();
  123. });
  124. const enums = JSON.parse(localStorage.getItem('knowledgeEnumsData'));
  125. this.typeList = enums.conceptDetailLexiconTypeEnum;
  126. },
  127. watch: {
  128. 'filter': {
  129. handler: function () {
  130. this.searched = false;
  131. },
  132. deep: true
  133. }
  134. },
  135. beforeRouteEnter(to, from, next){
  136. next(vm => {
  137. //const pm = to.param;
  138. Object.assign(vm,to.params);
  139. })
  140. },
  141. methods: {
  142. addMedicalPrompt(){
  143. const pam = this.searched ? {
  144. currentPage: this.currentPage,
  145. filter: this.filter
  146. } : {currentPage: this.currentPage};
  147. this.$router.push({name:'AddMedicinePrompt',
  148. params:pam});
  149. },
  150. toEditProduct(row){
  151. const pam = this.searched ? {
  152. currentPage: this.currentPage,
  153. filter: this.filter
  154. } : {currentPage: this.currentPage};
  155. this.$router.push({
  156. name:'AddMedicinePrompt',
  157. params: Object.assign(pam, {data:row,isEdit:true})
  158. })
  159. },
  160. toCopyProduct(row){
  161. this.$router.push({
  162. name:'AddMedicinePrompt',
  163. params: {data:row,isCopy:true}
  164. })
  165. },
  166. filterDatas(){
  167. this.currentPage = 1;
  168. this.getDataList();
  169. },
  170. getDataList(isTurnPage) {
  171. const param = this.getFilterItems(isTurnPage);
  172. this.searched = true;
  173. api.getConceptKnowledgeList(param).then((res) => {
  174. if (res.data.code == '0') {
  175. const data = res.data.data;
  176. this.list = data.records;
  177. this.cacheData[param.current] = data.records;
  178. this.total = data.total;
  179. }
  180. }).catch((error) => {
  181. console.log(error);
  182. });
  183. },
  184. clearFilter(){
  185. this.filter={
  186. term: '',
  187. title:'',
  188. status:'',
  189. libType:'',
  190. };
  191. },
  192. getFilterItems(isTurnPage) {
  193. //翻页时筛选条件没点确定则清空
  194. if(isTurnPage&&!this.searched){
  195. this.clearFilter();
  196. };
  197. const param = {
  198. conceptName:this.filter.term,
  199. title:this.filter.title,
  200. current: this.currentPage,
  201. size: this.pageSize,
  202. status:this.filter.status,
  203. libType:this.filter.libType,
  204. };
  205. return param;
  206. },
  207. indexMethod(index) {
  208. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  209. },
  210. currentChange(next) {
  211. this.currentPage = next;
  212. /*if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  213. this.list = this.cacheData[next];
  214. } else {*/
  215. this.getDataList(true);
  216. //}
  217. },
  218. warning(msg,type){
  219. this.$message({
  220. showClose: true,
  221. message:msg,
  222. type:type||'warning'
  223. })
  224. },
  225. showConfirmDialog(msg,resolve){
  226. this.$confirm(msg, '提示', {
  227. confirmButtonText: '确定',
  228. cancelButtonText: '取消',
  229. cancelButtonClass:'cancel',
  230. type: 'warning'
  231. }).then(() => {
  232. resolve();
  233. }).catch(() => {});
  234. },
  235. showDelDialog(row){
  236. this.showConfirmDialog('是否删除该静态知识?',()=>{
  237. api.delConceptInfo({conceptId:[row.conceptId],status:'Y'}).then((res)=>{
  238. if(res.data.code=='0'){
  239. if(!this.searched){
  240. //未点确认时清空搜索条件
  241. this.clearFilter();
  242. }
  243. this.warning(res.data.msg||'操作成功','success');
  244. this.getDataList();
  245. }else{
  246. this.warning(res.data.msg);
  247. }
  248. }).catch((error)=>{
  249. this.warning(error);
  250. })
  251. });
  252. },
  253. showReuseDialog(row){
  254. this.showConfirmDialog('是否重新启用该条数据?',()=>{
  255. api.delConceptInfo({conceptId:[row.conceptId],status:"N"}).then((res)=>{
  256. if(res.data.code=='0'){
  257. this.currentPage = 1; //恢复数据跳转到筛选条件下首页
  258. this.warning(res.data.msg||'操作成功','success');
  259. this.getDataList();
  260. }else{
  261. this.warning(res.data.msg);
  262. }
  263. }).catch((error)=>{
  264. this.warning(error);
  265. })
  266. });
  267. }
  268. }
  269. }
  270. </script>
  271. <style lang="less">
  272. @import "../../less/admin.less";
  273. .status-span{
  274. font-size: 12px;
  275. margin-right:10px;
  276. color: unset;
  277. }
  278. </style>