list.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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" allowClear 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-error"
  80. @click="handleCli(record)"
  81. v-if="record.resultType!='right'"
  82. :id="'erpMessageManagement-handle-btn'+record.id">处理</a-button>
  83. <a-button
  84. v-if="record.bizNo"
  85. size="small"
  86. type="link"
  87. class="button-info"
  88. @click="handleAgainVeriy(record)"
  89. :id="'erpMessageManagement-reOperate-btn'+record.id">重新验证</a-button>
  90. </div>
  91. </template>
  92. </s-table>
  93. </a-spin>
  94. </a-card>
  95. <!-- 新增/编辑 -->
  96. <editModal :openModal="openModal" :nowData="nowData" @close="closeModal" />
  97. </div>
  98. </template>
  99. <script>
  100. import { commonMixin } from '@/utils/mixin'
  101. // 组件
  102. import { STable, VSelect } from '@/components'
  103. import rangeDate from '@/views/common/rangeDate.vue'
  104. import editModal from './editModal.vue'
  105. // 接口
  106. import { queryCheckResultPage, datacheckReset } from '@/api/mqmsg'
  107. export default {
  108. name: 'DataValidManagementList',
  109. mixins: [commonMixin],
  110. components: { STable, VSelect, rangeDate, editModal },
  111. data () {
  112. return {
  113. spinning: false,
  114. disabled: false, // 查询、重置按钮是否可操作
  115. tableHeight: 0, // 列表高度
  116. // 查询参数
  117. queryParam: {
  118. beginDate: '', // 开始时间
  119. endDate: '', // 结束时间
  120. resultType: undefined, // 校验结果
  121. bizName: '', // 业务名称
  122. bizNo: '' // 业务编号
  123. },
  124. // 表头
  125. columns: [
  126. { title: '序号', dataIndex: 'no', width: '3.5%', align: 'center' },
  127. { title: '业务名称', dataIndex: 'bizName', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  128. { title: '校验内容', dataIndex: 'validContent', width: '14%', align: 'center', customRender: function (text) { return text || '--' } },
  129. { title: '业务编号', dataIndex: 'bizNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  130. { title: '校验结果', dataIndex: 'resultType', scopedSlots: { customRender: 'resultType' }, width: '6%', align: 'center' },
  131. { title: '错误信息', dataIndex: 'resultInfo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  132. { title: '校验时间', dataIndex: 'checkDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  133. { title: '处理状态', scopedSlots: { customRender: 'syncStatus' }, width: '6%', align: 'center' },
  134. { title: '处理描述', scopedSlots: { customRender: 'errInfo' }, width: '18%', align: 'center' },
  135. { title: '处理时间', dataIndex: 'disposeDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  136. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  137. ],
  138. // 加载数据方法 必须为 Promise 对象
  139. loadData: parameter => {
  140. this.disabled = true
  141. this.spinning = true
  142. // 获取列表数据 有分页
  143. return queryCheckResultPage(Object.assign(parameter, this.queryParam)).then(res => {
  144. let data
  145. if (res.status == 200) {
  146. data = res.data
  147. // 计算表格序号
  148. const no = (data.pageNo - 1) * data.pageSize
  149. for (var i = 0; i < data.list.length; i++) {
  150. data.list[i].no = no + i + 1
  151. data.list[i].validContent = data.list[i].nodeName + ',' + data.list[i].checkContent
  152. }
  153. this.disabled = false
  154. }
  155. this.spinning = false
  156. return data
  157. })
  158. },
  159. openModal: false, // 新增编辑调拨类型 弹框
  160. nowData: null // 当前记录数据
  161. }
  162. },
  163. methods: {
  164. // 同步时间 change
  165. dateChange (date) {
  166. this.queryParam.beginDate = date[0] ? date[0] : ''
  167. this.queryParam.endDate = date[1] ? date[1] : ''
  168. },
  169. // 重置
  170. resetSearchForm () {
  171. this.queryParam = {
  172. beginDate: '', // 开始时间
  173. endDate: '', // 结束时间
  174. resultType: undefined, // 校验结果
  175. bizName: '', // 业务名称
  176. bizNo: '' // 业务编号
  177. }
  178. this.$refs.rangeDate.resetDate()
  179. this.$refs.table.refresh(true)
  180. },
  181. // 处理
  182. handleCli (row) {
  183. this.nowData = row
  184. this.openModal = true
  185. },
  186. // 处理完成
  187. closeModal (flag) {
  188. this.nowData = null
  189. this.openModal = false
  190. if (flag) {
  191. this.$refs.table.refresh()
  192. }
  193. },
  194. // 重新验证
  195. handleAgainVeriy (row) {
  196. const _this = this
  197. this.$confirm({
  198. title: '提示',
  199. content: '重新验证会保留原数据,并重新生成一条无处理状态与处理描述的相同数据,确认重新验证吗?',
  200. centered: true,
  201. onOk () {
  202. _this.spinning = true
  203. datacheckReset({ bizName: row.bizName, bizNo: row.bizNo, nodeCode: row.nodeCode }).then(res => {
  204. if (res.status == 200) {
  205. _this.$message.success(res.message)
  206. _this.$refs.table.refresh()
  207. }
  208. _this.spinning = false
  209. })
  210. }
  211. })
  212. },
  213. // 初始化
  214. pageInit () {
  215. const _this = this
  216. this.$nextTick(() => { // 页面渲染完成后的回调
  217. _this.setTableH()
  218. })
  219. },
  220. // 计算表格高度
  221. setTableH () {
  222. const tableSearchH = this.$refs.tableSearch.offsetHeight
  223. this.tableHeight = window.innerHeight - tableSearchH - 190
  224. }
  225. },
  226. watch: {
  227. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  228. this.setTableH()
  229. }
  230. },
  231. mounted () {
  232. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  233. this.pageInit()
  234. this.resetSearchForm()
  235. }
  236. },
  237. activated () {
  238. // 如果是新页签打开,则重置当前页面
  239. if (this.$store.state.app.isNewTab) {
  240. this.pageInit()
  241. this.resetSearchForm()
  242. }
  243. // 仅刷新列表,不重置页面
  244. if (this.$store.state.app.updateList) {
  245. this.pageInit()
  246. this.$refs.table.refresh()
  247. }
  248. }
  249. }
  250. </script>
  251. <style lang="less" scope>
  252. .ant-table-tbody .ant-table-row{
  253. height:42px !important;
  254. }
  255. </style>