餐饮油烟智能监测与监管一体化平台
riku
2026-03-17 b1a0d701cf898c8b7812e66a808a1c91f2bae6cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<template>
  <div class="report-manage-container">
    <h2>巡查评估报告</h2>
 
    <!-- 查询条件区域 -->
    <div class="search-section">
      <el-form :inline="true" :model="searchForm" class="search-form">
        <el-form-item label="区县">
          <el-select v-model="searchForm.district" placeholder="请选择区县" style="width: 120px">
            <el-option
              v-for="district in districts"
              :key="district.value"
              :label="district.label"
              :value="district.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="searchReports">查询</el-button>
        </el-form-item>
      </el-form>
    </div>
 
    <!-- 报告表格区域 -->
    <div class="table-section">
      <el-table :data="reportList" style="width: 100%">
        <el-table-column prop="index" label="索引编号" width="80" />
        <el-table-column prop="name" label="报告名称" min-width="200" />
        <el-table-column prop="district" label="区县" width="120" />
        <el-table-column prop="reportMonth" label="报告时间" width="120" />
        <el-table-column prop="generateTime" label="生成时间" width="180" />
        <el-table-column prop="auditStatus" label="审核状态" width="100">
          <template #default="scope">
            <el-tag :type="scope.row.auditStatus === '已审核' ? 'success' : 'warning'">
              {{ scope.row.auditStatus }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="120" fixed="right">
          <template #default="scope">
            <el-button size="small" type="primary" @click="viewReport(scope.row)">
              查看报告
            </el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
 
    <!-- 报告预览抽屉 -->
    <el-drawer v-model="drawerVisible" title="报告预览" direction="rtl" size="80%">
      <!-- <div class="report-preview">
        <iframe :src="reportUrl" width="100%" height="800px" frameborder="0"></iframe>
      </div> -->
      <div ref="refWord" class="report-preview">
        <div :id="`word-preview`"></div>
      </div>
    </el-drawer>
  </div>
</template>
 
<script setup>
import { ref, onMounted } from 'vue'
import {
  exportDocx,
  prepareDocxBlob,
  preparePdf,
  previewDocx,
  downloadDocx,
  print,
} from '@/utils/doc'
 
const refWord = ref(null)
 
// 上海市区县列表
const districts = [
  { value: 'xuhui', label: '徐汇区' },
  { value: 'changning', label: '长宁区' },
  { value: 'jingan', label: '静安区' },
  { value: 'putuo', label: '普陀区' },
  { value: 'hongkou', label: '虹口区' },
  { value: 'yangpu', label: '杨浦区' },
  { value: 'minhang', label: '闵行区' },
  { value: 'baoshan', label: '宝山区' },
  { value: 'pudong', label: '浦东新区' },
  { value: 'jiading', label: '嘉定区' },
  { value: 'jinshan', label: '金山区' },
  { value: 'songjiang', label: '松江区' },
  { value: 'qingpu', label: '青浦区' },
  { value: 'fengxian', label: '奉贤区' },
  { value: 'chongming', label: '崇明区' },
]
 
// 查询表单
const searchForm = ref({
  district: 'xuhui', // 默认选中徐汇区
})
 
// 报告列表数据
const reportList = ref([])
 
// 抽屉状态
const drawerVisible = ref(false)
// 报告预览URL
const reportUrl = ref('')
 
// 模拟数据生成
const generateMockData = () => {
  const data = []
  const baseName = '餐饮监管简报'
  const areas = ['天钥桥', '徐家汇', '衡山路', '龙华']
 
  for (let i = 1; i <= 10; i++) {
    const area = areas[Math.floor(Math.random() * areas.length)]
    const month = Math.floor(Math.random() * 12) + 1
    const date = new Date()
    date.setMonth(month - 1)
 
    data.push({
      index: i,
      name: `${searchForm.value.district === 'xuhui' ? '徐汇区' : '其他区'}${baseName}(${area})-2023年${month}月`,
      district: searchForm.value.district === 'xuhui' ? '徐汇区' : '其他区',
      reportMonth: `2023年${month}月`,
      generateTime: new Date().toLocaleString('zh-CN'),
      auditStatus: Math.random() > 0.5 ? '已审核' : '未审核',
    })
  }
 
  return data
}
 
// 查询报告
const searchReports = () => {
  reportList.value = generateMockData()
}
 
// 查看报告
const viewReport = (row) => {
  // 使用模拟的报告文件
  reportUrl.value = '/徐汇区餐饮监管简报(天钥桥)-2023年8月(1).docx'
  drawerVisible.value = true
 
  prepareDocxBlob(reportUrl.value).then((blob) => {
    previewDocx(blob, document.getElementById(`word-preview`))
  })
}
 
// 页面加载时生成初始数据
onMounted(() => {
  searchReports()
})
</script>
 
<style scoped>
.report-manage-container {
  padding: 20px;
}
 
.search-section {
  margin-bottom: 20px;
  padding: 20px;
  background-color: #f5f7fa;
  border-radius: 4px;
}
 
.search-form {
  display: flex;
  align-items: center;
}
 
.table-section {
  background-color: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
 
.report-preview {
  padding: 20px;
}
</style>