333
This commit is contained in:
parent
3b05fcb81a
commit
6f10685aa8
|
|
@ -5,7 +5,7 @@ VITE_APP_API_HOST = 'http://localhost:8888/'
|
|||
|
||||
# 开发环境
|
||||
VITE_APP_BASE_API = 'http://localhost:8888/'
|
||||
# VITE_APP_BASE_API = 'https://gift.zpc-xy.com/'
|
||||
# VITE_APP_BASE_API = 'https://wc.zpc-xy.com/'
|
||||
|
||||
# 路由前缀
|
||||
VITE_APP_ROUTER_PREFIX = '/'
|
||||
|
|
@ -14,4 +14,4 @@ VITE_APP_ROUTER_PREFIX = '/'
|
|||
VITE_APP_UPLOAD_URL = 'Common/UploadFile'
|
||||
|
||||
#socket API
|
||||
VITE_APP_SOCKET_API = 'https://gift.zpc-xy.com/msghub'
|
||||
VITE_APP_SOCKET_API = 'https://wc.zpc-xy.com/msghub'
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<link rel="icon" href="/favicon.png">
|
||||
<title>抚顺电机客户福利平台后台管理</title>
|
||||
<link rel="icon" href="/favicon.jpg">
|
||||
<title>工作相机</title>
|
||||
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
|
||||
<style>
|
||||
html,
|
||||
|
|
|
|||
BIN
logo.png
BIN
logo.png
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 110 KiB |
BIN
public/favicon.jpg
Normal file
BIN
public/favicon.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 110 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB |
57
src/api/business/camworker.js
Normal file
57
src/api/business/camworker.js
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 工作人员记录分页查询
|
||||
* @param {查询条件} data
|
||||
*/
|
||||
export function listCamWorker(query) {
|
||||
return request({
|
||||
url: 'business/CamWorker/list',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工作人员记录
|
||||
* @param data
|
||||
*/
|
||||
export function addCamWorker(data) {
|
||||
return request({
|
||||
url: 'business/CamWorker',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 修改工作人员记录
|
||||
* @param data
|
||||
*/
|
||||
export function updateCamWorker(data) {
|
||||
return request({
|
||||
url: 'business/CamWorker',
|
||||
method: 'PUT',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 获取工作人员记录详情
|
||||
* @param {Id}
|
||||
*/
|
||||
export function getCamWorker(id) {
|
||||
return request({
|
||||
url: 'business/CamWorker/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工作人员记录
|
||||
* @param {主键} pid
|
||||
*/
|
||||
export function delCamWorker(pid) {
|
||||
return request({
|
||||
url: 'business/CamWorker/delete/' + pid,
|
||||
method: 'POST'
|
||||
})
|
||||
}
|
||||
30
src/api/business/camworkers.js
Normal file
30
src/api/business/camworkers.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import request from '@/utils/request'
|
||||
import { downFile } from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 月报表分页查询
|
||||
* @param {查询条件} data
|
||||
*/
|
||||
export function listCamWorkers(query) {
|
||||
return request({
|
||||
url: 'business/CamWorkers/list',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取月报表详情
|
||||
* @param {Id}
|
||||
*/
|
||||
export function getCamWorkers(id) {
|
||||
return request({
|
||||
url: 'business/CamWorkers/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出月报表
|
||||
export async function exportCamWorkers(query) {
|
||||
await downFile('business/CamWorkers/export', { ...query })
|
||||
}
|
||||
62
src/api/business/camworkrecord.js
Normal file
62
src/api/business/camworkrecord.js
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
import request from '@/utils/request'
|
||||
import { downFile } from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 工作记录分页查询
|
||||
* @param {查询条件} data
|
||||
*/
|
||||
export function listCamWorkrecord(query) {
|
||||
return request({
|
||||
url: 'business/CamWorkrecord/list',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工作记录
|
||||
* @param data
|
||||
*/
|
||||
export function addCamWorkrecord(data) {
|
||||
return request({
|
||||
url: 'business/CamWorkrecord',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 修改工作记录
|
||||
* @param data
|
||||
*/
|
||||
export function updateCamWorkrecord(data) {
|
||||
return request({
|
||||
url: 'business/CamWorkrecord',
|
||||
method: 'PUT',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 获取工作记录详情
|
||||
* @param {Id}
|
||||
*/
|
||||
export function getCamWorkrecord(id) {
|
||||
return request({
|
||||
url: 'business/CamWorkrecord/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工作记录
|
||||
* @param {主键} pid
|
||||
*/
|
||||
export function delCamWorkrecord(pid) {
|
||||
return request({
|
||||
url: 'business/CamWorkrecord/delete/' + pid,
|
||||
method: 'POST'
|
||||
})
|
||||
}
|
||||
// 导出工作记录
|
||||
export async function exportCamWorkrecord(query) {
|
||||
await downFile('business/CamWorkrecord/export', { ...query })
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 110 KiB |
286
src/views/business/CamWorker.vue
Normal file
286
src/views/business/CamWorker.vue
Normal file
|
|
@ -0,0 +1,286 @@
|
|||
<!--
|
||||
* @Descripttion: (工作人员记录/cam_worker)
|
||||
* @Author: (admin)
|
||||
* @Date: (2025-08-18)
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<el-form :model="queryParams" label-position="right" inline ref="queryRef" v-show="showSearch" @submit.prevent>
|
||||
<el-form-item>
|
||||
<el-button icon="search" type="primary" @click="handleQuery">{{ $t('btn.search') }}</el-button>
|
||||
<el-button icon="refresh" @click="resetQuery">{{ $t('btn.reset') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 工具区域 -->
|
||||
<el-row :gutter="15" class="mb10">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" v-hasPermi="['camworker:add']" plain icon="plus" @click="handleAdd">
|
||||
{{ $t('btn.add') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
:data="dataList"
|
||||
v-loading="loading"
|
||||
ref="table"
|
||||
border
|
||||
header-cell-class-name="el-table-header-cell"
|
||||
highlight-current-row
|
||||
@sort-change="sortChange"
|
||||
>
|
||||
<el-table-column prop="id" label="主键" align="center" v-if="columns.showColumn('id')"/>
|
||||
<el-table-column prop="workrecordId" label="施工记录Id" align="center" v-if="columns.showColumn('workrecordId')"/>
|
||||
<el-table-column prop="workerName" label="人员" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('workerName')"/>
|
||||
<el-table-column prop="createTime" label="创建时间" :show-overflow-tooltip="true" v-if="columns.showColumn('createTime')"/>
|
||||
<el-table-column prop="updateTime" label="更新时间" :show-overflow-tooltip="true" v-if="columns.showColumn('updateTime')"/>
|
||||
<el-table-column label="操作" width="160">
|
||||
<template #default="scope">
|
||||
<el-button type="success" size="small" icon="edit" title="编辑" v-hasPermi="['camworker:edit']" @click="handleUpdate(scope.row)"></el-button>
|
||||
<el-button type="danger" size="small" icon="delete" title="删除" v-hasPermi="['camworker:delete']" @click="handleDelete(scope.row)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
|
||||
<el-dialog :title="title" :lock-scroll="false" v-model="open" >
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-row :gutter="20">
|
||||
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="施工记录Id" prop="workrecordId">
|
||||
<el-input v-model.number="form.workrecordId" placeholder="请输入施工记录Id" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="人员" prop="workerName">
|
||||
<el-input v-model="form.workerName" placeholder="请输入人员" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="form.createTime"
|
||||
type="datetime"
|
||||
placeholder="选择日期时间"
|
||||
value-format="YYYY-MM-DD HH:mm:ss">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-date-picker
|
||||
v-model="form.updateTime"
|
||||
type="datetime"
|
||||
placeholder="选择日期时间"
|
||||
value-format="YYYY-MM-DD HH:mm:ss">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer v-if="opertype != 3">
|
||||
<el-button text @click="cancel">{{ $t('btn.cancel') }}</el-button>
|
||||
<el-button type="primary" :loading="state.submitLoading" @click="submitForm">{{ $t('btn.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="camworker">
|
||||
import { listCamWorker,
|
||||
addCamWorker, delCamWorker,
|
||||
updateCamWorker,getCamWorker,
|
||||
}
|
||||
from '@/api/business/camworker.js'
|
||||
const { proxy } = getCurrentInstance()
|
||||
const ids = ref([])
|
||||
const loading = ref(false)
|
||||
const showSearch = ref(true)
|
||||
const queryParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
sort: 'Id',
|
||||
sortType: 'desc',
|
||||
})
|
||||
const columns = ref([
|
||||
{ visible: true, align: 'center', type: '', prop: 'id', label: '主键' },
|
||||
{ visible: true, align: 'center', type: '', prop: 'workrecordId', label: '施工记录Id' },
|
||||
{ visible: true, align: 'center', type: '', prop: 'workerName', label: '人员' ,showOverflowTooltip: true },
|
||||
{ visible: true, align: 'center', type: '', prop: 'createTime', label: '创建时间' ,showOverflowTooltip: true },
|
||||
{ visible: true, align: 'center', type: '', prop: 'updateTime', label: '更新时间' ,showOverflowTooltip: true },
|
||||
//{ visible: false, prop: 'actions', label: '操作', type: 'slot', width: '160' }
|
||||
])
|
||||
const total = ref(0)
|
||||
const dataList = ref([])
|
||||
const queryRef = ref()
|
||||
const defaultTime = ref([new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)])
|
||||
|
||||
|
||||
var dictParams = [
|
||||
]
|
||||
|
||||
|
||||
function getList(){
|
||||
loading.value = true
|
||||
listCamWorker(queryParams).then(res => {
|
||||
const { code, data } = res
|
||||
if (code == 200) {
|
||||
dataList.value = data.result
|
||||
total.value = data.totalNum
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 查询
|
||||
function handleQuery() {
|
||||
queryParams.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
// 重置查询操作
|
||||
function resetQuery(){
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
// 自定义排序
|
||||
function sortChange(column) {
|
||||
var sort = undefined
|
||||
var sortType = undefined
|
||||
|
||||
if (column.prop != null && column.order != null) {
|
||||
sort = column.prop
|
||||
sortType = column.order
|
||||
|
||||
}
|
||||
queryParams.sort = sort
|
||||
queryParams.sortType = sortType
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/*************** form操作 ***************/
|
||||
const formRef = ref()
|
||||
const title = ref('')
|
||||
// 操作类型 1、add 2、edit 3、view
|
||||
const opertype = ref(0)
|
||||
const open = ref(false)
|
||||
const state = reactive({
|
||||
single: true,
|
||||
multiple: true,
|
||||
submitLoading: false,
|
||||
form: {},
|
||||
rules: {
|
||||
workrecordId: [{ required: true, message: "施工记录Id不能为空", trigger: "blur" , type: "number" }],
|
||||
workerName: [{ required: true, message: "人员不能为空", trigger: "blur" }],
|
||||
},
|
||||
options: {
|
||||
}
|
||||
})
|
||||
|
||||
const { form, rules, options, single, multiple } = toRefs(state)
|
||||
|
||||
// 关闭dialog
|
||||
function cancel(){
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 重置表单
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
workrecordId: null,
|
||||
workerName: null,
|
||||
createTime: null,
|
||||
updateTime: null,
|
||||
};
|
||||
proxy.resetForm("formRef")
|
||||
}
|
||||
|
||||
|
||||
// 添加按钮操作
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true
|
||||
state.submitLoading = false
|
||||
title.value = '添加工作人员记录'
|
||||
opertype.value = 1
|
||||
}
|
||||
// 修改按钮操作
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
state.submitLoading = false
|
||||
const id = row.id || ids.value
|
||||
getCamWorker(id).then((res) => {
|
||||
const { code, data } = res
|
||||
if (code == 200) {
|
||||
open.value = true
|
||||
title.value = '修改工作人员记录'
|
||||
opertype.value = 2
|
||||
|
||||
form.value = {
|
||||
...data,
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 添加&修改 表单提交
|
||||
function submitForm() {
|
||||
proxy.$refs["formRef"].validate((valid) => {
|
||||
if (valid) {
|
||||
state.submitLoading = true
|
||||
|
||||
if (form.value.id != undefined && opertype.value === 2) {
|
||||
updateCamWorker(form.value).then((res) => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addCamWorker(form.value).then((res) => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
state.submitLoading = false
|
||||
}, 800)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 删除按钮操作
|
||||
function handleDelete(row) {
|
||||
const Ids = row.id || ids.value
|
||||
|
||||
proxy
|
||||
.$confirm('是否确认删除参数编号为"' + Ids + '"的数据项?', "警告", {
|
||||
confirmButtonText: proxy.$t('common.ok'),
|
||||
cancelButtonText: proxy.$t('common.cancel'),
|
||||
type: "warning",
|
||||
})
|
||||
.then(function () {
|
||||
return delCamWorker(Ids)
|
||||
})
|
||||
.then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
handleQuery()
|
||||
</script>
|
||||
214
src/views/business/CamWorkers.vue
Normal file
214
src/views/business/CamWorkers.vue
Normal file
|
|
@ -0,0 +1,214 @@
|
|||
<!--
|
||||
* @Descripttion: (月报表/cam_workers)
|
||||
* @Author: (admin)
|
||||
* @Date: (2025-08-19)
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<el-form :model="queryParams" label-position="right" inline ref="queryRef" v-show="showSearch" @submit.prevent>
|
||||
<el-form-item label="人员名称" prop="workerName">
|
||||
<el-input v-model="queryParams.workerName" placeholder="请输入人员名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="时间">
|
||||
<el-date-picker style="width: 200px" v-model="queryParams.yearMonth" type="month" value-format="YYYY-MM" placeholder="请选择月份">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="search" type="primary" @click="handleQuery">{{ $t('btn.search') }}</el-button>
|
||||
<el-button icon="refresh" @click="resetQuery">{{ $t('btn.reset') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 工具区域 -->
|
||||
<el-row :gutter="15" class="mb10">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="download" @click="handleExport" v-hasPermi="['camworkers:export']">
|
||||
{{ $t('btn.export') }}
|
||||
</el-button>
|
||||
<el-button type="warning" plain icon="download" @click="downExport" v-hasPermi="['camworkers:export']"> 下载照片ZIP </el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
:data="dataList"
|
||||
v-loading="loading"
|
||||
ref="table"
|
||||
border
|
||||
header-cell-class-name="el-table-header-cell"
|
||||
highlight-current-row
|
||||
@sort-change="sortChange">
|
||||
<el-table-column prop="yearMonth" label="时间" align="center" v-if="columns.showColumn('yearMonth')" />
|
||||
<el-table-column prop="deptName" label="部门名称" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('deptName')" />
|
||||
<el-table-column prop="workerName" label="人员名称" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('workerName')" />
|
||||
<el-table-column prop="workDays" label="工作天数" align="center" v-if="columns.showColumn('workDays')" />
|
||||
</el-table>
|
||||
|
||||
<el-dialog :title="title" :lock-scroll="false" v-model="open">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="时间" prop="yearMonth">
|
||||
<el-input v-model="form.yearMonth" placeholder="请输入时间" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="部门名称" prop="deptName">
|
||||
<el-input v-model="form.deptName" placeholder="请输入部门名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="人员名称" prop="workerName">
|
||||
<el-input v-model="form.workerName" placeholder="请输入人员名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="工作天数" prop="workDays">
|
||||
<el-input v-model.number="form.workDays" placeholder="请输入工作天数" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer v-if="opertype != 3">
|
||||
<el-button text @click="cancel">{{ $t('btn.cancel') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="camworkers">
|
||||
import { listCamWorkers, getCamWorkers } from '@/api/business/camworkers.js'
|
||||
const { proxy } = getCurrentInstance()
|
||||
const ids = ref([])
|
||||
const loading = ref(false)
|
||||
const showSearch = ref(true)
|
||||
const queryParams = reactive({
|
||||
workerName: undefined,
|
||||
yearMonth: undefined
|
||||
})
|
||||
const columns = ref([
|
||||
{ visible: true, align: 'center', type: '', prop: 'yearMonth', label: '时间' },
|
||||
{ visible: true, align: 'center', type: '', prop: 'deptName', label: '部门名称', showOverflowTooltip: true },
|
||||
{ visible: true, align: 'center', type: '', prop: 'workerName', label: '人员名称', showOverflowTooltip: true },
|
||||
{ visible: true, align: 'center', type: '', prop: 'workDays', label: '工作天数' }
|
||||
])
|
||||
const total = ref(0)
|
||||
const dataList = ref([])
|
||||
const queryRef = ref()
|
||||
|
||||
var dictParams = []
|
||||
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listCamWorkers(queryParams).then((res) => {
|
||||
const { code, data } = res
|
||||
if (code == 200) {
|
||||
dataList.value = data
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 查询
|
||||
function handleQuery() {
|
||||
getList()
|
||||
}
|
||||
|
||||
// 重置查询操作
|
||||
function resetQuery() {
|
||||
proxy.resetForm('queryRef')
|
||||
handleQuery()
|
||||
}
|
||||
// 自定义排序
|
||||
function sortChange(column) {
|
||||
var sort = undefined
|
||||
var sortType = undefined
|
||||
|
||||
if (column.prop != null && column.order != null) {
|
||||
sort = column.prop
|
||||
sortType = column.order
|
||||
}
|
||||
queryParams.sort = sort
|
||||
queryParams.sortType = sortType
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/*************** form操作 ***************/
|
||||
const formRef = ref()
|
||||
const title = ref('')
|
||||
// 操作类型 1、add 2、edit 3、view
|
||||
const opertype = ref(0)
|
||||
const open = ref(false)
|
||||
const state = reactive({
|
||||
single: true,
|
||||
multiple: true,
|
||||
submitLoading: false,
|
||||
form: {},
|
||||
rules: {
|
||||
yearMonth: [{ required: true, message: '时间不能为空', trigger: 'blur' }],
|
||||
deptName: [{ required: true, message: '部门名称不能为空', trigger: 'blur' }],
|
||||
workerName: [{ required: true, message: '人员名称不能为空', trigger: 'blur' }],
|
||||
workDays: [{ required: true, message: '工作天数不能为空', trigger: 'blur', type: 'number' }]
|
||||
},
|
||||
options: {}
|
||||
})
|
||||
|
||||
const { form, rules, options, single, multiple } = toRefs(state)
|
||||
|
||||
// 关闭dialog
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 重置表单
|
||||
function reset() {
|
||||
form.value = {
|
||||
yearMonth: null,
|
||||
deptName: null,
|
||||
workerName: null,
|
||||
workDays: null
|
||||
}
|
||||
proxy.resetForm('formRef')
|
||||
}
|
||||
|
||||
// 添加&修改 表单提交
|
||||
function submitForm() {
|
||||
proxy.$refs['formRef'].validate((valid) => {
|
||||
if (valid) {
|
||||
state.submitLoading = true
|
||||
|
||||
if (form.value.id != undefined && opertype.value === 2) {
|
||||
} else {
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 导出按钮操作
|
||||
function handleExport() {
|
||||
proxy
|
||||
.$confirm('是否确认导出月报表数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
await proxy.downFile('/business/CamWorkers/export', { ...queryParams })
|
||||
})
|
||||
}
|
||||
function downExport() {
|
||||
proxy
|
||||
.$confirm('是否确认导出月报表数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
await proxy.downFile('/getDownloadZip?yearMoney=' + queryParams.yearMonth, {})
|
||||
})
|
||||
}
|
||||
handleQuery()
|
||||
</script>
|
||||
890
src/views/business/CamWorkrecord.vue
Normal file
890
src/views/business/CamWorkrecord.vue
Normal file
|
|
@ -0,0 +1,890 @@
|
|||
<!--
|
||||
* @Descripttion: (工作记录/cam_workrecord)
|
||||
* @Author: (admin)
|
||||
* @Date: (2025-08-18)
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<el-form :model="queryParams" label-position="right" inline ref="queryRef" v-show="showSearch" @submit.prevent>
|
||||
<el-form-item label="拍照时间">
|
||||
<el-date-picker
|
||||
style="width: 200px"
|
||||
v-model="dateRangeRecordTime"
|
||||
type="daterange"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
:default-time="defaultTime">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门名称" prop="deptName">
|
||||
<el-input v-model="queryParams.deptName" placeholder="请输入部门名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="拍照地址" prop="address">
|
||||
<el-input v-model="queryParams.address" placeholder="请输入拍照地址" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工作内容" prop="content">
|
||||
<el-input v-model="queryParams.content" placeholder="请输入工作内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="statusName">
|
||||
<el-select clearable v-model="queryParams.statusName" placeholder="请选择状态">
|
||||
<el-option v-for="item in options.sys_construction_status" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue">
|
||||
<span class="fl">{{ item.dictLabel }}</span>
|
||||
<span class="fr" style="color: var(--el-text-color-secondary)">{{ item.dictValue }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="search" type="primary" @click="handleQuery">{{ $t('btn.search') }}</el-button>
|
||||
<el-button icon="refresh" @click="resetQuery">{{ $t('btn.reset') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- 工具区域 -->
|
||||
<el-row :gutter="15" class="mb10">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" v-hasPermi="['camworkrecord:add']" plain icon="plus" @click="handleAdd">
|
||||
{{ $t('btn.add') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" :disabled="single" v-hasPermi="['camworkrecord:edit']" plain icon="edit" @click="handleUpdate">
|
||||
{{ $t('btn.edit') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" :disabled="multiple" v-hasPermi="['camworkrecord:delete']" plain icon="delete" @click="handleDelete">
|
||||
{{ $t('btn.delete') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="download" @click="handleExport" v-hasPermi="['camworkrecord:export']"> 导出 </el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
:data="dataList"
|
||||
v-loading="loading"
|
||||
ref="table"
|
||||
border
|
||||
stripe
|
||||
header-cell-class-name="table-header-cell"
|
||||
row-class-name="table-row-cell"
|
||||
highlight-current-row
|
||||
@sort-change="sortChange"
|
||||
@selection-change="handleSelectionChange"
|
||||
class="work-record-table">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column prop="id" label="主键" width="80" align="center" v-if="columns.showColumn('id')" />
|
||||
<el-table-column
|
||||
prop="deptName"
|
||||
width="120"
|
||||
label="部门名称"
|
||||
align="center"
|
||||
:show-overflow-tooltip="true"
|
||||
v-if="columns.showColumn('deptName')" />
|
||||
<el-table-column prop="imageUrl" width="140" label="图片" align="center" v-if="columns.showColumn('imageUrl')">
|
||||
<template #default="scope">
|
||||
<div class="image-container">
|
||||
<ImagePreview class="table-image" :src="scope.row.imageUrl"></ImagePreview>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="address"
|
||||
width="220"
|
||||
label="地址信息"
|
||||
align="center"
|
||||
:show-overflow-tooltip="true"
|
||||
v-if="columns.showColumn('address')">
|
||||
<template #default="scope">
|
||||
<div class="info-group">
|
||||
<div class="info-item">
|
||||
<span class="info-label">拍照时间:</span>
|
||||
<span class="info-value">{{ scope.row.recordTime }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">经度:</span>
|
||||
<span class="info-value">{{ scope.row.longitude }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">纬度:</span>
|
||||
<span class="info-value">{{ scope.row.latitude }}</span>
|
||||
</div>
|
||||
<div class="info-item address-item">
|
||||
<span class="info-label">位置:</span>
|
||||
<span class="info-value address-value">{{ scope.row.address }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="content"
|
||||
width="200"
|
||||
label="工作内容"
|
||||
align="center"
|
||||
:show-overflow-tooltip="true"
|
||||
v-if="columns.showColumn('content')">
|
||||
<template #default="scope">
|
||||
<div class="content-cell">
|
||||
<span class="content-text">{{ scope.row.content || '-' }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="worker" width="120" label="施工人员" align="center" :show-overflow-tooltip="true" v-if="columns.showColumn('worker')">
|
||||
<template #default="scope">
|
||||
<div class="worker-cell">
|
||||
<span class="worker-name">{{ scope.row.worker || '-' }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="statusName" width="100" label="状态" align="center" v-if="columns.showColumn('statusName')">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="options.sys_construction_status" :value="scope.row.statusName" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="createTime" width="200" label="时间信息" :show-overflow-tooltip="true" v-if="columns.showColumn('createTime')">
|
||||
<template #default="scope">
|
||||
<div class="info-group">
|
||||
<div class="info-item">
|
||||
<span class="info-label">拍照时间:</span>
|
||||
<span class="info-value">{{ scope.row.recordTime }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">创建时间:</span>
|
||||
<span class="info-value">{{ scope.row.createTime }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">修改时间:</span>
|
||||
<span class="info-value">{{ scope.row.updateTime }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="remarks"
|
||||
width="240"
|
||||
label="其它信息"
|
||||
align="center"
|
||||
:show-overflow-tooltip="true"
|
||||
v-if="columns.showColumn('remarks')">
|
||||
<template #default="scope">
|
||||
<div class="info-group">
|
||||
<div class="coordinate-section">
|
||||
<div class="section-title">WGS84坐标系</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">经度:</span>
|
||||
<span class="info-value">{{ scope.row.remarksDic?.location?.lng || '-' }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">纬度:</span>
|
||||
<span class="info-value">{{ scope.row.remarksDic?.location?.lat || '-' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="coordinate-section">
|
||||
<div class="section-title">GCJ02坐标系</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">经度:</span>
|
||||
<span class="info-value">{{ scope.row.remarksDic?.translate?.lng || '-' }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">纬度:</span>
|
||||
<span class="info-value">{{ scope.row.remarksDic?.translate?.lat || '-' }}</span>
|
||||
</div>
|
||||
<div class="info-item address-item">
|
||||
<span class="info-label">位置:</span>
|
||||
<span class="info-value address-value">{{ scope.row.remarksDic?.translate?.locationInfo || '-' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="140" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<div class="action-buttons">
|
||||
<el-button type="primary" size="small" icon="view" title="详情" @click="handlePreview(scope.row)"></el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
size="small"
|
||||
icon="edit"
|
||||
title="编辑"
|
||||
v-hasPermi="['camworkrecord:edit']"
|
||||
@click="handleUpdate(scope.row)"></el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
icon="delete"
|
||||
title="删除"
|
||||
v-hasPermi="['camworkrecord:delete']"
|
||||
@click="handleDelete(scope.row)"></el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<el-dialog :title="title" :lock-scroll="false" v-model="open">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="部门名称" prop="deptName">
|
||||
<el-input v-model="form.deptName" placeholder="请输入部门名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="24">
|
||||
<el-form-item label="图片" prop="imageUrl">
|
||||
<UploadImage v-model="form.imageUrl" :data="{ uploadType: 1 }" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="拍照时间" prop="recordTime">
|
||||
<el-date-picker v-model="form.recordTime" type="datetime" placeholder="选择日期时间" value-format="YYYY-MM-DD HH:mm:ss">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="经度" prop="longitude">
|
||||
<el-input v-model="form.longitude" placeholder="请输入经度" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="纬度" prop="latitude">
|
||||
<el-input v-model="form.latitude" placeholder="请输入纬度" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="拍照地址" prop="address">
|
||||
<el-input v-model="form.address" placeholder="请输入拍照地址" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="工作内容" prop="content">
|
||||
<el-input v-model="form.content" placeholder="请输入工作内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="状态" prop="statusName">
|
||||
<el-select v-model="form.statusName" placeholder="请选择状态">
|
||||
<el-option
|
||||
v-for="item in options.sys_construction_status"
|
||||
:key="item.dictValue"
|
||||
:label="item.dictLabel"
|
||||
:value="item.dictValue"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input v-model="form.remarks" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer v-if="opertype != 3">
|
||||
<el-button text @click="cancel">{{ $t('btn.cancel') }}</el-button>
|
||||
<el-button type="primary" :loading="state.submitLoading" @click="submitForm">{{ $t('btn.submit') }}</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="camworkrecord">
|
||||
import { listCamWorkrecord, addCamWorkrecord, delCamWorkrecord, updateCamWorkrecord, getCamWorkrecord } from '@/api/business/camworkrecord.js'
|
||||
const { proxy } = getCurrentInstance()
|
||||
const ids = ref([])
|
||||
const loading = ref(false)
|
||||
const showSearch = ref(true)
|
||||
const queryParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
sort: 'Id',
|
||||
sortType: 'desc',
|
||||
deptName: undefined,
|
||||
address: undefined,
|
||||
content: undefined,
|
||||
statusName: undefined
|
||||
})
|
||||
const columns = ref([
|
||||
{ visible: true, align: 'center', type: '', prop: 'id', label: '主键' },
|
||||
{ visible: true, align: 'center', type: '', prop: 'deptName', label: '部门名称', showOverflowTooltip: true },
|
||||
{ visible: true, align: 'center', type: 'img', prop: 'imageUrl', label: '图片', showOverflowTooltip: true },
|
||||
|
||||
{ visible: true, align: 'center', type: '', prop: 'address', label: '拍照信息', showOverflowTooltip: true },
|
||||
{ visible: true, align: 'center', type: '', prop: 'content', label: '工作内容', showOverflowTooltip: true },
|
||||
{ visible: true, align: 'center', type: '', prop: 'worker', label: '施工人员', showOverflowTooltip: true },
|
||||
|
||||
{
|
||||
visible: true,
|
||||
align: 'center',
|
||||
type: 'dict',
|
||||
prop: 'statusName',
|
||||
label: '状态',
|
||||
showOverflowTooltip: true,
|
||||
dictType: 'sys_construction_status'
|
||||
},
|
||||
|
||||
{ visible: true, align: 'center', type: '', prop: 'createTime', label: '创建时间', showOverflowTooltip: true },
|
||||
{ visible: true, align: 'center', type: '', prop: 'remarks', label: '其它信息', showOverflowTooltip: true }
|
||||
//{ visible: false, prop: 'actions', label: '操作', type: 'slot', width: '160' }
|
||||
])
|
||||
const total = ref(0)
|
||||
const dataList = ref([])
|
||||
const queryRef = ref()
|
||||
const defaultTime = ref([new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)])
|
||||
|
||||
// 拍照时间时间范围
|
||||
const dateRangeRecordTime = ref([])
|
||||
|
||||
var dictParams = ['sys_construction_status']
|
||||
|
||||
proxy.getDicts(dictParams).then((response) => {
|
||||
response.data.forEach((element) => {
|
||||
state.options[element.dictType] = element.list
|
||||
})
|
||||
})
|
||||
|
||||
function getList() {
|
||||
proxy.addDateRange(queryParams, dateRangeRecordTime.value, 'RecordTime')
|
||||
loading.value = true
|
||||
listCamWorkrecord(queryParams).then((res) => {
|
||||
const { code, data } = res
|
||||
if (code == 200) {
|
||||
dataList.value = data.result
|
||||
total.value = data.totalNum
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 查询
|
||||
function handleQuery() {
|
||||
queryParams.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
// 重置查询操作
|
||||
function resetQuery() {
|
||||
dateRangeRecordTime.value = []
|
||||
proxy.resetForm('queryRef')
|
||||
handleQuery()
|
||||
}
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map((item) => item.id)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
// 自定义排序
|
||||
function sortChange(column) {
|
||||
var sort = undefined
|
||||
var sortType = undefined
|
||||
|
||||
if (column.prop != null && column.order != null) {
|
||||
sort = column.prop
|
||||
sortType = column.order
|
||||
}
|
||||
queryParams.sort = sort
|
||||
queryParams.sortType = sortType
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/*************** form操作 ***************/
|
||||
const formRef = ref()
|
||||
const title = ref('')
|
||||
// 操作类型 1、add 2、edit 3、view
|
||||
const opertype = ref(0)
|
||||
const open = ref(false)
|
||||
const state = reactive({
|
||||
single: true,
|
||||
multiple: true,
|
||||
submitLoading: false,
|
||||
form: {},
|
||||
rules: {},
|
||||
options: {
|
||||
// 状态 选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
|
||||
sys_construction_status: []
|
||||
}
|
||||
})
|
||||
|
||||
const { form, rules, options, single, multiple } = toRefs(state)
|
||||
|
||||
// 关闭dialog
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 重置表单
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
deptName: null,
|
||||
imageUrl: null,
|
||||
recordTime: null,
|
||||
longitude: null,
|
||||
latitude: null,
|
||||
address: null,
|
||||
content: null,
|
||||
statusName: null,
|
||||
remarks: null,
|
||||
createTime: null,
|
||||
updateTime: null
|
||||
}
|
||||
proxy.resetForm('formRef')
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看
|
||||
* @param {*} row
|
||||
*/
|
||||
function handlePreview(row) {
|
||||
reset()
|
||||
const id = row.id
|
||||
getCamWorkrecord(id).then((res) => {
|
||||
const { code, data } = res
|
||||
if (code == 200) {
|
||||
open.value = true
|
||||
title.value = '查看'
|
||||
opertype.value = 3
|
||||
form.value = {
|
||||
...data
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 添加按钮操作
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
state.submitLoading = false
|
||||
title.value = '添加工作记录'
|
||||
opertype.value = 1
|
||||
}
|
||||
// 修改按钮操作
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
state.submitLoading = false
|
||||
const id = row.id || ids.value
|
||||
getCamWorkrecord(id).then((res) => {
|
||||
const { code, data } = res
|
||||
if (code == 200) {
|
||||
open.value = true
|
||||
title.value = '修改工作记录'
|
||||
opertype.value = 2
|
||||
|
||||
form.value = {
|
||||
...data
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 添加&修改 表单提交
|
||||
function submitForm() {
|
||||
proxy.$refs['formRef'].validate((valid) => {
|
||||
if (valid) {
|
||||
state.submitLoading = true
|
||||
|
||||
if (form.value.id != undefined && opertype.value === 2) {
|
||||
updateCamWorkrecord(form.value).then((res) => {
|
||||
proxy.$modal.msgSuccess('修改成功')
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addCamWorkrecord(form.value)
|
||||
.then((res) => {
|
||||
proxy.$modal.msgSuccess('新增成功')
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
state.submitLoading = false
|
||||
}, 800)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 删除按钮操作
|
||||
function handleDelete(row) {
|
||||
const Ids = row.id || ids.value
|
||||
|
||||
proxy
|
||||
.$confirm('是否确认删除参数编号为"' + Ids + '"的数据项?', '警告', {
|
||||
confirmButtonText: proxy.$t('common.ok'),
|
||||
cancelButtonText: proxy.$t('common.cancel'),
|
||||
type: 'warning'
|
||||
})
|
||||
.then(function () {
|
||||
return delCamWorkrecord(Ids)
|
||||
})
|
||||
.then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
})
|
||||
}
|
||||
|
||||
// 导出按钮操作
|
||||
function handleExport() {
|
||||
proxy
|
||||
.$confirm('是否确认导出工作记录数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
await proxy.downFile('/business/CamWorkrecord/export', { ...queryParams })
|
||||
})
|
||||
}
|
||||
|
||||
handleQuery()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.work-record-table {
|
||||
// 表格整体样式
|
||||
:deep(.el-table) {
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
// 表头样式
|
||||
:deep(.table-header-cell) {
|
||||
background-color: var(--el-table-header-bg-color);
|
||||
color: var(--el-table-header-text-color);
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
border: none;
|
||||
}
|
||||
|
||||
// 表格行样式
|
||||
:deep(.table-row-cell) {
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
background-color: #f5f7fa !important;
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
// 图片容器样式
|
||||
.image-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 8px;
|
||||
|
||||
.table-image {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border-radius: 6px;
|
||||
object-fit: cover;
|
||||
border: 2px solid #e4e7ed;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
transform: scale(1.05);
|
||||
border-color: #409eff;
|
||||
box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 施工人员单元格样式
|
||||
.worker-cell {
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
|
||||
.worker-name {
|
||||
display: inline-block;
|
||||
padding: 4px 8px;
|
||||
background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
|
||||
border-radius: 12px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: #1976d2;
|
||||
border: 1px solid #90caf9;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
background: linear-gradient(135deg, #bbdefb 0%, #90caf9 100%);
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 2px 8px rgba(25, 118, 210, 0.2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 工作内容单元格样式
|
||||
.content-cell {
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
|
||||
.content-text {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
line-height: 1.4;
|
||||
font-size: 13px;
|
||||
color: #303133;
|
||||
word-break: break-word;
|
||||
}
|
||||
}
|
||||
|
||||
// 信息组样式
|
||||
.info-group {
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 4px;
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
&.address-item {
|
||||
align-items: flex-start;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
color: #606266;
|
||||
font-weight: 500;
|
||||
min-width: 60px;
|
||||
margin-right: 4px;
|
||||
flex-shrink: 0;
|
||||
|
||||
.address-item & {
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.info-value {
|
||||
color: #303133;
|
||||
flex: 1;
|
||||
word-break: break-all;
|
||||
|
||||
&.address-value {
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
line-height: 1.5;
|
||||
max-height: 80px;
|
||||
overflow-y: auto;
|
||||
padding: 4px;
|
||||
background-color: #f8f9fa;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #e9ecef;
|
||||
font-size: 11px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.coordinate-section {
|
||||
margin-bottom: 8px;
|
||||
padding: 6px;
|
||||
background: #f8f9fa;
|
||||
border-radius: 4px;
|
||||
border-left: 3px solid #409eff;
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: #409eff;
|
||||
margin-bottom: 4px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 操作按钮样式
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.el-button {
|
||||
padding: 6px 8px;
|
||||
border-radius: 4px;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
&.el-button--primary {
|
||||
background: linear-gradient(135deg, #409eff 0%, #36a3f7 100%);
|
||||
border: none;
|
||||
|
||||
&:hover {
|
||||
background: linear-gradient(135deg, #36a3f7 0%, #2d8cf0 100%);
|
||||
}
|
||||
}
|
||||
|
||||
&.el-button--success {
|
||||
background: linear-gradient(135deg, #67c23a 0%, #5daf34 100%);
|
||||
border: none;
|
||||
|
||||
&:hover {
|
||||
background: linear-gradient(135deg, #5daf34 0%, #529b2e 100%);
|
||||
}
|
||||
}
|
||||
|
||||
&.el-button--danger {
|
||||
background: linear-gradient(135deg, #f56c6c 0%, #e74c3c 100%);
|
||||
border: none;
|
||||
|
||||
&:hover {
|
||||
background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 状态标签样式
|
||||
:deep(.el-tag) {
|
||||
border-radius: 12px;
|
||||
font-weight: 500;
|
||||
padding: 2px 8px;
|
||||
border: none;
|
||||
|
||||
&.el-tag--success {
|
||||
background: linear-gradient(135deg, #67c23a 0%, #5daf34 100%);
|
||||
color: white;
|
||||
}
|
||||
|
||||
&.el-tag--warning {
|
||||
background: linear-gradient(135deg, #e6a23c 0%, #d68910 100%);
|
||||
color: white;
|
||||
}
|
||||
|
||||
&.el-tag--danger {
|
||||
background: linear-gradient(135deg, #f56c6c 0%, #e74c3c 100%);
|
||||
color: white;
|
||||
}
|
||||
|
||||
&.el-tag--info {
|
||||
background: linear-gradient(135deg, #909399 0%, #7a7e83 100%);
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
|
||||
// 选择框样式
|
||||
:deep(.el-table__selection) {
|
||||
.el-checkbox {
|
||||
.el-checkbox__input {
|
||||
.el-checkbox__inner {
|
||||
border-radius: 4px;
|
||||
border: 2px solid #dcdfe6;
|
||||
|
||||
&:hover {
|
||||
border-color: #409eff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 加载状态样式
|
||||
:deep(.el-loading-mask) {
|
||||
background-color: rgba(255, 255, 255, 0.9);
|
||||
backdrop-filter: blur(2px);
|
||||
}
|
||||
}
|
||||
|
||||
// 响应式设计
|
||||
@media (max-width: 1200px) {
|
||||
.work-record-table {
|
||||
.info-group {
|
||||
.info-item {
|
||||
font-size: 11px;
|
||||
|
||||
.info-label {
|
||||
min-width: 50px;
|
||||
}
|
||||
|
||||
.info-value.address-value {
|
||||
font-size: 10px;
|
||||
max-height: 60px;
|
||||
padding: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
|
||||
.el-button {
|
||||
padding: 4px 6px;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 暗色主题适配
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.work-record-table {
|
||||
:deep(.table-row-cell) {
|
||||
&:hover {
|
||||
background-color: #2d3748 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.info-group {
|
||||
.info-item {
|
||||
.info-label {
|
||||
color: #a0aec0;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
color: #e2e8f0;
|
||||
|
||||
&.address-value {
|
||||
background-color: #2d3748;
|
||||
border-color: #4a5568;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.coordinate-section {
|
||||
background: #2d3748;
|
||||
border-left-color: #63b3ed;
|
||||
|
||||
.section-title {
|
||||
color: #63b3ed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
652
src/views/business/temp/index.vue
Normal file
652
src/views/business/temp/index.vue
Normal file
|
|
@ -0,0 +1,652 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 主页面内容 -->
|
||||
<view>
|
||||
<image class="logo" src="/static/logo.jpg"></image>
|
||||
<text class="title">{{ title }}</text>
|
||||
<view class="btn-view">
|
||||
<button type="primary" class="btn" @click="handleStartCapture">
|
||||
开始拍摄
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 隐藏的canvas用于水印处理 -->
|
||||
<canvas canvas-id="watermarkCanvas" style="
|
||||
position: fixed;
|
||||
top: -9999px;
|
||||
left: -9999px;
|
||||
width: 2000px;
|
||||
height: 2000px;
|
||||
"></canvas>
|
||||
|
||||
<!-- 弹窗内容 -->
|
||||
<uni-popup ref="popup" :is-mask-click="false" type="bottom" border-radius="0 0 0 0">
|
||||
<view class="container">
|
||||
<view style="height: 80rpx"></view>
|
||||
|
||||
<!-- 图片预览区域 -->
|
||||
<view class="preview-box">
|
||||
<text class="preview-title">图片预览</text>
|
||||
<view class="preview-img">
|
||||
<image :src="imageSrc" @click="handlePreviewImage" mode="aspectFit" class="img"></image>
|
||||
</view>
|
||||
|
||||
<!-- 图片尺寸和文件大小信息 -->
|
||||
<view class="size-info" v-if="imageSizeInfo.original.width > 0 && false">
|
||||
<text class="size-text">
|
||||
原图尺寸: {{ imageSizeInfo.original.width }} x
|
||||
{{ imageSizeInfo.original.height }}
|
||||
</text>
|
||||
<text class="size-text" v-if="imageSizeInfo.original.fileSize">
|
||||
原图大小: {{ imageSizeInfo.original.fileSize.sizeKB }} KB
|
||||
</text>
|
||||
<text class="size-text">
|
||||
水印图片尺寸: {{ imageSizeInfo.watermark.width }} x
|
||||
{{ imageSizeInfo.watermark.height }}
|
||||
</text>
|
||||
<text class="size-text" v-if="imageSizeInfo.watermark.fileSize">
|
||||
水印图片大小: {{ imageSizeInfo.watermark.fileSize.sizeKB }} KB
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 表单区域 -->
|
||||
<view class="form-item">
|
||||
<text class="label">位置:</text>
|
||||
<input v-model="locationInfo" type="text" class="input worker-input" />
|
||||
</view>
|
||||
<!-- 表单区域 -->
|
||||
<view class="form-item">
|
||||
<text class="label">请填写工作内容:</text>
|
||||
<uni-combox :candidates="candidates" :clear-able="true" placeholder="请填写工作内容"
|
||||
@select="handleComboxSelect" v-model="workContent"></uni-combox>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="label">请选择部门:</text>
|
||||
<picker :range="departments" @change="handleDeptChange">
|
||||
<view class="picker">{{ departments[deptIndex] }}</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="label">请填写施工人员:</text>
|
||||
<view v-for="(worker, index) in workers" :key="index" class="worker-row">
|
||||
<input type="text" v-model="workers[index]" class="input worker-input" />
|
||||
<view class="btns">
|
||||
<button class="btn_f" size="mini" @click="addWorker">+</button>
|
||||
<button v-if="workers.length > 0" class="btn_f" size="mini" @click="removeWorker(index)">
|
||||
-
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="label">请选择项目状态:</text>
|
||||
<picker :range="statusList" @change="handleStatusChange">
|
||||
<view class="picker">{{ statusList[statusIndex] }}</view>
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<!-- 底部操作按钮 -->
|
||||
<view class="footer">
|
||||
<button type="primary" class="btn-cancel" @click="handleRetakePhoto">
|
||||
重拍
|
||||
</button>
|
||||
<button type="primary" class="btn-cancel" @click="handleRetakeCancel">
|
||||
清空
|
||||
</button>
|
||||
<button type="primary" class="btn-submit" @click="handleSaveAndSubmit">
|
||||
保存本地并提交
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref
|
||||
} from "vue";
|
||||
import {
|
||||
getLocation,
|
||||
chooseImage,
|
||||
addWatermark,
|
||||
formatDate,
|
||||
getCachedLogo,
|
||||
saveImageToPhotosAlbum,
|
||||
imageToBase64,
|
||||
} from "../../common/utils";
|
||||
import {
|
||||
getLocationTranslate,
|
||||
getLocationGeocoder,
|
||||
} from "../../common/mapTranslateResult";
|
||||
import {
|
||||
getConfig,
|
||||
addWatermarkRecord
|
||||
} from "../../common/server";
|
||||
import {
|
||||
onLoad
|
||||
} from "@dcloudio/uni-app";
|
||||
|
||||
// ==================== 响应式数据 ====================
|
||||
// 基础数据
|
||||
const title = ref("水印相机");
|
||||
const candidates = ref([]);
|
||||
const workContent = ref(""); // 工作内容
|
||||
const popup = ref(null);
|
||||
|
||||
// 位置信息
|
||||
const locations = ref({
|
||||
location: {
|
||||
lat: null,
|
||||
lng: null,
|
||||
},
|
||||
translate: {
|
||||
lat: null,
|
||||
lng: null,
|
||||
locationInfo: null,
|
||||
},
|
||||
});
|
||||
|
||||
// 图片相关
|
||||
const imageSrc = ref("");
|
||||
const originalImageSrc = ref("");
|
||||
const imageSizeInfo = ref({
|
||||
original: {
|
||||
width: 0,
|
||||
height: 0,
|
||||
fileSize: null,
|
||||
},
|
||||
watermark: {
|
||||
width: 0,
|
||||
height: 0,
|
||||
fileSize: null,
|
||||
},
|
||||
});
|
||||
|
||||
// 表单数据
|
||||
const departments = ref(["请选择"]);
|
||||
const deptIndex = ref(0);
|
||||
const workers = ref([""]);
|
||||
const statusList = ref([]);
|
||||
const statusIndex = ref(0);
|
||||
|
||||
// 其他信息
|
||||
const locationInfo = ref("");
|
||||
const currentTime = ref("");
|
||||
let logo = ""; // 非响应式数据
|
||||
|
||||
// ==================== 事件处理函数 ====================
|
||||
// 开始拍摄
|
||||
const handleStartCapture = async () => {
|
||||
uni.showLoading({
|
||||
title: "加载中。。。",
|
||||
});
|
||||
|
||||
try {
|
||||
// 获取位置信息
|
||||
const locationData = await getLocation();
|
||||
console.log("系统坐标", locationData);
|
||||
|
||||
const location = locationData.latitude + "," + locationData.longitude;
|
||||
console.log("经纬度", location);
|
||||
|
||||
const translate = await getLocationTranslate(location);
|
||||
console.log("转换后", translate);
|
||||
|
||||
const t_location = translate.lat + "," + translate.lng;
|
||||
const geocoderResult = await getLocationGeocoder(t_location);
|
||||
console.log("地理编码结果", geocoderResult);
|
||||
|
||||
// 保存位置信息
|
||||
locations.value.location.lat = locationData.latitude;
|
||||
locations.value.location.lng = locationData.longitude;
|
||||
locations.value.translate.lat = translate.lat;
|
||||
locations.value.translate.lng = translate.lng;
|
||||
locations.value.translate.locationInfo = geocoderResult || "未知位置";
|
||||
locationInfo.value = geocoderResult || "未知位置";
|
||||
currentTime.value = new Date();
|
||||
|
||||
// 选择图片
|
||||
const image = await chooseImage();
|
||||
console.log("图片", image);
|
||||
originalImageSrc.value = image.tempFilePaths[0];
|
||||
imageSrc.value = image.tempFilePaths[0];
|
||||
|
||||
await addWatermarkToImage();
|
||||
uni.hideLoading();
|
||||
popup.value.open();
|
||||
} catch (error) {
|
||||
console.log("错误", error);
|
||||
uni.hideLoading();
|
||||
}
|
||||
};
|
||||
|
||||
// 预览图片
|
||||
const handlePreviewImage = () => {
|
||||
uni.previewImage({
|
||||
urls: [imageSrc.value]
|
||||
});
|
||||
};
|
||||
|
||||
// 表单事件处理
|
||||
const handleComboxSelect = async (value) => {
|
||||
console.log("选择的工作内容:", value);
|
||||
if (locationData[value] != null) {
|
||||
var tempData = locationData[value];
|
||||
|
||||
// 设置部门
|
||||
if (tempData.dept && departments.value.includes(tempData.dept)) {
|
||||
deptIndex.value = departments.value.indexOf(tempData.dept);
|
||||
}
|
||||
|
||||
// 设置项目状态
|
||||
if (tempData.status && statusList.value.includes(tempData.status)) {
|
||||
statusIndex.value = statusList.value.indexOf(tempData.status);
|
||||
}
|
||||
|
||||
// 设置施工人员
|
||||
if (tempData.workers && Array.isArray(tempData.workers)) {
|
||||
workers.value.splice(0, workers.value.length);
|
||||
workers.value.push(...tempData.workers);
|
||||
}
|
||||
await addWatermarkToImage(value);
|
||||
console.log("加载的历史数据:", tempData);
|
||||
}
|
||||
};
|
||||
|
||||
const handleDeptChange = (e) => {
|
||||
deptIndex.value = e.detail.value;
|
||||
};
|
||||
|
||||
const handleStatusChange = (e) => {
|
||||
statusIndex.value = e.detail.value;
|
||||
};
|
||||
|
||||
// 施工人员管理
|
||||
const addWorker = () => {
|
||||
workers.value.push("");
|
||||
};
|
||||
|
||||
const removeWorker = (index) => {
|
||||
if (workers.value.length > 1) {
|
||||
workers.value.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
// ==================== 业务逻辑函数 ====================
|
||||
// 添加水印
|
||||
const addWatermarkToImage = async (work = "") => {
|
||||
try {
|
||||
const watermarkInfo = {
|
||||
time: formatDate(currentTime.value),
|
||||
location: locationInfo.value,
|
||||
longitude: locations.value.translate.lng,
|
||||
latitude: locations.value.translate.lat,
|
||||
department: departments.value[deptIndex.value],
|
||||
workers: workers.value.filter((worker) => worker.trim() !== ""),
|
||||
status: statusList.value[statusIndex.value],
|
||||
remarks: workContent.value,
|
||||
};
|
||||
if (workContent.value == "" && work != "") {
|
||||
watermarkInfo.remarks = work;
|
||||
}
|
||||
console.log("水印信息:", watermarkInfo);
|
||||
console.log("原图路径:", originalImageSrc.value);
|
||||
|
||||
const watermarkResult = await addWatermark(
|
||||
originalImageSrc.value,
|
||||
watermarkInfo,
|
||||
logo,
|
||||
1
|
||||
);
|
||||
|
||||
console.log("水印结果:", watermarkResult);
|
||||
imageSrc.value = watermarkResult.filePath;
|
||||
imageSizeInfo.value = {
|
||||
original: watermarkResult.originalSize,
|
||||
watermark: watermarkResult.watermarkSize,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("添加水印失败:", error);
|
||||
uni.showToast({
|
||||
title: "添加水印失败",
|
||||
icon: "error",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 重新拍照
|
||||
const handleRetakePhoto = () => {
|
||||
popup.value.close();
|
||||
resetFormData();
|
||||
};
|
||||
const handleRetakeCancel = async () => {
|
||||
workers.value.splice(0, workers.value.length);
|
||||
workers.value.push("");
|
||||
statusIndex.value = 0;
|
||||
deptIndex.value = 0;
|
||||
workContent.value = "";
|
||||
loadCandidates();
|
||||
await addWatermarkToImage();
|
||||
};
|
||||
var locationData = {};
|
||||
// 保存并提交
|
||||
const handleSaveAndSubmit = async () => {
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: "保存中...",
|
||||
});
|
||||
|
||||
// 先添加水印
|
||||
await addWatermarkToImage();
|
||||
var saveData = {
|
||||
workContent: workContent.value,
|
||||
workers: workers.value.filter((worker) => worker.trim() !== ""),
|
||||
status: statusList.value[statusIndex.value],
|
||||
dept: departments.value[deptIndex.value],
|
||||
date: new Date().toISOString(), // 使用ISO格式确保时间格式一致
|
||||
};
|
||||
console.log(saveData);
|
||||
locationData[workContent.value] = saveData;
|
||||
uni.setStorageSync("locationData", locationData);
|
||||
var fromData = {
|
||||
locations: locations.value,
|
||||
workContent: workContent.value,
|
||||
workers: workers.value,
|
||||
status: statusList.value[statusIndex.value],
|
||||
dept: departments.value[deptIndex.value],
|
||||
};
|
||||
var _remarks = JSON.stringify(locations.value);
|
||||
var imageBase64 = await imageToBase64(imageSrc.value);
|
||||
console.log(fromData);
|
||||
const camRecordWorkDto = {
|
||||
// 部门名称
|
||||
DeptName: departments.value[deptIndex.value],
|
||||
// 图片地址
|
||||
Image: imageBase64,
|
||||
// 工作记录时间
|
||||
RecordTime: formatDate(currentTime.value),
|
||||
// 经度
|
||||
Longitude: locations.value.translate.lng,
|
||||
// 纬度
|
||||
Latitude: locations.value.translate.lat,
|
||||
// 工作地点
|
||||
Address: locationInfo.value,
|
||||
// 工作内容
|
||||
Content: workContent.value,
|
||||
// 状态
|
||||
StatusName: statusList.value[statusIndex.value],
|
||||
// 备注
|
||||
Remarks: _remarks,
|
||||
|
||||
// 工作人员列表
|
||||
Workers: workers.value,
|
||||
};
|
||||
var res = await addWatermarkRecord(camRecordWorkDto);
|
||||
console.log(res);
|
||||
if (res.code != 200) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "error",
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 保存水印图片到相册
|
||||
if (imageSrc.value) {
|
||||
await saveImageToPhotosAlbum(imageSrc.value);
|
||||
}
|
||||
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: "保存成功",
|
||||
icon: "success",
|
||||
});
|
||||
|
||||
handleRetakePhoto();
|
||||
} catch (error) {
|
||||
console.error("保存失败:", error);
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: "保存失败",
|
||||
icon: "error",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// ==================== 工具函数 ====================
|
||||
// 重置表单数据
|
||||
const resetFormData = () => {
|
||||
imageSrc.value = "";
|
||||
originalImageSrc.value = "";
|
||||
locationInfo.value = "";
|
||||
currentTime.value = "";
|
||||
imageSizeInfo.value = {
|
||||
original: {
|
||||
width: 0,
|
||||
height: 0,
|
||||
fileSize: null,
|
||||
},
|
||||
watermark: {
|
||||
width: 0,
|
||||
height: 0,
|
||||
fileSize: null,
|
||||
},
|
||||
};
|
||||
workers.value.splice(0, workers.value.length);
|
||||
workers.value.push("");
|
||||
statusIndex.value = 0;
|
||||
deptIndex.value = 0;
|
||||
workContent.value = "";
|
||||
loadCandidates();
|
||||
};
|
||||
|
||||
const loadCandidates = () => {
|
||||
candidates.value.splice(0, candidates.value.length);
|
||||
|
||||
// 将对象转换为数组并按时间倒序排序
|
||||
const sortedEntries = Object.entries(locationData)
|
||||
.filter(([key, data]) => data && data.date) // 过滤掉没有时间字段的数据
|
||||
.sort((a, b) => {
|
||||
const dateA = new Date(a[1].date);
|
||||
const dateB = new Date(b[1].date);
|
||||
return dateB - dateA; // 倒序排列(最新的在前)
|
||||
});
|
||||
|
||||
// 提取排序后的键名
|
||||
sortedEntries.forEach(([key, data]) => {
|
||||
console.log(`工作内容: ${key}, 时间: ${data.date}`);
|
||||
candidates.value.push(key);
|
||||
});
|
||||
};
|
||||
// ==================== 生命周期 ====================
|
||||
onLoad(async () => {
|
||||
uni.showLoading({
|
||||
title: "loading...",
|
||||
});
|
||||
|
||||
try {
|
||||
const config = await getConfig();
|
||||
console.log("配置", config);
|
||||
|
||||
logo = config.logo;
|
||||
departments.value.push(...config.deptList);
|
||||
statusList.value.push(...config.construction);
|
||||
|
||||
// 缓存logo
|
||||
await getCachedLogo(logo);
|
||||
|
||||
var _locationData = uni.getStorageSync("locationData");
|
||||
if (_locationData != null) {
|
||||
locationData = _locationData;
|
||||
loadCandidates();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("初始化失败:", error);
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.logo {
|
||||
height: 200px;
|
||||
width: 200px;
|
||||
margin: 0 auto;
|
||||
position: absolute;
|
||||
top: 25%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 100px;
|
||||
margin: 0 auto;
|
||||
position: absolute;
|
||||
bottom: 22%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 0 auto;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #000;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
top: 35%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 20rpx;
|
||||
background: #fff;
|
||||
height: 100vh;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.preview-box {
|
||||
background: #fff;
|
||||
padding: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.preview-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.preview-img {
|
||||
margin: 20rpx 0;
|
||||
width: 100%;
|
||||
height: 400rpx;
|
||||
background: #ddd;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 400rpx;
|
||||
height: 400rpx;
|
||||
}
|
||||
|
||||
.preview-info {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
text-align: left;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 10rpx;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.input {
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 8rpx;
|
||||
padding: 10rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.picker {
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 8rpx;
|
||||
padding: 10rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.worker-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.worker-input {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.btns {
|
||||
display: flex;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.btn_f {
|
||||
margin-left: 5rpx;
|
||||
}
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.btn-cancel {
|
||||
background: #007aff;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-submit {
|
||||
background: #007aff;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.watermark-btn {
|
||||
margin-top: 20rpx;
|
||||
background: #28a745;
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
padding: 10rpx 30rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.size-info {
|
||||
margin-top: 20rpx;
|
||||
padding: 20rpx;
|
||||
background: #f8f9fa;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.size-text {
|
||||
display: block;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-bottom: 10rpx;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -27,17 +27,6 @@
|
|||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :lg="8" class="mb10">
|
||||
<el-card style="height: 100%">
|
||||
<div class="text-warning mb10">{{ currentTime }} {{ weekName }}</div>
|
||||
<div class="work-wrap">
|
||||
<el-statistic title="申请数量" :value="statistics.nowCount" />
|
||||
<el-statistic title="待审核数量" :value="statistics.shenhe" />
|
||||
<el-statistic title="审核通过" :value="statistics.shenhe1" />
|
||||
<el-statistic title="审核未通过" :value="statistics.shenhe2" />
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="15">
|
||||
|
|
@ -61,7 +50,7 @@
|
|||
<script setup name="index">
|
||||
import PanelGroup from './dashboard/PanelGroup'
|
||||
import CommonMenu from './components/CommonMenu'
|
||||
import { getGiftClaimSatistics } from '@/api/business/giftclaim.js'
|
||||
|
||||
import dayjs from 'dayjs'
|
||||
// 时间插件
|
||||
import duration from 'dayjs/plugin/duration'
|
||||
|
|
@ -99,14 +88,6 @@ function handleAdd() {
|
|||
proxy.$modal.msg('请通过搜索添加')
|
||||
}
|
||||
|
||||
getGiftClaimSatistics().then((res) => {
|
||||
console.log(res)
|
||||
statistics.value.nowCount = res.data.nowCount
|
||||
statistics.value.shenhe = res.data.shenheCount
|
||||
statistics.value.shenhe1 = res.data.shenheCount1
|
||||
statistics.value.shenhe2 = res.data.shenheCount2
|
||||
})
|
||||
|
||||
function workTimeFormatter(val) {
|
||||
return dayjs.duration(val * 60, 'second').format('HH时mm分')
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user