华西海圻ELN前端工程
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.

182 lines
6.5 KiB

  1. <template>
  2. <div class="system-log-list">
  3. <div class="ytbd-search">
  4. <el-form :model="searchForm" ref="searchForm" :inline="true" label-width="80px">
  5. <el-form-item :label="$t('page.system.systemLog.czr')" prop="qmrMc">
  6. <el-input v-model="searchForm.qmrMc" :placeholder="$t('form.placeholderInput')" clearable
  7. style="width: 150px" />
  8. </el-form-item>
  9. <el-form-item :label="$t('page.system.systemLog.czsj')">
  10. <el-date-picker v-model="daterange" clearable type="daterange" range-separator="-" :start-placeholder="$t('page.business.study.study.startDate')"
  11. :end-placeholder="$t('page.business.study.study.endDate')" value-format="yyyy-MM-dd" @change="search" style="width: 200px" />
  12. </el-form-item>
  13. <el-form-item prop="jcmc" :label="$t('page.system.systemLog.czlx')">
  14. <el-select
  15. v-model="searchForm.jcmc"
  16. :placeholder="$t('form.placeholderSelect')"
  17. clearable
  18. style="width: 150px"
  19. @change="search"
  20. >
  21. <el-option :label="$t('page.business.study.study.sqgd')" :value="$t('page.business.study.study.sqgd')" />
  22. <el-option :label="$t('page.business.study.study.tygd')" :value="$t('page.business.study.study.tygd')" />
  23. <el-option :label="$t('page.business.study.study.jjgd')" :value="$t('page.business.study.study.jjgd')" />
  24. <el-option :label="$t('page.business.study.study.sqjd')" :value="$t('page.business.study.study.sqjd')" />
  25. <el-option :label="$t('page.business.study.study.tyjd')" :value="$t('page.business.study.study.tyjd')" />
  26. <el-option :label="$t('page.business.study.study.jjjd')" :value="$t('page.business.study.study.jjjd')" />
  27. <el-option :label="$t('page.business.study.study.sqjy')" :value="$t('page.business.study.study.sqjy')" />
  28. <el-option :label="$t('page.business.study.study.tyjy')" :value="$t('page.business.study.study.tyjy')" />
  29. <el-option :label="$t('page.business.study.study.jjjy')" :value="$t('page.business.study.study.jjjy')" />
  30. <el-option :label="$t('page.business.study.study.qrgh')" :value="$t('page.business.study.study.qrgh')" />
  31. </el-select>
  32. </el-form-item>
  33. <el-form-item :label="$t('page.system.systemLog.czxq')" prop="jcnr">
  34. <el-input v-model="searchForm.jcnr" :placeholder="$t('form.placeholderInput')" clearable
  35. style="width: 200px" />
  36. </el-form-item>
  37. <el-form-item>
  38. <el-button type="primary" icon="el-icon-search" @click="search">{{ $t('page.business.study.study.search') }}</el-button>
  39. <el-button icon="el-icon-refresh" @click="reset">{{ $t('form.reset') }}</el-button>
  40. </el-form-item>
  41. </el-form>
  42. </div>
  43. <div class="ytbd-content">
  44. <el-table v-loading="loading" :data="list">
  45. <el-table-column :label="$t('page.system.systemLog.czr')" prop="qmrMc" width="200" />
  46. <el-table-column :label="$t('page.system.systemLog.czlx')" :prop="$i18n.locale === 'zh_CN'?'jcmc':'jcmcEn'" width="200" />
  47. <el-table-column :label="$t('page.system.systemLog.czxq')">
  48. <template slot-scope="scope">
  49. <span>{{initNr(scope.row)}}</span>
  50. </template>
  51. </el-table-column>
  52. <el-table-column :label="$t('page.business.archive.czsj')" align="center" prop="createTime" width="200" />
  53. </el-table>
  54. <pagination v-show="total > 0" :total="total" :page.sync="searchForm.pageNum" :limit.sync="searchForm.pageSize"
  55. @pagination="getList" />
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. import { systemLog_list } from "@/api/business/systemLog/systemLog"
  61. export default {
  62. name: 'Czrz',
  63. props: {
  64. },
  65. computed: {
  66. },
  67. data() {
  68. return {
  69. daterange:[],
  70. searchForm: {
  71. pageNum: 1,
  72. pageSize: 10,
  73. qmrMc: '',
  74. jcmc: '',
  75. jcnr: '',
  76. startDate:'',
  77. endDate:'',
  78. },
  79. loading: false,
  80. total: 0,
  81. list: [],
  82. }
  83. },
  84. created() {
  85. this.getList()
  86. },
  87. methods: {
  88. search() {
  89. this.searchForm.pageNum = 1
  90. this.getList()
  91. },
  92. reset() {
  93. this.searchForm.qmrMc = ''
  94. this.searchForm.jcmc = ''
  95. this.searchForm.jcnr = ''
  96. this.searchForm.startDate = ''
  97. this.searchForm.endDate = ''
  98. this.daterange = []
  99. this.search()
  100. },
  101. getList() {
  102. this.loading = true
  103. this.searchForm.startDate = this.daterange && this.daterange.length > 0 ? this.daterange[0] : ''
  104. this.searchForm.endDate = this.daterange && this.daterange.length > 1 ? this.daterange[1] : ''
  105. systemLog_list(this.searchForm).then(response => {
  106. this.list = response.rows
  107. this.total = response.total
  108. this.loading = false
  109. })
  110. },
  111. initNr(row){
  112. if(this.$i18n.locale === 'zh_CN'){
  113. if(this.isJSON(row.jcnr)){
  114. let nr = ''
  115. let list = JSON.parse(row.jcnr)
  116. _.forEach(list,(o,index)=>{
  117. nr+=o.name+':'+o.value+(index===list.length-1?'':';')
  118. })
  119. return (row.name?('【'+row.name+'】'): '')+nr+(row.remark?(';'+this.$t('form.remark')+":"+row.remark):'')
  120. }else{
  121. return (row.name?('【'+row.name+'】'): '')+(row.jcnr || '')+(row.remark?(';'+this.$t('form.remark')+":"+row.remark):'')
  122. }
  123. }else{
  124. if(this.isJSON(row.jcnrEn)){
  125. let nr = ''
  126. let list = JSON.parse(row.jcnrEn)
  127. _.forEach(list,(o,index)=>{
  128. nr+=o.name+':'+o.value+(index===list.length-1?'':';')
  129. })
  130. return (row.nameEn?('【'+row.nameEn+'】'): '')+nr+(row.remark?(';'+this.$t('form.remark')+":"+row.remark):'')
  131. }else{
  132. return (row.nameEn?('【'+row.nameEn+'】'): '')+(row.jcnrEn || '')+(row.remark?(';'+this.$t('form.remark')+":"+row.remark):'')
  133. }
  134. }
  135. },
  136. isJSON(str) {
  137. if (typeof str !== 'string') {
  138. return false;
  139. }
  140. try {
  141. const result = JSON.parse(str);
  142. // 可选:确保解析后是对象或数组,而不是简单类型
  143. const type = Object.prototype.toString.call(result);
  144. return type === '[object Object]' || type === '[object Array]';
  145. } catch (e) {
  146. return false;
  147. }
  148. }
  149. }
  150. }
  151. </script>
  152. <style lang="scss" scoped>
  153. .system-log-list {
  154. .ytbd-search {
  155. background: #fff;
  156. padding: 20px;
  157. padding-bottom: 0;
  158. margin-bottom: 10px;
  159. .right-btn {
  160. text-align: right
  161. }
  162. }
  163. .ytbd-content {
  164. padding: 20px;
  165. background: #fff;
  166. .add-box {
  167. margin-bottom: 10px;
  168. }
  169. }
  170. }
  171. </style>