消毒机设备
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.

148 lines
3.5 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <script lang="ts" setup>
  2. // import { useSettingStore } from '@/stores/settingStore'
  3. import { FtMessage } from '@/libs/message'
  4. import { syncSendCmd } from 'apis/system'
  5. import { ElMessageBox } from 'element-plus'
  6. import { onMounted, ref } from 'vue'
  7. import HistoryDetail from './HistoryDetail.vue'
  8. // const settingStore = useSettingStore()
  9. const tableData = ref<string[]>([])
  10. const selectedRecords = ref<Setting.History[]>([])
  11. const visible = ref(false)
  12. onMounted(() => {
  13. getRecord()
  14. })
  15. const getRecord = () => {
  16. const params = {
  17. className: 'DisinfectionLogsService',
  18. fnName: 'getRecordList',
  19. params: {},
  20. }
  21. syncSendCmd(params).then((res) => {
  22. if (res.ackcode === 0 && res.rely && res.rely.length) {
  23. const list: string[] = res.rely.map((item: Setting.History) => {
  24. return {
  25. name: item,
  26. }
  27. })
  28. tableData.value = list
  29. }
  30. })
  31. }
  32. const showDetail = (historyItem: Setting.History) => {
  33. const detailParams = {
  34. className: 'DisinfectionLogsService',
  35. fnName: 'getRecord',
  36. params: {
  37. logName: historyItem.name,
  38. },
  39. }
  40. syncSendCmd(detailParams).then(() => {
  41. visible.value = true
  42. })
  43. }
  44. const onDelHistory = () => {
  45. if (selectedRecords.value.length !== 1) {
  46. FtMessage.warning('请选择一条数据进行删除')
  47. return
  48. }
  49. ElMessageBox.confirm(
  50. '请确认是否删除?',
  51. '删除',
  52. {
  53. confirmButtonText: '确认',
  54. cancelButtonText: '取消',
  55. type: 'warning',
  56. },
  57. ).then(() => {
  58. const delParams = {
  59. className: 'DisinfectionLogsService',
  60. fnName: 'deleteReport',
  61. params: {
  62. logName: selectedRecords.value.map(item => item.name)[0],
  63. },
  64. }
  65. syncSendCmd(delParams).then((res) => {
  66. if (res.ackcode === 0) {
  67. FtMessage.success('删除成功')
  68. getRecord()
  69. }
  70. })
  71. })
  72. }
  73. const onExportHistory = () => {
  74. if (!selectedRecords.value.length) {
  75. FtMessage.warning('请选择要导出的数据')
  76. return
  77. }
  78. const exportParams = {
  79. className: 'DisinfectionLogsService',
  80. fnName: 'exportRecord',
  81. params: {
  82. logNames: selectedRecords.value.map(item => item.name),
  83. },
  84. }
  85. syncSendCmd(exportParams)
  86. }
  87. const handleSelectionChange = (rows: Setting.History[]) => {
  88. selectedRecords.value = rows
  89. }
  90. const onClose = () => {
  91. visible.value = false
  92. }
  93. </script>
  94. <template>
  95. <div>
  96. <div class="history-export">
  97. <bt-button
  98. type="primary"
  99. button-text="导出"
  100. @click="onExportHistory"
  101. />
  102. <bt-button
  103. type="primary"
  104. button-text="删除"
  105. @click="onDelHistory"
  106. />
  107. </div>
  108. <div class="history-table">
  109. <el-table :data="tableData" stripe style="width: 100%" @selection-change="handleSelectionChange">
  110. <el-table-column type="selection" width="55" />
  111. <el-table-column prop="name" label="操作人" />
  112. <el-table-column prop="detail" label="操作">
  113. <template #default="scoped">
  114. <el-link type="primary" @click="showDetail(scoped.row)">
  115. 查看
  116. </el-link>
  117. </template>
  118. </el-table-column>
  119. </el-table>
  120. </div>
  121. <ft-dialog v-model="visible" title="消毒详情" width="80vw" @cancel="onClose">
  122. <div>
  123. <HistoryDetail />
  124. </div>
  125. </ft-dialog>
  126. </div>
  127. </template>
  128. <style lang="scss" scoped>
  129. .main-content{
  130. height: $main-container-height;
  131. padding: 10px;
  132. background: $gradient-color;
  133. .history-export{
  134. margin: 2vw;
  135. }
  136. .history-table{
  137. max-height: 73vh;
  138. overflow: auto;
  139. }
  140. }
  141. </style>