DiagBase.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <div>
  3. <crumbs title="诊断依据数据维护" style="min-width: 980px">
  4. <el-form :inline="true" class="demo-form-inline">
  5. <el-form-item label="诊断名称:">
  6. <el-input size="mini" v-model="filter.disName" placeholder="诊断名称" clearable></el-input>
  7. </el-form-item>
  8. <el-form-item label="操作人:">
  9. <el-input size="mini" v-model="filter.modifier" placeholder="操作人" clearable></el-input>
  10. </el-form-item>
  11. <el-form-item label="校验数据:">
  12. <el-select size="mini" v-model="filter.hasQuestion" placeholder="标签类型" clearable>
  13. <el-option v-for="item in dataTypeList" :label="item.name" :value="item.key" :key="item.key"></el-option>
  14. </el-select>
  15. </el-form-item>
  16. <el-form-item>
  17. <el-button size="mini" @click="filterDatas">确认</el-button>
  18. <el-button size="mini" @click="verifyAllData" >校验全部数据</el-button>
  19. <el-button size="mini" type="warning" @click="addDiagBase">添加诊断依据</el-button>
  20. </el-form-item>
  21. </el-form>
  22. </crumbs>
  23. <div class="contents">
  24. <el-table
  25. :data="list"
  26. border
  27. style="width: 100%">
  28. <el-table-column
  29. :resizable = "false"
  30. type="index"
  31. :index = 'indexMethod'
  32. label="编号"
  33. width="60">
  34. </el-table-column>
  35. <el-table-column
  36. :resizable = "false"
  37. prop="gmtModified"
  38. label="操作时间"
  39. width="180">
  40. </el-table-column>
  41. <el-table-column
  42. :resizable = "false"
  43. prop="disName"
  44. label="诊断名称">
  45. </el-table-column>
  46. <el-table-column
  47. :resizable = "false"
  48. label="校验数据">
  49. <template slot-scope="scope" >
  50. <span :class="scope.row.hasQuestion == '0' ? '': scope.row.hasQuestion == '1'? 'hsaQuestion' :scope.row.hasQuestion == '2'?'hasTemp':''">
  51. {{scope.row.hasQuestion == "0" ? "无问题词" : scope.row.hasQuestion == "1"? "有问题词":scope.row.hasQuestion == "2"?"暂存数据":""}}
  52. </span>
  53. </template>
  54. </el-table-column>
  55. <el-table-column
  56. :resizable = "false"
  57. prop="neoUpdate"
  58. label="最后更新图谱时间">
  59. </el-table-column>
  60. <el-table-column
  61. :resizable = "false"
  62. prop="modifier"
  63. label="操作人">
  64. </el-table-column>
  65. <el-table-column
  66. :resizable = "false"
  67. prop="operate"
  68. label="操作">
  69. <template slot-scope="scope">
  70. <el-button @click="modifyDiagBase(scope.row, 'modify')" type="text" size="small">修改</el-button>
  71. <span style="margin:0 3px;">|</span>
  72. <el-button @click="modifyDiagBase(scope.row,'copy')" type="text" size="small">复制</el-button>
  73. <span style="margin:0 3px;">|</span>
  74. <el-button @click="showDelDialog(scope.row.id)" class="delete" type="text" size="small">删除</el-button>
  75. </template>
  76. </el-table-column>
  77. </el-table>
  78. <div class="pagination">
  79. <el-pagination :current-page.sync="currentPage"
  80. @current-change="currentChange"
  81. background
  82. :page-size="pageSize"
  83. :page-sizes="pageSizeArr"
  84. @size-change="handleSizeChange"
  85. :layout="pageLayout"
  86. :total="total">
  87. </el-pagination>
  88. </div>
  89. </div>
  90. </div>
  91. </template>
  92. <script>
  93. import api from '@api/diagBase.js';
  94. import apis from '@api/icss.js';
  95. import config from '@api/config.js';
  96. export default {
  97. name: 'diagBase',
  98. data: function() {
  99. return {
  100. list: [],
  101. dataTypeList: [],
  102. searched: false,
  103. filter: {
  104. disName: '', //诊断名称
  105. modifier: '', //操作人
  106. hasQuestion: '', //有无问题词
  107. },
  108. currentPage: 1,
  109. pageSize: config.pageSize,
  110. pageSizeArr:config.pageSizeArr,
  111. pageLayout:config.pageLayout,
  112. total: 0,
  113. modifier: '',
  114. }
  115. },
  116. created() {
  117. this.$nextTick(()=>{
  118. this.getDropList()
  119. this.getDataList()
  120. const userLoginDTO= JSON.parse(localStorage.getItem('userLoginDTO'))
  121. this.modifier = userLoginDTO && userLoginDTO.linkman
  122. })
  123. },
  124. watch: {
  125. 'filter': {
  126. handler: function () {
  127. this.searched = false;
  128. },
  129. deep: true
  130. }
  131. },
  132. beforeRouteEnter(to, from, next) {
  133. next(vm => {
  134. Object.assign(vm, to.params);
  135. })
  136. },
  137. methods: {
  138. handleSizeChange(val){
  139. this.pageSize = val;
  140. this.getDataList();
  141. },
  142. getDropList() {
  143. return apis.getKnowledgeEnums().then((res) =>{
  144. if(res.data.code === '0') {
  145. this.dataTypeList = res.data.data.hasQuestionEnum
  146. }
  147. })
  148. },
  149. getDataList(isTurnPage) {
  150. const param = this.getFilterItems(isTurnPage);
  151. setTimeout(()=>{
  152. this.searched = true;
  153. },0)
  154. api.diagBasePage(param).then((res) => {
  155. this.list = res.data.data.records
  156. this.total = res.data.data.total;
  157. })
  158. },
  159. filterDatas() {
  160. this.currentPage = 1;
  161. this.getDataList();
  162. },
  163. addDiagBase() {
  164. const pam = this.searched ? {
  165. currentPage: this.currentPage,
  166. pageSize:this.pageSize,
  167. filter: this.filter
  168. } : {currentPage: this.currentPage,
  169. pageSize:this.pageSize};
  170. this.$router.push({name: 'AddDiagBase', params: pam});
  171. },
  172. verifyAllData() {
  173. const loading = this.$loading({
  174. lock: true,
  175. text: 'Loading',
  176. spinner: 'el-icon-loading',
  177. background: 'rgba(0, 0, 0, 0.7)'
  178. });
  179. api.diagBaseVerifyAllData({}).then((res) => {
  180. loading.close();
  181. const {code,data,msg} = res.data;
  182. if(code === '0') {
  183. this.warning('校验完成','success')
  184. this.currentPage = 1;
  185. this.pageSize = 10,
  186. this.filter.disName = '',
  187. this.filter.modifier = '', //操作人
  188. this.filter.hasQuestion = ''
  189. this.getDataList()
  190. } else {
  191. this.warning(msg)
  192. }
  193. })
  194. },
  195. modifyDiagBase(row, type) {
  196. api.diagBaseGetDetail({id:row.id}).then((res)=>{
  197. const {code,data,msg} = res.data;
  198. if(code=='0'){
  199. const item = Object.assign({},row,data);
  200. const pam = this.searched ? {
  201. currentPage: this.currentPage,
  202. pageSize:this.pageSize,
  203. filter: this.filter
  204. } : {currentPage: this.currentPage,
  205. pageSize:this.pageSize};
  206. if(type == 'modify') {
  207. this.$router.push({
  208. name: 'AddDiagBase',
  209. params: Object.assign(pam, {isEdit: true, data: item})
  210. });
  211. } else if( type == 'copy') {
  212. this.$router.push({
  213. name: 'AddDiagBase',
  214. params: Object.assign(pam, {isCopy: true, data: item})
  215. });
  216. } else {
  217. return
  218. }
  219. }else{
  220. this.$message({
  221. message: msg,
  222. type: 'warning'
  223. });
  224. }
  225. });
  226. },
  227. currentChange(next) {
  228. this.currentPage = next;
  229. this.getDataList(true);
  230. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  231. // this.list = this.cacheData[next];
  232. // } else {
  233. // this.getDataList();
  234. // }
  235. },
  236. getFilterItems(isTurnPage) {
  237. if(isTurnPage&&!this.searched){
  238. this.clearFilter();
  239. };
  240. const param = {
  241. current: this.currentPage,
  242. size: this.pageSize,
  243. disName: this.filter.disName.trim(),
  244. modifier: this.filter.modifier, //操作人
  245. hasQuestion: this.filter.hasQuestion, //有无问题词
  246. };
  247. return param;
  248. },
  249. indexMethod(index) {
  250. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  251. },
  252. warning(msg,type){
  253. this.$message({
  254. showClose: true,
  255. message:msg,
  256. type:type||'warning'
  257. })
  258. },
  259. clearFilter(){
  260. this.filter={
  261. disName: '', //诊断名称
  262. modifier: '', //操作人
  263. hasQuestion: '', //有无问题词
  264. };
  265. },
  266. showConfirmDialog(msg,resolve){
  267. this.$alert(msg, '提示', {
  268. confirmButtonText: '确定',
  269. type: 'warning'
  270. }).then(() => {
  271. resolve();
  272. }).catch(() => {});
  273. },
  274. showDelDialog(id){
  275. this.showConfirmDialog('是否删除该诊断依据?',()=>{
  276. api.diagBaseDelete({id:id,modifier:this.modifier,isDeleted:'Y',remark:''}).then((res)=>{
  277. if(res.data.code=='0'){
  278. if(!this.searched){
  279. //未点确认时清空搜索条件
  280. this.clearFilter();
  281. }
  282. if(this.list.length==1){
  283. //当前在最后一页且只有一条数据时,删除后跳到前一页
  284. this.currentPage = this.currentPage===1?1:this.currentPage-1;
  285. }
  286. this.getDataList();
  287. this.warning(res.data.msg || '操作成功','success');
  288. }else{
  289. this.warning(res.data.msg);
  290. }
  291. }).catch((error)=>{
  292. this.warning(error);
  293. })
  294. });
  295. }
  296. }
  297. }
  298. </script>
  299. <style lang="less">
  300. @import "../../less/admin.less";
  301. .el-form--inline .el-form-item__content {
  302. vertical-align: text-bottom;
  303. }
  304. .delete{
  305. color: red;
  306. }
  307. .delete:hover {
  308. color: red;
  309. }
  310. .pagination {
  311. min-width: 1010px;
  312. }
  313. .hsaQuestion {
  314. color: red;
  315. }
  316. .hasTemp{
  317. color: blue;
  318. }
  319. </style>