Merge branch 'master' into feature

This commit is contained in:
weipengfei 2023-09-15 10:53:25 +08:00
commit 0f85ffa810
5 changed files with 419 additions and 53 deletions

26
src/api/company_form.ts Normal file
View File

@ -0,0 +1,26 @@
import request from '@/utils/request'
// 公司认证表格列表
export function apiCompanyFormLists(params: any) {
return request.get({ url: '/company_form/lists', params })
}
// 添加公司认证表格
export function apiCompanyFormAdd(params: any) {
return request.post({ url: '/company_form/add', params })
}
// 编辑公司认证表格
export function apiCompanyFormEdit(params: any) {
return request.post({ url: '/company_form/edit', params })
}
// 删除公司认证表格
export function apiCompanyFormDelete(params: any) {
return request.post({ url: '/company_form/delete', params })
}
// 公司认证表格详情
export function apiCompanyFormDetail(params: any) {
return request.get({ url: '/company_form/detail', params })
}

View File

@ -0,0 +1,133 @@
<template>
<div class="edit-popup">
<popup
ref="popupRef"
:title="popupTitle"
:async="true"
width="550px"
@confirm="handleSubmit"
@close="handleClose"
>
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
<el-form-item label="" prop="company_name">
<el-input v-model="formData.company_name" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="" prop="organization_code">
<el-input v-model="formData.organization_code" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="" prop="address">
<el-input v-model="formData.address" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="" prop="master_name">
<el-input v-model="formData.master_name" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="" prop="type">
<el-input v-model="formData.type" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="" prop="master_email">
<el-input v-model="formData.master_email" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="" prop="notes">
<el-input v-model="formData.notes" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="" prop="type_two">
<el-input v-model="formData.type_two" clearable placeholder="请输入" />
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="companyFormEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiCompanyFormAdd, apiCompanyFormEdit, apiCompanyFormDetail } from '@/api/company_form'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
//
const popupTitle = computed(() => {
return mode.value == 'edit' ? '编辑公司认证表格' : '新增公司认证表格'
})
//
const formData = reactive({
id: '',
company_name: '',
organization_code: '',
address: '',
master_name: '',
type: '',
master_email: '',
notes: '',
type_two: '',
})
//
const formRules = reactive<any>({
})
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiCompanyFormDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
? await apiCompanyFormEdit(data)
: await apiCompanyFormAdd(data)
popupRef.value?.close()
emit('success')
}
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -0,0 +1,160 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form
class="mb-[-16px]"
:model="queryParams"
inline
>
<el-form-item label="" prop="company_name">
<el-input class="w-[280px]" v-model="queryParams.company_name" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="" prop="organization_code">
<el-input class="w-[280px]" v-model="queryParams.organization_code" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="" prop="address">
<el-input class="w-[280px]" v-model="queryParams.address" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="" prop="master_name">
<el-input class="w-[280px]" v-model="queryParams.master_name" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="" prop="type">
<el-input class="w-[280px]" v-model="queryParams.type" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="" prop="master_email">
<el-input class="w-[280px]" v-model="queryParams.master_email" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="" prop="notes">
<el-input class="w-[280px]" v-model="queryParams.notes" clearable placeholder="请输入" />
</el-form-item>
<el-form-item label="" prop="type_two">
<el-input class="w-[280px]" v-model="queryParams.type_two" clearable placeholder="请输入" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-button v-perms="['company_form/add']" type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<el-button
v-perms="['company_form/delete']"
:disabled="!selectData.length"
@click="handleDelete(selectData)"
>
删除
</el-button>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="" prop="company_name" show-overflow-tooltip />
<el-table-column label="" prop="organization_code" show-overflow-tooltip />
<el-table-column label="" prop="address" show-overflow-tooltip />
<el-table-column label="" prop="master_name" show-overflow-tooltip />
<el-table-column label="" prop="type" show-overflow-tooltip />
<el-table-column label="" prop="master_email" show-overflow-tooltip />
<el-table-column label="" prop="notes" show-overflow-tooltip />
<el-table-column label="" prop="type_two" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['company_form/edit']"
type="primary"
link
@click="handleEdit(row)"
>
编辑
</el-button>
<el-button
v-perms="['company_form/delete']"
type="danger"
link
@click="handleDelete(row.id)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
</div>
</template>
<script lang="ts" setup name="companyFormLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiCompanyFormLists, apiCompanyFormDelete } from '@/api/company_form'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import EditPopup from './edit.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
//
const queryParams = reactive({
company_name: '',
organization_code: '',
address: '',
master_name: '',
type: '',
master_email: '',
notes: '',
type_two: ''
})
//
const selectData = ref<any[]>([])
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id)
}
//
const { dictData } = useDictData('')
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiCompanyFormLists,
params: queryParams
})
//
const handleAdd = async () => {
showEdit.value = true
await nextTick()
editRef.value?.open('add')
}
//
const handleEdit = async (data: any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
}
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?')
await apiCompanyFormDelete({ id })
getLists()
}
getLists()
</script>

View File

@ -7,6 +7,8 @@
width="800px"
@confirm="handleSubmit"
@close="handleClose"
:button="mode == 'edit'"
:clickModalClose="mode == 'details'"
>
<el-form
ref="formRef"
@ -14,54 +16,75 @@
:rules="formRules"
label-width="120px"
>
<el-col>
<el-row>
<el-col :span="12">
<el-form-item label="ID" prop="id">
<el-input readonly v-model="formData.id" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="任务名称" prop="name">
<el-input readonly v-model="formData.name" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="任务金额" prop="flow_cate">
<el-input readonly v-model="formData.flow_cate" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属公司" prop="name">
<el-input readonly v-model="formData.name" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="任务描述" prop="remark">
<el-input
readonly
v-model="formData.remark"
clearable
type="textarea"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="任务完成时间" prop="id">
<el-input readonly v-model="formData.id" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="片区经理" prop="flow_cate">
<el-input readonly v-model="formData.flow_cate" />
</el-form-item>
</el-col>
</el-row>
</el-col>
<el-row>
<el-col :span="12">
<el-form-item label="ID" prop="id">
<el-input readonly v-model="formData.id" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="任务名称" prop="name">
<el-input readonly v-model="formData.name" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="任务金额" prop="flow_cate">
<el-input readonly v-model="formData.flow_cate" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属公司" prop="name">
<el-input readonly v-model="formData.name" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="任务描述" prop="remark">
<el-input
readonly
v-model="formData.remark"
clearable
type="textarea"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="任务完成时间" prop="id">
<el-input readonly v-model="formData.id" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="片区经理" prop="flow_cate">
<el-input readonly v-model="formData.flow_cate" />
</el-form-item>
</el-col>
</el-row>
<el-divider />
<el-row>
<el-col :span="24">
<el-form-item label="详情描述" prop="remark">
<el-input
readonly
v-model="formData.remark"
clearable
type="textarea"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="附件" prop="flow_cate">
<el-image
class="attachment"
v-for="(item, index) in 5"
:key="index"
src=""
:preview-src-list="[]"
:initial-index="index"
fit="cover"
></el-image>
</el-form-item>
</el-col>
</el-row>
<el-divider />
<el-col :span="24">
<el-form-item label="">
<el-timeline>
@ -84,7 +107,10 @@
clearable
:style="{ width: '100%' }"
>
<el-radio-group v-model="formData.flow_detail.type">
<el-radio-group
:disabled="mode == 'details'"
v-model="formData.flow_detail.type"
>
<el-radio :label="1">通过</el-radio>
<el-radio :label="2">驳回</el-radio>
</el-radio-group>
@ -93,7 +119,12 @@
<el-row>
<el-col>
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" clearable type="textarea" />
<el-input
:readonly="mode == 'details'"
v-model="formData.remark"
clearable
type="textarea"
/>
</el-form-item>
</el-col>
</el-row>
@ -122,7 +153,7 @@ const mode = ref("add");
//
const popupTitle = computed(() => {
return mode.value == "edit" ? "审核" : "新增";
return mode.value == "edit" ? "审核" : "详情";
});
const activities = ref([
@ -211,4 +242,11 @@ defineExpose({
:deep(.el-timeline-item__wrapper) {
top: -8px !important;
}
.attachment {
width: 150px;
height: 150px;
/* background-color: red; */
margin-right: 10px;
margin-bottom: 10px;
}
</style>

View File

@ -72,10 +72,19 @@
v-perms="['flow/edit']"
type="primary"
link
v-if="row.status == 0"
@click="handleEdit(row)"
>
审核
</el-button>
<el-button
type="primary"
link
v-else
@click="handleEdit(row, 'details')"
>
详情
</el-button>
<!-- <el-button
v-perms="['flow/delete']"
type="danger"
@ -154,10 +163,10 @@ const handleAdd = async () => {
};
//
const handleEdit = async (data: any) => {
const handleEdit = async (data: any, type = "edit") => {
showEdit.value = true;
await nextTick();
editRef.value?.open("edit");
editRef.value?.open(type);
editRef.value?.setFormData(data);
};
//