You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
202 lines
6.2 KiB
Vue
202 lines
6.2 KiB
Vue
<template>
|
|
<ContentWrap>
|
|
<el-form
|
|
class="-mb-15px"
|
|
:model="queryParams"
|
|
ref="queryFormRef"
|
|
:inline="true"
|
|
label-width="auto"
|
|
>
|
|
<el-form-item :label="t('ErpStock.WarehouseArea.warehouseId')" prop="warehouseId">
|
|
<el-select
|
|
v-model="queryParams.warehouseId"
|
|
:placeholder="t('ErpStock.WarehouseArea.placeholderWarehouseId')"
|
|
clearable
|
|
class="!w-240px"
|
|
>
|
|
<el-option
|
|
v-for="item in warehouseList"
|
|
:key="item.id"
|
|
:label="item.name"
|
|
:value="item.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item :label="t('ErpStock.WarehouseArea.areaCode')" prop="areaCode">
|
|
<el-input
|
|
v-model="queryParams.areaCode"
|
|
:placeholder="t('ErpStock.WarehouseArea.placeholderAreaCode')"
|
|
clearable
|
|
@keyup.enter="handleQuery"
|
|
class="!w-240px"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item :label="t('ErpStock.WarehouseArea.areaName')" prop="areaName">
|
|
<el-input
|
|
v-model="queryParams.areaName"
|
|
:placeholder="t('ErpStock.WarehouseArea.placeholderAreaName')"
|
|
clearable
|
|
@keyup.enter="handleQuery"
|
|
class="!w-240px"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item :label="t('ErpStock.WarehouseArea.status')" prop="status">
|
|
<el-select
|
|
v-model="queryParams.status"
|
|
:placeholder="t('ErpStock.WarehouseArea.placeholderStatus')"
|
|
clearable
|
|
class="!w-240px"
|
|
>
|
|
<el-option
|
|
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
|
:key="dict.value"
|
|
:label="dict.label"
|
|
:value="dict.value"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> {{ t('common.query') }}</el-button>
|
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> {{ t('common.reset') }}</el-button>
|
|
<el-button
|
|
type="primary"
|
|
plain
|
|
@click="openForm('create')"
|
|
v-hasPermi="['erp:warehouse-area:create']"
|
|
>
|
|
<Icon icon="ep:plus" class="mr-5px" /> {{ t('action.add') }}
|
|
</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</ContentWrap>
|
|
|
|
<ContentWrap>
|
|
<el-table
|
|
v-loading="loading"
|
|
:data="list"
|
|
:stripe="true"
|
|
:show-overflow-tooltip="true"
|
|
row-key="id"
|
|
>
|
|
<el-table-column :label="t('ErpStock.WarehouseArea.warehouseId')" align="center" prop="warehouseId" sortable>
|
|
<template #default="scope">
|
|
{{ getWarehouseName(scope.row.warehouseId) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column :label="t('ErpStock.WarehouseArea.areaCode')" align="center" prop="areaCode" sortable />
|
|
<el-table-column :label="t('ErpStock.WarehouseArea.areaName')" align="center" prop="areaName" sortable />
|
|
<el-table-column :label="t('ErpStock.WarehouseArea.areaSize')" align="center" prop="areaSize" />
|
|
<el-table-column :label="t('ErpStock.WarehouseArea.description')" align="center" prop="description" />
|
|
<el-table-column :label="t('ErpStock.WarehouseArea.status')" align="center" prop="status" sortable>
|
|
<template #default="scope">
|
|
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column :label="t('ErpStock.WarehouseArea.createTime')" align="center" prop="createTime" :formatter="dateFormatter" width="180px" sortable />
|
|
<el-table-column :label="t('common.operate')" align="center">
|
|
<template #default="scope">
|
|
<el-button
|
|
link
|
|
type="primary"
|
|
@click="openForm('update', scope.row.id)"
|
|
v-hasPermi="['erp:warehouse-area:update']"
|
|
>
|
|
{{ t('action.edit') }}
|
|
</el-button>
|
|
<el-button
|
|
link
|
|
type="danger"
|
|
@click="handleDelete(scope.row.id)"
|
|
v-hasPermi="['erp:warehouse-area:delete']"
|
|
>
|
|
{{ t('action.del') }}
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<Pagination
|
|
:total="total"
|
|
v-model:page="queryParams.pageNo"
|
|
v-model:limit="queryParams.pageSize"
|
|
@pagination="getList"
|
|
/>
|
|
</ContentWrap>
|
|
|
|
<WarehouseAreaForm ref="formRef" @success="getList" />
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
import { WarehouseAreaApi, WarehouseAreaVO } from '@/api/erp/stock/warehousearea'
|
|
import { WarehouseApi } from '@/api/erp/stock/warehouse'
|
|
import WarehouseAreaForm from './WarehouseAreaForm.vue'
|
|
|
|
defineOptions({ name: 'ErpWarehouseArea' })
|
|
|
|
const message = useMessage()
|
|
const { t } = useI18n()
|
|
|
|
const loading = ref(true)
|
|
const list = ref<WarehouseAreaVO[]>([])
|
|
const total = ref(0)
|
|
const queryParams = reactive({
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
warehouseId: undefined,
|
|
areaCode: undefined,
|
|
areaName: undefined,
|
|
status: undefined
|
|
})
|
|
const queryFormRef = ref()
|
|
const warehouseList = ref<any[]>([])
|
|
|
|
const getWarehouseName = (warehouseId: number) => {
|
|
return warehouseList.value.find((w) => w.id === warehouseId)?.name ?? '-'
|
|
}
|
|
|
|
const getList = async () => {
|
|
loading.value = true
|
|
try {
|
|
const data = await WarehouseAreaApi.getWarehouseAreaPage(queryParams)
|
|
list.value = data.list
|
|
total.value = data.total
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
|
|
const getWarehouseList = async () => {
|
|
warehouseList.value = await WarehouseApi.getWarehouseSimpleList()
|
|
}
|
|
|
|
const handleQuery = () => {
|
|
queryParams.pageNo = 1
|
|
getList()
|
|
}
|
|
|
|
const resetQuery = () => {
|
|
queryFormRef.value.resetFields()
|
|
handleQuery()
|
|
}
|
|
|
|
const formRef = ref()
|
|
const openForm = (type: string, id?: number) => {
|
|
formRef.value.open(type, id)
|
|
}
|
|
|
|
const handleDelete = async (id: number) => {
|
|
try {
|
|
await message.delConfirm()
|
|
await WarehouseAreaApi.deleteWarehouseArea(id)
|
|
message.success(t('common.delSuccess'))
|
|
await getList()
|
|
} catch {}
|
|
}
|
|
|
|
onMounted(() => {
|
|
getWarehouseList()
|
|
getList()
|
|
})
|
|
</script>
|