|
@@ -0,0 +1,242 @@
|
|
|
+<template>
|
|
|
+ <div class="form">
|
|
|
+ <van-nav-bar
|
|
|
+ title="多公司配置"
|
|
|
+ left-text="返回"
|
|
|
+ left-arrow
|
|
|
+ @click-left="onClickLeft"
|
|
|
+ >
|
|
|
+ </van-nav-bar>
|
|
|
+ <testForm
|
|
|
+ v-model="formData.data"
|
|
|
+ :formOption="formOption"
|
|
|
+ :formConfig="formConfig"
|
|
|
+ :rules="rules"
|
|
|
+ @onSubmit="onSubmit"
|
|
|
+ ref="formDom"
|
|
|
+ ></testForm>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { ref, getCurrentInstance, onMounted, reactive } from 'vue'
|
|
|
+import { showSuccessToast, showToast } from 'vant'
|
|
|
+import { useRoute } from 'vue-router'
|
|
|
+import { getUserInfo } from '@/utils/auth'
|
|
|
+import testForm from '@/components/testForm/index.vue'
|
|
|
+const proxy = getCurrentInstance().proxy
|
|
|
+const route = useRoute()
|
|
|
+const show = ref(false)
|
|
|
+const typeModal = ref(false)
|
|
|
+const unitModal = ref(false)
|
|
|
+const classification = ref([])
|
|
|
+const formData = reactive({
|
|
|
+ data: {
|
|
|
+ type:null,
|
|
|
+ },
|
|
|
+})
|
|
|
+const formDom = ref(null)
|
|
|
+const formOption = reactive({
|
|
|
+ readonly: false, //用于控制整个表单是否只读
|
|
|
+ disabled: false,
|
|
|
+ labelAlign: 'top',
|
|
|
+ scroll: true,
|
|
|
+ labelWidth: '62pk',
|
|
|
+ // hiddenSubmitBtn: true,
|
|
|
+})
|
|
|
+const formConfig = reactive([
|
|
|
+ {
|
|
|
+ type: 'input',
|
|
|
+ itemType: 'text',
|
|
|
+ label: '公司名称',
|
|
|
+ prop: 'name',
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'input',
|
|
|
+ itemType: 'text',
|
|
|
+ label: '英文名',
|
|
|
+ prop: 'nameEn',
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'picker',
|
|
|
+ label: '企业类型',
|
|
|
+ prop: 'type',
|
|
|
+ itemType: 'onePicker',
|
|
|
+ showPicker: false,
|
|
|
+ fieldNames: {
|
|
|
+ text: 'dictValue',
|
|
|
+ value: 'dictKey',
|
|
|
+ },
|
|
|
+ data:[],
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ type: 'input',
|
|
|
+ itemType: 'text',
|
|
|
+ label: '统一社会信用代码',
|
|
|
+ prop: 'uscCode',
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'input',
|
|
|
+ itemType: 'text',
|
|
|
+ label: '法定代表人',
|
|
|
+ prop: 'legalPersonName',
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'input',
|
|
|
+ itemType: 'text',
|
|
|
+ label: '注册资本',
|
|
|
+ prop: 'registeredCapital',
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'picker',
|
|
|
+ label: '营业时间(开始)',
|
|
|
+ prop: 'startDate',
|
|
|
+ itemType: 'datePicker',
|
|
|
+ showPicker: false,
|
|
|
+ split: '-',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'picker',
|
|
|
+ label: '营业时间(结束)',
|
|
|
+ prop: 'stopDate',
|
|
|
+ itemType: 'datePicker',
|
|
|
+ showPicker: false,
|
|
|
+ split: '-',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'cascader',
|
|
|
+ label: '注册地址',
|
|
|
+ prop: 'city',
|
|
|
+ itemType: 'city',
|
|
|
+ showPicker: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'input',
|
|
|
+ itemType: 'textarea',
|
|
|
+ label: '详细地址',
|
|
|
+ prop: 'detailedAddress',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'picker',
|
|
|
+ label: '纳税人资质',
|
|
|
+ prop: 'taxpayerQualification',
|
|
|
+ clearable: true,
|
|
|
+ itemType: 'onePicker',
|
|
|
+ showPicker: false,
|
|
|
+ fieldNames: {
|
|
|
+ text: 'dictValue',
|
|
|
+ value: 'dictKey',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'input',
|
|
|
+ itemType: 'text',
|
|
|
+ label: '海关注册代码',
|
|
|
+ prop: 'crCode',
|
|
|
+ clearable: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'upload',
|
|
|
+ label: '企业logo',
|
|
|
+ prop: 'enterpriseLogoList',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'upload',
|
|
|
+ label: '法人签名',
|
|
|
+ prop: 'larSignList',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'upload',
|
|
|
+ label: '公章',
|
|
|
+ prop: 'officialSealList',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'upload',
|
|
|
+ label: '合同章',
|
|
|
+ prop: 'contractSealList',
|
|
|
+ },
|
|
|
+])
|
|
|
+const rules = {
|
|
|
+ name: [{ required: true, message: '公司名称不能为空' }],
|
|
|
+}
|
|
|
+const unitList = ref([])
|
|
|
+
|
|
|
+const getDict = () => {
|
|
|
+ proxy
|
|
|
+ .post('/tenantDict/getDict', {
|
|
|
+ dictCode: 'enterprise_type',
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ formConfig[2].data = res.data
|
|
|
+ })
|
|
|
+ proxy
|
|
|
+ .post('/tenantDict/getDict', {
|
|
|
+ dictCode: 'taxpayer_qualification',
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ formConfig[10].data = res.data
|
|
|
+ })
|
|
|
+}
|
|
|
+getDict()
|
|
|
+const fileList = ref([])
|
|
|
+const onOversize = () => {
|
|
|
+ showToast('文件大小不能超过 5MB')
|
|
|
+}
|
|
|
+const onClickLeft = () => history.back()
|
|
|
+const onSubmit = () => {
|
|
|
+ if (
|
|
|
+ formData.data.cityObj &&
|
|
|
+ formData.data.cityObj.selectedOptions &&
|
|
|
+ formData.data.cityObj.selectedOptions.length > 0
|
|
|
+ ) {
|
|
|
+ formData.data.countryId = formData.data.cityObj.selectedOptions[0].value
|
|
|
+ if (formData.data.cityObj.selectedOptions.length == 2) {
|
|
|
+ formData.data.cityId =
|
|
|
+ formData.data.cityObj.selectedOptions[1].value
|
|
|
+ } else {
|
|
|
+ formData.data.provinceId =
|
|
|
+ formData.data.cityObj.selectedOptions[1].value
|
|
|
+ formData.data.cityId =
|
|
|
+ formData.data.cityObj.selectedOptions[2].value
|
|
|
+ }
|
|
|
+ }
|
|
|
+ proxy.post('/corporation/' + route.query.type, formData.data).then(() => {
|
|
|
+ showSuccessToast('添加成功')
|
|
|
+ setTimeout(() => {
|
|
|
+ history.back()
|
|
|
+ }, 500)
|
|
|
+ })
|
|
|
+}
|
|
|
+const treeToList = (arr) => {
|
|
|
+ let res = [] // 用于存储递归结果(扁平数据)
|
|
|
+ // 递归函数
|
|
|
+ let fn = (source) => {
|
|
|
+ source.forEach((el) => {
|
|
|
+ res.push(el)
|
|
|
+ el.children && el.children.length > 0 ? fn(el.children) : '' // 子级递归
|
|
|
+ })
|
|
|
+ }
|
|
|
+ fn(arr)
|
|
|
+ return res
|
|
|
+}
|
|
|
+onMounted(() => {
|
|
|
+ if (route.query.id) {
|
|
|
+ proxy
|
|
|
+ .post('/corporation/detail', { id: route.query.id })
|
|
|
+ .then((resDetail) => {
|
|
|
+ formData.data = resDetail.data
|
|
|
+ })
|
|
|
+ }
|
|
|
+})
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.form {
|
|
|
+ padding-bottom: 50px;
|
|
|
+}
|
|
|
+</style>
|