Files
ss-crm-manage-web/src/views/MiniMall/MallSet/Comp/SupplierSet.vue

114 lines
2.8 KiB
Vue
Raw Normal View History

2024-05-27 12:07:13 +08:00
<template>
<div>
<el-form ref="queryForm" :model="searchForm" label-width="0" inline>
<el-form-item>
<el-input
v-model="searchForm.name"
placeholder="请输入名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery">搜索</el-button>
<el-button @click="resetQuery">重置</el-button>
<el-button type="primary" @click="openForm('create', null)">新增</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="tableList">
2024-06-05 17:08:27 +08:00
<el-table-column prop="label" label="供应商名称" />
2024-10-25 10:27:36 +08:00
<!-- <el-table-column prop="" label="微信群名称" /> -->
2024-06-05 17:08:27 +08:00
<el-table-column prop="sort" label="排序" width="100px" />
2024-05-27 12:07:13 +08:00
<el-table-column prop="remark" label="备注" />
2024-06-05 17:08:27 +08:00
<el-table-column
label="创建时间"
prop="createTime"
width="180px"
:formatter="dateFormatter"
/>
2024-05-27 12:07:13 +08:00
<el-table-column label="操作">
<template #default="scope">
2024-06-05 17:08:27 +08:00
<el-button type="primary" text @click="openForm('update', scope.row.id)">修改</el-button>
<el-button type="danger" text @click="handleDelete(scope.row.id)">删除</el-button>
2024-05-27 12:07:13 +08:00
</template>
</el-table-column>
</el-table>
<Pagination
v-model:limit="searchForm.pageSize"
2024-06-05 17:08:27 +08:00
v-model:page="searchForm.pageNo"
2024-05-27 12:07:13 +08:00
:total="total"
2024-06-05 17:08:27 +08:00
@pagination="getList"
2024-05-27 12:07:13 +08:00
/>
<DialogSupplier ref="brandDialog" @success="handleQuery" />
</div>
</template>
<script setup name="SupplierSet">
2024-06-05 17:08:27 +08:00
import { dateFormatter } from '@/utils/formatTime'
2024-05-27 12:07:13 +08:00
import DialogSupplier from './DialogSupplier.vue'
2024-06-05 17:08:27 +08:00
import * as dictApi from '@/api/system/dict/dict.data'
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗
2024-05-27 12:07:13 +08:00
const searchForm = ref({
2024-06-05 17:08:27 +08:00
label: '',
pageSize: 20,
pageNo: 1,
dictType: 'erp_supplier'
2024-05-27 12:07:13 +08:00
})
const total = ref(0)
const brandDialog = ref()
const tableList = ref([])
const loading = ref(false)
function handleQuery() {
2024-06-05 17:08:27 +08:00
searchForm.value.pageNo = 1
2024-05-27 12:07:13 +08:00
getList()
}
function resetQuery() {
searchForm.value = {
2024-06-05 17:08:27 +08:00
label: '',
2024-05-27 12:07:13 +08:00
pageSize: 20,
2024-06-05 17:08:27 +08:00
pageNo: 1,
dictType: 'erp_supplier'
2024-05-27 12:07:13 +08:00
}
getList()
}
2024-06-05 17:08:27 +08:00
async function getList() {
loading.value = true
try {
const data = await dictApi.getDictDataPage(searchForm.value)
tableList.value = data.list
total.value = data.total
} finally {
loading.value = false
}
2024-05-27 12:07:13 +08:00
}
2024-06-05 17:08:27 +08:00
function openForm(type, id) {
brandDialog.value.open(type, id)
2024-05-27 12:07:13 +08:00
}
2024-06-05 17:08:27 +08:00
async function handleDelete(id) {
2024-05-27 12:07:13 +08:00
try {
// 删除的二次确认
await message.delConfirm()
// 发起删除
2024-06-05 17:08:27 +08:00
await dictApi.deleteDictData(id)
2024-05-27 12:07:13 +08:00
message.success(t('common.delSuccess'))
// 刷新列表
await getList()
} catch {}
}
2024-06-05 17:08:27 +08:00
onMounted(() => {
handleQuery()
})
2024-05-27 12:07:13 +08:00
</script>
<style lang="scss" scoped></style>