diff --git a/src/api/scene.ts b/src/api/scene.ts index 0956614..9bfacf1 100644 --- a/src/api/scene.ts +++ b/src/api/scene.ts @@ -43,3 +43,17 @@ method: 'get', }) } +// 开始作业 +export function startApi(id: string) { + return request({ + url: `/site/start?projectId=${id}`, + method: 'post', + }) +} +// 完成作业 +export function endApi(id: string) { + return request({ + url: `/site/finish?projectId=${id}`, + method: 'post', + }) +} diff --git a/src/api/scene.ts b/src/api/scene.ts index 0956614..9bfacf1 100644 --- a/src/api/scene.ts +++ b/src/api/scene.ts @@ -43,3 +43,17 @@ method: 'get', }) } +// 开始作业 +export function startApi(id: string) { + return request({ + url: `/site/start?projectId=${id}`, + method: 'post', + }) +} +// 完成作业 +export function endApi(id: string) { + return request({ + url: `/site/finish?projectId=${id}`, + method: 'post', + }) +} diff --git a/src/views/alarm/index.vue b/src/views/alarm/index.vue index 2e29e98..f6d83d1 100644 --- a/src/views/alarm/index.vue +++ b/src/views/alarm/index.vue @@ -73,7 +73,7 @@ 4: '张三', 5: '13700000000', 6: '2023-01-01', - 7:'未处理', + 7: '未处理', }, { 1: '作业二', @@ -82,7 +82,7 @@ 4: '李四', 5: '13700000000', 6: '2023-01-01', - 7:'已处理', + 7: '已处理', }, ] total.value = list.value.length @@ -131,37 +131,43 @@ - + - + - + - + - + 删除 - + - + 消警 diff --git a/src/api/scene.ts b/src/api/scene.ts index 0956614..9bfacf1 100644 --- a/src/api/scene.ts +++ b/src/api/scene.ts @@ -43,3 +43,17 @@ method: 'get', }) } +// 开始作业 +export function startApi(id: string) { + return request({ + url: `/site/start?projectId=${id}`, + method: 'post', + }) +} +// 完成作业 +export function endApi(id: string) { + return request({ + url: `/site/finish?projectId=${id}`, + method: 'post', + }) +} diff --git a/src/views/alarm/index.vue b/src/views/alarm/index.vue index 2e29e98..f6d83d1 100644 --- a/src/views/alarm/index.vue +++ b/src/views/alarm/index.vue @@ -73,7 +73,7 @@ 4: '张三', 5: '13700000000', 6: '2023-01-01', - 7:'未处理', + 7: '未处理', }, { 1: '作业二', @@ -82,7 +82,7 @@ 4: '李四', 5: '13700000000', 6: '2023-01-01', - 7:'已处理', + 7: '已处理', }, ] total.value = list.value.length @@ -131,37 +131,43 @@ - + - + - + - + - + 删除 - + - + 消警 diff --git a/src/views/person/index.vue b/src/views/person/index.vue index 7448f74..0c1ed5b 100644 --- a/src/views/person/index.vue +++ b/src/views/person/index.vue @@ -166,39 +166,45 @@ - + - + - + - + 新增 - + 删除 - + - + 注册 - + 编辑 diff --git a/src/api/scene.ts b/src/api/scene.ts index 0956614..9bfacf1 100644 --- a/src/api/scene.ts +++ b/src/api/scene.ts @@ -43,3 +43,17 @@ method: 'get', }) } +// 开始作业 +export function startApi(id: string) { + return request({ + url: `/site/start?projectId=${id}`, + method: 'post', + }) +} +// 完成作业 +export function endApi(id: string) { + return request({ + url: `/site/finish?projectId=${id}`, + method: 'post', + }) +} diff --git a/src/views/alarm/index.vue b/src/views/alarm/index.vue index 2e29e98..f6d83d1 100644 --- a/src/views/alarm/index.vue +++ b/src/views/alarm/index.vue @@ -73,7 +73,7 @@ 4: '张三', 5: '13700000000', 6: '2023-01-01', - 7:'未处理', + 7: '未处理', }, { 1: '作业二', @@ -82,7 +82,7 @@ 4: '李四', 5: '13700000000', 6: '2023-01-01', - 7:'已处理', + 7: '已处理', }, ] total.value = list.value.length @@ -131,37 +131,43 @@ - + - + - + - + - + 删除 - + - + 消警 diff --git a/src/views/person/index.vue b/src/views/person/index.vue index 7448f74..0c1ed5b 100644 --- a/src/views/person/index.vue +++ b/src/views/person/index.vue @@ -166,39 +166,45 @@ - + - + - + - + 新增 - + 删除 - + - + 注册 - + 编辑 diff --git a/src/views/scene/components/personTable.vue b/src/views/scene/components/personTable.vue index 8da05e8..b82dc79 100644 --- a/src/views/scene/components/personTable.vue +++ b/src/views/scene/components/personTable.vue @@ -76,7 +76,7 @@ const confirmPerson = (row: any) => { const person = userListData.value[personIndex.value] person.workerName = row.workerName - person.phoneNumber = row.phoneNumber + person.workerPhoneNumber = row.phoneNumber person.deptId = row.deptId person.workerDeptName = row.deptName person.workerId = row.id @@ -128,56 +128,82 @@ - - 新增 - 删除 + + + 新增 + + + 删除 + - + - - {{ scope.row.workerName }} + + + {{ scope.row.workerName }} + - {{ scope.row.workerPhoneNumber }} + + {{ scope.row.workerPhoneNumber }} + - {{ scope.row.workerDeptName }} + + {{ scope.row.workerDeptName }} + - - {{ scope.row.hatCode }} + + + {{ scope.row.hatCode }} + - - {{ scope.row.vastCode }} + + + {{ scope.row.vastCode }} + - - {{ scope.row.braceletCode }} + + + {{ scope.row.braceletCode }} + - + 编辑 @@ -201,9 +227,8 @@ .button-area { background-color: #ccc; - padding: 10px 10px; + padding: 10px; margin-bottom: 0 !important; } - } diff --git a/src/api/scene.ts b/src/api/scene.ts index 0956614..9bfacf1 100644 --- a/src/api/scene.ts +++ b/src/api/scene.ts @@ -43,3 +43,17 @@ method: 'get', }) } +// 开始作业 +export function startApi(id: string) { + return request({ + url: `/site/start?projectId=${id}`, + method: 'post', + }) +} +// 完成作业 +export function endApi(id: string) { + return request({ + url: `/site/finish?projectId=${id}`, + method: 'post', + }) +} diff --git a/src/views/alarm/index.vue b/src/views/alarm/index.vue index 2e29e98..f6d83d1 100644 --- a/src/views/alarm/index.vue +++ b/src/views/alarm/index.vue @@ -73,7 +73,7 @@ 4: '张三', 5: '13700000000', 6: '2023-01-01', - 7:'未处理', + 7: '未处理', }, { 1: '作业二', @@ -82,7 +82,7 @@ 4: '李四', 5: '13700000000', 6: '2023-01-01', - 7:'已处理', + 7: '已处理', }, ] total.value = list.value.length @@ -131,37 +131,43 @@ - + - + - + - + - + 删除 - + - + 消警 diff --git a/src/views/person/index.vue b/src/views/person/index.vue index 7448f74..0c1ed5b 100644 --- a/src/views/person/index.vue +++ b/src/views/person/index.vue @@ -166,39 +166,45 @@ - + - + - + - + 新增 - + 删除 - + - + 注册 - + 编辑 diff --git a/src/views/scene/components/personTable.vue b/src/views/scene/components/personTable.vue index 8da05e8..b82dc79 100644 --- a/src/views/scene/components/personTable.vue +++ b/src/views/scene/components/personTable.vue @@ -76,7 +76,7 @@ const confirmPerson = (row: any) => { const person = userListData.value[personIndex.value] person.workerName = row.workerName - person.phoneNumber = row.phoneNumber + person.workerPhoneNumber = row.phoneNumber person.deptId = row.deptId person.workerDeptName = row.deptName person.workerId = row.id @@ -128,56 +128,82 @@ - - 新增 - 删除 + + + 新增 + + + 删除 + - + - - {{ scope.row.workerName }} + + + {{ scope.row.workerName }} + - {{ scope.row.workerPhoneNumber }} + + {{ scope.row.workerPhoneNumber }} + - {{ scope.row.workerDeptName }} + + {{ scope.row.workerDeptName }} + - - {{ scope.row.hatCode }} + + + {{ scope.row.hatCode }} + - - {{ scope.row.vastCode }} + + + {{ scope.row.vastCode }} + - - {{ scope.row.braceletCode }} + + + {{ scope.row.braceletCode }} + - + 编辑 @@ -201,9 +227,8 @@ .button-area { background-color: #ccc; - padding: 10px 10px; + padding: 10px; margin-bottom: 0 !important; } - } diff --git a/src/views/scene/index.vue b/src/views/scene/index.vue index 9b3b4fa..34475bd 100644 --- a/src/views/scene/index.vue +++ b/src/views/scene/index.vue @@ -6,7 +6,7 @@ @@ -146,40 +158,46 @@ - + - + - + - + - + 新增 - + 删除 - + - + 编辑 @@ -200,6 +218,19 @@ + + + + 开始 + + + 结束 + + + diff --git a/src/api/scene.ts b/src/api/scene.ts index 0956614..9bfacf1 100644 --- a/src/api/scene.ts +++ b/src/api/scene.ts @@ -43,3 +43,17 @@ method: 'get', }) } +// 开始作业 +export function startApi(id: string) { + return request({ + url: `/site/start?projectId=${id}`, + method: 'post', + }) +} +// 完成作业 +export function endApi(id: string) { + return request({ + url: `/site/finish?projectId=${id}`, + method: 'post', + }) +} diff --git a/src/views/alarm/index.vue b/src/views/alarm/index.vue index 2e29e98..f6d83d1 100644 --- a/src/views/alarm/index.vue +++ b/src/views/alarm/index.vue @@ -73,7 +73,7 @@ 4: '张三', 5: '13700000000', 6: '2023-01-01', - 7:'未处理', + 7: '未处理', }, { 1: '作业二', @@ -82,7 +82,7 @@ 4: '李四', 5: '13700000000', 6: '2023-01-01', - 7:'已处理', + 7: '已处理', }, ] total.value = list.value.length @@ -131,37 +131,43 @@ - + - + - + - + - + 删除 - + - + 消警 diff --git a/src/views/person/index.vue b/src/views/person/index.vue index 7448f74..0c1ed5b 100644 --- a/src/views/person/index.vue +++ b/src/views/person/index.vue @@ -166,39 +166,45 @@ - + - + - + - + 新增 - + 删除 - + - + 注册 - + 编辑 diff --git a/src/views/scene/components/personTable.vue b/src/views/scene/components/personTable.vue index 8da05e8..b82dc79 100644 --- a/src/views/scene/components/personTable.vue +++ b/src/views/scene/components/personTable.vue @@ -76,7 +76,7 @@ const confirmPerson = (row: any) => { const person = userListData.value[personIndex.value] person.workerName = row.workerName - person.phoneNumber = row.phoneNumber + person.workerPhoneNumber = row.phoneNumber person.deptId = row.deptId person.workerDeptName = row.deptName person.workerId = row.id @@ -128,56 +128,82 @@ - - 新增 - 删除 + + + 新增 + + + 删除 + - + - - {{ scope.row.workerName }} + + + {{ scope.row.workerName }} + - {{ scope.row.workerPhoneNumber }} + + {{ scope.row.workerPhoneNumber }} + - {{ scope.row.workerDeptName }} + + {{ scope.row.workerDeptName }} + - - {{ scope.row.hatCode }} + + + {{ scope.row.hatCode }} + - - {{ scope.row.vastCode }} + + + {{ scope.row.vastCode }} + - - {{ scope.row.braceletCode }} + + + {{ scope.row.braceletCode }} + - + 编辑 @@ -201,9 +227,8 @@ .button-area { background-color: #ccc; - padding: 10px 10px; + padding: 10px; margin-bottom: 0 !important; } - } diff --git a/src/views/scene/index.vue b/src/views/scene/index.vue index 9b3b4fa..34475bd 100644 --- a/src/views/scene/index.vue +++ b/src/views/scene/index.vue @@ -6,7 +6,7 @@ @@ -146,40 +158,46 @@ - + - + - + - + - + 新增 - + 删除 - + - + 编辑 @@ -200,6 +218,19 @@ + + + + 开始 + + + 结束 + + + diff --git a/src/views/scene/sceneEdit.vue b/src/views/scene/sceneEdit.vue index f895195..bbd31bb 100644 --- a/src/views/scene/sceneEdit.vue +++ b/src/views/scene/sceneEdit.vue @@ -67,7 +67,7 @@ // 提交 const submitForm = async (formEl: FormInstance | undefined) => { if (!formEl) { return } - await formEl.validate((valid, fields) => { + await formEl.validate((valid, _fields) => { if (valid) { ElMessageBox.confirm( '确认提交吗?', @@ -82,7 +82,8 @@ if (personListRef.value.userListData.length) { // 人员必须绑定安全设备 if (personListRef.value.userListData.every((item: any) => item.braceletCode && item.hatCode && item.vastCode)) { - ruleForm.value.deviceList = safetyTree.value.map((item: any) => ({ deviceId: item.id ? item.id : item.deviceId })) + console.log(safetyTree.value) + ruleForm.value.deviceList = safetyTree.value.map((item: any) => ({ deviceId: item.id && item.deviceId ? item.deviceId : item.id })) ruleForm.value.workerList = personListRef.value.userListData.map((item: any) => ({ workerId: item.workerId, braceletCode: item.braceletCode, hatCode: item.hatCode, vastCode: item.vastCode })) // 新增编辑 const id = $route.query.id as string @@ -92,6 +93,8 @@ ElMessage.success('修改成功') $router.go(-1) } + }).catch((_error) => { + ruleForm.value.deviceList = safetyTree.value.map((item: any) => (item.deviceCode)) }) } else { @@ -100,6 +103,8 @@ ElMessage.success('新增成功') $router.go(-1) } + }).catch((_error) => { + ruleForm.value.deviceList = safetyTree.value.map((item: any) => (item.deviceCode)) }) } } @@ -126,13 +131,14 @@ title.value = '编辑' // 获取详情 getSceneDetail(id).then((res) => { - ruleForm.value = res.data - // 展示安全树 - ruleForm.value.deviceList = res.data.deviceList.map((item: any) => item.deviceCode) + const data = JSON.parse(JSON.stringify(res.data)) + ruleForm.value = data // 备份安全树 - safetyTree.value = res.data.deviceList + safetyTree.value = data.deviceList + // 展示安全树设备 + ruleForm.value.deviceList = data.deviceList.map((item: any) => item.deviceCode) // 备份人员列表 - userList.value = res.data.workerList + userList.value = data.workerList }) } }) @@ -145,34 +151,39 @@ - + - + - - + - + - + - + - - + - - + @@ -180,7 +191,7 @@ - + @@ -224,9 +235,8 @@ .isDetail { ::v-deep { - - .el-form-item.is-required:not(.is-no-asterisk) .el-form-item__label-wrap>.el-form-item__label::before, - .el-form-item.is-required:not(.is-no-asterisk)>.el-form-item__label::before { + .el-form-item.is-required:not(.is-no-asterisk) .el-form-item__label-wrap > .el-form-item__label::before, + .el-form-item.is-required:not(.is-no-asterisk) > .el-form-item__label::before { display: none; } }