diff --git a/.env.development b/.env.development
index 9ab76bb..764306d 100644
--- a/.env.development
+++ b/.env.development
@@ -6,7 +6,7 @@ VITE_APP_ENV = 'development'
# 开发环境
# 李陈杰 209
-VITE_APP_BASE_API = 'http://192.168.110.180:8899'
+VITE_APP_BASE_API = 'http://192.168.110.149:8899'
# 曾涛
# VITE_APP_BASE_API = 'http://192.168.110.180:8899'
# 罗成
diff --git a/package.json b/package.json
index 58746c4..62a70bc 100644
--- a/package.json
+++ b/package.json
@@ -69,7 +69,8 @@
"vue-types": "5.1.3",
"vue3-print-nb": "^0.1.4",
"vue3-scroll-seamless": "^1.0.6",
- "vxe-table": "4.5.22"
+ "vxe-table": "4.5.22",
+ "xlsx": "^0.18.5"
},
"devDependencies": {
"@eslint/js": "9.15.0",
diff --git a/src/api/design/received/index.ts b/src/api/design/received/index.ts
index f8bbbdd..848f53a 100644
--- a/src/api/design/received/index.ts
+++ b/src/api/design/received/index.ts
@@ -24,3 +24,11 @@ export const exportWord = (params) => {
method: 'post'
});
};
+// 导出模版
+export const exportExcel = (params) => {
+ return request({
+ url: '/design/collect/exportExcel',
+ method: 'post',
+ params: params
+ });
+};
diff --git a/src/api/project/project/index.ts b/src/api/project/project/index.ts
index cd3d1d7..460927c 100644
--- a/src/api/project/project/index.ts
+++ b/src/api/project/project/index.ts
@@ -195,3 +195,35 @@ export const changeProject = (id: string | number) => {
method: 'get'
});
};
+/**
+ * 打卡规则
+ * @param id
+ */
+export const attendanceRuleEdit = (data) => {
+ return request({
+ url: '/project/attendanceRule',
+ method: 'put',
+ data
+ });
+};
+/**
+ * 打卡规则
+ * @param id
+ */
+export const attendanceRuleAdd = (data) => {
+ return request({
+ url: '/project/attendanceRule',
+ method: 'post',
+ data
+ });
+};
+/**
+ * 获取规则
+ * @param id
+ */
+export const byProjectIdDetail = (id) => {
+ return request({
+ url: '/project/attendanceRule/byProjectId/' + id,
+ method: 'get'
+ });
+};
diff --git a/src/views/design/received/index.vue b/src/views/design/received/index.vue
index b9fc009..0095806 100644
--- a/src/views/design/received/index.vue
+++ b/src/views/design/received/index.vue
@@ -49,7 +49,32 @@
-
资料文件清单
+
+
资料文件清单
+
+ 导入文件
+
+
+ 导出模版
+
+
添加资料
@@ -180,11 +205,11 @@ import { ref, reactive, computed, onMounted, onUnmounted, watch, getCurrentInsta
import { useUserStoreHook } from '@/store/modules/user';
import { ElMessage, ElLoading, FormRules } from 'element-plus';
import { systemUserList } from '@/api/design/appointment';
-import { collectBatch, byProjectId, exportWord } from '@/api/design/received';
+import { collectBatch, byProjectId, exportWord, exportExcel } from '@/api/design/received';
import { getUser } from '@/api/system/user';
import type { ComponentInternalInstance, ElFormInstance } from 'element-plus';
import { getInfo } from '@/api/login';
-
+import * as XLSX from 'xlsx';
// 全局实例与状态管理
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const userStore = useUserStoreHook();
@@ -200,7 +225,7 @@ const documentsFormRef = ref
();
const userList = ref([]);
const userMap = new Map(); // 存储用户ID与昵称映射
const disabledAll = ref(false); // 表单是否全部禁用
-
+const uploadRef = ref();
// 表单核心数据
const form = reactive({
projectId: currentProject.value?.id,
@@ -445,7 +470,67 @@ const onLoad = async () => {
console.error('文件导出错误:', error);
}
};
+const exportTemplate = async () => {
+ // 导出模版
+ proxy?.download(
+ 'design/collect/exportExcel',
+ {
+ deptId: userStore.deptId
+ },
+ `收资清单表格.xlsx`
+ );
+};
+const importTemplate = async (files, fileList) => {
+ // 导入表格数据
+ console.log(fileList);
+ const file = fileList[0].raw; // 获取原始文件对象
+ const reader = new FileReader();
+ let obj = {
+ id: '编码',
+ name: '人员',
+ fliename: '目录名',
+ remark: '备注'
+ };
+ reader.onload = (e) => {
+ try {
+ // 读取文件内容
+ const data = new Uint8Array(e.target.result);
+ // 解析Excel
+ const workbook = XLSX.read(data, { type: 'array' });
+
+ // 获取第一个工作表名称
+ const firstSheetName = workbook.SheetNames[0];
+ // 获取第一个工作表内容
+ const worksheet = workbook.Sheets[firstSheetName];
+
+ // 转换为JSON格式
+ const jsonData = XLSX.utils.sheet_to_json(worksheet);
+
+ if (jsonData.length === 0) {
+ ElMessage.info('Excel文件中没有数据');
+ return;
+ }
+ let arr = [];
+ jsonData.forEach((item, index) => {
+ if (item[obj.id]) {
+ arr.push({
+ id: Date.now() + index,
+ catalogueName: item[obj.name],
+ remark: item[obj.remark],
+ userId: item[obj.id]
+ });
+ }
+ });
+ form.documents = form.documents.concat(arr);
+ uploadRef.value.clearFiles();
+ console.log(arr);
+ } catch (err) {}
+ };
+
+ // 以ArrayBuffer方式读取文件
+ reader.readAsArrayBuffer(file);
+};
/** 页面挂载初始化 */
onMounted(() => {
// 先获取当前用户信息,再获取部门用户列表,最后回显表单数据
diff --git a/src/views/project/project/index.vue b/src/views/project/project/index.vue
index 04ec6b7..2adad4b 100644
--- a/src/views/project/project/index.vue
+++ b/src/views/project/project/index.vue
@@ -144,13 +144,16 @@
-->
-
+
+ 打卡规则
+
+
导入安全协议书
-
修改
删除
-
@@ -253,78 +255,6 @@
-
-
打卡设置
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
填写子项目名称
@@ -366,7 +295,7 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 无限制
+ 范围内打卡
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 预览
+ 添加
+ 移除
+
+
+
+
+
+
+
@@ -382,14 +391,14 @@
import {
addChildProject,
addProject,
- addProjectFacilities,
- addProjectPilePoint,
- addProjectSquare,
delProject,
uploadProjectFile,
getProject,
listProject,
- updateProject
+ updateProject,
+ attendanceRuleAdd,
+ attendanceRuleEdit,
+ byProjectIdDetail
} from '@/api/project/project';
import { ProjectForm, ProjectQuery, ProjectVO, childProjectQuery, locationType } from '@/api/project/project/types';
import amap from '@/components/amap/index.vue';
@@ -413,6 +422,14 @@ const polygonStatus = ref(false);
const dxfFile = ref(null);
const projectId = ref('');
const designId = ref('');
+const ruleFlag = ref(false);
+const ScopeFlag = ref(false);
+const punchRangeList = ref([
+ {
+ punchName: '',
+ punchColor: '#1983ff'
+ }
+]);
const childProjectForm = reactive({
projectName: '',
pid: '',
@@ -432,7 +449,7 @@ const fileForm = ref({
const jsonData = ref(null);
const fullscreenLoading = ref(false);
-const initFormData: ProjectForm = {
+const initFormData = {
id: undefined,
projectName: undefined,
shortName: undefined,
@@ -451,13 +468,15 @@ const initFormData: ProjectForm = {
lat: undefined,
plan: undefined,
onStreamTime: undefined,
- playCardStart: undefined,
- playCardEnd: undefined,
+ clockInTime: undefined,
+ clockOutTime: undefined,
designTotal: undefined,
securityAgreement: undefined,
sort: 0,
showHidden: undefined,
- isDelete: undefined
+ isDelete: undefined,
+ type: '1',
+ weekday: []
};
const data = reactive>({
form: { ...initFormData },
@@ -480,8 +499,6 @@ const data = reactive>({
lat: undefined,
plan: undefined,
onStreamTime: undefined,
- playCardStart: undefined,
- playCardEnd: undefined,
designTotal: undefined,
securityAgreement: undefined,
sort: undefined,
@@ -490,8 +507,8 @@ const data = reactive>({
params: {}
},
rules: {
- playCardStart: [{ required: true, message: '打卡开始时间不能为空', trigger: 'blur' }],
- playCardEnd: [{ required: true, message: '打卡结束时间不能为空', trigger: 'blur' }],
+ clockInTime: [{ required: true, message: '打卡开始时间不能为空', trigger: 'blur' }],
+ clockOutTime: [{ required: true, message: '打卡结束时间不能为空', trigger: 'blur' }],
projectName: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }],
shortName: [{ required: true, message: '项目简称不能为空', trigger: 'blur' }],
principalPhone: [{ required: true, message: '负责人电话不能为空', trigger: 'blur' }],
@@ -692,7 +709,48 @@ const handleSetChild = async () => {
}
}
};
-
+const handleScope = (row) => {
+ // 打卡范围
+ ScopeFlag.value = true;
+ projectId.value = row.id;
+};
+const scopeSubmit = () => {
+ // 提交打卡范围
+};
+// 添加规则
+const handleCheckRules = async (row?: ProjectVO) => {
+ reset();
+ const _id = row?.id || ids.value[0];
+ const res = await byProjectIdDetail(_id);
+ if (res.data) {
+ res.data.weekday = res.data.weekday.split(',');
+ Object.assign(form.value, res.data);
+ }
+ projectId.value = row.id;
+ ruleFlag.value = true;
+};
+const ruleSubmit = async () => {
+ console.log(form.value);
+ projectFormRef.value?.validate(async (valid: boolean) => {
+ if (valid) {
+ let obj = {
+ weekday: form.value.weekday.join(','),
+ projectId: projectId.value,
+ id: projectId.value,
+ clockInTime: form.value.clockInTime,
+ clockOutTime: form.value.clockOutTime,
+ type: form.value.type
+ };
+ if (form.value.id) {
+ await attendanceRuleEdit(obj);
+ } else {
+ await attendanceRuleAdd(obj);
+ }
+ ruleFlag.value = false;
+ await getList();
+ }
+ });
+};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download(