生产经营主体
This commit is contained in:
parent
711c632cfc
commit
4c65ec3e9e
@ -17,5 +17,5 @@ VITE_APP_UPLOAD_API = '/uploadApis'
|
|||||||
# 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.74:8080'
|
VITE_APP_UPLOAD_URL = 'http://192.168.18.99:8080'
|
||||||
# VITE_APP_VIST_URL = 'http://192.168.18.99'
|
# VITE_APP_VIST_URL = 'http://192.168.18.99'
|
||||||
|
@ -14,4 +14,4 @@ VITE_APP_UPLOAD_API = '/uploadApis'
|
|||||||
|
|
||||||
# 内网接口地址
|
# 内网接口地址
|
||||||
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.74:8080'
|
VITE_APP_UPLOAD_URL = 'http://192.168.18.99:8080'
|
||||||
|
@ -104,21 +104,6 @@ const fetchAreaData = async () => {
|
|||||||
// }
|
// }
|
||||||
// );
|
// );
|
||||||
|
|
||||||
// 内部更新 => 外部同步
|
|
||||||
watch(
|
|
||||||
selectedAreaPath,
|
|
||||||
(val) => {
|
|
||||||
if (props.emitPath) {
|
|
||||||
// 期望数组模式,确保输出数组
|
|
||||||
emit('update:modelValue', Array.isArray(val) ? val : []);
|
|
||||||
} else {
|
|
||||||
// 期望字符串模式,确保输出字符串
|
|
||||||
emit('update:modelValue', typeof val === 'string' ? val : '');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ deep: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchAreaData();
|
fetchAreaData();
|
||||||
});
|
});
|
||||||
|
@ -13,31 +13,31 @@ const inputSuppliesRoutes = [
|
|||||||
path: '/sub-government-affairs-service/material/pesticide',
|
path: '/sub-government-affairs-service/material/pesticide',
|
||||||
name: 'input-supplies-pesticide',
|
name: 'input-supplies-pesticide',
|
||||||
component: () => import('@/views/inputSuppliesManage/material/pesticide/index.vue'),
|
component: () => import('@/views/inputSuppliesManage/material/pesticide/index.vue'),
|
||||||
meta: { title: '农药管理', icon: '' },
|
meta: { title: '农药管理', icon: 'Orange' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/sub-government-affairs-service/material/fertilizer',
|
path: '/sub-government-affairs-service/material/fertilizer',
|
||||||
name: 'input-supplies-fertilizer',
|
name: 'input-supplies-fertilizer',
|
||||||
component: () => import('@/views/inputSuppliesManage/material/fertilizer/index.vue'),
|
component: () => import('@/views/inputSuppliesManage/material/fertilizer/index.vue'),
|
||||||
meta: { title: '肥料管理', icon: '' },
|
meta: { title: '肥料管理', icon: 'Grid' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/sub-government-affairs-service/material/seed',
|
path: '/sub-government-affairs-service/material/seed',
|
||||||
name: 'input-supplies-seed',
|
name: 'input-supplies-seed',
|
||||||
component: () => import('@/views/inputSuppliesManage/material/seed/index.vue'),
|
component: () => import('@/views/inputSuppliesManage/material/seed/index.vue'),
|
||||||
meta: { title: '种子使用监督管理', icon: '' },
|
meta: { title: '种子使用监督管理', icon: 'Watermelon' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/sub-government-affairs-service/material/others',
|
path: '/sub-government-affairs-service/material/others',
|
||||||
name: 'input-supplies-others',
|
name: 'input-supplies-others',
|
||||||
component: () => import('@/views/inputSuppliesManage/material/others/index.vue'),
|
component: () => import('@/views/inputSuppliesManage/material/others/index.vue'),
|
||||||
meta: { title: '其他投入品', icon: '' },
|
meta: { title: '其他投入品', icon: 'TakeawayBox' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/sub-government-affairs-service/material/annualPlans',
|
path: '/sub-government-affairs-service/material/annualPlans',
|
||||||
name: 'annualPlans',
|
name: 'annualPlans',
|
||||||
component: () => import('@/views/inputSuppliesManage/material/annualPlan/index.vue'),
|
component: () => import('@/views/inputSuppliesManage/material/annualPlan/index.vue'),
|
||||||
meta: { title: '种植进度网格化管理', icon: '' },
|
meta: { title: '种植进度网格化管理', icon: 'Timer' },
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// path: '/sub-government-affairs-service/materialManage',
|
// path: '/sub-government-affairs-service/materialManage',
|
||||||
|
@ -18,7 +18,7 @@ export default [
|
|||||||
path: '/sub-government-affairs-service/individual',
|
path: '/sub-government-affairs-service/individual',
|
||||||
component: () => import('@/views/productOperateMain/individual/index.vue'),
|
component: () => import('@/views/productOperateMain/individual/index.vue'),
|
||||||
name: 'individual',
|
name: 'individual',
|
||||||
meta: { title: '农户管理', icon: '' },
|
meta: { title: '农户管理', icon: 'Place' },
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// path: '/sub-government-affairs-service/collective',
|
// path: '/sub-government-affairs-service/collective',
|
||||||
@ -30,7 +30,7 @@ export default [
|
|||||||
path: '/sub-government-affairs-service/coop',
|
path: '/sub-government-affairs-service/coop',
|
||||||
component: () => import('@/views/productOperateMain/coOp/index.vue'),
|
component: () => import('@/views/productOperateMain/coOp/index.vue'),
|
||||||
name: 'coop',
|
name: 'coop',
|
||||||
meta: { title: '企业管理', icon: '' },
|
meta: { title: '企业管理', icon: 'Finished' },
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// path: '/sub-government-affairs-service/enterprise',
|
// path: '/sub-government-affairs-service/enterprise',
|
||||||
|
@ -13,19 +13,7 @@
|
|||||||
<el-input v-model="localForm.contactPerson" placeholder="请输入" />
|
<el-input v-model="localForm.contactPerson" placeholder="请输入" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="农企/合作社照片">
|
<el-form-item label="农企/合作社照片">
|
||||||
<el-upload
|
<FileUploader v-model="localForm.cooperativePhoto" :limit="1" />
|
||||||
action="#"
|
|
||||||
:http-request="customUploadRequest"
|
|
||||||
:on-success="(res, file) => handleUploadSuccess(res, file, 'cooperativePhoto')"
|
|
||||||
:file-list="cooperativePhotoList"
|
|
||||||
list-type="picture-card"
|
|
||||||
:limit="1"
|
|
||||||
:on-exceed="handleExceed"
|
|
||||||
:on-remove="() => handleRemove('cooperativePhoto')"
|
|
||||||
>
|
|
||||||
<el-icon><Plus /></el-icon>
|
|
||||||
</el-upload>
|
|
||||||
<!-- <FileUploader v-model="localForm.cooperativePhoto" :limit="1" /> -->
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
@ -47,18 +35,6 @@
|
|||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="营业执照">
|
<el-form-item label="营业执照">
|
||||||
<!-- <el-upload
|
|
||||||
action="#"
|
|
||||||
:http-request="customUploadRequest"
|
|
||||||
:on-success="(res, file) => handleUploadSuccess(res, file, 'businessLicence')"
|
|
||||||
:file-list="businessLicenceList"
|
|
||||||
list-type="picture-card"
|
|
||||||
:limit="1"
|
|
||||||
:on-exceed="handleExceed"
|
|
||||||
:on-remove="() => handleRemove('businessLicence')"
|
|
||||||
>
|
|
||||||
<el-icon><Plus /></el-icon>
|
|
||||||
</el-upload> -->
|
|
||||||
<FileUploader v-model="localForm.businessLicence" :limit="1" />
|
<FileUploader v-model="localForm.businessLicence" :limit="1" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -67,14 +43,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, watch } from 'vue';
|
import { ref, toRefs, reactive, watch } from 'vue';
|
||||||
import { Plus } from '@element-plus/icons-vue';
|
|
||||||
import cloneDeep from 'lodash/cloneDeep';
|
|
||||||
import { CommonUpload } from '@/apis/index';
|
|
||||||
import { ElMessage } from 'element-plus';
|
|
||||||
import Attrs from './Attrs.vue';
|
|
||||||
import { useCoop } from '../../../../store/modules/coop';
|
|
||||||
const localForm = useCoop().$state.data;
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
@ -82,97 +51,11 @@ const props = defineProps({
|
|||||||
required: true,
|
required: true,
|
||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
// readonly: Boolean,
|
readonly: Boolean,
|
||||||
});
|
});
|
||||||
|
|
||||||
const ossUrl = 'http://gov-cloud.oss-cn-chengdu.aliyuncs.com/';
|
|
||||||
const cooperativePhotoList = ref([]);
|
|
||||||
const businessLicenceList = ref([]);
|
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue']);
|
const emit = defineEmits(['update:modelValue']);
|
||||||
|
const { modelValue: localForm } = toRefs(props);
|
||||||
// 建立本地副本,避免直接修改 props
|
|
||||||
// const localForm = ref({ ...props.modelValue });
|
|
||||||
|
|
||||||
// 深度监听本地副本的变化,实时更新父组件
|
|
||||||
// watch(
|
|
||||||
// localForm,
|
|
||||||
// (newVal) => {
|
|
||||||
// emit('update:modelValue', { ...newVal });
|
|
||||||
// },
|
|
||||||
// { deep: true }
|
|
||||||
// );
|
|
||||||
// watch(
|
|
||||||
// () => props.modelValue,
|
|
||||||
// (newVal) => {
|
|
||||||
// Object.assign(localForm, cloneDeep(newVal));
|
|
||||||
// },
|
|
||||||
// { deep: true }
|
|
||||||
// );
|
|
||||||
|
|
||||||
const customUploadRequest = async (options) => {
|
|
||||||
const formData = new FormData();
|
|
||||||
formData.append('file', options.file);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await CommonUpload(formData);
|
|
||||||
options.onSuccess(response, options.file);
|
|
||||||
return response;
|
|
||||||
} catch (err) {
|
|
||||||
console.error('上传失败', err);
|
|
||||||
options.onError(err);
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const handleUploadSuccess = (res, file, fieldName) => {
|
|
||||||
localForm[fieldName] = res.data.url;
|
|
||||||
// 更新预览列表
|
|
||||||
const previewItem = {
|
|
||||||
name: res.data.name,
|
|
||||||
url: ossUrl + res.data.url, // 确保这是完整的可访问URL
|
|
||||||
status: 'success',
|
|
||||||
};
|
|
||||||
if (fieldName === 'cooperativePhoto') {
|
|
||||||
cooperativePhotoList.value = [previewItem];
|
|
||||||
} else {
|
|
||||||
businessLicenceList.value = [previewItem];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// 处理移除图片
|
|
||||||
const handleRemove = (fieldName) => {
|
|
||||||
localForm[fieldName] = '';
|
|
||||||
if (fieldName === 'cooperativePhoto') {
|
|
||||||
cooperativePhotoList.value = [];
|
|
||||||
} else {
|
|
||||||
businessLicenceList.value = [];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 处理文件超出限制
|
|
||||||
const handleExceed = () => {
|
|
||||||
ElMessage.warning('只能上传一张图片,请先删除当前图片');
|
|
||||||
};
|
|
||||||
|
|
||||||
// 初始化时如果有图片,设置预览
|
|
||||||
if (localForm.cooperativePhoto) {
|
|
||||||
cooperativePhotoList.value = [
|
|
||||||
{
|
|
||||||
name: '合作社照片',
|
|
||||||
url: ossUrl + localForm.cooperativePhoto,
|
|
||||||
status: 'success',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (localForm.businessLicence) {
|
|
||||||
businessLicenceList.value = [
|
|
||||||
{
|
|
||||||
name: '营业执照',
|
|
||||||
url: ossUrl + localForm.businessLicence,
|
|
||||||
status: 'success',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
@ -72,7 +72,7 @@ import { reactive, watch } from 'vue';
|
|||||||
import { Plus } from '@element-plus/icons-vue';
|
import { Plus } from '@element-plus/icons-vue';
|
||||||
import cloneDeep from 'lodash/cloneDeep';
|
import cloneDeep from 'lodash/cloneDeep';
|
||||||
import { useCoop } from '../../../../store/modules/coop';
|
import { useCoop } from '../../../../store/modules/coop';
|
||||||
const localForm = useCoop().$state.data;
|
// const localForm = useCoop().$state.data;
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
@ -88,16 +88,16 @@ const props = defineProps({
|
|||||||
const emit = defineEmits(['update:modelValue']);
|
const emit = defineEmits(['update:modelValue']);
|
||||||
|
|
||||||
// 本地副本,存放各表的文件列表
|
// 本地副本,存放各表的文件列表
|
||||||
// const localForm = reactive(cloneDeep(props.modelValue));
|
const localForm = reactive(cloneDeep(props.modelValue));
|
||||||
|
|
||||||
// watch 同步回父组件
|
// watch 同步回父组件
|
||||||
// watch(
|
watch(
|
||||||
// () => localForm,
|
() => localForm,
|
||||||
// (val) => {
|
(val) => {
|
||||||
// emit('update:modelValue', { ...val });
|
emit('update:modelValue', { ...val });
|
||||||
// },
|
},
|
||||||
// { deep: true }
|
{ deep: true }
|
||||||
// );
|
);
|
||||||
// watch(
|
// watch(
|
||||||
// () => props.modelValue,
|
// () => props.modelValue,
|
||||||
// (newVal) => {
|
// (newVal) => {
|
||||||
|
@ -2,34 +2,32 @@
|
|||||||
<el-form :model="localForm" label-width="160px" :disabled="readonly">
|
<el-form :model="localForm" label-width="160px" :disabled="readonly">
|
||||||
<div class="credit-evaluation">
|
<div class="credit-evaluation">
|
||||||
<h3>信用评级</h3>
|
<h3>信用评级</h3>
|
||||||
|
|
||||||
<el-form-item label="信用评价">
|
<el-form-item label="信用评价">
|
||||||
<el-rate v-model="localForm.creditEvaluation" allow-half show-score score-template="{value} 分" />
|
<el-rate v-model="localForm.creditEvaluation" show-score score-template="{value} 分" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="带动周边农户">
|
<el-form-item label="带动周边农户">
|
||||||
<el-rate v-model="localForm.supportedFarmers" allow-half show-score score-template="{value} 分" />
|
<el-rate v-model="localForm.supportedFarmers" show-score score-template="{value} 分" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="社会效益">
|
<el-form-item label="社会效益">
|
||||||
<el-rate v-model="localForm.socialImpact" allow-half show-score score-template="{value} 分" />
|
<el-rate v-model="localForm.socialImpact" show-score score-template="{value} 分" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="高新技术应用">
|
<el-form-item label="高新技术应用">
|
||||||
<el-rate v-model="localForm.techApplication" allow-half show-score score-template="{value} 分" />
|
<el-rate v-model="localForm.techApplication" show-score score-template="{value} 分" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="产品质量及服务保障">
|
<el-form-item label="产品质量及服务保障">
|
||||||
<el-rate v-model="localForm.productQuality" allow-half show-score score-template="{value} 分" />
|
<el-rate v-model="localForm.productQuality" show-score score-template="{value} 分" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</div>
|
</div>
|
||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, watch } from 'vue';
|
import { toRefs, watch } from 'vue';
|
||||||
import cloneDeep from 'lodash/cloneDeep';
|
|
||||||
import { useCoop } from '../../../../store/modules/coop';
|
|
||||||
const localForm = useCoop().$state.data;
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
@ -42,8 +40,10 @@ const props = defineProps({
|
|||||||
|
|
||||||
const emit = defineEmits(['update:modelValue']);
|
const emit = defineEmits(['update:modelValue']);
|
||||||
|
|
||||||
// const localForm = reactive(cloneDeep(props.modelValue));
|
// 解构出响应式引用,保持与父组件绑定
|
||||||
|
const { modelValue: localForm } = toRefs(props);
|
||||||
|
|
||||||
|
// 如需在评分变化时同步更新父组件(可选,某些场景可能冗余)
|
||||||
// watch(
|
// watch(
|
||||||
// localForm,
|
// localForm,
|
||||||
// (newVal) => {
|
// (newVal) => {
|
||||||
@ -51,14 +51,8 @@ const emit = defineEmits(['update:modelValue']);
|
|||||||
// },
|
// },
|
||||||
// { deep: true }
|
// { deep: true }
|
||||||
// );
|
// );
|
||||||
// watch(
|
|
||||||
// () => props.modelValue,
|
|
||||||
// (newVal) => {
|
|
||||||
// Object.assign(localForm, cloneDeep(newVal));
|
|
||||||
// },
|
|
||||||
// { deep: true }
|
|
||||||
// );
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.credit-evaluation {
|
.credit-evaluation {
|
||||||
width: 600px;
|
width: 600px;
|
||||||
|
@ -105,8 +105,8 @@ import { ref, reactive, watch, onMounted, computed } from 'vue';
|
|||||||
import { CRUD_OPTIONS } from '@/config';
|
import { CRUD_OPTIONS } from '@/config';
|
||||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||||
import { getMemberList, addMember, updateMember, deleteMembers } from '@/apis/businessEntity';
|
import { getMemberList, addMember, updateMember, deleteMembers } from '@/apis/businessEntity';
|
||||||
import { useCoop } from '../../../../store/modules/coop';
|
// import { useCoop } from '../../../../store/modules/coop';
|
||||||
const defaultFormData = useCoop().$state.data;
|
// const defaultFormData = useCoop().$state.data;
|
||||||
|
|
||||||
const dialogTitle = ref('新增');
|
const dialogTitle = ref('新增');
|
||||||
const dialogVisible = ref(false);
|
const dialogVisible = ref(false);
|
||||||
@ -126,31 +126,31 @@ const searchForm = ref({
|
|||||||
});
|
});
|
||||||
const crudData = ref([]);
|
const crudData = ref([]);
|
||||||
// 定义默认表单数据
|
// 定义默认表单数据
|
||||||
// const defaultFormData = {
|
const defaultFormData = {
|
||||||
// id: '',
|
id: '',
|
||||||
// entId: '',
|
entId: '',
|
||||||
// name: '',
|
name: '',
|
||||||
// idType: '101',
|
idType: '101',
|
||||||
// idCard: '',
|
idCard: '',
|
||||||
// sex: '1',
|
sex: '1',
|
||||||
// age: '',
|
age: '',
|
||||||
// phone: '',
|
phone: '',
|
||||||
// provinceCode: '', // 省
|
provinceCode: '', // 省
|
||||||
// cityCode: '', // 市
|
cityCode: '', // 市
|
||||||
// countyCode: '', // 区县
|
countyCode: '', // 区县
|
||||||
// townCode: '', // 镇
|
townCode: '', // 镇
|
||||||
// street: '', // 村
|
street: '', // 村
|
||||||
// addressArr: [],
|
addressArr: [],
|
||||||
// detailAddress: '',
|
detailAddress: '',
|
||||||
// area: '',
|
area: '',
|
||||||
// planCrop: '',
|
planCrop: '',
|
||||||
// planCropName: '',
|
planCropName: '',
|
||||||
// address: '',
|
address: '',
|
||||||
// createTime: '',
|
createTime: '',
|
||||||
// createUser: '',
|
createUser: '',
|
||||||
// updateTime: '',
|
updateTime: '',
|
||||||
// updateUser: '',
|
updateUser: '',
|
||||||
// };
|
};
|
||||||
// 新增表单数据,使用默认数据初始化
|
// 新增表单数据,使用默认数据初始化
|
||||||
const formData = ref({ ...defaultFormData });
|
const formData = ref({ ...defaultFormData });
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
|
@ -71,10 +71,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, watch } from 'vue';
|
import { toRefs, reactive, watch } from 'vue';
|
||||||
import cloneDeep from 'lodash/cloneDeep';
|
|
||||||
import { useCoop } from '../../../../store/modules/coop';
|
|
||||||
const localForm = useCoop().$state.data;
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
@ -86,25 +83,8 @@ const props = defineProps({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue']);
|
const emit = defineEmits(['update:modelValue']);
|
||||||
|
// 解构出响应式引用,保持与父组件绑定
|
||||||
// 创建本地副本(为了避免直接修改 props)
|
const { modelValue: localForm } = toRefs(props);
|
||||||
// const localForm = reactive(cloneDeep(props.modelValue));
|
|
||||||
|
|
||||||
// 监听本地副本的变化,自动回传给父组件
|
|
||||||
// watch(
|
|
||||||
// localForm,
|
|
||||||
// (newVal) => {
|
|
||||||
// emit('update:modelValue', { ...newVal });
|
|
||||||
// },
|
|
||||||
// { deep: true }
|
|
||||||
// );
|
|
||||||
// watch(
|
|
||||||
// () => props.modelValue,
|
|
||||||
// (newVal) => {
|
|
||||||
// Object.assign(localForm, cloneDeep(newVal));
|
|
||||||
// },
|
|
||||||
// { deep: true }
|
|
||||||
// );
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<TabBasicInfo v-model="formData" :readonly="isReadonly" />
|
<TabBasicInfo v-model="formData" :readonly="isReadonly" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="登记注册信息" name="register">
|
<el-tab-pane label="登记注册信息" name="register">
|
||||||
<TabRegister v-model="formData" />
|
<TabRegister v-model="formData" :readonly="isReadonly" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="经营信息" name="business">
|
<el-tab-pane label="经营信息" name="business">
|
||||||
<TabBusinessInfo v-model="formData" :readonly="isReadonly" />
|
<TabBusinessInfo v-model="formData" :readonly="isReadonly" />
|
||||||
@ -57,10 +57,6 @@ import TabBusinessInfo from './components/TabBusinessInfo.vue';
|
|||||||
import TabCreditEvaluation from './components/TabCreditEvaluation.vue';
|
import TabCreditEvaluation from './components/TabCreditEvaluation.vue';
|
||||||
import TabMember from './components/TabMember.vue';
|
import TabMember from './components/TabMember.vue';
|
||||||
import { getEnterList, getEnterById, addEnter, updateEnter, approvalEnter, deleteEnter } from '@/apis/businessEntity';
|
import { getEnterList, getEnterById, addEnter, updateEnter, approvalEnter, deleteEnter } from '@/apis/businessEntity';
|
||||||
import { cloneDeep } from 'lodash';
|
|
||||||
import { useCoop } from '../../../store/modules/coop';
|
|
||||||
|
|
||||||
const useCoopData = useCoop();
|
|
||||||
|
|
||||||
// 控制弹窗显示
|
// 控制弹窗显示
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
@ -76,6 +72,7 @@ const searchForm = ref({
|
|||||||
productType: '',
|
productType: '',
|
||||||
primaryProduct: '',
|
primaryProduct: '',
|
||||||
});
|
});
|
||||||
|
const initialSearchForm = { ...searchForm.value };
|
||||||
// 数据和状态
|
// 数据和状态
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
id: '',
|
id: '',
|
||||||
@ -116,6 +113,19 @@ const formData = ref({
|
|||||||
techApplication: 2,
|
techApplication: 2,
|
||||||
productQuality: 1,
|
productQuality: 1,
|
||||||
});
|
});
|
||||||
|
const initialFormData = { ...formData.value };
|
||||||
|
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = { ...initialFormData };
|
||||||
|
};
|
||||||
|
const syncAddressToForm = () => {
|
||||||
|
const arr = Array.isArray(formData.value.addressArr) ? formData.value.addressArr : [];
|
||||||
|
formData.value.provinceCode = arr[0] || '';
|
||||||
|
formData.value.cityCode = arr[1] || '';
|
||||||
|
formData.value.countyCode = arr[2] || '';
|
||||||
|
formData.value.townCode = arr[3] || '';
|
||||||
|
formData.value.villageCode = arr[4] || '';
|
||||||
|
};
|
||||||
|
|
||||||
// 保存处理
|
// 保存处理
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
@ -124,27 +134,22 @@ const handleSubmit = async () => {
|
|||||||
let response;
|
let response;
|
||||||
if (dialogTitle.value === '新增') {
|
if (dialogTitle.value === '新增') {
|
||||||
formData.value.id = '';
|
formData.value.id = '';
|
||||||
|
syncAddressToForm();
|
||||||
response = await addEnter(formData.value);
|
response = await addEnter(formData.value);
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
ElMessage.success('新增成功');
|
ElMessage.success('新增成功');
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
getData(); // 刷新表格数据
|
getData();
|
||||||
}
|
}
|
||||||
} else if (dialogTitle.value === '编辑') {
|
} else if (dialogTitle.value === '编辑') {
|
||||||
formData.value.provinceCode = formData.value.addressArr[0];
|
syncAddressToForm();
|
||||||
formData.value.cityCode = formData.value.addressArr[1];
|
|
||||||
formData.value.countyCode = formData.value.addressArr[2];
|
|
||||||
formData.value.townCode = formData.value.addressArr[3];
|
|
||||||
formData.value.villageCode = formData.value.addressArr[4];
|
|
||||||
|
|
||||||
response = await updateEnter(formData.value);
|
response = await updateEnter(formData.value);
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
ElMessage.success('编辑成功');
|
ElMessage.success('编辑成功');
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
getData(); // 刷新表格数据
|
getData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 可刷新表格数据
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
ElMessage.error('保存失败');
|
ElMessage.error('保存失败');
|
||||||
} finally {
|
} finally {
|
||||||
@ -178,70 +183,6 @@ const crudOptions = reactive({
|
|||||||
{ label: '信息录入时间', prop: 'createTime' },
|
{ label: '信息录入时间', prop: 'createTime' },
|
||||||
{ label: '信息更新时间', prop: 'updateTime' },
|
{ 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),
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '驳回原因',
|
|
||||||
// icon: 'warning',
|
|
||||||
// event: ({ row }) => {
|
|
||||||
// showRejectReason(row);
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '提交审核',
|
|
||||||
// icon: 'check',
|
|
||||||
// event: ({ row }) => {
|
|
||||||
// if (row.status === '待提交') {
|
|
||||||
// handleSubmit();
|
|
||||||
// } else {
|
|
||||||
// ElMessage.warning('当前状态不允许提交审核');
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '撤销',
|
|
||||||
// icon: 'undo',
|
|
||||||
// event: ({ row }) => {
|
|
||||||
// handleWithdraw(row);
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '重新提交',
|
|
||||||
// icon: 'resubmit',
|
|
||||||
// event: (row) => {
|
|
||||||
// handleResubmit(row);
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '通过',
|
|
||||||
// icon: 'check-circle',
|
|
||||||
// event: ({ row }) => {
|
|
||||||
// handleApprove(row);
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// name: '驳回',
|
|
||||||
// icon: 'close-circle',
|
|
||||||
// event: ({ row }) => {
|
|
||||||
// handleReject(row);
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
});
|
});
|
||||||
// watch(
|
// watch(
|
||||||
// () => formData.value.addressArr,
|
// () => formData.value.addressArr,
|
||||||
@ -271,7 +212,6 @@ const getData = async () => {
|
|||||||
page: pageData.value.currentPage,
|
page: pageData.value.currentPage,
|
||||||
size: pageData.value.pageSize,
|
size: pageData.value.pageSize,
|
||||||
});
|
});
|
||||||
console.log('response', response);
|
|
||||||
crudData.value = response.data.records;
|
crudData.value = response.data.records;
|
||||||
pageData.value.total = response.data.total;
|
pageData.value.total = response.data.total;
|
||||||
pageData.value.currentPage = response.data.current;
|
pageData.value.currentPage = response.data.current;
|
||||||
@ -285,27 +225,20 @@ const getData = async () => {
|
|||||||
|
|
||||||
const getEnterDetail = async (id) => {
|
const getEnterDetail = async (id) => {
|
||||||
try {
|
try {
|
||||||
|
resetForm();
|
||||||
const response = await getEnterById(id);
|
const response = await getEnterById(id);
|
||||||
if (response?.code === 200 && response.data) {
|
formData.value = {
|
||||||
// 使用深拷贝避免污染原始数据
|
...response.data,
|
||||||
formData.value = {
|
// 确保addressArr始终是5个元素,不足的用空字符串填充
|
||||||
...cloneDeep(response.data),
|
addressArr: [
|
||||||
// 确保addressArr始终是5个元素,不足的用空字符串填充
|
response.data.provinceCode || '',
|
||||||
addressArr: [
|
response.data.cityCode || '',
|
||||||
response.data.provinceCode || '',
|
response.data.countyCode || '',
|
||||||
response.data.cityCode || '',
|
response.data.townCode || '',
|
||||||
response.data.countyCode || '',
|
response.data.villageCode || '',
|
||||||
response.data.townCode || '',
|
],
|
||||||
response.data.villageCode || '',
|
};
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log('详情数据加载完成', formData.value);
|
|
||||||
} else {
|
|
||||||
ElMessage.error(response?.msg || '获取详情失败:服务器未返回有效数据');
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取详情失败:', error);
|
|
||||||
ElMessage.error(`获取详情失败:${error.message || '请稍后重试'}`);
|
ElMessage.error(`获取详情失败:${error.message || '请稍后重试'}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -317,9 +250,8 @@ function handleTabChange(tab) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
useCoopData.getData({});
|
|
||||||
isReadonly.value = false;
|
isReadonly.value = false;
|
||||||
// resetForm();
|
resetForm();
|
||||||
dialogTitle.value = '新增';
|
dialogTitle.value = '新增';
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
};
|
};
|
||||||
@ -327,7 +259,6 @@ const handleAdd = () => {
|
|||||||
const handleView = async (row) => {
|
const handleView = async (row) => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
dialogTitle.value = '查看';
|
dialogTitle.value = '查看';
|
||||||
formData.value = null;
|
|
||||||
try {
|
try {
|
||||||
await getEnterDetail(row.id);
|
await getEnterDetail(row.id);
|
||||||
isReadonly.value = true;
|
isReadonly.value = true;
|
||||||
@ -340,14 +271,10 @@ const handleView = async (row) => {
|
|||||||
|
|
||||||
// 编辑详情(可修改)
|
// 编辑详情(可修改)
|
||||||
const handleEdit = async (row) => {
|
const handleEdit = async (row) => {
|
||||||
console.log(row);
|
|
||||||
formData.value = row;
|
|
||||||
formData.value.addressArr = [row.provinceCode, row.cityCode, row.countyCode, row.townCode, row.villageCode];
|
|
||||||
useCoopData.getData(formData.value);
|
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
dialogTitle.value = '编辑';
|
dialogTitle.value = '编辑';
|
||||||
try {
|
try {
|
||||||
await getEnterById(row.id);
|
await getEnterDetail(row.id);
|
||||||
isReadonly.value = false;
|
isReadonly.value = false;
|
||||||
activeTab.value = 'basic';
|
activeTab.value = 'basic';
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
@ -355,6 +282,26 @@ const handleEdit = async (row) => {
|
|||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// 提交审核
|
||||||
|
const handleSubmitApprove = async (row) => {
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
id: row.id,
|
||||||
|
status: '1', // 待审核
|
||||||
|
reason: '提交审核',
|
||||||
|
};
|
||||||
|
const res = await approvalEnter(params);
|
||||||
|
if (res.code === 200) {
|
||||||
|
ElMessage.success('提交审核成功');
|
||||||
|
row.status = '1';
|
||||||
|
getData(); // 刷新表格数据
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg || '提交审核失败');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
ElMessage.error('提交审核失败');
|
||||||
|
}
|
||||||
|
};
|
||||||
// 重新提交(被驳回 → 待审核)
|
// 重新提交(被驳回 → 待审核)
|
||||||
function handleResubmit(row) {
|
function handleResubmit(row) {
|
||||||
ElMessageBox.confirm('确认重新提交吗?', '重新提交').then(() => {
|
ElMessageBox.confirm('确认重新提交吗?', '重新提交').then(() => {
|
||||||
@ -513,16 +460,16 @@ console.log('admin 属性:', user.admin);
|
|||||||
const isAdmin = user.admin;
|
const isAdmin = user.admin;
|
||||||
const getActions = (row) => {
|
const getActions = (row) => {
|
||||||
const actions = [
|
const actions = [
|
||||||
// {
|
{
|
||||||
// name: '查看',
|
name: '查看',
|
||||||
// icon: 'view',
|
icon: 'view',
|
||||||
// event: () => handleView(row),
|
event: () => handleView(row),
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: '编辑',
|
name: '编辑',
|
||||||
// icon: 'edit',
|
icon: 'edit',
|
||||||
// event: () => handleEdit(row),
|
event: () => handleEdit(row),
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
type: 'danger',
|
type: 'danger',
|
||||||
name: '删除',
|
name: '删除',
|
||||||
@ -537,7 +484,7 @@ const getActions = (row) => {
|
|||||||
{
|
{
|
||||||
name: '提交审核',
|
name: '提交审核',
|
||||||
icon: 'check',
|
icon: 'check',
|
||||||
event: () => handleSubmit(row),
|
event: () => handleSubmitApprove(row),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '重新提交',
|
name: '重新提交',
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
</avue-crud>
|
</avue-crud>
|
||||||
|
|
||||||
<!-- 新增弹窗 -->
|
<!-- 新增弹窗 -->
|
||||||
<el-dialog :key="dialogTitle" v-model="dialogVisible" :title="dialogTitle" width="80%" align-center :draggable="true">
|
<el-dialog :key="dialogTitle" v-model="dialogVisible" :title="dialogTitle" width="60%" align-center :draggable="true">
|
||||||
<el-form :model="formData" label-width="120px" class="custom-form" :disabled="isReadonly">
|
<el-form :model="formData" label-width="120px" class="custom-form" :disabled="isReadonly">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user