xiabin修改企业管理

This commit is contained in:
13713575202 2025-06-13 13:46:51 +08:00
parent 0fbc726e8e
commit ae80ff266f
7 changed files with 137 additions and 95 deletions

View File

@ -0,0 +1,15 @@
import { defineStore } from 'pinia';
import { getEnterList } from '@/apis/businessEntity';
export const useCoop = defineStore('useCoop', {
state: () => ({
data: {},
}),
actions: {
//订单
getData(params) {
return Promise.resolve((useCoop().$state.data = params));
},
},
getters: {},
});

View File

@ -32,6 +32,7 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item label="地址"> <el-form-item label="地址">
<area-select v-model="localForm.addressArr" :disabled="readonly" :label="null" /> <area-select v-model="localForm.addressArr" :disabled="readonly" :label="null" />
<!-- <el-cascader v-model="localForm.addressArr" :options="options" @change="handleChange" /> -->
</el-form-item> </el-form-item>
<el-form-item label="经营产品"> <el-form-item label="经营产品">
<el-input v-model="localForm.primaryProduct" placeholder="请输入" /> <el-input v-model="localForm.primaryProduct" placeholder="请输入" />
@ -72,6 +73,8 @@ import cloneDeep from 'lodash/cloneDeep';
import { CommonUpload } from '@/apis/index'; import { CommonUpload } from '@/apis/index';
import { ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
import Attrs from './Attrs.vue'; import Attrs from './Attrs.vue';
import { useCoop } from '../../../../store/modules/coop';
const localForm = useCoop().$state.data;
const props = defineProps({ const props = defineProps({
modelValue: { modelValue: {
@ -79,7 +82,7 @@ const props = defineProps({
required: true, required: true,
default: () => ({}), default: () => ({}),
}, },
readonly: Boolean, // readonly: Boolean,
}); });
const ossUrl = 'http://gov-cloud.oss-cn-chengdu.aliyuncs.com/'; const ossUrl = 'http://gov-cloud.oss-cn-chengdu.aliyuncs.com/';
@ -89,16 +92,16 @@ const businessLicenceList = ref([]);
const emit = defineEmits(['update:modelValue']); const emit = defineEmits(['update:modelValue']);
// props // props
const localForm = ref({ ...props.modelValue }); // const localForm = ref({ ...props.modelValue });
// //
watch( // watch(
localForm, // localForm,
(newVal) => { // (newVal) => {
emit('update:modelValue', { ...newVal }); // emit('update:modelValue', { ...newVal });
}, // },
{ deep: true } // { deep: true }
); // );
// watch( // watch(
// () => props.modelValue, // () => props.modelValue,
// (newVal) => { // (newVal) => {
@ -151,21 +154,21 @@ const handleExceed = () => {
}; };
// //
if (localForm.value.cooperativePhoto) { if (localForm.cooperativePhoto) {
cooperativePhotoList.value = [ cooperativePhotoList.value = [
{ {
name: '合作社照片', name: '合作社照片',
url: ossUrl + localForm.value.cooperativePhoto, url: ossUrl + localForm.cooperativePhoto,
status: 'success', status: 'success',
}, },
]; ];
} }
if (localForm.value.businessLicence) { if (localForm.businessLicence) {
businessLicenceList.value = [ businessLicenceList.value = [
{ {
name: '营业执照', name: '营业执照',
url: ossUrl + localForm.value.businessLicence, url: ossUrl + localForm.businessLicence,
status: 'success', status: 'success',
}, },
]; ];

View File

@ -71,6 +71,8 @@
import { reactive, watch } from 'vue'; 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';
const localForm = useCoop().$state.data;
const props = defineProps({ const props = defineProps({
modelValue: { modelValue: {
@ -86,23 +88,23 @@ 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) => {
Object.assign(localForm, cloneDeep(newVal)); // Object.assign(localForm, cloneDeep(newVal));
}, // },
{ deep: true } // { deep: true }
); // );
// //
function downloadTemplate(type) { function downloadTemplate(type) {

View File

@ -28,6 +28,8 @@
<script setup> <script setup>
import { reactive, watch } from 'vue'; import { reactive, watch } from 'vue';
import cloneDeep from 'lodash/cloneDeep'; import cloneDeep from 'lodash/cloneDeep';
import { useCoop } from '../../../../store/modules/coop';
const localForm = useCoop().$state.data;
const props = defineProps({ const props = defineProps({
modelValue: { modelValue: {
@ -40,22 +42,22 @@ 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(
localForm, // localForm,
(newVal) => { // (newVal) => {
emit('update:modelValue', { ...newVal }); // emit('update:modelValue', { ...newVal });
}, // },
{ deep: true } // { deep: true }
); // );
watch( // watch(
() => props.modelValue, // () => props.modelValue,
(newVal) => { // (newVal) => {
Object.assign(localForm, cloneDeep(newVal)); // Object.assign(localForm, cloneDeep(newVal));
}, // },
{ deep: true } // { deep: true }
); // );
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.credit-evaluation { .credit-evaluation {

View File

@ -105,6 +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';
const defaultFormData = useCoop().$state.data;
const dialogTitle = ref('新增'); const dialogTitle = ref('新增');
const dialogVisible = ref(false); const dialogVisible = ref(false);
@ -124,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 = () => {
@ -264,18 +266,18 @@ const handleSave = async () => {
} }
}; };
watch( // watch(
() => formData.value.addressArr, // () => formData.value.addressArr,
(newValue) => { // (newValue) => {
if (newValue.length <= 3) { // if (newValue.length <= 3) {
formData.value.provinceCode = '530000'; // formData.value.provinceCode = '530000';
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.street = newValue[2]; // formData.value.street = newValue[2];
} // }
} // }
); // );
const handleAdd = () => { const handleAdd = () => {
isReadonly.value = false; // isReadonly.value = false; //
resetForm(); resetForm();

View File

@ -73,6 +73,8 @@
<script setup> <script setup>
import { reactive, watch } from 'vue'; import { reactive, watch } from 'vue';
import cloneDeep from 'lodash/cloneDeep'; 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,23 +88,23 @@ const props = defineProps({
const emit = defineEmits(['update:modelValue']); const emit = defineEmits(['update:modelValue']);
// props // props
const localForm = reactive(cloneDeep(props.modelValue)); // const localForm = reactive(cloneDeep(props.modelValue));
// //
watch( // watch(
localForm, // localForm,
(newVal) => { // (newVal) => {
emit('update:modelValue', { ...newVal }); // emit('update:modelValue', { ...newVal });
}, // },
{ deep: true } // { deep: true }
); // );
watch( // watch(
() => props.modelValue, // () => props.modelValue,
(newVal) => { // (newVal) => {
Object.assign(localForm, cloneDeep(newVal)); // Object.assign(localForm, cloneDeep(newVal));
}, // },
{ deep: true } // { deep: true }
); // );
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -58,6 +58,9 @@ 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 { cloneDeep } from 'lodash';
import { useCoop } from '../../../store/modules/coop';
const useCoopData = useCoop();
// //
const visible = ref(false); const visible = ref(false);
@ -116,6 +119,8 @@ const formData = ref({
// //
const handleSubmit = async () => { const handleSubmit = async () => {
console.log(formData.value);
debugger;
try { try {
loading.value = true; loading.value = true;
let response; let response;
@ -128,6 +133,12 @@ const handleSubmit = async () => {
getData(); // getData(); //
} }
} else if (dialogTitle.value === '编辑') { } else if (dialogTitle.value === '编辑') {
formData.value.provinceCode = formData.value.addressArr[0];
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('编辑成功');
@ -336,6 +347,7 @@ function handleTabChange(tab) {
} }
const handleAdd = () => { const handleAdd = () => {
useCoopData.getData({});
isReadonly.value = false; isReadonly.value = false;
// resetForm(); // resetForm();
dialogTitle.value = '新增'; dialogTitle.value = '新增';
@ -358,6 +370,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 {