list.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="erpMessageManagement-wrap searchBoxNormal">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline" id="erpMessageManagement-form" @keyup.enter.native="$refs.table.refresh(true)">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="校验时间">
  10. <rangeDate ref="rangeDate" id="erpMessageManagement-rangeDate" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="4" :sm="24">
  14. <a-form-item label="校验结果">
  15. <a-select clearable placeholder="请选择校验结果" id="erpMessageManagement-checkResult" v-model="queryParam.resultType">
  16. <a-select-option value="right" id="erpMessageManagement-checkResult-success">
  17. 成功
  18. </a-select-option>
  19. <a-select-option value="error" id="erpMessageManagement-checkResult-fail">
  20. 失败
  21. </a-select-option>
  22. </a-select>
  23. </a-form-item>
  24. </a-col>
  25. <a-col :md="4" :sm="24">
  26. <a-form-item label="业务编号">
  27. <a-input id="erpMessageManagement-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入业务编号"/>
  28. </a-form-item>
  29. </a-col>
  30. <a-col :md="4" :sm="24">
  31. <a-form-item label="业务名称">
  32. <a-input id="erpMessageManagement-bizName" v-model.trim="queryParam.bizName" allowClear placeholder="请输入业务名称"/>
  33. </a-form-item>
  34. </a-col>
  35. <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
  36. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="erpMessageManagement-refresh">查询</a-button>
  37. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="erpMessageManagement-reset">重置</a-button>
  38. </a-col>
  39. </a-row>
  40. </a-form>
  41. </div>
  42. </a-card>
  43. <!-- 列表 -->
  44. <a-card size="small" :bordered="false">
  45. <a-spin :spinning="spinning" tip="Loading...">
  46. <s-table
  47. class="sTable fixPagination"
  48. id="erpMessageManagement-table"
  49. ref="table"
  50. :style="{ height: tableHeight+70+'px' }"
  51. size="small"
  52. :rowKey="(record) => record.id"
  53. :columns="columns"
  54. :data="loadData"
  55. :scroll="{ y: tableHeight }"
  56. :defaultLoadData="false"
  57. bordered>
  58. <!-- 处理状态 -->
  59. <template slot="syncStatus" slot-scope="text, record">
  60. <span v-if="record.disposeType&&record.disposeType=='NO_DISPOSE'">未处理</span>
  61. <span v-else-if="record.disposeType&&record.disposeType=='RUN_DISPOSE'">处理中</span>
  62. <span v-else-if="record.disposeType&&record.disposeType=='YES_DISPOSE'">已处理</span>
  63. <span v-else>--</span>
  64. </template>
  65. <!-- 错误信息 -->
  66. <template slot="errInfo" slot-scope="text, record">
  67. {{ record.disposeDesc }}
  68. </template>
  69. <!-- 验证结果 -->
  70. <template slot="resultType" slot-scope="text, record">
  71. <span :style="{color:text=='right'?'green':'red'}">{{ text=='right'?'成功':'失败' }}</span>
  72. </template>
  73. <!-- 操作 -->
  74. <template slot="action" slot-scope="text, record">
  75. <div>
  76. <a-button
  77. size="small"
  78. type="link"
  79. class="button-info"
  80. @click="handleCli(record)"
  81. :id="'erpMessageManagement-handle-btn'+record.id">处理</a-button>
  82. <a-button
  83. v-if="record.bizNo"
  84. size="small"
  85. type="link"
  86. class="button-info"
  87. @click="handleAgainVeriy(record)"
  88. :id="'erpMessageManagement-reOperate-btn'+record.id">重新验证</a-button>
  89. </div>
  90. </template>
  91. </s-table>
  92. </a-spin>
  93. </a-card>
  94. <!-- 新增/编辑 -->
  95. <editModal :openModal="openModal" :nowData="nowData" @close="closeModal" />
  96. </div>
  97. </template>
  98. <script>
  99. import { commonMixin } from '@/utils/mixin'
  100. // 组件
  101. import { STable, VSelect } from '@/components'
  102. import rangeDate from '@/views/common/rangeDate.vue'
  103. import editModal from './editModal.vue'
  104. // 接口
  105. import { queryCheckResultPage, datacheckReset } from '@/api/mqmsg'
  106. export default {
  107. name: 'DataValidManagementList',
  108. mixins: [commonMixin],
  109. components: { STable, VSelect, rangeDate, editModal },
  110. data () {
  111. return {
  112. spinning: false,
  113. disabled: false, // 查询、重置按钮是否可操作
  114. tableHeight: 0, // 列表高度
  115. // 查询参数
  116. queryParam: {
  117. beginDate: '', // 开始时间
  118. endDate: '', // 结束时间
  119. resultType: undefined, // 校验结果
  120. bizName: '', // 业务名称
  121. bizNo: '' // 业务编号
  122. },
  123. // 表头
  124. columns: [
  125. { title: '序号', dataIndex: 'no', width: '3.5%', align: 'center' },
  126. { title: '业务名称', dataIndex: 'bizName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  127. { title: '校验内容', dataIndex: 'validContent', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  128. { title: '业务编号', dataIndex: 'bizNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  129. { title: '校验结果', dataIndex: 'resultType', scopedSlots: { customRender: 'resultType' }, width: '6%', align: 'center' },
  130. { title: '错误信息', dataIndex: 'resultInfo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  131. { title: '校验时间', dataIndex: 'checkDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  132. { title: '处理状态', scopedSlots: { customRender: 'syncStatus' }, width: '6%', align: 'center' },
  133. { title: '处理描述', scopedSlots: { customRender: 'errInfo' }, width: '18%', align: 'center' },
  134. { title: '处理时间', dataIndex: 'disposeDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  135. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  136. ],
  137. // 加载数据方法 必须为 Promise 对象
  138. loadData: parameter => {
  139. this.disabled = true
  140. this.spinning = true
  141. // 获取列表数据 有分页
  142. return queryCheckResultPage(Object.assign(parameter, this.queryParam)).then(res => {
  143. let data
  144. if (res.status == 200) {
  145. data = res.data
  146. // 计算表格序号
  147. const no = (data.pageNo - 1) * data.pageSize
  148. for (var i = 0; i < data.list.length; i++) {
  149. data.list[i].no = no + i + 1
  150. data.list[i].validContent = data.list[i].nodeName + ',' + data.list[i].checkContent
  151. }
  152. this.disabled = false
  153. }
  154. this.spinning = false
  155. return data
  156. })
  157. },
  158. openModal: false, // 新增编辑调拨类型 弹框
  159. nowData: null // 当前记录数据
  160. }
  161. },
  162. methods: {
  163. // 同步时间 change
  164. dateChange (date) {
  165. this.queryParam.beginDate = date[0] ? date[0] : ''
  166. this.queryParam.endDate = date[1] ? date[1] : ''
  167. },
  168. // 重置
  169. resetSearchForm () {
  170. this.queryParam = {
  171. beginDate: '', // 开始时间
  172. endDate: '', // 结束时间
  173. resultType: undefined, // 校验结果
  174. bizName: '', // 业务名称
  175. bizNo: '' // 业务编号
  176. }
  177. this.$refs.rangeDate.resetDate()
  178. this.$refs.table.refresh(true)
  179. },
  180. // 处理
  181. handleCli (row) {
  182. this.nowData = row
  183. this.openModal = true
  184. },
  185. // 处理完成
  186. closeModal (flag) {
  187. this.nowData = null
  188. this.openModal = false
  189. if (flag) {
  190. this.$refs.table.refresh()
  191. }
  192. },
  193. // 重新验证
  194. handleAgainVeriy (row) {
  195. const _this = this
  196. this.$confirm({
  197. title: '提示',
  198. content: '重新验证会保留原数据,并重新生成一条无处理状态与处理描述的相同数据,确认重新验证吗?',
  199. centered: true,
  200. onOk () {
  201. _this.spinning = true
  202. datacheckReset({ bizName: row.bizName, bizNo: row.bizNo, nodeCode: row.nodeCode }).then(res => {
  203. if (res.status == 200) {
  204. _this.$message.success(res.message)
  205. _this.$refs.table.refresh()
  206. }
  207. _this.spinning = false
  208. })
  209. }
  210. })
  211. },
  212. // 初始化
  213. pageInit () {
  214. const _this = this
  215. this.$nextTick(() => { // 页面渲染完成后的回调
  216. _this.setTableH()
  217. })
  218. },
  219. // 计算表格高度
  220. setTableH () {
  221. const tableSearchH = this.$refs.tableSearch.offsetHeight
  222. this.tableHeight = window.innerHeight - tableSearchH - 190
  223. }
  224. },
  225. watch: {
  226. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  227. this.setTableH()
  228. }
  229. },
  230. mounted () {
  231. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  232. this.pageInit()
  233. this.resetSearchForm()
  234. }
  235. },
  236. activated () {
  237. // 如果是新页签打开,则重置当前页面
  238. if (this.$store.state.app.isNewTab) {
  239. this.pageInit()
  240. this.resetSearchForm()
  241. }
  242. // 仅刷新列表,不重置页面
  243. if (this.$store.state.app.updateList) {
  244. this.pageInit()
  245. this.$refs.table.refresh()
  246. }
  247. }
  248. }
  249. </script>
  250. <style lang="less" scope>
  251. .ant-table-tbody .ant-table-row{
  252. height:42px !important;
  253. }
  254. </style>