diff --git a/main/.env.development b/main/.env.development
index 93c922a..5413cd1 100644
--- a/main/.env.development
+++ b/main/.env.development
@@ -16,5 +16,5 @@ VITE_APP_UPLOAD_API = '/uploadApis'
# VITE_APP_BASE_URL = 'http://47.109.205.240:8080'
# VITE_APP_UPLOAD_URL = 'http://47.109.205.240:9300'
# 内网接口地址
-VITE_APP_BASE_URL = 'http://192.168.18.74:8080'
-VITE_APP_UPLOAD_URL = 'http://192.168.18.74:8080'
+VITE_APP_BASE_URL = 'http://192.168.18.99:8080'
+VITE_APP_UPLOAD_URL = 'http://192.168.18.99:8080'
diff --git a/sub-government-affairs-service/.env.development b/sub-government-affairs-service/.env.development
index 9ba5ee0..7a86ca4 100644
--- a/sub-government-affairs-service/.env.development
+++ b/sub-government-affairs-service/.env.development
@@ -13,5 +13,5 @@ VITE_APP_UPLOAD_API = '/uploadApis'
# VITE_APP_UPLOAD_URL = 'http://47.109.205.240:9300'
# 内网接口地址
-VITE_APP_BASE_URL = 'http://192.168.18.74:8080'
-VITE_APP_UPLOAD_URL = 'http://192.168.18.74:8080'
+VITE_APP_BASE_URL = 'http://192.168.18.99:8080'
+VITE_APP_UPLOAD_URL = 'http://192.168.18.99:8080'
diff --git a/sub-government-affairs-service/src/apis/landResourceManagement/landInspection/index.js b/sub-government-affairs-service/src/apis/landResourceManagement/landInspection/index.js
index 2a98d82..a884ea1 100644
--- a/sub-government-affairs-service/src/apis/landResourceManagement/landInspection/index.js
+++ b/sub-government-affairs-service/src/apis/landResourceManagement/landInspection/index.js
@@ -66,6 +66,13 @@ export function createInspectionResult(data) {
data,
});
}
+// 巡查结果-批量新增(POST)
+export function createInspectionResultBatch(data) {
+ return request('/land-resource/inspection/result/saveBatch', {
+ method: 'POST',
+ data,
+ });
+}
// 巡查结果-删除(DELETE)
export function deleteInspectionResult(id) {
return request(`/land-resource/inspection/result/${id}`, {
diff --git a/sub-government-affairs-service/src/components/FileUploader/index.vue b/sub-government-affairs-service/src/components/FileUploader/index.vue
new file mode 100644
index 0000000..e4990ca
--- /dev/null
+++ b/sub-government-affairs-service/src/components/FileUploader/index.vue
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
diff --git a/sub-government-affairs-service/src/router/modules/resource.js b/sub-government-affairs-service/src/router/modules/resource.js
index 4ef2491..2055121 100644
--- a/sub-government-affairs-service/src/router/modules/resource.js
+++ b/sub-government-affairs-service/src/router/modules/resource.js
@@ -2,7 +2,7 @@ import Layout from '@/layouts/index.vue';
// import annualplanRouters from './annualplan';
import statisticsRoutes from './statisticAnalysis';
import landsRoutes from './lands';
-import dictRoutes from './dict';
+// import dictRoutes from './dict';
export default [
{
@@ -48,7 +48,7 @@ export default [
// ...annualplanRouters,
...landsRoutes,
// ...statisticsRoutes,
- ...dictRoutes,
+ // ...dictRoutes,
],
},
];
diff --git a/sub-government-affairs-service/src/views/landManage/component/landPartol/index.vue b/sub-government-affairs-service/src/views/landManage/component/landPartol/index.vue
index 172098f..27788f2 100644
--- a/sub-government-affairs-service/src/views/landManage/component/landPartol/index.vue
+++ b/sub-government-affairs-service/src/views/landManage/component/landPartol/index.vue
@@ -15,7 +15,7 @@
导出
-
+
@@ -71,7 +71,7 @@
@@ -90,29 +90,27 @@
- 是
- 否
+ 是
+ 否
-
-
+
+
-
-
-
-
+
+
-
+
-
-
+
+
@@ -150,6 +155,7 @@ import { ref, reactive, watch, onMounted, computed, nextTick } from 'vue';
import { CRUD_OPTIONS } from '@/config';
import { ElMessage } from 'element-plus';
import { useActionPermissions } from '@/hooks/useActionPermissions';
+import { useUserStore } from '@/store/modules/user';
import {
createLandInspection,
deleteLandInspection,
@@ -159,6 +165,7 @@ import {
fetchLandInspectionList,
exportLandInspection,
createInspectionResult,
+ createInspectionResultBatch,
deleteInspectionResult,
getInspectionResultDetail,
} from '@/apis/landResourceManagement/landInspection/index';
@@ -167,6 +174,9 @@ const dialogTitle = ref('新增');
const visible = ref(false);
const isReadonlyInfo = ref(false);
const isReadonlyRegist = ref(false);
+const UserStore = useUserStore();
+const user = UserStore.getUserInfo();
+console.log('admin 属性:', user.admin);
const pageData = ref({
currentPage: 1,
@@ -205,7 +215,7 @@ const illegalForm = ref({
illegalTypeCode: '', // 违法类型代码
illegalTypeName: '', // 违法类型名称
desc: '', // 违法描述
- img: '111', // 违法图片
+ img: '', // 违法图片
status: '', // 状态
});
const illegalForms = ref([{ ...illegalForm.value }]);
@@ -224,7 +234,7 @@ const crudOptions = reactive({
{ label: '巡查对象', prop: 'inspectionTarget' },
{ label: '注意事项', prop: 'notes' },
{ label: '是否违法', prop: 'isIllegal' },
- { label: '状态', prop: 'inspectionStatus' },
+ { label: '状态', prop: 'inspectionStatusName' },
],
actions: [
{
@@ -322,9 +332,17 @@ const handleView = async (id) => {
const response = await getLandInspectionDetail(id);
taskForm.value = response.data;
const arr = response.data.inspectionResults;
- if (arr && Array.isArray(arr)) {
- illegalForms.value = arr;
- }
+ illegalForms.value = arr ? arr : [];
+ illegalForms.value.forEach((item) => {
+ // 如果后端只给了一个 img 字符串
+ if (item.img) {
+ // 直接包成数组
+ item.illegalImages = [item.img];
+ } else {
+ // 没图时给空数组
+ item.illegalImages = [];
+ }
+ });
isReadonlyInfo.value = true;
if (taskForm.value.inspectionUsers && Array.isArray(taskForm.value.inspectionUsers)) {
taskForm.value.taskUserIds = taskForm.value.inspectionUsers.map((user) => user.userId);
@@ -394,8 +412,12 @@ const handleViewResult = async (row) => {
};
// 删除表单
-const handleRemoveForm = (index) => {
- illegalForms.value.splice(index, 1);
+const handleRemoveForm = async (index) => {
+ if (illegalForms.value[index].id) {
+ await deleteInspectionResult(illegalForms.value[index].id);
+ } else {
+ illegalForms.value.splice(index, 1);
+ }
};
const handleSubmit = async () => {
@@ -420,8 +442,30 @@ const handleSubmit = async () => {
visible.value = false;
await getData();
} else if (dialogTitle.value === '结果登记') {
- response = await createInspectionResult(illegalForm.value);
+ // 1. 只保留没有 id 的新记录,并给它们补全 img 字段
+ const payload = illegalForms.value
+ .filter((item) => !item.id)
+ .map((item) => {
+ // 安全取第一张图
+ const firstImage = Array.isArray(item.illegalImages) && item.illegalImages.length ? item.illegalImages[0] : '';
+ return {
+ ...item,
+ img: firstImage,
+ };
+ });
+
+ // 2. 如果没有新记录,直接提示并返回
+ if (payload.length === 0) {
+ ElMessage.warning('没有需要登记的新违法记录');
+ return;
+ }
+
+ // 3. 调用批量创建接口 —— 按后端期待的结构传参
+ response = await createInspectionResultBatch(payload);
+
ElMessage.success(response?.msg || '结果登记成功');
+
+ // 4. 完成后重新拉列表、关闭弹窗
await getData();
}
// 可刷新表格数据
@@ -467,7 +511,13 @@ function handleSizeChange(val) {
// 页面权限控制相关
// ---------------------------------------------------------------------
+// 如果user.admin是true就是operator,否则是inspector
const role = ref('operator');
+if (user.admin) {
+ role.value = 'operator';
+} else {
+ role.value = 'inspector';
+}
// 所有操作项
const allActions = [
{ name: '查看', icon: 'view', key: 'view', event: ({ row }) => handleView(row.id) },
@@ -482,7 +532,7 @@ const allActions = [
// 权限表(角色 -> 可操作项)
const permissionMap = {
admin: ['operator', 'inspector'], // 继承 operator 和 inspector 的权限
- operator: ['view', 'edit', 'delete', 'publish', 'back', 'rePublish', 'result', 'viewResult'],
+ operator: ['view', 'edit', 'delete', 'publish', 'back', 'rePublish', 'viewResult'],
inspector: ['result', 'viewResult'],
};
// 状态控制表(状态码 -> 可操作项)
@@ -492,8 +542,36 @@ const statusMap = {
'01': ['viewResult'],
'02': ['view', 'edit', 'delete', 'rePublish'],
};
-// 使用封装 Hook
-// const { actions } = useActionPermissions(role, status, allActions, permissionMap, statusMap);
+function getActions(row) {
+ // 1. 先拿到当前角色对应的“原始权限”列表(可能是 action.key 也可能是继承的子角色名)
+ let raw = permissionMap[role.value] || [];
+
+ // 2. 如果 raw 里有子角色(即 permissionMap 中也存在该 key),则把它平铺展开
+ const expanded = raw.reduce((acc, key) => {
+ if (permissionMap[key]) {
+ // key 是个角色,取它的 action.key 列表
+ acc.push(...permissionMap[key]);
+ } else {
+ // key 不是角色,直接当作 action.key
+ acc.push(key);
+ }
+ return acc;
+ }, []);
+
+ // 去重
+ const roleAllowed = Array.from(new Set(expanded));
+
+ // 3. 根据当前行状态拿到状态允许的 action.key
+ // 假设 row.inspectionStatus 或 row.status 存储了状态码
+ const statusKey = row.inspectionStatus ?? row.status;
+ const statusAllowed = statusMap[statusKey] || [];
+
+ // 4. 最终只取角色和状态都允许的 key
+ const finalKeys = roleAllowed.filter((key) => statusAllowed.includes(key));
+
+ // 5. 根据 finalKeys 过滤 allActions,并保持原始顺序
+ return allActions.filter((a) => finalKeys.includes(a.key));
+}