添加上传图片两张
This commit is contained in:
parent
a46d6e2f24
commit
0d9beb2686
|
@ -9,16 +9,53 @@
|
||||||
<menu-fold-outlined v-else class="trigger" @click="() => (collapsed = !collapsed)"/>
|
<menu-fold-outlined v-else class="trigger" @click="() => (collapsed = !collapsed)"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="margin-right flex-center">
|
<div class="margin-right flex-center">
|
||||||
<a-avatar/>
|
<a-dropdown :trigger="['click']" placement="bottomRight" :arrow="{ pointAtCenter: true }">
|
||||||
|
<a-avatar/>
|
||||||
|
<template #overlay >
|
||||||
|
<a-menu style="width: 100px;text-align: center">
|
||||||
|
<a-menu-item key="0" @click="logout"> 退出登录</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
</template>
|
||||||
|
</a-dropdown>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {MenuFoldOutlined, MenuUnfoldOutlined} from "@ant-design/icons-vue";
|
import {ExclamationCircleOutlined, MenuFoldOutlined, MenuUnfoldOutlined} from "@ant-design/icons-vue";
|
||||||
|
import router from "@/router";
|
||||||
|
import {useUserStore} from "@/stores/modules/userStore.ts";
|
||||||
|
import {Modal} from "ant-design-vue";
|
||||||
|
import {createVNode} from "vue";
|
||||||
|
|
||||||
|
|
||||||
const collapsed = defineModel<boolean>('collapsed')
|
const collapsed = defineModel<boolean>('collapsed')
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
|
// const logout = ()=>{
|
||||||
|
// localStorage.removeItem("baUserStore");
|
||||||
|
// router.push('/login')
|
||||||
|
// userStore.resetUserInfo()
|
||||||
|
// }
|
||||||
|
const logout = () => {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '确定要退出登录么?',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
async onOk() {
|
||||||
|
//清除登录信息
|
||||||
|
await userStore.resetUserInfo();
|
||||||
|
//跳转登录页
|
||||||
|
await router.push({
|
||||||
|
path: '/login'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async onCancel() {
|
||||||
|
console.log('Cancel');
|
||||||
|
},
|
||||||
|
class: 'test',
|
||||||
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|
|
@ -1,96 +1,122 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="simpleUploadDiv">
|
<div class="simpleUploadDiv">
|
||||||
<a-progress v-if="uploading" type="circle" :percent="percent"/>
|
<a-progress v-if="uploading" type="circle" :percent="percent" />
|
||||||
<a-image
|
<a-image
|
||||||
height="80%"
|
height="80%"
|
||||||
v-else
|
v-else
|
||||||
:src="minioBaseUrl+modelValue"
|
:src="minioBaseUrl + modelValue"
|
||||||
alt="avatar"/>
|
alt="avatar"
|
||||||
|
/>
|
||||||
|
|
||||||
<a-button class="btn-success" @click="selectFile">{{ btnLabel }}</a-button>
|
<a-button class="btn-success" @click="selectFile">{{ btnLabel }}</a-button>
|
||||||
<input id="myFileInput" type="file" style="display: none" ref="fileInput" />
|
<input :id="id" type="file" style="display: none" ref="fileInput" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {message} from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import {onMounted, onUnmounted, ref} from "vue";
|
import { onMounted, onUnmounted, ref } from "vue";
|
||||||
import {generateSimpleObjectName, getResignedObjectUrl} from "@/utils/minioUtil";
|
import {
|
||||||
import axios, {CancelTokenSource} from "axios";
|
generateSimpleObjectName,
|
||||||
import {convertFileSizeToStr} from "@/utils/index.ts";
|
getResignedObjectUrl,
|
||||||
|
} from "@/utils/minioUtil";
|
||||||
|
import axios, { CancelTokenSource } from "axios";
|
||||||
|
import { convertFileSizeToStr } from "@/utils/index.ts";
|
||||||
|
|
||||||
const minioBaseUrl = __APP_ENV.VITE_APP_MINIO_URL
|
const minioBaseUrl = __APP_ENV.VITE_APP_MINIO_URL;
|
||||||
|
|
||||||
const modelValue = defineModel<string>('value')
|
const modelValue = defineModel<string>("value");
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(
|
||||||
parentDir?: string,
|
defineProps<{
|
||||||
allowedExtensions?: string[],
|
parentDir?: string;
|
||||||
maxSize?: number,
|
allowedExtensions?: string[];
|
||||||
width?: string | number,
|
maxSize?: number;
|
||||||
height?: string | number,
|
width?: string | number;
|
||||||
btnLabel?: string
|
height?: string | number;
|
||||||
}>(), {
|
btnLabel?: string;
|
||||||
parentDir: '',
|
id: string;
|
||||||
allowedExtensions: () => ['jpg', 'jpeg', 'png', 'gif'],
|
}>(),
|
||||||
maxSize: 1024 * 1024 * 4,
|
{
|
||||||
width: '150px',
|
parentDir: "",
|
||||||
height: '150px',
|
allowedExtensions: () => ["jpg", "jpeg", "png", "gif"],
|
||||||
btnLabel: '选择图片'
|
maxSize: 1024 * 1024 * 4,
|
||||||
})
|
width: "150px",
|
||||||
|
height: "150px",
|
||||||
|
btnLabel: "选择图片",
|
||||||
|
id: "myFileInput",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const uploading = ref(false)
|
const uploading = ref(false);
|
||||||
const percent = ref(0)
|
const percent = ref(0);
|
||||||
let cancelToken: CancelTokenSource | null = null
|
let cancelToken: CancelTokenSource | null = null;
|
||||||
const uploadUrl = ref()
|
const uploadUrl = ref();
|
||||||
const fileInput = ref(null);
|
const fileInput = ref(null);
|
||||||
|
|
||||||
const selectFile = () => {
|
const selectFile = () => {
|
||||||
document.getElementById('myFileInput')?.click()
|
document.getElementById(props.id)?.click();
|
||||||
}
|
};
|
||||||
|
|
||||||
async function inputFileListener(this: HTMLInputElement) {
|
async function inputFileListener(this: HTMLInputElement) {
|
||||||
const selectedFile: File = this.files?.[0] as File;
|
const selectedFile: File = this.files?.[0] as File;
|
||||||
const fileExtension = selectedFile.name?.split('.').pop().toLowerCase() as string;
|
const fileExtension = selectedFile.name
|
||||||
if (!props.allowedExtensions.includes(fileExtension)) {
|
?.split(".")
|
||||||
return message.error(`错误:不支持的文件格式,目前支持:【${props.allowedExtensions}】`)
|
.pop()
|
||||||
}
|
.toLowerCase() as string;
|
||||||
|
|
||||||
|
if (!props.allowedExtensions.includes(fileExtension)) {
|
||||||
|
return message.error(
|
||||||
|
`错误:不支持的文件格式,目前支持:【${props.allowedExtensions}】`
|
||||||
|
);
|
||||||
|
}
|
||||||
const isMax = selectedFile.size > props.maxSize;
|
const isMax = selectedFile.size > props.maxSize;
|
||||||
if (isMax) {
|
if (isMax) {
|
||||||
return message.error(`文件大小超出限制,最大支持:【${convertFileSizeToStr(props.maxSize)}】`);
|
return message.error(
|
||||||
|
`文件大小超出限制,最大支持:【${convertFileSizeToStr(props.maxSize)}】`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelToken?.cancel();
|
cancelToken?.cancel();
|
||||||
percent.value = 0;
|
percent.value = 0;
|
||||||
uploading.value = true;
|
uploading.value = true;
|
||||||
|
|
||||||
const objectName = generateSimpleObjectName(selectedFile.name, props.parentDir)
|
const objectName = generateSimpleObjectName(
|
||||||
uploadUrl.value = await getResignedObjectUrl(__APP_ENV.VITE_APP_MINIO_BUCKET, objectName)
|
selectedFile.name,
|
||||||
cancelToken = axios.CancelToken.source()
|
props.parentDir
|
||||||
|
);
|
||||||
|
|
||||||
|
uploadUrl.value = await getResignedObjectUrl(
|
||||||
|
__APP_ENV.VITE_APP_MINIO_BUCKET,
|
||||||
|
objectName
|
||||||
|
);
|
||||||
|
cancelToken = axios.CancelToken.source();
|
||||||
await axios.put(uploadUrl.value, selectedFile, {
|
await axios.put(uploadUrl.value, selectedFile, {
|
||||||
cancelToken: cancelToken.token,
|
cancelToken: cancelToken.token,
|
||||||
onUploadProgress: (progressEvent) => {
|
onUploadProgress: (progressEvent) => {
|
||||||
percent.value = (progressEvent.loaded / (progressEvent.total as number) * 100 | 0)
|
percent.value =
|
||||||
}
|
((progressEvent.loaded / (progressEvent.total as number)) * 100) | 0;
|
||||||
})
|
},
|
||||||
modelValue.value = '/' + __APP_ENV.VITE_APP_MINIO_BUCKET + objectName;
|
});
|
||||||
|
modelValue.value = "/" + __APP_ENV.VITE_APP_MINIO_BUCKET + objectName;
|
||||||
uploading.value = false;
|
uploading.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileDelete = ()=>{
|
const fileDelete = () => {
|
||||||
uploadUrl.value = ''
|
uploadUrl.value = "";
|
||||||
fileInput.value.value = ''
|
fileInput.value.value = "";
|
||||||
modelValue.value = ''
|
modelValue.value = "";
|
||||||
}
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
document.getElementById('myFileInput')?.addEventListener('change', inputFileListener);
|
document
|
||||||
})
|
.getElementById(props.id)
|
||||||
|
?.addEventListener("change", inputFileListener);
|
||||||
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
document.getElementById('myFileInput')?.removeEventListener('change', inputFileListener);
|
document
|
||||||
})
|
.getElementById(props.id)
|
||||||
defineExpose({fileDelete})
|
?.removeEventListener("change", inputFileListener);
|
||||||
|
});
|
||||||
|
defineExpose({ fileDelete });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|
|
@ -20,6 +20,8 @@ router.beforeEach(async (to, from, next) => {
|
||||||
Modal.destroyAll();
|
Modal.destroyAll();
|
||||||
//判断访问的是不是登录页
|
//判断访问的是不是登录页
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
console.log(to.path.toLocaleLowerCase())
|
||||||
|
console.log(userStore)
|
||||||
if (to.path.toLocaleLowerCase() === '/login' && userStore.getTokenInfo?.value) {
|
if (to.path.toLocaleLowerCase() === '/login' && userStore.getTokenInfo?.value) {
|
||||||
//如果已登录 且访问login页面 直接返回当前页面
|
//如果已登录 且访问login页面 直接返回当前页面
|
||||||
await message.warn('当前已登录,请先退出账号');
|
await message.warn('当前已登录,请先退出账号');
|
||||||
|
|
|
@ -20,7 +20,7 @@ export const useUserStore = defineStore({
|
||||||
getTokenInfo: (state): TokenInfo => state.tokenInfo as TokenInfo,
|
getTokenInfo: (state): TokenInfo => state.tokenInfo as TokenInfo,
|
||||||
},
|
},
|
||||||
persist: {
|
persist: {
|
||||||
key: "baUserStore", //spUserStore
|
key: "baUserStore",
|
||||||
storage: window.localStorage,
|
storage: window.localStorage,
|
||||||
paths: ["tokenInfo"],
|
paths: ["tokenInfo"],
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@ export interface formDatePort {
|
||||||
telephone:string,
|
telephone:string,
|
||||||
administrativeDivisionCodes:string,
|
administrativeDivisionCodes:string,
|
||||||
address:string,
|
address:string,
|
||||||
nature:string
|
nature:string,
|
||||||
|
securityServiceLicence:string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface statusPort {
|
export interface statusPort {
|
||||||
|
|
|
@ -11,6 +11,7 @@ export interface serviceProjectSaveOrUpdateParams extends BaseTableRowRecord {
|
||||||
twoType: BaseEnum<any>,
|
twoType: BaseEnum<any>,
|
||||||
outsourceName:string,
|
outsourceName:string,
|
||||||
isFiling:BaseEnum<number>,
|
isFiling:BaseEnum<number>,
|
||||||
|
securityServiceContract:string,
|
||||||
idNumber: string,
|
idNumber: string,
|
||||||
serviceArea: number,
|
serviceArea: number,
|
||||||
buildingTotal: number,
|
buildingTotal: number,
|
||||||
|
|
|
@ -1,15 +1,21 @@
|
||||||
<template>
|
<template>
|
||||||
<!-- 背景色覆盖整个页面,并且能够正常滚动内容,同时固定内层内容的位置 -->
|
<!-- 背景色覆盖整个页面,并且能够正常滚动内容,同时固定内层内容的位置 -->
|
||||||
<body style="margin: 0; padding: 0; overflow: auto">
|
<body style="margin: 0; padding: 0; overflow: auto">
|
||||||
<!-- 背景色层 -->
|
<!-- 背景色层 -->
|
||||||
<div class="bg-gray-100" style="position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: -1"></div>
|
<div
|
||||||
<!-- 内容层 -->
|
class="bg-gray-100"
|
||||||
<div class="flex justify-center" style="position: relative; margin: 20px auto">
|
style="position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: -1"
|
||||||
<!-- 卡片盒子 -->
|
></div>
|
||||||
<div class="w-full max-w-3xl p-6 bg-white rounded-xl shadow-md">
|
<!-- 内容层 -->
|
||||||
<a-tabs v-model:activeKey="activeKey" :tabBarGutter="300" centered >
|
<div
|
||||||
<a-tab-pane key="1" tab="企业入驻">
|
class="flex justify-center"
|
||||||
<a-form
|
style="position: relative; margin: 20px auto"
|
||||||
|
>
|
||||||
|
<!-- 卡片盒子 -->
|
||||||
|
<div class="w-full max-w-3xl p-6 bg-white rounded-xl shadow-md">
|
||||||
|
<a-tabs v-model:activeKey="activeKey" :tabBarGutter="300" centered>
|
||||||
|
<a-tab-pane key="1" tab="企业入驻">
|
||||||
|
<a-form
|
||||||
ref="formDateRef"
|
ref="formDateRef"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
:label-col="labelCol"
|
:label-col="labelCol"
|
||||||
|
@ -17,18 +23,22 @@
|
||||||
layout="horizontal"
|
layout="horizontal"
|
||||||
:model="formDate"
|
:model="formDate"
|
||||||
@finish="onFinish"
|
@finish="onFinish"
|
||||||
>
|
>
|
||||||
<a-form-item label="名称" name="name">
|
<a-form-item label="名称" name="name">
|
||||||
<a-input :allowClear="true" v-model:value="formDate.name" />
|
<a-input :allowClear="true" v-model:value="formDate.name" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item :allowClear="true" label="统一社会编码" name="socialCode">
|
<a-form-item
|
||||||
<a-input v-model:value="formDate.socialCode"/>
|
:allowClear="true"
|
||||||
</a-form-item>
|
label="统一社会编码"
|
||||||
<a-form-item label="公司性质" name="nature">
|
name="socialCode"
|
||||||
<a-input :allowClear="true" v-model:value="formDate.nature"/>
|
>
|
||||||
</a-form-item>
|
<a-input v-model:value="formDate.socialCode" />
|
||||||
<a-form-item label="行政区划" name="administrativeDivisionCodes">
|
</a-form-item>
|
||||||
<a-cascader
|
<a-form-item label="公司性质" name="nature">
|
||||||
|
<a-input :allowClear="true" v-model:value="formDate.nature" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="行政区划" name="administrativeDivisionCodes">
|
||||||
|
<a-cascader
|
||||||
v-model:value="formDate.administrativeDivisionCodes"
|
v-model:value="formDate.administrativeDivisionCodes"
|
||||||
:options="administrativeDivisionTree"
|
:options="administrativeDivisionTree"
|
||||||
:load-data="loadData"
|
:load-data="loadData"
|
||||||
|
@ -36,225 +46,292 @@
|
||||||
@change="searchAdministrativeDivisionTree"
|
@change="searchAdministrativeDivisionTree"
|
||||||
placeholder="请选择行政区划"
|
placeholder="请选择行政区划"
|
||||||
change-on-select
|
change-on-select
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="营业执照" name="businessLicense">
|
<a-form-item label="营业执照" name="businessLicense">
|
||||||
<SingleImageFileUpload v-model:value="formDate.businessLicense" ref="fileUpload"></SingleImageFileUpload>
|
<SingleImageFileUpload
|
||||||
</a-form-item>
|
type="businessLicense"
|
||||||
<a-form-item label="法人名称">
|
btnLabel="营业执照上传"
|
||||||
<a-input :allowClear="true" v-model:value="formDate.legalPersonInfo" />
|
v-model:value="formDate.businessLicense"
|
||||||
</a-form-item>
|
ref="fileUpload"
|
||||||
<a-form-item label="法人手机号码">
|
></SingleImageFileUpload>
|
||||||
<a-input :allowClear="true" v-model:value="formDate.telephone" />
|
</a-form-item>
|
||||||
</a-form-item>
|
<a-form-item label="备案证/许可证" name="securityServiceLicence">
|
||||||
<a-form-item label="详细地址" >
|
<div style="display: flex">
|
||||||
<a-input :allowClear="true" v-model:value="formDate.address" />
|
<SingleImageFileUpload
|
||||||
</a-form-item>
|
v-model:value="formDate.securityServiceLicence"
|
||||||
<a-form-item :wrapper-col="{ offset: 8, span: 16 }">
|
ref="permitUpload"
|
||||||
<a-button type="primary" html-type="submit" style="width: 100px">确认</a-button>
|
id="securityServiceLicenceInput"
|
||||||
<a-button style="width: 100px;margin-left: 10px" @click="resetForm">重置表单</a-button>
|
></SingleImageFileUpload>
|
||||||
</a-form-item>
|
<div style="color: red; text-align: left">
|
||||||
</a-form>
|
注:自行招用单位备案证或保安许可证
|
||||||
</a-tab-pane>
|
</div>
|
||||||
<a-tab-pane key="2" tab="查询企业状态" >
|
</div>
|
||||||
<a-form
|
</a-form-item>
|
||||||
|
<a-form-item label="法人名称">
|
||||||
|
<a-input
|
||||||
|
:allowClear="true"
|
||||||
|
v-model:value="formDate.legalPersonInfo"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="法人手机号码">
|
||||||
|
<a-input
|
||||||
|
:allowClear="true"
|
||||||
|
v-model:value="formDate.telephone"
|
||||||
|
/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="详细地址">
|
||||||
|
<a-input :allowClear="true" v-model:value="formDate.address" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item :wrapper-col="{ offset: 8, span: 16 }">
|
||||||
|
<a-button type="primary" html-type="submit" style="width: 100px"
|
||||||
|
>确认</a-button
|
||||||
|
>
|
||||||
|
<a-button
|
||||||
|
style="width: 100px; margin-left: 10px"
|
||||||
|
@click="resetForm"
|
||||||
|
>重置表单</a-button
|
||||||
|
>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</a-tab-pane>
|
||||||
|
<a-tab-pane key="2" tab="查询企业状态">
|
||||||
|
<a-form
|
||||||
:label-col="labelCol"
|
:label-col="labelCol"
|
||||||
:wrapper-col="wrapperCol"
|
:wrapper-col="wrapperCol"
|
||||||
:model="statusDate"
|
:model="statusDate"
|
||||||
layout="horizontal">
|
layout="horizontal"
|
||||||
<a-form-item label="统一社会编码" name="onlyCode" :rules="[{ required: true, message: '请输入统一社会编码进行查询' }]">
|
>
|
||||||
<a-input :allowClear="true" v-model:value="statusDate.onlyCode"></a-input>
|
<a-form-item
|
||||||
</a-form-item>
|
label="统一社会编码"
|
||||||
<a-form-item :wrapper-col="{ offset: 8, span: 16 }">
|
name="onlyCode"
|
||||||
<a-button type="primary" html-type="submit" style="width: 100px" @click="getCheckStatus">确认</a-button>
|
:rules="[
|
||||||
</a-form-item>
|
{ required: true, message: '请输入统一社会编码进行查询' },
|
||||||
</a-form>
|
]"
|
||||||
</a-tab-pane></a-tabs>
|
>
|
||||||
|
<a-input
|
||||||
|
:allowClear="true"
|
||||||
|
v-model:value="statusDate.onlyCode"
|
||||||
|
></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item :wrapper-col="{ offset: 8, span: 16 }">
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
html-type="submit"
|
||||||
|
style="width: 100px"
|
||||||
|
@click="getCheckStatus"
|
||||||
|
>确认</a-button
|
||||||
|
>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</a-tab-pane></a-tabs
|
||||||
|
>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, onMounted,createVNode,h} from 'vue';
|
import { ref, onMounted, createVNode, h } from "vue";
|
||||||
import type { Rule } from 'ant-design-vue/es/form';
|
import type { Rule } from "ant-design-vue/es/form";
|
||||||
import type { ShowSearchType } from 'ant-design-vue/es/cascader';
|
import type { ShowSearchType } from "ant-design-vue/es/cascader";
|
||||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
import { ExclamationCircleOutlined } from "@ant-design/icons-vue";
|
||||||
import api from "@/axios";
|
import api from "@/axios";
|
||||||
import {CascaderProps, message, Modal} from 'ant-design-vue';
|
import { CascaderProps, message, Modal } from "ant-design-vue";
|
||||||
import SingleImageFileUpload from "@/components/upload/SingleImageFileUpload.vue";
|
import SingleImageFileUpload from "@/components/upload/SingleImageFileUpload.vue";
|
||||||
import {useRouter} from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import {formDatePort, statusPort} from "@/types/views/enterprise.ts";
|
import { formDatePort, statusPort } from "@/types/views/enterprise.ts";
|
||||||
const activeKey = ref('1');
|
const activeKey = ref("1");
|
||||||
const labelCol = { style: { width: '120px' } };
|
const labelCol = { style: { width: "120px" } };
|
||||||
const wrapperCol = { span: 14 };
|
const wrapperCol = { span: 14 };
|
||||||
const administrativeDivisionTree = ref<TreeNodeVo<string>[]>([])
|
const administrativeDivisionTree = ref<TreeNodeVo<string>[]>([]);
|
||||||
const formDateRef = ref();
|
const formDateRef = ref();
|
||||||
const fileUpload = ref()
|
const fileUpload = ref();
|
||||||
const router = useRouter()
|
const permitUpload = ref();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const formDate = ref<formDatePort>({
|
const formDate = ref<formDatePort>({
|
||||||
name:'',
|
name: "",
|
||||||
socialCode:'',
|
socialCode: "",
|
||||||
businessLicense:'',
|
businessLicense: "",
|
||||||
legalPersonInfo:'',
|
legalPersonInfo: "",
|
||||||
telephone:'',
|
telephone: "",
|
||||||
administrativeDivisionCodes:'',
|
administrativeDivisionCodes: "",
|
||||||
address:'',
|
address: "",
|
||||||
nature:''
|
nature: "",
|
||||||
})
|
securityServiceLicence: "",
|
||||||
const statusDate = ref<statusPort>({
|
});
|
||||||
onlyCode:'',
|
const statusDate = ref<statusPort>({
|
||||||
unitOptType:'SECURITY_UNIT'
|
onlyCode: "",
|
||||||
})
|
unitOptType: "SECURITY_UNIT",
|
||||||
|
});
|
||||||
const rules: Record<string, Rule[]> = {
|
const rules: Record<string, Rule[]> = {
|
||||||
name: [
|
name: [{ required: true, message: "请输入姓名", trigger: "change" }],
|
||||||
{ required: true, message: '请输入姓名', trigger: 'change' },
|
socialCode: [
|
||||||
|
{ required: true, message: "请输入社会编码", trigger: "change" },
|
||||||
],
|
],
|
||||||
socialCode:[
|
nature: [{ required: true, message: "请填写公司性质", trigger: "change" }],
|
||||||
{ required: true, message: '请输入社会编码', trigger: 'change' },
|
businessLicense: [
|
||||||
|
{ required: true, message: "请上传营业执照", trigger: "change" },
|
||||||
],
|
],
|
||||||
nature:[
|
securityServiceLicence: [
|
||||||
{ required: true, message: '请填写公司性质', trigger: 'change' },
|
{ required: true, message: "请上传备案证/许可证", trigger: "change" },
|
||||||
],
|
],
|
||||||
businessLicense:[
|
administrativeDivisionCodes: [
|
||||||
{ required: true, message: '请上传营业执照', trigger: 'change' },
|
{ required: true, message: "请选择行政区划", trigger: "change" },
|
||||||
],
|
],
|
||||||
administrativeDivisionCodes:[
|
|
||||||
{ required: true, message: '请选择行政区划', trigger: 'change' },
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 调用行政区划 1
|
// 调用行政区划 1
|
||||||
const DivisionTree = async ()=>{
|
const DivisionTree = async () => {
|
||||||
const resp = await api.get<TreeNodeVo<string>[]>('/common/administrativeDivisionByParentCode',{parentCode:'0'})
|
const resp = await api.get<TreeNodeVo<string>[]>(
|
||||||
administrativeDivisionTree.value = resp.data as TreeNodeVo<string>[]
|
"/common/administrativeDivisionByParentCode",
|
||||||
|
{ parentCode: "0" }
|
||||||
|
);
|
||||||
|
administrativeDivisionTree.value = resp.data as TreeNodeVo<string>[];
|
||||||
|
};
|
||||||
|
|
||||||
}
|
const loadData: CascaderProps["loadData"] = async (selectedOptions) => {
|
||||||
|
|
||||||
const loadData: CascaderProps['loadData'] = async selectedOptions => {
|
|
||||||
const targetOption = selectedOptions[selectedOptions.length - 1];
|
const targetOption = selectedOptions[selectedOptions.length - 1];
|
||||||
targetOption.loading = true;
|
targetOption.loading = true;
|
||||||
const resp = await api.get<TreeNodeVo<string>[]>('/common/administrativeDivisionByParentCode',{parentCode:targetOption.value})
|
const resp = await api.get<TreeNodeVo<string>[]>(
|
||||||
|
"/common/administrativeDivisionByParentCode",
|
||||||
|
{ parentCode: targetOption.value }
|
||||||
|
);
|
||||||
targetOption.loading = false;
|
targetOption.loading = false;
|
||||||
targetOption.children = [administrativeDivisionTree.value,...resp.data]
|
targetOption.children = [administrativeDivisionTree.value, ...resp.data];
|
||||||
};
|
};
|
||||||
// 回显数据
|
// 回显数据
|
||||||
const transformData = (val:any,tree:any)=>{
|
const transformData = (val: any, tree: any) => {
|
||||||
for(let i = 0; i< val.length - 1;i++){
|
for (let i = 0; i < val.length - 1; i++) {
|
||||||
tree.forEach(async(item:any)=>{
|
tree.forEach(async (item: any) => {
|
||||||
if(item.value === val[i]){
|
if (item.value === val[i]) {
|
||||||
item.children = []
|
item.children = [];
|
||||||
let data = await api.get<TreeNodeVo<string>[]>('/common/administrativeDivisionByParentCode',{parentCode:val[i]})
|
let data = await api.get<TreeNodeVo<string>[]>(
|
||||||
item.children = data.data.map((items:any)=>{
|
"/common/administrativeDivisionByParentCode",
|
||||||
|
{ parentCode: val[i] }
|
||||||
|
);
|
||||||
|
item.children = data.data.map((items: any) => {
|
||||||
return {
|
return {
|
||||||
label:items.label,
|
label: items.label,
|
||||||
value:items.value
|
value: items.value,
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
transformData(val,item.children)
|
transformData(val, item.children);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
// 可以进行搜索行政区划 2
|
// 可以进行搜索行政区划 2
|
||||||
const filter: ShowSearchType['filter'] = (inputValue, path) => {
|
const filter: ShowSearchType["filter"] = (inputValue, path) => {
|
||||||
return path?.some(option => option.label.toLowerCase().indexOf(inputValue?.toLowerCase()) > -1);
|
return path?.some(
|
||||||
|
(option) =>
|
||||||
|
option.label.toLowerCase().indexOf(inputValue?.toLowerCase()) > -1
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 搜索完成时回调
|
// 搜索完成时回调
|
||||||
const searchAdministrativeDivisionTree = (e:Array<string>)=>{
|
const searchAdministrativeDivisionTree = (e: Array<string>) => {
|
||||||
formDate.value.administrativeDivisionCodes = e as any
|
formDate.value.administrativeDivisionCodes = e as any;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 注册企业入驻
|
// 注册企业入驻
|
||||||
const onFinish = async ()=>{
|
const onFinish = async () => {
|
||||||
//校验表单
|
//校验表单
|
||||||
await formDateRef.value.validate()
|
await formDateRef.value.validate();
|
||||||
const legalPersonInfo = {
|
const legalPersonInfo = {
|
||||||
name:formDate.value.legalPersonInfo,
|
name: formDate.value.legalPersonInfo,
|
||||||
telephone:formDate.value.telephone
|
telephone: formDate.value.telephone,
|
||||||
}
|
};
|
||||||
const securityUnitRegisterParams = {
|
const securityUnitRegisterParams = {
|
||||||
name:formDate.value.name,
|
name: formDate.value.name,
|
||||||
socialCode:formDate.value.socialCode,
|
socialCode: formDate.value.socialCode,
|
||||||
businessLicense:formDate.value.businessLicense,
|
businessLicense: formDate.value.businessLicense,
|
||||||
legalPersonInfo:legalPersonInfo,
|
legalPersonInfo: legalPersonInfo,
|
||||||
nature:formDate.value.nature,
|
nature: formDate.value.nature,
|
||||||
administrativeDivisionCodes:formDate.value.administrativeDivisionCodes,
|
administrativeDivisionCodes: formDate.value.administrativeDivisionCodes,
|
||||||
address:formDate.value.address
|
address: formDate.value.address,
|
||||||
}
|
securityServiceLicence: formDate.value.securityServiceLicence,
|
||||||
const resp = await api.post('/common/securityUnitRegister',securityUnitRegisterParams)
|
};
|
||||||
message.success(resp.message)
|
const resp = await api.post(
|
||||||
fileUpload.value.fileDelete()
|
"/common/securityUnitRegister",
|
||||||
await resetForm()
|
securityUnitRegisterParams
|
||||||
}
|
);
|
||||||
|
message.success(resp.message);
|
||||||
|
fileUpload.value.fileDelete();
|
||||||
|
permitUpload.value.fileDelete();
|
||||||
|
await resetForm();
|
||||||
|
};
|
||||||
// 重置
|
// 重置
|
||||||
|
|
||||||
const resetForm = async ()=>{
|
const resetForm = async () => {
|
||||||
await formDateRef.value.resetFields()
|
await formDateRef.value.resetFields();
|
||||||
formDate.value = {
|
formDate.value = {
|
||||||
name:'',
|
name: "",
|
||||||
socialCode:'',
|
socialCode: "",
|
||||||
businessLicense:'',
|
businessLicense: "",
|
||||||
legalPersonInfo:'',
|
legalPersonInfo: "",
|
||||||
telephone:'',
|
telephone: "",
|
||||||
administrativeDivisionCodes:'',
|
administrativeDivisionCodes: "",
|
||||||
address:'',
|
address: "",
|
||||||
nature:''
|
nature: "",
|
||||||
}
|
securityServiceLicence: "",
|
||||||
fileUpload.value.fileDelete()
|
};
|
||||||
}
|
fileUpload.value.fileDelete();
|
||||||
|
permitUpload.value.fileDelete();
|
||||||
|
};
|
||||||
|
|
||||||
// 查询企业状态
|
// 查询企业状态
|
||||||
const getCheckStatus = async ()=>{
|
|
||||||
const indexCheckStatusParams = {
|
|
||||||
onlyCode:statusDate.value.onlyCode,
|
|
||||||
unitOptType:statusDate.value.unitOptType
|
|
||||||
}
|
|
||||||
const resp = await api.post<dataStatus>('/management/getCheckStatus',indexCheckStatusParams)
|
|
||||||
showConfirm(resp.data)
|
|
||||||
}
|
|
||||||
|
|
||||||
const showConfirm = (columnsDate:dataStatus) => {
|
const getCheckStatus = async () => {
|
||||||
if(columnsDate.checkStatus.value === 0){
|
const indexCheckStatusParams = {
|
||||||
|
onlyCode: statusDate.value.onlyCode,
|
||||||
|
unitOptType: statusDate.value.unitOptType,
|
||||||
|
};
|
||||||
|
const resp = await api.post<dataStatus>(
|
||||||
|
"/management/getCheckStatus",
|
||||||
|
indexCheckStatusParams
|
||||||
|
);
|
||||||
|
showConfirm(resp.data);
|
||||||
|
};
|
||||||
|
|
||||||
|
const showConfirm = (columnsDate: dataStatus) => {
|
||||||
|
if (columnsDate.checkStatus.value === 0) {
|
||||||
Modal.success({
|
Modal.success({
|
||||||
title: `审核通过`,
|
title: `审核通过`,
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
content: h('div', {}, [
|
content: h("div", {}, [
|
||||||
h('div', `账号:${columnsDate.account}`),
|
h("div", `账号:${columnsDate.account}`),
|
||||||
h('div', `密码:${columnsDate.password}`),
|
h("div", `密码:${columnsDate.password}`),
|
||||||
h('div', `${columnsDate.remark}`)
|
h("div", `${columnsDate.remark}`),
|
||||||
]),
|
]),
|
||||||
okText:'跳转',
|
okText: "跳转",
|
||||||
async onOk() {
|
async onOk() {
|
||||||
await router.push({
|
await router
|
||||||
path:'/login',
|
.push({
|
||||||
query:{
|
path: "/login",
|
||||||
account:columnsDate.account,
|
query: {
|
||||||
password:columnsDate.password
|
account: columnsDate.account,
|
||||||
}
|
password: columnsDate.password,
|
||||||
}).then(()=>{})
|
},
|
||||||
|
})
|
||||||
|
.then(() => {});
|
||||||
},
|
},
|
||||||
onCancel() {},
|
onCancel() {},
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
Modal.error({
|
Modal.error({
|
||||||
title: `未审核`,
|
title: `未审核`,
|
||||||
icon: createVNode(ExclamationCircleOutlined),
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
content:`${columnsDate.remark}`,
|
content: `${columnsDate.remark}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
onMounted( async ()=>{
|
onMounted(async () => {
|
||||||
await DivisionTree()
|
await DivisionTree();
|
||||||
await transformData(formDate.value.administrativeDivisionCodes,administrativeDivisionTree.value)
|
await transformData(
|
||||||
})
|
formDate.value.administrativeDivisionCodes,
|
||||||
|
administrativeDivisionTree.value
|
||||||
|
);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
@ok="submit"
|
@ok="submit"
|
||||||
@cancel="closeModal"
|
@cancel="closeModal"
|
||||||
>
|
>
|
||||||
<FormProMax ref="formRef" v-model:value="formParams" :form-item-options="formItemOptions"/>
|
<FormProMax ref="formRef" v-model:value="formParams" :form-item-options="formItemOptions">
|
||||||
|
</FormProMax>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@ import {FormExpose} from "ant-design-vue/es/form/Form";
|
||||||
import {FormProMaxItemOptions} from "@/types/components/form";
|
import {FormProMaxItemOptions} from "@/types/components/form";
|
||||||
import FormProMax from "@/components/form/FormProMax.vue";
|
import FormProMax from "@/components/form/FormProMax.vue";
|
||||||
import {message} from "ant-design-vue";
|
import {message} from "ant-design-vue";
|
||||||
|
import SingleImageFileUpload from "@/components/upload/SingleImageFileUpload.vue";
|
||||||
|
|
||||||
type TableProps = TableProMaxProps<serviceProjectSaveOrUpdateParams> //需要修改
|
type TableProps = TableProMaxProps<serviceProjectSaveOrUpdateParams> //需要修改
|
||||||
|
|
||||||
|
@ -85,6 +87,7 @@ const formParams = ref<{
|
||||||
outsourceName?:string,
|
outsourceName?:string,
|
||||||
isFiling:number,
|
isFiling:number,
|
||||||
idNumber?: string,
|
idNumber?: string,
|
||||||
|
securityServiceContract?:string,
|
||||||
serviceArea?:number,
|
serviceArea?:number,
|
||||||
buildingTotal?:number,
|
buildingTotal?:number,
|
||||||
houseTotal?:number,
|
houseTotal?:number,
|
||||||
|
@ -116,7 +119,6 @@ const columns: TableProps['columns'] = [
|
||||||
title: '企事业单位名称',
|
title: '企事业单位名称',
|
||||||
width: 150,
|
width: 150,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataIndex:'type',
|
dataIndex:'type',
|
||||||
|
@ -146,10 +148,19 @@ const columns: TableProps['columns'] = [
|
||||||
title: '保安服务许可证',
|
title: '保安服务许可证',
|
||||||
width:170
|
width:170
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
dataIndex:'securityServiceContract',
|
||||||
|
title:'保安服务合同',
|
||||||
|
width:200,
|
||||||
|
customRender({text}) {
|
||||||
|
return <a-image width={100} height={100} src={__APP_ENV.VITE_APP_MINIO_URL + text}></a-image>
|
||||||
|
},
|
||||||
|
ellipsis: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
dataIndex:'serviceArea',
|
dataIndex:'serviceArea',
|
||||||
title:'服务区域面积',
|
title:'服务区域面积',
|
||||||
width:120
|
width:120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
dataIndex:'buildingTotal',
|
dataIndex:'buildingTotal',
|
||||||
|
@ -225,6 +236,7 @@ const columns: TableProps['columns'] = [
|
||||||
formParams.value. securityUserTotal = record.securityUserTotal
|
formParams.value. securityUserTotal = record.securityUserTotal
|
||||||
formParams.value.enterprisesUnitId = record.enterprisesUnitName
|
formParams.value.enterprisesUnitId = record.enterprisesUnitName
|
||||||
formParams.value.administrativeDivisionCodes = record.enterprisesUnitAdministrativeDivisionCodes
|
formParams.value.administrativeDivisionCodes = record.enterprisesUnitAdministrativeDivisionCodes
|
||||||
|
formParams.value.securityServiceContract = record.securityServiceContract
|
||||||
|
|
||||||
}}>编辑</a-button>
|
}}>编辑</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
|
@ -347,10 +359,17 @@ const formItemOptions = ref<FormProMaxItemOptions<serviceProjectSaveOrUpdatePara
|
||||||
idNumber: {
|
idNumber: {
|
||||||
type: 'input',
|
type: 'input',
|
||||||
label: '保安服务许可证',
|
label: '保安服务许可证',
|
||||||
// componentsProps:{
|
|
||||||
// disabled:idNumberDisabled as any
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
|
securityServiceContract:{
|
||||||
|
type:'custom',
|
||||||
|
label: '保安服务合同',
|
||||||
|
required: true,
|
||||||
|
customRender: () =>
|
||||||
|
<div>
|
||||||
|
<SingleImageFileUpload height={200} v-model:value={formParams.value.securityServiceContract} />
|
||||||
|
<div class="securityServiceContract">注:(只需提供体现签订合同的单位和执行合同起止时间的页面即可)两张合在一起进行上传</div>
|
||||||
|
</div>
|
||||||
|
},
|
||||||
serviceArea:{
|
serviceArea:{
|
||||||
type:'inputNumber',
|
type:'inputNumber',
|
||||||
label:'服务区域面积',
|
label:'服务区域面积',
|
||||||
|
@ -359,7 +378,7 @@ const formItemOptions = ref<FormProMaxItemOptions<serviceProjectSaveOrUpdatePara
|
||||||
buildingTotal:{
|
buildingTotal:{
|
||||||
type:'inputNumber',
|
type:'inputNumber',
|
||||||
label:'楼栋数量',
|
label:'楼栋数量',
|
||||||
componentsProps:{
|
componentsProps:{
|
||||||
formatter:(value:any)=>{
|
formatter:(value:any)=>{
|
||||||
return Math.round(value)?Math.round(value):'' as any
|
return Math.round(value)?Math.round(value):'' as any
|
||||||
},
|
},
|
||||||
|
@ -432,6 +451,7 @@ const submit = async()=>{
|
||||||
staffTotal:formParams.value.staffTotal,
|
staffTotal:formParams.value.staffTotal,
|
||||||
securityUserTotal:formParams.value.securityUserTotal,
|
securityUserTotal:formParams.value.securityUserTotal,
|
||||||
remark: formParams.value.remark,
|
remark: formParams.value.remark,
|
||||||
|
securityServiceContract:formParams.value.securityServiceContract
|
||||||
}
|
}
|
||||||
const resp = await api.post('/m3/sp/add_upd',serviceProjectSaveOrUpdateParams)
|
const resp = await api.post('/m3/sp/add_upd',serviceProjectSaveOrUpdateParams)
|
||||||
message.success(resp.message)
|
message.success(resp.message)
|
||||||
|
@ -471,6 +491,8 @@ onMounted(async ()=>{
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style lang="scss">
|
||||||
|
.securityServiceContract{
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue