MedicalMultRelation.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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. relationId: 17,
  193. startTypeIds: [52]
  194. };
  195. return param;
  196. },
  197. indexMethod(index) {
  198. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  199. },
  200. currentChange(next) {
  201. this.currentPage = next;
  202. if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  203. this.list = this.cacheData[next];
  204. } else {
  205. this.getDataList(true);
  206. }
  207. },
  208. warning(msg,type){
  209. this.$message({
  210. showClose: true,
  211. message:msg,
  212. type:type||'warning'
  213. })
  214. },
  215. showConfirmDialog(msg,resolve){
  216. this.$alert(msg, '提示', {
  217. confirmButtonText: '确定',
  218. type: 'warning'
  219. }).then(() => {
  220. resolve();
  221. }).catch(() => {});
  222. },
  223. showDelDialog(item){
  224. /*const param = {
  225. term:item.term,
  226. type:item.type,
  227. id:item.id
  228. }*/
  229. const param = {
  230. conceptId:item.conceptId,
  231. isDeleted:item.isDeleted === 'N'?'Y':'N',
  232. relationId: 17
  233. }
  234. let waringTxt = '是否删除该关系,可能对现有系统造成影响'
  235. this.showConfirmDialog(waringTxt,()=>{
  236. api.removeRelationContact(param).then((res)=>{
  237. if(res.data.code=='0'){
  238. if(!this.searched){
  239. //未点确认时清空搜索条件
  240. this.clearFilter();
  241. }
  242. if(this.list.length==1){
  243. //当前在最后一页且只有一条数据时,删除后跳到前一页
  244. this.currentPage = this.currentPage===1?1:this.currentPage-1;
  245. }
  246. this.warning(res.data.msg||'操作成功','success');
  247. this.getDataList();
  248. }else{
  249. this.warning(res.data.msg);
  250. }
  251. }).catch((error)=>{
  252. this.warning(error);
  253. })
  254. });
  255. },
  256. clearFilter(){
  257. this.filter={
  258. term:'',
  259. type:''
  260. };
  261. },
  262. uploadClick(){
  263. let inp = document.getElementById("upFile");
  264. inp.click();
  265. },
  266. uploadFile(e){
  267. let fileInfo = e.target.files[0];
  268. e.preventDefault();
  269. let formData = new FormData();
  270. formData.append('uploadfile', fileInfo);
  271. const header = {
  272. headers:{
  273. 'Content-Type': 'multipart/form-data'
  274. }
  275. }
  276. api.knowledgeUpload(formData,header).then((res)=>{
  277. if(res.data.code==0){
  278. this.$message({
  279. message: '上传成功',
  280. type: 'success',
  281. });
  282. this.getDataList();
  283. }else{
  284. this.$message({
  285. dangerouslyUseHTMLString: true,
  286. message:res.data.msg,
  287. type:'warning'
  288. });
  289. }
  290. })
  291. //解决上传相同文件不触发change
  292. let inp = document.getElementById("upFile");
  293. inp.value = "";
  294. },
  295. }
  296. }
  297. </script>
  298. <style lang="less" scoped>
  299. @import "../../less/admin.less";
  300. .delete{
  301. color: red;
  302. }
  303. .review{
  304. color: #22ccc8;
  305. }
  306. .el-table .cell{
  307. overflow: hidden;
  308. white-space: nowrap;
  309. }
  310. #upFile{
  311. display: none !important;
  312. }
  313. </style>