MedicinePrompt.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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 v-if="scope.row.isDeleted=='Y'" type="text" size="small" class="is-disabled">复制</el-button>
  58. <el-button v-if="scope.row.isDeleted=='N'" type="text" size="small" @click="toCopyProduct(scope.row)">复制</el-button>
  59. <span style="margin:0 3px;">|</span>
  60. <el-button v-if="scope.row.isDeleted=='Y'" type="text" size="small" @click="showReuseDialog(scope.row)">恢复</el-button>
  61. <el-button v-if="scope.row.isDeleted=='N'" type="text" size="small" class="delete" @click="showDelDialog(scope.row)">删除</el-button>
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. <el-pagination v-if="total>pageSize"
  66. :current-page.sync="currentPage"
  67. @current-change="currentChange"
  68. background
  69. :page-size="pageSize"
  70. layout="total,prev, pager, next, jumper"
  71. :total="total">
  72. </el-pagination>
  73. </div>
  74. </div>
  75. </template>
  76. <script>
  77. import api from '@api/icss.js';
  78. export default {
  79. name: 'MedicinePrompt',
  80. data: function () {
  81. return {
  82. list: [],
  83. cacheData: {},
  84. currentPage: 1,
  85. pageSize: 10,
  86. total: 0,
  87. linkIn:[],
  88. pays:[],
  89. searched: false,
  90. filter: {
  91. term: '',
  92. title:''
  93. }
  94. }
  95. },
  96. created() {
  97. const that = this;
  98. //返回时避免参数未赋值就获取列表
  99. setTimeout(function(){
  100. that.getDataList();
  101. });
  102. },
  103. watch: {
  104. 'filter': {
  105. handler: function () {
  106. this.searched = false;
  107. },
  108. deep: true
  109. }
  110. },
  111. beforeRouteEnter(to, from, next){
  112. next(vm => {
  113. //const pm = to.param;
  114. Object.assign(vm,to.params);
  115. })
  116. },
  117. methods: {
  118. addMedicalPrompt(){
  119. const pam = this.searched ? {
  120. currentPage: this.currentPage,
  121. filter: this.filter
  122. } : {currentPage: this.currentPage};
  123. this.$router.push({name:'AddMedicinePrompt',
  124. params:pam});
  125. },
  126. toEditProduct(row){
  127. const pam = this.searched ? {
  128. currentPage: this.currentPage,
  129. filter: this.filter
  130. } : {currentPage: this.currentPage};
  131. this.$router.push({
  132. name:'AddMedicinePrompt',
  133. params: Object.assign(pam, {data:row,isEdit:true})
  134. })
  135. },
  136. toCopyProduct(row){
  137. this.$router.push({
  138. name:'AddMedicinePrompt',
  139. params: {data:row,isCopy:true}
  140. })
  141. },
  142. filterDatas(){
  143. this.currentPage = 1;
  144. this.getDataList();
  145. },
  146. getDataList(isTurnPage) {
  147. const param = this.getFilterItems(isTurnPage);
  148. this.searched = true;
  149. api.getConceptKnowledgeList(param).then((res) => {
  150. if (res.data.code == '0') {
  151. const data = res.data.data;
  152. this.list = data.records;
  153. this.cacheData[param.current] = data.records;
  154. this.total = data.total;
  155. }
  156. }).catch((error) => {
  157. console.log(error);
  158. });
  159. },
  160. clearFilter(){
  161. this.filter={
  162. term: '',
  163. title:''
  164. };
  165. },
  166. getFilterItems(isTurnPage) {
  167. //翻页时筛选条件没点确定则清空
  168. if(isTurnPage&&!this.searched){
  169. this.clearFilter();
  170. };
  171. const param = {
  172. conceptName:this.filter.term,
  173. title:this.filter.title,
  174. current: this.currentPage,
  175. size: this.pageSize
  176. };
  177. return param;
  178. },
  179. indexMethod(index) {
  180. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  181. },
  182. currentChange(next) {
  183. this.currentPage = next;
  184. /*if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  185. this.list = this.cacheData[next];
  186. } else {*/
  187. this.getDataList(true);
  188. //}
  189. },
  190. warning(msg,type){
  191. this.$message({
  192. showClose: true,
  193. message:msg,
  194. type:type||'warning'
  195. })
  196. },
  197. showConfirmDialog(msg,resolve){
  198. this.$confirm(msg, '提示', {
  199. confirmButtonText: '确定',
  200. cancelButtonText: '取消',
  201. cancelButtonClass:'cancel',
  202. type: 'warning'
  203. }).then(() => {
  204. resolve();
  205. }).catch(() => {});
  206. },
  207. showDelDialog(row){
  208. this.showConfirmDialog('是否删除该静态知识?',()=>{
  209. api.delConceptInfo({conceptId:[row.conceptId],status:'Y'}).then((res)=>{
  210. if(res.data.code=='0'){
  211. if(!this.searched){
  212. //未点确认时清空搜索条件
  213. this.clearFilter();
  214. }
  215. this.warning(res.data.msg||'操作成功','success');
  216. this.getDataList();
  217. }else{
  218. this.warning(res.data.msg);
  219. }
  220. }).catch((error)=>{
  221. this.warning(error);
  222. })
  223. });
  224. },
  225. showReuseDialog(row){
  226. this.showConfirmDialog('是否重新启用该条数据?',()=>{
  227. api.delConceptInfo({conceptId:[row.conceptId],status:"N"}).then((res)=>{
  228. if(res.data.code=='0'){
  229. this.currentPage = 1; //恢复数据跳转到筛选条件下首页
  230. this.warning(res.data.msg||'操作成功','success');
  231. this.getDataList();
  232. }else{
  233. this.warning(res.data.msg);
  234. }
  235. }).catch((error)=>{
  236. this.warning(error);
  237. })
  238. });
  239. }
  240. }
  241. }
  242. </script>
  243. <style lang="less">
  244. @import "../../less/admin.less";
  245. .status-span{
  246. font-size: 12px;
  247. margin-right:10px;
  248. color: unset;
  249. }
  250. </style>