xiabin修改企业管理
This commit is contained in:
parent
0fbc726e8e
commit
ae80ff266f
15
sub-government-affairs-service/src/store/modules/coop.js
Normal file
15
sub-government-affairs-service/src/store/modules/coop.js
Normal 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: {},
|
||||
});
|
@ -32,6 +32,7 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item label="地址">
|
||||
<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 label="经营产品">
|
||||
<el-input v-model="localForm.primaryProduct" placeholder="请输入" />
|
||||
@ -72,6 +73,8 @@ 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({
|
||||
modelValue: {
|
||||
@ -79,7 +82,7 @@ const props = defineProps({
|
||||
required: true,
|
||||
default: () => ({}),
|
||||
},
|
||||
readonly: Boolean,
|
||||
// readonly: Boolean,
|
||||
});
|
||||
|
||||
const ossUrl = 'http://gov-cloud.oss-cn-chengdu.aliyuncs.com/';
|
||||
@ -89,16 +92,16 @@ const businessLicenceList = ref([]);
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
|
||||
// 建立本地副本,避免直接修改 props
|
||||
const localForm = ref({ ...props.modelValue });
|
||||
// const localForm = ref({ ...props.modelValue });
|
||||
|
||||
// 深度监听本地副本的变化,实时更新父组件
|
||||
watch(
|
||||
localForm,
|
||||
(newVal) => {
|
||||
emit('update:modelValue', { ...newVal });
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
// watch(
|
||||
// localForm,
|
||||
// (newVal) => {
|
||||
// emit('update:modelValue', { ...newVal });
|
||||
// },
|
||||
// { deep: true }
|
||||
// );
|
||||
// watch(
|
||||
// () => props.modelValue,
|
||||
// (newVal) => {
|
||||
@ -151,21 +154,21 @@ const handleExceed = () => {
|
||||
};
|
||||
|
||||
// 初始化时如果有图片,设置预览
|
||||
if (localForm.value.cooperativePhoto) {
|
||||
if (localForm.cooperativePhoto) {
|
||||
cooperativePhotoList.value = [
|
||||
{
|
||||
name: '合作社照片',
|
||||
url: ossUrl + localForm.value.cooperativePhoto,
|
||||
url: ossUrl + localForm.cooperativePhoto,
|
||||
status: 'success',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
if (localForm.value.businessLicence) {
|
||||
if (localForm.businessLicence) {
|
||||
businessLicenceList.value = [
|
||||
{
|
||||
name: '营业执照',
|
||||
url: ossUrl + localForm.value.businessLicence,
|
||||
url: ossUrl + localForm.businessLicence,
|
||||
status: 'success',
|
||||
},
|
||||
];
|
||||
|
@ -71,6 +71,8 @@
|
||||
import { reactive, watch } from 'vue';
|
||||
import { Plus } from '@element-plus/icons-vue';
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import { useCoop } from '../../../../store/modules/coop';
|
||||
const localForm = useCoop().$state.data;
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
@ -86,23 +88,23 @@ const props = defineProps({
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
|
||||
// 本地副本,存放各表的文件列表
|
||||
const localForm = reactive(cloneDeep(props.modelValue));
|
||||
// const localForm = reactive(cloneDeep(props.modelValue));
|
||||
|
||||
// watch 同步回父组件
|
||||
watch(
|
||||
() => localForm,
|
||||
(val) => {
|
||||
emit('update:modelValue', { ...val });
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newVal) => {
|
||||
Object.assign(localForm, cloneDeep(newVal));
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
// watch(
|
||||
// () => localForm,
|
||||
// (val) => {
|
||||
// emit('update:modelValue', { ...val });
|
||||
// },
|
||||
// { deep: true }
|
||||
// );
|
||||
// watch(
|
||||
// () => props.modelValue,
|
||||
// (newVal) => {
|
||||
// Object.assign(localForm, cloneDeep(newVal));
|
||||
// },
|
||||
// { deep: true }
|
||||
// );
|
||||
|
||||
// 下载模板(可替换为真实下载地址)
|
||||
function downloadTemplate(type) {
|
||||
|
@ -28,6 +28,8 @@
|
||||
<script setup>
|
||||
import { reactive, watch } from 'vue';
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import { useCoop } from '../../../../store/modules/coop';
|
||||
const localForm = useCoop().$state.data;
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
@ -40,22 +42,22 @@ const props = defineProps({
|
||||
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
|
||||
const localForm = reactive(cloneDeep(props.modelValue));
|
||||
// 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 }
|
||||
);
|
||||
// watch(
|
||||
// localForm,
|
||||
// (newVal) => {
|
||||
// emit('update:modelValue', { ...newVal });
|
||||
// },
|
||||
// { deep: true }
|
||||
// );
|
||||
// watch(
|
||||
// () => props.modelValue,
|
||||
// (newVal) => {
|
||||
// Object.assign(localForm, cloneDeep(newVal));
|
||||
// },
|
||||
// { deep: true }
|
||||
// );
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.credit-evaluation {
|
||||
|
@ -105,6 +105,8 @@ import { ref, reactive, watch, onMounted, computed } from 'vue';
|
||||
import { CRUD_OPTIONS } from '@/config';
|
||||
import { ElMessageBox, ElMessage } from 'element-plus';
|
||||
import { getMemberList, addMember, updateMember, deleteMembers } from '@/apis/businessEntity';
|
||||
import { useCoop } from '../../../../store/modules/coop';
|
||||
const defaultFormData = useCoop().$state.data;
|
||||
|
||||
const dialogTitle = ref('新增');
|
||||
const dialogVisible = ref(false);
|
||||
@ -124,31 +126,31 @@ const searchForm = ref({
|
||||
});
|
||||
const crudData = ref([]);
|
||||
// 定义默认表单数据
|
||||
const defaultFormData = {
|
||||
id: '',
|
||||
entId: '',
|
||||
name: '',
|
||||
idType: '101',
|
||||
idCard: '',
|
||||
sex: '1',
|
||||
age: '',
|
||||
phone: '',
|
||||
provinceCode: '', // 省
|
||||
cityCode: '', // 市
|
||||
countyCode: '', // 区县
|
||||
townCode: '', // 镇
|
||||
street: '', // 村
|
||||
addressArr: [],
|
||||
detailAddress: '',
|
||||
area: '',
|
||||
planCrop: '',
|
||||
planCropName: '',
|
||||
address: '',
|
||||
createTime: '',
|
||||
createUser: '',
|
||||
updateTime: '',
|
||||
updateUser: '',
|
||||
};
|
||||
// const defaultFormData = {
|
||||
// id: '',
|
||||
// entId: '',
|
||||
// name: '',
|
||||
// idType: '101',
|
||||
// idCard: '',
|
||||
// sex: '1',
|
||||
// age: '',
|
||||
// phone: '',
|
||||
// provinceCode: '', // 省
|
||||
// cityCode: '', // 市
|
||||
// countyCode: '', // 区县
|
||||
// townCode: '', // 镇
|
||||
// street: '', // 村
|
||||
// addressArr: [],
|
||||
// detailAddress: '',
|
||||
// area: '',
|
||||
// planCrop: '',
|
||||
// planCropName: '',
|
||||
// address: '',
|
||||
// createTime: '',
|
||||
// createUser: '',
|
||||
// updateTime: '',
|
||||
// updateUser: '',
|
||||
// };
|
||||
// 新增表单数据,使用默认数据初始化
|
||||
const formData = ref({ ...defaultFormData });
|
||||
const resetForm = () => {
|
||||
@ -264,18 +266,18 @@ const handleSave = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
() => formData.value.addressArr,
|
||||
(newValue) => {
|
||||
if (newValue.length <= 3) {
|
||||
formData.value.provinceCode = '530000';
|
||||
formData.value.cityCode = '530900';
|
||||
formData.value.countyCode = newValue[0];
|
||||
formData.value.townCode = newValue[1];
|
||||
formData.value.street = newValue[2];
|
||||
}
|
||||
}
|
||||
);
|
||||
// watch(
|
||||
// () => formData.value.addressArr,
|
||||
// (newValue) => {
|
||||
// if (newValue.length <= 3) {
|
||||
// formData.value.provinceCode = '530000';
|
||||
// formData.value.cityCode = '530900';
|
||||
// formData.value.countyCode = newValue[0];
|
||||
// formData.value.townCode = newValue[1];
|
||||
// formData.value.street = newValue[2];
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
const handleAdd = () => {
|
||||
isReadonly.value = false; // 设置为可编辑模式
|
||||
resetForm();
|
||||
|
@ -73,6 +73,8 @@
|
||||
<script setup>
|
||||
import { reactive, watch } from 'vue';
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import { useCoop } from '../../../../store/modules/coop';
|
||||
const localForm = useCoop().$state.data;
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
@ -86,23 +88,23 @@ const props = defineProps({
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
|
||||
// 创建本地副本(为了避免直接修改 props)
|
||||
const localForm = reactive(cloneDeep(props.modelValue));
|
||||
// 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 }
|
||||
);
|
||||
// watch(
|
||||
// localForm,
|
||||
// (newVal) => {
|
||||
// emit('update:modelValue', { ...newVal });
|
||||
// },
|
||||
// { deep: true }
|
||||
// );
|
||||
// watch(
|
||||
// () => props.modelValue,
|
||||
// (newVal) => {
|
||||
// Object.assign(localForm, cloneDeep(newVal));
|
||||
// },
|
||||
// { deep: true }
|
||||
// );
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
@ -58,6 +58,9 @@ import TabCreditEvaluation from './components/TabCreditEvaluation.vue';
|
||||
import TabMember from './components/TabMember.vue';
|
||||
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);
|
||||
@ -116,6 +119,8 @@ const formData = ref({
|
||||
|
||||
// 保存处理
|
||||
const handleSubmit = async () => {
|
||||
console.log(formData.value);
|
||||
debugger;
|
||||
try {
|
||||
loading.value = true;
|
||||
let response;
|
||||
@ -128,6 +133,12 @@ const handleSubmit = async () => {
|
||||
getData(); // 刷新表格数据
|
||||
}
|
||||
} 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);
|
||||
if (response.code === 200) {
|
||||
ElMessage.success('编辑成功');
|
||||
@ -336,6 +347,7 @@ function handleTabChange(tab) {
|
||||
}
|
||||
|
||||
const handleAdd = () => {
|
||||
useCoopData.getData({});
|
||||
isReadonly.value = false;
|
||||
// resetForm();
|
||||
dialogTitle.value = '新增';
|
||||
@ -358,6 +370,10 @@ const handleView = 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;
|
||||
dialogTitle.value = '编辑';
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user