MedicinePrompt.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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. const pam = this.searched ? {
  162. currentPage: this.currentPage,
  163. filter: this.filter
  164. } : {currentPage: this.currentPage};
  165. this.$router.push({
  166. name:'AddMedicinePrompt',
  167. params: Object.assign(pam, {data:row,isCopy:true})
  168. })
  169. },
  170. filterDatas(){
  171. this.currentPage = 1;
  172. this.getDataList();
  173. },
  174. getDataList(isTurnPage) {
  175. const param = this.getFilterItems(isTurnPage);
  176. this.searched = true;
  177. api.getConceptKnowledgeList(param).then((res) => {
  178. if (res.data.code == '0') {
  179. const data = res.data.data;
  180. this.list = data.records;
  181. this.cacheData[param.current] = data.records;
  182. this.total = data.total;
  183. }
  184. }).catch((error) => {
  185. console.log(error);
  186. });
  187. },
  188. clearFilter(){
  189. this.filter={
  190. term: '',
  191. title:'',
  192. status:'',
  193. libType:'',
  194. };
  195. },
  196. getFilterItems(isTurnPage) {
  197. //翻页时筛选条件没点确定则清空
  198. if(isTurnPage&&!this.searched){
  199. this.clearFilter();
  200. };
  201. const param = {
  202. conceptName:this.filter.term.trim(),
  203. title:this.filter.title,
  204. current: this.currentPage,
  205. size: this.pageSize,
  206. status:this.filter.status,
  207. libType:this.filter.libType,
  208. };
  209. return param;
  210. },
  211. indexMethod(index) {
  212. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  213. },
  214. currentChange(next) {
  215. this.currentPage = next;
  216. /*if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  217. this.list = this.cacheData[next];
  218. } else {*/
  219. this.getDataList(true);
  220. //}
  221. },
  222. warning(msg,type){
  223. this.$message({
  224. showClose: true,
  225. message:msg,
  226. type:type||'warning'
  227. })
  228. },
  229. showConfirmDialog(msg,resolve){
  230. this.$confirm(msg, '提示', {
  231. confirmButtonText: '确定',
  232. cancelButtonText: '取消',
  233. cancelButtonClass:'cancel',
  234. type: 'warning'
  235. }).then(() => {
  236. resolve();
  237. }).catch(() => {});
  238. },
  239. showDelDialog(row){
  240. this.showConfirmDialog('是否删除该静态知识?',()=>{
  241. api.delConceptInfo({conceptId:[row.conceptId],status:'Y'}).then((res)=>{
  242. if(res.data.code=='0'){
  243. if(!this.searched){
  244. //未点确认时清空搜索条件
  245. this.clearFilter();
  246. }
  247. this.warning(res.data.msg||'操作成功','success');
  248. this.getDataList();
  249. }else{
  250. this.warning(res.data.msg);
  251. }
  252. }).catch((error)=>{
  253. this.warning(error);
  254. })
  255. });
  256. },
  257. showReuseDialog(row){
  258. this.showConfirmDialog('是否重新启用该条数据?',()=>{
  259. api.delConceptInfo({conceptId:[row.conceptId],status:"N"}).then((res)=>{
  260. if(res.data.code=='0'){
  261. this.currentPage = 1; //恢复数据跳转到筛选条件下首页
  262. this.warning(res.data.msg||'操作成功','success');
  263. this.getDataList();
  264. }else{
  265. this.warning(res.data.msg);
  266. }
  267. }).catch((error)=>{
  268. this.warning(error);
  269. })
  270. });
  271. }
  272. }
  273. }
  274. </script>
  275. <style lang="less">
  276. @import "../../less/admin.less";
  277. .status-span{
  278. font-size: 12px;
  279. margin-right:10px;
  280. color: unset;
  281. }
  282. </style>