MedicinePrompt.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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() {
  147. const param = this.getFilterItems();
  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. getFilterItems() {
  161. const param = {
  162. conceptName:this.filter.term,
  163. title:this.filter.title,
  164. current: this.currentPage,
  165. size: this.pageSize
  166. };
  167. return param;
  168. },
  169. indexMethod(index) {
  170. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  171. },
  172. currentChange(next) {
  173. this.currentPage = next;
  174. if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  175. this.list = this.cacheData[next];
  176. } else {
  177. this.getDataList();
  178. }
  179. },
  180. warning(msg,type){
  181. this.$message({
  182. showClose: true,
  183. message:msg,
  184. type:type||'warning'
  185. })
  186. },
  187. showConfirmDialog(msg,resolve){
  188. this.$confirm(msg, '提示', {
  189. confirmButtonText: '确定',
  190. cancelButtonText: '取消',
  191. cancelButtonClass:'cancel',
  192. type: 'warning'
  193. }).then(() => {
  194. resolve();
  195. }).catch(() => {});
  196. },
  197. showDelDialog(row){
  198. this.showConfirmDialog('是否删除该静态知识?',()=>{
  199. api.delConceptInfo({conceptId:[row.conceptId],status:'Y'}).then((res)=>{
  200. if(res.data.code=='0'){
  201. if(!this.searched){
  202. //未点确认时清空搜索条件
  203. this.filter={
  204. term: '',
  205. title:''
  206. };
  207. }
  208. this.warning(res.data.msg||'操作成功','success');
  209. this.getDataList();
  210. }else{
  211. this.warning(res.data.msg);
  212. }
  213. }).catch((error)=>{
  214. this.warning(error);
  215. })
  216. });
  217. },
  218. showReuseDialog(row){
  219. this.showConfirmDialog('是否重新启用该条数据?',()=>{
  220. api.delConceptInfo({conceptId:[row.conceptId],status:"N"}).then((res)=>{
  221. if(res.data.code=='0'){
  222. this.warning(res.data.msg||'操作成功','success');
  223. this.getDataList();
  224. }else{
  225. this.warning(res.data.msg);
  226. }
  227. }).catch((error)=>{
  228. this.warning(error);
  229. })
  230. });
  231. }
  232. }
  233. }
  234. </script>
  235. <style lang="less">
  236. @import "../../less/admin.less";
  237. .status-span{
  238. font-size: 12px;
  239. margin-right:10px;
  240. color: unset;
  241. }
  242. </style>