DiagBase.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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' ? '': 'hsaQuestion'">
  51. {{scope.row.hasQuestion == '0' ? "无问题词" : "有问题词"}}
  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="showDelDialog(scope.row.id)" class="delete" type="text" size="small">删除</el-button>
  73. </template>
  74. </el-table-column>
  75. </el-table>
  76. <div class="pagination">
  77. <el-pagination v-if="total>pageSize"
  78. :current-page.sync="currentPage"
  79. @current-change="currentChange"
  80. background
  81. :page-size="pageSize"
  82. layout="total,prev, pager, next, jumper"
  83. :total="total">
  84. </el-pagination>
  85. </div>
  86. </div>
  87. <!-- <div class="pagination">
  88. <el-pagination v-if="total>pageSize"
  89. :current-page.sync="currentPage"
  90. @current-change="currentChange"
  91. background
  92. :page-size="pageSize"
  93. layout="total,prev, pager, next, jumper"
  94. :total="total">
  95. </el-pagination>
  96. </div> -->
  97. </div>
  98. </template>
  99. <script>
  100. import api from '@api/diagBase.js';
  101. import apis from '@api/icss.js';
  102. export default {
  103. name: 'diagBase',
  104. data: function() {
  105. return {
  106. list: [],
  107. dataTypeList: [],
  108. searched: false,
  109. filter: {
  110. disName: '', //诊断名称
  111. modifier: '', //操作人
  112. hasQuestion: '', //有无问题词
  113. },
  114. currentPage: 1,
  115. pageSize: 10,
  116. total: 0,
  117. modifier: '',
  118. }
  119. },
  120. created() {
  121. this.$nextTick(()=>{
  122. this.getDropList()
  123. this.getDataList()
  124. const userLoginDTO= JSON.parse(localStorage.getItem('userLoginDTO'))
  125. this.modifier = userLoginDTO && userLoginDTO.linkman
  126. })
  127. },
  128. watch: {
  129. 'filter': {
  130. handler: function () {
  131. this.searched = false;
  132. },
  133. deep: true
  134. }
  135. },
  136. beforeRouteEnter(to, from, next) {
  137. next(vm => {
  138. Object.assign(vm, to.params);
  139. })
  140. },
  141. methods: {
  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. this.searched = true;
  152. api.diagBasePage(param).then((res) => {
  153. this.list = res.data.data.records
  154. this.total = res.data.data.total;
  155. })
  156. },
  157. filterDatas() {
  158. this.currentPage = 1;
  159. this.getDataList();
  160. },
  161. addDiagBase() {
  162. const pam = this.searched ? {
  163. currentPage: this.currentPage,
  164. filter: this.filter
  165. } : {currentPage: this.currentPage};
  166. this.$router.push({name: 'AddDiagBase', params: pam});
  167. },
  168. verifyAllData() {
  169. const loading = this.$loading({
  170. lock: true,
  171. text: 'Loading',
  172. spinner: 'el-icon-loading',
  173. background: 'rgba(0, 0, 0, 0.7)'
  174. });
  175. api.diagBaseVerifyAllData({}).then((res) => {
  176. loading.close();
  177. const {code,data,msg} = res.data;
  178. if(code === '0') {
  179. this.currentPage = 1;
  180. this.pageSize = 10,
  181. this.filter.disName = '',
  182. this.filter.modifier = '', //操作人
  183. this.filter.hasQuestion = ''
  184. this.getDataList()
  185. } else {
  186. this.warning(msg)
  187. }
  188. })
  189. },
  190. modifyDiagBase(row, type) {
  191. api.diagBaseGetDetail({id:row.id}).then((res)=>{
  192. const {code,data,msg} = res.data;
  193. if(code=='0'){
  194. const item = Object.assign({},row,data);
  195. const pam = this.searched ? {
  196. currentPage: this.currentPage,
  197. filter: this.filter
  198. } : {currentPage: this.currentPage};
  199. if(type == 'modify') {
  200. this.$router.push({
  201. name: 'AddDiagBase',
  202. params: Object.assign(pam, {isEdit: true, data: item})
  203. });
  204. } else if( type == 'copy') {
  205. this.$router.push({
  206. name: 'AddDiagBase',
  207. params: Object.assign(pam, {isCopy: true, data: item})
  208. });
  209. } else {
  210. return
  211. }
  212. }else{
  213. this.$message({
  214. message: msg,
  215. type: 'warning'
  216. });
  217. }
  218. });
  219. },
  220. currentChange(next) {
  221. this.currentPage = next;
  222. this.getDataList(true);
  223. // if (this.cacheData[next]) { //如果已请求过该页数据,则使用缓存不重复请求
  224. // this.list = this.cacheData[next];
  225. // } else {
  226. // this.getDataList();
  227. // }
  228. },
  229. getFilterItems(isTurnPage) {
  230. if(isTurnPage&&!this.searched){
  231. this.clearFilter();
  232. };
  233. const param = {
  234. current: this.currentPage,
  235. size: this.pageSize,
  236. disName: this.filter.disName,
  237. modifier: this.filter.modifier, //操作人
  238. hasQuestion: this.filter.hasQuestion, //有无问题词
  239. };
  240. return param;
  241. },
  242. indexMethod(index) {
  243. return ((this.currentPage - 1) * this.pageSize) + index + 1;
  244. },
  245. warning(msg,type){
  246. this.$message({
  247. showClose: true,
  248. message:msg,
  249. type:type||'warning'
  250. })
  251. },
  252. clearFilter(){
  253. this.filter={
  254. disName: '', //诊断名称
  255. modifier: '', //操作人
  256. hasQuestion: '', //有无问题词
  257. };
  258. },
  259. showConfirmDialog(msg,resolve){
  260. this.$alert(msg, '提示', {
  261. confirmButtonText: '确定',
  262. type: 'warning'
  263. }).then(() => {
  264. resolve();
  265. }).catch(() => {});
  266. },
  267. showDelDialog(id){
  268. this.showConfirmDialog('是否删除该诊断依据?',()=>{
  269. api.diagBaseDelete({id:id,modifier:this.modifier,isDeleted:'Y',remark:''}).then((res)=>{
  270. if(res.data.code=='0'){
  271. if(!this.searched){
  272. //未点确认时清空搜索条件
  273. this.clearFilter();
  274. }
  275. if(this.list.length==1){
  276. //当前在最后一页且只有一条数据时,删除后跳到前一页
  277. this.currentPage = this.currentPage===1?1:this.currentPage-1;
  278. }
  279. this.getDataList();
  280. this.warning(res.data.msg || '操作成功','success');
  281. }else{
  282. this.warning(res.data.msg);
  283. }
  284. }).catch((error)=>{
  285. this.warning(error);
  286. })
  287. });
  288. }
  289. }
  290. }
  291. </script>
  292. <style lang="less">
  293. @import "../../less/admin.less";
  294. .delete{
  295. color: red;
  296. }
  297. .delete:hover {
  298. color: red;
  299. }
  300. .pagination {
  301. min-width: 1010px;
  302. }
  303. .hsaQuestion {
  304. color: red;
  305. }
  306. </style>