style: 修改备件管理中备件出库的新增/编辑弹框样式

main
zhongwenkai 2 weeks ago
parent e7abc6cfc7
commit 3671db55fc

@ -1,84 +1,92 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible" width="1080">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
:disabled="disabled"
>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item :label="t('SparePartsManagement.SpareOut.no')" prop="no">
<el-input
disabled
v-model="formData.no"
:placeholder="t('SparePartsManagement.SpareOut.placeholderNoAuto')"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="t('SparePartsManagement.SpareOut.outTime')" prop="outTime">
<el-date-picker
v-model="formData.outTime"
type="date"
value-format="x"
:placeholder="t('SparePartsManagement.SpareOut.placeholderOutTime')"
class="!w-1/1"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="t('SparePartsManagement.SpareOut.outType')" prop="outType">
<el-select
disabled
v-model="formData.outType"
clearable
filterable
:placeholder="t('SparePartsManagement.SpareOut.placeholderOutType')"
class="!w-1/1"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
:disabled="item.disabled"
<div class="stock-out-panel">
<div class="stock-out-panel__header">
<div class="stock-out-panel__title">{{ dialogTitle }}</div>
<el-button text @click="closeForm">
<Icon icon="ep:close" />
</el-button>
</div>
<div class="stock-out-dialog" v-loading="formLoading">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
:disabled="disabled"
>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item :label="t('SparePartsManagement.SpareOut.no')" prop="no">
<el-input
disabled
v-model="formData.no"
:placeholder="t('SparePartsManagement.SpareOut.placeholderNoAuto')"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="t('SparePartsManagement.SpareOut.outTime')" prop="outTime">
<el-date-picker
v-model="formData.outTime"
type="date"
value-format="x"
:placeholder="t('SparePartsManagement.SpareOut.placeholderOutTime')"
class="!w-1/1"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="t('SparePartsManagement.SpareOut.remark')" prop="remark">
<el-input
type="textarea"
v-model="formData.remark"
:rows="1"
:placeholder="t('SparePartsManagement.SpareOut.placeholderRemark')"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- 子表的表单 -->
<ContentWrap>
<el-tabs v-model="subTabsName" class="-mt-15px -mb-10px">
<el-tab-pane :label="t('SparePartsManagement.SpareOut.itemListTitle')" name="item">
<StockOutItemForm ref="itemFormRef" :items="formData.items" :disabled="disabled" />
</el-tab-pane>
</el-tabs>
</ContentWrap>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading" v-if="!disabled">
{{ t('action.save') }}
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="t('SparePartsManagement.SpareOut.outType')" prop="outType">
<el-select
disabled
v-model="formData.outType"
clearable
filterable
:placeholder="t('SparePartsManagement.SpareOut.placeholderOutType')"
class="!w-1/1"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
:disabled="item.disabled"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="t('SparePartsManagement.SpareOut.remark')" prop="remark">
<el-input
type="textarea"
v-model="formData.remark"
:rows="1"
:placeholder="t('SparePartsManagement.SpareOut.placeholderRemark')"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- 子表的表单 -->
<ContentWrap>
<el-tabs v-model="subTabsName" class="-mt-15px -mb-10px">
<el-tab-pane :label="t('SparePartsManagement.SpareOut.itemListTitle')" name="item">
<StockOutItemForm ref="itemFormRef" :items="formData.items" :disabled="disabled" />
</el-tab-pane>
</el-tabs>
</ContentWrap>
</div>
<div class="stock-out-footer">
<el-button @click="closeForm">{{ t('common.cancel') }}</el-button>
<el-button v-if="!disabled" @click="submitForm" type="primary" :disabled="formLoading">
{{ t('common.ok') }}
</el-button>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button>
</template>
</Dialog>
</div>
</div>
</template>
<script setup lang="ts">
import { StockOutApi, StockOutVO } from '@/api/erp/stock/out'
@ -92,7 +100,6 @@ defineOptions({ name: 'StockOutForm' })
const { t } = useI18n() //
const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update - detail -
@ -146,7 +153,6 @@ const itemFormRef = ref()
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
resetForm()
@ -163,8 +169,12 @@ const open = async (type: string, id?: number) => {
}
defineExpose({ open }) // open
const closeForm = () => {
emit('closed')
}
/** 提交表单 */
const emit = defineEmits(['success']) // success
const emit = defineEmits(['success', 'closed']) // success closed
const submitForm = async () => {
//
await formRef.value.validate()
@ -180,9 +190,9 @@ const submitForm = async () => {
await StockOutApi.updateStockOut(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
closeForm()
} finally {
formLoading.value = false
}
@ -201,3 +211,57 @@ const resetForm = () => {
formRef.value?.resetFields()
}
</script>
<style lang="scss" scoped>
.stock-out-panel {
background: #fff;
border-radius: 12px;
box-shadow: var(--el-box-shadow-light);
}
.stock-out-panel__header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 20px;
border-bottom: 1px solid #ebeef5;
}
.stock-out-panel__title {
color: #1f2937;
font-size: 18px;
font-weight: 600;
}
.stock-out-dialog {
max-height: calc(100vh - 220px);
padding: 20px 20px 0;
padding-right: 16px;
overflow-y: auto;
}
.stock-out-footer {
display: flex;
justify-content: flex-end;
gap: 12px;
width: 100%;
padding: 16px 20px 20px;
border-top: 1px solid #ebeef5;
}
@media (max-width: 768px) {
.stock-out-panel__header {
padding: 14px 16px;
}
.stock-out-dialog {
max-height: none;
padding: 16px 16px 0;
overflow-y: visible;
}
.stock-out-footer {
padding: 16px;
}
}
</style>

@ -1,6 +1,7 @@
<template>
<ContentWrap>
<div class="stock-out-page">
<template v-if="!formVisible">
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
@ -211,9 +212,10 @@
@pagination="getList"
/>
</ContentWrap>
</template>
<!-- 表单弹窗添加/修改 -->
<StockOutForm ref="formRef" @success="getList" />
<StockOutForm v-else ref="formRef" @success="getList" @closed="formVisible = false" />
</div>
</template>
<script setup lang="ts">
@ -289,8 +291,12 @@ const resetQuery = () => {
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
const formVisible = ref(false)
const openForm = async (type: string, id?: number) => {
formVisible.value = true
await nextTick()
formRef.value?.open(type, id)
}
/** 删除按钮操作 */

Loading…
Cancel
Save