MedicalMultRelation.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <template>
  2. <div>
  3. <crumbs title="医学术语多层关联维护" minWidth="995px">
  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>
  9. <el-button size="mini" @click="filterDatas">确认</el-button>
  10. <el-button size="mini" type="warning" style="margin:0 10px" @click="addMedicalMultR">添加</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="operTime"
  26. label="操作时间"
  27. :show-overflow-tooltip="true">
  28. </el-table-column>
  29. <el-table-column
  30. prop="libNameType"
  31. label="医学标准术语"
  32. show-overflow-tooltip>
  33. </el-table-column>
  34. <el-table-column
  35. prop="otherNames"
  36. label="一级关联标准术语"
  37. show-overflow-tooltip>
  38. </el-table-column>
  39. <!-- <el-table-column
  40. label="状态">
  41. <template slot-scope="scope">
  42. <span :class="scope.row.isDeleted == 'N'?'':'delete'">
  43. {{scope.row.isDeleted == 'N'?'启用中':'已删除'}}
  44. </span>
  45. </template>
  46. </el-table-column> -->
  47. <el-table-column
  48. prop="operName"
  49. label="操作人">
  50. </el-table-column>
  51. <el-table-column
  52. label="操作" width="160">
  53. <template slot-scope="scope">
  54. <el-button type="text" size="small" :disabled="scope.row.isDeleted != 'N'" @click="toEditProduct(scope.row)">修改</el-button>
  55. <span style="margin:0 3px;">|</span>
  56. <el-button type="text" size="small" :class="scope.row.isDeleted == 'N'?'delete':'review'" @click="showDelDialog(scope.row)">{{scope.row.isDeleted == 'N'?'删除':'恢复'}}</el-button>
  57. </template>
  58. </el-table-column>
  59. </el-table>
  60. <el-pagination v-if="total>pageSize"
  61. :current-page.sync="currentPage"
  62. @current-change="currentChange"
  63. background
  64. :page-size="pageSize"
  65. layout="total,prev, pager, next, jumper"
  66. :total="total">
  67. </el-pagination>
  68. </div>
  69. </div>
  70. </template>
  71. <script>
  72. import api from '@api/icss.js';
  73. export default {
  74. name: 'MedicalName',
  75. data: function () {
  76. return {
  77. list: [],
  78. stateSelect:[
  79. {id:'N',name:'启用中'},
  80. {id:'Y',name:'已删除'},
  81. ],
  82. isState:'',
  83. cacheData: {},
  84. currentPage: 1,
  85. pageSize: 10,
  86. total: 0,
  87. searched: false,
  88. filter: {
  89. term:'',
  90. type:''
  91. },
  92. typeList:[]
  93. }
  94. },
  95. created() {
  96. const that = this;
  97. //返回时避免参数未赋值就获取列表
  98. setTimeout(function(){
  99. that.getDataList();
  100. });
  101. this.getTypeList();
  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. addMedicalMultR(){
  119. const pam = this.searched ? {
  120. currentPage: this.currentPage,
  121. filter: this.filter
  122. } : {currentPage: this.currentPage};
  123. this.$router.push({name:'AddMedicalMultRelation',
  124. params:pam});
  125. },
  126. toEditProduct(row){
  127. const param = {
  128. conceptId: row.conceptId,
  129. relationId: 17
  130. };
  131. const pam = this.searched ? {
  132. currentPage: this.currentPage,
  133. filter: this.filter
  134. } : {currentPage: this.currentPage};
  135. api.relationContactDetail(param).then((res) => {
  136. const {code,data,msg} = res.data;
  137. if(code=='0'){
  138. const item = Object.assign({},row,data);
  139. this.$router.push({name:'AddMedicalMultRelation',params:Object.assign(pam, {isEdit: true, data: item})});
  140. }else{
  141. this.$message({
  142. message: msg,
  143. type: 'warning'
  144. });
  145. }
  146. })
  147. },
  148. filterDatas(){
  149. this.currentPage = 1;
  150. this.getDataList();
  151. },
  152. getDataList(isTurnPage) {
  153. const param = this.getFilterItems(isTurnPage);
  154. this.searched = true;
  155. api.multContactList(param).then((res) => {
  156. if (res.data.code == '0') {
  157. const data = res.data.data;
  158. this.list = data.records;
  159. this.cacheData[param.current] = data.records;
  160. this.total = data.total;
  161. }
  162. }).catch((error) => {
  163. console.log(error);
  164. });
  165. },
  166. getTypeList(){
  167. api.allKnowledgeType({'name':''}).then((res)=>{
  168. const data = res.data;
  169. if(data.code==0){
  170. this.typeList = data.data;
  171. }else{
  172. console.log(res.msg);
  173. }
  174. }).catch((error) => {
  175. console.log(error);
  176. });
  177. },
  178. /*getDetailList(id) {
  179. this.$router.push({name:'DeptInfoDetail', params:{id: id}})
  180. },*/
  181. getFilterItems(isTurnPage) {
  182. //翻页时筛选条件没点确定则清空
  183. if(isTurnPage&&!this.searched){
  184. this.clearFilter();
  185. };
  186. const param = {
  187. name: this.filter.term,
  188. current: this.currentPage,
  189. size: this.pageSize,
  190. type:this.filter.type,
  191. isDeleted:this.isState
  192. };
  193. return param;
  194. },
  195. indexMethod(index) {
  196. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  197. },
  198. currentChange(next) {
  199. this.currentPage = next;
  200. if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  201. this.list = this.cacheData[next];
  202. } else {
  203. this.getDataList(true);
  204. }
  205. },
  206. warning(msg,type){
  207. this.$message({
  208. showClose: true,
  209. message:msg,
  210. type:type||'warning'
  211. })
  212. },
  213. showConfirmDialog(msg,resolve){
  214. this.$alert(msg, '提示', {
  215. confirmButtonText: '确定',
  216. type: 'warning'
  217. }).then(() => {
  218. resolve();
  219. }).catch(() => {});
  220. },
  221. showDelDialog(item){
  222. /*const param = {
  223. term:item.term,
  224. type:item.type,
  225. id:item.id
  226. }*/
  227. const param = {
  228. conceptId:item.conceptId,
  229. isDeleted:item.isDeleted === 'N'?'Y':'N',
  230. relationId: 17
  231. }
  232. let waringTxt = '是否删除该关系,可能对现有系统造成影响'
  233. this.showConfirmDialog(waringTxt,()=>{
  234. api.removeRelationContact(param).then((res)=>{
  235. if(res.data.code=='0'){
  236. if(!this.searched){
  237. //未点确认时清空搜索条件
  238. this.clearFilter();
  239. }
  240. if(this.list.length==1){
  241. //当前在最后一页且只有一条数据时,删除后跳到前一页
  242. this.currentPage = this.currentPage===1?1:this.currentPage-1;
  243. }
  244. this.warning(res.data.msg||'操作成功','success');
  245. this.getDataList();
  246. }else{
  247. this.warning(res.data.msg);
  248. }
  249. }).catch((error)=>{
  250. this.warning(error);
  251. })
  252. });
  253. },
  254. clearFilter(){
  255. this.filter={
  256. term:'',
  257. type:''
  258. };
  259. },
  260. uploadClick(){
  261. let inp = document.getElementById("upFile");
  262. inp.click();
  263. },
  264. uploadFile(e){
  265. let fileInfo = e.target.files[0];
  266. e.preventDefault();
  267. let formData = new FormData();
  268. formData.append('uploadfile', fileInfo);
  269. const header = {
  270. headers:{
  271. 'Content-Type': 'multipart/form-data'
  272. }
  273. }
  274. api.knowledgeUpload(formData,header).then((res)=>{
  275. if(res.data.code==0){
  276. this.$message({
  277. message: '上传成功',
  278. type: 'success',
  279. });
  280. this.getDataList();
  281. }else{
  282. this.$message({
  283. dangerouslyUseHTMLString: true,
  284. message:res.data.msg,
  285. type:'warning'
  286. });
  287. }
  288. })
  289. //解决上传相同文件不触发change
  290. let inp = document.getElementById("upFile");
  291. inp.value = "";
  292. },
  293. }
  294. }
  295. </script>
  296. <style lang="less" scoped>
  297. @import "../../less/admin.less";
  298. .delete{
  299. color: red;
  300. }
  301. .review{
  302. color: #22ccc8;
  303. }
  304. .el-table .cell{
  305. overflow: hidden;
  306. white-space: nowrap;
  307. }
  308. #upFile{
  309. display: none !important;
  310. }
  311. </style>