黄伟杰 1 week ago
commit 4c98bb463a

@ -111,5 +111,10 @@ export const DeviceLedgerApi = {
exportDeviceComponent: async (params: any) => {
return await request.download({ url: `/mes/device-critical-component/export-excel`, params })
}
},
// 删除设备关键件明细
deleteDeviceCriticalComponent: async (id: string) => {
return await request.delete({ url: `/mes/device-critical-component/delete?id=` + id })
},
}

@ -1,12 +1,18 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="120px"
v-loading="formLoading"
>
<div class="mold-panel">
<div class="mold-panel__header">
<div class="mold-panel__title">{{ dialogTitle }}</div>
<el-button text @click="closeForm">
<Icon icon="ep:close" />
</el-button>
</div>
<div class="mold-dialog" v-loading="formLoading">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="120px"
>
<el-form-item :label="t('MoldManagement.Mold.code')" prop="code">
<el-row :gutter="10" style="width: 100%">
<el-col :xs="24" :sm="18" :md="16" :lg="14" :xl="12">
@ -128,13 +134,14 @@
<UploadFile v-model="formData.fileUrl" :limit="1" :isShowTip="false"/>
</el-form-item>
</el-form>
<template #footer>
</div>
<div class="mold-footer">
<el-button @click="closeForm">{{ t('dialog.close') }}</el-button>
<el-button @click="submitForm" type="primary" :disabled="formLoading">
{{ t('action.save') }}
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</div>
</div>
</template>
<script setup lang="ts">
import { getIntDictOptions, DICT_TYPE, getBoolDictOptions } from '@/utils/dict'
@ -146,7 +153,6 @@ const unitList = ref<ProductUnitVO[]>([]) // 产品单位列表
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
@ -203,7 +209,6 @@ const formRef = ref() // 表单 Ref
/** 打开弹窗 */
const open = async (type: string, id?: number, brandId: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
@ -270,7 +275,7 @@ const handleQrcodeRefreshSuccess = async (data: any) => {
}
/** 提交表单 */
const emit = defineEmits(['success']) // success
const emit = defineEmits(['success', 'closed']) // success closed
const submitForm = async () => {
//
await formRef.value.validate()
@ -286,7 +291,7 @@ const submitForm = async () => {
await MoldBrandApi.updateMold(updateData)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
closeForm()
//
emit('success')
} finally {
@ -294,6 +299,10 @@ const submitForm = async () => {
}
}
const closeForm = () => {
emit('closed')
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
@ -316,5 +325,58 @@ const resetForm = () => {
}
formRef.value?.resetFields()
}
</script>
<style scoped lang="scss"></style>
<style lang="scss" scoped>
.mold-panel {
background: #fff;
border-radius: 12px;
box-shadow: var(--el-box-shadow-light);
}
.mold-panel__header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 20px;
border-bottom: 1px solid #ebeef5;
}
.mold-panel__title {
color: #1f2937;
font-size: 18px;
font-weight: 600;
}
.mold-dialog {
max-height: calc(100vh - 220px);
padding: 20px 20px 0;
padding-right: 16px;
overflow-y: auto;
}
.mold-footer {
display: flex;
justify-content: flex-end;
gap: 12px;
width: 100%;
padding: 16px 20px 20px;
border-top: 1px solid #ebeef5;
}
@media (max-width: 768px) {
.mold-panel__header {
padding: 14px 16px;
}
.mold-dialog {
max-height: none;
padding: 16px 16px 0;
overflow-y: visible;
}
.mold-footer {
padding: 16px;
}
}
</style>

@ -1,5 +1,5 @@
<template>
<div class="device-ledger-layout">
<div v-show="!formVisible" class="device-ledger-layout">
<ContentWrap class="device-ledger-left">
<el-tree
v-loading="typeTreeLoading" :data="brandTreeData" node-key="id" highlight-current :props="typeTreeProps"
@ -101,9 +101,8 @@ type="success" plain @click="handleExport" :loading="exportLoading"
</div>
</div>
<!-- 表单弹窗添加/修改 -->
<!-- 表单弹窗添加/修改 -->
<MoldForm ref="formRef" @success="getList" />
<!-- 表单添加/修改 -->
<MoldForm v-show="formVisible" ref="formRef" @success="getList" @closed="formVisible = false" />
<!-- 表单弹窗添加/修改 -->
<MoldRecordForm ref="recordFormRef" @success="getList" />
@ -223,11 +222,14 @@ const resetQuery = () => {
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
const formVisible = ref(false)
const openForm = async (type: string, id?: number) => {
if (type == 'create' && !queryParams.brand) {
message.error('请选择一个模具型号')
return
}
formVisible.value = true
await nextTick()
formRef.value.open(type, id, queryParams.brand)
}

@ -208,7 +208,7 @@
<Icon icon="ep:download" class="mr-5px" /> {{ t('action.export') }}
</el-button>
</div>
<el-table v-loading="tableLoading" :data="editableCriticalComponentRows" :stripe="true" :show-overflow-tooltip="true">
<el-table ref="tableRef" v-loading="tableLoading" :data="editableCriticalComponentRows" :stripe="true" :show-overflow-tooltip="true">
<el-table-column :label="t('EquipmentManagement.EquipmentLedger.componentCode')" align="center" prop="code" min-width="140" sortable />
<el-table-column :label="t('EquipmentManagement.EquipmentLedger.componentName')" align="center" prop="name" min-width="140" sortable />
<el-table-column :label="t('EquipmentManagement.EquipmentKeyItems.count')" align="center" prop="count" min-width="180">
@ -225,6 +225,15 @@
<el-table-column :label="t('EquipmentManagement.EquipmentLedger.componentDesc')" align="center" prop="description" min-width="180" />
<el-table-column :label="t('EquipmentManagement.EquipmentLedger.remark')" align="center" prop="remark" min-width="180" />
<el-table-column :label="t('EquipmentManagement.EquipmentLedger.createTime')" align="center" prop="createTime" :formatter="dateFormatter" width="180" sortable />
<el-table-column :label="t('EquipmentManagement.EquipmentLedger.operate')" align="center" min-width="160px"
fixed="right">
<template #default="scope">
<el-button link type="danger" @click="handleDelete(scope.row.id)"
v-hasPermi="['mes:device-ledger:delete']">
{{ t('EquipmentManagement.EquipmentLedger.delete') }}
</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
@ -232,7 +241,7 @@
</el-tabs>
</div>
<div class="device-ledger-action-bar" :style="actionBarStyle">
<el-button @click="handleCancelEdit">{{ t('common.cancel') }}</el-button>
<el-button @click="handleCancel">{{ t('common.cancel') }}</el-button>
<el-button type="primary" :loading="formLoading" :disabled="fileUploading" @click="submitForm">{{ t('common.save') }}</el-button>
</div>
</div>
@ -364,6 +373,7 @@ const message = useMessage()
const route = useRoute()
const { delView } = useTagsViewStore()
const { currentRoute } = useRouter()
const router = useRouter()
const appStore = useAppStore()
const deviceId = computed(() => Number(route.params.id))
const detailLoading = ref(false)
@ -384,6 +394,7 @@ const updateActionBarRect = () => {
actionBarStyle.width = rect.width + 'px'
}
const tableRef = ref()
const updateActionBarRectAfterLayout = () => {
nextTick(updateActionBarRect)
window.setTimeout(updateActionBarRect, 320)
@ -622,14 +633,12 @@ const selectedDeviceRows = ref<any[]>([])
const ids = ref<number[]>([])
const bjIds = ref<number[]>([])
const openCriticalComponentDialog = () => {
/* criticalComponentDraft.value = [...(formData.value.componentIds ?? [])]
criticalComponentDialogVisible.value = true
ids.value = [...(formData.value.componentIds ?? [])]
setDefaultSelections()*/
queryParams.name = ''
queryParams.description = ''
queryParams.code = ''
const rows = selectedDeviceRows.value.map((item) => ({ ...item, id: Number(item.id) }))
criticalComponentSelectDialogRef.value?.open(rows)
let initIds= formData.value.machineId!=undefined?formData.value.machineId.toString().split(","):[]
let initIds= formData.value.componentIds!=undefined?formData.value.componentIds.toString().split(","):[]
ids.value=initIds.map((id) => Number(id))
}
const openBeijianDialog = () => {
@ -1014,13 +1023,14 @@ const submitForm = async () => {
await DeviceLedgerApi.updateDeviceLedger(buildSubmitData())
message.success(t('common.updateSuccess'))
await getDetail()
getDetailList()
} finally {
formLoading.value = false
}
}
const handleCancelEdit = async () => {
await getDetail()
const handleCancel = async () => {
router.back()
}
const handleExportCriticalComponent = async () => {
if (!deviceId.value) return
@ -1111,6 +1121,7 @@ async function initForm() {
beijianIds: parseIdsValue((detail as any)?.beijianId),
qrcodeUrl: (detail as any)?.qrcodeUrl,
}
ids.value=parseIdsValue((detail as any)?.componentId)
savedCriticalComponentOptions.value = buildCriticalComponentOptions((detail as any)?.componentList ?? [])
savedBeijianOptions.value = buildBeijianOptions((detail as any)?.beijianList ?? [])
// syncCriticalComponentRows()
@ -1141,15 +1152,7 @@ const criticalComponentColumns = computed(() => [
const fetchCriticalComponentPage = async (params: Record<string, any>) => {
return await CriticalComponentApi.getCriticalComponentPage(params)
}
const handleCriticalComponentSelectConfirm = ({ ids: selectedIds, rows }: { ids: Array<number | string>; rows: any[] }) => {
/* selectedRows.value = rows
savedCriticalComponentOptions.value = mergeSelectionOptions(savedCriticalComponentOptions.value, buildCriticalComponentOptions(rows))
const selected = filterValidSelectedIds(
[...(formData.value.componentIds ?? []), ...selectedIds],
mergeSelectionOptions(savedCriticalComponentOptions.value, criticalComponentOptions.value)
)
formData.value.componentIds = selected
appendSelectedCriticalComponentRows(selected)*/
const handleCriticalComponentSelectConfirm = (payload: { ids: (number | string)[]; rows: any[] }) => {
formData.value.devices = payload.rows
.map((item) => {
const id = Number(item.id)
@ -1163,6 +1166,7 @@ const handleCriticalComponentSelectConfirm = ({ ids: selectedIds, rows }: { ids:
selectedDeviceRows.value = payload.rows
formData.value.machineId = payload.ids.join(',')
ids.value = payload.ids.map((id) => Number(id))
appendSelectedCriticalComponentRows(ids.value)
}
const buildCriticalComponentRowById = (id: number) => {
@ -1202,6 +1206,25 @@ const appendSelectedCriticalComponentRows = (selectedIds: number[]) => {
editableCriticalComponentRows.value = [...editableCriticalComponentRows.value, ...rowsToAppend]
}
}
/** 删除按钮操作 */
const buildIdsParam = (ids: number | number[]) => {
return Array.isArray(ids) ? ids.join(',') : String(ids)
}
const handleDelete = async (id: string) => {
try {
//
await message.delConfirm()
editableCriticalComponentRows.value = editableCriticalComponentRows.value.filter((item: any) => item.id !== id)
await DeviceLedgerApi.deleteDeviceCriticalComponent(id)
message.success(t('common.delSuccess'))
selectedIds.value = []
tableRef.value?.clearSelection?.()
//
//await getList()
} catch {
}
}
onMounted(async () => {
await ensureOptionsLoaded()

@ -1,13 +1,19 @@
<template>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<el-form
ref="formRef"
v-loading="formLoading"
:model="formData"
:rules="formRules"
label-width="auto"
class="system-menu-form"
>
<div class="system-menu-panel">
<div class="system-menu-panel__header">
<div class="system-menu-panel__title">{{ dialogTitle }}</div>
<el-button text @click="closeForm">
<Icon icon="ep:close" />
</el-button>
</div>
<div class="system-menu-dialog" v-loading="formLoading">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="auto"
class="system-menu-form"
>
<el-form-item :label="t('SystemManagement.Menu.parent')">
<el-tree-select
v-model="formData.parentId"
@ -111,11 +117,12 @@
</el-radio-group>
</el-form-item>
</el-form>
<template #footer>
</div>
<div class="system-menu-footer">
<el-button @click="closeForm">{{ t('common.cancel') }}</el-button>
<el-button :disabled="formLoading" type="primary" @click="submitForm">{{ t('common.ok') }}</el-button>
<el-button @click="dialogVisible = false">{{ t('common.cancel') }}</el-button>
</template>
</Dialog>
</div>
</div>
</template>
<script lang="ts" setup>
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
@ -131,7 +138,6 @@ const { wsCache } = useCache()
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
@ -164,7 +170,6 @@ const formRef = ref() // 表单 Ref
/** 打开弹窗 */
const open = async (type: string, id?: number, parentId?: number, currentClientType?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
clientType.value = currentClientType ?? 1
@ -187,7 +192,7 @@ const open = async (type: string, id?: number, parentId?: number, currentClientT
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const emit = defineEmits(['success', 'closed']) // success closed
const submitForm = async () => {
//
if (!formRef) return
@ -219,7 +224,7 @@ const submitForm = async () => {
await MenuApi.updateMenu(data as unknown as MenuApi.MenuVO)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
closeForm()
//
emit('success')
} finally {
@ -239,6 +244,10 @@ const getTree = async () => {
menuTree.value.push(menu)
}
const closeForm = () => {
emit('closed')
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
@ -267,3 +276,57 @@ const isExternal = (path: string) => {
return /^(https?:|mailto:|tel:)/.test(path)
}
</script>
<style lang="scss" scoped>
.system-menu-panel {
background: #fff;
border-radius: 12px;
box-shadow: var(--el-box-shadow-light);
}
.system-menu-panel__header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 20px;
border-bottom: 1px solid #ebeef5;
}
.system-menu-panel__title {
color: #1f2937;
font-size: 18px;
font-weight: 600;
}
.system-menu-dialog {
max-height: calc(100vh - 220px);
padding: 20px 20px 0;
padding-right: 16px;
overflow-y: auto;
}
.system-menu-footer {
display: flex;
justify-content: flex-end;
gap: 12px;
width: 100%;
padding: 16px 20px 20px;
border-top: 1px solid #ebeef5;
}
@media (max-width: 768px) {
.system-menu-panel__header {
padding: 14px 16px;
}
.system-menu-dialog {
max-height: none;
padding: 16px 16px 0;
overflow-y: visible;
}
.system-menu-footer {
padding: 16px;
}
}
</style>

@ -1,4 +1,6 @@
<template>
<div class="system-menu-page">
<div v-show="!formVisible">
<!-- Tabs 切换 Web/APP -->
<ContentWrap>
<el-tabs v-model="activeClientType" @tab-change="handleClientTypeChange">
@ -134,9 +136,11 @@
</el-table-column>
</el-table>
</ContentWrap>
</div>
<!-- 表单弹窗添加/修改 -->
<MenuForm ref="formRef" @success="getList" />
<!-- 表单添加/修改 -->
<MenuForm v-show="formVisible" ref="formRef" @success="getList" @closed="formVisible = false" />
</div>
</template>
<script lang="ts" setup>
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
@ -195,7 +199,10 @@ const resetQuery = () => {
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number, parentId?: number) => {
const formVisible = ref(false)
const openForm = async (type: string, id?: number, parentId?: number) => {
formVisible.value = true
await nextTick()
formRef.value.open(type, id, parentId, activeClientType.value)
}

Loading…
Cancel
Save