DiagBase.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <template>
  2. <div>
  3. <crumbs title="诊断依据维护" :minWidth="titleWidth" class="knowledgeTitle">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="疾病名称:">
  6. <el-input size="mini" v-model="filter.conceptName" placeholder="输入疾病名称" clearable></el-input>
  7. </el-form-item>
  8. <el-form-item label="描述:">
  9. <el-input size="mini" v-model="filter.description" placeholder="输入描述" clearable></el-input>
  10. </el-form-item>
  11. <el-form-item>
  12. <el-button size="mini" @click="filterDatas">确认</el-button>
  13. </el-form-item>
  14. <el-form-item>
  15. <el-button size="mini" @click="addRule" type="warning" style="margin:0 10px">+ 新增诊断依据</el-button>
  16. <el-button size="mini" @click="update">更新数据</el-button>
  17. </el-form-item>
  18. </el-form>
  19. </crumbs>
  20. <div class="contents knowledgeContents">
  21. <el-table :data="list"
  22. border
  23. style="width: 100%">
  24. <el-table-column
  25. type="index"
  26. :index="indexMethod"
  27. label="编号"
  28. width="60">
  29. </el-table-column>
  30. <el-table-column
  31. prop="conceptName"
  32. label="疾病名称"
  33. width="160">
  34. <template slot-scope="scope">
  35. <el-tooltip v-if="scope.row.conceptName.length>8" class="item" effect="dark" :content="scope.row.conceptName" placement="top">
  36. <span>{{scope.row.conceptName.slice(0,8)+'...'}}</span>
  37. </el-tooltip>
  38. <span v-if="scope.row.conceptName.length<9">{{scope.row.conceptName}}</span>
  39. </template>
  40. </el-table-column>
  41. <el-table-column
  42. prop="description"
  43. label="描述"
  44. width="160">
  45. <template slot-scope="scope">
  46. <el-tooltip v-if="scope.row.description.length>8" class="item" effect="dark" :content="scope.row.description" placement="top">
  47. <span>{{scope.row.description.slice(0,8)+'...'}}</span>
  48. </el-tooltip>
  49. <span v-if="scope.row.description.length<9">{{scope.row.description}}</span>
  50. </template>
  51. </el-table-column>
  52. <el-table-column
  53. label="状态">
  54. <template slot-scope="scope">
  55. <span>
  56. {{scope.row.status === 0?'禁用':'启用'}}
  57. </span>
  58. </template>
  59. </el-table-column>
  60. <el-table-column
  61. prop="modifierName"
  62. label="操作人">
  63. </el-table-column>
  64. <el-table-column
  65. prop="gmtModified"
  66. label="操作时间"
  67. width="180">
  68. </el-table-column>
  69. <el-table-column
  70. label="操作"
  71. width="180" fixed="right">
  72. <template slot-scope="scope">
  73. <el-button type="text" size="small" @click="editData(scope.row)">修改</el-button>
  74. <span style="margin:0 3px;">|</span>
  75. <el-button type="text" size="small" @click="editData(scope.row,true)">复制</el-button>
  76. <span style="margin:0 3px;">|</span>
  77. <el-button type="text" size="small" :class="scope.row.status === 0?'':'unvailable'" @click="showDelDialog(scope.row)">{{scope.row.status === 0?'启用':'禁用'}}</el-button>
  78. <span style="margin:0 3px;">|</span>
  79. <el-button type="text" size="small" class="delete" @click="showDelDialog(scope.row,1)">删除</el-button>
  80. </template>
  81. </el-table-column>
  82. </el-table>
  83. <el-pagination :current-page.sync="currentPage"
  84. @current-change="currentChange"
  85. background
  86. :page-size="pageSize"
  87. :page-sizes="pageSizeArr"
  88. @size-change="handleSizeChange"
  89. :layout="pageLayout"
  90. :total="total">
  91. </el-pagination>
  92. </div>
  93. </div>
  94. </template>
  95. <script>
  96. import api from '@api/zskDiagBase.js';
  97. import config from '@api/config.js';
  98. import utils from '@api/utils.js';
  99. export default {
  100. name: 'ZskDiagBase',
  101. data: function () {
  102. return {
  103. list: [],
  104. stateSelect:[
  105. {id:1,name:'启用'},
  106. {id:0,name:'禁用'},
  107. ],
  108. ruleTypeList:[],
  109. searched: false,
  110. filter:{
  111. conceptName:'',
  112. description:'',
  113. },
  114. cacheData: {},
  115. currentPage: 1,
  116. pageSize: config.pageSize,
  117. pageSizeArr:config.pageSizeArr,
  118. pageLayout:config.pageLayout,
  119. total: 0,
  120. titleWidth:'1070px' //头部最小宽度
  121. }
  122. },
  123. created() {
  124. const param = this.$route.params;
  125. if(param.currentPage){
  126. this.inCurrentPage = param.currentPage;
  127. this.filter = param.filter
  128. }
  129. this.getTypeList();
  130. const that = this;
  131. //返回时避免参数未赋值就获取列表
  132. setTimeout(function(){
  133. that.getDataList();
  134. });
  135. },
  136. watch: {
  137. 'filter': {
  138. handler: function () {
  139. this.searched = false;
  140. },
  141. deep: true
  142. }
  143. },
  144. // beforeRouteEnter(to, from, next) {
  145. // next(vm => {
  146. // //const pm = to.param;
  147. // Object.assign(vm, to.params);
  148. // vm.inCurrentPage=to.params.currentPage;
  149. // })
  150. // },
  151. methods: {
  152. getDict(){
  153. api.zskgetDict().then((res) => {
  154. if (res.data.code == '0') {
  155. const data = res.data.data;
  156. localStorage.setItem("zskDiagDicts",`{"onlyNum":"${data['24'][0].val}","onlyTxt":"${data['25'][0].val}"}`);
  157. }
  158. }).catch((error) => {
  159. console.log(error);
  160. });
  161. },
  162. getTypeList(){
  163. this.getDict();
  164. api.getTypesList({planCode:'dis'}).then((res) => {
  165. if (res.data.code == '0') {
  166. const data = res.data.data;
  167. localStorage.setItem("zskDiagList",JSON.stringify(data));
  168. }
  169. }).catch((error) => {
  170. console.log(error);
  171. });
  172. },
  173. handleSizeChange(val){
  174. this.pageSize = val;
  175. this.currentPage = utils.getCurrentPage(this.currentPage, this.total, this.pageSize);
  176. this.getDataList();
  177. },
  178. addRule(){
  179. const pam = this.searched ? {
  180. currentPage: this.currentPage,
  181. pageSize:this.pageSize,
  182. filter: this.filter
  183. } : {currentPage: this.currentPage,
  184. pageSize:this.pageSize};
  185. this.$router.push({name: 'AddZskDiagBase', params: pam});
  186. },
  187. filterDatas(){
  188. this.currentPage = 1;
  189. this.getDataList(1);
  190. },
  191. getDataList(flag,isTurnPage) {
  192. const params = this.getFilterItems(isTurnPage);
  193. this.searched = true;
  194. const loading = this.$loading({
  195. lock: true,
  196. text: 'Loading',
  197. spinner: 'el-icon-loading',
  198. background: 'rgba(0, 0, 0, 0.7)'
  199. });
  200. api.diagBasePage(params).then((res) => {
  201. loading.close();
  202. if (res.data.code == '0') {
  203. const data = res.data.data;
  204. for(let j = 0;j < data.records.length;j++){
  205. data.records[j].condition = (data.records[j].parStatus == '1'?'启用':'禁用')
  206. }
  207. this.list = data.records;
  208. if(!flag){//搜索时不缓存
  209. this.cacheData[params.current] = data.records;
  210. }else{
  211. this.cacheData = {}
  212. }
  213. this.total = data.total;
  214. if(this.inCurrentPage!==undefined){
  215. this.currentPage=this.inCurrentPage;
  216. this.inCurrentPage = undefined;
  217. }
  218. }else{
  219. this.warning(res.data.msg||'获取列表数据失败');
  220. }
  221. }).catch((error) => {
  222. loading.close();
  223. console.log(error);
  224. });
  225. },
  226. getFilterItems(isTurnPage) {
  227. //翻页时筛选条件没点确定则清空
  228. if(isTurnPage&&!this.searched){
  229. this.clearFilter();
  230. };
  231. const param = {
  232. current: this.inCurrentPage||this.currentPage,
  233. size: this.pageSize,
  234. conceptName: this.filter.conceptName,
  235. description: this.filter.description,
  236. };
  237. return param;
  238. },
  239. indexMethod(index) {
  240. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  241. },
  242. currentChange(next) {
  243. this.currentPage = next;
  244. /*if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  245. this.list = this.cacheData[next];
  246. } else {*/
  247. this.getDataList(1,true);
  248. //}
  249. },
  250. warning(msg,type){
  251. this.$message({
  252. showClose: true,
  253. message:msg,
  254. type:type||'warning'
  255. })
  256. },
  257. showConfirmDialog(msg,resolve){
  258. this.$alert(msg, '提示', {
  259. confirmButtonText: '确定',
  260. type: 'warning'
  261. }).then(() => {
  262. resolve();
  263. }).catch(() => {});
  264. },
  265. editData(row,isCopy){
  266. const pam = this.searched ? {
  267. currentPage: this.currentPage,
  268. pageSize:this.pageSize,
  269. filter: this.filter
  270. } : {currentPage: this.currentPage,
  271. pageSize:this.pageSize};
  272. api.diagBaseGetDetail({id:row.id}).then((res) => {
  273. if (res.data.code == '0') {
  274. const data = res.data.data;
  275. this.$router.push({name:'AddZskDiagBase',params:{...pam,data:{...row,klDiagnoseTypeVO:data},copy:isCopy}});
  276. }
  277. }).catch((error) => {
  278. this.warning('获取详情失败,请重试')
  279. });
  280. },
  281. showDelDialog(row,isDelete){
  282. const params = {
  283. id:row.id
  284. };
  285. const txt=row.status===0?'重新启用':'禁用';
  286. const warningTxt = isDelete?'是否删除该诊断依据?可能对现有系统造成影响':'是否'+txt+'该诊断依据?';
  287. const handleFn = isDelete?api.diagBaseDelete:(row.status===0?api.diagBaseApply:api.diagBaseStop);
  288. this.showConfirmDialog(warningTxt,()=>{
  289. handleFn(params).then((res)=>{
  290. if(res.data.code=='0'){
  291. if(!this.searched){
  292. //未点确认时清空搜索条件
  293. this.clearFilter();
  294. }
  295. if(isDelete){ //恢复成功后跳转到筛选条件的首页
  296. this.currentPage = 1;
  297. } else {
  298. if (this.filter.status!==''&&this.list.length === 1){
  299. //有启用状态筛选条件且当前页只有最后一条数据删除时,删除成功后跳转到前一页
  300. this.currentPage = this.currentPage===1?1:this.currentPage-1;
  301. }
  302. }
  303. this.warning(res.data.msg||'操作成功','success');
  304. this.getDataList();
  305. }else{
  306. this.warning(res.data.msg);
  307. }
  308. }).catch((error)=>{
  309. this.warning(error);
  310. })
  311. });
  312. },
  313. clearFilter(){
  314. this.filter={
  315. conceptName:'',
  316. };
  317. },
  318. update(){
  319. const loading = this.$loading({
  320. lock: true,
  321. text: 'Loading',
  322. spinner: 'el-icon-loading',
  323. background: 'rgba(0, 0, 0, 0.7)'
  324. });
  325. api.updateDiagBase().then((res) => {
  326. loading.close();
  327. if (res.data.code == '0') {
  328. this.warning('更新成功','success');
  329. this.getDataList();
  330. }
  331. }).catch((error) => {
  332. loading.close();
  333. this.warning('更新失败,请重试')
  334. });
  335. },
  336. }
  337. }
  338. </script>
  339. <style lang="less" scoped>
  340. @import "../../less/admin.less";
  341. /deep/ .container.knowledgeTitle {
  342. height: 80px;
  343. min-width: 970px!important;
  344. }
  345. .demo-form-inline{
  346. margin: 30px 20px 0 0;
  347. }
  348. /deep/ .contents.knowledgeContents {
  349. padding: 104px 20px 0;
  350. }
  351. .delete{
  352. color: red;
  353. }
  354. .review{
  355. color: #22ccc8;
  356. }
  357. .el-table .cell{
  358. overflow: hidden;
  359. white-space: nowrap;
  360. }
  361. #upFile{
  362. display: none !important;
  363. }
  364. .unvailable{
  365. color: #FE7D3D;
  366. &:hover{
  367. color: #f19061;
  368. }
  369. }
  370. </style>