This commit is contained in:
mkm 2023-07-21 18:11:52 +08:00
parent 229472779b
commit 806061cbbc
2 changed files with 85 additions and 84 deletions

View File

@ -1,6 +1,5 @@
<template>
<div class="edit-popup">
<!-- <popup ref="popupRef" :title="popupTitle" :async="true" width="70%" @confirm="handleSubmit" @close="handleClose"> -->
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
<div style="font-size: 1.2rem; margin: 10px 0">公司基本信息创建</div>
<el-col :span="24" class="el-card pt-6">
@ -181,18 +180,30 @@
></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="选择人员" prop="man">
<el-col :span="12">
<el-form-item label="管理人员" prop="admin_name">
<el-input
:disabled="isDisabled"
v-model="formData.man"
placeholder="请选择人员"
v-model="formData.admin_name"
placeholder="设置当前公司管理人员"
clearable
:style="{ width: '100%' }"
@click="isMan = true"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="片区经理" prop="area_manager_name">
<el-input
:disabled="isDisabled"
v-model="formData.area_manager_name"
placeholder="选择片区经理"
clearable
:style="{ width: '100%' }"
@click="isAreaManager = true"
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-col>
<div style="font-size: 1.2rem; margin: 10px 0">其他联系人</div>
@ -266,12 +277,11 @@
<el-upload
:disabled="isDisabled"
v-model="formData.qualification.business_license"
class="avatar-uploader"
class="avatar-uploader pl-3"
:data="{ cid: 1 }"
action="https://worker-task.lihaink.cn/api/upload/image"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
>
<img
v-if="formData.qualification.business_license"
@ -285,7 +295,7 @@
<el-upload
:disabled="isDisabled"
v-model="formData.qualification.business_licenseB"
class="avatar-uploader"
class="avatar-uploader pl-3"
:data="{ cid: 1 }"
action="https://worker-task.lihaink.cn/api/upload/image"
:show-file-list="false"
@ -307,12 +317,11 @@
<el-upload
:disabled="isDisabled"
v-model="formData.qualification.bank_account"
class="avatar-uploader"
class="avatar-uploader pl-3"
:data="{ cid: 1 }"
action="https://worker-task.lihaink.cn/api/upload/image"
:show-file-list="false"
:on-success="handleAvatarSuccess_two"
:before-upload="beforeAvatarUpload_two"
>
<img
v-if="formData.qualification.bank_account"
@ -326,12 +335,11 @@
<el-upload
:disabled="isDisabled"
v-model="formData.qualification.bank_accountB"
class="avatar-uploader"
class="avatar-uploader pl-3"
:data="{ cid: 1 }"
action="https://worker-task.lihaink.cn/api/upload/image"
:show-file-list="false"
:on-success="handleAvatarSuccess_twoB"
:before-upload="beforeAvatarUpload_two"
>
<img
v-if="formData.qualification.bank_accountB"
@ -346,19 +354,19 @@
</el-col>
</el-row>
</el-col>
<template v-if="userStore.userInfo.root == 1">
<template v-if="userStore.userInfo.root == 0">
<div style="font-size: 1.2rem; margin: 10px 0">电子合同</div>
<el-col :span="24" class="el-card pt-6">
<el-row>
<el-col :span="12">
<el-form-item label="签约方" prop="field130">
<el-input
:disabled="isDisabled"
v-model="formData.party_a_name"
placeholder="请选择签约方"
clearable
:style="{ width: '100%' }"
@click="openCompany"
:disabled="userStore.userInfo.root == 0 ? true : false"
></el-input>
</el-form-item>
</el-col>
@ -396,6 +404,7 @@
<el-form-item label-width="100px" label="合同编号" prop="field133">
<el-input
placeholder="系统自动生成"
v-model="formData.contract.contract_no"
clearable
:style="{ width: '100%' }"
:disabled="true"
@ -408,25 +417,15 @@
<el-row>
<el-col :span="24">
<el-form-item label="合同上传" required>
<!-- <el-upload
:disabled="isDisabled"
class="avatar-uploader"
v-model="formData.contract.file"
action="https://worker-task.lihaink.cn/api/upload/image"
:show-file-list="false"
:on-success="handleAvatarSuccess"
>
<el-button size="small" :disabled="isDisabled" type="primary">点击上传</el-button>
</el-upload>-->
<el-upload
:disabled="isDisabled"
v-model="formData.contract.file"
v-model:file-list="fileList"
:headers="{ Token: userStore.token }"
class="upload-demo"
action="https://worker-task.lihaink.cn/adminapi/upload/file"
multiple
:limit="1"
:on-success="handleAvatarSuccess_three"
>
<el-button :disabled="isDisabled" type="primary"
>上传</el-button
@ -437,6 +436,7 @@
</el-row>
</el-col>
</template>
<el-col :span="24" class="el-card pt-6">
<el-form-item label prop="field139">
<el-button v-if="isEdit" type="primary" size="medium" @click="create"
@ -456,9 +456,12 @@
<el-dialog v-model="isCompany" title="选择签约方" width="60%">
<DialogIndex @customEvent="customEvent" />
</el-dialog>
<el-dialog v-model="isMan" title="选择人员" width="60%">
<el-dialog v-model="isMan" title="选择管理人员" width="60%">
<DialogIndexMan @customEvent="customEventMan" />
</el-dialog>
<el-dialog v-model="isAreaManager" title="选择片区经理" width="60%">
<DialogIndexMan @customEvent="EventAreaManager" />
</el-dialog>
</div>
</template>
@ -475,6 +478,7 @@ import type { PropType } from 'vue'
import useMultipleTabs from '@/hooks/useMultipleTabs'
import useUserStore from '@/stores/modules/user'
const userStore = useUserStore()
const { removeTab } = useMultipleTabs()
const router = useRouter()
const route = useRoute()
@ -492,10 +496,12 @@ const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref()
isDisabled = route.query.read
isEdit = route.query.edit
//
const formData = reactive({
man: '',
admin_id: '',
admin_name: '',
area_manager: '',
area_manager_name: '',
id: '',
// level_two: '',
// level_one: '',
@ -511,7 +517,6 @@ const formData = reactive({
master_position: '',
master_phone: '',
master_email: '',
other_contacts: [
{
name: '',
@ -534,7 +539,7 @@ const formData = reactive({
},
contract: {
contract_type: '',
party_a: '',
party_a: 0,
file: '',
contract_no: '系统自动生成'
},
@ -543,6 +548,11 @@ const formData = reactive({
file_image: ''
// status: ''
})
if (userStore.userInfo.root == 0) {
formData.contract.party_a = userStore.userInfo.company?.id
formData.party_a_name = userStore.userInfo.company?.company_name
}
const datas = reactive({
provinceOptions: [],
cityOptions: [],
@ -551,6 +561,12 @@ const datas = reactive({
dictTypeLists: [],
contract_type: []
})
const fileList = ref<UploadUserFile[]>([
{
name: '',
url: ''
}
])
//
const formRules = reactive<any>({
company_name: [
@ -612,6 +628,7 @@ const formRules = reactive<any>({
})
const isCompany = ref(false)
const isMan = ref(false)
const isAreaManager = ref(false)
function customEvent(data: any) {
isCompany.value = false
@ -620,9 +637,14 @@ function customEvent(data: any) {
}
function customEventMan(data: any) {
isMan.value = false
console.log(data)
// formData.contract.party_a = data.id;
formData.man = data.name
formData.admin_name = data.name
formData.admin_id = data.id
}
//
function EventAreaManager(data: any) {
isAreaManager.value = false
formData.area_manager_name = data.name
formData.area_manager = data.id
}
function openCompany() {
isCompany.value = true
@ -647,55 +669,46 @@ const getDetail = async (row: Record<string, any>) => {
//1
const handleAvatarSuccess: UploadProps['onSuccess'] = (response, uploadFile) => {
if (response.code == 0) {
ElMessage.error(response.msg)
return
}
formData.qualification.business_license = response.data.uri
}
const handleAvatarSuccessB: UploadProps['onSuccess'] = (response, uploadFile) => {
if (response.code == 0) {
ElMessage.error(response.msg)
return
}
formData.qualification.business_licenseB = response.data.uri
}
const beforeAvatarUpload: UploadProps['beforeUpload'] = (rawFile) => {
// if (rawFile.type !== 'image/jpeg') {
// ElMessage.error('Avatar picture must be JPG format!')
// return false
// } else if (rawFile.size / 1024 / 1024 > 2) {
// ElMessage.error('Avatar picture size can not exceed 2MB!')
// return false
// }
return true
}
//2
const handleAvatarSuccess_two: UploadProps['onSuccess'] = (response, uploadFile) => {
if (response.code == 0) {
ElMessage.error(response.msg)
return
}
formData.qualification.bank_account = response.data.uri
}
const handleAvatarSuccess_twoB: UploadProps['onSuccess'] = (response, uploadFile) => {
if (response.code == 0) {
ElMessage.error(response.msg)
return
}
formData.qualification.bank_accountB = response.data.uri
}
const beforeAvatarUpload_two: UploadProps['beforeUpload'] = (rawFile) => {
// if (rawFile.type !== 'image/jpeg') {
// ElMessage.error('Avatar picture must be JPG format!')
// return false
// } else if (rawFile.size / 1024 / 1024 > 2) {
// ElMessage.error('Avatar picture size can not exceed 2MB!')
// return false
// }
return true
}
//3
const handleAvatarSuccess_three: UploadProps['onSuccess'] = (response, uploadFile) => {
if (response.code == 0) {
ElMessage.error(response.msg)
return
}
formData.file_image = response.data.uri
formData.contract.file = response.data.uri
fileList.value[0].url = response.data.uri
fileList.value[0].name = '合同文件'
}
const beforeAvatarUpload_three: UploadProps['beforeUpload'] = (rawFile) => {
// if (rawFile.type !== 'application/msword') {
// ElMessage.error('word!')
// return false
// }
// else if (rawFile.size / 1024 / 1024 > 2) {
// ElMessage.error('Avatar picture size can not exceed 2MB!')
// return false
// }
return true
}
//
function other() {
formData.other_contacts.push({
@ -762,6 +775,8 @@ const getDetails = async () => {
})
formData['party_a_name'] = data['contract']['party_a_name']
formData['file_image'] = data['contract']['file']
fileList.value[0].url = data['contract']['file']
fileList.value[0].name = '合同文件'
}
getProvinceList()
getdictTypeLists()

View File

@ -67,14 +67,8 @@
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<!-- <el-button v-perms="['company/add']" type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>-->
<router-link
v-perms="['company/add', 'company/edit']"
v-perms="['company/add:edit']"
:to="{
path: getRoutePath('company/add:edit')
}"
@ -124,11 +118,7 @@
>下属公司</router-link
>
</el-button>
<el-button
v-perms="['company/edit', 'company/add']"
type="primary"
link
>
<el-button v-perms="['company/add:edit']" type="primary" link>
<router-link
:to="{
path: getRoutePath('company/add:edit'),
@ -140,11 +130,7 @@
>详情</router-link
>
</el-button>
<el-button
v-perms="['company/edit', 'company/add']"
type="primary"
link
>
<el-button v-perms="['company/add:edit']" type="primary" link>
<router-link
:to="{
path: getRoutePath('company/add:edit'),
@ -164,14 +150,14 @@
>删除</el-button
>
<el-button
v-perms="['company/edit', 'company/add']"
v-perms="['company/Draftingcontracts']"
type="primary"
link
@click="showCreateConctPop(row)"
>生成合同</el-button
>
<el-button
v-perms="['company/edit', 'company/add']"
v-perms="['company/postsms']"
type="primary"
link
@click=";(showPop = true), (contractId = row.id)"