refactor(mes-ui): 修正工作站模块中文标签命名 + 拆分 API
- 表单标签/占位符/校验提示:工位 → 工作站 - API 注释:工位设备 → 设备资源、工位工具 → 工装夹具资源、工位人员 → 人力资源 - 拆分 workstation API 到 machine/tool/worker/workshop 子目录pull/871/MERGE
parent
95c478d739
commit
debce44339
|
|
@ -0,0 +1,51 @@
|
||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
// MES 产品BOM VO
|
||||||
|
export interface MdProductBomVO {
|
||||||
|
id?: number // BOM 编号
|
||||||
|
itemId: number // 物料产品 ID
|
||||||
|
bomItemId: number // BOM 物料 ID
|
||||||
|
quantity: number // 物料使用比例
|
||||||
|
status?: number // 是否启用
|
||||||
|
remark?: string // 备注
|
||||||
|
createTime?: Date // 创建时间
|
||||||
|
// ========== 关联展示字段 ==========
|
||||||
|
bomItemCode?: string // BOM 物料编码
|
||||||
|
bomItemName?: string // BOM 物料名称
|
||||||
|
bomItemSpecification?: string // BOM 物料规格
|
||||||
|
unitMeasureName?: string // 计量单位名称
|
||||||
|
itemOrProduct?: string // 产品物料标识
|
||||||
|
}
|
||||||
|
|
||||||
|
// MES 产品BOM API
|
||||||
|
export const MdProductBomApi = {
|
||||||
|
// 创建产品BOM
|
||||||
|
createProductBom: async (data: MdProductBomVO) => {
|
||||||
|
return await request.post({ url: `/mes/md/product-bom/create`, data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 更新产品BOM
|
||||||
|
updateProductBom: async (data: MdProductBomVO) => {
|
||||||
|
return await request.put({ url: `/mes/md/product-bom/update`, data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除产品BOM
|
||||||
|
deleteProductBom: async (id: number) => {
|
||||||
|
return await request.delete({ url: `/mes/md/product-bom/delete?id=` + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获得产品BOM
|
||||||
|
getProductBom: async (id: number) => {
|
||||||
|
return await request.get({ url: `/mes/md/product-bom/get?id=` + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获得产品BOM分页
|
||||||
|
getProductBomPage: async (params: any) => {
|
||||||
|
return await request.get({ url: `/mes/md/product-bom/page`, params })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 根据物料产品编号获得产品BOM列表
|
||||||
|
getProductBomListByItemId: async (itemId: number) => {
|
||||||
|
return await request.get({ url: `/mes/md/product-bom/list-by-item-id?itemId=` + itemId })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
// MES 产品SIP VO
|
||||||
|
export interface MdProductSipVO {
|
||||||
|
id?: number // SIP 编号
|
||||||
|
itemId: number // 物料产品 ID
|
||||||
|
orderNumber: number // 排列顺序
|
||||||
|
processId?: number // 工序 ID
|
||||||
|
title: string // 标题
|
||||||
|
description?: string // 详细描述
|
||||||
|
url?: string // 图片地址
|
||||||
|
remark?: string // 备注
|
||||||
|
createTime?: Date // 创建时间
|
||||||
|
// ========== 关联展示字段 ==========
|
||||||
|
processCode?: string // 工序编号
|
||||||
|
processName?: string // 工序名称
|
||||||
|
}
|
||||||
|
|
||||||
|
// MES 产品SIP API
|
||||||
|
export const MdProductSipApi = {
|
||||||
|
// 创建产品SIP
|
||||||
|
createProductSip: async (data: MdProductSipVO) => {
|
||||||
|
return await request.post({ url: `/mes/md/product-sip/create`, data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 更新产品SIP
|
||||||
|
updateProductSip: async (data: MdProductSipVO) => {
|
||||||
|
return await request.put({ url: `/mes/md/product-sip/update`, data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除产品SIP
|
||||||
|
deleteProductSip: async (id: number) => {
|
||||||
|
return await request.delete({ url: `/mes/md/product-sip/delete?id=` + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获得产品SIP
|
||||||
|
getProductSip: async (id: number) => {
|
||||||
|
return await request.get({ url: `/mes/md/product-sip/get?id=` + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获得产品SIP分页
|
||||||
|
getProductSipPage: async (params: any) => {
|
||||||
|
return await request.get({ url: `/mes/md/product-sip/page`, params })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 根据物料产品编号获得产品SIP列表
|
||||||
|
getProductSipListByItemId: async (itemId: number) => {
|
||||||
|
return await request.get({ url: `/mes/md/product-sip/list-by-item-id?itemId=` + itemId })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
// MES 产品SOP VO
|
||||||
|
export interface MdProductSopVO {
|
||||||
|
id?: number // SOP 编号
|
||||||
|
itemId: number // 物料产品 ID
|
||||||
|
orderNumber: number // 排列顺序
|
||||||
|
processId?: number // 工序 ID
|
||||||
|
title: string // 标题
|
||||||
|
description?: string // 详细描述
|
||||||
|
url?: string // 图片地址
|
||||||
|
remark?: string // 备注
|
||||||
|
createTime?: Date // 创建时间
|
||||||
|
// ========== 关联展示字段 ==========
|
||||||
|
processCode?: string // 工序编号
|
||||||
|
processName?: string // 工序名称
|
||||||
|
}
|
||||||
|
|
||||||
|
// MES 产品SOP API
|
||||||
|
export const MdProductSopApi = {
|
||||||
|
// 创建产品SOP
|
||||||
|
createProductSop: async (data: MdProductSopVO) => {
|
||||||
|
return await request.post({ url: `/mes/md/product-sop/create`, data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 更新产品SOP
|
||||||
|
updateProductSop: async (data: MdProductSopVO) => {
|
||||||
|
return await request.put({ url: `/mes/md/product-sop/update`, data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除产品SOP
|
||||||
|
deleteProductSop: async (id: number) => {
|
||||||
|
return await request.delete({ url: `/mes/md/product-sop/delete?id=` + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获得产品SOP
|
||||||
|
getProductSop: async (id: number) => {
|
||||||
|
return await request.get({ url: `/mes/md/product-sop/get?id=` + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获得产品SOP分页
|
||||||
|
getProductSopPage: async (params: any) => {
|
||||||
|
return await request.get({ url: `/mes/md/product-sop/page`, params })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 根据物料产品编号获得产品SOP列表
|
||||||
|
getProductSopListByItemId: async (itemId: number) => {
|
||||||
|
return await request.get({ url: `/mes/md/product-sop/list-by-item-id?itemId=` + itemId })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<div class="flex justify-end mb-10px">
|
<div class="flex justify-end mb-10px">
|
||||||
<el-button type="primary" size="small" @click="handleSave" :loading="loading">保存批次属性</el-button>
|
<el-button type="primary" size="small" @click="handleSave" :loading="loading">保存批次属性</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="batch-config-grid">
|
<div class="grid grid-cols-5 gap-x-20px">
|
||||||
<!-- 通用属性(ITEM 和 PRODUCT 都可见) -->
|
<!-- 通用属性(ITEM 和 PRODUCT 都可见) -->
|
||||||
<el-checkbox v-model="formData.produceDateFlag">生产日期</el-checkbox>
|
<el-checkbox v-model="formData.produceDateFlag">生产日期</el-checkbox>
|
||||||
<el-checkbox v-model="formData.qualityStatusFlag">质量状态</el-checkbox>
|
<el-checkbox v-model="formData.qualityStatusFlag">质量状态</el-checkbox>
|
||||||
|
|
@ -39,13 +39,14 @@ import { MesItemOrProductEnum } from '@/views/mes/utils/constants'
|
||||||
defineOptions({ name: 'MdItemBatchConfigForm' })
|
defineOptions({ name: 'MdItemBatchConfigForm' })
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
itemId: number
|
itemId: number // 物料编号
|
||||||
itemOrProduct: string // 'ITEM' | 'PRODUCT'
|
itemOrProduct: string // 区分原材料/产品:'ITEM' | 'PRODUCT'
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage() // 消息弹窗
|
||||||
const loading = ref(false)
|
const loading = ref(false) // 加载中
|
||||||
const formRef = ref()
|
const formRef = ref() // 表单 Ref
|
||||||
|
/** 表单数据 */
|
||||||
const formData = ref<MdItemBatchConfigVO>({
|
const formData = ref<MdItemBatchConfigVO>({
|
||||||
itemId: props.itemId,
|
itemId: props.itemId,
|
||||||
produceDateFlag: false,
|
produceDateFlag: false,
|
||||||
|
|
@ -112,11 +113,3 @@ const handleSave = async () => {
|
||||||
|
|
||||||
onMounted(() => loadData())
|
onMounted(() => loadData())
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.batch-config-grid {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(5, 1fr);
|
|
||||||
gap: 0 20px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,19 @@
|
||||||
<el-col :span="6" v-for="item in list" :key="item.id" class="mb-12px">
|
<el-col :span="6" v-for="item in list" :key="item.id" class="mb-12px">
|
||||||
<el-card shadow="hover" :body-style="{ padding: '0px' }">
|
<el-card shadow="hover" :body-style="{ padding: '0px' }">
|
||||||
<!-- 图片区域 -->
|
<!-- 图片区域 -->
|
||||||
<div class="sip-image-wrapper" @click="handlePreview(item.url)">
|
<div class="cursor-pointer" @click="handlePreview(item.url)">
|
||||||
<el-image v-if="item.url" :src="item.url" fit="cover" class="sip-image" />
|
<el-image v-if="item.url" :src="item.url" fit="cover" class="w-full h-160px block" />
|
||||||
<div v-else class="sip-image sip-image-empty">
|
<div
|
||||||
|
v-else
|
||||||
|
class="w-full h-160px flex items-center justify-center bg-#f5f7fa color-#c0c4cc"
|
||||||
|
>
|
||||||
<Icon icon="ep:picture" :size="32" />
|
<Icon icon="ep:picture" :size="32" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 信息区域 -->
|
<!-- 信息区域 -->
|
||||||
<div class="p-10px">
|
<div class="p-10px">
|
||||||
<div class="font-bold text-14px mb-4px truncate">{{ item.title }}</div>
|
<div class="font-bold text-14px mb-4px truncate">{{ item.title }}</div>
|
||||||
<div class="text-12px color-gray mb-4px">序号:{{ item.orderNum }}</div>
|
<div class="text-12px color-gray mb-4px">序号:{{ item.orderNumber }}</div>
|
||||||
<div v-if="item.processName" class="text-12px color-gray mb-4px">
|
<div v-if="item.processName" class="text-12px color-gray mb-4px">
|
||||||
工序:{{ item.processName }}
|
工序:{{ item.processName }}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -41,22 +44,15 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<!-- 图片预览 -->
|
|
||||||
<el-image-viewer
|
|
||||||
v-if="previewVisible"
|
|
||||||
:url-list="[previewUrl]"
|
|
||||||
@close="previewVisible = false"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 新增/编辑弹窗 -->
|
<!-- 新增/编辑弹窗 -->
|
||||||
<Dialog :title="formDialogTitle" v-model="formDialogVisible" width="500px">
|
<Dialog :title="formDialogTitle" v-model="formDialogVisible" width="500px">
|
||||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px">
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px">
|
||||||
<el-form-item label="标题" prop="title">
|
<el-form-item label="标题" prop="title">
|
||||||
<el-input v-model="formData.title" placeholder="请输入标题" />
|
<el-input v-model="formData.title" placeholder="请输入标题" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="排列顺序" prop="orderNum">
|
<el-form-item label="排列顺序" prop="orderNumber">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="formData.orderNum"
|
v-model="formData.orderNumber"
|
||||||
:min="0"
|
:min="0"
|
||||||
controls-position="right"
|
controls-position="right"
|
||||||
class="!w-1/1"
|
class="!w-1/1"
|
||||||
|
|
@ -87,21 +83,21 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// TODO @AI:方法注释,字段注释,记得写下
|
|
||||||
import { MdProductSipApi, MdProductSipVO } from '@/api/mes/md/item/productSip'
|
import { MdProductSipApi, MdProductSipVO } from '@/api/mes/md/item/productSip'
|
||||||
import { UploadImg } from '@/components/UploadFile'
|
import { UploadImg } from '@/components/UploadFile'
|
||||||
|
import { createImageViewer } from '@/components/ImageViewer'
|
||||||
|
|
||||||
defineOptions({ name: 'MdProductSipForm' })
|
defineOptions({ name: 'MdProductSipForm' })
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
itemId: number
|
itemId: number // 物料产品编号
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
const loading = ref(false)
|
const loading = ref(false) // 列表的加载中
|
||||||
const list = ref<MdProductSipVO[]>([])
|
const list = ref<MdProductSipVO[]>([]) // SIP 列表
|
||||||
|
|
||||||
/** 加载列表 */
|
/** 加载 SIP 列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
|
|
@ -112,37 +108,35 @@ const getList = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== 图片预览 ====================
|
// ==================== 图片预览 ====================
|
||||||
// TODO @AI:图片预览,项目里有更简单的写法!
|
|
||||||
const previewVisible = ref(false)
|
|
||||||
const previewUrl = ref('')
|
|
||||||
|
|
||||||
|
/** 预览图片 */
|
||||||
const handlePreview = (url?: string) => {
|
const handlePreview = (url?: string) => {
|
||||||
if (!url) {
|
if (!url) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
previewUrl.value = url
|
createImageViewer({ urlList: [url] })
|
||||||
previewVisible.value = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== 新增/编辑 ====================
|
// ==================== 新增/编辑 ====================
|
||||||
const formDialogVisible = ref(false)
|
const formDialogVisible = ref(false) // 弹窗是否可见
|
||||||
const formDialogTitle = ref('')
|
const formDialogTitle = ref('') // 弹窗标题
|
||||||
const formRef = ref()
|
const formRef = ref() // 表单 Ref
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
id: undefined as number | undefined,
|
id: undefined as number | undefined,
|
||||||
itemId: undefined as number | undefined,
|
itemId: undefined as number | undefined,
|
||||||
orderNum: 0,
|
orderNumber: 0,
|
||||||
processId: undefined as number | undefined,
|
processId: undefined as number | undefined,
|
||||||
title: undefined as string | undefined,
|
title: undefined as string | undefined,
|
||||||
description: undefined as string | undefined,
|
description: undefined as string | undefined,
|
||||||
url: undefined as string | undefined,
|
url: undefined as string | undefined,
|
||||||
remark: undefined as string | undefined
|
remark: undefined as string | undefined
|
||||||
})
|
}) // 表单数据
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
title: [{ required: true, message: '标题不能为空', trigger: 'blur' }],
|
title: [{ required: true, message: '标题不能为空', trigger: 'blur' }],
|
||||||
orderNum: [{ required: true, message: '排列顺序不能为空', trigger: 'blur' }]
|
orderNumber: [{ required: true, message: '排列顺序不能为空', trigger: 'blur' }]
|
||||||
})
|
}) // 表单校验规则
|
||||||
|
|
||||||
|
/** 打开新增/编辑表单 */
|
||||||
const openForm = (row?: MdProductSipVO) => {
|
const openForm = (row?: MdProductSipVO) => {
|
||||||
formDialogVisible.value = true
|
formDialogVisible.value = true
|
||||||
if (row) {
|
if (row) {
|
||||||
|
|
@ -150,7 +144,7 @@ const openForm = (row?: MdProductSipVO) => {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
id: row.id,
|
id: row.id,
|
||||||
itemId: row.itemId,
|
itemId: row.itemId,
|
||||||
orderNum: row.orderNum,
|
orderNumber: row.orderNumber,
|
||||||
processId: row.processId,
|
processId: row.processId,
|
||||||
title: row.title,
|
title: row.title,
|
||||||
description: row.description,
|
description: row.description,
|
||||||
|
|
@ -162,7 +156,7 @@ const openForm = (row?: MdProductSipVO) => {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
itemId: props.itemId,
|
itemId: props.itemId,
|
||||||
orderNum: 0,
|
orderNumber: 0,
|
||||||
processId: undefined,
|
processId: undefined,
|
||||||
title: undefined,
|
title: undefined,
|
||||||
description: undefined,
|
description: undefined,
|
||||||
|
|
@ -173,6 +167,7 @@ const openForm = (row?: MdProductSipVO) => {
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
await formRef.value.validate()
|
await formRef.value.validate()
|
||||||
if (formData.value.id) {
|
if (formData.value.id) {
|
||||||
|
|
@ -187,6 +182,8 @@ const submitForm = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== 删除 ====================
|
// ==================== 删除 ====================
|
||||||
|
|
||||||
|
/** 删除 SIP */
|
||||||
const handleDelete = async (id: number) => {
|
const handleDelete = async (id: number) => {
|
||||||
try {
|
try {
|
||||||
await message.delConfirm()
|
await message.delConfirm()
|
||||||
|
|
@ -206,25 +203,4 @@ watch(
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
)
|
)
|
||||||
// TODO @AI:通过 unocss 简化掉 style;
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.sip-image-wrapper {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sip-image {
|
|
||||||
width: 100%;
|
|
||||||
height: 160px;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sip-image-empty {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background-color: #f5f7fa;
|
|
||||||
color: #c0c4cc;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,19 @@
|
||||||
<el-col :span="6" v-for="item in list" :key="item.id" class="mb-12px">
|
<el-col :span="6" v-for="item in list" :key="item.id" class="mb-12px">
|
||||||
<el-card shadow="hover" :body-style="{ padding: '0px' }">
|
<el-card shadow="hover" :body-style="{ padding: '0px' }">
|
||||||
<!-- 图片区域 -->
|
<!-- 图片区域 -->
|
||||||
<div class="sop-image-wrapper" @click="handlePreview(item.url)">
|
<div class="cursor-pointer" @click="handlePreview(item.url)">
|
||||||
<el-image v-if="item.url" :src="item.url" fit="cover" class="sop-image" />
|
<el-image v-if="item.url" :src="item.url" fit="cover" class="w-full h-160px block" />
|
||||||
<div v-else class="sop-image sop-image-empty">
|
<div
|
||||||
|
v-else
|
||||||
|
class="w-full h-160px flex items-center justify-center bg-#f5f7fa color-#c0c4cc"
|
||||||
|
>
|
||||||
<Icon icon="ep:picture" :size="32" />
|
<Icon icon="ep:picture" :size="32" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 信息区域 -->
|
<!-- 信息区域 -->
|
||||||
<div class="p-10px">
|
<div class="p-10px">
|
||||||
<div class="font-bold text-14px mb-4px truncate">{{ item.title }}</div>
|
<div class="font-bold text-14px mb-4px truncate">{{ item.title }}</div>
|
||||||
<div class="text-12px color-gray mb-4px">序号:{{ item.orderNum }}</div>
|
<div class="text-12px color-gray mb-4px">序号:{{ item.orderNumber }}</div>
|
||||||
<div v-if="item.processName" class="text-12px color-gray mb-4px">
|
<div v-if="item.processName" class="text-12px color-gray mb-4px">
|
||||||
工序:{{ item.processName }}
|
工序:{{ item.processName }}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -41,22 +44,15 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<!-- 图片预览 -->
|
|
||||||
<el-image-viewer
|
|
||||||
v-if="previewVisible"
|
|
||||||
:url-list="[previewUrl]"
|
|
||||||
@close="previewVisible = false"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 新增/编辑弹窗 -->
|
<!-- 新增/编辑弹窗 -->
|
||||||
<Dialog :title="formDialogTitle" v-model="formDialogVisible" width="500px">
|
<Dialog :title="formDialogTitle" v-model="formDialogVisible" width="500px">
|
||||||
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px">
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px">
|
||||||
<el-form-item label="标题" prop="title">
|
<el-form-item label="标题" prop="title">
|
||||||
<el-input v-model="formData.title" placeholder="请输入标题" />
|
<el-input v-model="formData.title" placeholder="请输入标题" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="排列顺序" prop="orderNum">
|
<el-form-item label="排列顺序" prop="orderNumber">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="formData.orderNum"
|
v-model="formData.orderNumber"
|
||||||
:min="0"
|
:min="0"
|
||||||
controls-position="right"
|
controls-position="right"
|
||||||
class="!w-1/1"
|
class="!w-1/1"
|
||||||
|
|
@ -87,21 +83,22 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// TODO @AI:方法注释,字段注释,记得写下
|
// DONE @AI:方法注释,字段注释,记得写下
|
||||||
import { MdProductSopApi, MdProductSopVO } from '@/api/mes/md/item/productSop'
|
import { MdProductSopApi, MdProductSopVO } from '@/api/mes/md/item/productSop'
|
||||||
import { UploadImg } from '@/components/UploadFile'
|
import { UploadImg } from '@/components/UploadFile'
|
||||||
|
import { createImageViewer } from '@/components/ImageViewer'
|
||||||
|
|
||||||
defineOptions({ name: 'MdProductSopForm' })
|
defineOptions({ name: 'MdProductSopForm' })
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
itemId: number
|
itemId: number // 物料产品编号
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
const loading = ref(false)
|
const loading = ref(false) // 列表的加载中
|
||||||
const list = ref<MdProductSopVO[]>([])
|
const list = ref<MdProductSopVO[]>([]) // SOP 列表
|
||||||
|
|
||||||
/** 加载列表 */
|
/** 加载 SOP 列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
|
|
@ -112,35 +109,35 @@ const getList = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== 图片预览 ====================
|
// ==================== 图片预览 ====================
|
||||||
// TODO @AI:图片预览,项目里有更简单的写法!
|
|
||||||
const previewVisible = ref(false)
|
|
||||||
const previewUrl = ref('')
|
|
||||||
|
|
||||||
|
/** 预览图片 */
|
||||||
const handlePreview = (url?: string) => {
|
const handlePreview = (url?: string) => {
|
||||||
if (!url) return
|
if (!url) return
|
||||||
previewUrl.value = url
|
createImageViewer({ urlList: [url] })
|
||||||
previewVisible.value = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== 新增/编辑 ====================
|
// ==================== 新增/编辑 ====================
|
||||||
const formDialogVisible = ref(false)
|
const formDialogVisible = ref(false) // 弹窗是否可见
|
||||||
const formDialogTitle = ref('')
|
const formDialogTitle = ref('') // 弹窗标题
|
||||||
const formRef = ref()
|
const formRef = ref() // 表单 Ref
|
||||||
|
/** 表单数据 */
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
id: undefined as number | undefined,
|
id: undefined as number | undefined,
|
||||||
itemId: undefined as number | undefined,
|
itemId: undefined as number | undefined,
|
||||||
orderNum: 0,
|
orderNumber: 0,
|
||||||
processId: undefined as number | undefined,
|
processId: undefined as number | undefined,
|
||||||
title: undefined as string | undefined,
|
title: undefined as string | undefined,
|
||||||
description: undefined as string | undefined,
|
description: undefined as string | undefined,
|
||||||
url: undefined as string | undefined,
|
url: undefined as string | undefined,
|
||||||
remark: undefined as string | undefined
|
remark: undefined as string | undefined
|
||||||
})
|
})
|
||||||
|
/** 表单校验规则 */
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
title: [{ required: true, message: '标题不能为空', trigger: 'blur' }],
|
title: [{ required: true, message: '标题不能为空', trigger: 'blur' }],
|
||||||
orderNum: [{ required: true, message: '排列顺序不能为空', trigger: 'blur' }]
|
orderNumber: [{ required: true, message: '排列顺序不能为空', trigger: 'blur' }]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/** 打开新增/编辑表单 */
|
||||||
const openForm = (row?: MdProductSopVO) => {
|
const openForm = (row?: MdProductSopVO) => {
|
||||||
formDialogVisible.value = true
|
formDialogVisible.value = true
|
||||||
if (row) {
|
if (row) {
|
||||||
|
|
@ -148,7 +145,7 @@ const openForm = (row?: MdProductSopVO) => {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
id: row.id,
|
id: row.id,
|
||||||
itemId: row.itemId,
|
itemId: row.itemId,
|
||||||
orderNum: row.orderNum,
|
orderNumber: row.orderNumber,
|
||||||
processId: row.processId,
|
processId: row.processId,
|
||||||
title: row.title,
|
title: row.title,
|
||||||
description: row.description,
|
description: row.description,
|
||||||
|
|
@ -160,7 +157,7 @@ const openForm = (row?: MdProductSopVO) => {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
itemId: props.itemId,
|
itemId: props.itemId,
|
||||||
orderNum: 0,
|
orderNumber: 0,
|
||||||
processId: undefined,
|
processId: undefined,
|
||||||
title: undefined,
|
title: undefined,
|
||||||
description: undefined,
|
description: undefined,
|
||||||
|
|
@ -171,6 +168,7 @@ const openForm = (row?: MdProductSopVO) => {
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
await formRef.value.validate()
|
await formRef.value.validate()
|
||||||
if (formData.value.id) {
|
if (formData.value.id) {
|
||||||
|
|
@ -185,6 +183,8 @@ const submitForm = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== 删除 ====================
|
// ==================== 删除 ====================
|
||||||
|
|
||||||
|
/** 删除 SOP */
|
||||||
const handleDelete = async (id: number) => {
|
const handleDelete = async (id: number) => {
|
||||||
try {
|
try {
|
||||||
await message.delConfirm()
|
await message.delConfirm()
|
||||||
|
|
@ -204,25 +204,5 @@ watch(
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
)
|
)
|
||||||
// TODO @AI:通过 unocss 简化掉 style
|
// DONE @AI:通过 unocss 简化掉 style
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.sop-image-wrapper {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sop-image {
|
|
||||||
width: 100%;
|
|
||||||
height: 160px;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sop-image-empty {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background-color: #f5f7fa;
|
|
||||||
color: #c0c4cc;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
<el-input v-model="formData.address" placeholder="请输入工作站地点" />
|
<el-input v-model="formData.address" placeholder="请输入工作站地点" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- TODO @AI:所属工序 -->
|
<!-- TODO @芋艿:所属工序,等工序模块完成后对接 -->
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-radio-group v-model="formData.status">
|
<el-radio-group v-model="formData.status">
|
||||||
|
|
@ -94,20 +94,17 @@ import WorkstationMachinePanel from './components/WorkstationMachinePanel.vue'
|
||||||
import WorkstationToolPanel from './components/WorkstationToolPanel.vue'
|
import WorkstationToolPanel from './components/WorkstationToolPanel.vue'
|
||||||
import WorkstationWorkerPanel from './components/WorkstationWorkerPanel.vue'
|
import WorkstationWorkerPanel from './components/WorkstationWorkerPanel.vue'
|
||||||
|
|
||||||
// TODO @AI:方法注释;
|
|
||||||
// TODO @AI:字段注释;
|
|
||||||
|
|
||||||
defineOptions({ name: 'WorkstationForm' })
|
defineOptions({ name: 'WorkstationForm' })
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const dialogTitle = ref('')
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
const formLoading = ref(false)
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
const formType = ref('')
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
const activeTab = ref('machine')
|
const activeTab = ref('machine') // 当前激活的资源 Tab
|
||||||
const workshopList = ref<MdWorkshopVO[]>([]) // 车间列表
|
const workshopList = ref<MdWorkshopVO[]>([]) // 车间下拉列表
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
id: undefined,
|
id: undefined,
|
||||||
code: undefined,
|
code: undefined,
|
||||||
|
|
@ -120,13 +117,13 @@ const formData = ref({
|
||||||
areaId: undefined,
|
areaId: undefined,
|
||||||
status: CommonStatusEnum.ENABLE,
|
status: CommonStatusEnum.ENABLE,
|
||||||
remark: undefined
|
remark: undefined
|
||||||
})
|
}) // 表单数据
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
code: [{ required: true, message: '工作站编码不能为空', trigger: 'blur' }],
|
code: [{ required: true, message: '工作站编码不能为空', trigger: 'blur' }],
|
||||||
name: [{ required: true, message: '工作站名称不能为空', trigger: 'blur' }],
|
name: [{ required: true, message: '工作站名称不能为空', trigger: 'blur' }],
|
||||||
workshopId: [{ required: true, message: '所在车间不能为空', trigger: 'change' }],
|
workshopId: [{ required: true, message: '所在车间不能为空', trigger: 'change' }],
|
||||||
status: [{ required: true, message: '状态不能为空', trigger: 'blur' }]
|
status: [{ required: true, message: '状态不能为空', trigger: 'blur' }]
|
||||||
})
|
}) // 表单校验规则
|
||||||
const formRef = ref()
|
const formRef = ref()
|
||||||
|
|
||||||
/** 生成工作站编码 */
|
/** 生成工作站编码 */
|
||||||
|
|
|
||||||
|
|
@ -16,22 +16,31 @@
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<!-- 添加设备弹窗 -->
|
<!-- 添加设备弹窗 -->
|
||||||
<Dialog title="添加设备" v-model="addDialogVisible" width="500px">
|
<Dialog title="添加设备" v-model="dialogVisible" width="500px">
|
||||||
<el-form ref="addFormRef" :model="addFormData" :rules="addFormRules" label-width="80px">
|
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="80px">
|
||||||
<el-form-item label="设备" prop="machineryId">
|
<el-form-item label="设备" prop="machineryId">
|
||||||
<!-- TODO @芋艿:对接设备下拉列表,等 DV 设备模块完成后对接 -->
|
<!-- TODO @芋艿:对接设备下拉列表,等 DV 设备模块完成后对接 -->
|
||||||
<el-input-number v-model="addFormData.machineryId" placeholder="请输入设备编号" class="!w-1/1" />
|
<el-input-number
|
||||||
|
v-model="formData.machineryId"
|
||||||
|
placeholder="请输入设备编号"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="数量" prop="quantity">
|
<el-form-item label="数量" prop="quantity">
|
||||||
<el-input-number v-model="addFormData.quantity" :min="1" controls-position="right" class="!w-1/1" />
|
<el-input-number
|
||||||
|
v-model="formData.quantity"
|
||||||
|
:min="1"
|
||||||
|
controls-position="right"
|
||||||
|
class="!w-1/1"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input v-model="addFormData.remark" type="textarea" placeholder="请输入备注" />
|
<el-input v-model="formData.remark" type="textarea" placeholder="请输入备注" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button @click="submitAddForm" type="primary">确 定</el-button>
|
<el-button @click="submitForm" type="primary">确 定</el-button>
|
||||||
<el-button @click="addDialogVisible = false">取 消</el-button>
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
</template>
|
</template>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -40,16 +49,13 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { MdWorkstationMachineApi, MdWorkstationMachineVO } from '@/api/mes/md/workstation/machine'
|
import { MdWorkstationMachineApi, MdWorkstationMachineVO } from '@/api/mes/md/workstation/machine'
|
||||||
|
|
||||||
// TODO @AI:字段注释;
|
|
||||||
// TODO @AI:方法注释;
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
workstationId: number
|
workstationId: number // 工作站编号
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage() // 消息弹窗
|
||||||
const loading = ref(false)
|
const loading = ref(false) // 列表加载中
|
||||||
const list = ref<MdWorkstationMachineVO[]>([])
|
const list = ref<MdWorkstationMachineVO[]>([]) // 设备资源列表
|
||||||
|
|
||||||
/** 加载列表 */
|
/** 加载列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
|
|
@ -61,37 +67,40 @@ const getList = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 添加弹窗 */
|
// ==================== 添加设备 ====================
|
||||||
// TODO @AI:使用 form,不要 add 前缀;
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const addDialogVisible = ref(false)
|
const formRef = ref() // 表单 Ref
|
||||||
const addFormRef = ref()
|
const formData = ref({
|
||||||
const addFormData = ref({
|
|
||||||
workstationId: undefined as number | undefined,
|
workstationId: undefined as number | undefined,
|
||||||
machineryId: undefined as number | undefined,
|
machineryId: undefined as number | undefined,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
remark: undefined as string | undefined
|
remark: undefined as string | undefined
|
||||||
})
|
}) // 表单数据
|
||||||
const addFormRules = reactive({
|
const formRules = reactive({
|
||||||
machineryId: [{ required: true, message: '设备不能为空', trigger: 'blur' }],
|
machineryId: [{ required: true, message: '设备不能为空', trigger: 'blur' }],
|
||||||
quantity: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
|
quantity: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
|
||||||
})
|
}) // 表单校验规则
|
||||||
|
|
||||||
|
/** 打开添加弹窗 */
|
||||||
const openAddForm = () => {
|
const openAddForm = () => {
|
||||||
addDialogVisible.value = true
|
dialogVisible.value = true
|
||||||
addFormData.value = {
|
formData.value = {
|
||||||
workstationId: props.workstationId,
|
workstationId: props.workstationId,
|
||||||
machineryId: undefined,
|
machineryId: undefined,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
remark: undefined
|
remark: undefined
|
||||||
}
|
}
|
||||||
addFormRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
const submitAddForm = async () => {
|
/** 提交表单 */
|
||||||
await addFormRef.value.validate()
|
const submitForm = async () => {
|
||||||
await MdWorkstationMachineApi.createWorkstationMachine(addFormData.value as unknown as MdWorkstationMachineVO)
|
await formRef.value.validate()
|
||||||
|
await MdWorkstationMachineApi.createWorkstationMachine(
|
||||||
|
formData.value as unknown as MdWorkstationMachineVO
|
||||||
|
)
|
||||||
message.success('添加成功')
|
message.success('添加成功')
|
||||||
addDialogVisible.value = false
|
dialogVisible.value = false
|
||||||
await getList()
|
await getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
v-model="formData.toolTypeId"
|
v-model="formData.toolTypeId"
|
||||||
placeholder="请输入工具类型编号"
|
placeholder="请输入工具类型编号"
|
||||||
class="!w-1/1"
|
class="!w-1/1"
|
||||||
:disabled="isEdit"
|
:disabled="formType === 'update'"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="数量" prop="quantity">
|
<el-form-item label="数量" prop="quantity">
|
||||||
|
|
@ -51,16 +51,13 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { MdWorkstationToolApi, MdWorkstationToolVO } from '@/api/mes/md/workstation/tool'
|
import { MdWorkstationToolApi, MdWorkstationToolVO } from '@/api/mes/md/workstation/tool'
|
||||||
|
|
||||||
// TODO @AI:字段注释;
|
|
||||||
// TODO @AI:方法注释;
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
workstationId: number
|
workstationId: number // 工作站编号
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage() // 消息弹窗
|
||||||
const loading = ref(false)
|
const loading = ref(false) // 列表加载中
|
||||||
const list = ref<MdWorkstationToolVO[]>([])
|
const list = ref<MdWorkstationToolVO[]>([]) // 工装夹具资源列表
|
||||||
|
|
||||||
/** 加载列表 */
|
/** 加载列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
|
|
@ -72,27 +69,29 @@ const getList = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 弹窗 */
|
// ==================== 添加/编辑工具 ====================
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const dialogTitle = ref('')
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
const isEdit = ref(false) // TODO @AI:参考别的模块,formType?
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
const formRef = ref()
|
const formRef = ref() // 表单 Ref
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
id: undefined as number | undefined,
|
id: undefined as number | undefined,
|
||||||
workstationId: undefined as number | undefined,
|
workstationId: undefined as number | undefined,
|
||||||
toolTypeId: undefined as number | undefined,
|
toolTypeId: undefined as number | undefined,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
remark: undefined as string | undefined
|
remark: undefined as string | undefined
|
||||||
})
|
}) // 表单数据
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
toolTypeId: [{ required: true, message: '工具类型不能为空', trigger: 'blur' }],
|
toolTypeId: [{ required: true, message: '工具类型不能为空', trigger: 'blur' }],
|
||||||
quantity: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
|
quantity: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
|
||||||
})
|
}) // 表单校验规则
|
||||||
|
|
||||||
|
/** 打开添加弹窗 */
|
||||||
|
// TODO @AI:是不是 openForm、resetForm 更好?因为编辑和添加其实是同一个表单,区别只是 formType 不同;这样和别的模块,更统一;
|
||||||
const openAddForm = () => {
|
const openAddForm = () => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
dialogTitle.value = '添加工具'
|
dialogTitle.value = '添加工具'
|
||||||
isEdit.value = false
|
formType.value = 'create'
|
||||||
formData.value = {
|
formData.value = {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
workstationId: props.workstationId,
|
workstationId: props.workstationId,
|
||||||
|
|
@ -103,16 +102,19 @@ const openAddForm = () => {
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 打开编辑弹窗 */
|
||||||
const openEditForm = (row: MdWorkstationToolVO) => {
|
const openEditForm = (row: MdWorkstationToolVO) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
dialogTitle.value = '编辑工具'
|
dialogTitle.value = '编辑工具'
|
||||||
isEdit.value = true
|
formType.value = 'update'
|
||||||
formData.value = { ...row }
|
formData.value = { ...row }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
|
// TODO @AI:和别的模块保持一致;类似 loading 啥的
|
||||||
await formRef.value.validate()
|
await formRef.value.validate()
|
||||||
if (isEdit.value) {
|
if (formType.value === 'update') {
|
||||||
await MdWorkstationToolApi.updateWorkstationTool(
|
await MdWorkstationToolApi.updateWorkstationTool(
|
||||||
formData.value as unknown as MdWorkstationToolVO
|
formData.value as unknown as MdWorkstationToolVO
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
v-model="formData.postId"
|
v-model="formData.postId"
|
||||||
placeholder="请选择岗位"
|
placeholder="请选择岗位"
|
||||||
class="!w-1/1"
|
class="!w-1/1"
|
||||||
:disabled="isEdit"
|
:disabled="formType === 'update'"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="post in postList"
|
v-for="post in postList"
|
||||||
|
|
@ -58,17 +58,14 @@
|
||||||
import { MdWorkstationWorkerApi, MdWorkstationWorkerVO } from '@/api/mes/md/workstation/worker'
|
import { MdWorkstationWorkerApi, MdWorkstationWorkerVO } from '@/api/mes/md/workstation/worker'
|
||||||
import * as PostApi from '@/api/system/post'
|
import * as PostApi from '@/api/system/post'
|
||||||
|
|
||||||
// TODO @AI:字段注释;
|
|
||||||
// TODO @AI:方法注释;
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
workstationId: number
|
workstationId: number // 工作站编号
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage() // 消息弹窗
|
||||||
const loading = ref(false)
|
const loading = ref(false) // 列表加载中
|
||||||
const list = ref<MdWorkstationWorkerVO[]>([])
|
const list = ref<MdWorkstationWorkerVO[]>([]) // 人力资源列表
|
||||||
const postList = ref<PostApi.PostVO[]>([]) // 岗位列表
|
const postList = ref<PostApi.PostVO[]>([]) // 岗位下拉列表
|
||||||
|
|
||||||
/** 加载列表 */
|
/** 加载列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
|
|
@ -80,27 +77,30 @@ const getList = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 弹窗 */
|
// ==================== 添加/编辑人员 ====================
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const dialogTitle = ref('')
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
const isEdit = ref(false) // TODO @AI:参考别的模块,formType?
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
const formRef = ref()
|
const formRef = ref() // 表单 Ref
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
id: undefined as number | undefined,
|
id: undefined as number | undefined,
|
||||||
workstationId: undefined as number | undefined,
|
workstationId: undefined as number | undefined,
|
||||||
postId: undefined as number | undefined,
|
postId: undefined as number | undefined,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
remark: undefined as string | undefined
|
remark: undefined as string | undefined
|
||||||
})
|
}) // 表单数据
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
postId: [{ required: true, message: '岗位不能为空', trigger: 'change' }],
|
postId: [{ required: true, message: '岗位不能为空', trigger: 'change' }],
|
||||||
quantity: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
|
quantity: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
|
||||||
})
|
}) // 表单校验规则
|
||||||
|
|
||||||
|
// TODO @AI:是不是 openForm、resetForm 更好?因为编辑和添加其实是同一个表单,区别只是 formType 不同;这样和别的模块,更统一;
|
||||||
|
|
||||||
|
/** 打开添加弹窗 */
|
||||||
const openAddForm = async () => {
|
const openAddForm = async () => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
dialogTitle.value = '添加人员'
|
dialogTitle.value = '添加人员'
|
||||||
isEdit.value = false
|
formType.value = 'create'
|
||||||
// 加载岗位列表
|
// 加载岗位列表
|
||||||
postList.value = await PostApi.getSimplePostList()
|
postList.value = await PostApi.getSimplePostList()
|
||||||
formData.value = {
|
formData.value = {
|
||||||
|
|
@ -113,18 +113,21 @@ const openAddForm = async () => {
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 打开编辑弹窗 */
|
||||||
const openEditForm = async (row: MdWorkstationWorkerVO) => {
|
const openEditForm = async (row: MdWorkstationWorkerVO) => {
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
dialogTitle.value = '编辑人员'
|
dialogTitle.value = '编辑人员'
|
||||||
isEdit.value = true
|
formType.value = 'update'
|
||||||
// 加载岗位列表
|
// 加载岗位列表
|
||||||
postList.value = await PostApi.getSimplePostList()
|
postList.value = await PostApi.getSimplePostList()
|
||||||
formData.value = { ...row }
|
formData.value = { ...row }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
|
// TODO @AI:和别的模块保持一致;类似 loading 啥的
|
||||||
await formRef.value.validate()
|
await formRef.value.validate()
|
||||||
if (isEdit.value) {
|
if (formType.value === 'update') {
|
||||||
await MdWorkstationWorkerApi.updateWorkstationWorker(
|
await MdWorkstationWorkerApi.updateWorkstationWorker(
|
||||||
formData.value as unknown as MdWorkstationWorkerVO
|
formData.value as unknown as MdWorkstationWorkerVO
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@
|
||||||
<el-table-column label="工作站名称" align="center" prop="name" width="150" />
|
<el-table-column label="工作站名称" align="center" prop="name" width="150" />
|
||||||
<el-table-column label="工作站地点" align="center" prop="address" width="150" />
|
<el-table-column label="工作站地点" align="center" prop="address" width="150" />
|
||||||
<el-table-column label="所在车间" align="center" prop="workshopName" width="120" />
|
<el-table-column label="所在车间" align="center" prop="workshopName" width="120" />
|
||||||
<!-- TODO @AI:所属工序 -->
|
<!-- TODO @芋艿:所属工序,等工序模块完成后对接 -->
|
||||||
<el-table-column label="状态" align="center" prop="status" width="100">
|
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue