生产计划
parent
4db17d345d
commit
20701187a8
@ -0,0 +1,45 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 质量管理-质检参数 VO
|
||||
export interface ZjProductVO {
|
||||
id: number // ID
|
||||
type: string // 工序
|
||||
name: string // 名称
|
||||
unit: string // 单位
|
||||
upperVal: number // 上限值
|
||||
lowerVal: number // 下限值
|
||||
remark: string // 备注
|
||||
}
|
||||
|
||||
// 质量管理-质检参数 API
|
||||
export const ZjProductApi = {
|
||||
// 查询质量管理-质检参数分页
|
||||
getZjProductPage: async (params: any) => {
|
||||
return await request.get({ url: `/mes/zj-product/page`, params })
|
||||
},
|
||||
|
||||
// 查询质量管理-质检参数详情
|
||||
getZjProduct: async (id: number) => {
|
||||
return await request.get({ url: `/mes/zj-product/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增质量管理-质检参数
|
||||
createZjProduct: async (data: ZjProductVO) => {
|
||||
return await request.post({ url: `/mes/zj-product/create`, data })
|
||||
},
|
||||
|
||||
// 修改质量管理-质检参数
|
||||
updateZjProduct: async (data: ZjProductVO) => {
|
||||
return await request.put({ url: `/mes/zj-product/update`, data })
|
||||
},
|
||||
|
||||
// 删除质量管理-质检参数
|
||||
deleteZjProduct: async (id: number) => {
|
||||
return await request.delete({ url: `/mes/zj-product/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出质量管理-质检参数 Excel
|
||||
exportZjProduct: async (params) => {
|
||||
return await request.download({ url: `/mes/zj-product/export-excel`, params })
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,201 @@
|
||||
<!-- ERP 产品列表 -->
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<!-- <el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['erp:product:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['erp:product:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button> -->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-tabs v-model="activeName" @tab-click="handleTabClick">
|
||||
<el-tab-pane label="产品" name="2" />
|
||||
<el-tab-pane label="原料" name="1" />
|
||||
</el-tabs>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" @current-change="handleCurrentChange">
|
||||
<el-table-column label="编码" align="center" prop="barCode" />
|
||||
<el-table-column label="名称" align="left" prop="name" width="220px"/>
|
||||
<el-table-column label="规格" align="center" prop="standard" />
|
||||
<el-table-column label="分类" align="center" prop="subCategoryName" />
|
||||
<el-table-column label="单位" align="center" prop="unitName" />
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
<!-- 子表的列表 -->
|
||||
<ContentWrap>
|
||||
<el-tabs model-value="product">
|
||||
<el-tab-pane label="质检参数" name="product">
|
||||
<ZjProductList :productId="currentRow.id"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { ProductApi, ProductVO } from '@/api/erp/product/product'
|
||||
import { ProductCategoryApi, ProductCategoryVO } from '@/api/erp/product/category'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
import ZjProductList from './components/ZjProductList.vue'
|
||||
/** 产品质检列表 */
|
||||
defineOptions({ name: 'ZjProduct' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<ProductVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: undefined,
|
||||
categoryId: undefined
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
const categoryList = ref<ProductCategoryVO[]>([]) // 产品分类列表
|
||||
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await ProductApi.getProductPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
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 ProductApi.deleteProduct(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await ProductApi.exportProduct(queryParams)
|
||||
download.excel(data, '产品.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(async () => {
|
||||
queryParams.categoryId = 2
|
||||
await getList()
|
||||
// 产品分类
|
||||
const categoryData = await ProductCategoryApi.getProductCategorySimpleList()
|
||||
categoryList.value = handleTree(categoryData, 'id', 'parentId')
|
||||
})
|
||||
|
||||
/** tab 切换 */
|
||||
let activeName = '2'
|
||||
const handleTabClick = (tab: TabsPaneContext) => {
|
||||
queryParams.categoryId = tab.paneName
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const bomFormRef = ref()
|
||||
const openBomForm = (type: string, id?: number) => {
|
||||
bomFormRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 选中行操作 */
|
||||
const currentRow = ref({}) // 选中行
|
||||
const handleCurrentChange = (row) => {
|
||||
currentRow.value = row
|
||||
}
|
||||
</script>
|
||||
Loading…
Reference in New Issue