MedicinePrompt.vue 7.8 KB

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