Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
姚俊旭 2025-06-10 14:03:03 +08:00
commit 9482747e01
61 changed files with 5870 additions and 2919 deletions

View File

@ -17,5 +17,4 @@ VITE_APP_UPLOAD_API = '/uploadApis'
# VITE_APP_UPLOAD_URL = 'http://47.109.205.240:9300'
# 内网接口地址
VITE_APP_BASE_URL = 'http://192.168.18.99:8080'
VITE_APP_UPLOAD_URL = 'http://192.168.18.9:9300'
VITE_APP_VIST_URL = 'http://192.168.18.99'
VITE_APP_UPLOAD_URL = 'http://192.168.18.99:8080'

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@ -1,6 +1,6 @@
<template>
<div class="platform">
<h2 class="platform-title">数字农业产业管理平台</h2>
<h2 class="platform-title">全域数字农业产业管理平台</h2>
<div class="platform-panel">
<div class="platform-panel-item">
<div class="icon"><img :src="getAssetsFile('images/platform/icon-zw.png')" /></div>
@ -51,14 +51,25 @@ const gotoPage = (row) => {
min-height: 100%;
background-image: url('@/assets/images/platform/bg.png');
background-size: cover;
.platform-title {
height: 156px;
line-height: 50px;
width: 98%;
font-size: 100px;
text-align: center;
color: #fff;
transform: skewX(-10deg); /* 沿X轴倾斜-15度 */
display: inline-block; /* 需要设置为inline-block或block */
letter-spacing: 5px;
}
&-title {
width: 1200px;
height: 156px;
margin: 0 auto 20px;
padding-top: 120px;
text-indent: -999rem;
background-image: url('@/assets/images/platform/title.png');
// text-indent: -999rem;
// background-image: url('@/assets/images/platform/title.png');
background-size: 100%;
background-repeat: no-repeat;
background-position: center;

View File

@ -14,4 +14,4 @@ VITE_APP_UPLOAD_API = '/uploadApis'
# 内网接口地址
VITE_APP_BASE_URL = 'http://192.168.18.99:8080'
VITE_APP_UPLOAD_URL = 'http://192.168.18.99:9300'
VITE_APP_UPLOAD_URL = 'http://192.168.18.99:8080'

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>政务服务</title>
<title>农业产业政务平台</title>
</head>
<body>

View File

@ -2,61 +2,75 @@
import request from '@/utils/axios';
/**
* 生产经营主体 - 新增
* @param {Object} data 经营主体数据
*/
export function saveBusinessSubject(data) {
return request({
url: '/product-business/business/businessSave',
method: 'post',
data,
});
}
/**
* 生产经营主体 - 编辑
* @param {Object} data 经营主体数据
*/
export function editBusinessSubject(data) {
return request({
url: '/product-business/business/businessEdit',
method: 'put',
data,
});
}
/**
* 生产经营主体 - 分页查询
* 农户 - 列表查询
* @param {Object} params 查询参数
*/
export function fetchBusinessSubjectList(params) {
export function fetchFarmerList(params) {
return request({
url: '/product-business/business/businessPage',
url: '/product-business/business/farmer/businessPage',
method: 'get',
params,
});
}
/**
* 生产经营主体 - 详情查询
* 农户 - 新增
* @param {Object} data 经营主体数据
*/
export function saveFarmerList(data) {
return request({
url: '/product-business/business/farmer/businessSave',
method: 'post',
data,
});
}
/**
* 农户 - 编辑
* @param {Object} data 经营主体数据
*/
export function editFarmer(data) {
return request({
url: '/product-business/business/farmer/businessEdit',
method: 'put',
data,
});
}
/**
* 农户 - 审批
* @param {Object} data 审批数据
*/
export function approveFarmer(data) {
return request({
url: '/product-business/business/farmer/businessApproval',
method: 'put',
data,
});
}
/**
* 农户 - 详情查询
* @param {string} id 主体ID
*/
export function fetchBusinessSubjectInfo(id) {
export function fetchFarmerById(id) {
return request({
url: `/product-business/business/businessInfo/${id}`,
url: `/product-business/business/farmer/businessInfo/${id}`,
method: 'get',
});
}
/**
* 生产经营主体 - 批量删除
* @param {string} businessId 主体ID
* 删除农户接口严格匹配文档规范
* @param {string|string[]} ids - 单个ID或ID数组会自动转为逗号分隔字符串
* @returns {Promise} 请求Promise
*/
export function deleteBusinessSubject(businessId) {
export function deleteFarmers(ids) {
// 统一参数格式:数组转逗号分隔字符串,非数组直接使用
const idStr = Array.isArray(ids) ? ids.join(',') : ids;
return request({
url: '/product-business/business/deleteBusiness',
url: '/product-business/business/farmer/deleteBusiness',
method: 'delete',
params: { businessId },
params: { ids: idStr },
});
}
@ -83,3 +97,11 @@ export function fetchBusinessCheckList(params) {
params,
});
}
// 农企合作社-列表查询/product-business/business/enter/businessPage
export function getEnterList(params) {
return request({
url: '/product-business/business/enter/businessPage',
method: 'get',
params,
});
}

View File

@ -0,0 +1,16 @@
import request from '@/utils/axios';
/**
* 获取种植作物分页列表
* @param {Object} params - 请求参数
* @param {string} [params.status] - 状态 0-禁用1-启用
* @param {number} [params.current] - 页码
* @param {number} [params.size] - 每页数量
* @returns {Promise<Object>} - 返回包含种植作物分页数据的 Promise
*/
export function pageCropsList(params = {}) {
return request('/land-resource/crops/page', {
method: 'GET',
params,
});
}

View File

@ -0,0 +1,19 @@
import * as plantingPlan from './plantingPlan';
import * as operationRecord from './operationRecord';
import * as landIllegal from './landIllegal';
import * as landInspection from './landInspection';
import * as gridManagement from './gridManagement';
import * as gridMemberManagement from './gridMemberManagement';
import * as basicInfoMaintenance from './basicInfoMaintenance';
import * as cropsManagement from './cropsManagement';
export default {
...plantingPlan,
...operationRecord,
...landIllegal,
...landInspection,
...gridManagement,
...gridMemberManagement,
...basicInfoMaintenance,
...cropsManagement,
};

View File

@ -0,0 +1,71 @@
import request from '@/utils/axios';
/**
* 分页查询土地列表
* @param {Object} params 请求参数
* @param {string} [params.current] 每页条数
* @param {string} [params.size] 分页
* @param {string} [params.landType] 土地类型 传入id土地资源管理/基础信息维护/土地类型列表查询
* @param {string} [params.regionCode] 区域编码
* @param {string} [params.keyword] 关键字
* @param {string} [params.gridId] 网格id
* @returns {Promise<Object>} 返回包含接口响应数据的 Promise
*/
export function getLandList(params) {
return request({
url: '/land-resource/landManage/page',
method: 'get',
params,
});
}
/**
* 保存土地基础信息
* @param {Object} [data={}] 请求数据默认为空对象
* @returns {Promise<Object>} 返回包含接口响应数据的 Promise
*/
export function saveBaseInfo(data = {}) {
return request({
url: '/land-resource/landManage/v1/saveBaseInfo',
method: 'post',
data,
});
}
/**
* 保存土地产权信息
* @param {Object} [data={}] 请求数据默认为空对象
* @returns {Promise<Object>} 返回包含接口响应数据的 Promise
*/
export function saveProperty(data = {}) {
return request({
url: '/land-resource/landManage/v1/saveProperty',
method: 'put',
data,
});
}
/**
* 编辑土地信息
* @param {Object} [data={}] 请求数据默认为空对象用于传递要编辑的土地信息
* @returns {Promise<Object>} 返回包含接口响应数据的 Promise
*/
export function editLand(data = {}) {
return request({
url: '/land-resource/landManage/edit',
method: 'post',
data,
});
}
/**
* 删除指定 ID 的土地信息
* @param {string|number} id 要删除的土地信息的 ID
* @returns {Promise<Object>} 返回包含接口响应数据的 Promise
*/
export function deleteLand(id) {
return request({
url: `/land-resource/landManage/delete/${id}`,
method: 'delete',
});
}

View File

@ -0,0 +1,68 @@
import request from '@/utils/axios';
/**
* 年度计划管理-新增
* @param {Object} data 年度计划新增数据对象
* @param {string} [data.year] 计划年份
* @param {string} [data.regionCode] 区划编码
* @param {string} [data.gridId] 网格id
* @param {string} data.planName 计划名称
* @param {string} [data.cropsId] 作物id,调用接口种植作物/列表
* @param {number} [data.plantingArea] 种植面积
* @param {string} [data.plantingMonths] 种植月份
* @param {string} [data.growthCycle] 成长周期
* @param {string} [data.note] 备注
* @param {string} [data.growthCycleUnit] 成长周期单位 1 2 3 4
* @returns {Promise<Object>} 返回包含接口响应数据的 Promise
*/
export function saveAnnual(data = {}) {
return request('/land-resource/annualManage/save', {
method: 'POST',
data,
});
}
/**
* 年度计划管理-编辑
* @param {Object} data 年度计划更新数据对象
* @param {string} [data.id] 计划 ID
* @param {string} [data.planName] 计划名称
* @param {string} [data.plantingMonths] 种植月份
* @param {number} [data.plantingArea] 种植面积
* @param {string} [data.growthCycle] 成长周期
* @param {string} [data.growthCycleUnit] 成长周期单位 1 2 3 4
* @returns {Promise<Object>} 返回包含接口响应数据的 Promise
*/
export function editAnnual(data = {}) {
return request('/land-resource/annualManage/edit', {
method: 'PUT',
data: data,
});
}
/**
* 填报实际进度
* @param {Object} annualActualAddDTO 年度计划实际进度新增数据对象
* @param {string} [annualActualAddDTO.planId] 年度计划id
* @param {number} [annualActualAddDTO.plantingArea] 实际种植面积
* @param {number} [annualActualAddDTO.plantingMonths] 实际种植月份
* @param {number} [annualActualAddDTO.growthCycle] 实际种植周期
* @returns {Promise<Object>} 返回包含接口响应数据的 Promise
*/
export function saveActualProgress(annualActualAddDTO = {}) {
return request('/land-resource/annualManage/save-actual', {
method: 'POST',
data: annualActualAddDTO,
});
}
/**
* 年度计划管理-获取详情
* @param {string} id 计划编号
* @returns {Promise<Object>} 返回包含接口响应数据的 Promise响应数据包含年度计划详情
*/
export function getAnnualDetail(id) {
return request(`/land-resource/annualManage/${id}`, {
method: 'GET',
});
}

View File

@ -0,0 +1,31 @@
src/
├── apis/
│ ├── landResourceManagement/ # 土地资源管理
│ │ ├── plantingPlan/ # 种植规划
│ │ │ ├── index.js
│ │ ├── operationRecord/ # 作业记录
│ │ │ ├── index.js
│ │ ├── landIllegal/ # 土地违法处理
│ │ │ ├── index.js
│ │ ├── landManagement/ # 土地管理
│ │ │ ├── index.js
│ │ ├── landInspection/ # 土地巡查
│ │ │ ├── index.js
│ │ ├── gridManagement/ # 网格管理
│ │ │ ├── index.js
│ │ ├── gridMemberManagement/ # 网格员管理
│ │ │ ├── index.js
│ │ ├── basicInfoMaintenance/ # 基础信息维护
│ │ │ ├── index.js
│ │ ├── cropsManagement/ # 种植作物
│ │ │ ├── index.js
│ │ ├── index.js # 土地资源管理模块统一入口
│ ├── productionEntityManagement/ # 生产经营主体管理
│ │ ├── index.js
│ ├── inputManagement/ # 投入品管理
│ │ ├── index.js
│ ├── productTraceability/ # 农产品溯源
│ │ ├── index.js
│ ├── index.js # 项目统一入口文件
├── utils/
│ ├── axios.js # 封装的请求工具

View File

@ -1,66 +1,112 @@
<template>
<div class="area-cascader-container">
<div v-if="label" class="area-cascader-label">{{ label }}</div>
<div style="display: flex; gap: 8px" :style="{ width: width + 'px' }">
<el-cascader
v-model="selectedAreaCode"
:options="areaOptions"
:props="cascaderProps"
:placeholder="areaPlaceholder"
style="flex: 1"
clearable
/>
<el-select v-model="selectedGridName" :placeholder="gridPlaceholder" style="flex: 1" clearable :disabled="!selectedAreaCode">
<el-option v-for="item in gridOptions" :key="item.gridName" :label="item.gridName" :value="item.gridName" />
</el-select>
</div>
<div class="area-cascader-container" :style="{ width: width + 'px' }">
<!-- 一行显示模式 -->
<template v-if="!splitRows">
<div v-if="label" class="area-cascader-label">{{ label }}</div>
<div style="display: flex; gap: 8px; flex: 1">
<el-cascader
v-model="selectedAreaCode"
:options="areaOptions"
:props="cascaderProps"
:placeholder="areaPlaceholder"
style="flex: 1"
clearable
/>
<span v-if="showSeparator" class="area-cascader-separator">{{ separator }}</span>
<el-select v-model="selectedGridId" :placeholder="gridPlaceholder" style="flex: 1" clearable :disabled="!selectedAreaCode">
<el-option v-for="item in gridOptions" :key="item.gridName" :label="item.gridName" :value="item.id" />
</el-select>
</div>
</template>
<!-- 两行显示模式 -->
<template v-else>
<div class="area-item">
<div class="area-cascader-label">所属行政区域</div>
<el-cascader
v-model="selectedAreaCode"
:options="areaOptions"
:props="cascaderProps"
:placeholder="areaPlaceholder"
style="flex: 1"
clearable
/>
</div>
<div class="area-item">
<div class="area-cascader-label">网格</div>
<el-select v-model="selectedGridId" :placeholder="gridPlaceholder" style="flex: 1" clearable :disabled="!selectedAreaCode">
<el-option v-for="item in gridOptions" :key="item.gridName" :label="item.gridName" :value="item.id" />
</el-select>
</div>
</template>
</div>
</template>
<script setup>
import { ref, watch, onMounted, computed } from 'vue';
import { ElCascader, ElSelect, ElOption } from 'element-plus';
import axios from 'axios';
import request from '@/utils/axios';
import { useUserStore } from '@/store/modules/user';
const props = defineProps({
value: {
type: Object,
default: () => ({}),
regionCode: {
type: String,
default: '',
},
gridId: {
type: [String, Number],
default: '',
},
label: {
type: String,
default: '所属行政区域-网格:',
default: '行政区域-网格:',
},
placeholder: {
areaPlaceholder: {
type: String,
default: '请选择区域',
},
gridPlaceholder: {
type: String,
default: '请选择网格',
},
width: {
type: [Number, String],
default: 300,
default: 500,
},
showSeparator: {
type: Boolean,
default: false,
},
separator: {
type: String,
default: '-',
},
splitRows: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(['update:value']);
const emit = defineEmits(['update:regionCode', 'update:gridId']);
const userStore = useUserStore();
const areaOptions = ref([]);
const gridOptions = ref([]);
const selectedAreaCode = ref('');
const selectedGridName = ref('');
//
const selectedAreaCode = ref(props.regionCode);
const selectedGridId = ref(props.gridId);
//
const fetchAreaData = async () => {
try {
const res = await axios.get(`${import.meta.env.VITE_APP_BASE_API}/system/area/region?areaCode=530000`, {
headers: {
authorization: userStore.token,
// 使 request params
const res = await request.get('/system/area/region', {
params: {
areaCode: '530000',
},
});
areaOptions.value = res.data?.data ?? [];
areaOptions.value = res.data ?? [];
} catch (err) {
console.error('区域数据加载失败', err);
}
@ -70,46 +116,72 @@ const fetchAreaData = async () => {
const fetchGridList = async (regionCode) => {
if (!regionCode) return;
try {
const res = await axios.get(`${import.meta.env.VITE_APP_BASE_API}/land-resource/gridManage/page?regionCode=${regionCode}`, {
headers: {
authorization: userStore.token,
// 使 request params
const res = await request.get('/land-resource/gridManage/page', {
params: {
regionCode: regionCode,
},
});
gridOptions.value = res.data?.data?.records ?? [];
gridOptions.value = res.data?.records ?? [];
} catch (err) {
console.error('网格数据加载失败', err);
}
};
//
watch(selectedAreaCode, (val) => {
selectedGridName.value = '';
fetchGridList(val);
updateValue();
const selectedAreaLabel = computed(() => {
const findLabel = (options, code) => {
for (const item of options) {
if (item.areaCode === code) return item.areaName;
if (item.areaChildVOS?.length) {
const res = findLabel(item.areaChildVOS, code);
if (res) return res;
}
}
return '';
};
return findLabel(areaOptions.value, selectedAreaCode.value);
});
//
watch(selectedGridName, () => {
updateValue();
const selectedGridLabel = computed(() => {
const item = gridOptions.value.find((g) => g.id === selectedGridId.value);
return item?.gridName || '';
});
//
//
watch(
() => props.value,
() => props.regionCode,
(val) => {
selectedAreaCode.value = val.regionCode ?? '';
selectedGridName.value = val.gridName ?? '';
},
{ immediate: true }
selectedAreaCode.value = val;
}
);
watch(
() => props.gridId,
(val) => {
selectedGridId.value = val;
}
);
//
watch(selectedAreaCode, (val) => {
emit('update:regionCode', val);
selectedGridId.value = ''; // gridId
emit('update:gridId', '');
fetchGridList(val);
});
watch(selectedGridId, (val) => {
emit('update:gridId', val);
});
// v-model:value
const updateValue = () => {
emit('update:value', {
regionCode: selectedAreaCode.value,
gridName: selectedGridName.value,
});
};
// const updateValue = () => {
// console.log('update:value', selectedAreaCode.value, selectedGridName.value, selectedGridId.value);
// emit('update:value', {
// regionCode: selectedAreaCode.value,
// gridName: selectedGridName.value,
// gridId: selectedGridId.value,
// });
// };
onMounted(() => {
fetchAreaData();
@ -128,13 +200,32 @@ const cascaderProps = computed(() => ({
<style scoped>
.area-cascader-container {
display: flex;
/* flex-direction: column; */
gap: 8px;
gap: 18px;
margin: 0;
padding: 0;
/* 分行显示时垂直排列 */
flex-direction: v-bind('splitRows ? "column" : "row"');
}
.area-cascader-label {
font-size: 14px;
color: #606266;
text-align: right;
line-height: 32px;
box-sizing: border-box;
width: 120px;
padding-right: v-bind('splitRows ? "12px" : "0"');
}
.area-cascader-separator {
align-self: center;
font-size: 16px;
color: #606266;
margin: 0;
padding: 0;
}
.area-item {
display: flex;
gap: 0;
}
</style>

View File

@ -0,0 +1,105 @@
<template>
<div class="area-select-container" :style="{ width: width + 'px' }">
<div v-if="label" class="area-select-label">{{ label }}</div>
<el-cascader
v-bind="$attrs"
v-model="selectedAreaPath"
:options="areaOptions"
:props="cascaderProps"
:placeholder="placeholder"
style="flex: 1"
clearable
/>
</div>
</template>
<script setup>
import { ref, watch, onMounted, computed } from 'vue';
import request from '@/utils/axios';
import { useUserStore } from '@/store/modules/user';
const props = defineProps({
inheritAttrs: {
type: Boolean,
default: false,
},
modelValue: {
type: Array,
default: () => [],
},
label: {
type: String,
default: '所属行政区域:',
},
placeholder: {
type: String,
default: '请选择行政区域',
},
width: {
type: [Number, String],
default: 500,
},
});
const emit = defineEmits(['update:modelValue']);
const userStore = useUserStore();
const areaOptions = ref([]);
const selectedAreaPath = ref([...props.modelValue]);
//
const cascaderProps = computed(() => ({
label: 'areaName',
value: 'areaCode',
children: 'areaChildVOS',
emitPath: true,
expandTrigger: 'hover',
}));
const fetchAreaData = async () => {
try {
const res = await request.get('/system/area/region', {
params: {
areaCode: '530000',
},
});
areaOptions.value = res.data ?? [];
} catch (err) {
console.error('加载行政区域失败', err);
}
};
// =>
watch(
() => props.modelValue,
(val) => {
selectedAreaPath.value = [...val];
}
);
// =>
watch(selectedAreaPath, (val) => {
emit('update:modelValue', val);
});
onMounted(() => {
fetchAreaData();
});
</script>
<style scoped>
.area-select-container {
display: flex;
align-items: center;
gap: 12px;
}
.area-select-label {
font-size: 14px;
color: #606266;
width: 120px;
line-height: 32px;
text-align: right;
}
</style>

View File

@ -0,0 +1,100 @@
<!-- components/UrlSelect.vue -->
<template>
<el-select
v-bind="$attrs"
v-model="internalValue"
@change="$emit('change', $event)"
@blur="$emit('blur', $event)"
@focus="$emit('focus', $event)"
@clear="$emit('clear', $event)"
@visible-change="$emit('visible-change', $event)"
@remove-tag="$emit('remove-tag', $event)"
@scroll="$emit('scroll', $event)"
>
<!-- 1. 原生 prefix 插槽 -->
<slot name="prefix" />
<!-- 2. 如果要实现分组插槽也照搬 el-option-group 的结构 -->
<slot name="option-group">
<!-- 默认选项渲染 -->
<el-option v-for="item in options" :key="item[valueKey]" :label="item[labelKey]" :value="item[valueKey]" />
</slot>
<!-- 3. 其他自定义插槽不指定 name 的默认为 default slot -->
<slot />
<!-- 4. 下面这几个插槽是 el-select 也常见的 -->
<slot name="empty" />
<slot name="no-match" />
<slot name="footer" />
</el-select>
</template>
<script setup>
import { ref, watch, onMounted } from 'vue';
import request from '@/utils/axios';
// -------------- / Props --------------
const props = defineProps({
modelValue: {
type: [String, Number, Array],
default: null,
},
url: {
type: String,
default: null,
},
params: {
type: Object,
default: () => ({}),
},
// label value
labelKey: {
type: String,
default: 'label',
},
valueKey: {
type: String,
default: 'value',
},
});
// -------------- Events --------------
const emit = defineEmits(['update:modelValue', 'change', 'blur', 'focus', 'clear', 'visible-change', 'remove-tag', 'scroll']);
// -------------- --------------
// ref
const internalValue = ref(props.modelValue);
// prop internalValue
watch(
() => props.modelValue,
(newVal) => {
internalValue.value = newVal;
}
);
// internalValue emit update:modelValue
watch(internalValue, (newVal) => {
emit('update:modelValue', newVal);
});
// -------------- --------------
const options = ref([]);
// -------------- --------------
async function fetchOptions() {
// console.log('fetchOptions :>> ', props.url, props.params);
if (!props.url) return;
const res = await request.get(props.url, { params: props.params });
const records = res.data.records;
if (Array.isArray(records)) {
options.value = records;
// console.log('option', options.value);
} else {
options.value = [];
console.log('UrlSelect接口返回数据格式不是数组无法解析成 options');
}
}
// -------------- --------------
onMounted(() => {
fetchOptions();
});
</script>

View File

@ -8,9 +8,9 @@
<template>
<el-breadcrumb class="layout-breadcrumb" separator="/">
<transition-group name="breadcrumb">
<el-breadcrumb-item v-if="matched[0].meta.title !== '政务服务'" key="home" :to="{ path: '/' }">
<el-breadcrumb-item v-if="matched[0].meta.title !== '农业产业政务平台'" key="home" :to="{ path: '/' }">
<div class="layout-breadcrumb-item">
<span class="layout-breadcrumb-title">政务服务</span>
<span class="layout-breadcrumb-title">农业产业政务平台</span>
</div>
</el-breadcrumb-item>
<el-breadcrumb-item v-for="(item, index) in matched" :key="item.name">

View File

@ -61,7 +61,7 @@ const stylePlaceholder = () => {
width: calc(100% - 60px);
}
&.no-collapse {
width: calc(100% - 210px);
width: calc(100% - 240px);
}
&-placeholder {
height: 50px;

View File

@ -56,7 +56,7 @@ const activeMenu = computed(() => {
left: 0;
z-index: 98;
overflow: hidden;
width: 210px;
width: 240px;
height: 100%;
background-color: #ffffff;
box-shadow: 0 1px 4px rgb(0 21 41 / 8%);

View File

@ -37,7 +37,7 @@ const SettingStore = useSettingStore();
}
&-container {
position: relative;
margin-left: 210px;
margin-left: 240px;
height: 100%;
transition: margin-left 0.28s;
box-sizing: border-box;

View File

@ -1,10 +1,3 @@
/**
* @Description:
* @Author: zenghua.wang
* @Date: 2024-01-24 17:14:41
* @LastEditors: zenghua.wang
* @LastEditTime: 2024-03-22 10:11:34
*/
import 'virtual:svg-icons-register';
import { createApp } from 'vue';
import App from './App.vue';

View File

@ -34,7 +34,7 @@ export const constantRoutes = [
name: 'layout',
component: Layout,
redirect: '/sub-government-affairs-service/home',
meta: { title: '政务服务', icon: 'House' },
meta: { title: '农业产业政务平台', icon: 'House' },
children: [
{
path: '/sub-government-affairs-service/home',

View File

@ -6,7 +6,7 @@ const annualplanRoutes = [
name: 'annualPlan',
component: Views,
redirect: '/sub-government-affairs-service/annualPlans',
meta: { title: '年度种植计划', icon: '' },
meta: { title: '种植进度网格化管理', icon: '' },
children: [
// {
// path: '/sub-government-affairs-service/annualPlans',
@ -18,7 +18,7 @@ const annualplanRoutes = [
path: '/sub-government-affairs-service/annualPlans',
name: 'annualPlans',
component: () => import('@/views/annualPlan/component/annualPlans/index.vue'),
meta: { title: '网格种植进度', icon: 'Memo' },
meta: { title: '种植进度网格化管理', icon: 'Memo' },
},
],
},

View File

@ -15,12 +15,12 @@ const dictRoutes = [
component: () => import('@/views/dict/component/region/index.vue'),
meta: { title: '行政信息', icon: '' },
},
{
path: '/sub-government-affairs-service/landCassification',
name: 'landCassification',
component: () => import('@/views/dict/component/landCassification/index.vue'),
meta: { title: '土地分类', icon: '' },
},
// {
// path: '/sub-government-affairs-service/landCassification',
// name: 'landCassification',
// component: () => import('@/views/dict/component/landCassification/index.vue'),
// meta: { title: '土地分类', icon: '' },
// },
// {
// path: '/sub-government-affairs-service/dictCrop',
// name: 'dictCrop',

View File

@ -3,63 +3,87 @@ import Views from '@/layouts/Views.vue';
const inputSuppliesRoutes = [
{
path: '/sub-government-affairs-service/inputSuppliesManage',
path: '/sub-government-affairs-service/material',
name: 'inputSuppliesManage',
component: Layout,
redirect: '/sub-government-affairs-service/materialManage',
meta: { title: '投入品监管平台', icon: 'FullScreen' },
redirect: '/sub-government-affairs-service/material/pesticide',
meta: { title: '投入品管理', icon: 'FullScreen' },
children: [
// {
// path: '/sub-government-affairs-service/inputDataView',
// name: 'inputDataView',
// component: () => import('@/views/inputSuppliesManage/inputDataView/index.vue'),
// meta: { title: '投入品资源一张图', icon: 'Document' },
// },
{
path: '/sub-government-affairs-service/material',
name: 'material',
component: Views,
redirect: '/sub-government-affairs-service/material/pesticide',
meta: { title: '投入品管理', icon: 'OfficeBuilding' },
children: [
{
path: '/sub-government-affairs-service/material/pesticide',
name: 'input-supplies-pesticide',
component: () => import('@/views/inputSuppliesManage/material/pesticide/index.vue'),
meta: { title: '农药管理', icon: '' },
},
{
path: '/sub-government-affairs-service/material/fertilizer',
name: 'input-supplies-fertilizer',
component: () => import('@/views/inputSuppliesManage/material/fertilizer/index.vue'),
meta: { title: '肥料管理', icon: '' },
},
// {
// path: '/sub-government-affairs-service/material/pesticide',
// name: 'input-supplies-pesticide',
// component: () => import('@/views/inputSuppliesManage/material/pesticide/index.vue'),
// meta: { title: '农药管理', icon: '' },
// },
// {
// path: '/sub-government-affairs-service/material/ratPoison',
// name: 'input-supplies-ratPoison',
// component: () => import('@/views/inputSuppliesManage/material/ratPoison/index.vue'),
// meta: { title: '兽药管理', icon: '' },
// },
{
path: '/sub-government-affairs-service/material/seed',
name: 'input-supplies-seed',
component: () => import('@/views/inputSuppliesManage/material/seed/index.vue'),
meta: { title: '种子管理', icon: '' },
},
// {
// path: '/sub-government-affairs-service/material/farmMachinery',
// name: 'input-supplies-farmMachinery',
// component: () => import('@/views/inputSuppliesManage/material/farmMachinery/index.vue'),
// meta: { title: '农机管理', icon: '' },
// },
],
path: '/sub-government-affairs-service/material/pesticide',
name: 'input-supplies-pesticide',
component: () => import('@/views/inputSuppliesManage/material/pesticide/index.vue'),
meta: { title: '农药管理', icon: '' },
},
{
path: '/sub-government-affairs-service/material/fertilizer',
name: 'input-supplies-fertilizer',
component: () => import('@/views/inputSuppliesManage/material/fertilizer/index.vue'),
meta: { title: '肥料管理', icon: '' },
},
{
path: '/sub-government-affairs-service/material/seed',
name: 'input-supplies-seed',
component: () => import('@/views/inputSuppliesManage/material/seed/index.vue'),
meta: { title: '种子使用监督管理', icon: '' },
},
{
path: '/sub-government-affairs-service/material/others',
name: 'input-supplies-others',
component: () => import('@/views/inputSuppliesManage/material/others/index.vue'),
meta: { title: '其他投入品', icon: '' },
},
{
path: '/sub-government-affairs-service/material/annualPlans',
name: 'annualPlans',
component: () => import('@/views/inputSuppliesManage/material/annualPlan/index.vue'),
meta: { title: '种植进度网格化管理', icon: '' },
},
// {
// path: '/sub-government-affairs-service/materialManage',
// name: 'materialManage',
// component: Views,
// redirect: '/sub-government-affairs-service/material/pesticide',
// meta: { title: '投入品管理', icon: 'OfficeBuilding' },
// children: [
// {
// path: '/sub-government-affairs-service/material/pesticide',
// name: 'input-supplies-pesticide',
// component: () => import('@/views/inputSuppliesManage/material/pesticide/index.vue'),
// meta: { title: '农药管理', icon: '' },
// },
// {
// path: '/sub-government-affairs-service/material/fertilizer',
// name: 'input-supplies-fertilizer',
// component: () => import('@/views/inputSuppliesManage/material/fertilizer/index.vue'),
// meta: { title: '肥料管理', icon: '' },
// },
// // {
// // path: '/sub-government-affairs-service/material/pesticide',
// // name: 'input-supplies-pesticide',
// // component: () => import('@/views/inputSuppliesManage/material/pesticide/index.vue'),
// // meta: { title: '农药管理', icon: '' },
// // },
// // {
// // path: '/sub-government-affairs-service/material/ratPoison',
// // name: 'input-supplies-ratPoison',
// // component: () => import('@/views/inputSuppliesManage/material/ratPoison/index.vue'),
// // meta: { title: '兽药管理', icon: '' },
// // },
// {
// path: '/sub-government-affairs-service/material/seed',
// name: 'input-supplies-seed',
// component: () => import('@/views/inputSuppliesManage/material/seed/index.vue'),
// meta: { title: '种子管理', icon: '' },
// },
// // {
// // path: '/sub-government-affairs-service/material/farmMachinery',
// // name: 'input-supplies-farmMachinery',
// // component: () => import('@/views/inputSuppliesManage/material/farmMachinery/index.vue'),
// // meta: { title: '农机管理', icon: '' },
// // },
// ],
// },
// {
// path: '/sub-government-affairs-service/productionDealer',
// name: 'productionDealer',
@ -90,12 +114,12 @@ const inputSuppliesRoutes = [
// component: () => import('@/views/inputSuppliesManage/redBlackRank/index.vue'),
// meta: { title: '企业红黑榜', icon: '' },
// },
{
path: '/sub-government-affairs-service/knowledgeManage',
name: 'knowledgeManage',
component: () => import('@/views/inputSuppliesManage/knowledgeManage/index.vue'),
meta: { title: '知识库', icon: '' },
},
// {
// path: '/sub-government-affairs-service/knowledgeManage',
// name: 'knowledgeManage',
// component: () => import('@/views/inputSuppliesManage/knowledgeManage/index.vue'),
// meta: { title: '知识库', icon: '' },
// },
// {
// path: '/sub-government-affairs-service/patrolCaseManage',
// name: 'patrolCaseManage',

View File

@ -13,31 +13,31 @@ const landsRoutes = [
path: '/sub-government-affairs-service/landsManage',
name: 'landsManage',
component: () => import('@/views/landManage/component/landsManage/index.vue'),
meta: { title: '土地信息登记', icon: '' },
},
{
path: '/sub-government-affairs-service/plantPlan',
name: 'plantPlan',
component: () => import('@/views/landManage/component/plantPlan/index.vue'),
meta: { title: '种植计划', icon: '' },
},
{
path: '/sub-government-affairs-service/operationRecord',
name: 'operationRecord',
component: () => import('@/views/landManage/component/operationRecord/index.vue'),
meta: { title: '作业记录', icon: '' },
meta: { title: '土地资源信息登记', icon: '' },
},
// {
// path: '/sub-government-affairs-service/plantPlan',
// name: 'plantPlan',
// component: () => import('@/views/landManage/component/plantPlan/index.vue'),
// meta: { title: '种植计划', icon: '' },
// },
// {
// path: '/sub-government-affairs-service/operationRecord',
// name: 'operationRecord',
// component: () => import('@/views/landManage/component/operationRecord/index.vue'),
// meta: { title: '作业记录', icon: '' },
// },
{
path: '/sub-government-affairs-service/landPartol',
name: 'landPartol',
component: () => import('@/views/landManage/component/landPartol/index.vue'),
meta: { title: '土地巡查', icon: '' },
meta: { title: '土地使用巡查', icon: '' },
},
{
path: '/sub-government-affairs-service/illegalHandle',
name: 'illegalHandle',
component: () => import('@/views/landManage/component/illegalHandle/index.vue'),
meta: { title: '土地违法处理', icon: '' },
meta: { title: '土地案件', icon: '' },
},
],
},

View File

@ -6,7 +6,7 @@ export default [
name: 'productOperateMain',
component: Layout,
redirect: '/sub-government-affairs-service/mainHome',
meta: { title: '生产经营主体', icon: 'icon-shop' },
meta: { title: '农业生产经营主体管理', icon: 'icon-shop' },
children: [
// {
// path: '/sub-government-affairs-service/mainHome',
@ -18,7 +18,7 @@ export default [
path: '/sub-government-affairs-service/individual',
component: () => import('@/views/productOperateMain/individual/index.vue'),
name: 'individual',
meta: { title: '农户', icon: '' },
meta: { title: '农户管理', icon: '' },
},
// {
// path: '/sub-government-affairs-service/collective',
@ -30,7 +30,7 @@ export default [
path: '/sub-government-affairs-service/coop',
component: () => import('@/views/productOperateMain/coOp/index.vue'),
name: 'coop',
meta: { title: '农企合作社', icon: '' },
meta: { title: '企业管理', icon: '' },
},
// {
// path: '/sub-government-affairs-service/enterprise',
@ -62,12 +62,12 @@ export default [
// name: 'enterprise',
// meta: { title: '经营企业', icon: 'Document' },
// },
{
path: '/sub-government-affairs-service/examineList',
component: () => import('@/views/productOperateMain/examine/list.vue'),
name: 'examineList',
meta: { title: '主体审核管理', icon: '' },
},
// {
// path: '/sub-government-affairs-service/examineList',
// component: () => import('@/views/productOperateMain/examine/list.vue'),
// name: 'examineList',
// meta: { title: '主体审核管理', icon: '' },
// },
// {
// path: '/sub-government-affairs-service/examineRecord',
// component: () => import('@/views/productOperateMain/examine/record.vue'),

View File

@ -9,15 +9,21 @@ export default [
path: '/sub-government-affairs-service/resource',
name: 'resourceManagement',
component: Layout,
redirect: '/sub-government-affairs-service/grid',
redirect: '/sub-government-affairs-service/landCassification',
meta: { title: '土地资源管理', icon: 'icon-test' },
children: [
{
path: '/sub-government-affairs-service/landCassification',
name: 'landCassification',
component: () => import('@/views/dict/component/landCassification/index.vue'),
meta: { title: '土地分类', icon: '' },
},
{
redirect: '/sub-government-affairs-service/add-grid',
path: '/sub-government-affairs-service/grid',
// component: () => import('@/views/resource/grid/index.vue'),
name: 'grid',
meta: { title: '网格化管理', icon: 'Memo' },
meta: { title: '土地资源网格化管理', icon: 'Memo' },
children: [
{
path: '/sub-government-affairs-service/add-grid',
@ -31,15 +37,15 @@ export default [
name: 'member',
meta: { title: '新增网格员', icon: '' },
},
{
path: '/sub-government-affairs-service/grid--management',
component: () => import('@/views/resource/grid/GridManagement.vue'),
name: 'management',
meta: { title: '网格化管理', icon: '' },
},
// {
// path: '/sub-government-affairs-service/grid--management',
// component: () => import('@/views/resource/grid/GridManagement.vue'),
// name: 'management',
// meta: { title: '网格化管理', icon: '' },
// },
],
},
...annualplanRouters,
// ...annualplanRouters,
...landsRoutes,
// ...statisticsRoutes,
...dictRoutes,

View File

@ -7,7 +7,7 @@ export default [
name: 'trace',
component: Layout,
redirect: '/sub-government-affairs-service/trace-home',
meta: { title: '溯源管理', icon: 'Connection' },
meta: { title: '农产品流通溯源管理', icon: 'Connection' },
children: [
{
path: '/sub-government-affairs-service/record',

View File

@ -1,10 +1,3 @@
/*
* @Descripttion:
* @Author: zenghua.wang
* @Date: 2022-02-23 21:12:37
* @LastEditors: zenghua.wang
* @LastEditTime: 2025-03-26 10:02:18
*/
import axios from 'axios';
import { ElNotification } from 'element-plus';
import router from '@/router';
@ -18,7 +11,7 @@ const { VITE_APP_BASE_API, VITE_APP_UPLOAD_API, VITE_APP_DICDATA_API } = import.
*/
const publicAxios = axios.create({
baseURL: VITE_APP_BASE_API, // API请求的默认前缀
timeout: 30000,
timeout: 10000, // 10秒超时
});
/**
* 异常拦截处理器
@ -26,8 +19,17 @@ const publicAxios = axios.create({
* @returns
*/
const errorHandler = async (error) => {
const { response } = error;
const { response, code, message } = error;
const UserStore = useUserStore();
// 1. 处理超时错误
if (error.code === 'ECONNABORTED' || error.message.includes('timeout')) {
ElNotification.error({
message: '请求超时',
description: '请检查网络或稍后重试',
});
return Promise.reject({ code: 'TIMEOUT', message: '请求超时' });
}
// 2. 处理HTTP状态码错误
if (response && response.status) {
switch (response.status) {
case 401:
@ -38,6 +40,7 @@ const errorHandler = async (error) => {
break;
}
}
// 3. 其他错误传递到业务层
return Promise.reject(error?.response?.data);
};
/**
@ -98,22 +101,27 @@ const formatResult = async (res) => {
/**
* 响应拦截器
*/
publicAxios.interceptors.response.use((response) => {
const { config } = response;
// console.info('响应拦截器', response);
if (config?.responseType) {
return response;
publicAxios.interceptors.response.use(
(response) => {
const { config } = response;
if (config?.responseType) {
return response;
}
const token = response?.headers['authorization'];
if (!isEmpty(token)) {
const UserStore = useUserStore();
UserStore.setToken(token);
}
const result = formatResult(response);
if (result) {
return result;
}
throw new Error(response.data.msg);
},
(error) => {
// 处理错误
return errorHandler(error);
}
const token = response?.headers['authorization'];
if (!isEmpty(token)) {
const UserStore = useUserStore();
UserStore.setToken(token);
}
const result = formatResult(response);
if (result) {
return result;
}
throw new Error(response.data.msg);
}, errorHandler);
);
export default publicAxios;

View File

@ -1,10 +1,3 @@
/**
* @Description: 路由权限
* @Author: zenghua.wang
* @Date: 2022-01-26 22:04:31
* @LastEditors: zenghua.wang
* @LastEditTime: 2024-02-26 13:54:43
*/
import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
@ -19,7 +12,7 @@ const whiteList = [];
router.beforeEach(async (to, from, next) => {
NProgress.start();
if (typeof to.meta.title === 'string') {
document.title = '政务服务 | ' + to.meta.title;
document.title = '农业产业政务平台 | ' + to.meta.title;
}
const userStore = useUserStore();

View File

@ -3,111 +3,291 @@
<avue-crud
ref="crudRef"
v-model="state.form"
v-model:search="state.query"
v-model:page="state.pageData"
:table-loading="state.loading"
:data="state.data"
:option="state.options"
@refresh-change="refreshChange"
@search-reset="searchChange"
@search-change="searchChange"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@row-save="rowSave"
@row-update="rowUpdate"
@row-del="rowDel"
>
<template #menu-left>
<el-button type="primary" icon="Plus" @click="onAdd">新增</el-button>
<el-button type="success" icon="download" @click="onExport">导出</el-button>
</template>
<template #planStatus="{ row }">
<el-tag v-if="row.planStatus == '1'" type="warning" size="small">待提交</el-tag>
<el-tag v-if="row.planStatus == '2'" type="primary" size="small">审核中</el-tag>
<el-tag v-if="row.planStatus == '3'" type="success" size="small">通过</el-tag>
<el-tag v-if="row.planStatus == '4'" type="danger" size="small">拒绝</el-tag>
<template #menu="{ row }">
<custom-table-operate :actions="state.options.actions" :data="{ row }" />
</template>
<template #growthCycle-form="{ row, column, value, type }">
<el-input-number v-model="growthCycleVal[0]" :disabled="type == 'view' ? true : false" :min="1" :max="30" style="width: 130px">
<template #suffix>
<span></span>
</template>
</el-input-number>
&nbsp; - &nbsp;
<el-input-number v-model="growthCycleVal[1]" :min="1" :disabled="type == 'view' ? true : false" :max="30" style="width: 130px">
<template #suffix>
<span></span>
</template>
</el-input-number>
</template>
<template #plantingMonths-form="{ row, column, value, type }">
<el-select
v-model="plantingMonths"
placeholder="请选择月份"
:disabled="type == 'view' ? true : false"
style="width: 200px"
:clearable="true"
:multiple="true"
>
<el-option v-for="item in monthsOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</template>
<template #menu="scope">
<custom-table-operate :actions="state.options.actions" :data="scope" />
<template #search>
<div class="custom-search">
<div class="search-fields">
<div class="search-item">
<AreaCascader
v-model:region-code="areaQuery.regionCode"
v-model:grid-id="areaQuery.gridId"
placeholder="选择行政区域与网格"
:show-separator="true"
:width="500"
/>
</div>
<div class="search-item">
<span>种植作物</span>
<el-select v-model="state.query.cropsId" placeholder="种植作物" :clearable="true">
<el-option v-for="item in cropsOptions" :key="item.id" :label="item.cropsName" :value="item.id" />
</el-select>
</div>
<div class="search-item">
<span>计划编号</span>
<el-input v-model="state.query.id" placeholder="计划编号" :clearable="true" />
</div>
<div class="search-item">
<span>计划名称</span>
<el-input v-model="state.query.planName" placeholder="计划名称" :clearable="true" />
</div>
</div>
<div class="search-buttons">
<el-button type="primary" @click="searchChange"> 查询 </el-button>
<el-button @click="resetSearch"> 重置 </el-button>
</div>
</div>
</template>
</avue-crud>
<el-dialog v-model="examVisible" title="审核计划" width="500" center>
<el-dialog v-model="detailDialogVisible" title="年度种植计划详情页" width="800" class="detail-dialog">
<el-tabs v-model="activeTab">
<el-tab-pane label="年度种植计划" name="basic">
<h3>{{ currentDetailRow.planName }}</h3>
<div>所属行政区域{{ currentDetailRow.regionName }}</div>
<div>所属网格{{ currentDetailRow.gridName }}</div>
<div>计划编号{{ currentDetailRow.id }}</div>
<div>计划名称{{ currentDetailRow.planName }}</div>
<div>种植作物{{ currentDetailRow.cropsName }}</div>
<div>种植面积{{ currentDetailRow.planParameters?.plantingArea }}</div>
<div>种植月份{{ currentDetailRow.planParameters?.plantingMonths }}</div>
<div>
生长周期{{ currentDetailRow.planParameters?.growthCycle }}
{{ getGrowthCycleUnitName(currentDetailRow.planParameters?.growthCycleUnit) }}
</div>
</el-tab-pane>
<el-tab-pane label="实际种植情况" name="planting">
<h3>{{ currentDetailRow.planName }}</h3>
<div>所属行政区域{{ currentDetailRow.regionName }}</div>
<div>所属网格{{ currentDetailRow.gridName }}</div>
<div>计划编号{{ currentDetailRow.id }}</div>
<div>计划名称{{ currentDetailRow.planName }}</div>
<div>种植作物{{ currentDetailRow.cropsName }}</div>
<div>种植面积{{ currentDetailRow.actualParameters?.plantingArea }}</div>
<div>种植月份{{ currentDetailRow.actualParameters?.plantingMonths }}</div>
<div>
生长周期{{ currentDetailRow.actualParameters?.growthCycle }}
{{ getGrowthCycleUnitName(currentDetailRow.actualParameters?.growthCycleUnit) }}
</div>
<div>当前进度{{ currentDetailRow.currentProgress }}%</div>
</el-tab-pane>
</el-tabs>
<template #footer>
<div class="dialog-footer">
<el-button type="danger" @click="examCancel">审核拒绝</el-button>
<el-button type="primary" @click="examPast"> 审核通过 </el-button>
</div>
<span class="dialog-footer">
<el-button @click="detailDialogVisible = false">关闭</el-button>
</span>
</template>
</el-dialog>
<!-- 新增重新制定计划和填写实际种植信息操作的共用弹窗 -->
<el-dialog v-model="commonDialogVisible" :title="dialogTitle">
<template #default>
<el-form ref="planForm" :model="formData" :rules="formRules" label-width="120px" class="common-dialog">
<el-form-item label="" label-width="0px">
<AreaCascader v-model:value="areaFormData" split-rows label="所属行政区域-网格" :width="500" />
</el-form-item>
<!-- <AreaCascader v-model:value="areaFormData" split-rows label="所属行政区域-网格" :width="500" /> -->
<el-form-item label="计划名称">
<el-input v-model="formData.planName" style="width: 380px" />
</el-form-item>
<el-form-item label="种植作物" prop="cropsName">
<el-select v-model="formData.cropsId" placeholder="种植作物" style="width: 380px" :clearable="true">
<el-option v-for="item in cropsOptions" :key="item.id" :label="item.cropsName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="种植面积" prop="plantingArea">
<el-input v-model="formData.plantingArea" style="width: 380px" />
</el-form-item>
<el-form-item label="种植月份" prop="plantingMonths">
<el-select v-model="formData.plantingMonths" placeholder="请选择月份" style="width: 380px" :clearable="true">
<el-option v-for="item in monthsOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="生长周期" prop="growthCycle">
<el-input-number v-model="formData.growthCycle" :min="1" style="width: 300px" />
<el-select v-model="formData.growthCycleUnit" disabled style="width: 68px; margin: 0; padding: 0">
<el-option label="天" value="1" />
<el-option label="周" value="2" />
<el-option label="月" value="3" />
<el-option label="年" value="4" />
</el-select>
</el-form-item>
</el-form>
</template>
<template #footer>
<span class="dialog-footer">
<el-button @click="commonDialogVisible = false">取消</el-button>
<el-button type="primary" @click="submitForm">确定</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { reactive, ref } from 'vue';
import { reactive, ref, computed, onMounted, watch } from 'vue';
import { useApp } from '@/hooks';
import { CRUD_OPTIONS } from '@/config';
import { isEmpty, downloadFile } from '@/utils';
import { getAnnualList, saveAnnual, editAnnual, examineAnnual, delAnnual, exportAnnua } from '@/apis/land.js';
import { useUserStore } from '@/store/modules/user';
import { getAnnualList, examineAnnual, delAnnual, exportAnnua } from '@/apis/land.js';
import { pageCropsList } from '@/apis/landResourceManagement/cropsManagement/index.js';
import { saveAnnual, editAnnual, saveActualProgress, getAnnualDetail } from '@/apis/landResourceManagement/plantingPlan/index.js';
const app = useApp();
const crudRef = ref(null);
const userStore = useUserStore();
// AreaCascader
const areaFormData = ref({
regionCode: '',
gridName: '',
gridId: '',
});
watch(
areaFormData,
(newVal) => {
formData.value.regionCode = newVal.regionCode;
formData.value.gridName = newVal.gridName;
formData.value.gridId = newVal.gridId;
},
{ deep: true }
);
const formRules = reactive({
// planName: [{ required: true, message: '', trigger: 'blur' }],
// cropsId: [{ required: true, message: '', trigger: 'change' }],
// plantingArea: [
// { required: true, message: '', trigger: 'blur' },
// { type: 'number', message: '', trigger: 'blur' },
// ],
// plantingMonths: [{ required: true, message: '', trigger: 'change' }],
// growthCycle: [
// { required: true, message: '', trigger: 'blur' },
// { type: 'number', message: '', trigger: 'blur' },
// ],
});
//
const cropsOptions = ref([]);
//
const fetchCropsList = async () => {
try {
// pageCropsList
const res = await pageCropsList({ status: '0' });
if (res.code === 200) {
console.log('res :>> ', res.data.records);
cropsOptions.value = res.data.records;
console.log('object :>> ', cropsOptions.value);
}
} catch (error) {
app.$message.error('获取种植作物列表失败');
}
};
onMounted(() => {
fetchCropsList();
});
const monthsOptions = reactive([
{ label: '1月份', value: '1月' },
{ label: '2月份', value: '2月' },
{ label: '3月份', value: '3月' },
{ label: '4月份', value: '4月' },
{ label: '5月份', value: '5月' },
{ label: '6月份', value: '6月' },
{ label: '7月份', value: '7月' },
{ label: '8月份', value: '8月' },
{ label: '9月份', value: '9月' },
{ label: '10月份', value: '10月' },
{ label: '11月份', value: '11月' },
{ label: '12月份', value: '12月' },
//
const getGrowthCycleUnitName = (unit) => {
const unitMap = {
1: '天',
2: '周',
3: '月',
4: '年',
};
return unitMap[unit] || '';
};
//
const fetchDetailData = async (id) => {
try {
const res = await getAnnualDetail(id);
if (res.code === 200) {
currentDetailRow.value = res.data;
} else {
app.$message.error(res.msg || '获取详情数据失败');
}
} catch (error) {
console.error('获取详情数据出错:', error);
app.$message.error('获取详情数据失败,请稍后重试');
}
};
const openDetailDialog = async (row) => {
detailDialogVisible.value = true;
await fetchDetailData(row.id);
};
//
const detailDialogVisible = ref(false);
//
const activeTab = ref('basic');
const currentDetailRow = ref({});
//
const commonDialogVisible = ref(false);
//
const currentAction = ref('');
//
const dialogTitle = computed(() => {
if (currentAction.value === 'reCreate') {
return '重新制定计划';
} else if (currentAction.value === 'fillActual') {
return '填写实际种植信息';
} else if (currentAction.value === 'add') {
return '新增年度种植计划';
}
return '';
});
const monthsOptions = ref([
{ value: 1, label: '1月' },
{ value: 2, label: '2月' },
{ value: 3, label: '3月' },
{ value: 4, label: '4月' },
{ value: 5, label: '5月' },
{ value: 6, label: '6月' },
{ value: 7, label: '7月' },
{ value: 8, label: '8月' },
{ value: 9, label: '9月' },
{ value: 10, label: '10月' },
{ value: 11, label: '11月' },
{ value: 12, label: '12月' },
]);
//
const planForm = ref(null);
//
const isGridMember = computed(() => {
const userRoles = userStore.getUserInfo().roles;
console.log('当前用户角色:', userRoles);
return userRoles.some((role) => role.roleKey === 'gridMember');
// return true;
});
let infoData = reactive({ id: '' });
const examVisible = ref(false);
let growthCycleVal = reactive([0, 0]);
let plantingMonths = ref([]);
// 使 ref 使 v-model:value
const areaQuery = ref({
regionCode: '',
gridName: '',
gridId: '',
});
const state = reactive({
loading: false,
query: {
current: 1,
size: 10,
id: '',
planName: '',
cropsName: '',
cropsId: '',
},
form: {},
selection: [],
@ -115,111 +295,63 @@ const state = reactive({
...CRUD_OPTIONS,
addBtnText: '',
addBtn: false,
searchBtn: false,
emptyBtn: false,
fit: true,
column: [
{ label: '计划编号', prop: 'id', width: '200px', search: true, showOverflowTooltip: true, addDisplay: false, editDisplay: false },
{
label: '计划名称',
prop: 'planName',
width: '200px',
showOverflowTooltip: true,
search: true,
rules: {
required: true,
message: '请选择',
trigger: 'blur',
},
},
{ label: '种植作物', prop: 'cropsName', width: '120px', search: true, editDisplay: false },
{
label: '种植面积',
prop: 'plantingArea',
append: '亩',
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
// formatter: (value) => `${value} `,
formatter: (row, column, cellValue) => `${cellValue}`,
},
{
label: '种植月份',
prop: 'plantingMonths',
width: '120px',
rules: {
required: true,
message: '请选择',
trigger: 'blur',
validator: (rule, value, callback) => {
if (!plantingMonths.value.length) {
callback(new Error('请输入'));
} else {
callback();
}
},
},
formatter: (row, column, cellValue) => `${cellValue}`,
},
{ label: '计划编号', prop: 'id', minWidth: 100 },
{ label: '计划名称', prop: 'planName' },
{ label: '种植作物', prop: 'cropsName' },
{ label: '种植面积', prop: 'plantingArea', formatter: (row, column, cellValue) => `${cellValue}` },
{ label: '种植月份', prop: 'plantingMonths', formatter: (row, column, cellValue) => `${cellValue}` },
{
label: '生长周期',
prop: 'growthCycle',
width: '120px',
viewDisabled: true,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
validator: (rule, value, callback) => {
if (growthCycleVal[0] < 1 || growthCycleVal[1] < 1) {
callback(new Error('请输入'));
} else {
callback();
}
},
},
formatter: (row, column, cellValue) => {
const unitMap = {
1: '天',
2: '周',
3: '月',
4: '年',
};
const unitMap = { 1: '天', 2: '周', 3: '月', 4: '年' };
const unit = unitMap[row.growthCycleUnit] || '';
return `${cellValue} ${unit}`;
},
},
{ label: '所属行政区域', prop: 'regionName', width: '120px', search: true, searchLabelWidth: 100, addDisplay: false, editDisplay: false },
{ label: '所属网格', prop: 'gridName', width: '120px', search: true, addDisplay: false, editDisplay: false },
{ label: '当前进度', prop: 'currentProgress', width: '120px', addDisplay: false, editDisplay: false },
// {
// label: '',
// prop: 'note',
// width: '180px',
// showOverflowTooltip: true,
// rules: {
// required: true,
// message: '',
// trigger: 'blur',
// },
// },
// { label: '', prop: 'planProgress', addDisplay: false, editDisplay: false },
// { label: '', prop: 'planStatus', addDisplay: false, editDisplay: false },
{ label: '所属行政区域', prop: 'regionName' },
{ label: '所属网格', prop: 'gridName' },
{ label: '当前进度', prop: 'currentProgress' },
],
actions: [
{
name: '审核',
icon: 'Stamp',
event: ({ row }) => doExam(row),
name: '查看',
icon: 'view',
event: ({ row }) => {
openDetailDialog(row);
},
},
{
name: '编辑',
name: '重新制定计划',
icon: 'edit',
event: ({ row }) => rowEdit(row),
event: ({ row }) => {
currentAction.value = 'reCreate';
formData.value = { ...row };
if (isGridMember.value) {
formData.value.regionName = row.regionName;
formData.value.gridName = row.gridName;
}
formData.value.growthCycleUnit = row.growthCycleUnit || '1';
commonDialogVisible.value = true;
},
},
{
name: '详情',
icon: 'List',
event: ({ row }) => doDetail(row),
name: '填写实际种植信息',
icon: 'edit',
event: ({ row }) => {
currentAction.value = 'fillActual';
formData.value = { ...row };
if (isGridMember.value) {
formData.value.regionName = row.regionName;
formData.value.gridName = row.gridName;
}
formData.value.growthCycleUnit = row.growthCycleUnit || '1';
commonDialogVisible.value = true;
},
},
{
type: 'danger',
@ -238,6 +370,72 @@ const state = reactive({
currentRow: {},
});
const formData = ref({
year: '',
regionCode: '',
gridId: '',
regionName: '',
gridName: '',
planName: '', //
cropsId: null,
cropsName: '',
plantingArea: null,
plantingMonths: '',
growthCycle: '',
growthCycleUnit: '1', //
note: '',
});
//
const submitForm = async () => {
try {
//
await planForm.value.validate();
//
console.log('表单数据:', formData.value);
if (currentAction.value === 'reCreate') {
//
await editAnnual(formData.value);
app.$message.success('重新制定计划成功');
} else if (currentAction.value === 'fillActual') {
//
await saveActualProgress(formData.value);
app.$message.success('填写实际种植信息成功');
} else if (currentAction.value === 'add') {
//
await saveAnnual(formData.value);
app.$message.success('新增年度种植计划成功');
}
commonDialogVisible.value = false;
loadData();
} catch (error) {
console.error('表单提交失败:', error);
if (error.errors) {
//
app.$message.error('请填写完整且正确的表单信息');
} else {
// API
app.$message.error('操作失败,请稍后重试');
}
}
};
const onAdd = () => {
currentAction.value = 'add';
formData.value = {
regionName: '',
gridName: '',
planName: '',
cropsName: '',
plantingArea: '',
plantingMonths: '',
growthCycle: '',
growthCycleUnit: '1',
};
commonDialogVisible.value = true;
};
//
const loadData = () => {
state.loading = true;
@ -277,10 +475,29 @@ const sizeChange = (size) => {
};
//
const searchChange = (params, done) => {
if (done) done();
state.query = params;
state.query.current = 1;
const searchChange = () => {
state.query = {
...state.query,
...areaQuery.value,
current: 1,
};
console.log('搜索参数', state.query);
loadData();
};
//
const resetSearch = () => {
state.query = {
current: 1,
size: 10,
id: '',
planName: '',
cropsName: '',
cropsId: '',
};
areaQuery.value.regionCode = '';
areaQuery.value.gridName = '';
areaQuery.value.gridId = '';
loadData();
};
@ -295,65 +512,6 @@ const selectionChange = (rows) => {
state.selection = rows;
};
const onAdd = () => {
afterSub();
crudRef.value.rowAdd();
};
//
const rowSave = (row, done, loading) => {
row.growthCycle = growthCycleVal[0] + '周' + ',' + growthCycleVal[1] + '周';
row.plantingMonths = plantingMonths.value.length ? plantingMonths.value.toString() : '';
saveAnnual(row)
.then((res) => {
if (res.code === 200) {
app.$message.success('添加成功!');
done();
loadData();
}
})
.catch((err) => {
app.$message.error(err.msg);
})
.finally(() => {});
};
const beforeMsg = (row) => {
growthCycleVal = row.growthCycle.split(',').map((m) => {
return Number(m.replace(/[^0-9]/gi, ''));
});
plantingMonths.value = row.plantingMonths.split(',');
};
const afterSub = () => {
growthCycleVal = [0, 0];
plantingMonths.value = [];
};
//
const rowEdit = (row) => {
console.info('编辑');
beforeMsg(row);
crudRef.value.rowEdit(row);
};
const rowUpdate = (row, index, done, loading) => {
console.info('更新');
editAnnual(row)
.then((res) => {
if (res.code === 200) {
app.$message.success('更新成功!');
done();
loadData();
}
})
.catch((err) => {
app.$message.error(err.msg);
})
.finally(() => {
loading();
});
};
//
const rowDel = (row, index, done) => {
if (isEmpty(row)) return;
@ -379,7 +537,6 @@ const rowDel = (row, index, done) => {
})
.catch(() => {});
};
//
const onExport = () => {
if (isEmpty(state.data)) {
@ -402,53 +559,101 @@ const onExport = () => {
state.loading = false;
});
};
const doExam = (row) => {
examVisible.value = true;
infoData.id = row.id || '';
};
const doDetail = (row) => {
beforeMsg(row);
crudRef.value.rowView(row);
};
const examCancel = () => {
console.log('审核不通过');
examVisible.value = true;
toDoexam(infoData.id, '4', '审核不通过');
};
const examPast = (row) => {
console.log('审核通过');
toDoexam(infoData.id, '3', '审核通过');
};
const toDoexam = (id, status, tips) => {
app
.$confirm(`确定` + tips + `吗?`, '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
examineAnnual({ id: id, planStatus: status })
.then((res) => {
if (res.code === 200) {
app.$message.success('审核提交成功!');
loadData();
examHide();
}
})
.catch((err) => {
app.$message.error(err.msg);
})
.finally(() => {});
})
.catch(() => {});
};
const examHide = () => {
examVisible.value = false;
};
</script>
<style scoped lang="scss">
.custom-page {
/* 详情弹窗样式 */
/* 表单弹窗样式 */
.el-dialog {
.el-form {
padding: 0 20px;
width: 100%;
// background-color: aqua;
display: flex;
flex-wrap: wrap;
justify-content: center;
&-item {
margin-bottom: 18px;
width: 60%;
// background-color: #606266;
&__label {
font-weight: 500;
color: #606266;
}
/* 输入框和选择器统一宽度 */
.el-input,
.el-select,
.el-cascader {
width: 100%;
max-width: 400px;
}
/* 数字输入框和单位选择器组合 */
.el-input-number {
margin-right: 10px;
& + .el-select {
width: 100px;
}
}
}
}
}
/* 按钮样式微调 */
.el-button {
padding: 8px 16px;
border-radius: 4px;
& + .el-button {
margin-left: 12px;
}
}
/* 搜索区域样式 */
.custom-search {
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 16px;
border-radius: 8px;
// background-color: #f5f7fa;
.search-fields {
display: flex;
flex-wrap: wrap;
gap: 16px;
width: 100%;
margin-bottom: 16px;
}
.search-item {
display: flex;
align-items: center;
gap: 8px;
.el-input,
.el-select,
.el-cascader {
width: 200px;
}
span {
font-size: 14px;
color: #606266;
align-self: center;
}
}
.search-buttons {
display: flex;
align-self: center;
gap: 12px;
margin-left: 8px;
}
}
}
</style>

View File

@ -0,0 +1,659 @@
<template>
<div class="custom-page">
<avue-crud
ref="crudRef"
v-model="state.form"
v-model:page="state.pageData"
:table-loading="state.loading"
:data="state.data"
:option="state.options"
@refresh-change="refreshChange"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
>
<template #menu-left>
<el-button type="primary" icon="Plus" @click="onAdd">新增</el-button>
<el-button type="success" icon="download" @click="onExport">导出</el-button>
</template>
<template #menu="{ row }">
<custom-table-operate :actions="state.options.actions" :data="{ row }" />
</template>
<template #search>
<div class="custom-search">
<div class="search-fields">
<div class="search-item">
<AreaCascader
v-model:region-code="areaQuery.regionCode"
v-model:grid-id="areaQuery.gridId"
placeholder="选择行政区域与网格"
:show-separator="true"
:width="500"
/>
</div>
<div class="search-item">
<span>种植作物</span>
<el-select v-model="state.query.cropsId" placeholder="种植作物" :clearable="true">
<el-option v-for="item in cropsOptions" :key="item.id" :label="item.cropsName" :value="item.id" />
</el-select>
</div>
<div class="search-item">
<span>计划编号</span>
<el-input v-model="state.query.id" placeholder="计划编号" :clearable="true" />
</div>
<div class="search-item">
<span>计划名称</span>
<el-input v-model="state.query.planName" placeholder="计划名称" :clearable="true" />
</div>
</div>
<div class="search-buttons">
<el-button type="primary" @click="searchChange"> 查询 </el-button>
<el-button @click="resetSearch"> 重置 </el-button>
</div>
</div>
</template>
</avue-crud>
<el-dialog v-model="detailDialogVisible" title="年度种植计划详情页" width="800" class="detail-dialog">
<el-tabs v-model="activeTab">
<el-tab-pane label="年度种植计划" name="basic">
<h3>{{ currentDetailRow.planName }}</h3>
<div>所属行政区域{{ currentDetailRow.regionName }}</div>
<div>所属网格{{ currentDetailRow.gridName }}</div>
<div>计划编号{{ currentDetailRow.id }}</div>
<div>计划名称{{ currentDetailRow.planName }}</div>
<div>种植作物{{ currentDetailRow.cropsName }}</div>
<div>种植面积{{ currentDetailRow.planParameters?.plantingArea }}</div>
<div>种植月份{{ currentDetailRow.planParameters?.plantingMonths }}</div>
<div>
生长周期{{ currentDetailRow.planParameters?.growthCycle }}
{{ getGrowthCycleUnitName(currentDetailRow.planParameters?.growthCycleUnit) }}
</div>
</el-tab-pane>
<el-tab-pane label="实际种植情况" name="planting">
<h3>{{ currentDetailRow.planName }}</h3>
<div>所属行政区域{{ currentDetailRow.regionName }}</div>
<div>所属网格{{ currentDetailRow.gridName }}</div>
<div>计划编号{{ currentDetailRow.id }}</div>
<div>计划名称{{ currentDetailRow.planName }}</div>
<div>种植作物{{ currentDetailRow.cropsName }}</div>
<div>种植面积{{ currentDetailRow.actualParameters?.plantingArea }}</div>
<div>种植月份{{ currentDetailRow.actualParameters?.plantingMonths }}</div>
<div>
生长周期{{ currentDetailRow.actualParameters?.growthCycle }}
{{ getGrowthCycleUnitName(currentDetailRow.actualParameters?.growthCycleUnit) }}
</div>
<div>当前进度{{ currentDetailRow.currentProgress }}%</div>
</el-tab-pane>
</el-tabs>
<template #footer>
<span class="dialog-footer">
<el-button @click="detailDialogVisible = false">关闭</el-button>
</span>
</template>
</el-dialog>
<!-- 新增重新制定计划和填写实际种植信息操作的共用弹窗 -->
<el-dialog v-model="commonDialogVisible" :title="dialogTitle">
<template #default>
<el-form ref="planForm" :model="formData" :rules="formRules" label-width="120px" class="common-dialog">
<el-form-item label="" label-width="0px">
<AreaCascader v-model:value="areaFormData" split-rows label="所属行政区域-网格" :width="500" />
</el-form-item>
<!-- <AreaCascader v-model:value="areaFormData" split-rows label="所属行政区域-网格" :width="500" /> -->
<el-form-item label="计划名称">
<el-input v-model="formData.planName" style="width: 380px" />
</el-form-item>
<el-form-item label="种植作物" prop="cropsName">
<el-select v-model="formData.cropsId" placeholder="种植作物" style="width: 380px" :clearable="true">
<el-option v-for="item in cropsOptions" :key="item.id" :label="item.cropsName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="种植面积" prop="plantingArea">
<el-input v-model="formData.plantingArea" style="width: 380px" />
</el-form-item>
<el-form-item label="种植月份" prop="plantingMonths">
<el-select v-model="formData.plantingMonths" placeholder="请选择月份" style="width: 380px" :clearable="true">
<el-option v-for="item in monthsOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="生长周期" prop="growthCycle">
<el-input-number v-model="formData.growthCycle" :min="1" style="width: 300px" />
<el-select v-model="formData.growthCycleUnit" disabled style="width: 68px; margin: 0; padding: 0">
<el-option label="天" value="1" />
<el-option label="周" value="2" />
<el-option label="月" value="3" />
<el-option label="年" value="4" />
</el-select>
</el-form-item>
</el-form>
</template>
<template #footer>
<span class="dialog-footer">
<el-button @click="commonDialogVisible = false">取消</el-button>
<el-button type="primary" @click="submitForm">确定</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { reactive, ref, computed, onMounted, watch } from 'vue';
import { useApp } from '@/hooks';
import { CRUD_OPTIONS } from '@/config';
import { isEmpty, downloadFile } from '@/utils';
import { useUserStore } from '@/store/modules/user';
import { getAnnualList, examineAnnual, delAnnual, exportAnnua } from '@/apis/land.js';
import { pageCropsList } from '@/apis/landResourceManagement/cropsManagement/index.js';
import { saveAnnual, editAnnual, saveActualProgress, getAnnualDetail } from '@/apis/landResourceManagement/plantingPlan/index.js';
const app = useApp();
const crudRef = ref(null);
const userStore = useUserStore();
// AreaCascader
const areaFormData = ref({
regionCode: '',
gridName: '',
gridId: '',
});
watch(
areaFormData,
(newVal) => {
formData.value.regionCode = newVal.regionCode;
formData.value.gridName = newVal.gridName;
formData.value.gridId = newVal.gridId;
},
{ deep: true }
);
const formRules = reactive({
// planName: [{ required: true, message: '', trigger: 'blur' }],
// cropsId: [{ required: true, message: '', trigger: 'change' }],
// plantingArea: [
// { required: true, message: '', trigger: 'blur' },
// { type: 'number', message: '', trigger: 'blur' },
// ],
// plantingMonths: [{ required: true, message: '', trigger: 'change' }],
// growthCycle: [
// { required: true, message: '', trigger: 'blur' },
// { type: 'number', message: '', trigger: 'blur' },
// ],
});
//
const cropsOptions = ref([]);
//
const fetchCropsList = async () => {
try {
// pageCropsList
const res = await pageCropsList({ status: '0' });
if (res.code === 200) {
console.log('res :>> ', res.data.records);
cropsOptions.value = res.data.records;
console.log('object :>> ', cropsOptions.value);
}
} catch (error) {
app.$message.error('获取种植作物列表失败');
}
};
onMounted(() => {
fetchCropsList();
});
//
const getGrowthCycleUnitName = (unit) => {
const unitMap = {
1: '天',
2: '周',
3: '月',
4: '年',
};
return unitMap[unit] || '';
};
//
const fetchDetailData = async (id) => {
try {
const res = await getAnnualDetail(id);
if (res.code === 200) {
currentDetailRow.value = res.data;
} else {
app.$message.error(res.msg || '获取详情数据失败');
}
} catch (error) {
console.error('获取详情数据出错:', error);
app.$message.error('获取详情数据失败,请稍后重试');
}
};
const openDetailDialog = async (row) => {
detailDialogVisible.value = true;
await fetchDetailData(row.id);
};
//
const detailDialogVisible = ref(false);
//
const activeTab = ref('basic');
const currentDetailRow = ref({});
//
const commonDialogVisible = ref(false);
//
const currentAction = ref('');
//
const dialogTitle = computed(() => {
if (currentAction.value === 'reCreate') {
return '重新制定计划';
} else if (currentAction.value === 'fillActual') {
return '填写实际种植信息';
} else if (currentAction.value === 'add') {
return '新增年度种植计划';
}
return '';
});
const monthsOptions = ref([
{ value: 1, label: '1月' },
{ value: 2, label: '2月' },
{ value: 3, label: '3月' },
{ value: 4, label: '4月' },
{ value: 5, label: '5月' },
{ value: 6, label: '6月' },
{ value: 7, label: '7月' },
{ value: 8, label: '8月' },
{ value: 9, label: '9月' },
{ value: 10, label: '10月' },
{ value: 11, label: '11月' },
{ value: 12, label: '12月' },
]);
//
const planForm = ref(null);
//
const isGridMember = computed(() => {
const userRoles = userStore.getUserInfo().roles;
console.log('当前用户角色:', userRoles);
return userRoles.some((role) => role.roleKey === 'gridMember');
// return true;
});
// 使 ref 使 v-model:value
const areaQuery = ref({
regionCode: '',
gridName: '',
gridId: '',
});
const state = reactive({
loading: false,
query: {
current: 1,
size: 10,
id: '',
planName: '',
cropsName: '',
cropsId: '',
},
form: {},
selection: [],
options: {
...CRUD_OPTIONS,
addBtnText: '',
addBtn: false,
searchBtn: false,
emptyBtn: false,
fit: true,
column: [
{ label: '计划编号', prop: 'id', minWidth: 100 },
{ label: '计划名称', prop: 'planName' },
{ label: '种植作物', prop: 'cropsName' },
{ label: '种植面积', prop: 'plantingArea', formatter: (row, column, cellValue) => `${cellValue}` },
{ label: '种植月份', prop: 'plantingMonths', formatter: (row, column, cellValue) => `${cellValue}` },
{
label: '生长周期',
prop: 'growthCycle',
formatter: (row, column, cellValue) => {
const unitMap = { 1: '天', 2: '周', 3: '月', 4: '年' };
const unit = unitMap[row.growthCycleUnit] || '';
return `${cellValue} ${unit}`;
},
},
{ label: '所属行政区域', prop: 'regionName' },
{ label: '所属网格', prop: 'gridName' },
{ label: '当前进度', prop: 'currentProgress' },
],
actions: [
{
name: '查看',
icon: 'view',
event: ({ row }) => {
openDetailDialog(row);
},
},
{
name: '重新制定计划',
icon: 'edit',
event: ({ row }) => {
currentAction.value = 'reCreate';
formData.value = { ...row };
if (isGridMember.value) {
formData.value.regionName = row.regionName;
formData.value.gridName = row.gridName;
}
formData.value.growthCycleUnit = row.growthCycleUnit || '1';
commonDialogVisible.value = true;
},
},
{
name: '填写实际种植信息',
icon: 'edit',
event: ({ row }) => {
currentAction.value = 'fillActual';
formData.value = { ...row };
if (isGridMember.value) {
formData.value.regionName = row.regionName;
formData.value.gridName = row.gridName;
}
formData.value.growthCycleUnit = row.growthCycleUnit || '1';
commonDialogVisible.value = true;
},
},
{
type: 'danger',
name: '删除',
icon: 'delete',
event: ({ row }) => rowDel(row),
},
],
},
pageData: {
total: 0,
currentPage: 1,
pageSize: 10,
},
data: [],
currentRow: {},
});
const formData = ref({
year: '',
regionCode: '',
gridId: '',
regionName: '',
gridName: '',
planName: '', //
cropsId: null,
cropsName: '',
plantingArea: null,
plantingMonths: '',
growthCycle: '',
growthCycleUnit: '1', //
note: '',
});
//
const submitForm = async () => {
try {
//
await planForm.value.validate();
//
console.log('表单数据:', formData.value);
if (currentAction.value === 'reCreate') {
//
await editAnnual(formData.value);
app.$message.success('重新制定计划成功');
} else if (currentAction.value === 'fillActual') {
//
await saveActualProgress(formData.value);
app.$message.success('填写实际种植信息成功');
} else if (currentAction.value === 'add') {
//
await saveAnnual(formData.value);
app.$message.success('新增年度种植计划成功');
}
commonDialogVisible.value = false;
loadData();
} catch (error) {
console.error('表单提交失败:', error);
if (error.errors) {
//
app.$message.error('请填写完整且正确的表单信息');
} else {
// API
app.$message.error('操作失败,请稍后重试');
}
}
};
const onAdd = () => {
currentAction.value = 'add';
formData.value = {
regionName: '',
gridName: '',
planName: '',
cropsName: '',
plantingArea: '',
plantingMonths: '',
growthCycle: '',
growthCycleUnit: '1',
};
commonDialogVisible.value = true;
};
//
const loadData = () => {
state.loading = true;
getAnnualList(state.query)
.then((res) => {
if (res.code === 200) {
const { current, size, total, records } = res.data;
state.data = records;
state.pageData = {
currentPage: current || 1,
pageSize: size || 10,
total: total,
};
}
})
.catch((err) => {
app.$message.error(err.msg);
state.data = [];
})
.finally(() => {
state.loading = false;
});
};
loadData();
//
const currentChange = (current) => {
state.query.current = current;
loadData();
};
//
const sizeChange = (size) => {
state.query.size = size;
loadData();
};
//
const searchChange = () => {
state.query = {
...state.query,
...areaQuery.value,
current: 1,
};
console.log('搜索参数', state.query);
loadData();
};
//
const resetSearch = () => {
state.query = {
current: 1,
size: 10,
id: '',
planName: '',
cropsName: '',
cropsId: '',
};
areaQuery.value.regionCode = '';
areaQuery.value.gridName = '';
areaQuery.value.gridId = '';
loadData();
};
//
const refreshChange = () => {
loadData();
app.$message.success('刷新成功');
};
//
const selectionChange = (rows) => {
state.selection = rows;
};
//
const rowDel = (row, index, done) => {
if (isEmpty(row)) return;
app
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
console.info('删除');
delAnnual({ id: row.id })
.then((res) => {
if (res.code === 200) {
app.$message.success('删除成功!');
// done();
loadData();
}
})
.catch((err) => {
app.$message.error(err.msg);
});
})
.catch(() => {});
};
//
const onExport = () => {
if (isEmpty(state.data)) {
app.$message.error('当前暂时没有可供导出的数据!');
return;
}
state.loading = true;
const fileName = '年度计划明细表';
exportAnnua(state.query)
.then((res) => {
if (res.status === 200) {
downloadFile(res.data, `${fileName}.xlsx`, 'blob');
app.$message.success('导出成功!');
}
})
.catch((err) => {
app.$message.error('导出失败!');
})
.finally(() => {
state.loading = false;
});
};
</script>
<style scoped lang="scss">
.custom-page {
/* 详情弹窗样式 */
/* 表单弹窗样式 */
.el-dialog {
.el-form {
padding: 0 20px;
width: 100%;
// background-color: aqua;
display: flex;
flex-wrap: wrap;
justify-content: center;
&-item {
margin-bottom: 18px;
width: 60%;
// background-color: #606266;
&__label {
font-weight: 500;
color: #606266;
}
/* 输入框和选择器统一宽度 */
.el-input,
.el-select,
.el-cascader {
width: 100%;
max-width: 400px;
}
/* 数字输入框和单位选择器组合 */
.el-input-number {
margin-right: 10px;
& + .el-select {
width: 100px;
}
}
}
}
}
/* 按钮样式微调 */
.el-button {
padding: 8px 16px;
border-radius: 4px;
& + .el-button {
margin-left: 12px;
}
}
/* 搜索区域样式 */
.custom-search {
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 16px;
border-radius: 8px;
// background-color: #f5f7fa;
.search-fields {
display: flex;
flex-wrap: wrap;
gap: 16px;
width: 100%;
margin-bottom: 16px;
}
.search-item {
display: flex;
align-items: center;
gap: 8px;
.el-input,
.el-select,
.el-cascader {
width: 200px;
}
span {
font-size: 14px;
color: #606266;
align-self: center;
}
}
.search-buttons {
display: flex;
align-self: center;
gap: 12px;
margin-left: 8px;
}
}
}
</style>

View File

@ -124,10 +124,10 @@ const option = ref({
hide: true,
editDisplay: false,
},
{
prop: 'distributor',
label: '经销商',
},
// {
// prop: 'distributor',
// label: '',
// },
{
prop: '_classifyId',
label: '分类',

View File

@ -0,0 +1,270 @@
<template>
<div class="custom-page">
<!-- 替换为 avue-crud 表格区域 -->
<avue-crud ref="crudRef" v-model:data="tableData" v-model:page="pagination" :option="options">
<template #search>
<!-- 搜索区域 -->
<div class="search-area">
<el-input v-model="searchForm.name" placeholder="投入品名称" style="width: 200px; margin-right: 10px"></el-input>
<el-button type="primary" @click="searchData">搜索</el-button>
<el-button @click="resetSearch">重置</el-button>
</div>
</template>
<template #menu-left><el-button type="primary" icon="Plus" @click="openDialog">新增</el-button></template>
<template #menu="scope">
<custom-table-operate :actions="options.actions" :data="scope" />
</template>
</avue-crud>
<!-- 新增/编辑弹窗 -->
<el-dialog v-model="dialogVisible" :title="isEdit ? '编辑投入品' : '新增投入品'" width="600px">
<el-form ref="formRef" :model="formData" label-width="100px" class="custom-form">
<el-form-item label="名称" prop="name">
<el-input v-model="formData.name" class="custom-input"></el-input>
</el-form-item>
<el-form-item label="规格" prop="specification">
<el-input v-model="formData.specification" class="custom-input"></el-input>
</el-form-item>
<el-form-item label="厂家" prop="manufacturer">
<el-input v-model="formData.manufacturer" class="custom-input"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" class="custom-input" type="textarea" :rows="3"></el-input>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer custom-footer">
<el-button @click="dialogVisible = false" class="custom-button">取消</el-button>
<el-button type="primary" @click="submitForm" class="custom-button">确定</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { ref, reactive, computed } from 'vue';
import { ElMessage } from 'element-plus';
import { CRUD_OPTIONS, customRules } from '@/config';
//
const initialTableData = [
{
id: 1,
name: '甘蔗专用全生物降解地膜',
specification: '厚度0.008mm-0.012mm宽度800mm-1200mm',
manufacturer: '耿马特斯郎全生物降解材料有限公司',
remark: '可根据甘蔗种植需求定制',
},
{
id: 2,
name: '华丰牌加厚地膜',
specification: '厚度≥0.01mm宽度75cm-140cm',
manufacturer: '河南省银丰塑料有限公司',
remark: '符合新国标',
},
{
id: 3,
name: '高速贴片式滴灌带',
specification: '管径16mm-20mm出水流量2.0L/h、2.7L/h',
manufacturer: '库车拉依苏裕丰农民专业合作社(新疆)',
remark: '多种规格可选',
},
{
id: 4,
name: '再生滴灌带',
specification: '500米/卷',
manufacturer: '宁夏佳稼旺生态农业科技有限公司',
remark: '以旧换新50公斤废旧滴灌带兑换500米新带',
},
{
id: 5,
name: '防草布PP编织',
specification: '宽度1.2m克重90g/㎡',
manufacturer: '昆明绿保塑业有限公司',
remark: '用于果园/经济作物抑草',
},
];
//
const searchForm = reactive({
name: '',
});
// avue-crud
const crudRef = ref(null);
//
const tableData = ref([...initialTableData]);
//
const pagination = reactive({
currentPage: 1,
pageSize: 10,
total: initialTableData.length,
});
// avue-crud
const options = reactive({
...CRUD_OPTIONS,
addBtn: false,
searchBtn: false,
emptyBtn: false,
column: [
{
label: '名称',
prop: 'name',
},
{
label: '规格',
prop: 'specification',
},
{
label: '厂家',
prop: 'manufacturer',
},
{
label: '备注',
prop: 'remark',
},
],
actions: [
{
name: '编辑',
icon: 'edit',
event: ({ row }) => editData(row),
},
{
type: 'danger',
name: '删除',
icon: 'delete',
event: ({ row }) => deleteData(row.id),
},
],
});
//
const dialogVisible = ref(false);
const isEdit = ref(false);
const formRef = ref(null);
const formData = reactive({
id: null,
name: '',
specification: '',
manufacturer: '',
remark: '',
});
//
const searchData = () => {
pagination.currentPage = 1;
const filteredData = initialTableData.filter((item) => item.name.includes(searchForm.name));
tableData.value = filteredData;
pagination.total = filteredData.length;
};
//
const resetSearch = () => {
searchForm.name = '';
pagination.currentPage = 1;
tableData.value = [...initialTableData];
pagination.total = initialTableData.length;
};
//
const openDialog = () => {
isEdit.value = false;
Object.keys(formData).forEach((key) => {
if (key !== 'id') {
formData[key] = '';
}
});
formData.id = tableData.value.length > 0 ? Math.max(...tableData.value.map((item) => item.id)) + 1 : 1;
dialogVisible.value = true;
};
//
const editData = (row) => {
isEdit.value = true;
Object.assign(formData, row);
dialogVisible.value = true;
};
//
const deleteData = (id) => {
tableData.value = tableData.value.filter((item) => item.id !== id);
pagination.total = tableData.value.length;
ElMessage.success('删除成功');
};
//
const submitForm = () => {
if (isEdit.value) {
const index = tableData.value.findIndex((item) => item.id === formData.id);
if (index !== -1) {
tableData.value[index] = { ...formData };
ElMessage.success('编辑成功');
}
} else {
tableData.value.push({ ...formData });
pagination.total = tableData.value.length;
ElMessage.success('新增成功');
}
dialogVisible.value = false;
};
</script>
<style scoped>
.custom-page {
padding: 20px;
height: calc(100vh - 150px);
}
.search-area {
margin-bottom: 20px;
}
.custom-form {
padding: 20px;
}
/* 自定义输入框样式 */
.custom-input {
border-radius: 6px;
transition:
border-color 0.3s,
box-shadow 0.3s;
}
.custom-input:hover {
border-color: #409eff;
}
.custom-input:focus-within {
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
}
/* 自定义备注输入框样式 */
.custom-input textarea {
border-radius: 6px;
}
/* 对话框底部按钮区域样式 */
.custom-footer {
padding: 10px 20px 20px;
}
/* 自定义按钮样式 */
.custom-button {
border-radius: 6px;
transition: transform 0.2s;
}
.custom-button:hover {
transform: translateY(-2px);
}
/* 主按钮悬停效果 */
.custom-button[type='primary']:hover {
opacity: 0.9;
}
</style>

View File

@ -176,12 +176,12 @@ const option = ref({
editDisplay: false,
rules: customRules({ msg: '请输入生产厂家' }),
},
{
prop: 'distributor',
width: '220',
label: '经销商',
editDisplay: false,
},
// {
// prop: 'distributor',
// width: '220',
// label: '',
// editDisplay: false,
// },
{
prop: 'productSpecification',
width: '100',

View File

@ -119,10 +119,10 @@ const option = ref({
rules: customRules({ msg: '请选择分类' }),
render: ({ row }) => row.classifyName ?? '',
},
{
prop: 'distributor',
label: '经销商',
},
// {
// prop: 'distributor',
// label: '',
// },
{
prop: 'productUnit',
width: '100',

View File

@ -137,178 +137,34 @@ const state = reactive({
{
label: '任务编号',
prop: 'taskCode',
fixed: true,
search: true,
editDisplay: false,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '任务名称',
prop: 'taskName',
search: true,
width: '240px',
showOverflowTooltip: true,
editDisplay: false,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '任务成员',
search: true,
prop: 'taskMembers',
disabled: false,
editDisplay: false,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '巡查类型',
prop: 'inspectionType',
editDisplay: false,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '巡查对象',
prop: 'inspectionTarget',
editDisplay: false,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '注意事项',
prop: 'notes',
type: 'textarea',
minRows: 2, //
maxRows: 5, //
editDisplay: false,
rows: 1,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '是否违法',
prop: 'isIllegal',
editDisplay: false,
addDisplay: false,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '状态',
prop: 'inspectionStatus',
editDisplay: false,
addDisplay: false,
},
],
group: [
{
label: '任务信息>',
prop: 'caseInfo',
addDisplay: false,
column: [
{
label: '任务编号',
prop: 'taskCode',
render: ({ row }) => {
return h('span', {}, row.taskCode);
},
},
{
label: '任务名称',
prop: 'taskName',
render: ({ row }) => {
return h('span', {}, row.taskCode);
},
},
{
label: '任务成员',
prop: 'taskMembers',
render: ({ row }) => {
return h('span', {}, row.taskCode);
},
},
{
label: '巡查类型',
prop: 'inspectionType',
render: ({ row }) => {
return h('span', {}, row.taskCode);
},
},
{
label: '巡查对象',
prop: 'inspectionTarget',
render: ({ row }) => {
return h('span', {}, row.taskCode);
},
},
{
label: '注意事项',
prop: 'notes',
render: ({ row }) => {
return h('span', {}, row.taskCode);
},
},
],
},
{
label: '巡查信息登记>',
prop: 'caseInfo',
addDisplay: false,
column: [
{
label: '是否违法',
prop: 'isIllegal',
span: 24,
display: true,
type: 'radio',
editDisplay: true,
disabled: isDisabled,
dicData: [
{
label: '是',
value: '1',
},
{
label: '否',
value: '0',
},
],
},
{
label: '巡查情况',
prop: 'inspectionSituation',
type: 'textarea',
disabled: isDisabled,
span: 24,
minRows: 3, //
maxRows: 5, //
display: true,
editDisplay: true,
},
],
},
],
actions: [

View File

@ -0,0 +1,87 @@
<template>
<el-form :model="localForm" label-width="120px" :disabled="readonly">
<el-row :gutter="20">
<el-col :span="24">
<h3>经营主体信息</h3>
</el-col>
<el-col :span="12">
<el-form-item label="农企/合作社名称">
<el-input v-model="localForm.name" placeholder="请输入" />
</el-form-item>
<el-form-item label="面积">
<el-input v-model="localForm.area" placeholder="请输入" />
</el-form-item>
<el-form-item label="联系人">
<el-input v-model="localForm.contactPerson" placeholder="请输入" />
</el-form-item>
<el-form-item label="农企/合作社照片">
<el-upload action="#" list-type="picture-card" :disabled="readonly" :auto-upload="false">
<el-icon><Plus /></el-icon>
</el-upload>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="地址">
<el-cascader v-model="localForm.address" :options="regionOptions" placeholder="请选择" />
</el-form-item>
<el-form-item label="经营产品">
<el-input v-model="localForm.product" placeholder="请输入" />
</el-form-item>
<el-form-item label="联系电话">
<el-input v-model="localForm.phone" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="24">
<h3>证件资料</h3>
<el-form-item label="营业执照">
<el-upload action="#" list-type="picture-card" :disabled="readonly" :auto-upload="false">
<el-icon><Plus /></el-icon>
</el-upload>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script setup>
import { reactive, watch } from 'vue';
import { Plus } from '@element-plus/icons-vue';
const props = defineProps({
modelValue: {
type: Object,
required: true,
default: () => ({}),
},
readonly: Boolean,
});
const emit = defineEmits(['update:modelValue']);
// props
const localForm = reactive({ ...props.modelValue });
//
watch(
localForm,
(newVal) => {
emit('update:modelValue', { ...newVal });
},
{ deep: true }
);
const regionOptions = [
{
label: '耿马县',
value: '耿马县',
children: [
{
label: '耿马镇',
value: '耿马镇',
children: [{ label: '新城村', value: '新城村' }],
},
],
},
];
</script>

View File

@ -0,0 +1,139 @@
<template>
<div class="tab-business">
<el-form :model="localForm" label-width="140px">
<el-row :gutter="24">
<!-- 负债表 -->
<el-col :span="24">
<el-form-item label="负债表">
<el-button type="text" @click="downloadTemplate('debt')"> 下载模板 </el-button>
<el-upload
class="upload-btn"
action="#"
:auto-upload="false"
:file-list="localForm.debtFiles"
:before-upload="(file) => handleImport('debt', file)"
:disabled="readonly"
>
<el-button size="small" :disabled="readonly">导入表格</el-button>
</el-upload>
</el-form-item>
</el-col>
<!-- 利润表 -->
<el-col :span="24">
<el-form-item label="利润表">
<el-button type="text" @click="downloadTemplate('profit')"> 下载模板 </el-button>
<el-upload
class="upload-btn"
action="#"
:auto-upload="false"
:file-list="localForm.profitFiles"
:before-upload="(file) => handleImport('profit', file)"
:disabled="readonly"
>
<el-button size="small" :disabled="readonly">导入表格</el-button>
</el-upload>
</el-form-item>
</el-col>
<!-- 现金流量表 -->
<el-col :span="24">
<el-form-item label="现金流量表">
<el-button type="text" @click="downloadTemplate('cashflow')"> 下载模板 </el-button>
<el-upload
class="upload-btn"
action="#"
:auto-upload="false"
:file-list="localForm.cashflowFiles"
:before-upload="(file) => handleImport('cashflow', file)"
:disabled="readonly"
>
<el-button size="small" :disabled="readonly">导入表格</el-button>
</el-upload>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- 底部按钮 -->
<div class="business-footer" style="text-align: right; margin-top: 20px">
<el-button :disabled="readonly" @click="$emit('prev')">上一步</el-button>
<el-button v-if="!readonly" type="primary" @click="$emit('next', localForm)"> 下一步 </el-button>
<el-button v-if="readonly" type="warning" @click="$emit('edit')"> 修改 </el-button>
</div>
</div>
</template>
<script setup>
import { reactive, watch } from 'vue';
const props = defineProps({
modelValue: {
type: Object,
default: () => ({}),
},
readonly: {
type: Boolean,
default: false,
},
});
const emit = defineEmits([
'update:modelValue',
'prev', //
'next', //
'edit', //
]);
//
const localForm = reactive({
debtFiles: props.modelValue.debtFiles || [],
profitFiles: props.modelValue.profitFiles || [],
cashflowFiles: props.modelValue.cashflowFiles || [],
});
// watch
watch(
() => localForm,
(val) => {
emit('update:modelValue', { ...val });
},
{ deep: true }
);
//
function downloadTemplate(type) {
let url = '';
switch (type) {
case 'debt':
url = '/templates/debt-template.xlsx';
break;
case 'profit':
url = '/templates/profit-template.xlsx';
break;
case 'cashflow':
url = '/templates/cashflow-template.xlsx';
break;
}
//
window.open(url, '_blank');
}
//
function handleImport(type, file) {
const key = type + 'Files'; // debtFiles / profitFiles / cashflowFiles
//
localForm[key] = [file];
//
return false;
}
</script>
<style scoped>
.upload-btn {
margin-left: 16px;
}
.business-footer el-button + el-button {
margin-left: 8px;
}
</style>

View File

@ -0,0 +1,54 @@
<template>
<el-form :model="localForm" label-width="160px" :disabled="readonly">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="信用评价">
<el-rate v-model="localForm.creditRating" allow-half show-score score-template="{value} 分" />
</el-form-item>
<el-form-item label="带动周边农户">
<el-rate v-model="localForm.farmersSupport" allow-half show-score score-template="{value} 分" />
</el-form-item>
<el-form-item label="社会效益">
<el-rate v-model="localForm.socialBenefit" allow-half show-score score-template="{value} 分" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="高新技术应用">
<el-rate v-model="localForm.techApplication" allow-half show-score score-template="{value} 分" />
</el-form-item>
<el-form-item label="产品质量及服务保障">
<el-rate v-model="localForm.qualityService" allow-half show-score score-template="{value} 分" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script setup>
import { reactive, watch } from 'vue';
const props = defineProps({
modelValue: {
type: Object,
required: true,
default: () => ({}),
},
readonly: Boolean,
});
const emit = defineEmits(['update:modelValue']);
const localForm = reactive({ ...props.modelValue });
watch(
localForm,
(val) => {
emit('update:modelValue', { ...val });
},
{ deep: true }
);
</script>

View File

@ -0,0 +1,81 @@
<template>
<el-form :model="localForm" label-width="150px" :disabled="readonly">
<el-row :gutter="20">
<!-- 左列 -->
<el-col :span="12">
<el-form-item label="企业名称">
<el-input v-model="localForm.companyName" placeholder="请输入" />
</el-form-item>
<el-form-item label="法定代表人">
<el-input v-model="localForm.legalPerson" placeholder="请输入" />
</el-form-item>
<el-form-item label="企业类型">
<el-select v-model="localForm.companyType" placeholder="请选择">
<el-option label="农民专业合作社" value="农民专业合作社" />
<el-option label="农业公司" value="农业公司" />
<el-option label="个体工商户" value="个体工商户" />
</el-select>
</el-form-item>
<el-form-item label="登记机关">
<el-input v-model="localForm.registerOrg" placeholder="请输入" />
</el-form-item>
<el-form-item label="核准日期">
<el-date-picker v-model="localForm.approvalDate" type="date" placeholder="请选择" format="YYYY年MM月DD日" value-format="YYYY-MM-DD" />
</el-form-item>
<el-form-item label="经营范围">
<el-input v-model="localForm.businessScope" type="textarea" placeholder="请输入" :rows="4" />
</el-form-item>
</el-col>
<!-- 右列 -->
<el-col :span="12">
<el-form-item label="统一社会信用代码">
<el-input v-model="localForm.creditCode" placeholder="请输入" />
</el-form-item>
<el-form-item label="登记状态">
<el-select v-model="localForm.registerStatus" placeholder="请选择">
<el-option label="存续" value="存续" />
<el-option label="注销" value="注销" />
<el-option label="吊销" value="吊销" />
</el-select>
</el-form-item>
<el-form-item label="成立日期">
<el-date-picker v-model="localForm.establishDate" type="date" placeholder="请选择" format="YYYY年MM月DD日" value-format="YYYY-MM-DD" />
</el-form-item>
<el-form-item label="成员出资总额">
<el-input v-model="localForm.totalCapital" placeholder="请输入" />
</el-form-item>
<el-form-item label="住所">
<el-input v-model="localForm.address" placeholder="请输入" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script setup>
import { reactive, watch } from 'vue';
const props = defineProps({
modelValue: {
type: Object,
required: true,
default: () => ({}),
},
readonly: Boolean,
});
const emit = defineEmits(['update:modelValue']);
// props
const localForm = reactive({ ...props.modelValue });
//
watch(
localForm,
(newVal) => {
emit('update:modelValue', { ...newVal });
},
{ deep: true }
);
</script>

View File

@ -0,0 +1,712 @@
<template>
<div class="custom-page">
<avue-crud ref="crudRef" v-model:page="pageData" :data="filteredData" :option="crudOptions" :table-loading="loading">
<template #menu-left>
<!-- <el-button type="primary" icon="Upload" @click="onImport">导入</el-button> -->
<el-button type="danger" icon="Delete" @click="onBatchDel">批量删除</el-button>
</template>
<template #menu="scope">
<custom-table-operate :actions="state.options.actions" :data="scope" />
</template>
</avue-crud>
</div>
</template>
<script setup>
import { reactive, ref, h } from 'vue';
import { useApp } from '@/hooks';
import { CRUD_OPTIONS } from '@/config';
import { isEmpty, downloadFile } from '@/utils';
import { useUserStore } from '@/store/modules/user';
import {
getOperationRecord,
saveOperationRecord,
editOperationRecord,
delOperationRecord,
exportOperationRecord,
getAddrCropByLand,
importOperationRecord,
} from '@/apis/land';
import uploadImg from '../components/uploadImg.vue';
const { VITE_APP_BASE_API } = import.meta.env;
const app = useApp();
const UserStore = useUserStore();
const crudRef = ref(null);
const handleLandChange = async (value, form, done) => {
if (!value || !value.item || !value.item.id) return; //
let val = {};
getAddrCropByLand(value.item?.id || '')
.then((res) => {
if (res.code === 200) {
val = res.data || {};
}
})
.catch((err) => {
val = {};
})
.finally(() => {});
state.form.crop = val?.crop || value.item?.crop;
state.form.address = val?.county + val?.town + val?.village || value.item?.address;
};
const productTypeOptions = reactive([
{ label: '蔬菜', value: '0' },
{ label: '水果', value: '1' },
{ label: '畜产品', value: '2' },
{ label: '水产品', value: '3' },
{ label: '谷物', value: '4' },
{ label: '农资', value: '5' },
{ label: '种源', value: '6' },
{ label: '农产品加工', value: '7' },
{ label: '其他', value: '8' },
]);
const bTypeOptions = reactive([
{ label: '农户', value: '0' },
// { label: '', value: '1' },
{ label: '合作社', value: '2' },
]);
let timeVal = ref([]);
const licenseImg = ref('');
const permitImg = ref('');
const data = reactive([
{
crop1: '100001',
crop2: '耿马佑氏种植专业合作社',
crop3: '蔬菜',
crop4: '>20人',
crop5: '云南省临沧市耿马县耿马镇城区甘东村允楞芒抗山',
crop6: '何仙义',
crop7: '18008834114',
crop8: '93530926MA6K3M3K5U',
crop9: '图片',
crop10: '无固定期限',
crop11: '已通过',
crop12: '暂无',
crop13: '2025-03-01',
},
{
crop1: '100002',
crop2: '耿马金田园种植专业合作社',
crop3: '蔬菜',
crop4: '>20人',
crop5: '云南省临沧市耿马县四排山公路6公里处',
crop6: '董福良',
crop7: '13578302599',
crop8: '93530926MA6N6C4N8U',
crop9: '图片',
crop10: '无固定期限',
crop11: '已通过',
crop12: '暂无',
crop13: '2025-01-01',
},
{
crop1: '100003',
crop2: '耿马原生茶叶种植专业合作社',
crop3: '蔬菜',
crop4: '>20人',
crop5: '云南省临沧市耿马县四排山公路20公里处',
crop6: '李伟荣',
crop7: '13529623147',
crop8: '935309260752901376',
crop9: '图片',
crop10: '无固定期限',
crop11: '已通过',
crop12: '暂无',
crop13: '2025-02-11',
},
{
crop1: '100004',
crop2: '耿马华侨金果源农业专业合作社',
crop3: '蔬菜',
crop4: '>20人',
crop5: '云南省临沧市耿马县华侨管理区第五居民小组',
crop6: '严共洪',
crop7: '13987011022',
crop8: '93530926MA6L3A7F8T',
crop9: '图片',
crop10: '无固定期限',
crop11: '已通过',
crop12: '暂无',
crop13: '2025-03-01',
},
{
crop1: '100005',
crop2: '耿马尖山沿边魔芋种植农民专业合作社',
crop3: '蔬菜',
crop4: '>20人',
crop5: '云南省临沧市耿马傣族佤族自治县孟定镇尖山村沿线9公里处',
crop6: '商德伟',
crop7: '13888526321',
crop8: '93530926MA6KR6E41C',
crop9: '图片',
crop10: '无固定期限',
crop11: '已通过',
crop12: '暂无',
crop13: '2025-04-25',
},
]);
const state = reactive({
loading: false,
query: {
current: 1,
size: 10,
},
form: {},
selection: [],
options: {
...CRUD_OPTIONS,
addBtnText: '添加',
searchLabelWidth: '120px',
searchSpan: 8,
searchGutter: 100,
searchMenuPosition: 'center',
column: [
{
label: '主体代码',
prop: 'crop1',
addDisplay: false,
editDisplay: false,
search: true,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '主体名称',
prop: 'crop2',
search: true,
addDisplay: false,
editDisplay: false,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '经营产品种类',
prop: 'crop3',
type: 'select',
remote: false,
search: true,
addDisplay: false,
editDisplay: false,
props: {
label: 'landName',
value: 'id',
},
dicHeaders: {
authorization: UserStore.token,
},
dicUrl: `${VITE_APP_BASE_API}/land-resource/landManage/page?current=1&size=9999&draftsSaveType=0&landName=&gridName=&owner=`,
dicFormatter: (res) => res.data.records ?? [],
rules: [
{
required: true,
message: '请选择地块',
trigger: 'blur',
},
],
change: handleLandChange,
},
// {
// label: '',
// showOverflowTooltip: true,
// search: false,
// addDisplay: false,
// editDisplay: false,
// rules: {
// required: true,
// message: '',
// trigger: 'blur',
// },
// },
{
label: '合作社规模',
prop: 'crop4',
search: false,
addDisplay: false,
editDisplay: false,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
// {
// label: '',
// prop: 'cities',
// type: 'cascader',
// hide: true,
// addDisplay: true,
// editDisplay: true,
// viewDisplay: false,
// // multiple: true,
// // checkStrictly: true,
// // collapseTags: true,
// // emitPath: false,
// // checkDescendants: false,
// props: {
// label: 'areaName',
// value: 'areaCode',
// children: 'areaChildVOS',
// },
// dicUrl: `${VITE_APP_BASE_API}/system/area/region?areaCode=530000`,
// dicHeaders: {
// authorization: UserStore.token,
// },
// dicFormatter: (res) => res.data ?? [],
// rules: {
// required: true,
// message: '',
// trigger: 'blur',
// },
// },
{
label: '合作社地址',
prop: 'crop5',
type: 'cascader',
addDisplay: false,
editDisplay: false,
checkStrictly: false,
search: false,
props: {
label: 'areaName',
value: 'areaCode',
children: 'areaChildVOS',
},
dicUrl: `${VITE_APP_BASE_API}/system/area/region?areaCode=530000`,
dicHeaders: {
authorization: UserStore.token,
},
dicFormatter: (res) => res.data ?? [],
rules: [
{
required: true,
message: '请选择',
trigger: 'blur',
},
],
},
{
label: '负责人',
prop: 'crop6',
search: false,
addDisplay: false,
editDisplay: false,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '负责人电话',
prop: 'crop7',
search: false,
addDisplay: false,
editDisplay: false,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '企业信用代码',
prop: 'crop8',
search: false,
addDisplay: false,
editDisplay: false,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
// {
// label: '',
// prop: 'crop9',
// search: false,
// addDisplay: false,
// editDisplay: false,
// rules: {
// required: true,
// message: '',
// trigger: 'blur',
// },
// },
{
label: '经营有效期',
prop: 'crop10',
search: false,
addDisplay: false,
editDisplay: false,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '审核状态',
prop: 'crop11',
addDisplay: false,
editDisplay: false,
search: false,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{
label: '审核意见',
prop: 'crop12',
addDisplay: false,
editDisplay: false,
rules: {
required: true,
message: '请输入',
trigger: 'blur',
},
},
{ label: '创建时间', prop: 'crop13', addDisplay: false, editDisplay: false, search: false },
],
group: [
{
label: '基本信息>',
prop: 'caseInfo',
column: [
{
label: '主体名称',
prop: 'businessName',
rules: { required: true, message: '请输入', trigger: 'blur' },
},
{
label: '合作社类型',
prop: 'bType',
type: 'select',
dicData: bTypeOptions,
rules: { required: true, message: '请选择', trigger: 'blur' },
},
{
label: '经营产品种类',
type: 'select',
dicData: productTypeOptions,
rules: { required: true, message: '请选择', trigger: 'blur' },
},
{
label: '主要产品',
prop: 'primaryProduct',
rules: { required: false, message: '请输入', trigger: 'blur' },
},
{
label: '合作社规模',
prop: 'inspectionType',
rules: { required: false, message: '请选择', trigger: 'blur' },
},
{
label: '负责人',
prop: 'inspectionTarget',
rules: { required: false, message: '请输入', trigger: 'blur' },
},
{
label: '负责人电话',
prop: 'inspectionTarget',
rules: { required: false, message: '请输入', trigger: 'blur' },
},
{
label: '合作社地址',
prop: 'villageCode',
rules: { required: true, message: '请输入', trigger: 'blur' },
type: 'cascader',
props: {
label: 'areaName',
value: 'areaCode',
children: 'areaChildVOS',
},
dicUrl: `${VITE_APP_BASE_API}/system/area/region?areaCode=530000`,
dicHeaders: {
authorization: UserStore.token,
},
dicFormatter: (res) => res.data ?? [],
},
{
label: '详细地址',
prop: 'notes',
rules: { required: true, message: '请输入', trigger: 'blur' },
},
],
},
{
label: '营业执照>',
prop: 'caseInfo',
column: [
{
label: '统一社会信用代码',
prop: 'notes',
rules: { required: true, message: '请输入', trigger: 'blur' },
},
{
label: '营业执照',
prop: 'license',
},
{
label: '有效期至',
prop: 'operationDate',
type: 'date',
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
width: 200,
rules: { required: true, message: '请输入', trigger: 'blur' },
},
{
label: '经营项目',
prop: 'inspectionSituation',
rules: { required: true, message: '请输入', trigger: 'blur' },
},
],
},
{
label: '经营许可证>',
prop: 'caseInfo',
column: [
{
label: '经营许可证编号',
prop: 'operationType',
rules: { required: false, message: '请输入', trigger: 'blur' },
},
{
label: '经营许可证',
prop: 'permit',
rules: { required: false, message: '请选择', trigger: 'blur' },
},
{
label: '有效期至',
prop: 'operationDate',
type: 'date',
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
width: 200,
rules: { required: true, message: '请输入', trigger: 'blur' },
},
],
},
],
searchColumn: [
{ label: '主体代码', prop: 'landName', search: true },
{ label: '主体名称', prop: 'crop', search: true },
{
label: '经营产品种类',
prop: 'operationType',
type: 'select',
search: true,
dicData: productTypeOptions,
},
{
label: '创建日期',
prop: 'operationDate',
type: 'daterange',
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
width: 200,
search: true,
},
],
actions: [
{
name: '详情',
icon: 'View',
event: ({ row }) => doDetail(row),
},
{
name: '编辑',
icon: 'edit',
event: ({ row }) => rowEdit(row),
},
{
type: 'danger',
name: '删除',
icon: 'delete',
event: ({ row }) => rowDel(row),
},
],
},
pageData: {
total: 0,
currentPage: 1,
pageSize: 10,
},
data: [],
currentRow: {},
});
//
const loadData = () => {
// state.loading = true;
// getOperationRecord(state.query)
// .then((res) => {
// if (res.code === 200) {
// const { current, size, total, records } = res.data;
// state.data = records;
// state.pageData = {
// currentPage: current || 1,
// pageSize: size || 10,
// total: total,
// };
// }
// })
// .catch((err) => {
// app.$message.error(err.msg);
// state.data = [];
// })
// .finally(() => {
// state.loading = false;
// });
};
loadData();
//
const currentChange = (current) => {
state.query.current = current;
loadData();
};
//
const sizeChange = (size) => {
state.query.size = size;
loadData();
};
//
const searchChange = (params, done) => {
if (done) done();
state.query = params;
state.query.current = 1;
loadData();
};
//
const refreshChange = () => {
loadData();
app.$message.success('刷新成功');
};
//
const selectionChange = (rows) => {
state.selection = rows;
};
const handleIds = () => {
let datalist = state.selection.map((m) => {
return { landId: m.landId, landName: m.landName };
});
let selectIdlist = uniqueObjects(datalist, 'landId');
let selectIdsVal = selectIdlist.map((n) => {
return n.landId;
});
return selectIdsVal.toString() || '';
};
function uniqueObjects(arr, key) {
return arr.reduce((acc, current) => {
const duplicate = acc.find((element) => element[key] === current[key]);
if (!duplicate) {
acc.push(current);
}
return acc;
}, []);
}
//
const rowSave = (row, done, loading) => {
// console.info('', row);
saveOperationRecord(row)
.then((res) => {
if (res.code === 200) {
app.$message.success('添加成功!');
done();
loadData();
}
})
.catch((err) => {
app.$message.error(err.msg);
})
.finally(() => {
loading();
});
};
//
const rowEdit = (row) => {
console.info('编辑', row);
crudRef.value.rowEdit(row);
};
const doDetail = (row) => {
crudRef.value.rowView(row);
};
const rowUpdate = (row, index, done, loading) => {
console.info('更新');
editOperationRecord(row)
.then((res) => {
if (res.code === 200) {
app.$message.success('更新成功!');
done();
loadData();
}
})
.catch((err) => {
app.$message.error(err.msg);
})
.finally(() => {
loading();
});
};
//
const rowDel = (row, index, done) => {
if (isEmpty(row)) return;
app
.$confirm(`删除后信息将不可查看,确认要删除吗?`, '确定删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
console.info('删除', row.recordId);
delOperationRecord(row.recordId || '')
.then((res) => {
if (res.code === 200) {
app.$message.success('删除成功!');
loadData();
done();
}
})
.catch((err) => {
app.$message.error(err.msg);
});
})
.catch(() => {});
};
const onBatchDel = () => {
let ids = handleIds();
if (!ids.length || ids.length <= 0) {
return app.$message.error('请先选择要删除的数据');
}
};
const fileChange = (name, list) => {
console.info('父组件', list);
};
</script>

View File

@ -1,254 +1,641 @@
<template>
<div class="custom-page">
<avue-crud
ref="crudRef"
v-model="state.form"
v-model:page="state.pageData"
:table-loading="state.loading"
:data="state.data"
:option="state.options"
@refresh-change="refreshChange"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@row-save="rowSave"
@row-update="rowUpdate"
@row-del="rowDel"
>
<template #menu-left>
<!-- <el-button type="primary" icon="Upload" @click="onImport">导入</el-button> -->
<!-- <el-button type="danger" icon="Delete" @click="onBatchDel">批量删除</el-button> -->
<!-- 关键词搜索 -->
<el-form :inline="true" :model="searchForm" class="search-bar">
<el-form-item label="关键词">
<el-input v-model="searchForm.name" placeholder="请输入关键词" clearable />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch">查询</el-button>
<el-button @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
<!-- 四个固定 Tabs -->
<el-tabs v-model="activeTab" @tab-click="handleTabChange">
<el-tab-pane label="待提交" name="0" />
<el-tab-pane label="待审核" name="1" />
<el-tab-pane label="已通过" name="2" />
<el-tab-pane label="已驳回" name="3" />
</el-tabs>
<!-- 表格 -->
<avue-crud ref="crudRef" v-model:page="pageData" :data="filteredData" :option="crudOptions" :table-loading="loading">
<template v-if="activeTab === '0'" #menu-left>
<el-button type="primary" icon="Plus" @click="handleAdd">新增</el-button>
</template>
<!-- <template #operationDate-search>
<el-date-picker v-model="timeVal" type="daterange" style="width: 230px" start-placeholder="开始" end-placeholder="结束" />
</template> -->
<template #menu="scope">
<custom-table-operate :actions="state.options.actions" :data="scope" />
<custom-table-operate :actions="getActions(scope.row)" :data="scope" />
</template>
</avue-crud>
<!-- 新增弹窗 -->
<el-dialog :key="dialogTitle" v-model="dialogVisible" :title="dialogTitle" width="80%">
<el-form :model="formData" label-width="120px" class="custom-form" :disabled="isReadonly">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="姓名" prop="name">
<el-input v-model="formData.name" placeholder="请输入姓名" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="证件类型" prop="idType">
<el-select v-model="formData.idType" placeholder="请选择证件类型" disabled>
<el-option label="身份证" value="101" />
<el-option label="护照" value="2" />
<el-option label="港澳身份证" value="3" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="证件号码" prop="idCard">
<el-input v-model="formData.idCard" placeholder="请输入证件号码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="性别" prop="sex">
<el-radio-group v-model="formData.sex">
<el-radio label="1"></el-radio>
<el-radio label="0"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="年龄" prop="age">
<el-input v-model="formData.age" placeholder="请输入年龄" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系方式" prop="phone">
<el-input v-model="formData.phone" placeholder="请输入联系方式" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="居住地行政区划" prop="address">
<area-select v-model="formData.address" :label="null" />
<!-- <el-input v-model="formData.detailAddress" placeholder="请选择居住地行政区划" /> -->
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="具体地址" prop="detailAddress">
<el-input v-model="formData.detailAddress" placeholder="请输入具体地址" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="种植面积" prop="area">
<el-input v-model="formData.area" placeholder="请输入种植面积" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="种植作物" prop="planCrop">
<!-- <el-select v-model="formData.planCrop" placeholder="种植作物" style="width: 380px" :clearable="true">
<el-option v-for="item in cropsOptions" :key="item.id" :label="item.cropsName" :value="item.id" />
</el-select> -->
<url-select
v-model="formData.planCrop"
url="/land-resource/crops/page"
:params="{ status: '0' }"
label-key="cropsName"
value-key="id"
placeholder="请选择种植作物"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button v-if="!isReadonly" type="primary" @click="handleSave">保存</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { reactive, ref } from 'vue';
import { useApp } from '@/hooks';
import { ref, computed, reactive, onMounted, watch } from 'vue';
import { ElMessageBox, ElMessage } from 'element-plus';
import { CRUD_OPTIONS } from '@/config';
import { isEmpty, downloadFile } from '@/utils';
import { useUserStore } from '@/store/modules/user';
import { fetchFarmerList, fetchFarmerById, saveFarmerList, editFarmer, approveFarmer, deleteFarmers } from '@/apis/businessEntity';
import { pageCropsList } from '@/apis/landResourceManagement/cropsManagement/index.js';
import {
fetchBusinessSubjectList,
saveBusinessSubject,
editBusinessSubject,
deleteBusinessSubject,
fetchBusinessSubjectInfo,
} from '@/apis/businessEntity';
// ---------------------------------------------------------------------
// 1.
// 'superadmin''auditor''submitter'
// ---------------------------------------------------------------------
const role = ref('superadmin'); // 'superadmin' / 'auditor' / 'submitter'
const { VITE_APP_BASE_API } = import.meta.env;
const app = useApp();
const UserStore = useUserStore();
const crudRef = ref(null);
//
const isSuperAdmin = computed(() => role.value === 'superadmin');
const isAuditor = computed(() => role.value === 'auditor');
const state = reactive({
loading: false,
query: { current: 1, size: 10, businessType: 0 },
form: {},
selection: [],
pageData: { currentPage: 1, pageSize: 10, total: 0 },
data: [],
options: {
...CRUD_OPTIONS,
addBtnText: '添加',
column: [
{ label: '主体代码', prop: 'id' },
{ label: '主体名称', prop: 'businessName' },
{
label: '经营产品种类',
prop: 'productType',
type: 'select',
dicData: [
{ label: '蔬菜', value: '0' },
{ label: '水果', value: '1' },
{ label: '畜产品', value: '2' },
{ label: '水产品', value: '3' },
{ label: '谷物', value: '4' },
{ label: '农资', value: '5' },
{ label: '种源', value: '6' },
{ label: '农产品加工', value: '7' },
{ label: '其他', value: '8' },
],
// ---------------------------------------------------------------------
// 2. Tab
// ---------------------------------------------------------------------
const activeTab = ref('0');
const dialogTitle = ref('新增');
const isReadonly = ref(false);
//
const searchForm = ref({
name: '',
idCard: '',
phone: '',
status: '',
userId: '',
});
const loading = ref(false);
const crudRef = ref();
//
const pageData = ref({
currentPage: 1,
pageSize: 10,
total: 0,
});
//
const allData = ref([]);
//
const dialogVisible = ref(false);
//
const defaultFormData = {
name: '',
idType: '101',
idCard: '',
sex: '1',
age: '',
phone: '',
provinceCode: '', //
cityCode: '', //
countyCode: '', //
townCode: '', //
street: '', //
address: [],
detailAddress: '',
area: '',
planCrop: '',
reason: '',
};
// 使
const formData = ref({ ...defaultFormData });
//
const resetForm = () => {
formData.value = { ...defaultFormData };
};
// tab +
const filteredData = computed(() => {
return allData.value.filter((row) => {
//
if (String(row.status) !== activeTab.value) return false;
// //
const kw = searchForm.value.name.trim();
if (kw) {
return row.name.includes(kw) || row.idCard.includes(kw) || row.phone.includes(kw);
}
return true;
});
});
// ==============================
// CRUD
// ==============================
const crudOptions = reactive({
...CRUD_OPTIONS,
addBtn: false,
searchBtn: false,
emptyBtn: false,
refreshBtn: false,
column: [
{ label: '姓名', prop: 'name' },
{
label: '证件类型',
prop: 'idType',
formatter: (row, column, cellValue) => {
return cellValue === '101' ? '身份证' : cellValue === '2' ? '护照' : cellValue === '3' ? '港澳身份证' : '';
},
{ label: '主要经营产品', prop: 'primaryProduct' },
{ label: '户主身份证号', prop: 'idCard' },
{
label: '联系地址',
prop: 'address',
type: 'cascader',
props: { label: 'areaName', value: 'areaCode', children: 'areaChildVOS' },
dicUrl: `${VITE_APP_BASE_API}/system/area/region?areaCode=530000`,
dicHeaders: { authorization: UserStore.token },
},
{ label: '证件号码', prop: 'idCardEncrypt' },
{
label: '性别',
prop: 'sex',
formatter: (row, column, cellValue) => {
return cellValue === '1' ? '男' : cellValue === '0' ? '女' : '';
},
{ label: '详细地址', prop: 'detailAddress' },
{ label: '联系电话', prop: 'phone' },
{
label: '审核状态',
prop: 'status',
type: 'select',
dicData: [
{ label: '未审核', value: 0 },
{ label: '通过', value: 1 },
{ label: '拒绝', value: 2 },
],
},
{ label: '审核意见', prop: 'reviewSuggestion' },
{ label: '创建时间', prop: 'createTime', type: 'datetime', format: 'YYYY-MM-DD HH:mm:ss' },
],
actions: [
{ name: '详情', event: ({ row }) => viewRow(row) },
{ name: '编辑', event: ({ row }) => editRow(row) },
{ type: 'danger', name: '删除', event: ({ row }) => deleteRow(row) },
],
},
},
{ label: '年龄', prop: 'age' },
{ label: '联系方式', prop: 'phone' },
{ label: '居住地行政区划', prop: 'address' },
{ label: '种植作物', prop: 'planCrop' },
{ label: '创建时间', prop: 'createTime' },
{ label: '更新时间', prop: 'updateTime' },
],
});
//
const loadData = () => {
state.loading = true;
fetchBusinessSubjectList(state.query)
.then((res) => {
if (res.code === 200) {
const { current, size, total, records } = res.data;
state.data = records;
state.pageData = {
currentPage: current || 1,
pageSize: size || 10,
total: total,
};
}
})
.catch((err) => {
app.$message.error(err.msg);
state.data = [];
})
.finally(() => {
state.loading = false;
});
};
loadData();
const editRow = (row) => {
fetchBusinessSubjectInfo(row.id).then((res) => {
crudRef.value.rowEdit(res.data);
});
};
const viewRow = (row) => {
fetchBusinessSubjectInfo(row.id).then((res) => {
crudRef.value.rowView(res.data);
});
};
const deleteRow = (row) => {
app
.$confirm('确认删除?', '删除', { type: 'warning' })
.then(() =>
deleteBusinessSubject(row.id).then(() => {
app.$message.success('删除成功');
loadData();
})
)
.catch(() => {});
};
//
const currentChange = (current) => {
state.query.current = current;
loadData();
};
//
const sizeChange = (size) => {
state.query.size = size;
loadData();
};
//
const searchChange = (params, done) => {
if (done) done();
state.query = params;
state.query.current = 1;
loadData();
};
//
const refreshChange = () => {
loadData();
app.$message.success('刷新成功');
};
//
const selectionChange = (rows) => {
state.selection = rows;
};
const handleIds = () => {
let datalist = state.selection.map((m) => {
return { landId: m.landId, landName: m.landName };
});
let selectIdlist = uniqueObjects(datalist, 'landId');
let selectIdsVal = selectIdlist.map((n) => {
return n.landId;
});
return selectIdsVal.toString() || '';
};
function uniqueObjects(arr, key) {
return arr.reduce((acc, current) => {
const duplicate = acc.find((element) => element[key] === current[key]);
if (!duplicate) {
acc.push(current);
// ---------------------------------------------------------------------
// 3. API/
// ---------------------------------------------------------------------
async function getData() {
loading.value = true;
try {
const params = {
...searchForm.value,
status: activeTab.value,
current: pageData.value.currentPage,
size: pageData.value.pageSize,
};
const response = await fetchFarmerList(params);
if (response.code === 200 && response.data) {
allData.value = response.data.records;
console.log('获取数据成功:', allData.value);
pageData.value = {
currentPage: response.data.current,
pageSize: response.data.size,
total: response.data.total,
};
} else {
ElMessage.error(response.msg || '获取数据失败');
}
return acc;
}, []);
} catch (error) {
ElMessage.error('获取数据失败,请稍后重试');
} finally {
loading.value = false;
}
}
//
const rowSave = (row, done, loading) => {
saveBusinessSubject(row)
.then(() => {
app.$message.success('添加成功');
done();
loadData();
})
.catch((e) => app.$message.error(e.msg))
.finally(() => loading());
};
const rowUpdate = (row, index, done, loading) => {
console.info('更新');
editBusinessSubject(row)
.then((res) => {
if (res.code === 200) {
app.$message.success('更新成功!');
done();
loadData();
}
})
.catch((err) => {
app.$message.error(err.msg);
})
.finally(() => {
loading();
});
};
const onBatchDel = () => {
let ids = handleIds();
if (!ids.length || ids.length <= 0) {
return app.$message.error('请先选择要删除的数据');
//
const cropsOptions = ref([]);
//
const fetchCropsList = async () => {
try {
// pageCropsList
const res = await pageCropsList({ status: '0' });
if (res.code === 200) {
console.log('res :>> ', res.data.records);
cropsOptions.value = res.data.records;
console.log('object :>> ', cropsOptions.value);
}
} catch (error) {
console.error('获取种植作物列表失败:', error);
}
};
function handleSearch() {
// filteredData
// activeTab + keyword
console.log('搜索关键词:', searchForm.value.keyword);
getData();
}
function handleReset() {
searchForm.value.keyword = '';
handleSearch();
}
function handleTabChange(tab) {
handleSearch();
}
//
const handleAdd = () => {
isReadonly.value = false; //
resetForm();
dialogTitle.value = '新增';
dialogVisible.value = true;
};
// address
watch(
() => formData.value.address,
(newValue) => {
if (newValue.length <= 3) {
formData.value.provinceCode = '530000';
formData.value.cityCode = '530900';
formData.value.countyCode = newValue[0];
formData.value.townCode = newValue[1];
formData.value.street = newValue[2];
}
}
);
// saveFarmerList
const handleSave = async () => {
try {
let response;
if (dialogTitle.value === '新增') {
// saveFarmerList
response = await saveFarmerList(formData.value);
if (response.code === 200) {
ElMessage.success('新增成功');
}
} else if (dialogTitle.value === '编辑') {
// editFarmer
response = await editFarmer(formData.value);
if (response.code === 200) {
ElMessage.success('编辑成功');
}
}
if (response && response.code === 200) {
dialogVisible.value = false;
getData(); //
}
} catch (error) {
if (dialogTitle.value === '新增') {
ElMessage.error('新增失败,请稍后重试');
} else {
ElMessage.error('编辑失败,请稍后重试');
}
}
};
const getFarmerById = async (id) => {
try {
const response = await fetchFarmerById(id);
if (response.code === 200 && response.data) {
return response.data;
} else {
ElMessage.error(response.msg || '获取数据失败');
return null;
}
} catch (error) {
ElMessage.error('获取数据失败,请稍后重试');
return null;
}
};
//
function handleView(row) {
console.log('查看', row);
dialogTitle.value = '查看';
isReadonly.value = true; //
dialogVisible.value = true;
getFarmerById(row.id).then((data) => {
if (data) {
const address = [data.countyCode, data.townCode, data.street].filter(Boolean);
formData.value = {
...data,
address,
};
}
});
//
}
// /
async function handleEdit(row) {
//
if (row.status === '2') {
try {
await ElMessageBox.confirm('编辑后数据将需要重新审核,是否继续?', '确认编辑', {
confirmButtonText: '继续编辑',
cancelButtonText: '取消',
type: 'warning',
});
} catch {
return; //
}
}
dialogTitle.value = '编辑';
isReadonly.value = false;
dialogVisible.value = true;
getFarmerById(row.id).then((data) => {
if (data) {
const address = [data.countyCode, data.townCode, data.street].filter(Boolean);
formData.value = {
...data,
address,
};
}
});
}
//
function handleSubmit(row) {
ElMessageBox.confirm('确定提交审核吗?', '提交审核').then(() => {
const params = {
id: row.id,
status: '1',
reason: row.reason || '',
};
approveFarmer(params)
.then(() => {
console.log(`ID=${row.id} 提交审核`);
row.rejectReason = ''; //
getData(); //
})
.catch(() => {
ElMessage.error('提交审核失败,请稍后重试');
});
});
}
//
//
function handleResubmit(row) {
ElMessageBox.confirm('确认重新提交吗?', '重新提交').then(() => {
const params = {
id: row.id,
status: '1', //
reason: '重新提交审核',
};
approveFarmer(params)
.then(() => {
console.log(`ID=${row.id} 重新提交审核`);
row.status = '1';
row.rejectReason = '';
getData();
ElMessage.success('已重新提交,状态已变为"待审核"');
})
.catch((error) => {
console.error('重新提交失败:', error);
ElMessage.error(error.response?.data?.msg || '重新提交失败');
});
});
}
//
function handleWithdraw(row) {
ElMessageBox.confirm('确认撤销本次审核吗?', '撤销').then(() => {
const params = {
id: row.id,
status: '0', //
reason: '用户主动撤销',
};
approveFarmer(params)
.then(() => {
console.log(`ID=${row.id} 撤销审核`);
row.status = '0';
getData();
ElMessage.success('已撤销,状态已变为"待提交"');
})
.catch((error) => {
console.error('撤销失败:', error);
ElMessage.error(error.response?.data?.msg || '撤销失败');
});
});
}
//
function handleApprove(row) {
ElMessageBox.confirm('确认通过审核?', '审核通过').then(() => {
const params = {
id: row.id,
status: '2', //
reason: '审核通过',
};
approveFarmer(params)
.then(() => {
console.log(`ID=${row.id} 审核通过`);
row.status = '2';
getData();
ElMessage.success('审核已通过');
})
.catch((error) => {
console.error('审核通过操作失败:', error);
ElMessage.error(error.response?.data?.msg || '审核操作失败');
});
});
}
//
function handleReject(row) {
ElMessageBox.prompt('请输入驳回原因', '审核驳回', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /.+/, //
inputErrorMessage: '驳回原因不能为空',
})
.then(({ value }) => {
const params = {
id: row.id,
status: '3', //
reason: value.trim(),
};
return approveFarmer(params).then(() => {
console.log(`ID=${row.id} 驳回,原因:${value.trim()}`);
row.status = '3';
row.rejectReason = value.trim();
getData();
ElMessage.success('已驳回');
});
})
.catch((error) => {
if (error !== 'cancel') {
console.error('驳回操作失败:', error);
ElMessage.error(error.response?.data?.msg || '驳回操作失败');
}
});
}
// /
function showRejectReason(row) {
ElMessageBox.alert(row.reason || '无驳回原因', '驳回原因');
}
async function handleDelete(row) {
try {
await ElMessageBox.confirm('确定删除该条记录?', '删除提示');
console.log(`删除 ID=${row.id}`);
await deleteFarmers(row.id); // ID
await getData();
ElMessage.success('已删除');
} catch (error) {
if (error !== 'cancel') {
ElMessage.error(`删除失败: ${error.message || '请稍后重试'}`);
}
}
}
//
const ACTION_MAP = {
view: { name: '查看', icon: 'view', handler: handleView },
edit: { name: '编辑', icon: 'edit', handler: handleEdit },
submit: { name: '提交审核', icon: 'submit', handler: handleSubmit },
delete: { type: 'danger', name: '删除', icon: 'delete', handler: handleDelete },
approve: { name: '通过', icon: 'approve', handler: handleApprove },
reject: { name: '驳回', icon: 'reject', handler: handleReject },
withdraw: { name: '撤销', icon: 'withdraw', handler: handleWithdraw },
resubmit: { name: '重新提交', icon: 'resubmit', handler: handleResubmit },
reason: { name: '驳回原因', icon: 'reason', handler: showRejectReason },
modify: { name: '修改', icon: 'edit', handler: handleEdit },
};
//
const ROLE_STATUS_ACTIONS = {
superadmin: {
0: ['view', 'edit', 'submit', 'delete'],
1: ['view', 'approve', 'reject', 'withdraw', 'delete'],
2: ['view', 'modify', 'delete'],
3: ['view', 'edit', 'reason', 'resubmit', 'delete'],
},
auditor: {
0: [],
1: ['view', 'approve', 'reject'],
2: ['view', 'delete'],
3: ['view', 'reason', 'delete'],
},
submitter: {
0: ['view', 'edit', 'submit', 'delete'],
1: ['view', 'withdraw', 'delete'],
2: ['view', 'modify', 'delete'],
3: ['view', 'edit', 'reason', 'resubmit', 'delete'],
},
};
//
function getActions(row) {
const currentRole = role.value;
const status = row.status;
const actionKeys = ROLE_STATUS_ACTIONS[currentRole]?.[status] || [];
return actionKeys.map((key) => {
const action = ACTION_MAP[key];
return {
...action,
event: () => action.handler(row),
};
});
}
// ---------------------------------------------------------------------
// 4. allData
// ---------------------------------------------------------------------
onMounted(() => {
getData();
fetchCropsList(); //
});
</script>
<style scoped lang="scss">
// :deep(.avue-crud__header) {
// display: none;
// }
.custom-page {
padding: 20px;
height: calc(100vh - 150px);
overflow-y: auto;
.search-bar {
margin-bottom: 20px;
}
}
.custom-form {
padding: 20px;
.el-form-item {
margin-bottom: 22px;
}
.el-input,
.el-select,
.el-cascader,
.el-date-picker {
width: 500px;
max-width: 100%; //
box-sizing: border-box; // padding/border
}
}
</style>

View File

@ -0,0 +1,254 @@
<template>
<div class="custom-page">
<avue-crud
ref="crudRef"
v-model="state.form"
v-model:page="state.pageData"
:table-loading="state.loading"
:data="state.data"
:option="state.options"
@refresh-change="refreshChange"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@row-save="rowSave"
@row-update="rowUpdate"
@row-del="rowDel"
>
<template #menu-left>
<!-- <el-button type="primary" icon="Upload" @click="onImport">导入</el-button> -->
<!-- <el-button type="danger" icon="Delete" @click="onBatchDel">批量删除</el-button> -->
</template>
<!-- <template #operationDate-search>
<el-date-picker v-model="timeVal" type="daterange" style="width: 230px" start-placeholder="开始" end-placeholder="结束" />
</template> -->
<template #menu="scope">
<custom-table-operate :actions="state.options.actions" :data="scope" />
</template>
</avue-crud>
</div>
</template>
<script setup>
import { reactive, ref } from 'vue';
import { useApp } from '@/hooks';
import { CRUD_OPTIONS } from '@/config';
import { isEmpty, downloadFile } from '@/utils';
import { useUserStore } from '@/store/modules/user';
import {
fetchBusinessSubjectList,
saveBusinessSubject,
editBusinessSubject,
deleteBusinessSubject,
fetchBusinessSubjectInfo,
} from '@/apis/businessEntity';
const { VITE_APP_BASE_API } = import.meta.env;
const app = useApp();
const UserStore = useUserStore();
const crudRef = ref(null);
const state = reactive({
loading: false,
query: { current: 1, size: 10, businessType: 0 },
form: {},
selection: [],
pageData: { currentPage: 1, pageSize: 10, total: 0 },
data: [],
options: {
...CRUD_OPTIONS,
addBtnText: '添加',
column: [
{ label: '主体代码', prop: 'id' },
{ label: '主体名称', prop: 'businessName' },
{
label: '经营产品种类',
prop: 'productType',
type: 'select',
dicData: [
{ label: '蔬菜', value: '0' },
{ label: '水果', value: '1' },
{ label: '畜产品', value: '2' },
{ label: '水产品', value: '3' },
{ label: '谷物', value: '4' },
{ label: '农资', value: '5' },
{ label: '种源', value: '6' },
{ label: '农产品加工', value: '7' },
{ label: '其他', value: '8' },
],
},
{ label: '主要经营产品', prop: 'primaryProduct' },
{ label: '户主身份证号', prop: 'idCard' },
{
label: '联系地址',
prop: 'address',
type: 'cascader',
props: { label: 'areaName', value: 'areaCode', children: 'areaChildVOS' },
dicUrl: `${VITE_APP_BASE_API}/system/area/region?areaCode=530000`,
dicHeaders: { authorization: UserStore.token },
},
{ label: '详细地址', prop: 'detailAddress' },
{ label: '联系电话', prop: 'phone' },
{
label: '审核状态',
prop: 'status',
type: 'select',
dicData: [
{ label: '未审核', value: 0 },
{ label: '通过', value: 1 },
{ label: '拒绝', value: 2 },
],
},
{ label: '审核意见', prop: 'reviewSuggestion' },
{ label: '创建时间', prop: 'createTime', type: 'datetime', format: 'YYYY-MM-DD HH:mm:ss' },
],
actions: [
{ name: '详情', event: ({ row }) => viewRow(row) },
{ name: '编辑', event: ({ row }) => editRow(row) },
{ type: 'danger', name: '删除', event: ({ row }) => deleteRow(row) },
],
},
});
//
const loadData = () => {
state.loading = true;
fetchBusinessSubjectList(state.query)
.then((res) => {
if (res.code === 200) {
const { current, size, total, records } = res.data;
state.data = records;
state.pageData = {
currentPage: current || 1,
pageSize: size || 10,
total: total,
};
}
})
.catch((err) => {
app.$message.error(err.msg);
state.data = [];
})
.finally(() => {
state.loading = false;
});
};
loadData();
const editRow = (row) => {
fetchBusinessSubjectInfo(row.id).then((res) => {
crudRef.value.rowEdit(res.data);
});
};
const viewRow = (row) => {
fetchBusinessSubjectInfo(row.id).then((res) => {
crudRef.value.rowView(res.data);
});
};
const deleteRow = (row) => {
app
.$confirm('确认删除?', '删除', { type: 'warning' })
.then(() =>
deleteBusinessSubject(row.id).then(() => {
app.$message.success('删除成功');
loadData();
})
)
.catch(() => {});
};
//
const currentChange = (current) => {
state.query.current = current;
loadData();
};
//
const sizeChange = (size) => {
state.query.size = size;
loadData();
};
//
const searchChange = (params, done) => {
if (done) done();
state.query = params;
state.query.current = 1;
loadData();
};
//
const refreshChange = () => {
loadData();
app.$message.success('刷新成功');
};
//
const selectionChange = (rows) => {
state.selection = rows;
};
const handleIds = () => {
let datalist = state.selection.map((m) => {
return { landId: m.landId, landName: m.landName };
});
let selectIdlist = uniqueObjects(datalist, 'landId');
let selectIdsVal = selectIdlist.map((n) => {
return n.landId;
});
return selectIdsVal.toString() || '';
};
function uniqueObjects(arr, key) {
return arr.reduce((acc, current) => {
const duplicate = acc.find((element) => element[key] === current[key]);
if (!duplicate) {
acc.push(current);
}
return acc;
}, []);
}
//
const rowSave = (row, done, loading) => {
saveBusinessSubject(row)
.then(() => {
app.$message.success('添加成功');
done();
loadData();
})
.catch((e) => app.$message.error(e.msg))
.finally(() => loading());
};
const rowUpdate = (row, index, done, loading) => {
console.info('更新');
editBusinessSubject(row)
.then((res) => {
if (res.code === 200) {
app.$message.success('更新成功!');
done();
loadData();
}
})
.catch((err) => {
app.$message.error(err.msg);
})
.finally(() => {
loading();
});
};
const onBatchDel = () => {
let ids = handleIds();
if (!ids.length || ids.length <= 0) {
return app.$message.error('请先选择要删除的数据');
}
};
</script>

View File

@ -78,6 +78,10 @@ const state = reactive({
// detail: true,
// detailTitle: '',
column: [
{
label: '网格编号',
prop: 'id',
},
{
label: '网格名称',
prop: 'gridName',

View File

@ -3,7 +3,6 @@
<avue-crud
ref="crudRef"
v-model="state.form"
v-model:search="state.query"
v-model:page="state.pageData"
:table-loading="state.loading"
:data="state.data"
@ -14,18 +13,64 @@
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@row-save="rowSave"
@row-update="rowUpdate"
@row-del="rowDel"
>
<template #menu-left>
<el-button type="primary" icon="Plus" @click="onAdd">新增</el-button>
<el-button type="success" icon="download" @click="onExport">导出</el-button>
</template>
<template #menu="scope">
<custom-table-operate :actions="state.options.actions" :data="scope" />
</template>
<template #search>
<div class="custom-search">
<div class="search-fields">
<div class="search-item">
<span>网格员姓名</span>
<el-input v-model="state.query.memberName" placeholder="网格员姓名" style="width: 200px; margin-right: 10px" />
</div>
<div class="search-item">
<AreaCascader
v-model:region-code="areaQuery.regionCode"
v-model:grid-id="areaQuery.gridId"
placeholder="选择行政区域与网格"
:show-separator="true"
:width="500"
/>
</div>
</div>
<div class="search-buttons">
<el-button type="primary" @click="triggerSearch">搜索</el-button>
<el-button @click="resetSearch">重置</el-button>
</div>
</div>
</template>
</avue-crud>
<el-dialog v-model="addDialogVisible" :title="isEdit ? '编辑网格员' : '新增网格员'" width="600px">
<el-form ref="addFormRef" :model="addForm" :rules="addFormRules" label-width="120px">
<el-form-item label="网格员姓名" prop="memberName">
<el-input v-model="addForm.memberName" style="width: 380px" />
</el-form-item>
<el-form-item label="" prop="gridId" label-width="0px">
<!-- 假设 AreaCascader 是行政区域-网格的级联选择组件 -->
<AreaCascader v-model:region-code="addForm.gridAreaCode" v-model:grid-id="addForm.gridId" split-rows label="" />
</el-form-item>
<el-form-item label="电话号码" prop="phone">
<el-input v-model="addForm.phone" style="width: 380px" />
</el-form-item>
<el-form-item label="备注" prop="note">
<el-input v-model="addForm.note" type="textarea" style="width: 380px" />
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="addDialogVisible = false">取消</el-button>
<el-button type="primary" @click="submitAddForm">确定</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
@ -44,73 +89,47 @@ const app = useApp();
const UserStore = useUserStore();
const crudRef = ref(null);
//
const areaQuery = reactive({
regionCode: '',
gridId: '',
});
const state = reactive({
loading: false,
query: { current: 1, size: 10 },
query: { current: 1, size: 10, memberName: '', gridAreaCode: '', gridId: '' },
form: {},
selection: [],
gridOptions: [],
options: {
...CRUD_OPTIONS,
addBtn: false,
searchBtn: false,
emptyBtn: false,
column: [
{
label: '网格员姓名',
prop: 'memberName',
searchLabelWidth: 100,
search: true,
rules: {
required: true,
message: '请输入网格员姓名',
trigger: 'blur',
},
},
{
label: '所属行政区域',
prop: 'gridAreaName',
width: 300,
searchLabelWidth: 110,
search: true,
rules: {
required: true,
message: '请输入所属区域',
trigger: 'blur',
},
},
{
label: '所属网格',
prop: 'gridId',
type: 'select',
width: 200,
search: true,
dicData: [], // loadGridOptions
props: {
label: 'gridName',
value: 'id',
},
rules: {
required: true,
message: '请选择所属网格',
trigger: 'change',
},
},
// {
// label: '',
// prop: 'adminFlag',
// type: 'radio',
// dicData: [
// { label: '', value: '1' },
// { label: '', value: '0' },
// ],
// valueDefault: '0',
// hide: true, // false
// },
{
label: '电话号码',
prop: 'phone',
rules: [
{ required: true, message: '请输入电话号码', trigger: 'blur' },
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码' },
],
},
{
label: '备注',
@ -149,7 +168,26 @@ const state = reactive({
data: [],
currentRow: {},
});
//
const addDialogVisible = ref(false);
const isEdit = ref(false);
const addFormRef = ref(null);
const addForm = reactive({
id: '',
memberName: '',
gridAreaCode: '',
gridId: '',
phone: '',
note: '',
});
const addFormRules = {
memberName: [{ required: true, message: '请输入网格员姓名', trigger: 'blur' }],
gridId: [{ required: true, message: '请选择所属网格', trigger: 'change' }],
phone: [
{ required: true, message: '请输入电话号码', trigger: 'blur' },
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码' },
],
};
const loadData = () => {
state.loading = true;
GetMemberList(state.query)
@ -196,6 +234,25 @@ const sizeChange = (size) => {
loadData();
};
//
const triggerSearch = () => {
state.query.gridAreaCode = areaQuery.regionCode;
state.query.gridId = areaQuery.gridId;
state.query.current = 1;
loadData();
};
//
const resetSearch = () => {
state.query.memberName = '';
state.query.gridAreaCode = '';
state.query.gridId = '';
areaQuery.regionCode = '';
areaQuery.gridId = '';
state.query.current = 1;
loadData();
};
const searchChange = (params, done) => {
if (done) done();
state.query = params;
@ -217,33 +274,36 @@ const rowView = (row) => {
};
const rowEdit = (row) => {
crudRef.value.rowEdit(row);
isEdit.value = true;
Object.assign(addForm, row);
addDialogVisible.value = true;
};
//
const onAdd = () => {
addDialogVisible.value = true;
//
Object.keys(addForm).forEach((key) => {
addForm[key] = '';
});
};
const rowSave = (row, done, loading) => {
AddMember(row)
.then((res) => {
if (res.code === 200) {
app.$message.success('添加成功!');
done();
loadData();
}
})
.catch((err) => app.$message.error(err.msg))
.finally(() => loading());
};
const rowUpdate = (row, index, done, loading) => {
UpdateMember(row)
.then((res) => {
if (res.code === 200) {
app.$message.success('更新成功!');
done();
loadData();
}
})
.catch((err) => app.$message.error(err.msg))
.finally(() => loading());
//
const submitForm = async () => {
if (!addFormRef.value) return;
try {
await addFormRef.value.validate();
if (isEdit.value) {
await UpdateMember(addForm);
app.$message.success('编辑网格员成功');
} else {
await AddMember(addForm);
app.$message.success('新增网格员成功');
}
addDialogVisible.value = false;
loadData();
} catch (error) {
app.$message.error(isEdit.value ? '编辑网格员失败' : '新增网格员失败');
}
};
const rowDel = (row, index, done) => {
@ -289,3 +349,49 @@ const onExport = () => {
});
};
</script>
<style scoped lang="scss">
.custom-page {
padding: 20px;
.custom-search {
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 16px;
border-radius: 8px;
// background-color: #f5f7fa;
.search-fields {
display: flex;
flex-wrap: wrap;
gap: 16px;
width: 100%;
margin-bottom: 16px;
}
.search-item {
display: flex;
align-items: center;
gap: 8px;
.el-input,
.el-select,
.el-cascader {
width: 200px;
}
span {
font-size: 14px;
color: #606266;
align-self: center;
}
}
.search-buttons {
display: flex;
align-self: center;
gap: 12px;
margin-left: 8px;
}
}
}
</style>

View File

@ -35,8 +35,8 @@ import Mock from 'mockjs';
const res = [
{
id: '100001',
name: '小麦',
shop: '万好芽种公司',
name: '云蔗05-51',
shop: '云南云蔗科技开发有限公司',
buyTime: '2025-01-20 20:32:24',
avalibleTime: '2026-01-20 20:32:24',
createdTime: '2025-01-20 20:32:24',
@ -44,15 +44,15 @@ const res = [
{
id: '100002',
name: '南瓜',
shop: '丰隆种源公司',
shop: '云南高原特色农业种子公司',
buyTime: '2025-01-15 14:20:21',
avalibleTime: '2026-01-15 14:20:21',
createdTime: '2025-01-15 14:20:21',
},
{
id: '100003',
name: '玉米',
shop: '万好芽种公司',
name: '小米辣',
shop: '云南宏斌绿色食品集团',
buyTime: '2025-01-12 17:25:32',
avalibleTime: '2026-01-12 17:25:32',
createdTime: '2025-01-12 17:25:32',

View File

@ -104,3 +104,24 @@ export function mainPage(params = {}) {
params,
});
}
//修改地址
export function updateOrderReceiveAddress(params = {}) {
return request('/user-center/orderInfo/updateOrderReceiveAddress', {
method: 'GET',
params,
});
}
//获取订单详情
export function orderInfoGetById(params = {}) {
return request('/user-center/orderInfo/getById', {
method: 'GET',
params,
});
}
//申请退款
export function refundApprove(params = {}) {
return request('/user-center/refund/refundApprove', {
method: 'POST',
data: params,
});
}

View File

@ -71,13 +71,13 @@ export const constantRoutes = [
path: '/sub-operation-service/userOrders',
component: () => import('@/views/userCenter/userOrders.vue'),
name: 'userOrders',
meta: { title: '我的订单' },
meta: { title: '我的订单', keepAlive: true },
},
{
path: '/sub-operation-service/orderDetails',
component: () => import('@/views/userCenter/orderDetails.vue'),
name: 'orderDetails',
meta: { title: '订单详情' },
meta: { title: '订单详情', keepAlive: true },
},
{
path: '/sub-operation-service/userLands',
@ -511,4 +511,13 @@ const router = createRouter({
routes: constantRoutes,
});
router.beforeEach((to, from) => {
console.log(from.path);
console.log(to.path);
if (from.path === '/sub-operation-service/orderDetails' && to.path === '/sub-operation-service/userOrders') {
to.meta.keepAlive = true; // 从详情页返回列表页时启用缓存
}
});
export default router;

View File

@ -1,7 +1,7 @@
<template>
<div>
<el-dialog v-model="dialogVisible" title="地址" width="40%" :before-close="handleClose">
<el-form :label-position="labelPosition" label-width="130px" :model="formLabelAlign" style="max-width: 460px">
<el-form :label-position="labelPosition" label-width="130px" :model="formLabelAlign" style="max-width: 1000px">
<el-form-item label="联系人" prop="receiverName" :rules="[{ required: true, message: '请输入联系人' }]">
<el-input v-model="formLabelAlign.receiverName" />
</el-form-item>
@ -9,14 +9,13 @@
<el-input v-model="formLabelAlign.receiverPhone" />
</el-form-item>
<el-form-item label="省市区" prop="postArea" :rules="[{ required: true, message: '省市区' }]">
<!-- <el-input v-model="formLabelAlign.region" /> -->
<el-cascader v-model="formLabelAlign.postArea" :props="props" :options="options" @change="handleChange" />
<el-cascader v-model="formLabelAlign.postArea" style="width: 100%" :props="props" :options="options" @change="handleChange" />
</el-form-item>
<el-form-item label="详细地址" prop="postAddress" :rules="[{ required: true, message: '详细地址' }]">
<el-input v-model="formLabelAlign.postAddress" />
<el-input v-model="formLabelAlign.postAddress" :autosize="{ minRows: 2, maxRows: 4 }" type="textarea" />
</el-form-item>
<el-form-item label="默认地址" prop="isDefault" :rules="[{ required: true, message: '默认地址' }]">
<el-switch v-model="formLabelAlign.isDefault" size="large" active-text="是" inactive-text="否" />
<el-switch v-model="formLabelAlign.isDefault" style="margin-top: -3px" size="large" active-text="是" inactive-text="否" />
</el-form-item>
</el-form>
<template #footer>
@ -39,71 +38,95 @@
</div> -->
</div>
<div>
<div style="margin-right: 20px" class="batch-del" @click="add()">
<el-icon><Plus color="#000000" /></el-icon> <span class="del-txt">新增</span>
<div class="up-text" @click="add()">
添加地址
<!-- <el-icon><Plus color="#000000" /></el-icon> <span class="del-txt">新增</span> -->
</div>
<!-- <div class="batch-del" @click="doBatchDel">
<el-icon><Delete /></el-icon> <span class="del-txt">批量删除</span>
</div> -->
</div>
</div>
<div class="conetnt-warp">
<div class="content-item-warp">
<div v-for="(n, index) in data" :key="n.id" class="content-item">
<div class="shop-info">
<div class="shop-do" @click="toCheckShop(index)">
<!-- <ischeck :value="n.ischeck"></ischeck> -->
<div v-if="data.length <= 0" class="empty">
<img style="width: 300px; height: 300px" src="../../assets/images/empty.png" alt="" />
</div>
<div v-else class="conetnt-warp">
<div class="content-item-warp" :style="{ height: tableViewportHeight + 'px' }">
<tableComponent
:table-data="data"
:columns="columns"
:show-border="false"
:show-selection="fasle"
:header-cell-class-name="getHeaderClass"
@page-change="handlePaginationChange"
@selection-change="handleSelectionChange"
>
<template #isDefault="slotProps">
<div style="width: 120px; display: flex; align-items: center; justify-content: flex-start">
<el-checkbox
:disabled="slotProps.row.isDefault == '1' ? false : true"
:checked="slotProps.row.isDefault == '1' ? true : false"
size="large"
/>
</div>
<!-- <div class="shop-img">
<costomImg
:url="'images/ecommerce/' + 'pic.png'"
:preview-list="[getAssetsFile('images/ecommerce/' + 'pic.png')?.href ?? '']"
:is-view="false"
></costomImg>
</div> -->
</template>
<template #postAddress="slotProps">
<div style="display: flex; align-items: center">{{ slotProps.row.postArea.join(',') }}{{ slotProps.row.postAddress }}</div>
</template>
<template #action="slotProps">
<div style="width: 100px; display: flex; align-items: center; justify-content: space-between">
<div class="upButton" @click="showDialogVisible(slotProps.row)">编辑</div>
<div class="upButton" @click="del(slotProps.row)">删除</div>
</div>
</template>
</tableComponent>
<!-- <el-table
:show-selection="true"
:header-cell-class-name="getHeaderClass"
:data="data"
style="width: 100%"
@page-change="handlePaginationChange"
@selection-change="handleSelectionChange"
>
<el-table-column prop="date" label="默认收货地址" width="120">
<template #default="slotProps">
<div style="width: 120px; display: flex; align-items: center; justify-content: flex-start">
<el-checkbox
:disabled="slotProps.row.isDefault == '1' ? false : true"
:checked="slotProps.row.isDefault == '1' ? true : false"
size="large"
/>
</div>
</template>
</el-table-column>
<el-table-column prop="receiverName" label="收货人" width="120" />
<el-table-column prop="receiverPhone" label="联系电话" width="160" />
<el-table-column label="详细地址">
<template #default="slotProps">
<div style="display: flex; align-items: center">{{ slotProps.row.postArea.join(',') }}{{ slotProps.row.postAddress }}</div>
</template>
</el-table-column>
<el-table-column prop="date" label="操作" width="180">
<template #default="slotProps">
<div style="width: 100px; display: flex; align-items: center; justify-content: space-between">
<div class="upButton" @click="showDialogVisible(slotProps.row)">编辑</div>
<div class="upButton" @click="del(slotProps.row)">删除</div>
</div>
</template>
</el-table-column>
</el-table> -->
<!-- <div v-for="(n, index) in data" :key="n.id" class="content-item">
<div class="shop-info">
<div class="shop-do" @click="toCheckShop(index)"></div>
<span style="border: 1px solid #dddddd; border-radius: 5px; padding: 3px 5px" class="shop-name txt-ellipsis clamp2"
>联系人{{ n.receiverName }}联系人手机号{{ n.receiverPhone }}地址{{ n.postArea }}{{ n.postAddress }}</span
>
<div style="color: #25bf82; font-size: 20px" @click="showDialogVisible(n)">修改</div>
<div style="color: red; font-size: 20px" @click="del(n)">删除</div>
</div>
<!-- <div v-if="n.cartDetails && n.cartDetails.length > 0" class="good-list">
<div v-for="(g, indexg) in n.cartDetails" :key="indexg" class="good-item">
<div class="good-do" @click="toCheckGood(index, indexg)">
<div class="good-do-pos">
<ischeck :value="g.ischeck" size="24px"></ischeck>
</div>
</div>
<div class="good-img" @click="toCheckGood(index, indexg)">
<img class="good-img" style="border-radius: 5px" :src="g.productImgUrl" alt="" />
</div>
<div class="good-info" @click="toCheckGood(index, indexg)">
<div class="good-info-pos">
<div class="txt-ellipsis clamp2">{{ g.productName || '--' }}</div>
</div>
</div>
<div class="good-price-num">
<div class="good-price-num-pos">
<div class="price" @click="toCheckGood(index, indexg)">{{ g.price }} / {{ g.quantity }}</div>
<div class="total" @click="toCheckGood(index, indexg)">{{ (g.price * g.quantity).toFixed(2) }}</div>
<div class="num">
<div class="right-item">
<el-input-number v-model="g.quantity" :min="1" @change="numberChange(index, indexg)">
<template #suffix>
<span>{{ g.quantity }}</span>
</template>
</el-input-number>
</div>
</div>
<div class="good-del" @click="doSingleDel(index, indexg)">
<span>删除</span>
</div>
</div>
</div>
</div>
</div> -->
</div>
</div> -->
</div>
</div>
</div>
@ -121,6 +144,7 @@ import userHeader from './components/userHeader.vue';
import ischeck from './components/ischeck.vue';
import costomImg from '@/components/costomImg.vue';
import { useApp } from '@/hooks';
import tableComponent from './components/tableComponent.vue';
import {
shoppingCart,
deleteChooseGoods,
@ -155,6 +179,57 @@ let formLabelAlign = reactive({
isDefault: false,
});
const columns = ref([
{ prop: 'isDefault', label: '是否默认地址', slotName: 'isDefault', width: '180px' },
{ prop: 'receiverName', label: '联系人' },
{ prop: 'receiverPhone', label: '联系人手机号' },
{ prop: 'postAddress', label: '详细地址', slotName: 'postAddress', width: '250px' },
{ prop: 'action', label: '操作', slotName: 'action', width: '180' },
]);
const titleRef = ref(null);
const searchBarRef = ref(null);
const tableViewportHeight = ref(0);
//
const calculateTableHeight = () => {
//
const windowHeight = window.innerHeight;
//
const headerHeight = titleRef.value?.$el?.offsetHeight || 0;
const searchBarHeight = searchBarRef.value?.offsetHeight || 0;
//
const paddingCompensation = 60;
//
tableViewportHeight.value = windowHeight - headerHeight - searchBarHeight - paddingCompensation - 80;
// console.log(tableViewportHeight.value);
};
// ,columnsheaderClassName: 'custom-header'
const getHeaderClass = ({ column }) => {
return 'custom-header';
};
//
const handlePaginationChange = ({ page, pageSize }) => {
console.log('分页变化:', page, pageSize);
// API
// fetchData(page, limit,pageSize)
};
//
const handleSelectionChange = (selection) => {
console.log('选中项:', selection);
};
let nowClickRow = ref(null);
//
const handleEdit = (row, num) => {
nowClickRow.value = row;
console.log('编辑的行:', row);
console.log('第几个按钮:', num);
};
const options = json;
const handleClose = () => {
@ -194,6 +269,7 @@ const submit = (value) => {
onMounted(() => {
getUserAddressList();
calculateTableHeight();
});
const handleChange = (value) => {
@ -203,6 +279,9 @@ const handleChange = (value) => {
const getUserAddressList = () => {
userPostAddress(page).then((res) => {
res.data.records.forEach((item) => {
item.postArea = item.postArea.split(',');
});
console.log(res.data.records);
data.value = res.data.records;
addIsCheckProperty(data);
@ -428,12 +507,36 @@ function removeCheckedItems(data) {
}
</script>
<style lang="scss" scoped>
:deep(.el-checkbox__inner) {
border-radius: 50%;
width: 16px;
height: 16px;
background-color: #25bf82;
}
:deep(.el-checkbox__inner::after) {
border: none;
width: 6px;
height: 6px;
background: #25bf82;
}
.up-text {
font-size: 20px;
color: #25bf82;
margin-right: 75px;
cursor: pointer;
}
.upButton {
cursor: pointer;
color: #25bf82;
font-size: 15px;
}
.my-shoping-car-warp {
width: 100%;
.page-content-warp {
position: relative;
overflow: hidden;
margin: 16px 0 0 16px;
margin: 16px 0 0;
width: 100%;
height: calc(100vh - 135px);
border-radius: 16px;
@ -531,7 +634,7 @@ function removeCheckedItems(data) {
}
.conetnt-warp {
overflow-y: auto;
padding: 80px 16px 96px;
// padding: 80px 16px 96px;
width: 100%;
height: 100%;
.content-item-warp {

View File

@ -1,139 +1,156 @@
<template>
<div>
<el-dialog v-model="refundVs" title="退货/退款" width="800" :before-close="handleClose">
<div class="refundVs-title">退货/退款原因</div>
<el-select v-model="optionsValue" placeholder="Select" size="large" style="width: 765px" @change="change">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<div class="refundVs-title" style="margin-top: 15px">退货/退款描述</div>
<el-input v-model="input" type="textarea" size="large" style="width: 765px" placeholder="退货/退款描述" clearable />
<template #footer>
<div class="dialog-footer">
<el-button @click="refundVs = false">取消</el-button>
<el-button type="primary" @click="upRefund()"> 确认 </el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="dialogVisible" title="修改地址" width="800" :before-close="handleClose">
<el-radio-group v-model="radio1" @change="changeAddress">
<el-radio v-for="(item, index) in data" :key="item.id" :value="item.id"
><div style="font-size: 15px">
联系人:{{ item.receiverName }}, 联系人手机号:{{ item.receiverPhone }}, 地址:{{ item.postArea }} {{ item.postAddress }}
</div></el-radio
>
</el-radio-group>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="upAddress()"> 确认 </el-button>
</div>
</template>
</el-dialog>
<common current-name="order">
<template #main>
<div class="sure-order-warp">
<userHeader :title="'订单信息'"></userHeader>
<!-- <div class="addr-list">
<div class="addr-list-top">
<div class="back">
<el-icon><ArrowLeftBold /></el-icon>
<span>确认收货地址</span>
</div>
<div class="addr-manage" @click="goAddressList()">管理地址</div>
</div>
<el-scrollbar>
<div class="scrollbar-flex-content">
<div
v-for="(item, index) in addrlist"
:key="item.id"
class="addr-item"
:class="currentAddr == item.id ? 'addr-item-act' : 'addr-item-normal'"
@click="selectAddr(item.id)"
@mouseover="hoverAddr(true, index)"
@mouseleave="hoverAddr(false, index)"
<div class="user-orders-warp">
<userHeader :title="'订单详情'"></userHeader>
<div class="user-orders-content">
<div class="order-tab">
<div class="order-tab-title">
<el-icon style="cursor: pointer" size="30" @click="back()"><ArrowLeftBold /></el-icon>
<span style="font-weight: bold; color: #25bf82; font-size: 20px">
{{
JSON.parse(route.query.page).orderStatus == '1'
? '待支付'
: JSON.parse(route.query.page).orderStatus == '2' || JSON.parse(route.query.page).orderStatus == '3'
? '待发货'
: JSON.parse(route.query.page).orderStatus == '4' || JSON.parse(route.query.page).orderStatus == '5'
? '已发货'
: JSON.parse(route.query.page).orderStatus == '6'
? '已收货'
: JSON.parse(route.query.page).orderStatus == '7'
? '已取消'
: JSON.parse(route.query.page).orderStatus == '8'
? '已完成'
: ''
}}</span
>
<div class="addr-item-icon">
<div class="icon-pos">
<div class="iconfont icon-location"></div>
<span v-if="JSON.parse(route.query.page).orderStatus == '1'" style="font-size: 15px">在71小时59分59秒之前发货</span>
</div>
</div>
<div class="order-list-warp">
<div class="order-list-warp-left">
<div style="display: flex; align-items: center; justify-content: flex-start; margin-top: 20px">
<el-icon size="30"><LocationFilled /></el-icon>
<div class="order-list-warp-left-address">
<div>{{ detailsData.receiverAddress }}</div>
<div>{{ detailsData.receiverName }} {{ detailsData.receiverPhone }}</div>
</div>
</div>
<div class="order-list-warp-left-title">商品信息</div>
<div v-for="(item, index) in detailsData.orderItemInfos" :key="item.id" class="order-list-warp-left-goods">
<div class="order-list-warp-left-goods-list">
<img style="width: 100px; height: 100px" :src="item.productImage" alt="" />
<div class="order-list-warp-left-goods-list-info">
<div class="order-list-warp-left-goods-list-info-title">{{ item.productName }}</div>
<div class="order-list-warp-left-goods-list-info-info">{{ item.unitPrice }}/{{ item.unit }}</div>
</div>
</div>
<div class="addr-item-info">
<div class="region">{{ item.postArea || '--' }}</div>
<div class="addr">{{ item.postAddress || '--' }}</div>
<div class="link-name">
{{ item.receiverName }} {{ item.receiverPhone }} <text v-if="currentAddr == item.id" style="color: #25bf82">当前选中</text>
</div>
<div>
<div style="color: #25bf82; font-size: 15px">{{ item.subtotalAmount }}</div>
<div style="font-size: 15px; color: #999999; width: 50px; text-align: right">x{{ item.quantity }}</div>
</div>
</div>
</div>
</el-scrollbar>
</div> -->
<div class="order-info">
<div class="order-info-top">订单信息</div>
<div class="order-statu-info">
<div class="order-statu-info-list">订单编号{{ datalist[0]?.orderNo }}</div>
<div class="order-statu-info-list">创建时间{{ datalist[0]?.orderNo }}</div>
<div class="order-statu-info-list">支付时间{{ datalist[0]?.orderNo }}</div>
</div>
<div class="order-info-list">
<div class="content-item-warp">
<div class="content-item-header">
<div class="header-th first">商品</div>
<div class="header-th other">规格</div>
<div class="header-th other">原价</div>
<div class="header-th other">数量</div>
<div class="header-th other">小计</div>
</div>
<div class="content-item-list">
<div v-for="(n, index) in datalist" :key="index" class="content-item">
<div class="shop-info">
<div class="shop-img">
<costomImg
:url="'images/ecommerce/' + 'pic.png'"
:preview-list="[getAssetsFile('images/ecommerce/' + 'pic.png')]"
:is-view="false"
></costomImg>
</div>
<!-- <span class="shop-name txt-ellipsis clamp2">订单编号{{ n.orderNo }}</span> -->
</div>
<div v-if="n.orderItemInfos && n.orderItemInfos.length > 0" class="good-list">
<div v-for="(g, indexg) in n.orderItemInfos" :key="indexg" class="good-item">
<div class="good-img">
<costomImg
:url="'images/ecommerce/' + 'pic.png'"
:preview-list="[getAssetsFile('images/ecommerce/' + 'pic.png')]"
:is-view="false"
></costomImg>
</div>
<div class="good-info">
<div class="good-info-pos">
<div class="txt-ellipsis clamp2">{{ g.productName || '--' }}</div>
</div>
</div>
<div class="good-price-num">
<div class="good-price-num-pos">
<div class="price">{{ g.unitPrice }} / {{ g.unit }}</div>
<div class="total">{{ g.unitPrice }}</div>
<div class="num">
<div class="right-item">
<el-input-number v-model="g.quantity" :disabled="true" :min="1">
<template #suffix>
<span>{{ g.unit }}</span>
</template>
</el-input-number>
</div>
</div>
<div class="good-total">
{{ (g.unitPrice * g.quantity).toFixed(2) }}
</div>
</div>
</div>
</div>
</div>
<div class="order-list-warp-right">
<div style="margin-top: 20px">
<div style="width: 100%; text-align: left; font-size: 18px; font-weight: bold">订单详情</div>
<div class="order-list-warp-right-list">
<div>订单编号</div>
<div style="color: #000000">{{ detailsData.orderNo }}</div>
</div>
<div class="order-list-warp-right-list">
<div>订单备注</div>
<div style="color: #000000">{{ detailsData.orderNote ?? '暂无备注' }}</div>
</div>
<div class="order-list-warp-right-list">
<div>商品总数</div>
<div style="color: #000000">{{ detailsData.totalQuantity }}</div>
</div>
<div class="order-list-warp-right-list">
<div>创建时间</div>
<div style="color: #999999">{{ detailsData.createTime }}</div>
</div>
<div v-if="detailsData.paymentTime" class="order-list-warp-right-list">
<div>付款时间</div>
<div style="color: #999999">{{ detailsData.paymentTime }}</div>
</div>
</div>
<div class="content-item-bottom">
<div class="num-total">
<span class="num-val">{{ totalNum }}</span
>件商品
<div v-if="detailsData.totalAmount" style="margin-top: 30px">
<div style="width: 100%; text-align: left; font-size: 18px; font-weight: bold">付款信息</div>
<div class="order-list-warp-right-list">
<div>商品总价</div>
<div style="color: #000000">{{ detailsData.totalAmount }}</div>
</div>
<div class="price-total">
<div class="amount cost-item">
<span>商品总价</span>
<span class="coat-val">{{ totalAmout.toFixed(2) }}</span>
</div>
<div class="freight cost-item">
<span>运费</span>
<span class="coat-val">{{ carriage.toFixed(2) }}</span>
</div>
<div class="order-list-warp-right-list">
<div>运费</div>
<div style="color: #000000">{{ detailsData.totalShipFee }}</div>
</div>
<div class="order-list-warp-right-list">
<div>优惠金额</div>
<div style="color: #999999">{{ detailsData.discountAmount }}</div>
</div>
<div class="order-list-warp-right-list">
<div>实付金额</div>
<div style="color: #999999">{{ detailsData.payableAmount }}</div>
</div>
</div>
</div>
</div>
<!-- <div class="order-bottom">
<div class="bottom-total">
<span class="tips">实付款</span>
<span class="total">{{ (totalAmout + carriage).toFixed(2) }}</span>
<div style="display: flex; align-items: center; justify-content: start">
<div v-if="detailsData.orderStatus == '1'" class="button-bottom" @click="doPay(1)">立即付款</div>
<div
v-if="
detailsData.orderStatus == '2' || detailsData.orderStatus == '3' || detailsData.orderStatus == '4' || detailsData.orderStatus == '5'
"
class="button-bottom"
@click="confirmReceipt()"
>
确认收货
</div>
<div class="bottom-do">
<el-button type="primary" @click="toSureOrder">提交订单</el-button>
<div class="button-bottoms" @click="reAddress()">修改地址</div>
<div
v-if="
detailsData.orderStatus == '2' || detailsData.orderStatus == '3' || detailsData.orderStatus == '4' || detailsData.orderStatus == '5'
"
class="button-bottoms"
@click="refund()"
>
退货/退款
</div>
</div> -->
<div v-if="detailsData.orderStatus == '1'" class="button-bottoms" @click="doCancel">取消订单</div>
<!-- <div class="button-bottoms">打印订单</div> -->
</div>
</div>
</div>
</template>
@ -144,472 +161,259 @@
import { userPostAddress, upOrderInfoList, confirmOrder } from '../../apis/user';
import common from './components/common.vue';
import { ref, reactive, computed, onMounted } from 'vue';
import { isEmpty, getAssetsFile } from '@/utils';
import userHeader from './components/userHeader.vue';
import { useRoute, useRouter } from 'vue-router';
import { cancelOrder, updateOrderReceiveAddress, orderInfoGetById, refundApprove } from '../../apis/user';
import { useGetUserOrder } from '../../store/modules/userOrder';
let store = useGetUserOrder();
let dialogVisible = ref(false);
let refundVs = ref(false);
const router = useRouter();
const route = useRoute();
let addressId = ref(0);
let data = ref([]);
let detailsData = ref([]);
let radio1 = ref(0);
let input = ref('');
let page = reactive({
orderStatus: 1,
current: 1,
size: 10,
});
let optionsValue = ref('不想要了');
let addrlist = ref([]);
let currentAddr = ref(0);
let total = ref(99);
let orderList = ref([]);
const options = [
{
value: '不想要了',
label: '不想要了',
},
{
value: '与卖家协商一致',
label: '与卖家协商一致',
},
{
value: '货物损坏',
label: '货物损坏',
},
{
value: '实物与宣传不符',
label: '实物与宣传不符',
},
];
onMounted(() => {
getAddressList();
getOrderInfo();
getDetails();
getUserAddressList();
});
let datalist = ref([
// {
// id: '01',
// shop: '',
// shopimg: '',
// ischeck: false,
// orderItemInfos: [
// { id: '001', title: ' 西', price: 4.9, unit: '', num: 2, ischeck: false },
// { id: '002', title: ' 西', price: 2.6, unit: '', num: 100, ischeck: false },
// ],
// },
// {
// id: '02',
// shop: '',
// shopimg: '',
// ischeck: false,
// orderItemInfos: [{ id: '001', title: ' ', price: 4.9, unit: '', num: 2, ischeck: false }],
// },
]);
const getAddressList = () => {
userPostAddress().then((res) => {
addrlist.value = res.data.records;
currentAddr.value = addrlist.value[0].id;
console.log(addrlist);
addrlist.value.forEach((item) => {
if (item.isDefault == '1') {
currentAddr.value = item.id;
}
const confirmReceipt = () => {
getDetails();
};
const change = (value) => {
console.log(value);
optionsValue.value = value;
};
const getDetails = () => {
orderInfoGetById({ id: route.query.id }).then((res) => {
detailsData.value = res.data.records[0];
});
};
const changeAddress = (value) => {
addressId.value = value;
};
const doCancel = () => {
cancelOrder({ id: route.query.id }).then((res) => {
store.getData(JSON.parse(route.query.page)).then((res) => {
router.back();
});
});
};
const getOrderInfo = () => {
upOrderInfoList({ id: route.query.id }).then((res) => {
datalist.value = res.data.records;
const refund = () => {
refundVs.value = true;
};
const upRefund = () => {
refundApprove({
orderId: 0,
refundCategory: '1',
refundType: 1,
refundReason: input,
}).then((res) => {
getDetails();
refundVs.value = false;
});
};
const goAddressList = () => {
router.push('/sub-operation-service/addressList');
};
const selectAddr = (data) => {
currentAddr.value = data;
};
//
const hoverAddr = (data, index) => {
console.log('data', data, index);
addrlist.value.forEach((item, i) => {
if (index == i) {
item.isEditBtn = data;
}
});
};
//
const editAddr = (data) => {
console.log('data', data);
};
const toSureOrder = () => {
confirmOrder({ id: route.query.id, userChooseAddressId: currentAddr.value }).then((res) => {
// router.push('/sub-operation-service/orderSuccess');
router.push({
path: '/sub-operation-service/orderSuccess',
query: { id: route.query.id },
});
// useRouter().push({ path: '/sub-operation-service/orderSuccess' });
const upAddress = () => {
updateOrderReceiveAddress({ orderId: route.query.id, addressId: addressId.value }).then((res) => {
getDetails();
dialogVisible.value = false;
});
};
let carriage = ref(0);
let totalAmout = computed(() => {
let num = 0;
let list = [];
if (datalist.value && datalist.value.length > 0) {
list = datalist.value
.map((m) => {
return m.orderItemInfos;
})
.flat();
const reAddress = () => {
dialogVisible.value = true;
};
// console.info('totalAmout**************', list);
if (list && list.length > 0) {
num = list.reduce((acc, current) => {
return acc + current.unitPrice * current.quantity;
}, 0);
}
}
const doPay = () => {
router.push({
path: '/sub-operation-service/orderSuccess',
query: { id: route.query.id },
});
};
return num;
});
const getUserAddressList = () => {
userPostAddress({ size: 100, current: 1 }).then((res) => {
console.log(res.data.records);
data.value = res.data.records;
});
};
let totalNum = computed(() => {
let num = 0;
let list = [];
if (datalist && datalist.value.length > 0) {
list = datalist.value
.map((m) => {
return m.orderItemInfos;
})
.flat();
if (list && list.length > 0) {
num = list.reduce((acc, current) => {
return acc + 1;
}, 0);
}
}
return num;
});
const back = () => {
router.back();
};
</script>
<style lang="scss" scoped>
.sure-order-warp {
.refundVs-title {
font-size: 15px;
color: #999999;
margin-bottom: 10px;
}
.user-orders-warp {
width: 100%;
.addr-list {
overflow: hidden;
margin: 16px 0;
.user-orders-content {
margin-top: 16px;
padding: 16px;
width: 100%;
height: calc(100vh - 136px);
border-radius: 16px;
background: $color-fff;
.addr-list-top {
display: inline-flex;
justify-content: space-between;
margin-bottom: 16px;
width: 100%;
.back {
font-size: 20px;
.el-icon {
font-size: 30px;
}
.el-icon,
span {
display: inline-block;
vertical-align: middle;
}
}
.addr-manage {
font-size: 20px;
cursor: pointer;
}
}
.scrollbar-flex-content {
.order-list-warp {
display: flex;
width: fit-content;
gap: 16px;
}
.addr-item {
display: inline-flex;
justify-content: flex-start;
padding: 16px 8px;
width: 280px;
border-radius: 16px;
background: $color-fff;
cursor: pointer;
&.addr-item-act {
border: 1px solid $color-main;
.iconfont {
color: $color-main !important;
justify-content: space-between;
width: 100%;
.order-list-warp-left {
width: 55%;
height: 70vh;
.order-list-warp-left-title {
margin-top: 20px;
font-size: 18px;
font-weight: bold;
text-align: left;
}
.order-list-warp-left-goods {
margin-top: 20px;
display: flex;
justify-content: space-between;
.order-list-warp-left-goods-list {
display: flex;
.order-list-warp-left-goods-list-info {
margin-left: 10px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
height: 100px;
.order-list-warp-left-goods-list-info-title {
text-align: left;
width: 300px;
font-size: 15px;
}
.order-list-warp-left-goods-list-info-info {
margin-top: 10px;
text-align: left;
width: 300px;
font-size: 12px;
color: #999999;
}
}
}
}
.order-list-warp-left-address {
font-size: 15px;
text-align: start;
margin-left: 15px;
}
}
&.addr-item-normal {
border: 1px solid $color-da;
}
.addr-item-icon,
.addr-item-info {
display: inline-block;
vertical-align: middle;
text-align: left;
}
.addr-item-icon {
display: inline-flex;
justify-content: center;
flex-direction: column;
.iconfont {
font-size: 20px;
color: $color-666;
}
}
.addr-item-info {
padding-left: 8px;
font-size: 15px;
line-height: 24px;
.region,
.link-name {
color: $color-999;
position: relative;
.bj {
color: #25bf82;
position: absolute;
right: 0;
.order-list-warp-right {
width: 40%;
height: 70vh;
.order-list-warp-right-list {
margin-top: 20px;
display: flex;
align-items: center;
justify-content: space-between;
div {
font-size: 14px;
color: #999999;
}
}
}
}
}
.order-info {
position: relative;
padding: 16px;
.order-tab {
width: 100%;
height: calc(100vh - 340px);
border-radius: 16px;
background: $color-fff;
.order-info-top,
.order-bottom,
.order-info-list {
position: absolute;
left: 0;
z-index: 1;
padding: 16px;
width: 100%;
}
.order-statu-info {
text-align: left;
margin-top: 40px;
z-index: 1;
padding: 16px;
width: 100%;
font-size: 18px;
.order-statu-info-list {
margin-top: 10px;
::v-deep() {
.el-tabs__nav-wrap::after {
background: transparent !important;
}
}
.order-info-top {
top: 0;
font-size: 20px;
}
.order-bottom {
bottom: 0;
display: inline-flex;
justify-content: space-between;
.bottom-total,
.bottom-do {
display: inline-block;
vertical-align: middle;
.el-tabs__item {
font-size: 20px !important;
}
.bottom-total {
.tips,
.total {
display: inline-block;
vertical-align: middle;
}
.tips {
font-size: 30px;
}
.total {
padding-left: 16px;
font-size: 42px;
color: $color-main;
}
.total::before {
content: '¥';
}
.el-tabs__active-bar {
height: 5px !important;
border-radius: 4px;
}
.bottom-do {
.el-descriptions__label,
.el-descriptions__content {
font-size: 16px !important;
}
.cell-item {
display: inline-flex;
justify-content: center;
flex-direction: column;
::v-deep() {
.el-button {
display: inline-block !important;
padding: 0 40px !important;
height: 42px !important;
font-size: 18px !important;
line-height: 42px !important;
}
}
}
.el-descriptions__label {
color: $color-999;
}
.el-descriptions__content {
color: $color-333;
}
}
.order-info-list {
position: relative;
top: 30px;
left: 16px;
padding: 16px;
width: calc(100% - 32px);
height: calc(100% - 150px);
border-radius: 16px;
background: $color-f5;
.content-item-warp {
position: relative;
width: 100%;
height: 100%;
.content-item-header {
position: absolute;
top: 0;
left: 0;
display: inline-flex;
justify-content: flex-start;
width: 100%;
gap: 16px;
.header-th {
display: inline-block;
margin-bottom: 16px;
font-size: 20px;
color: $color-999;
vertical-align: middle;
line-height: 32px;
&.first {
width: 340px;
text-align: left;
}
&.other {
width: calc((100% - 340px) / 4);
text-align: center;
}
}
}
.content-item-list {
position: absolute;
top: 48px;
left: 0;
overflow-y: auto;
width: 100%;
height: calc(100% - 100px);
}
.content-item {
margin-bottom: 16px;
width: 100%;
cursor: pointer;
.shop-info {
display: inline-flex;
justify-content: flex-start;
width: 100%;
gap: 16px;
.shop-do,
.shop-img,
.shop-name {
display: inline-block;
vertical-align: middle;
}
.shop-img {
display: inline-flex;
justify-content: center;
width: 32px;
height: 32px;
border-radius: 4px;
flex-direction: column;
}
.shop-do {
display: inline-flex;
justify-content: center;
width: 30px;
flex-direction: column;
}
.shop-name {
width: calc(100% - 62px);
font-size: 18px;
}
}
.good-list {
width: 100%;
.good-item {
display: inline-flex;
justify-content: flex-start;
margin: 8px 0;
padding-left: 16px;
width: 100%;
gap: 16px;
}
.good-do,
.good-img,
.good-info,
.good-price-num {
display: inline-block;
vertical-align: middle;
}
.good-do {
display: inline-flex;
flex-direction: column;
justify-content: center;
.good-do-pos {
}
}
.good-img {
width: 120px;
height: 120px;
}
.good-info {
display: inline-flex;
justify-content: center;
width: 200px;
flex-direction: column;
.good-info-pos {
font-size: 18px;
color: $color-666;
}
}
.good-price-num {
display: inline-flex;
justify-content: center;
width: calc(100% - 340px);
flex-direction: column;
.good-price-num-pos {
display: inline-flex;
justify-content: space-around;
gap: 16px;
.price,
.total {
font-size: 20px;
}
.price {
font-weight: 400;
}
.total {
font-weight: 700;
color: $color-main;
}
.total::before {
content: '¥';
}
.good-total {
font-size: 16px;
color: $color-main;
}
}
}
}
}
.content-item-bottom {
position: absolute;
bottom: -8px;
left: 0;
z-index: 2;
display: inline-flex;
justify-content: space-between;
width: 100%;
line-height: 48px;
.num-total,
.price-total {
display: inline-block;
vertical-align: middle;
font-size: 20px;
.cost-item {
display: inline-block;
margin: 0 16px;
.coat-val::before {
content: '¥';
}
}
}
.num-total {
.num-val {
padding: 0 8px;
font-size: 24px;
font-weight: bold;
color: $color-main;
}
}
}
.order-tab-title {
width: 100%;
display: flex;
align-items: center;
span {
margin-left: 10px;
}
}
}
}
.button-bottom {
cursor: pointer;
width: 100px;
border-radius: 10px;
height: 40px;
color: #fff;
line-height: 40px;
font-size: 15px;
font-weight: bold;
background-color: #25bf82;
}
.button-bottoms {
cursor: pointer;
margin-left: 20px;
width: 100px;
border-radius: 10px;
height: 40px;
color: #000000;
line-height: 40px;
font-size: 15px;
background-color: #ffffff;
border: 1px solid #707070;
}
</style>

View File

@ -27,13 +27,13 @@
<div class="shop-do">
<ischeck :value="n.ischeck"></ischeck>
</div>
<div class="shop-img">
<!-- <div class="shop-img">
<costomImg
:url="'images/ecommerce/' + 'pic.png'"
:preview-list="[getAssetsFile('images/ecommerce/' + 'pic.png')?.href ?? '']"
:is-view="false"
></costomImg>
</div>
</div> -->
<span class="shop-name txt-ellipsis clamp2">{{ n.cartName }}</span>
</div>
@ -375,7 +375,7 @@ function removeCheckedItems(data) {
.page-content-warp {
position: relative;
overflow: hidden;
margin: 16px 0 0 16px;
margin: 16px 0 0;
width: 100%;
height: calc(100vh - 135px);
border-radius: 16px;

View File

@ -55,25 +55,22 @@
<div class="content-item-list">
<div v-for="(n, index) in datalist" :key="index" class="content-item">
<div class="shop-info">
<div class="shop-img">
<!-- <div class="shop-img">
<costomImg
:url="'images/ecommerce/' + 'pic.png'"
:preview-list="[getAssetsFile('images/ecommerce/' + 'pic.png')]"
:is-view="false"
></costomImg>
</div>
</div> -->
<span class="shop-name txt-ellipsis clamp2">{{ n.shop }}</span>
</div>
<div v-if="n.orderItemInfos && n.orderItemInfos.length > 0" class="good-list">
<div v-for="(g, indexg) in n.orderItemInfos" :key="indexg" class="good-item">
<div class="good-img">
<costomImg
:url="'images/ecommerce/' + 'pic.png'"
:preview-list="[getAssetsFile('images/ecommerce/' + 'pic.png')]"
:is-view="false"
></costomImg>
<img class="good-img" :url="g.productImage" />
</div>
<!-- :preview-list="[getAssetsFile('images/ecommerce/' + 'pic.png')]" -->
<div class="good-info">
<div class="good-info-pos">
<div class="txt-ellipsis clamp2">{{ g.productName || '--' }}</div>

View File

@ -73,7 +73,7 @@
</div>
<div v-if="o.orderStatus == '5'" class="right-item">已发货</div>
<div v-if="o.orderStatus == '5'" class="right-item text-link">快递单号</div>
<!-- <div class="right-item text-link" @click="goInfo(o.id)">订单详情</div> -->
<div class="right-item text-link" @click="goInfo(o.id)">订单详情</div>
<div class="right-item text-link">
{{
o.orderStatus == '7'
@ -133,7 +133,7 @@ let handleClick = (value) => {
const goInfo = (id) => {
router.push({
path: '/sub-operation-service/orderDetails',
query: { id: id },
query: { id: id, page: JSON.stringify(page) },
});
};
@ -141,8 +141,8 @@ let bottomList = reactive([
{ title: '全部', name: 'all' },
{ title: '待付款', name: '1' },
{ title: '待发货', name: '3' },
{ title: '待收货', name: '5' },
{ title: '已发货', name: '6' },
{ title: '待收货', name: '5' },
]);
onMounted(() => {