index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
  4. <el-form-item label="大队" prop="brigadeId">
  5. <el-select v-model="queryParams.brigadeId" placeholder="请选择大队" clearable style="width: 200px">
  6. <el-option v-for="item in brigadeOptions" :key="item.value" :label="item.label" :value="item.value" />
  7. </el-select>
  8. </el-form-item>
  9. <el-form-item label="回查日期" prop="reviewDate">
  10. <el-date-picker clearable v-model="dateRange" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
  11. start-placeholder="开始日期" end-placeholder="结束日期" style="width: 300px">
  12. </el-date-picker>
  13. </el-form-item>
  14. <el-form-item label="被回查人" prop="reviewedUserId">
  15. <el-select v-model="queryParams.reviewedUserId" placeholder="请选择被回查人" clearable style="width: 200px">
  16. <el-option v-for="item in personOptions" :key="item.value" :label="item.label" :value="item.value" />
  17. </el-select>
  18. </el-form-item>
  19. <el-form-item label="分管班组长" prop="teamLeaderId">
  20. <el-select v-model="queryParams.teamLeaderId" placeholder="请选择分管班组长" clearable style="width: 200px">
  21. <el-option v-for="item in teamLeaderOptions" :key="item.value" :label="item.label" :value="item.value" />
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="分管主管" prop="supervisorId">
  25. <el-select v-model="queryParams.supervisorId" placeholder="请选择分管主管" clearable style="width: 200px">
  26. <el-option v-for="item in supervisorOptions" :key="item.value" :label="item.label" :value="item.value" />
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item label="判别类型" prop="discriminationType">
  30. <el-select v-model="queryParams.discriminationType" placeholder="请选择判别类型" clearable style="width: 200px">
  31. <el-option v-for="item in discrimination_type" :key="item.value" :label="item.label" :value="item.value" />
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item>
  35. <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
  36. <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  37. </el-form-item>
  38. </el-form>
  39. <el-row :gutter="10" class="mb8">
  40. <el-col :span="1.5">
  41. <el-button type="primary" plain icon="Plus" @click="handleAdd"
  42. v-hasPermi="['missedInspection:missedInspection:add']">新增</el-button>
  43. </el-col>
  44. <el-col :span="1.5">
  45. <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
  46. v-hasPermi="['missedInspection:missedInspection:remove']">删除</el-button>
  47. </el-col>
  48. <el-col :span="1.5">
  49. <el-button type="warning" plain icon="Download" @click="handleExport"
  50. v-hasPermi="['missedInspection:missedInspection:export']">导出</el-button>
  51. </el-col>
  52. <el-col :span="1.5">
  53. <el-button type="info" plain icon="Upload" @click="handleImport"
  54. v-hasPermi="['missedInspection:missedInspection:import']">导入</el-button>
  55. </el-col>
  56. <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
  57. </el-row>
  58. <el-table v-loading="loading" :data="missedInspectionList" @selection-change="handleSelectionChange">
  59. <el-table-column type="selection" width="55" align="center" />
  60. <el-table-column label="大队" align="center" prop="brigadeName" width="120" />
  61. <el-table-column label="区域" align="center" prop="areaName" width="120" />
  62. <el-table-column label="被回查人" align="center" prop="reviewedUserName" width="120" />
  63. <el-table-column label="回查日期" align="center" prop="reviewDate" width="120" />
  64. <el-table-column label="漏检时间" align="center" prop="missCheckTime" width="120" />
  65. <el-table-column label="漏检时间段" align="center" prop="missCheckTimePeriod" width="150" />
  66. <el-table-column label="上岗位置" align="center" prop="channelName" width="120" />
  67. <el-table-column label="分管主管" align="center" prop="supervisorName" width="120" />
  68. <el-table-column label="代管主管" align="center" prop="actingSupervisorName" width="120" />
  69. <el-table-column label="分管班组长" align="center" prop="teamLeaderName" width="120" />
  70. <el-table-column label="物品位置" align="center" prop="itemLocation" width="120" />
  71. <el-table-column label="简单/难" align="center" prop="difficultyLevel" width="100" />
  72. <el-table-column label="回查人" align="center" prop="reviewUserName" width="120" />
  73. <el-table-column label="判别类型" align="center" prop="discriminationType" width="100" />
  74. <el-table-column label="是否追回" align="center" prop="isRecovered" width="100">
  75. <template #default="scope">
  76. <el-tag :type="scope.row.isRecovered === '是' ? 'success' : 'warning'">
  77. {{ scope.row.isRecovered }}
  78. </el-tag>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="开机年限" align="center" prop="machineOperatingYears" width="100" />
  82. <el-table-column label="证书级别" align="center" prop="certificateLevel" width="100" />
  83. <el-table-column label="人员性别" align="center" prop="gender" width="100" />
  84. <el-table-column label="漏检原因分类" align="center" prop="missCheckReasonCategory" width="120" />
  85. <el-table-column label="月考成绩" align="center" prop="monthlyAssessment" width="100" />
  86. <el-table-column label="本月自测有无漏检" align="center" prop="selfTestHasMissCheck" width="120">
  87. <template #default="scope">
  88. <el-tag>
  89. {{ scope.row.selfTestHasMissCheck ? '有' : '无' }}
  90. </el-tag>
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="漏检物品" align="center" prop="missCheckItem" width="120" />
  94. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140">
  95. <template #default="scope">
  96. <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
  97. v-hasPermi="['missedInspection:missedInspection:edit']">修改</el-button>
  98. <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
  99. v-hasPermi="['missedInspection:missedInspection:remove']">删除</el-button>
  100. </template>
  101. </el-table-column>
  102. </el-table>
  103. <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
  104. v-model:limit="queryParams.pageSize" @pagination="getList" />
  105. <!-- 添加或修改漏检对话框 -->
  106. <el-dialog :title="title" v-model="open" width="1000px" append-to-body>
  107. <el-form ref="missedInspectionRef" :model="form" :rules="rules" label-width="140px">
  108. <el-row :gutter="20">
  109. <el-col :span="12">
  110. <el-form-item label="大队" prop="brigadeId">
  111. <el-select v-model="form.brigadeId" placeholder="请选择大队" style="width: 100%">
  112. <el-option v-for="item in brigadeOptions" :key="item.value" :label="item.label" :value="item.value" />
  113. </el-select>
  114. </el-form-item>
  115. </el-col>
  116. <el-col :span="12">
  117. <el-form-item label="区域" prop="areaId">
  118. <el-select v-model="form.areaId" placeholder="请选择区域" style="width: 100%">
  119. <el-option v-for="item in areaOptions" :key="item.code" :label="item.name" :value="item.positionId" />
  120. </el-select>
  121. </el-form-item>
  122. </el-col>
  123. </el-row>
  124. <el-row :gutter="20">
  125. <el-col :span="12">
  126. <el-form-item label="被回查人" prop="reviewedUserId">
  127. <el-select v-model="form.reviewedUserId" placeholder="请选择被回查人" style="width: 100%">
  128. <el-option v-for="item in personOptions" :key="item.value" :label="item.label" :value="item.value" />
  129. </el-select>
  130. </el-form-item>
  131. </el-col>
  132. <el-col :span="12">
  133. <el-form-item label="回查日期" prop="reviewDate">
  134. <el-date-picker v-model="form.reviewDate" type="date" placeholder="选择回查日期" value-format="YYYY-MM-DD"
  135. style="width: 100%" />
  136. </el-form-item>
  137. </el-col>
  138. </el-row>
  139. <el-row :gutter="20">
  140. <el-col :span="12">
  141. <el-form-item label="漏检时间" prop="missCheckTime">
  142. <el-time-picker v-model="form.missCheckTime" placeholder="请选择漏检时间" value-format="HH:mm"
  143. style="width: 100%" />
  144. </el-form-item>
  145. </el-col>
  146. <el-col :span="12">
  147. <el-form-item label="漏检时间段" prop="missCheckTimePeriod">
  148. <el-select v-model="form.missCheckTimePeriod" placeholder="请选择漏检时间段" style="width: 100%">
  149. <el-option v-for="item in blocked_time_period" :key="item.value" :label="item.label"
  150. :value="item.value" />
  151. </el-select>
  152. </el-form-item>
  153. </el-col>
  154. </el-row>
  155. <el-row :gutter="20">
  156. <el-col :span="12">
  157. <el-form-item label="上岗位置" prop="channelId">
  158. <el-select v-model="form.channelId" placeholder="请选择上岗位置" style="width: 100%">
  159. <el-option v-for="item in channelOptions" :key="item.code" :label="item.name"
  160. :value="item.positionId" />
  161. </el-select>
  162. </el-form-item>
  163. </el-col>
  164. <el-col :span="12">
  165. <el-form-item label="分管主管" prop="supervisorId">
  166. <el-select v-model="form.supervisorId" placeholder="请选择分管主管" style="width: 100%">
  167. <el-option v-for="item in supervisorOptions" :key="item.value" :label="item.label"
  168. :value="item.value" />
  169. </el-select>
  170. </el-form-item>
  171. </el-col>
  172. </el-row>
  173. <el-row :gutter="20">
  174. <el-col :span="12">
  175. <el-form-item label="代管主管" prop="actingSupervisorId">
  176. <el-select v-model="form.actingSupervisorId" placeholder="请选择代管主管" style="width: 100%">
  177. <el-option v-for="item in supervisorOptions" :key="item.value" :label="item.label"
  178. :value="item.value" />
  179. </el-select>
  180. </el-form-item>
  181. </el-col>
  182. <el-col :span="12">
  183. <el-form-item label="分管班组长" prop="teamLeaderId">
  184. <el-select v-model="form.teamLeaderId" placeholder="请选择分管班组长" style="width: 100%">
  185. <el-option v-for="item in teamLeaderOptions" :key="item.value" :label="item.label"
  186. :value="item.value" />
  187. </el-select>
  188. </el-form-item>
  189. </el-col>
  190. </el-row>
  191. <el-row :gutter="20">
  192. <el-col :span="12">
  193. <el-form-item label="物品位置" prop="itemLocation">
  194. <el-select v-model="form.itemLocation" placeholder="请选择物品位置" style="width: 100%">
  195. <el-option v-for="item in blocked_item_position" :key="item.value" :label="item.label"
  196. :value="item.value" />
  197. </el-select>
  198. </el-form-item>
  199. </el-col>
  200. <el-col :span="12">
  201. <el-form-item label="简单/难" prop="difficultyLevel">
  202. <el-select v-model="form.difficultyLevel" placeholder="请选择简单/难" style="width: 100%">
  203. <el-option label="简单" value="简单" />
  204. <el-option label="难" value="难" />
  205. </el-select>
  206. </el-form-item>
  207. </el-col>
  208. </el-row>
  209. <el-row :gutter="20">
  210. <el-col :span="12">
  211. <el-form-item label="回查人" prop="reviewUserId">
  212. <el-select v-model="form.reviewUserId" placeholder="请选择回查人" style="width: 100%">
  213. <el-option v-for="item in personOptions" :key="item.value" :label="item.label" :value="item.value" />
  214. </el-select>
  215. </el-form-item>
  216. </el-col>
  217. <el-col :span="12">
  218. <el-form-item label="判别类型" prop="discriminationType">
  219. <el-select v-model="form.discriminationType" placeholder="请选择判别类型" style="width: 100%">
  220. <el-option v-for="item in discrimination_type" :key="item.value" :label="item.label"
  221. :value="item.value" />
  222. </el-select>
  223. </el-form-item>
  224. </el-col>
  225. </el-row>
  226. <el-row :gutter="20">
  227. <el-col :span="12">
  228. <el-form-item label="是否追回" prop="isRecovered">
  229. <el-select v-model="form.isRecovered" placeholder="请选择是否追回" style="width: 100%">
  230. <el-option label="是" value="是" />
  231. <el-option label="否" value="否" />
  232. </el-select>
  233. </el-form-item>
  234. </el-col>
  235. <el-col :span="12">
  236. <el-form-item label="开机年限" prop="machineOperatingYears">
  237. <el-select v-model="form.machineOperatingYears" placeholder="请选择开机年限" style="width: 100%">
  238. <el-option v-for="item in blocked_operating_years" :key="item.value" :label="item.label"
  239. :value="item.value" />
  240. </el-select>
  241. </el-form-item>
  242. </el-col>
  243. </el-row>
  244. <el-row :gutter="20">
  245. <el-col :span="12">
  246. <el-form-item label="证书级别" prop="certificateLevel">
  247. <el-input v-model="form.certificateLevel" placeholder="请输入证书级别" />
  248. </el-form-item>
  249. </el-col>
  250. <el-col :span="12">
  251. <el-form-item label="人员性别" prop="gender">
  252. <el-select v-model="form.gender" placeholder="请选择人员性别" style="width: 100%">
  253. <el-option label="男" value="男" />
  254. <el-option label="女" value="女" />
  255. </el-select>
  256. </el-form-item>
  257. </el-col>
  258. </el-row>
  259. <el-row :gutter="20">
  260. <el-col :span="12">
  261. <el-form-item label="漏检原因分类" prop="missCheckReasonCategory">
  262. <el-select v-model="form.missCheckReasonCategory" placeholder="请选择漏检原因分类" style="width: 100%">
  263. <el-option v-for="item in blocked_miss_check_reason" :key="item.value" :label="item.label"
  264. :value="item.value" />
  265. </el-select>
  266. </el-form-item>
  267. </el-col>
  268. <el-col :span="12">
  269. <el-form-item label="月考成绩" prop="monthlyAssessment">
  270. <el-select v-model="form.monthlyAssessment" placeholder="请选择月考成绩" style="width: 100%">
  271. <el-option v-for="item in blocked_monthly_exam_result" :key="item.value" :label="item.label"
  272. :value="item.value" />
  273. </el-select>
  274. </el-form-item>
  275. </el-col>
  276. </el-row>
  277. <el-row :gutter="20">
  278. <el-col :span="12">
  279. <el-form-item label="本月自测有无漏检" prop="selfTestHasMissCheck">
  280. <el-select v-model="form.selfTestHasMissCheck" placeholder="请选择本月自测有无漏检" style="width: 100%">
  281. <el-option label="有" value="1" />
  282. <el-option label="无" value="0" />
  283. </el-select>
  284. </el-form-item>
  285. </el-col>
  286. <el-col :span="12">
  287. <el-form-item label="漏检物品" prop="missCheckItem">
  288. <el-input v-model="form.missCheckItem" placeholder="请输入漏检物品" />
  289. </el-form-item>
  290. </el-col>
  291. </el-row>
  292. </el-form>
  293. <template #footer>
  294. <div class="dialog-footer">
  295. <el-button type="primary" @click="submitForm">确 定</el-button>
  296. <el-button @click="cancel">取 消</el-button>
  297. </div>
  298. </template>
  299. </el-dialog>
  300. <!-- 导入对话框 -->
  301. <el-dialog title="导入" v-model="importOpen" width="500px" append-to-body>
  302. <el-upload ref="uploadRef" :auto-upload="false" :on-change="handleFileChange" :show-file-list="false"
  303. accept=".xlsx,.xls">
  304. <el-button type="primary">选取文件</el-button>
  305. </el-upload>
  306. <div class="el-upload__tip">只能上传xls/xlsx文件</div>
  307. <div class="el-upload__tip">
  308. <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
  309. @click="importTemplate">下载模板</el-link>
  310. </div>
  311. <template #footer>
  312. <div class="dialog-footer">
  313. <el-button type="primary" @click="submitImport">确 定</el-button>
  314. <el-button @click="importOpen = false">取 消</el-button>
  315. </div>
  316. </template>
  317. </el-dialog>
  318. </div>
  319. </template>
  320. <script setup>
  321. import { ref, reactive, onMounted, getCurrentInstance } from 'vue'
  322. import { listPosition } from '@/api/system/position'
  323. import { listMissedInspection, getMissedInspection, delMissedInspection, addMissedInspection, updateMissedInspection, exportMissedInspection, downloadTemplate } from '@/api/blockingData/missedInspection'
  324. import { listDept } from '@/api/system/dept'
  325. import { listUser } from '@/api/system/user'
  326. import { useDict } from '@/utils/dict'
  327. const { proxy } = getCurrentInstance()
  328. // 遮罩层
  329. const loading = ref(true)
  330. // 选中数组
  331. const ids = ref([])
  332. // 非单个禁用
  333. const single = ref(true)
  334. // 非多个禁用
  335. const multiple = ref(true)
  336. // 显示搜索条件
  337. const showSearch = ref(true)
  338. // 总条数
  339. const total = ref(0)
  340. // 漏检表格数据
  341. const missedInspectionList = ref([])
  342. // 弹出层标题
  343. const title = ref('')
  344. // 是否显示弹出层
  345. const open = ref(false)
  346. // 是否显示导入弹出层
  347. const importOpen = ref(false)
  348. // 日期范围
  349. const dateRange = ref([])
  350. // 导入文件
  351. const importFile = ref(null)
  352. // 查询参数
  353. const queryParams = reactive({
  354. pageNum: 1,
  355. pageSize: 10,
  356. brigadeId: null,
  357. reviewDate: null,
  358. reviewedUserId: null,
  359. teamLeaderId: null,
  360. supervisorId: null,
  361. discriminationType: null
  362. })
  363. // 表单参数
  364. const form = reactive({})
  365. // 表单校验
  366. const rules = {
  367. brigadeId: [{ required: true, message: '大队不能为空', trigger: 'change' }],
  368. reviewDate: [{ required: true, message: '回查日期不能为空', trigger: 'change' }]
  369. }
  370. // 字典数据
  371. const { discrimination_type, blocked_time_period, blocked_item_position, blocked_monthly_exam_result, blocked_operating_years, blocked_miss_check_reason } = useDict('discrimination_type', 'blocked_time_period', 'blocked_item_position', 'blocked_monthly_exam_result', 'blocked_operating_years', 'blocked_miss_check_reason')
  372. // 大队选项
  373. const brigadeOptions = ref([])
  374. // 人员选项
  375. const personOptions = ref([])
  376. // 班组长选项
  377. const teamLeaderOptions = ref([])
  378. // 主管选项
  379. const supervisorOptions = ref([])
  380. // 区域选项
  381. const areaOptions = ref([])
  382. // 上岗位置选项
  383. const channelOptions = ref([])
  384. /** 获取职位列表 */
  385. function getPositionList() {
  386. // 获取区域选项
  387. listPosition({ positionType: 'REGIONAL' }).then(response => {
  388. areaOptions.value = response.data || []
  389. })
  390. // 获取上岗位置选项
  391. listPosition({ positionType: 'TERMINL' }).then(response => {
  392. channelOptions.value = response.data || []
  393. })
  394. }
  395. /** 查询漏检列表 */
  396. function getList() {
  397. loading.value = true
  398. if (dateRange.value && dateRange.value.length === 2) {
  399. queryParams.reviewDateStart = dateRange.value[0]
  400. queryParams.reviewDateEnd = dateRange.value[1]
  401. } else {
  402. queryParams.reviewDateStart = null
  403. queryParams.reviewDateEnd = null
  404. }
  405. listMissedInspection(queryParams).then(response => {
  406. missedInspectionList.value = response.rows
  407. total.value = response.total
  408. loading.value = false
  409. })
  410. }
  411. /** 获取部门列表 */
  412. function getDeptList() {
  413. listDept({}).then(response => {
  414. const deptList = response.data || []
  415. brigadeOptions.value = deptList.filter(item => item.deptType === 'BRIGADE').map(item => ({
  416. value: item.deptId,
  417. label: item.deptName
  418. }))
  419. teamLeaderOptions.value = deptList.filter(item => item.deptType === 'TEAMS').map(item => ({
  420. value: item.deptId,
  421. label: item.deptName
  422. }))
  423. supervisorOptions.value = deptList.filter(item => item.deptType === 'MANAGER').map(item => ({
  424. value: item.deptId,
  425. label: item.deptName
  426. }))
  427. })
  428. }
  429. /** 获取用户列表 */
  430. function getUserList() {
  431. listUser({ pageNum: 1, pageSize: 1000 }).then(response => {
  432. personOptions.value = response.rows.map(item => ({
  433. value: item.userId,
  434. label: item.nickName
  435. }))
  436. })
  437. }
  438. // 取消按钮
  439. function cancel() {
  440. open.value = false
  441. reset()
  442. }
  443. // 表单重置
  444. function reset() {
  445. Object.assign(form, {
  446. id: null,
  447. brigadeId: null,
  448. areaId: null,
  449. areaName: null,
  450. reviewedUserId: null,
  451. reviewDate: null,
  452. missCheckTime: null,
  453. missCheckTimePeriod: null,
  454. channelId: null,
  455. channelName: null,
  456. supervisorId: null,
  457. actingSupervisorId: null,
  458. teamLeaderId: null,
  459. itemLocation: null,
  460. difficultyLevel: null,
  461. reviewUserId: null,
  462. discriminationType: null,
  463. isRecovered: null,
  464. machineOperatingYears: null,
  465. certificateLevel: null,
  466. gender: null,
  467. missCheckReasonCategory: null,
  468. monthlyAssessment: null,
  469. selfTestHasMissCheck: null,
  470. missCheckItem: null
  471. })
  472. proxy.resetForm('missedInspectionRef')
  473. }
  474. /** 搜索按钮操作 */
  475. function handleQuery() {
  476. queryParams.pageNum = 1
  477. getList()
  478. }
  479. /** 重置按钮操作 */
  480. function resetQuery() {
  481. dateRange.value = []
  482. proxy.resetForm('queryRef')
  483. handleQuery()
  484. }
  485. // 多选框选中数据
  486. function handleSelectionChange(selection) {
  487. ids.value = selection.map(item => item.id)
  488. single.value = selection.length !== 1
  489. multiple.value = !selection.length
  490. }
  491. /** 新增按钮操作 */
  492. function handleAdd() {
  493. reset()
  494. open.value = true
  495. title.value = '添加漏检'
  496. }
  497. /** 修改按钮操作 */
  498. function handleUpdate(row) {
  499. reset()
  500. const id = row.id || ids.value[0]
  501. getMissedInspection(id).then(response => {
  502. Object.assign(form, response.data)
  503. open.value = true
  504. title.value = '修改漏检'
  505. })
  506. }
  507. /** 提交按钮 */
  508. function submitForm() {
  509. proxy.$refs.missedInspectionRef.validate(valid => {
  510. if (valid) {
  511. // 处理大队ID和名称映射
  512. if (form.brigadeId) {
  513. const brigade = brigadeOptions.value.find(item => item.value === form.brigadeId)
  514. form.brigadeName = brigade ? brigade.label : null
  515. }
  516. // 处理区域ID和名称映射
  517. if (form.areaId) {
  518. const area = areaOptions.value.find(item => item.positionId === form.areaId)
  519. form.areaName = area ? area.positionName : null
  520. }
  521. // 处理被回查人ID和名称映射
  522. if (form.reviewedUserId) {
  523. const reviewedUser = personOptions.value.find(item => item.value === form.reviewedUserId)
  524. form.reviewedUserName = reviewedUser ? reviewedUser.label : null
  525. }
  526. // 处理上岗位置ID和名称映射
  527. if (form.channelId) {
  528. const channel = channelOptions.value.find(item => item.positionId === form.channelId)
  529. form.channelName = channel ? channel.positionName : null
  530. }
  531. // 处理分管主管ID和名称映射
  532. if (form.supervisorId) {
  533. const supervisor = supervisorOptions.value.find(item => item.value === form.supervisorId)
  534. form.supervisorName = supervisor ? supervisor.label : null
  535. }
  536. // 处理代管主管ID和名称映射
  537. if (form.actingSupervisorId) {
  538. const actingSupervisor = supervisorOptions.value.find(item => item.value === form.actingSupervisorId)
  539. form.actingSupervisorName = actingSupervisor ? actingSupervisor.label : null
  540. }
  541. // 处理分管班组长ID和名称映射
  542. if (form.teamLeaderId) {
  543. const teamLeader = teamLeaderOptions.value.find(item => item.value === form.teamLeaderId)
  544. form.teamLeaderName = teamLeader ? teamLeader.label : null
  545. }
  546. // 处理回查人ID和名称映射
  547. if (form.reviewUserId) {
  548. const reviewUser = personOptions.value.find(item => item.value === form.reviewUserId)
  549. form.reviewUserName = reviewUser ? reviewUser.label : null
  550. }
  551. if (form.id != null) {
  552. updateMissedInspection(form).then(response => {
  553. proxy.$modal.msgSuccess('修改成功')
  554. open.value = false
  555. getList()
  556. })
  557. } else {
  558. addMissedInspection(form).then(response => {
  559. proxy.$modal.msgSuccess('新增成功')
  560. open.value = false
  561. getList()
  562. })
  563. }
  564. }
  565. })
  566. }
  567. /** 删除按钮操作 */
  568. function handleDelete(row) {
  569. const id = row.id || ids.value
  570. proxy.$modal.confirm('是否确认删除漏检编号为"' + id + '"的数据项?').then(function () {
  571. return delMissedInspection(id)
  572. }).then(() => {
  573. getList()
  574. proxy.$modal.msgSuccess('删除成功')
  575. }).catch(() => { })
  576. }
  577. /** 导出按钮操作 */
  578. function handleExport() {
  579. proxy.download('missedInspection/export', {
  580. ...queryParams
  581. }, `漏检_${new Date().getTime()}.xlsx`)
  582. }
  583. /** 导入按钮操作 */
  584. function handleImport() {
  585. importOpen.value = true
  586. importFile.value = null
  587. }
  588. /** 下载模板操作 */
  589. function importTemplate() {
  590. proxy.download('blocked/missReview/importTemplate', {}, `missed_inspection_template_${new Date().getTime()}.xlsx`)
  591. }
  592. /** 文件选择 */
  593. function handleFileChange(file) {
  594. importFile.value = file.raw
  595. }
  596. /** 提交导入 */
  597. function submitImport() {
  598. if (!importFile.value) {
  599. proxy.$modal.msgWarning('请选择要导入的文件')
  600. return
  601. }
  602. const formData = new FormData()
  603. formData.append('file', importFile.value)
  604. proxy.upload('missedInspection/importData', formData).then(response => {
  605. proxy.$modal.msgSuccess(response.msg)
  606. importOpen.value = false
  607. getList()
  608. })
  609. }
  610. onMounted(() => {
  611. getList()
  612. getDeptList()
  613. getUserList()
  614. getPositionList()
  615. })
  616. </script>
  617. <style lang="less" scoped>
  618. .app-container {
  619. padding: 20px;
  620. }
  621. </style>