MedicalMultRelation.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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" @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 :current-page.sync="currentPage"
  61. @current-change="currentChange"
  62. background
  63. :page-size="pageSize"
  64. :page-sizes="pageSizeArr"
  65. @size-change="handleSizeChange"
  66. :layout="pageLayout"
  67. :total="total">
  68. </el-pagination>
  69. </div>
  70. </div>
  71. </template>
  72. <script>
  73. import api from '@api/icss.js';
  74. import config from '@api/config.js';
  75. import utils from '@api/utils.js';
  76. export default {
  77. name: 'MedicalName',
  78. data: function () {
  79. return {
  80. list: [],
  81. stateSelect:[
  82. {id:'N',name:'启用中'},
  83. {id:'Y',name:'已删除'},
  84. ],
  85. isState:'',
  86. cacheData: {},
  87. currentPage: 1,
  88. pageSize: config.pageSize,
  89. pageSizeArr:config.pageSizeArr,
  90. pageLayout:config.pageLayout,
  91. total: 0,
  92. searched: false,
  93. filter: {
  94. term:'',
  95. type:''
  96. },
  97. typeList:[]
  98. }
  99. },
  100. created() {
  101. const that = this;
  102. //返回时避免参数未赋值就获取列表
  103. setTimeout(function(){
  104. that.getDataList();
  105. });
  106. this.getTypeList();
  107. },
  108. watch: {
  109. 'filter': {
  110. handler: function () {
  111. this.searched = false;
  112. },
  113. deep: true
  114. }
  115. },
  116. beforeRouteEnter(to, from, next){
  117. next(vm => {
  118. //const pm = to.param;
  119. Object.assign(vm,to.params);
  120. vm.inCurrentPage=to.params.currentPage;
  121. })
  122. },
  123. methods: {
  124. handleSizeChange(val){
  125. this.pageSize = val;
  126. this.currentPage = utils.getCurrentPage(this.currentPage, this.total, this.pageSize);
  127. this.getDataList();
  128. },
  129. addMedicalMultR(){
  130. const pam = this.searched ? {
  131. currentPage: this.currentPage,
  132. pageSize:this.pageSize,
  133. filter: this.filter
  134. } : {currentPage: this.currentPage,
  135. pageSize:this.pageSize};
  136. this.$router.push({name:'AddMedicalMultRelation',
  137. params:pam});
  138. },
  139. toEditProduct(row){
  140. const param = {
  141. conceptId: row.conceptId,
  142. relationIds: [17,17],
  143. typeIds: [3,1]
  144. };
  145. const pam = this.searched ? {
  146. currentPage: this.currentPage,
  147. pageSize:this.pageSize,
  148. filter: this.filter
  149. } : {currentPage: this.currentPage,
  150. pageSize:this.pageSize};
  151. api.relationContactDetail(param).then((res) => {
  152. const {code,data,msg} = res.data;
  153. if(code=='0'){
  154. const item = Object.assign({},row,data);
  155. this.$router.push({name:'AddMedicalMultRelation',params:Object.assign(pam, {isEdit: true, data: item})});
  156. }else{
  157. this.$message({
  158. message: msg,
  159. type: 'warning'
  160. });
  161. }
  162. })
  163. },
  164. filterDatas(){
  165. this.currentPage = 1;
  166. this.getDataList();
  167. },
  168. getDataList(isTurnPage) {
  169. const param = this.getFilterItems(isTurnPage);
  170. this.searched = true;
  171. const loading = this.$loading({
  172. lock: true,
  173. text: 'Loading',
  174. spinner: 'el-icon-loading',
  175. background: 'rgba(0, 0, 0, 0.7)'
  176. });
  177. api.multContactList(param).then((res) => {
  178. loading.close()
  179. if (res.data.code == '0') {
  180. const data = res.data.data;
  181. this.list = data.records;
  182. this.cacheData[param.current] = data.records;
  183. this.total = data.total;
  184. if(this.inCurrentPage!==undefined){
  185. this.currentPage=this.inCurrentPage;
  186. this.inCurrentPage = undefined;
  187. }
  188. }
  189. }).catch((error) => {
  190. console.log(error);
  191. });
  192. },
  193. getTypeList(){
  194. api.allKnowledgeType({'name':''}).then((res)=>{
  195. const data = res.data;
  196. if(data.code==0){
  197. this.typeList = data.data;
  198. }else{
  199. console.log(res.msg);
  200. }
  201. }).catch((error) => {
  202. console.log(error);
  203. });
  204. },
  205. /*getDetailList(id) {
  206. this.$router.push({name:'DeptInfoDetail', params:{id: id}})
  207. },*/
  208. getFilterItems(isTurnPage) {
  209. //翻页时筛选条件没点确定则清空
  210. if(isTurnPage&&!this.searched){
  211. this.clearFilter();
  212. };
  213. const param = {
  214. name: this.filter.term.trim(),
  215. current: this.inCurrentPage||this.currentPage,
  216. size: this.pageSize,
  217. type: this.filter.type,
  218. isDeleted: this.isState,
  219. relationId: 17,
  220. startTypeIds: [52]
  221. };
  222. return param;
  223. },
  224. indexMethod(index) {
  225. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  226. },
  227. currentChange(next) {
  228. this.currentPage = next;
  229. if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  230. this.list = this.cacheData[next];
  231. } else {
  232. this.getDataList(true);
  233. }
  234. },
  235. warning(msg,type){
  236. this.$message({
  237. showClose: true,
  238. message:msg,
  239. type:type||'warning'
  240. })
  241. },
  242. showConfirmDialog(msg,resolve){
  243. this.$alert(msg, '提示', {
  244. confirmButtonText: '确定',
  245. type: 'warning'
  246. }).then(() => {
  247. resolve();
  248. }).catch(() => {});
  249. },
  250. showDelDialog(item){
  251. /*const param = {
  252. term:item.term,
  253. type:item.type,
  254. id:item.id
  255. }*/
  256. const param = {
  257. conceptId:item.conceptId,
  258. // isDeleted:item.isDeleted === 'N'?'Y':'N',
  259. relationIds: [17,17],
  260. typeIds: [3,1]
  261. }
  262. let waringTxt = '是否删除该关系,可能对现有系统造成影响'
  263. this.showConfirmDialog(waringTxt,()=>{
  264. api.removeRelationContact(param).then((res)=>{
  265. if(res.data.code=='0'){
  266. if(!this.searched){
  267. //未点确认时清空搜索条件
  268. this.clearFilter();
  269. }
  270. if(this.list.length==1){
  271. //当前在最后一页且只有一条数据时,删除后跳到前一页
  272. this.currentPage = this.currentPage===1?1:this.currentPage-1;
  273. }
  274. this.warning(res.data.msg||'操作成功','success');
  275. this.getDataList();
  276. }else{
  277. this.warning(res.data.msg);
  278. }
  279. }).catch((error)=>{
  280. this.warning(error);
  281. })
  282. });
  283. },
  284. clearFilter(){
  285. this.filter={
  286. term:'',
  287. type:''
  288. };
  289. },
  290. uploadClick(){
  291. let inp = document.getElementById("upFile");
  292. inp.click();
  293. },
  294. uploadFile(e){
  295. let fileInfo = e.target.files[0];
  296. e.preventDefault();
  297. let formData = new FormData();
  298. formData.append('uploadfile', fileInfo);
  299. const header = {
  300. headers:{
  301. 'Content-Type': 'multipart/form-data'
  302. }
  303. }
  304. api.knowledgeUpload(formData,header).then((res)=>{
  305. if(res.data.code==0){
  306. this.$message({
  307. message: '上传成功',
  308. type: 'success',
  309. });
  310. this.getDataList();
  311. }else{
  312. this.$message({
  313. dangerouslyUseHTMLString: true,
  314. message:res.data.msg,
  315. type:'warning'
  316. });
  317. }
  318. })
  319. //解决上传相同文件不触发change
  320. let inp = document.getElementById("upFile");
  321. inp.value = "";
  322. },
  323. }
  324. }
  325. </script>
  326. <style lang="less" scoped>
  327. @import "../../less/admin.less";
  328. .delete{
  329. color: red;
  330. }
  331. .review{
  332. color: #22ccc8;
  333. }
  334. .el-table .cell{
  335. overflow: hidden;
  336. white-space: nowrap;
  337. }
  338. #upFile{
  339. display: none !important;
  340. }
  341. </style>