2023-07-16 19:14:41 +08:00
|
|
|
<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">
|
2023-07-16 22:44:02 +08:00
|
|
|
<el-input
|
|
|
|
class="w-[280px]"
|
|
|
|
v-model="queryParams.company_name"
|
|
|
|
clearable
|
|
|
|
placeholder="请输入公司名称"
|
|
|
|
/>
|
2023-07-16 19:14:41 +08:00
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="区" prop="area">
|
2023-07-16 22:44:02 +08:00
|
|
|
<el-input
|
|
|
|
class="w-[280px]"
|
|
|
|
v-model="queryParams.area"
|
|
|
|
clearable
|
|
|
|
placeholder="请输入区"
|
|
|
|
/>
|
2023-07-16 19:14:41 +08:00
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="镇" prop="street">
|
2023-07-16 22:44:02 +08:00
|
|
|
<el-input
|
|
|
|
class="w-[280px]"
|
|
|
|
v-model="queryParams.street"
|
|
|
|
clearable
|
|
|
|
placeholder="请输入镇"
|
|
|
|
/>
|
2023-07-16 19:14:41 +08:00
|
|
|
</el-form-item>
|
2023-07-17 18:07:40 +08:00
|
|
|
<!-- <el-form-item label="公司类型" prop="company_type">
|
2023-07-16 22:44:02 +08:00
|
|
|
<el-input
|
|
|
|
class="w-[280px]"
|
|
|
|
v-model="queryParams.company_type"
|
|
|
|
clearable
|
|
|
|
placeholder="请输入公司类型"
|
|
|
|
/>
|
2023-07-17 18:07:40 +08:00
|
|
|
</el-form-item> -->
|
|
|
|
|
|
|
|
<el-form-item label="公司类型" prop="company_type">
|
|
|
|
<el-select
|
|
|
|
v-model="queryParams.company_type"
|
|
|
|
placeholder="请选择公司类型"
|
|
|
|
clearable
|
|
|
|
:style="{ width: '100%' }"
|
|
|
|
>
|
|
|
|
<el-option
|
|
|
|
v-for="(item, index) in datas.dictTypeLists"
|
|
|
|
:key="index"
|
|
|
|
:label="item.name"
|
|
|
|
:value="item.id"
|
|
|
|
></el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
2023-07-16 19:14:41 +08:00
|
|
|
<el-form-item label="片区经理" prop="area_manager">
|
2023-07-16 22:44:02 +08:00
|
|
|
<el-input
|
|
|
|
class="w-[280px]"
|
|
|
|
v-model="queryParams.area_manager"
|
|
|
|
clearable
|
|
|
|
placeholder="请输入片区经理"
|
|
|
|
/>
|
2023-07-16 19:14:41 +08:00
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="是否签约" prop="is_contract">
|
2023-07-17 18:07:40 +08:00
|
|
|
<el-select
|
|
|
|
v-model="queryParams.is_contract"
|
|
|
|
placeholder="是否签约"
|
|
|
|
clearable
|
|
|
|
:style="{ width: '100%' }"
|
|
|
|
>
|
|
|
|
<el-option
|
|
|
|
label="已签约"
|
|
|
|
value="1"
|
|
|
|
></el-option>
|
|
|
|
<el-option
|
|
|
|
label="未签约"
|
|
|
|
value="0"
|
|
|
|
></el-option>
|
|
|
|
</el-select>
|
2023-07-16 19:14:41 +08:00
|
|
|
</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/add']" type="primary" @click="handleAdd">
|
|
|
|
<template #icon>
|
|
|
|
<icon name="el-icon-Plus" />
|
|
|
|
</template>
|
|
|
|
新增
|
|
|
|
</el-button> -->
|
2023-07-16 22:44:02 +08:00
|
|
|
<router-link
|
|
|
|
v-perms="['company/add', 'company/edit']"
|
|
|
|
:to="{
|
|
|
|
path: getRoutePath('company/add:edit')
|
|
|
|
}"
|
|
|
|
>
|
2023-07-16 19:14:41 +08:00
|
|
|
<el-button type="primary" class="mb-4">
|
|
|
|
<template #icon>
|
|
|
|
<icon name="el-icon-Plus" />
|
|
|
|
</template>
|
2023-07-17 18:07:40 +08:00
|
|
|
创建
|
2023-07-16 19:14:41 +08:00
|
|
|
</el-button>
|
2023-07-17 18:07:40 +08:00
|
|
|
</router-link>
|
2023-07-16 19:14:41 +08:00
|
|
|
<div class="mt-4">
|
|
|
|
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
2023-07-16 22:44:02 +08:00
|
|
|
<el-table-column label="id" prop="id" show-overflow-tooltip />
|
2023-07-16 19:14:41 +08:00
|
|
|
<el-table-column label="查看成员" prop="company_name" show-overflow-tooltip />
|
|
|
|
<el-table-column label="签约公司" prop="company_name" show-overflow-tooltip />
|
|
|
|
<el-table-column label="公司类型" prop="company_type" show-overflow-tooltip />
|
|
|
|
<el-table-column label="区县" prop="area" show-overflow-tooltip />
|
|
|
|
<el-table-column label="乡镇" prop="street" show-overflow-tooltip />
|
|
|
|
<el-table-column label="主联系人" prop="master_name" show-overflow-tooltip />
|
|
|
|
<el-table-column label="联系方式" prop="master_phone" show-overflow-tooltip />
|
|
|
|
<el-table-column label="片区经理" prop="area_manager" show-overflow-tooltip />
|
|
|
|
<el-table-column label="是否签约" prop="is_contract" show-overflow-tooltip />
|
2023-07-17 18:07:40 +08:00
|
|
|
<el-table-column label="操作" width="140" fixed="right">
|
2023-07-16 19:14:41 +08:00
|
|
|
<template #default="{ row }">
|
2023-07-17 18:07:40 +08:00
|
|
|
<div style="display:flex;">
|
|
|
|
<el-button
|
|
|
|
v-perms="['company/edit', 'company/add']"
|
|
|
|
type="primary"
|
|
|
|
link>
|
|
|
|
<router-link
|
|
|
|
:to="{
|
|
|
|
path: getRoutePath('company/add:edit'),
|
|
|
|
query: {
|
|
|
|
id: row.id,
|
|
|
|
read:true
|
|
|
|
}
|
|
|
|
}"
|
|
|
|
> 查看</router-link>
|
|
|
|
</el-button>
|
2023-07-16 22:44:02 +08:00
|
|
|
<el-button
|
|
|
|
v-perms="['company/edit', 'company/add']"
|
|
|
|
type="primary"
|
|
|
|
link
|
|
|
|
>
|
|
|
|
<router-link
|
|
|
|
:to="{
|
|
|
|
path: getRoutePath('company/add:edit'),
|
|
|
|
query: {
|
|
|
|
id: row.id
|
|
|
|
}
|
|
|
|
}"
|
|
|
|
>
|
|
|
|
编辑
|
|
|
|
</router-link>
|
2023-07-16 19:14:41 +08:00
|
|
|
</el-button>
|
2023-07-16 22:44:02 +08:00
|
|
|
<el-button
|
|
|
|
v-perms="['company/delete']"
|
|
|
|
type="danger"
|
|
|
|
link
|
|
|
|
@click="handleDelete(row.id)"
|
|
|
|
>
|
2023-07-16 19:14:41 +08:00
|
|
|
删除
|
|
|
|
</el-button>
|
2023-07-17 18:07:40 +08:00
|
|
|
</div>
|
|
|
|
|
2023-07-16 19:14:41 +08:00
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
</div>
|
|
|
|
<div class="flex mt-4 justify-end">
|
|
|
|
<pagination v-model="pager" @change="getLists" />
|
|
|
|
</div>
|
|
|
|
</el-card>
|
2023-07-16 22:44:02 +08:00
|
|
|
<edit-popup
|
|
|
|
v-if="showEdit"
|
|
|
|
ref="editRef"
|
|
|
|
:dict-data="dictData"
|
|
|
|
@success="getLists"
|
|
|
|
@close="showEdit = false"
|
|
|
|
/>
|
2023-07-16 19:14:41 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup name="companyLists">
|
|
|
|
import { usePaging } from '@/hooks/usePaging'
|
|
|
|
import { useDictData } from '@/hooks/useDictOptions'
|
|
|
|
import { apiCompanyLists, apiCompanyDelete } from '@/api/company'
|
|
|
|
import { timeFormat } from '@/utils/util'
|
|
|
|
import feedback from '@/utils/feedback'
|
2023-07-17 18:07:40 +08:00
|
|
|
import { dictDataLists } from '@/api/setting/dict'
|
2023-07-16 19:14:41 +08:00
|
|
|
import EditPopup from './edit.vue'
|
|
|
|
import { getRoutePath } from '@/router'
|
|
|
|
|
|
|
|
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
|
|
|
// 是否显示编辑框
|
|
|
|
const showEdit = ref(false)
|
|
|
|
|
|
|
|
// 查询条件
|
|
|
|
const queryParams = reactive({
|
|
|
|
level_two: '',
|
|
|
|
level_one: '',
|
|
|
|
company_name: '',
|
|
|
|
organization_code: '',
|
|
|
|
city: '',
|
|
|
|
area: '',
|
|
|
|
street: '',
|
|
|
|
company_type: '',
|
|
|
|
master_name: '',
|
|
|
|
master_position: '',
|
|
|
|
master_phone: '',
|
|
|
|
master_email: '',
|
|
|
|
other_contacts: '',
|
|
|
|
area_manager: '',
|
2023-07-17 18:07:40 +08:00
|
|
|
// 是否签约
|
2023-07-16 19:14:41 +08:00
|
|
|
is_contract: '',
|
|
|
|
account: '',
|
|
|
|
password: '',
|
|
|
|
deposit: '',
|
|
|
|
deposit_time: '',
|
|
|
|
qualification: '',
|
|
|
|
status: ''
|
|
|
|
})
|
2023-07-17 18:07:40 +08:00
|
|
|
const datas = reactive({
|
|
|
|
dictTypeLists: [],
|
2023-07-16 19:14:41 +08:00
|
|
|
|
2023-07-17 18:07:40 +08:00
|
|
|
})
|
|
|
|
const getdictTypeLists = async () => {
|
|
|
|
const data = await dictDataLists({ type_id: 6 })
|
|
|
|
datas['dictTypeLists'] = data['lists']
|
|
|
|
}
|
|
|
|
getdictTypeLists()
|
2023-07-16 19:14:41 +08:00
|
|
|
// 选中数据
|
|
|
|
const selectData = ref<any[]>([])
|
|
|
|
|
|
|
|
// 表格选择后回调事件
|
|
|
|
const handleSelectionChange = (val: any[]) => {
|
|
|
|
selectData.value = val.map(({ id }) => id)
|
|
|
|
}
|
|
|
|
|
|
|
|
// 获取字典数据
|
|
|
|
const { dictData } = useDictData('')
|
|
|
|
|
|
|
|
// 分页相关
|
|
|
|
const { pager, getLists, resetParams, resetPage } = usePaging({
|
|
|
|
fetchFun: apiCompanyLists,
|
|
|
|
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 apiCompanyDelete({ id })
|
|
|
|
getLists()
|
|
|
|
}
|
|
|
|
|
|
|
|
getLists()
|
|
|
|
</script>
|
2023-07-17 18:07:40 +08:00
|
|
|
<style lang="scss">
|
|
|
|
.btn{
|
|
|
|
position: absolute;
|
|
|
|
|
|
|
|
}
|
|
|
|
</style>
|