You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

431 lines
14 KiB

  1. <template>
  2. <div class="mod-config yzz">
  3. <!-- 查询表单 - rqrq -->
  4. <el-form :inline="true" label-position="top" style="margin-top: 1px; margin-left: 0px;">
  5. <!-- 三级级联选择平台 -> 模块 -> 功能页面 - rqrq -->
  6. <el-form-item label="平台">
  7. <el-select
  8. v-model="queryData.platform"
  9. placeholder="请选择平台"
  10. style="width: 100px"
  11. @change="handlePlatformChange">
  12. <el-option
  13. v-for="item in platformOptions"
  14. :key="item"
  15. :label="item"
  16. :value="item">
  17. </el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label="模块">
  21. <el-select
  22. v-model="queryData.moduleName"
  23. placeholder="请选择模块"
  24. style="width: 150px"
  25. :disabled="!queryData.platform"
  26. @change="handleModuleChange">
  27. <el-option
  28. v-for="item in moduleOptions"
  29. :key="item"
  30. :label="item"
  31. :value="item">
  32. </el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item label="功能页面">
  36. <el-select
  37. v-model="queryData.url"
  38. placeholder="请选择功能页面"
  39. style="width: 180px"
  40. :disabled="!queryData.moduleName"
  41. @change="handlePageChange">
  42. <el-option
  43. v-for="item in pageOptions"
  44. :key="item.url"
  45. :label="item.pageName"
  46. :value="item.url">
  47. </el-option>
  48. </el-select>
  49. </el-form-item>
  50. <el-form-item label="错误信息">
  51. <el-input v-model="queryData.searchErrorMessage" style="width: 180px" placeholder="错误信息关键字" clearable></el-input>
  52. </el-form-item>
  53. <el-form-item label=" ">
  54. <el-button type="primary" @click="getDataList()">查询</el-button>
  55. <el-button @click="resetQuery()">重置</el-button>
  56. </el-form-item>
  57. </el-form>
  58. <!-- 当前选中页面信息 - rqrq -->
  59. <div v-if="false" class="url-info-card">
  60. <el-card shadow="never">
  61. <div slot="header" class="clearfix">
  62. <span>
  63. <el-tag :type="currentUrlConfig.platform === 'PC' ? 'primary' : 'success'" size="small" style="margin-right: 10px">
  64. {{ currentUrlConfig.platform }}
  65. </el-tag>
  66. <i class="el-icon-document"></i>
  67. {{ currentUrlConfig.moduleName }} - {{ currentUrlConfig.pageName }}
  68. </span>
  69. </div>
  70. </el-card>
  71. </div>
  72. <!-- 数据表格 - rqrq -->
  73. <el-table
  74. :data="dataList"
  75. :height="height"
  76. border
  77. highlight-current-row
  78. v-loading="dataListLoading"
  79. style="width: 100%;">
  80. <el-table-column prop="functionButton" label="功能/按钮" width="150" header-align="center" align="center">
  81. <template slot-scope="scope">
  82. <el-tag type="primary" size="small">{{ scope.row.functionButton }}</el-tag>
  83. </template>
  84. </el-table-column>
  85. <el-table-column prop="seqNo" label="序号" width="60" header-align="center" align="center"></el-table-column>
  86. <el-table-column prop="errorMessage" label="错误信息" min-width="300" header-align="center" show-overflow-tooltip>
  87. <template slot-scope="scope">
  88. <span style="color: #F56C6C">{{ scope.row.errorMessage }}</span>
  89. </template>
  90. </el-table-column>
  91. <!-- <el-table-column prop="errorType" label="类型" width="80" header-align="center" align="center">-->
  92. <!-- <template slot-scope="scope">-->
  93. <!-- <el-tag :type="scope.row.errorType === 'BACKEND' ? 'warning' : 'info'" size="mini">-->
  94. <!-- {{ scope.row.errorType === 'BACKEND' ? '后端' : '前端' }}-->
  95. <!-- </el-tag>-->
  96. <!-- </template>-->
  97. <!-- </el-table-column>-->
  98. <el-table-column prop="defaultSolution" label="默认处理方式" min-width="250" header-align="center" show-overflow-tooltip>
  99. <template slot-scope="scope">
  100. <span style="color: #67C23A">{{ scope.row.defaultSolution || '-' }}</span>
  101. </template>
  102. </el-table-column>
  103. <el-table-column prop="userSolution" label="用户补充处理方式" min-width="250" header-align="center" show-overflow-tooltip>
  104. <template slot-scope="scope">
  105. <span style="color: #409EFF">{{ scope.row.userSolution || '-' }}</span>
  106. </template>
  107. </el-table-column>
  108. <!-- 操作列 - rqrq -->
  109. <el-table-column header-align="center" align="center" fixed="right" width="100" label="操作">
  110. <template slot-scope="scope">
  111. <a type="text" @click="editSolution(scope.row)">编辑</a>
  112. </template>
  113. </el-table-column>
  114. </el-table>
  115. <!-- 分页 - rqrq -->
  116. <el-pagination
  117. @size-change="sizeChangeHandle"
  118. @current-change="currentChangeHandle"
  119. :current-page="pageIndex"
  120. :page-sizes="[20, 50, 100, 1000]"
  121. :page-size="pageSize"
  122. :total="totalPage"
  123. layout="total, sizes, prev, pager, next, jumper">
  124. </el-pagination>
  125. <!-- 编辑处理方式弹窗 - rqrq -->
  126. <el-dialog
  127. title="编辑处理方式"
  128. :visible.sync="editDialogVisible"
  129. :close-on-click-modal="false"
  130. v-drag
  131. width="800px">
  132. <el-form :model="editForm" label-position="top" style="margin-top: 1px; margin-left: 0px;">
  133. <el-row :gutter="20">
  134. <el-col :span="12">
  135. <el-form-item label="功能/按钮">
  136. <el-input v-model="editForm.functionButton" readonly></el-input>
  137. </el-form-item>
  138. </el-col>
  139. <el-col :span="12">
  140. <el-form-item label="错误类型">
  141. <el-input v-model="editForm.errorTypeText" readonly></el-input>
  142. </el-form-item>
  143. </el-col>
  144. </el-row>
  145. <el-row>
  146. <el-col :span="24">
  147. <el-form-item label="错误信息">
  148. <el-input type="textarea" :rows="3" resize="none" v-model="editForm.errorMessage" readonly></el-input>
  149. </el-form-item>
  150. </el-col>
  151. </el-row>
  152. <el-row style="margin-top: 52px">
  153. <el-col :span="24">
  154. <el-form-item label="默认处理方式">
  155. <el-input type="textarea" :rows="4" resize="none" v-model="editForm.defaultSolution" readonly></el-input>
  156. </el-form-item>
  157. </el-col>
  158. </el-row>
  159. <el-row style="margin-top: 70px">
  160. <el-col :span="24">
  161. <el-form-item label="用户补充处理方式">
  162. <el-input type="textarea" :rows="4" resize="none" v-model="editForm.userSolution" placeholder="请输入用户补充处理方式"></el-input>
  163. </el-form-item>
  164. </el-col>
  165. </el-row>
  166. </el-form>
  167. <div slot="footer" class="dialog-footer" style="margin-top: 70px">
  168. <el-button type="primary" @click="saveSolution" :disabled="saveLoading">
  169. {{ saveLoading ? '保存中...' : '保存' }}
  170. </el-button>
  171. <el-button @click="editDialogVisible = false" :disabled="saveLoading">取消</el-button>
  172. </div>
  173. </el-dialog>
  174. </div>
  175. </template>
  176. <script>
  177. import {
  178. getPlatformList,
  179. getModuleListByPlatform,
  180. getPageListByPlatformAndModule,
  181. getErrorDetailList,
  182. updateErrorDetail
  183. } from "@/api/sys/sop.js"
  184. export default {
  185. data() {
  186. return {
  187. height: 200,
  188. dataListLoading: false,
  189. saveLoading: false,
  190. editDialogVisible: false,
  191. platformOptions: [],
  192. moduleOptions: [],
  193. pageOptions: [],
  194. currentUrlConfig: null,
  195. queryData: {
  196. platform: '',
  197. moduleName: '',
  198. url: '',
  199. searchErrorMessage: '',
  200. page: 1,
  201. limit: 20
  202. },
  203. editForm: {
  204. url: '',
  205. functionButton: '',
  206. seqNo: null,
  207. errorMessage: '',
  208. errorType: '',
  209. errorTypeText: '',
  210. defaultSolution: '',
  211. userSolution: ''
  212. },
  213. dataList: [],
  214. pageIndex: 1,
  215. pageSize: 20,
  216. totalPage: 0
  217. }
  218. },
  219. mounted() {
  220. // 使用nextTick确保DOM渲染完成后设置高度 - rqrq
  221. this.$nextTick(() => {
  222. this.height = window.innerHeight - 220
  223. })
  224. this.loadPlatformOptions()
  225. },
  226. methods: {
  227. // 加载平台列表,默认选中PC - rqrq
  228. loadPlatformOptions() {
  229. getPlatformList({}).then(({ data }) => {
  230. if (data && data.code == 0) {
  231. this.platformOptions = data.rows || []
  232. // 默认选中PC,如果没有PC则选中第一个 - rqrq
  233. if (this.platformOptions.includes('PC')) {
  234. this.queryData.platform = 'PC'
  235. } else if (this.platformOptions.length > 0) {
  236. this.queryData.platform = this.platformOptions[0]
  237. }
  238. // 加载模块列表
  239. if (this.queryData.platform) {
  240. this.loadModuleOptions(this.queryData.platform, true)
  241. }
  242. }
  243. })
  244. },
  245. // 加载模块列表 - rqrq
  246. loadModuleOptions(platform, selectFirst) {
  247. getModuleListByPlatform({ platform: platform }).then(({ data }) => {
  248. if (data && data.code == 0) {
  249. this.moduleOptions = data.rows || []
  250. // 默认选中第一个模块 - rqrq
  251. if (selectFirst && this.moduleOptions.length > 0) {
  252. this.queryData.moduleName = this.moduleOptions[0]
  253. this.loadPageOptions(platform, this.queryData.moduleName, true)
  254. }
  255. }
  256. })
  257. },
  258. // 加载功能页面列表 - rqrq
  259. loadPageOptions(platform, moduleName, selectFirst) {
  260. getPageListByPlatformAndModule({
  261. platform: platform,
  262. moduleName: moduleName
  263. }).then(({ data }) => {
  264. if (data && data.code == 0) {
  265. this.pageOptions = data.rows || []
  266. // 默认选中第一个功能页面 - rqrq
  267. if (selectFirst && this.pageOptions.length > 0) {
  268. this.queryData.url = this.pageOptions[0].url
  269. this.currentUrlConfig = this.pageOptions[0]
  270. this.getDataList()
  271. }
  272. }
  273. })
  274. },
  275. // 平台变化处理 - rqrq
  276. handlePlatformChange(platform) {
  277. this.queryData.moduleName = ''
  278. this.queryData.url = ''
  279. this.moduleOptions = []
  280. this.pageOptions = []
  281. this.currentUrlConfig = null
  282. this.dataList = []
  283. this.totalPage = 0
  284. if (platform) {
  285. // 加载模块列表并默认选中第一个 - rqrq
  286. this.loadModuleOptions(platform, true)
  287. }
  288. },
  289. // 模块变化处理 - rqrq
  290. handleModuleChange(moduleName) {
  291. this.queryData.url = ''
  292. this.pageOptions = []
  293. this.currentUrlConfig = null
  294. this.dataList = []
  295. this.totalPage = 0
  296. if (moduleName) {
  297. // 加载功能页面列表并默认选中第一个 - rqrq
  298. this.loadPageOptions(this.queryData.platform, moduleName, true)
  299. }
  300. },
  301. // 功能页面变化处理 - rqrq
  302. handlePageChange(url) {
  303. if (url) {
  304. this.currentUrlConfig = this.pageOptions.find(item => item.url === url)
  305. this.getDataList()
  306. } else {
  307. this.currentUrlConfig = null
  308. this.dataList = []
  309. this.totalPage = 0
  310. }
  311. },
  312. // 查询数据 - rqrq
  313. getDataList() {
  314. if (!this.queryData.url) {
  315. this.$message.warning('请先选择功能页面')
  316. return
  317. }
  318. this.dataListLoading = true
  319. this.queryData.page = this.pageIndex
  320. this.queryData.limit = this.pageSize
  321. getErrorDetailList(this.queryData).then(({ data }) => {
  322. this.dataListLoading = false
  323. if (data && data.code == 0) {
  324. this.dataList = data.rows || []
  325. this.totalPage = data.total || 0
  326. } else {
  327. this.dataList = []
  328. this.totalPage = 0
  329. this.$alert(data.msg || '查询失败', '错误', { confirmButtonText: '确定' })
  330. }
  331. }).catch(() => {
  332. this.dataListLoading = false
  333. this.$alert('查询失败', '错误', { confirmButtonText: '确定' })
  334. })
  335. },
  336. // 重置查询 - rqrq
  337. resetQuery() {
  338. this.queryData.searchErrorMessage = ''
  339. this.pageIndex = 1
  340. this.getDataList()
  341. },
  342. // 编辑处理方式 - rqrq
  343. editSolution(row) {
  344. this.editForm = {
  345. url: row.url,
  346. functionButton: row.functionButton,
  347. seqNo: row.seqNo,
  348. errorMessage: row.errorMessage,
  349. errorType: row.errorType,
  350. errorTypeText: row.errorType === 'BACKEND' ? '后端' : '前端',
  351. defaultSolution: row.defaultSolution || '',
  352. userSolution: row.userSolution || ''
  353. }
  354. this.editDialogVisible = true
  355. },
  356. // 保存处理方式 - rqrq
  357. saveSolution() {
  358. this.saveLoading = true
  359. const updateData = {
  360. url: this.editForm.url,
  361. functionButton: this.editForm.functionButton,
  362. seqNo: this.editForm.seqNo,
  363. defaultSolution: this.editForm.defaultSolution,
  364. userSolution: this.editForm.userSolution,
  365. errorMessage: this.editForm.errorMessage,
  366. errorType: this.editForm.errorType,
  367. isActive: 'Y'
  368. }
  369. updateErrorDetail(updateData).then(({ data }) => {
  370. if (data && data.code == 0) {
  371. this.$message.success('保存成功')
  372. this.editDialogVisible = false
  373. this.getDataList()
  374. } else {
  375. this.$alert(data.msg || '保存失败', '错误', { confirmButtonText: '确定' })
  376. }
  377. }).catch(() => {
  378. this.$alert('保存失败', '错误', { confirmButtonText: '确定' })
  379. }).finally(() => {
  380. this.saveLoading = false
  381. })
  382. },
  383. // 分页 - 每页条数变化 - rqrq
  384. sizeChangeHandle(val) {
  385. this.pageSize = val
  386. this.pageIndex = 1
  387. this.getDataList()
  388. },
  389. // 分页 - 当前页变化 - rqrq
  390. currentChangeHandle(val) {
  391. this.pageIndex = val
  392. this.getDataList()
  393. }
  394. }
  395. }
  396. </script>
  397. <style scoped>
  398. .url-info-card {
  399. margin-bottom: 10px;
  400. }
  401. .url-info-card /deep/ .el-card__header {
  402. padding: 10px 15px;
  403. background-color: #f5f7fa;
  404. }
  405. .url-info-card /deep/ .el-card__body {
  406. display: none;
  407. }
  408. </style>