瀏覽代碼

first commit

wangxx 4 月之前
父節點
當前提交
8ca64cbc45

+ 512 - 0
script/deploy.mjs

@@ -0,0 +1,512 @@
1
+#!/usr/bin/env node
2
+
3
+import sftpClient from 'ssh2-sftp-client'
4
+import {
5
+  readFileSync,
6
+  existsSync,
7
+  statSync,
8
+  readdirSync,
9
+  unlinkSync,
10
+  createReadStream,
11
+  writeFileSync
12
+} from 'fs'
13
+import { join, dirname } from 'path'
14
+import { fileURLToPath } from 'url'
15
+import { SingleBar } from 'cli-progress'
16
+import { exec, spawn } from 'child_process'
17
+import { promisify } from 'util'
18
+import { Command } from 'commander'
19
+const program = new Command();
20
+program.option('-n --env <env>', '发布环境', 'dev')
21
+program.parse(process.argv);
22
+const options = program.opts();
23
+
24
+const __filename = fileURLToPath(import.meta.url)
25
+const __dirname = dirname(__filename)
26
+const projectRoot = join(__dirname, '..')
27
+
28
+// 配置 测试环境 : 
29
+const config = options.env === 'prod' ? {
30
+  host: '60.205.166.0',
31
+  username: 'root',
32
+  password: 'U/N$$XBv', // 运行时输入
33
+  remotePath: '/opt/data/airport-web/dist',
34
+  localPath: join(projectRoot, 'dist'),
35
+  accessLocation: 'http://airport.samsundot.com:9011'
36
+} : {
37
+  host: '192.168.3.221',
38
+  username: 'root',
39
+  password: 'root', // 运行时输入
40
+  remotePath: '/opt/data/airport-web/dist',
41
+  localPath: join(projectRoot, 'dist')
42
+}
43
+
44
+// 颜色输出
45
+const colors = {
46
+  reset: '\x1b[0m',
47
+  bright: '\x1b[1m',
48
+  red: '\x1b[31m',
49
+  green: '\x1b[32m',
50
+  yellow: '\x1b[33m',
51
+  blue: '\x1b[34m',
52
+  magenta: '\x1b[35m',
53
+  cyan: '\x1b[36m'
54
+}
55
+
56
+function log (message, color = 'reset') {
57
+  console.log(`${colors[ color ]}${message}${colors.reset}`)
58
+}
59
+
60
+// 获取密码
61
+async function getPassword () {
62
+  const readline = await import('readline')
63
+  const rl = readline.createInterface({
64
+    input: process.stdin,
65
+    output: process.stdout
66
+  })
67
+
68
+  return new Promise(resolve => {
69
+    rl.question('🔐 请输入服务器密码: ', password => {
70
+      rl.close()
71
+      resolve(password)
72
+    })
73
+  })
74
+}
75
+
76
+// 检查并构建 dist 目录
77
+async function checkAndBuildDist () {
78
+  if (!existsSync(config.localPath)) {
79
+    log('⚠️  dist 目录不存在,开始自动构建...', 'yellow')
80
+
81
+    // 检查 package.json 是否存在
82
+    const packageJsonPath = join(projectRoot, 'package.json')
83
+    if (!existsSync(packageJsonPath)) {
84
+      log('❌ package.json 不存在', 'red')
85
+      process.exit(1)
86
+    }
87
+
88
+    // 检查是否有 build 脚本
89
+    const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'))
90
+    if (!packageJson.scripts || !packageJson.scripts.build) {
91
+      log('❌ package.json 中没有找到 build 脚本', 'red')
92
+      process.exit(1)
93
+    }
94
+
95
+    // 执行构建
96
+    log('🔨 正在执行构建命令...', 'cyan')
97
+    const execAsync = promisify(exec)
98
+
99
+    try {
100
+      // 优先使用 yarn,如果没有则使用 npm
101
+      let buildCommand = 'npm run build'
102
+      let packageManager = 'npm'
103
+
104
+      // 检查是否有 yarn
105
+      try {
106
+        await execAsync('yarn --version', { cwd: projectRoot })
107
+        buildCommand = 'yarn build'
108
+        packageManager = 'yarn'
109
+        log(`使用 ${packageManager} 构建...`, 'cyan')
110
+      } catch (yarnError) {
111
+        log('yarn 不可用,使用 npm 构建...', 'yellow')
112
+      }
113
+
114
+      await execAsync(buildCommand, { cwd: projectRoot })
115
+
116
+      // 再次检查构建结果
117
+      if (!existsSync(config.localPath)) {
118
+        log('❌ 构建失败,dist 目录仍未生成', 'red')
119
+        process.exit(1)
120
+      }
121
+
122
+      log(`✅ 构建完成!(使用 ${packageManager})`, 'green')
123
+    } catch (error) {
124
+      log(`❌ 构建失败: ${error.message}`, 'red')
125
+      process.exit(1)
126
+    }
127
+  } else {
128
+    const stats = statSync(config.localPath)
129
+    if (!stats.isDirectory()) {
130
+      log('❌ dist 不是目录', 'red')
131
+      process.exit(1)
132
+    }
133
+    log('✅ dist 目录检查通过', 'green')
134
+  }
135
+}
136
+
137
+// 计算目录大小
138
+function getDirectorySize (dirPath) {
139
+  let totalSize = 0
140
+  const files = readdirSync(dirPath, { withFileTypes: true })
141
+
142
+  for (const file of files) {
143
+    const fullPath = join(dirPath, file.name)
144
+    if (file.isDirectory()) {
145
+      totalSize += getDirectorySize(fullPath)
146
+    } else {
147
+      totalSize += statSync(fullPath).size
148
+    }
149
+  }
150
+
151
+  return totalSize
152
+}
153
+
154
+// 格式化文件大小
155
+function formatSize (bytes) {
156
+  const units = [ 'B', 'KB', 'MB', 'GB' ]
157
+  let size = bytes
158
+  let unitIndex = 0
159
+
160
+  while (size >= 1024 && unitIndex < units.length - 1) {
161
+    size /= 1024
162
+    unitIndex++
163
+  }
164
+
165
+  return `${size.toFixed(1)}${units[ unitIndex ]}`
166
+}
167
+
168
+// 创建压缩包
169
+async function createArchive () {
170
+  const execAsync = promisify(exec)
171
+
172
+  const archivePath = join(projectRoot, 'dist.tar.gz')
173
+
174
+  log('📦 正在创建压缩包...', 'yellow')
175
+  try {
176
+    // 使用 tar 创建压缩包,排除 macOS 扩展属性
177
+    await execAsync(`tar --no-xattrs -czf "${archivePath}" -C "${config.localPath}" .`)
178
+
179
+    const stats = statSync(archivePath)
180
+    log(`✅ 压缩包创建完成,大小: ${formatSize(stats.size)}`, 'green')
181
+
182
+    return archivePath
183
+  } catch (error) {
184
+    log(`❌ 创建压缩包失败: ${error.message}`, 'red')
185
+    throw error
186
+  }
187
+}
188
+
189
+// 获取用户选择
190
+async function getUserChoice (question) {
191
+  const readline = await import('readline')
192
+  const rl = readline.createInterface({
193
+    input: process.stdin,
194
+    output: process.stdout
195
+  })
196
+
197
+  return new Promise(resolve => {
198
+    rl.question(question, answer => {
199
+      rl.close()
200
+      resolve(answer.toLowerCase().trim())
201
+    })
202
+  })
203
+}
204
+
205
+// 主部署函数
206
+async function deploy () {
207
+  let archivePath = null
208
+
209
+  try {
210
+    log('🚀 开始 Node.js 部署...', 'cyan')
211
+
212
+    // 检查并构建 dist 目录
213
+    await checkAndBuildDist()
214
+
215
+    if (!config.password) {
216
+      // 获取密码
217
+      config.password = await getPassword()
218
+    }
219
+
220
+    // 计算总大小
221
+    const totalSize = getDirectorySize(config.localPath)
222
+    log(`📊 总大小: ${formatSize(totalSize)}`, 'blue')
223
+
224
+    // 检查是否已有压缩包,支持断点续传
225
+    const existingArchivePath = join(projectRoot, 'dist.tar.gz')
226
+    if (existsSync(existingArchivePath)) {
227
+      log('📦 发现已存在的压缩包,跳过打包步骤', 'yellow')
228
+      archivePath = existingArchivePath
229
+    } else {
230
+      // 创建压缩包
231
+      archivePath = await createArchive()
232
+    }
233
+
234
+    // 连接 SFTP
235
+    log('🔌 正在连接服务器...', 'yellow')
236
+    const sftp = new sftpClient()
237
+    await sftp.connect({
238
+      host: config.host,
239
+      username: config.username,
240
+      password: config.password
241
+    })
242
+    log('✅ SFTP 连接成功', 'green')
243
+
244
+    // 创建远程目录
245
+    log('📁 创建远程目录...', 'yellow')
246
+    await sftp.mkdir(config.remotePath, true) // true 表示递归创建
247
+
248
+    // 检查服务器是否已存在压缩包
249
+    const remoteArchivePath = '/opt/data/airport-web/dist.tar.gz'
250
+    let needUpload = true
251
+
252
+    try {
253
+      await sftp.stat(remoteArchivePath)
254
+      log('📦 服务器已存在压缩包', 'yellow')
255
+
256
+      // 询问用户是否续传
257
+      const choice = await getUserChoice('是否续传?(y/n): ')
258
+      if (choice === 'y' || choice === 'yes') {
259
+        log('📦 跳过上传步骤,使用现有压缩包', 'green')
260
+        needUpload = false
261
+      } else {
262
+        log('🗑️  删除服务器压缩包,重新上传...', 'yellow')
263
+        await sftp.unlink(remoteArchivePath)
264
+        log('📤 开始上传新压缩包...', 'yellow')
265
+      }
266
+    } catch (error) {
267
+      // 文件不存在,需要上传
268
+      log('📤 服务器不存在压缩包,开始上传...', 'yellow')
269
+    }
270
+
271
+    if (needUpload) {
272
+      // 上传压缩包
273
+      log('📤 正在上传压缩包...', 'yellow')
274
+
275
+      // 显示上传进度
276
+      const fileSize = statSync(archivePath).size
277
+      log(`📊 文件大小: ${formatSize(fileSize)}`, 'blue')
278
+
279
+      // 创建进度条
280
+      const progressBar = new SingleBar({
281
+        format: '📤 上传进度 |{bar}| {percentage}% | {value}/{total} Bytes | {speed}',
282
+        barCompleteChar: '█',
283
+        barIncompleteChar: '░',
284
+        hideCursor: true
285
+      })
286
+
287
+      progressBar.start(fileSize, 0)
288
+
289
+      try {
290
+        // 使用流的方式上传,获得实时进度
291
+        const readStream = createReadStream(archivePath)
292
+        const writeStream = await sftp.createWriteStream(remoteArchivePath)
293
+
294
+        let uploadedBytes = 0
295
+        const startTime = Date.now()
296
+
297
+        // 监听数据流,实时更新进度
298
+        readStream.on('data', chunk => {
299
+          uploadedBytes += chunk.length
300
+          const elapsedTime = (Date.now() - startTime) / 1000
301
+          const speed = elapsedTime > 0 ? (uploadedBytes / elapsedTime).toFixed(2) : '0'
302
+          progressBar.update(uploadedBytes, { speed: `${speed} B/s` })
303
+        })
304
+
305
+        // 处理流事件
306
+        readStream.pipe(writeStream)
307
+
308
+        // 等待上传完成
309
+        await new Promise((resolve, reject) => {
310
+          writeStream.on('close', () => {
311
+            progressBar.stop()
312
+            log('✅ 压缩包上传完成', 'green')
313
+            resolve()
314
+          })
315
+
316
+          writeStream.on('error', err => {
317
+            progressBar.stop()
318
+            reject(err)
319
+          })
320
+
321
+          readStream.on('error', err => {
322
+            progressBar.stop()
323
+            reject(err)
324
+          })
325
+        })
326
+      } catch (error) {
327
+        progressBar.stop()
328
+        throw error
329
+      }
330
+    }
331
+
332
+    // 在服务器端解压
333
+    log('📦 正在服务器端解压...', 'yellow')
334
+
335
+    // 检测操作系统
336
+    const isWindows = process.platform === 'win32'
337
+    const execAsync = promisify(exec)
338
+
339
+
340
+    // 转义密码(关键步骤!)
341
+    function escapeForExpect (password) {
342
+      return password
343
+        .replace(/\\/g, "\\\\") // 转义反斜杠 \
344
+        .replace(/\$/g, "\\$"); // 转义 $
345
+    }
346
+
347
+    if (isWindows) {
348
+      // Windows 系统:使用 PowerShell 脚本(单次密码输入)
349
+      log('🪟  Windows 系统检测到,使用 PowerShell 脚本', 'yellow')
350
+      const runPowerShellScript = (scriptPath) => {
351
+        return new Promise((resolve, reject) => {
352
+          const child = spawn('powershell', [
353
+            '-ExecutionPolicy',
354
+            'Bypass',
355
+            '-File',
356
+            scriptPath
357
+          ], {
358
+            stdio: 'inherit'
359
+          });
360
+
361
+          child.on('close', (code) => {
362
+            if (code === 0) {
363
+              resolve();
364
+            } else {
365
+              reject(new Error(`PowerShell 脚本执行失败,退出码: ${code}`));
366
+            }
367
+          });
368
+
369
+          child.on('error', (error) => {
370
+            reject(new Error(`无法启动 PowerShell: ${error.message}`));
371
+          });
372
+        });
373
+      };
374
+      const powershellScript = `
375
+        $username = "${config.username}"
376
+        $hostname = "${config.host}"
377
+        $remotePath = "${config.remotePath}"
378
+        $archivePath = "${remoteArchivePath}"
379
+        $safePath = [System.Management.Automation.WildcardPattern]::Escape($remotePath)
380
+        $safeArchive = [System.Management.Automation.WildcardPattern]::Escape($archivePath)
381
+
382
+        # 创建 SSH 命令
383
+        $combinedCommand = "cd '$safePath' && tar -xzf '$safeArchive' && rm '$safeArchive' && chmod -R 755 '$safePath'"
384
+
385
+        Write-Host "=== 部署脚本 ===" -ForegroundColor Green
386
+        Write-Host "目标服务器: $username@$hostname" -ForegroundColor Yellow
387
+        Write-Host "远程路径: $remotePath" -ForegroundColor Yellow
388
+        Write-Host ""
389
+
390
+        Write-Host "🔑 请输入 SSH 密码 密码:${config.password}" -ForegroundColor Cyan
391
+        Write-Host ""
392
+
393
+        try {
394
+            # 执行合并命令
395
+            Write-Host "🚀 正在执行部署操作..." -ForegroundColor Cyan
396
+            ssh -o StrictHostKeyChecking=no $username@$hostname $combinedCommand
397
+            
398
+            Write-Host "✅ 所有操作完成!" -ForegroundColor Green
399
+            
400
+        } catch {
401
+            Write-Host "❌ 执行失败: $_" -ForegroundColor Red
402
+            Write-Host ""
403
+            Write-Host "请手动执行以下命令:" -ForegroundColor Yellow
404
+            Write-Host "ssh $username@$hostname \"cd '$remotePath' && tar -xzf '$archivePath' && rm '$archivePath' && chmod -R 755 '$remotePath'\"" -ForegroundColor Cyan
405
+            exit 1
406
+        }`
407
+      const psScriptPath = join(projectRoot, 'temp_deploy.ps1');
408
+      writeFileSync(psScriptPath, powershellScript);
409
+      try {
410
+        // 执行 PowerShell 脚本
411
+        log('ℹ️  即将执行部署命令,请根据提示输入密码...', 'blue');
412
+        await runPowerShellScript(psScriptPath)
413
+        log('✅ 部署完成', 'green');
414
+      } catch (error) {
415
+        log('⚠️  执行失败,请手动执行以下命令:', 'yellow');
416
+        log(`ssh ${config.username}@${config.host} "cd '${config.remotePath}' && tar -xzf '${remoteArchivePath}' && rm '${remoteArchivePath}' && chmod -R 755 '${config.remotePath}'"`, 'cyan');
417
+
418
+        // 等待用户确认
419
+        const readline = await import('readline');
420
+        const rl = readline.createInterface({
421
+          input: process.stdin,
422
+          output: process.stdout
423
+        });
424
+
425
+        await new Promise(resolve => {
426
+          rl.question('执行完成后按回车键继续...', () => {
427
+            rl.close();
428
+            resolve();
429
+          });
430
+        });
431
+      } finally {
432
+        if (existsSync(psScriptPath)) {
433
+          unlinkSync(psScriptPath);
434
+        }
435
+      }
436
+    } else {
437
+      // Unix/Linux/macOS 系统:使用 expect 脚本
438
+      const expectScript = `#!/usr/bin/expect -f
439
+        set timeout 30
440
+        set password {${config.password}}
441
+        spawn ssh -o StrictHostKeyChecking=no ${config.username}@${config.host} "cd ${config.remotePath} && tar -xzf ${remoteArchivePath} && rm ${remoteArchivePath}"
442
+        expect "password:"
443
+        send "$password\r"
444
+        expect eof
445
+      `
446
+
447
+      const expectScriptPath = join(projectRoot, 'temp_expect.sh')
448
+      writeFileSync(expectScriptPath, expectScript)
449
+
450
+      try {
451
+        await execAsync(`chmod +x ${expectScriptPath}`)
452
+        await execAsync(expectScriptPath)
453
+        log('✅ 解压完成', 'green')
454
+      } finally {
455
+        if (existsSync(expectScriptPath)) {
456
+          unlinkSync(expectScriptPath)
457
+        }
458
+      }
459
+
460
+      // 设置权限
461
+      log('🔧 设置文件权限...', 'yellow')
462
+
463
+      const chmodExpectScript = `#!/usr/bin/expect -f
464
+        set timeout 30
465
+        set password {${config.password}}
466
+        spawn ssh -o StrictHostKeyChecking=no ${config.username}@${config.host} "chmod -R 755 ${config.remotePath}"
467
+        expect "password:"
468
+        send "$password\r"
469
+        expect eof
470
+      `
471
+
472
+      const chmodScriptPath = join(projectRoot, 'temp_chmod.sh')
473
+      writeFileSync(chmodScriptPath, chmodExpectScript)
474
+
475
+      try {
476
+        await execAsync(`chmod +x ${chmodScriptPath}`)
477
+        await execAsync(chmodScriptPath)
478
+        log('✅ 权限设置完成', 'green')
479
+      } finally {
480
+        if (existsSync(chmodScriptPath)) {
481
+          unlinkSync(chmodScriptPath)
482
+        }
483
+      }
484
+    }
485
+
486
+    // 清理服务器上的压缩包
487
+    log('🗑️  清理服务器压缩包...', 'yellow')
488
+    try {
489
+      await sftp.unlink(remoteArchivePath)
490
+      log('✅ 服务器压缩包已清理', 'green')
491
+    } catch (error) {
492
+      log('⚠️  服务器压缩包清理失败(可能已被删除)', 'yellow')
493
+    }
494
+
495
+    // 关闭连接
496
+    await sftp.end()
497
+    log('🗑️  清理本地压缩包...', 'yellow')
498
+    if (archivePath && existsSync(archivePath)) {
499
+      unlinkSync(archivePath)
500
+    }
501
+
502
+    log('🎉 部署成功!', 'green')
503
+    config.accessLocation ? log(`🌐 访问地址: ${config.accessLocation}`, 'cyan') : log(`🌐 访问地址: http://${config.host}`, 'cyan')
504
+  } catch (error) {
505
+    log(`❌ 部署失败: ${error.message}`, 'red')
506
+    console.error(error)
507
+    process.exit(1)
508
+  }
509
+}
510
+
511
+// 运行部署
512
+deploy()

+ 44 - 0
src/api/attendance/attendanceRecord.js

@@ -0,0 +1,44 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询考勤记录列表
4
+export function listAttendanceRecord(query) {
5
+  return request({
6
+    url: '/attendance/attendanceRecord/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询考勤记录详细
13
+export function getAttendanceRecord(id) {
14
+  return request({
15
+    url: '/attendance/attendanceRecord/' + id,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增考勤记录
21
+export function addAttendanceRecord(data) {
22
+  return request({
23
+    url: '/attendance/attendanceRecord',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改考勤记录
30
+export function updateAttendanceRecord(data) {
31
+  return request({
32
+    url: '/attendance/attendanceRecord',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除考勤记录
39
+export function delAttendanceRecord(id) {
40
+  return request({
41
+    url: '/attendance/attendanceRecord/' + id,
42
+    method: 'delete'
43
+  })
44
+}

+ 44 - 0
src/api/attendance/checkRecord.js

@@ -0,0 +1,44 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询打卡记录列表
4
+export function listCheckRecord(query) {
5
+  return request({
6
+    url: '/attendance/checkRecord/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询打卡记录详细
13
+export function getCheckRecord(id) {
14
+  return request({
15
+    url: '/attendance/checkRecord/' + id,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增打卡记录
21
+export function addCheckRecord(data) {
22
+  return request({
23
+    url: '/attendance/checkRecord',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改打卡记录
30
+export function updateCheckRecord(data) {
31
+  return request({
32
+    url: '/attendance/checkRecord',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除打卡记录
39
+export function delCheckRecord(id) {
40
+  return request({
41
+    url: '/attendance/checkRecord/' + id,
42
+    method: 'delete'
43
+  })
44
+}

+ 62 - 0
src/api/attendance/postRecord.js

@@ -0,0 +1,62 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询上岗记录列表
4
+export function listPostRecord(query) {
5
+  return request({
6
+    url: '/attendance/postRecord/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询上岗记录详细
13
+export function getPostRecord(id) {
14
+  return request({
15
+    url: '/attendance/postRecord/' + id,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增上岗记录
21
+export function addPostRecord(data) {
22
+  return request({
23
+    url: '/attendance/postRecord',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改上岗记录
30
+export function updatePostRecord(data) {
31
+  return request({
32
+    url: '/attendance/postRecord',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除上岗记录
39
+export function delPostRecord(id) {
40
+  return request({
41
+    url: '/attendance/postRecord/' + id,
42
+    method: 'delete'
43
+  })
44
+}
45
+
46
+// 查询位置信息
47
+export function positionList(data) {
48
+  return request({
49
+    url: '/attendance/postRecord/positionList',
50
+    method: 'post',
51
+    data: data
52
+  })
53
+}
54
+
55
+// 查询班组信息
56
+export function teamList(data) {
57
+  return request({
58
+    url: '/system/dept/teamList',
59
+    method: 'post',
60
+    data: data
61
+  })
62
+}

+ 44 - 0
src/api/attendance/record.js

@@ -0,0 +1,44 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询考勤班组成员列表
4
+export function listRecord(query) {
5
+  return request({
6
+    url: '/attendance/record/pageList',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询考勤班组成员详细
13
+export function getRecord(userId) {
14
+  return request({
15
+    url: '/attendance/record/' + userId,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增考勤班组成员
21
+export function addRecord(data) {
22
+  return request({
23
+    url: '/attendance/record',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改考勤班组成员
30
+export function updateRecord(data) {
31
+  return request({
32
+    url: '/attendance/record',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除考勤班组成员
39
+export function delRecord(userId) {
40
+  return request({
41
+    url: '/attendance/record/' + userId,
42
+    method: 'delete'
43
+  })
44
+}

+ 69 - 0
src/api/check/checkCorrection.js

@@ -0,0 +1,69 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询检查记录列表
4
+export function checkCorrection(query) {
5
+  return request({
6
+    url: '/check/checkCorrection/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询检查记录详细
13
+export function getCheckCorrection(id) {
14
+  return request({
15
+    url: `/check/checkCorrection/${id}`,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增检查记录
21
+export function addCheckRecord(data) {
22
+  return request({
23
+    url: '/check/checkCorrection',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改检查记录
30
+export function updateCheckRecord(data) {
31
+  return request({
32
+    url: '/check/checkCorrection',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除检查记录
39
+export function delCheckRecord(ids) {
40
+  return request({
41
+    url: `/check/checkCorrection/${ids}`,
42
+    method: 'delete'
43
+  })
44
+}
45
+
46
+export function historyInstance (id) {
47
+  return request({
48
+    url: `/system/check/approval/history/instance/${id}`,
49
+    method: 'get'
50
+  })
51
+}
52
+
53
+// 同意检查记录
54
+export function approveTask (data) {
55
+  return request({
56
+    url: `/check/checkCorrection/approveTask`,
57
+    method: 'post',
58
+    data
59
+  })
60
+}
61
+// 驳回检查记录
62
+export function rejectTask(data) {
63
+  return request({
64
+    url: `/check/checkCorrection/rejectTask`,
65
+    method: 'post',
66
+    data
67
+  })
68
+}
69
+

+ 44 - 0
src/api/check/checkRecord.js

@@ -0,0 +1,44 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询检查记录列表
4
+export function listCheckRecord(query) {
5
+  return request({
6
+    url: '/check/checkRecord/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询检查记录详细
13
+export function getCheckRecord(id) {
14
+  return request({
15
+    url: '/check/checkRecord/' + id,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增检查记录
21
+export function addCheckRecord(data) {
22
+  return request({
23
+    url: '/check/checkRecord',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改检查记录
30
+export function updateCheckRecord(data) {
31
+  return request({
32
+    url: '/check/checkRecord',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除检查记录
39
+export function delCheckRecord(id) {
40
+  return request({
41
+    url: '/check/checkRecord/' + id,
42
+    method: 'delete'
43
+  })
44
+}

+ 39 - 0
src/api/check/checkTask.js

@@ -0,0 +1,39 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询检查任务列表
4
+export function listCheckTask(query) {
5
+  return request({
6
+    url: '/check/checkTask/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+//新增检查任务
12
+export function addCheckTask(data) {
13
+  return request({
14
+    url: '/check/checkTask',
15
+    method: 'post',
16
+    data: data
17
+  })
18
+}
19
+//获取检查任务详细信息
20
+export function getCheckTask(id) {
21
+  return request({
22
+    url: '/check/checkTask/' + id,
23
+    method: 'get'
24
+  })
25
+}
26
+//删除检查任务
27
+export function delCheckTask(id) {
28
+  return request({
29
+    url: '/check/checkTask/' + id,
30
+    method: 'delete'
31
+  })
32
+}
33
+//根据被检查级别查询检查项目列表
34
+export function getCheckProjectItemList(checkLevel) {
35
+  return request({
36
+    url: '/system/project/listByCheckLevel/' + checkLevel,
37
+    method: 'get'
38
+  })
39
+}

+ 44 - 0
src/api/item/items.js

@@ -0,0 +1,44 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询查获物品明细列表
4
+export function listItems(query) {
5
+  return request({
6
+    url: '/item/items/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询查获物品明细详细
13
+export function getItems(id) {
14
+  return request({
15
+    url: '/item/items/' + id,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增查获物品明细
21
+export function addItems(data) {
22
+  return request({
23
+    url: '/item/items',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改查获物品明细
30
+export function updateItems(data) {
31
+  return request({
32
+    url: '/item/items',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除查获物品明细
39
+export function delItems(id) {
40
+  return request({
41
+    url: '/item/items/' + id,
42
+    method: 'delete'
43
+  })
44
+}

+ 44 - 0
src/api/item/record.js

@@ -0,0 +1,44 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询查获记录列表
4
+export function listRecord(query) {
5
+  return request({
6
+    url: '/item/record/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询查获记录详细
13
+export function getRecord(id) {
14
+  return request({
15
+    url: '/item/record/' + id,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增查获记录
21
+export function addRecord(data) {
22
+  return request({
23
+    url: '/item/record',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改查获记录
30
+export function updateRecord(data) {
31
+  return request({
32
+    url: '/item/record',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除查获记录
39
+export function delRecord(id) {
40
+  return request({
41
+    url: '/item/record/' + id,
42
+    method: 'delete'
43
+  })
44
+}

+ 92 - 0
src/api/largeScreen/largeScreen.js

@@ -0,0 +1,92 @@
1
+import request from '@/utils/request'
2
+
3
+// 移交公安情况
4
+export function getPolice(params = {}) {
5
+  return request({
6
+    url: '/item/largeScreen/police',
7
+    method: 'get',
8
+    params
9
+  })
10
+}
11
+// 故意隐匿情况
12
+export function getConceal(params = {}) {
13
+  return request({
14
+    url: '/item/largeScreen/conceal',
15
+    method: 'get',
16
+    params
17
+  })
18
+}
19
+//查获类别分布
20
+export function getCategory(params = {}) {
21
+  return request({
22
+    url: '/item/largeScreen/category',
23
+    method: 'get',
24
+    params
25
+  })
26
+}
27
+
28
+//查获岗位分布
29
+export function getPost(params = {}) {
30
+  return request({
31
+    url: '/item/largeScreen/post',
32
+    method: 'get',
33
+    params
34
+  })
35
+} 
36
+
37
+//查获总数量+移交公安数量+故意隐匿数量
38
+export function getTotalSome(params = {}) {
39
+  return request({
40
+    url: '/item/largeScreen/getTotalSome',
41
+    method: 'get',
42
+    params
43
+  })
44
+}
45
+//查获排名
46
+export function getRank(params = {}) {
47
+  return request({
48
+    url: '/item/largeScreen/rank',
49
+    method: 'get',
50
+    params
51
+  })
52
+}
53
+//查获时段分布
54
+export function getTimeSpan(params = {}) {
55
+  return request({
56
+    url: '/item/largeScreen/timeSpan',
57
+    method: 'get',
58
+    params
59
+  })
60
+}
61
+//查获位置分布
62
+export function getPosition(params = {}) {
63
+  return request({
64
+    url: '/item/largeScreen/position',
65
+    method: 'get',
66
+    params
67
+  })
68
+}
69
+//查获通道分布
70
+export function getChannel(params = {}) {
71
+  return request({
72
+    url: '/item/largeScreen/channel',
73
+    method: 'get',
74
+    params
75
+  })
76
+}
77
+
78
+
79
+
80
+
81
+
82
+
83
+// 新增检查记录
84
+export function addCheckRecord(data) {
85
+  return request({
86
+    url: '/check/checkRecord',
87
+    method: 'post',
88
+    data: data
89
+  })
90
+}
91
+
92
+

+ 60 - 0
src/api/login.js

@@ -0,0 +1,60 @@
1
+import request from '@/utils/request'
2
+
3
+// 登录方法
4
+export function login(username, password, code, uuid) {
5
+  const data = {
6
+    username,
7
+    password,
8
+    code,
9
+    uuid
10
+  }
11
+  return request({
12
+    url: '/login',
13
+    headers: {
14
+      isToken: false,
15
+      repeatSubmit: false
16
+    },
17
+    method: 'post',
18
+    data: data
19
+  })
20
+}
21
+
22
+// 注册方法
23
+export function register(data) {
24
+  return request({
25
+    url: '/register',
26
+    headers: {
27
+      isToken: false
28
+    },
29
+    method: 'post',
30
+    data: data
31
+  })
32
+}
33
+
34
+// 获取用户详细信息
35
+export function getInfo() {
36
+  return request({
37
+    url: '/getInfo',
38
+    method: 'get'
39
+  })
40
+}
41
+
42
+// 退出方法
43
+export function logout() {
44
+  return request({
45
+    url: '/logout',
46
+    method: 'post'
47
+  })
48
+}
49
+
50
+// 获取验证码
51
+export function getCodeImg() {
52
+  return request({
53
+    url: '/captchaImage',
54
+    headers: {
55
+      isToken: false
56
+    },
57
+    method: 'get',
58
+    timeout: 20000
59
+  })
60
+}

+ 9 - 0
src/api/menu.js

@@ -0,0 +1,9 @@
1
+import request from '@/utils/request'
2
+
3
+// 获取路由
4
+export const getRouters = () => {
5
+  return request({
6
+    url: '/getRouters',
7
+    method: 'get'
8
+  })
9
+}

+ 57 - 0
src/api/monitor/cache.js

@@ -0,0 +1,57 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询缓存详细
4
+export function getCache() {
5
+  return request({
6
+    url: '/monitor/cache',
7
+    method: 'get'
8
+  })
9
+}
10
+
11
+// 查询缓存名称列表
12
+export function listCacheName() {
13
+  return request({
14
+    url: '/monitor/cache/getNames',
15
+    method: 'get'
16
+  })
17
+}
18
+
19
+// 查询缓存键名列表
20
+export function listCacheKey(cacheName) {
21
+  return request({
22
+    url: '/monitor/cache/getKeys/' + cacheName,
23
+    method: 'get'
24
+  })
25
+}
26
+
27
+// 查询缓存内容
28
+export function getCacheValue(cacheName, cacheKey) {
29
+  return request({
30
+    url: '/monitor/cache/getValue/' + cacheName + '/' + cacheKey,
31
+    method: 'get'
32
+  })
33
+}
34
+
35
+// 清理指定名称缓存
36
+export function clearCacheName(cacheName) {
37
+  return request({
38
+    url: '/monitor/cache/clearCacheName/' + cacheName,
39
+    method: 'delete'
40
+  })
41
+}
42
+
43
+// 清理指定键名缓存
44
+export function clearCacheKey(cacheKey) {
45
+  return request({
46
+    url: '/monitor/cache/clearCacheKey/' + cacheKey,
47
+    method: 'delete'
48
+  })
49
+}
50
+
51
+// 清理全部缓存
52
+export function clearCacheAll() {
53
+  return request({
54
+    url: '/monitor/cache/clearCacheAll',
55
+    method: 'delete'
56
+  })
57
+}

+ 71 - 0
src/api/monitor/job.js

@@ -0,0 +1,71 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询定时任务调度列表
4
+export function listJob(query) {
5
+  return request({
6
+    url: '/monitor/job/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询定时任务调度详细
13
+export function getJob(jobId) {
14
+  return request({
15
+    url: '/monitor/job/' + jobId,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增定时任务调度
21
+export function addJob(data) {
22
+  return request({
23
+    url: '/monitor/job',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改定时任务调度
30
+export function updateJob(data) {
31
+  return request({
32
+    url: '/monitor/job',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除定时任务调度
39
+export function delJob(jobId) {
40
+  return request({
41
+    url: '/monitor/job/' + jobId,
42
+    method: 'delete'
43
+  })
44
+}
45
+
46
+// 任务状态修改
47
+export function changeJobStatus(jobId, status) {
48
+  const data = {
49
+    jobId,
50
+    status
51
+  }
52
+  return request({
53
+    url: '/monitor/job/changeStatus',
54
+    method: 'put',
55
+    data: data
56
+  })
57
+}
58
+
59
+
60
+// 定时任务立即执行一次
61
+export function runJob(jobId, jobGroup) {
62
+  const data = {
63
+    jobId,
64
+    jobGroup
65
+  }
66
+  return request({
67
+    url: '/monitor/job/run',
68
+    method: 'put',
69
+    data: data
70
+  })
71
+}

+ 26 - 0
src/api/monitor/jobLog.js

@@ -0,0 +1,26 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询调度日志列表
4
+export function listJobLog(query) {
5
+  return request({
6
+    url: '/monitor/jobLog/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 删除调度日志
13
+export function delJobLog(jobLogId) {
14
+  return request({
15
+    url: '/monitor/jobLog/' + jobLogId,
16
+    method: 'delete'
17
+  })
18
+}
19
+
20
+// 清空调度日志
21
+export function cleanJobLog() {
22
+  return request({
23
+    url: '/monitor/jobLog/clean',
24
+    method: 'delete'
25
+  })
26
+}

+ 34 - 0
src/api/monitor/logininfor.js

@@ -0,0 +1,34 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询登录日志列表
4
+export function list(query) {
5
+  return request({
6
+    url: '/monitor/logininfor/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 删除登录日志
13
+export function delLogininfor(infoId) {
14
+  return request({
15
+    url: '/monitor/logininfor/' + infoId,
16
+    method: 'delete'
17
+  })
18
+}
19
+
20
+// 解锁用户登录状态
21
+export function unlockLogininfor(userName) {
22
+  return request({
23
+    url: '/monitor/logininfor/unlock/' + userName,
24
+    method: 'get'
25
+  })
26
+}
27
+
28
+// 清空登录日志
29
+export function cleanLogininfor() {
30
+  return request({
31
+    url: '/monitor/logininfor/clean',
32
+    method: 'delete'
33
+  })
34
+}

+ 18 - 0
src/api/monitor/online.js

@@ -0,0 +1,18 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询在线用户列表
4
+export function list(query) {
5
+  return request({
6
+    url: '/monitor/online/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 强退用户
13
+export function forceLogout(tokenId) {
14
+  return request({
15
+    url: '/monitor/online/' + tokenId,
16
+    method: 'delete'
17
+  })
18
+}

+ 26 - 0
src/api/monitor/operlog.js

@@ -0,0 +1,26 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询操作日志列表
4
+export function list(query) {
5
+  return request({
6
+    url: '/monitor/operlog/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 删除操作日志
13
+export function delOperlog(operId) {
14
+  return request({
15
+    url: '/monitor/operlog/' + operId,
16
+    method: 'delete'
17
+  })
18
+}
19
+
20
+// 清空操作日志
21
+export function cleanOperlog() {
22
+  return request({
23
+    url: '/monitor/operlog/clean',
24
+    method: 'delete'
25
+  })
26
+}

+ 9 - 0
src/api/monitor/server.js

@@ -0,0 +1,9 @@
1
+import request from '@/utils/request'
2
+
3
+// 获取服务信息
4
+export function getServer() {
5
+  return request({
6
+    url: '/monitor/server',
7
+    method: 'get'
8
+  })
9
+}

+ 44 - 0
src/api/system/category.js

@@ -0,0 +1,44 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询查获物品分类列表
4
+export function listCategory(query) {
5
+  return request({
6
+    url: '/system/category/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询查获物品分类详细
13
+export function getCategory(id) {
14
+  return request({
15
+    url: '/system/category/' + id,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增查获物品分类
21
+export function addCategory(data) {
22
+  return request({
23
+    url: '/system/category',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改查获物品分类
30
+export function updateCategory(data) {
31
+  return request({
32
+    url: '/system/category',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除查获物品分类
39
+export function delCategory(id) {
40
+  return request({
41
+    url: '/system/category/' + id,
42
+    method: 'delete'
43
+  })
44
+}

+ 44 - 0
src/api/system/checkCategory.js

@@ -0,0 +1,44 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询检查项分类列表
4
+export function listCheckCategory(query) {
5
+  return request({
6
+    url: '/system/checkCategory/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询检查项分类详细
13
+export function getCheckCategory(id) {
14
+  return request({
15
+    url: '/system/checkCategory/' + id,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增检查项分类
21
+export function addCheckCategory(data) {
22
+  return request({
23
+    url: '/system/checkCategory',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改检查项分类
30
+export function updateCheckCategory(data) {
31
+  return request({
32
+    url: '/system/checkCategory',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除检查项分类
39
+export function delCheckCategory(id) {
40
+  return request({
41
+    url: '/system/checkCategory/' + id,
42
+    method: 'delete'
43
+  })
44
+}

+ 14 - 0
src/api/system/common.js

@@ -0,0 +1,14 @@
1
+import request from '@/utils/request'
2
+
3
+/*
4
+ * 查询分类下拉树结构
5
+ * @param {*} treeType ITEM_CATEGORY  查获物品分类   POSITION  位置   CHECK_POINT 检查部位  CHECK_CATEGORY 检查分类
6
+ * @returns 
7
+ */
8
+export function treeSelectByType(treeType,maxLevel,lable) {
9
+    return request({
10
+      url: '/dataConfig/dataConfigTree',
11
+      method: 'get',
12
+      params: {treeType,lable,maxLevel}
13
+    })
14
+  }

+ 60 - 0
src/api/system/config.js

@@ -0,0 +1,60 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询参数列表
4
+export function listConfig(query) {
5
+  return request({
6
+    url: '/system/config/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询参数详细
13
+export function getConfig(configId) {
14
+  return request({
15
+    url: '/system/config/' + configId,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 根据参数键名查询参数值
21
+export function getConfigKey(configKey) {
22
+  return request({
23
+    url: '/system/config/configKey/' + configKey,
24
+    method: 'get'
25
+  })
26
+}
27
+
28
+// 新增参数配置
29
+export function addConfig(data) {
30
+  return request({
31
+    url: '/system/config',
32
+    method: 'post',
33
+    data: data
34
+  })
35
+}
36
+
37
+// 修改参数配置
38
+export function updateConfig(data) {
39
+  return request({
40
+    url: '/system/config',
41
+    method: 'put',
42
+    data: data
43
+  })
44
+}
45
+
46
+// 删除参数配置
47
+export function delConfig(configId) {
48
+  return request({
49
+    url: '/system/config/' + configId,
50
+    method: 'delete'
51
+  })
52
+}
53
+
54
+// 刷新参数缓存
55
+export function refreshCache() {
56
+  return request({
57
+    url: '/system/config/refreshCache',
58
+    method: 'delete'
59
+  })
60
+}

+ 52 - 0
src/api/system/dept.js

@@ -0,0 +1,52 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询部门列表
4
+export function listDept(query) {
5
+  return request({
6
+    url: '/system/dept/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询部门列表(排除节点)
13
+export function listDeptExcludeChild(deptId) {
14
+  return request({
15
+    url: '/system/dept/list/exclude/' + deptId,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 查询部门详细
21
+export function getDept(deptId) {
22
+  return request({
23
+    url: '/system/dept/' + deptId,
24
+    method: 'get'
25
+  })
26
+}
27
+
28
+// 新增部门
29
+export function addDept(data) {
30
+  return request({
31
+    url: '/system/dept',
32
+    method: 'post',
33
+    data: data
34
+  })
35
+}
36
+
37
+// 修改部门
38
+export function updateDept(data) {
39
+  return request({
40
+    url: '/system/dept',
41
+    method: 'put',
42
+    data: data
43
+  })
44
+}
45
+
46
+// 删除部门
47
+export function delDept(deptId) {
48
+  return request({
49
+    url: '/system/dept/' + deptId,
50
+    method: 'delete'
51
+  })
52
+}

+ 52 - 0
src/api/system/dict/data.js

@@ -0,0 +1,52 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询字典数据列表
4
+export function listData(query) {
5
+  return request({
6
+    url: '/system/dict/data/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询字典数据详细
13
+export function getData(dictCode) {
14
+  return request({
15
+    url: '/system/dict/data/' + dictCode,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 根据字典类型查询字典数据信息
21
+export function getDicts(dictType) {
22
+  return request({
23
+    url: '/system/dict/data/type/' + dictType,
24
+    method: 'get'
25
+  })
26
+}
27
+
28
+// 新增字典数据
29
+export function addData(data) {
30
+  return request({
31
+    url: '/system/dict/data',
32
+    method: 'post',
33
+    data: data
34
+  })
35
+}
36
+
37
+// 修改字典数据
38
+export function updateData(data) {
39
+  return request({
40
+    url: '/system/dict/data',
41
+    method: 'put',
42
+    data: data
43
+  })
44
+}
45
+
46
+// 删除字典数据
47
+export function delData(dictCode) {
48
+  return request({
49
+    url: '/system/dict/data/' + dictCode,
50
+    method: 'delete'
51
+  })
52
+}

+ 60 - 0
src/api/system/dict/type.js

@@ -0,0 +1,60 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询字典类型列表
4
+export function listType(query) {
5
+  return request({
6
+    url: '/system/dict/type/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询字典类型详细
13
+export function getType(dictId) {
14
+  return request({
15
+    url: '/system/dict/type/' + dictId,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增字典类型
21
+export function addType(data) {
22
+  return request({
23
+    url: '/system/dict/type',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改字典类型
30
+export function updateType(data) {
31
+  return request({
32
+    url: '/system/dict/type',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除字典类型
39
+export function delType(dictId) {
40
+  return request({
41
+    url: '/system/dict/type/' + dictId,
42
+    method: 'delete'
43
+  })
44
+}
45
+
46
+// 刷新字典缓存
47
+export function refreshCache() {
48
+  return request({
49
+    url: '/system/dict/type/refreshCache',
50
+    method: 'delete'
51
+  })
52
+}
53
+
54
+// 获取字典选择框列表
55
+export function optionselect() {
56
+  return request({
57
+    url: '/system/dict/type/optionselect',
58
+    method: 'get'
59
+  })
60
+}

+ 44 - 0
src/api/system/generator.js

@@ -0,0 +1,44 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询编码code自增列表
4
+export function listGenerator(query) {
5
+  return request({
6
+    url: '/system/generator/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询编码code自增详细
13
+export function getGenerator(id) {
14
+  return request({
15
+    url: '/system/generator/' + id,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增编码code自增
21
+export function addGenerator(data) {
22
+  return request({
23
+    url: '/system/generator',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改编码code自增
30
+export function updateGenerator(data) {
31
+  return request({
32
+    url: '/system/generator',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除编码code自增
39
+export function delGenerator(id) {
40
+  return request({
41
+    url: '/system/generator/' + id,
42
+    method: 'delete'
43
+  })
44
+}

+ 44 - 0
src/api/system/item.js

@@ -0,0 +1,44 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询查获物品列表
4
+export function listItem(query) {
5
+  return request({
6
+    url: '/system/item/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询查获物品详细
13
+export function getItem(id) {
14
+  return request({
15
+    url: '/system/item/' + id,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增查获物品
21
+export function addItem(data) {
22
+  return request({
23
+    url: '/system/item',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改查获物品
30
+export function updateItem(data) {
31
+  return request({
32
+    url: '/system/item',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除查获物品
39
+export function delItem(id) {
40
+  return request({
41
+    url: '/system/item/' + id,
42
+    method: 'delete'
43
+  })
44
+}

+ 60 - 0
src/api/system/menu.js

@@ -0,0 +1,60 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询菜单列表
4
+export function listMenu(query) {
5
+  return request({
6
+    url: '/system/menu/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询菜单详细
13
+export function getMenu(menuId) {
14
+  return request({
15
+    url: '/system/menu/' + menuId,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 查询菜单下拉树结构
21
+export function treeselect() {
22
+  return request({
23
+    url: '/system/menu/treeselect',
24
+    method: 'get'
25
+  })
26
+}
27
+
28
+// 根据角色ID查询菜单下拉树结构
29
+export function roleMenuTreeselect(roleId) {
30
+  return request({
31
+    url: '/system/menu/roleMenuTreeselect/' + roleId,
32
+    method: 'get'
33
+  })
34
+}
35
+
36
+// 新增菜单
37
+export function addMenu(data) {
38
+  return request({
39
+    url: '/system/menu',
40
+    method: 'post',
41
+    data: data
42
+  })
43
+}
44
+
45
+// 修改菜单
46
+export function updateMenu(data) {
47
+  return request({
48
+    url: '/system/menu',
49
+    method: 'put',
50
+    data: data
51
+  })
52
+}
53
+
54
+// 删除菜单
55
+export function delMenu(menuId) {
56
+  return request({
57
+    url: '/system/menu/' + menuId,
58
+    method: 'delete'
59
+  })
60
+}

+ 44 - 0
src/api/system/notice.js

@@ -0,0 +1,44 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询公告列表
4
+export function listNotice(query) {
5
+  return request({
6
+    url: '/system/notice/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询公告详细
13
+export function getNotice(noticeId) {
14
+  return request({
15
+    url: '/system/notice/' + noticeId,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增公告
21
+export function addNotice(data) {
22
+  return request({
23
+    url: '/system/notice',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改公告
30
+export function updateNotice(data) {
31
+  return request({
32
+    url: '/system/notice',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除公告
39
+export function delNotice(noticeId) {
40
+  return request({
41
+    url: '/system/notice/' + noticeId,
42
+    method: 'delete'
43
+  })
44
+}

+ 44 - 0
src/api/system/point.js

@@ -0,0 +1,44 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询检查部位列表
4
+export function listPoint(query) {
5
+  return request({
6
+    url: '/system/point/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询检查部位详细
13
+export function getPoint(id) {
14
+  return request({
15
+    url: '/system/point/' + id,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增检查部位
21
+export function addPoint(data) {
22
+  return request({
23
+    url: '/system/point',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改检查部位
30
+export function updatePoint(data) {
31
+  return request({
32
+    url: '/system/point',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除检查部位
39
+export function delPoint(id) {
40
+  return request({
41
+    url: '/system/point/' + id,
42
+    method: 'delete'
43
+  })
44
+}

+ 44 - 0
src/api/system/position.js

@@ -0,0 +1,44 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询位置列表
4
+export function listPosition(query) {
5
+  return request({
6
+    url: '/system/position/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询位置详细
13
+export function getPosition(id) {
14
+  return request({
15
+    url: '/system/position/' + id,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增位置
21
+export function addPosition(data) {
22
+  return request({
23
+    url: '/system/position',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改位置
30
+export function updatePosition(data) {
31
+  return request({
32
+    url: '/system/position',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除位置
39
+export function delPosition(id) {
40
+  return request({
41
+    url: '/system/position/' + id,
42
+    method: 'delete'
43
+  })
44
+}

+ 52 - 0
src/api/system/post.js

@@ -0,0 +1,52 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询岗位列表
4
+export function listPost(query) {
5
+  return request({
6
+    url: '/system/post/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询岗位详细
13
+export function getPost(postId) {
14
+  return request({
15
+    url: '/system/post/' + postId,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增岗位
21
+export function addPost(data) {
22
+  return request({
23
+    url: '/system/post',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改岗位
30
+export function updatePost(data) {
31
+  return request({
32
+    url: '/system/post',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除岗位
39
+export function delPost(postId) {
40
+  return request({
41
+    url: '/system/post/' + postId,
42
+    method: 'delete'
43
+  })
44
+}
45
+
46
+
47
+export function listAllTree () {
48
+  return request({
49
+    url: '/system/post/listAllTree',
50
+    method: 'get'
51
+  })
52
+}

+ 44 - 0
src/api/system/project.js

@@ -0,0 +1,44 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询检查项目列表
4
+export function listProject(query) {
5
+  return request({
6
+    url: '/system/project/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询检查项目详细
13
+export function getProject(id) {
14
+  return request({
15
+    url: '/system/project/' + id,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增检查项目
21
+export function addProject(data) {
22
+  return request({
23
+    url: '/system/project',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改检查项目
30
+export function updateProject(data) {
31
+  return request({
32
+    url: '/system/project',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除检查项目
39
+export function delProject(id) {
40
+  return request({
41
+    url: '/system/project/' + id,
42
+    method: 'delete'
43
+  })
44
+}

+ 119 - 0
src/api/system/role.js

@@ -0,0 +1,119 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询角色列表
4
+export function listRole(query) {
5
+  return request({
6
+    url: '/system/role/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询角色详细
13
+export function getRole(roleId) {
14
+  return request({
15
+    url: '/system/role/' + roleId,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增角色
21
+export function addRole(data) {
22
+  return request({
23
+    url: '/system/role',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改角色
30
+export function updateRole(data) {
31
+  return request({
32
+    url: '/system/role',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 角色数据权限
39
+export function dataScope(data) {
40
+  return request({
41
+    url: '/system/role/dataScope',
42
+    method: 'put',
43
+    data: data
44
+  })
45
+}
46
+
47
+// 角色状态修改
48
+export function changeRoleStatus(roleId, status) {
49
+  const data = {
50
+    roleId,
51
+    status
52
+  }
53
+  return request({
54
+    url: '/system/role/changeStatus',
55
+    method: 'put',
56
+    data: data
57
+  })
58
+}
59
+
60
+// 删除角色
61
+export function delRole(roleId) {
62
+  return request({
63
+    url: '/system/role/' + roleId,
64
+    method: 'delete'
65
+  })
66
+}
67
+
68
+// 查询角色已授权用户列表
69
+export function allocatedUserList(query) {
70
+  return request({
71
+    url: '/system/role/authUser/allocatedList',
72
+    method: 'get',
73
+    params: query
74
+  })
75
+}
76
+
77
+// 查询角色未授权用户列表
78
+export function unallocatedUserList(query) {
79
+  return request({
80
+    url: '/system/role/authUser/unallocatedList',
81
+    method: 'get',
82
+    params: query
83
+  })
84
+}
85
+
86
+// 取消用户授权角色
87
+export function authUserCancel(data) {
88
+  return request({
89
+    url: '/system/role/authUser/cancel',
90
+    method: 'put',
91
+    data: data
92
+  })
93
+}
94
+
95
+// 批量取消用户授权角色
96
+export function authUserCancelAll(data) {
97
+  return request({
98
+    url: '/system/role/authUser/cancelAll',
99
+    method: 'put',
100
+    params: data
101
+  })
102
+}
103
+
104
+// 授权用户选择
105
+export function authUserSelectAll(data) {
106
+  return request({
107
+    url: '/system/role/authUser/selectAll',
108
+    method: 'put',
109
+    params: data
110
+  })
111
+}
112
+
113
+// 根据角色ID查询部门树结构
114
+export function deptTreeSelect(roleId) {
115
+  return request({
116
+    url: '/system/role/deptTree/' + roleId,
117
+    method: 'get'
118
+  })
119
+}

+ 53 - 0
src/api/system/sql.js

@@ -0,0 +1,53 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询动态sql执行config列表
4
+export function listSql(query) {
5
+  return request({
6
+    url: '/system/sql/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+
12
+// 查询动态sql执行config详细
13
+export function getSql(id) {
14
+  return request({
15
+    url: '/system/sql/' + id,
16
+    method: 'get'
17
+  })
18
+}
19
+
20
+// 新增动态sql执行config
21
+export function addSql(data) {
22
+  return request({
23
+    url: '/system/sql',
24
+    method: 'post',
25
+    data: data
26
+  })
27
+}
28
+
29
+// 修改动态sql执行config
30
+export function updateSql(data) {
31
+  return request({
32
+    url: '/system/sql',
33
+    method: 'put',
34
+    data: data
35
+  })
36
+}
37
+
38
+// 删除动态sql执行config
39
+export function delSql(id) {
40
+  return request({
41
+    url: '/system/sql/' + id,
42
+    method: 'delete'
43
+  })
44
+}
45
+
46
+
47
+export function executeSqlByKeyAndParam(sqlKey, param){
48
+  return request({
49
+    url: '/system/sql/executeSqlByKeyAndParam/' + sqlKey,
50
+    method: 'post',
51
+    data: param
52
+  })
53
+}

+ 136 - 0
src/api/system/user.js

@@ -0,0 +1,136 @@
1
+import request from '@/utils/request'
2
+import { parseStrEmpty } from "@/utils/ruoyi";
3
+
4
+// 查询用户列表
5
+export function listUser(query) {
6
+  return request({
7
+    url: '/system/user/list',
8
+    method: 'get',
9
+    params: query
10
+  })
11
+}
12
+
13
+// 查询用户详细
14
+export function getUser(userId) {
15
+  return request({
16
+    url: '/system/user/' + parseStrEmpty(userId),
17
+    method: 'get'
18
+  })
19
+}
20
+
21
+// 新增用户
22
+export function addUser(data) {
23
+  return request({
24
+    url: '/system/user',
25
+    method: 'post',
26
+    data: data
27
+  })
28
+}
29
+
30
+// 修改用户
31
+export function updateUser(data) {
32
+  return request({
33
+    url: '/system/user',
34
+    method: 'put',
35
+    data: data
36
+  })
37
+}
38
+
39
+// 删除用户
40
+export function delUser(userId) {
41
+  return request({
42
+    url: '/system/user/' + userId,
43
+    method: 'delete'
44
+  })
45
+}
46
+
47
+// 用户密码重置
48
+export function resetUserPwd(userId, password) {
49
+  const data = {
50
+    userId,
51
+    password
52
+  }
53
+  return request({
54
+    url: '/system/user/resetPwd',
55
+    method: 'put',
56
+    data: data
57
+  })
58
+}
59
+
60
+// 用户状态修改
61
+export function changeUserStatus(userId, status) {
62
+  const data = {
63
+    userId,
64
+    status
65
+  }
66
+  return request({
67
+    url: '/system/user/changeStatus',
68
+    method: 'put',
69
+    data: data
70
+  })
71
+}
72
+
73
+// 查询用户个人信息
74
+export function getUserProfile() {
75
+  return request({
76
+    url: '/system/user/profile',
77
+    method: 'get'
78
+  })
79
+}
80
+
81
+// 修改用户个人信息
82
+export function updateUserProfile(data) {
83
+  return request({
84
+    url: '/system/user/profile',
85
+    method: 'put',
86
+    data: data
87
+  })
88
+}
89
+
90
+// 用户密码重置
91
+export function updateUserPwd(oldPassword, newPassword) {
92
+  const data = {
93
+    oldPassword,
94
+    newPassword
95
+  }
96
+  return request({
97
+    url: '/system/user/profile/updatePwd',
98
+    method: 'put',
99
+    data: data
100
+  })
101
+}
102
+
103
+// 用户头像上传
104
+export function uploadAvatar(data) {
105
+  return request({
106
+    url: '/system/user/profile/avatar',
107
+    method: 'post',
108
+    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
109
+    data: data
110
+  })
111
+}
112
+
113
+// 查询授权角色
114
+export function getAuthRole(userId) {
115
+  return request({
116
+    url: '/system/user/authRole/' + userId,
117
+    method: 'get'
118
+  })
119
+}
120
+
121
+// 保存授权角色
122
+export function updateAuthRole(data) {
123
+  return request({
124
+    url: '/system/user/authRole',
125
+    method: 'put',
126
+    params: data
127
+  })
128
+}
129
+
130
+// 查询部门下拉树结构
131
+export function deptTreeSelect() {
132
+  return request({
133
+    url: '/system/user/deptTree',
134
+    method: 'get'
135
+  })
136
+}

+ 85 - 0
src/api/tool/gen.js

@@ -0,0 +1,85 @@
1
+import request from '@/utils/request'
2
+
3
+// 查询生成表数据
4
+export function listTable(query) {
5
+  return request({
6
+    url: '/tool/gen/list',
7
+    method: 'get',
8
+    params: query
9
+  })
10
+}
11
+// 查询db数据库列表
12
+export function listDbTable(query) {
13
+  return request({
14
+    url: '/tool/gen/db/list',
15
+    method: 'get',
16
+    params: query
17
+  })
18
+}
19
+
20
+// 查询表详细信息
21
+export function getGenTable(tableId) {
22
+  return request({
23
+    url: '/tool/gen/' + tableId,
24
+    method: 'get'
25
+  })
26
+}
27
+
28
+// 修改代码生成信息
29
+export function updateGenTable(data) {
30
+  return request({
31
+    url: '/tool/gen',
32
+    method: 'put',
33
+    data: data
34
+  })
35
+}
36
+
37
+// 导入表
38
+export function importTable(data) {
39
+  return request({
40
+    url: '/tool/gen/importTable',
41
+    method: 'post',
42
+    params: data
43
+  })
44
+}
45
+
46
+// 创建表
47
+export function createTable(data) {
48
+  return request({
49
+    url: '/tool/gen/createTable',
50
+    method: 'post',
51
+    params: data
52
+  })
53
+}
54
+
55
+// 预览生成代码
56
+export function previewTable(tableId) {
57
+  return request({
58
+    url: '/tool/gen/preview/' + tableId,
59
+    method: 'get'
60
+  })
61
+}
62
+
63
+// 删除表数据
64
+export function delTable(tableId) {
65
+  return request({
66
+    url: '/tool/gen/' + tableId,
67
+    method: 'delete'
68
+  })
69
+}
70
+
71
+// 生成代码(自定义路径)
72
+export function genCode(tableName) {
73
+  return request({
74
+    url: '/tool/gen/genCode/' + tableName,
75
+    method: 'get'
76
+  })
77
+}
78
+
79
+// 同步数据库
80
+export function synchDb(tableName) {
81
+  return request({
82
+    url: '/tool/gen/synchDb/' + tableName,
83
+    method: 'get'
84
+  })
85
+}

二進制
src/assets/401_images/401.gif