MedicalName.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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="输入术语"></el-input>
  7. </el-form-item>
  8. <el-form-item label="术语类型:">
  9. <el-select v-model="filter.type"
  10. clearable
  11. filterable
  12. placeholder="请选择"
  13. size="mini">
  14. <el-option
  15. v-for="item in typeList"
  16. :key="item.id"
  17. :label="item.name"
  18. :value="item.name">
  19. </el-option>
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button size="mini" @click="filterDatas">确认</el-button>
  24. <el-button size="mini" @click="uploadClick">导入</el-button>
  25. <input type="file" name="uploadfile " id="upFile" @change="uploadFile($event)" accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
  26. <router-link to="/admin/LT-YXSYKWH-TJYXSY" style="margin:0 10px">
  27. <el-button size="mini" type="warning">添加术语</el-button>
  28. </router-link>
  29. </el-form-item>
  30. </el-form>
  31. </crumbs>
  32. <div class="contents">
  33. <el-table :data="list"
  34. border
  35. style="width: 100%">
  36. <el-table-column
  37. type="index"
  38. :index="indexMethod"
  39. label="编号"
  40. width="60">
  41. </el-table-column>
  42. <el-table-column
  43. prop="gmtCreated"
  44. label="操作时间"
  45. :show-overflow-tooltip="true">
  46. </el-table-column>
  47. <el-table-column
  48. prop="name"
  49. label="医学标准术语"
  50. show-overflow-tooltip>
  51. </el-table-column>
  52. <el-table-column
  53. prop="synonymous"
  54. label="其他术语"
  55. show-overflow-tooltip>
  56. </el-table-column>
  57. <el-table-column
  58. prop="modifier"
  59. label="操作人">
  60. </el-table-column>
  61. <el-table-column
  62. label="操作" width="160">
  63. <template slot-scope="scope">
  64. <el-button type="text" size="small" @click="toEditProduct(scope.row)">修改</el-button>
  65. <span style="margin:0 3px;">|</span>
  66. <el-button type="text" size="small" class="delete" @click="showDelDialog(scope.row)">删除</el-button>
  67. </template>
  68. </el-table-column>
  69. </el-table>
  70. <el-pagination v-if="total>pageSize"
  71. :current-page.sync="currentPage"
  72. @current-change="currentChange"
  73. background
  74. :page-size="pageSize"
  75. layout="total,prev, pager, next, jumper"
  76. :total="total">
  77. </el-pagination>
  78. </div>
  79. </div>
  80. </template>
  81. <script>
  82. import api from '@api/icss.js';
  83. export default {
  84. name: 'MedicalName',
  85. data: function () {
  86. return {
  87. list: [],
  88. cacheData: {},
  89. currentPage: 1,
  90. pageSize: 10,
  91. total: 0,
  92. filter: {
  93. term:'',
  94. type:''
  95. },
  96. typeList:[]
  97. }
  98. },
  99. created() {
  100. this.getDataList();
  101. this.getTypeList();
  102. },
  103. methods: {
  104. toEditProduct(row){
  105. this.$router.push({
  106. name:'AddMedicalName',
  107. params: {info:row}
  108. })
  109. },
  110. filterDatas(){
  111. this.currentPage = 1;
  112. this.getDataList();
  113. },
  114. getDataList() {
  115. const param = this.getFilterItems();
  116. // const param = {
  117. // current: this.currentPage,
  118. // size: this.pageSize
  119. // }
  120. api.knowledgeName(param).then((res) => {
  121. if (res.data.code == '0') {
  122. const data = res.data.data;
  123. this.list = data.records;
  124. this.cacheData[param.current] = data.records;
  125. this.total = data.total;
  126. }
  127. }).catch((error) => {
  128. console.log(error);
  129. });
  130. },
  131. getTypeList(){
  132. const param = {
  133. current: this.currentPage,
  134. size: 60
  135. }
  136. api.allKnowledgeType(param).then((res)=>{
  137. const data = res.data;
  138. if(data.code==0){
  139. this.typeList = data.data.records;
  140. }else{
  141. console.log(res.msg);
  142. }
  143. }).catch((error) => {
  144. console.log(error);
  145. });
  146. },
  147. getDetailList(id) {
  148. const param = {'id': id,};
  149. // this.$router.push({name:'DeptInfoDetail', params:{id: id}})
  150. },
  151. getFilterItems() {
  152. const param = {
  153. term: this.filter.term,
  154. current: this.currentPage,
  155. size: this.pageSize,
  156. type:this.filter.type
  157. };
  158. return param;
  159. },
  160. indexMethod(index) {
  161. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  162. },
  163. currentChange(next) {
  164. this.currentPage = next;
  165. if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  166. this.list = this.cacheData[next];
  167. } else {
  168. this.getDataList();
  169. }
  170. },
  171. warning(msg,type){
  172. this.$message({
  173. showClose: true,
  174. message:msg,
  175. type:type||'warning'
  176. })
  177. },
  178. showConfirmDialog(msg,resolve){
  179. this.$alert(msg, '提示', {
  180. confirmButtonText: '确定',
  181. type: 'warning'
  182. }).then(() => {
  183. resolve();
  184. }).catch(() => {});
  185. },
  186. showDelDialog(item){
  187. const param = {
  188. term:item.term,
  189. type:item.type,
  190. id:item.id
  191. }
  192. this.showConfirmDialog('删除该标准词,可能造成相关联的医学信息、术语关系、医学静态知识等信息全部删除,是否删除?',()=>{
  193. api.deletMedicalName(param).then((res)=>{
  194. if(res.data.code=='0'){
  195. this.warning(res.data.msg||'操作成功','success');
  196. this.getDataList();
  197. }else{
  198. this.warning(res.data.msg);
  199. }
  200. }).catch((error)=>{
  201. this.warning(error);
  202. })
  203. });
  204. },
  205. uploadClick(){
  206. let inp = document.getElementById("upFile");
  207. inp.click();
  208. },
  209. uploadFile(e){
  210. let fileInfo = e.target.files[0];
  211. e.preventDefault();
  212. let formData = new FormData();
  213. formData.append('uploadfile', fileInfo);
  214. console.log(123,fileInfo,formData);
  215. const header = {
  216. headers:{
  217. 'Content-Type': 'multipart/form-data'
  218. }
  219. }
  220. api.knowledgeUpload(formData,header).then((res)=>{
  221. if(res.data.code==0){
  222. this.$message({
  223. message: '上传成功',
  224. type: 'success',
  225. });
  226. }else{
  227. this.$message({
  228. message:res.data.msg,
  229. type:'warning'
  230. });
  231. }
  232. })
  233. this.getDataList();
  234. //解决上传相同文件不触发change
  235. let inp = document.getElementById("upFile");
  236. inp.value = "";
  237. },
  238. }
  239. }
  240. </script>
  241. <style lang="less" scoped>
  242. @import "../../less/admin.less";
  243. .delete{
  244. color: red;
  245. }
  246. .el-table .cell{
  247. overflow: hidden;
  248. white-space: nowrap;
  249. }
  250. #upFile{
  251. display: none !important;
  252. }
  253. </style>