DiagBase.vue 16 KB

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