一大波修改 #1
@ -13,8 +13,8 @@ VITE_APP_SUB_GSR = '//localhost:9530/new-digital-agriculture-screen/'
|
|||||||
VITE_APP_BASE_API = '/apis'
|
VITE_APP_BASE_API = '/apis'
|
||||||
VITE_APP_UPLOAD_API = '/uploadApis'
|
VITE_APP_UPLOAD_API = '/uploadApis'
|
||||||
# 阿里云接口地址
|
# 阿里云接口地址
|
||||||
VITE_APP_BASE_URL = 'http://47.109.205.240:8080'
|
# VITE_APP_BASE_URL = 'http://47.109.205.240:8080'
|
||||||
VITE_APP_UPLOAD_URL = 'http://47.109.205.240:9300'
|
# VITE_APP_UPLOAD_URL = 'http://47.109.205.240:9300'
|
||||||
# 内网接口地址
|
# 内网接口地址
|
||||||
# VITE_APP_BASE_URL = 'http://192.168.18.99:8080'
|
VITE_APP_BASE_URL = 'http://192.168.18.99:8080'
|
||||||
# VITE_APP_UPLOAD_URL = 'http://192.168.18.99:8080'
|
VITE_APP_UPLOAD_URL = 'http://192.168.18.99:8080'
|
||||||
|
@ -9,9 +9,9 @@ VITE_APP_BASE_API = '/apis'
|
|||||||
VITE_APP_UPLOAD_API = '/uploadApis'
|
VITE_APP_UPLOAD_API = '/uploadApis'
|
||||||
|
|
||||||
# 阿里云接口地址
|
# 阿里云接口地址
|
||||||
VITE_APP_BASE_URL = 'http://47.109.205.240:8080'
|
# VITE_APP_BASE_URL = 'http://47.109.205.240:8080'
|
||||||
VITE_APP_UPLOAD_URL = 'http://47.109.205.240:9300'
|
# VITE_APP_UPLOAD_URL = 'http://47.109.205.240:9300'
|
||||||
|
|
||||||
# 内网接口地址
|
# 内网接口地址
|
||||||
# VITE_APP_BASE_URL = 'http://192.168.18.99:8080'
|
VITE_APP_BASE_URL = 'http://192.168.18.99:8080'
|
||||||
# VITE_APP_UPLOAD_URL = 'http://192.168.18.99:8080'
|
VITE_APP_UPLOAD_URL = 'http://192.168.18.99:8080'
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
import request from '@/utils/axios';
|
import request from '@/utils/axios';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产经营主体农户 - 列表查询
|
* 农户 - 列表查询
|
||||||
* @param {Object} params 查询参数
|
* @param {Object} params 查询参数
|
||||||
*/
|
*/
|
||||||
export function getFarmerList(params) {
|
export function fetchFarmerList(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/product-business/business/farmer/businessPage',
|
url: '/product-business/business/farmer/businessPage',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@ -14,7 +14,7 @@ export function getFarmerList(params) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产经营主体农户 - 新增
|
* 农户 - 新增
|
||||||
* @param {Object} data 经营主体数据
|
* @param {Object} data 经营主体数据
|
||||||
*/
|
*/
|
||||||
export function saveFarmerList(data) {
|
export function saveFarmerList(data) {
|
||||||
@ -26,7 +26,7 @@ export function saveFarmerList(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产经营主体农户 - 编辑
|
* 农户 - 编辑
|
||||||
* @param {Object} data 经营主体数据
|
* @param {Object} data 经营主体数据
|
||||||
*/
|
*/
|
||||||
export function editFarmer(data) {
|
export function editFarmer(data) {
|
||||||
@ -37,7 +37,7 @@ export function editFarmer(data) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 生产经营主体农户 - 审批
|
* 农户 - 审批
|
||||||
* @param {Object} data 审批数据
|
* @param {Object} data 审批数据
|
||||||
*/
|
*/
|
||||||
export function approveFarmer(data) {
|
export function approveFarmer(data) {
|
||||||
@ -48,10 +48,10 @@ export function approveFarmer(data) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 生产经营主体农户 - 详情查询
|
* 农户 - 详情查询
|
||||||
* @param {string} id 主体ID
|
* @param {string} id 主体ID
|
||||||
*/
|
*/
|
||||||
export function fetchBusinessSubjectInfo(id) {
|
export function fetchFarmerById(id) {
|
||||||
return request({
|
return request({
|
||||||
url: `/product-business/business/farmer/businessInfo/${id}`,
|
url: `/product-business/business/farmer/businessInfo/${id}`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@ -59,14 +59,18 @@ export function fetchBusinessSubjectInfo(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产经营主体 - 批量删除
|
* 删除农户接口(严格匹配文档规范)
|
||||||
* @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({
|
return request({
|
||||||
url: '/product-business/business/deleteBusiness',
|
url: '/product-business/business/farmer/deleteBusiness',
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
params: { businessId },
|
params: { ids: idStr },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,3 +97,11 @@ export function fetchBusinessCheckList(params) {
|
|||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// 农企合作社-列表查询/product-business/business/enter/businessPage
|
||||||
|
export function getEnterList(params) {
|
||||||
|
return request({
|
||||||
|
url: '/product-business/business/enter/businessPage',
|
||||||
|
method: 'get',
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -1,7 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="area-select-container" :style="{ width: width + 'px' }">
|
<div class="area-select-container" :style="{ width: width + 'px' }">
|
||||||
<div v-if="label" class="area-select-label">{{ label }}</div>
|
<div v-if="label" class="area-select-label">{{ label }}</div>
|
||||||
<el-cascader v-model="selectedAreaPath" :options="areaOptions" :props="cascaderProps" :placeholder="placeholder" style="flex: 1" clearable />
|
<el-cascader
|
||||||
|
v-bind="$attrs"
|
||||||
|
v-model="selectedAreaPath"
|
||||||
|
:options="areaOptions"
|
||||||
|
:props="cascaderProps"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
style="flex: 1"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -11,6 +19,10 @@ import request from '@/utils/axios';
|
|||||||
import { useUserStore } from '@/store/modules/user';
|
import { useUserStore } from '@/store/modules/user';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
inheritAttrs: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
|
@ -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>
|
@ -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>
|
@ -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>
|
@ -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>
|
@ -1,9 +1,353 @@
|
|||||||
<template>
|
<template>
|
||||||
<div></div>
|
<section class="custom-page">
|
||||||
|
<avue-crud ref="crudRef" v-model:page="pageData" :data="crudData" :option="crudOptions" :table-loading="loading">
|
||||||
|
<template #menu="scope">
|
||||||
|
<custom-table-operate :actions="crudOptions.actions" :data="scope" />
|
||||||
|
</template>
|
||||||
|
</avue-crud>
|
||||||
|
<el-dialog v-model="visible" title="农企合作社详情" width="80%" :draggable="true">
|
||||||
|
<el-tabs v-model="activeTab" class="tabs-wrapper">
|
||||||
|
<el-tab-pane label="1. 基础信息" name="basic">
|
||||||
|
<TabBasicInfo v-model="formData.basicInfo" :readonly="isReadonly" />
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="2. 登记注册信息" name="register">
|
||||||
|
<TabRegister v-model="formData.registerInfo" />
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="3. 经营信息" name="business">
|
||||||
|
<TabBusinessInfo
|
||||||
|
v-model="formData.business"
|
||||||
|
:readonly="isReadonly"
|
||||||
|
@prev="activeTab = 'register'"
|
||||||
|
@next="handleNext"
|
||||||
|
@edit="isReadonly = false"
|
||||||
|
/>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="4. 信用评级" name="credit">
|
||||||
|
<TabCreditEvaluation v-model="formData.credit" :readonly="isReadonly" />
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="visible = false">关闭</el-button>
|
||||||
|
<el-button v-if="!isReadonly" type="primary" @click="handleSubmit">保存</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch, onMounted, computed } from 'vue';
|
import { ref, reactive, watch, onMounted, computed } from 'vue';
|
||||||
|
import { CRUD_OPTIONS } from '@/config';
|
||||||
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||||
|
import TabBasicInfo from './components/TabBasicInfo.vue';
|
||||||
|
import TabRegister from './components/TabRegister.vue';
|
||||||
|
import TabBusinessInfo from './components/TabBusinessInfo.vue';
|
||||||
|
import TabCreditEvaluation from './components/TabCreditEvaluation.vue';
|
||||||
|
import { getEnterList } from '@/apis/businessEntity';
|
||||||
|
|
||||||
|
// 控制弹窗显示
|
||||||
|
const visible = ref(false);
|
||||||
|
// 当前 tab
|
||||||
|
const activeTab = ref('basic');
|
||||||
|
|
||||||
|
// 数据和状态
|
||||||
|
const formData = ref({
|
||||||
|
// 基础信息
|
||||||
|
basicInfo: {
|
||||||
|
name: '',
|
||||||
|
area: '',
|
||||||
|
contactPerson: '',
|
||||||
|
address: [],
|
||||||
|
product: '',
|
||||||
|
phone: '',
|
||||||
|
photoUrl: '',
|
||||||
|
businessLicenseUrl: '',
|
||||||
|
},
|
||||||
|
// 其他信息根据注册、经营、信用评级模块添加
|
||||||
|
registerInfo: {
|
||||||
|
companyName: '',
|
||||||
|
legalPerson: '',
|
||||||
|
companyType: '',
|
||||||
|
registerOrg: '',
|
||||||
|
approvalDate: '',
|
||||||
|
creditCode: '',
|
||||||
|
registerStatus: '',
|
||||||
|
establishDate: '',
|
||||||
|
totalCapital: '',
|
||||||
|
address: '',
|
||||||
|
businessScope: '',
|
||||||
|
},
|
||||||
|
business: {
|
||||||
|
debtFiles: [],
|
||||||
|
profitFiles: [],
|
||||||
|
cashflowFiles: [],
|
||||||
|
},
|
||||||
|
credit: {
|
||||||
|
creditRating: 5,
|
||||||
|
farmersSupport: 4,
|
||||||
|
socialBenefit: 3,
|
||||||
|
techApplication: 2,
|
||||||
|
qualityService: 1,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// 是否查看模式
|
||||||
|
const isReadonly = ref(false);
|
||||||
|
|
||||||
|
// 保存处理
|
||||||
|
const handleSubmit = async () => {
|
||||||
|
try {
|
||||||
|
loading.value = true;
|
||||||
|
// 假设当前编辑的数据 ID 是 formData.value.id(你可能需要从原始行中传入)
|
||||||
|
await api.updateById(formData.value.id, formData.value);
|
||||||
|
ElMessage.success('保存成功');
|
||||||
|
visible.value = false;
|
||||||
|
// 可刷新表格数据
|
||||||
|
} catch (e) {
|
||||||
|
ElMessage.error('保存失败');
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const pageData = ref({
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
total: 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
const crudData = ref([
|
||||||
|
{
|
||||||
|
cooperativeName: '华祥种植专业合作社',
|
||||||
|
location: '耿马县/耿马镇/新城村',
|
||||||
|
area: '300亩',
|
||||||
|
products: '小葱、大白菜',
|
||||||
|
contactPerson: '张强',
|
||||||
|
contactPhone: '13384041642',
|
||||||
|
employeeCount: '50人',
|
||||||
|
status: '待审核',
|
||||||
|
createTime: '2024年8月21日16:20:41',
|
||||||
|
updateTime: '2024年8月21日16:20:51',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
cooperativeName: '春林农业合作社',
|
||||||
|
location: '耿马县/耿马镇/和平村',
|
||||||
|
area: '200亩',
|
||||||
|
products: '西红柿、黄瓜',
|
||||||
|
contactPerson: '李梅',
|
||||||
|
contactPhone: '13812345678',
|
||||||
|
employeeCount: '30人',
|
||||||
|
status: '审核通过',
|
||||||
|
createTime: '2024年7月15日09:30:12',
|
||||||
|
updateTime: '2024年7月15日10:02:00',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
cooperativeName: '绿源蔬菜种植基地',
|
||||||
|
location: '耿马县/芒洪乡/新村',
|
||||||
|
area: '150亩',
|
||||||
|
products: '辣椒、豆角',
|
||||||
|
contactPerson: '王伟',
|
||||||
|
contactPhone: '13987654321',
|
||||||
|
employeeCount: '25人',
|
||||||
|
status: '待审核',
|
||||||
|
createTime: '2024年9月01日14:45:20',
|
||||||
|
updateTime: '2024年9月01日14:46:30',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
cooperativeName: '金丰农作物专业合作社',
|
||||||
|
location: '耿马县/勐简乡/丰收村',
|
||||||
|
area: '400亩',
|
||||||
|
products: '玉米、大豆',
|
||||||
|
contactPerson: '赵敏',
|
||||||
|
contactPhone: '13699887766',
|
||||||
|
employeeCount: '60人',
|
||||||
|
status: '待审核',
|
||||||
|
createTime: '2024年6月10日08:10:50',
|
||||||
|
updateTime: '2024年6月10日08:12:20',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
cooperativeName: '恒泰水果种植农场',
|
||||||
|
location: '耿马县/勐永镇/红星村',
|
||||||
|
area: '500亩',
|
||||||
|
products: '香蕉、芒果',
|
||||||
|
contactPerson: '周强',
|
||||||
|
contactPhone: '13711223344',
|
||||||
|
employeeCount: '80人',
|
||||||
|
status: '审核不通过',
|
||||||
|
createTime: '2024年5月25日11:20:15',
|
||||||
|
updateTime: '2024年5月25日11:22:00',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
|
const crudOptions = reactive({
|
||||||
|
...CRUD_OPTIONS,
|
||||||
|
addBtn: false,
|
||||||
|
searchBtn: false,
|
||||||
|
emptyBtn: false,
|
||||||
|
column: [
|
||||||
|
{ label: '农企/合作社名称', prop: 'cooperativeName' },
|
||||||
|
{ label: '地点', prop: 'location' },
|
||||||
|
{ label: '面积', prop: 'area' },
|
||||||
|
{ label: '经营产品', prop: 'products' },
|
||||||
|
{ label: '联系人', prop: 'contactPerson' },
|
||||||
|
{ label: '联系电话', prop: 'contactPhone' },
|
||||||
|
{ label: '聘工人数', prop: 'employeeCount' },
|
||||||
|
{ label: '状态', prop: 'status' },
|
||||||
|
{ label: '信息录入时间', prop: 'createTime' },
|
||||||
|
{ label: '信息更新时间', prop: 'updateTime' },
|
||||||
|
],
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
name: '查看',
|
||||||
|
icon: 'view',
|
||||||
|
event: ({ row }) => handleView(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '编辑',
|
||||||
|
icon: 'edit',
|
||||||
|
event: ({ row }) => handleEdit(row),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'danger',
|
||||||
|
name: '删除',
|
||||||
|
icon: 'delete',
|
||||||
|
event: ({ row }) => handleDelete(row.id),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
// 页面加载时获取数据
|
||||||
|
const getData = async () => {
|
||||||
|
loading.value = true;
|
||||||
|
try {
|
||||||
|
const response = await getEnterList(pageData.value.currentPage, pageData.value.pageSize);
|
||||||
|
crudData.value = response.data;
|
||||||
|
pageData.value.total = response.total;
|
||||||
|
} catch (error) {
|
||||||
|
ElMessage.error('加载数据失败');
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 查看详情(只读模式)
|
||||||
|
const handleView = async (row) => {
|
||||||
|
loading.value = true;
|
||||||
|
try {
|
||||||
|
const data = await api.getDetailById(row.id);
|
||||||
|
formData.value = data;
|
||||||
|
isReadonly.value = true;
|
||||||
|
activeTab.value = 'basic';
|
||||||
|
visible.value = true;
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 编辑详情(可修改)
|
||||||
|
const handleEdit = async (row) => {
|
||||||
|
loading.value = true;
|
||||||
|
try {
|
||||||
|
const data = await api.getDetailById(row.id);
|
||||||
|
formData.value = data;
|
||||||
|
isReadonly.value = false;
|
||||||
|
activeTab.value = 'basic';
|
||||||
|
visible.value = true;
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 删除操作
|
||||||
|
const handleDelete = async (id) => {
|
||||||
|
try {
|
||||||
|
await ElMessageBox.confirm('确认删除该合作社信息?', '提示', {
|
||||||
|
type: 'warning',
|
||||||
|
});
|
||||||
|
loading.value = true;
|
||||||
|
await api.deleteById(id);
|
||||||
|
ElMessage.success('删除成功');
|
||||||
|
// 这里可以重新刷新表格数据,比如调用接口或分页更新
|
||||||
|
} catch (e) {
|
||||||
|
if (e !== 'cancel') {
|
||||||
|
ElMessage.error('删除失败');
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 假设的 API 模块
|
||||||
|
const api = {
|
||||||
|
// 获取详情
|
||||||
|
getDetailById: async (id) => {
|
||||||
|
// 模拟请求,返回结构应与 formData 保持一致
|
||||||
|
return {
|
||||||
|
basicInfo: {
|
||||||
|
name: '绿源蔬菜种植基地',
|
||||||
|
area: '150亩',
|
||||||
|
contactPerson: '王伟',
|
||||||
|
address: ['耿马县', '芒洪乡', '新村'],
|
||||||
|
product: '辣椒、豆角',
|
||||||
|
phone: '13987654321',
|
||||||
|
photoUrl: '',
|
||||||
|
businessLicenseUrl: '',
|
||||||
|
},
|
||||||
|
registerInfo: {
|
||||||
|
companyName: '绿源蔬菜种植基地',
|
||||||
|
legalPerson: '王伟',
|
||||||
|
companyType: '合作社',
|
||||||
|
registerOrg: '耿马县工商局',
|
||||||
|
approvalDate: '2022-03-01',
|
||||||
|
creditCode: '123456789000000000',
|
||||||
|
registerStatus: '存续',
|
||||||
|
establishDate: '2020-01-01',
|
||||||
|
totalCapital: '200万',
|
||||||
|
address: '耿马县芒洪乡新村',
|
||||||
|
businessScope: '蔬菜种植销售',
|
||||||
|
},
|
||||||
|
business: {
|
||||||
|
debtFiles: [],
|
||||||
|
profitFiles: [],
|
||||||
|
cashflowFiles: [],
|
||||||
|
},
|
||||||
|
credit: {
|
||||||
|
creditRating: 4,
|
||||||
|
farmersSupport: 3,
|
||||||
|
socialBenefit: 4,
|
||||||
|
techApplication: 3,
|
||||||
|
qualityService: 4,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
// 更新
|
||||||
|
updateById: async (id, data) => {
|
||||||
|
console.log('更新请求', id, data);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
deleteById: async (id) => {
|
||||||
|
console.log('删除请求', id);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss"></style>
|
<style scoped lang="scss">
|
||||||
|
.tabs-wrapper {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
|
:deep(.el-tabs__item) {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 700;
|
||||||
|
// border: 1 solid #f000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@ -30,31 +30,31 @@
|
|||||||
</avue-crud>
|
</avue-crud>
|
||||||
|
|
||||||
<!-- 新增弹窗 -->
|
<!-- 新增弹窗 -->
|
||||||
<el-dialog v-model="dialogVisible" title="新增" width="80%">
|
<el-dialog :key="dialogTitle" v-model="dialogVisible" :title="dialogTitle" width="80%">
|
||||||
<el-form :model="formData" label-width="120px" class="custom-form">
|
<el-form :model="formData" label-width="120px" class="custom-form" :disabled="isReadonly">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="8">
|
<el-col :span="12">
|
||||||
<el-form-item label="姓名" prop="name">
|
<el-form-item label="姓名" prop="name">
|
||||||
<el-input v-model="formData.name" placeholder="请输入姓名" />
|
<el-input v-model="formData.name" placeholder="请输入姓名" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="12">
|
||||||
<el-form-item label="证件类型" prop="idType">
|
<el-form-item label="证件类型" prop="idType">
|
||||||
<el-select v-model="formData.idType" placeholder="请选择证件类型">
|
<el-select v-model="formData.idType" placeholder="请选择证件类型" disabled>
|
||||||
<el-option label="身份证" value="1" />
|
<el-option label="身份证" value="101" />
|
||||||
<el-option label="护照" value="2" />
|
<el-option label="护照" value="2" />
|
||||||
<el-option label="港澳身份证" value="3" />
|
<el-option label="港澳身份证" value="3" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
<el-form-item label="证件号码" prop="idCard">
|
<el-form-item label="证件号码" prop="idCard">
|
||||||
<el-input v-model="formData.idCard" placeholder="请输入证件号码" />
|
<el-input v-model="formData.idCard" placeholder="请输入证件号码" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
<el-col :span="12">
|
||||||
<el-row :gutter="20">
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="性别" prop="sex">
|
<el-form-item label="性别" prop="sex">
|
||||||
<el-radio-group v-model="formData.sex">
|
<el-radio-group v-model="formData.sex">
|
||||||
<el-radio label="1">男</el-radio>
|
<el-radio label="1">男</el-radio>
|
||||||
@ -62,36 +62,39 @@
|
|||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
<el-form-item label="年龄" prop="age">
|
<el-form-item label="年龄" prop="age">
|
||||||
<el-input v-model="formData.age" placeholder="请输入年龄" />
|
<el-input v-model="formData.age" placeholder="请输入年龄" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="12">
|
||||||
<el-form-item label="联系方式" prop="phone">
|
<el-form-item label="联系方式" prop="phone">
|
||||||
<el-input v-model="formData.phone" placeholder="请输入联系方式" />
|
<el-input v-model="formData.phone" placeholder="请输入联系方式" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="8">
|
<el-col :span="12">
|
||||||
<el-form-item label="居住地行政区划" prop="address">
|
<el-form-item label="居住地行政区划" prop="address">
|
||||||
<area-select v-model="formData.address" label="" />
|
<area-select v-model="formData.address" :label="null" />
|
||||||
|
<!-- <el-input v-model="formData.detailAddress" placeholder="请选择居住地行政区划" /> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="12">
|
||||||
<el-form-item label="具体地址" prop="detailAddress">
|
<el-form-item label="具体地址" prop="detailAddress">
|
||||||
<el-input v-model="formData.detailAddress" placeholder="请输入具体地址" />
|
<el-input v-model="formData.detailAddress" placeholder="请输入具体地址" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="种植面积" prop="plantingArea">
|
|
||||||
<el-input v-model="formData.plantingArea" placeholder="请输入种植面积" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="8">
|
<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-form-item label="种植作物" prop="planCrop">
|
||||||
<!-- <el-select v-model="formData.planCrop" placeholder="种植作物" style="width: 380px" :clearable="true">
|
<!-- <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-option v-for="item in cropsOptions" :key="item.id" :label="item.cropsName" :value="item.id" />
|
||||||
@ -103,7 +106,6 @@
|
|||||||
label-key="cropsName"
|
label-key="cropsName"
|
||||||
value-key="id"
|
value-key="id"
|
||||||
placeholder="请选择种植作物"
|
placeholder="请选择种植作物"
|
||||||
style="width: 380px"
|
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -112,7 +114,7 @@
|
|||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="dialogVisible = false">取消</el-button>
|
<el-button @click="dialogVisible = false">取消</el-button>
|
||||||
<el-button type="primary" @click="handleSave">保存</el-button>
|
<el-button v-if="!isReadonly" type="primary" @click="handleSave">保存</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -123,14 +125,14 @@
|
|||||||
import { ref, computed, reactive, onMounted, watch } from 'vue';
|
import { ref, computed, reactive, onMounted, watch } from 'vue';
|
||||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||||
import { CRUD_OPTIONS } from '@/config';
|
import { CRUD_OPTIONS } from '@/config';
|
||||||
import { getFarmerList, saveFarmerList, approveFarmer } from '@/apis/businessEntity';
|
import { fetchFarmerList, fetchFarmerById, saveFarmerList, editFarmer, approveFarmer, deleteFarmers } from '@/apis/businessEntity';
|
||||||
import { pageCropsList } from '@/apis/landResourceManagement/cropsManagement/index.js';
|
import { pageCropsList } from '@/apis/landResourceManagement/cropsManagement/index.js';
|
||||||
|
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
// 1. 模拟“当前用户角色”
|
// 1. 模拟“当前用户角色”
|
||||||
// 可选值:'superadmin'(超级管理员)、'auditor'(审核员)、'submitter'(提交人)
|
// 可选值:'superadmin'(超级管理员)、'auditor'(审核员)、'submitter'(提交人)
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
const role = ref('submitter'); // 开发时可手动切换为 'superadmin' / 'auditor' / 'submitter'
|
const role = ref('superadmin'); // 开发时可手动切换为 'superadmin' / 'auditor' / 'submitter'
|
||||||
|
|
||||||
// 角色判断的计算属性
|
// 角色判断的计算属性
|
||||||
const isSuperAdmin = computed(() => role.value === 'superadmin');
|
const isSuperAdmin = computed(() => role.value === 'superadmin');
|
||||||
@ -140,6 +142,8 @@ const isAuditor = computed(() => role.value === 'auditor');
|
|||||||
// 2. Tab 与数据的状态控制
|
// 2. Tab 与数据的状态控制
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
const activeTab = ref('0');
|
const activeTab = ref('0');
|
||||||
|
const dialogTitle = ref('新增');
|
||||||
|
const isReadonly = ref(false);
|
||||||
// 搜索表单模型
|
// 搜索表单模型
|
||||||
const searchForm = ref({
|
const searchForm = ref({
|
||||||
name: '',
|
name: '',
|
||||||
@ -161,10 +165,10 @@ const allData = ref([]);
|
|||||||
|
|
||||||
// 新增弹窗显示状态
|
// 新增弹窗显示状态
|
||||||
const dialogVisible = ref(false);
|
const dialogVisible = ref(false);
|
||||||
// 新增表单数据
|
// 定义默认表单数据
|
||||||
const formData = ref({
|
const defaultFormData = {
|
||||||
name: '',
|
name: '',
|
||||||
idType: '1',
|
idType: '101',
|
||||||
idCard: '',
|
idCard: '',
|
||||||
sex: '1',
|
sex: '1',
|
||||||
age: '',
|
age: '',
|
||||||
@ -173,12 +177,20 @@ const formData = ref({
|
|||||||
cityCode: '', // 市
|
cityCode: '', // 市
|
||||||
countyCode: '', // 区县
|
countyCode: '', // 区县
|
||||||
townCode: '', // 镇
|
townCode: '', // 镇
|
||||||
villageCode: '', // 村
|
street: '', // 村
|
||||||
address: [],
|
address: [],
|
||||||
detailAddress: '',
|
detailAddress: '',
|
||||||
plantingArea: '',
|
area: '',
|
||||||
planCrop: '',
|
planCrop: '',
|
||||||
});
|
reason: '',
|
||||||
|
};
|
||||||
|
// 新增表单数据,使用默认数据初始化
|
||||||
|
const formData = ref({ ...defaultFormData });
|
||||||
|
|
||||||
|
// 重置表单数据的方法
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = { ...defaultFormData };
|
||||||
|
};
|
||||||
|
|
||||||
// 根据当前选中 tab + 关键词来过滤数据
|
// 根据当前选中 tab + 关键词来过滤数据
|
||||||
const filteredData = computed(() => {
|
const filteredData = computed(() => {
|
||||||
@ -205,8 +217,14 @@ const crudOptions = reactive({
|
|||||||
refreshBtn: false,
|
refreshBtn: false,
|
||||||
column: [
|
column: [
|
||||||
{ label: '姓名', prop: 'name' },
|
{ label: '姓名', prop: 'name' },
|
||||||
{ label: '证件类型', prop: 'idType' },
|
{
|
||||||
{ label: '证件号码', prop: 'idCard' },
|
label: '证件类型',
|
||||||
|
prop: 'idType',
|
||||||
|
formatter: (row, column, cellValue) => {
|
||||||
|
return cellValue === '101' ? '身份证' : cellValue === '2' ? '护照' : cellValue === '3' ? '港澳身份证' : '';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ label: '证件号码', prop: 'idCardEncrypt' },
|
||||||
{
|
{
|
||||||
label: '性别',
|
label: '性别',
|
||||||
prop: 'sex',
|
prop: 'sex',
|
||||||
@ -235,7 +253,7 @@ async function getData() {
|
|||||||
current: pageData.value.currentPage,
|
current: pageData.value.currentPage,
|
||||||
size: pageData.value.pageSize,
|
size: pageData.value.pageSize,
|
||||||
};
|
};
|
||||||
const response = await getFarmerList(params);
|
const response = await fetchFarmerList(params);
|
||||||
if (response.code === 200 && response.data) {
|
if (response.code === 200 && response.data) {
|
||||||
allData.value = response.data.records;
|
allData.value = response.data.records;
|
||||||
console.log('获取数据成功:', allData.value);
|
console.log('获取数据成功:', allData.value);
|
||||||
@ -284,23 +302,13 @@ function handleTabChange(tab) {
|
|||||||
}
|
}
|
||||||
// 新增
|
// 新增
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
|
isReadonly.value = false; // 设置为可编辑模式
|
||||||
|
resetForm();
|
||||||
|
dialogTitle.value = '新增';
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
// 打开弹窗时重置表单数据
|
|
||||||
// formData.value = {
|
|
||||||
// name: '',
|
|
||||||
// idType: '1',
|
|
||||||
// idCard: '',
|
|
||||||
// sex: '1',
|
|
||||||
// age: '',
|
|
||||||
// phone: '',
|
|
||||||
// address: [],
|
|
||||||
// detailAddress: '',
|
|
||||||
// plantingArea: '',
|
|
||||||
// planCrop: '',
|
|
||||||
// };
|
|
||||||
};
|
};
|
||||||
// 根据address解构行政区划数据
|
// 根据address解构行政区划数据
|
||||||
const watchAddress = watch(
|
watch(
|
||||||
() => formData.value.address,
|
() => formData.value.address,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
if (newValue.length <= 3) {
|
if (newValue.length <= 3) {
|
||||||
@ -308,36 +316,99 @@ const watchAddress = watch(
|
|||||||
formData.value.cityCode = '530900';
|
formData.value.cityCode = '530900';
|
||||||
formData.value.countyCode = newValue[0];
|
formData.value.countyCode = newValue[0];
|
||||||
formData.value.townCode = newValue[1];
|
formData.value.townCode = newValue[1];
|
||||||
formData.value.villageCode = newValue[2];
|
formData.value.street = newValue[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// 保存新增数据saveFarmerList
|
// 保存新增数据saveFarmerList
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
await saveFarmerList(formData.value)
|
try {
|
||||||
.then((response) => {
|
let response;
|
||||||
|
if (dialogTitle.value === '新增') {
|
||||||
|
// 新增操作调用 saveFarmerList 接口
|
||||||
|
response = await saveFarmerList(formData.value);
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
ElMessage.success('新增成功');
|
ElMessage.success('新增成功');
|
||||||
dialogVisible.value = false;
|
|
||||||
getData(); // 重新获取数据
|
|
||||||
}
|
}
|
||||||
})
|
} else if (dialogTitle.value === '编辑') {
|
||||||
.catch(() => {
|
// 编辑操作调用 editFarmer 接口
|
||||||
ElMessage.error('新增失败,请稍后重试');
|
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) {
|
function handleView(row) {
|
||||||
console.log('查看', row);
|
console.log('查看', row);
|
||||||
ElMessageBox.alert(`查看 ID=${row.id} 的详情`, '查看');
|
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,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 清空驳回原因
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑(修改/填写)
|
// 编辑(修改/填写)
|
||||||
function handleEdit(row) {
|
async function handleEdit(row) {
|
||||||
console.log('编辑', row);
|
// 已通过状态的数据,点击编辑之后提示:编辑之后需要重新提交审核,是否确认的确认框
|
||||||
ElMessageBox.alert(`编辑 ID=${row.id}`, '编辑');
|
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,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提交审核(待提交 → 待审核)
|
// 提交审核(待提交 → 待审核)
|
||||||
@ -360,31 +431,71 @@ function handleSubmit(row) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 重新提交(被驳回 → 待审核)
|
||||||
// 重新提交(被驳回 → 待审核)
|
// 重新提交(被驳回 → 待审核)
|
||||||
function handleResubmit(row) {
|
function handleResubmit(row) {
|
||||||
ElMessageBox.confirm('确认重新提交吗?', '重新提交').then(() => {
|
ElMessageBox.confirm('确认重新提交吗?', '重新提交').then(() => {
|
||||||
row.status = '1';
|
const params = {
|
||||||
row.rejectReason = '';
|
id: row.id,
|
||||||
console.log(`ID=${row.id} 重新提交`);
|
status: '1', // 待审核
|
||||||
ElMessage.success('已重新提交,状态已变为“待审核”');
|
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) {
|
function handleWithdraw(row) {
|
||||||
ElMessageBox.confirm('确认撤销本次审核吗?', '撤销').then(() => {
|
ElMessageBox.confirm('确认撤销本次审核吗?', '撤销').then(() => {
|
||||||
row.status = '0';
|
const params = {
|
||||||
console.log(`ID=${row.id} 撤销到“待提交”`);
|
id: row.id,
|
||||||
ElMessage.success('已撤销,状态已变为“待提交”');
|
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) {
|
function handleApprove(row) {
|
||||||
ElMessageBox.confirm('确认通过?', '审核通过').then(() => {
|
ElMessageBox.confirm('确认通过审核?', '审核通过').then(() => {
|
||||||
row.status = '2';
|
const params = {
|
||||||
console.log(`ID=${row.id} 审核通过`);
|
id: row.id,
|
||||||
ElMessage.success('已通过');
|
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 || '审核操作失败');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,37 +504,49 @@ function handleReject(row) {
|
|||||||
ElMessageBox.prompt('请输入驳回原因', '审核驳回', {
|
ElMessageBox.prompt('请输入驳回原因', '审核驳回', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
|
inputPattern: /.+/, // 必须输入内容
|
||||||
|
inputErrorMessage: '驳回原因不能为空',
|
||||||
})
|
})
|
||||||
.then(({ value }) => {
|
.then(({ value }) => {
|
||||||
if (!value.trim()) {
|
const params = {
|
||||||
ElMessage.error('驳回原因不能为空');
|
id: row.id,
|
||||||
return;
|
status: '3', // 已驳回
|
||||||
}
|
reason: value.trim(),
|
||||||
row.status = '3';
|
};
|
||||||
row.rejectReason = value.trim();
|
return approveFarmer(params).then(() => {
|
||||||
console.log(`ID=${row.id} 驳回,原因:${value.trim()}`);
|
console.log(`ID=${row.id} 驳回,原因:${value.trim()}`);
|
||||||
ElMessage.success('已驳回');
|
row.status = '3';
|
||||||
|
row.rejectReason = value.trim();
|
||||||
|
getData();
|
||||||
|
ElMessage.success('已驳回');
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((error) => {
|
||||||
// 取消时不做任何事
|
if (error !== 'cancel') {
|
||||||
|
console.error('驳回操作失败:', error);
|
||||||
|
ElMessage.error(error.response?.data?.msg || '驳回操作失败');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查看/弹窗 驳回原因
|
// 查看/弹窗 驳回原因
|
||||||
function showRejectReason(row) {
|
function showRejectReason(row) {
|
||||||
ElMessageBox.alert(row.rejectReason || '无驳回原因', '驳回原因');
|
ElMessageBox.alert(row.reason || '无驳回原因', '驳回原因');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除
|
async function handleDelete(row) {
|
||||||
function handleDelete(row) {
|
try {
|
||||||
ElMessageBox.confirm('确定删除该条记录?', '删除提示').then(() => {
|
await ElMessageBox.confirm('确定删除该条记录?', '删除提示');
|
||||||
const idx = allData.value.findIndex((r) => r.id === row.id);
|
|
||||||
if (idx !== -1) {
|
console.log(`删除 ID=${row.id}`);
|
||||||
allData.value.splice(idx, 1);
|
await deleteFarmers(row.id); // 直接传递单ID
|
||||||
}
|
await getData();
|
||||||
console.log(`ID=${row.id} 已删除`);
|
|
||||||
ElMessage.success('已删除');
|
ElMessage.success('已删除');
|
||||||
});
|
} catch (error) {
|
||||||
|
if (error !== 'cancel') {
|
||||||
|
ElMessage.error(`删除失败: ${error.message || '请稍后重试'}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 定义操作映射
|
// 定义操作映射
|
||||||
@ -506,5 +629,13 @@ onMounted(() => {
|
|||||||
.el-form-item {
|
.el-form-item {
|
||||||
margin-bottom: 22px;
|
margin-bottom: 22px;
|
||||||
}
|
}
|
||||||
|
.el-input,
|
||||||
|
.el-select,
|
||||||
|
.el-cascader,
|
||||||
|
.el-date-picker {
|
||||||
|
width: 500px;
|
||||||
|
max-width: 100%; // 防止超出父容器
|
||||||
|
box-sizing: border-box; // 让padding/border包含在宽度内
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user