crm:增加合同 List 组件

This commit is contained in:
YunaiV
2023-11-30 19:12:57 +08:00
parent 5f26c4afe9
commit 31a42fc3f7
11 changed files with 171 additions and 332 deletions

View File

@ -1,7 +1,7 @@
<template>
<!-- 操作栏 -->
<el-row justify="end">
<el-button>
<el-button @click="openForm">
<Icon class="mr-5px" icon="system-uicons:contacts" />
创建联系人
</el-button>
@ -25,26 +25,6 @@
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.master" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" fixed="right" width="200">
<template #default="scope">
<el-button
plain
type="primary"
@click="openForm('update', scope.row.id)"
v-hasPermi="['crm:contact:update']"
>
编辑
</el-button>
<el-button
plain
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['crm:contact:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
@ -55,7 +35,7 @@
/>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<!-- 表单弹窗添加 -->
<ContactForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
@ -70,9 +50,6 @@ const props = defineProps<{
bizId: number // 业务编号
}>()
const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化
const loading = ref(true) // 列表的加载中
const total = ref(0) // 列表的总页数
const list = ref([]) // 列表的数据
@ -111,26 +88,13 @@ const handleQuery = () => {
getList()
}
/** 添加/修改操作 */
/** 添加操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
const openForm = () => {
formRef.value.open('create')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
// 删除的二次确认
await message.delConfirm()
// 发起删除
await ContactApi.deleteContact(id)
message.success(t('common.delSuccess'))
// 刷新列表
await getList()
} catch {}
}
/** 打开客户详情 */
/** 打开联系人详情 */
const { push } = useRouter()
const openDetail = (id: number) => {
push({ name: 'CrmContactDetail', params: { id } })