MedicalName.vue 6.9 KB

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