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

main
zhongwenkai 3 weeks ago
parent e7abc6cfc7
commit 3671db55fc

@ -1,84 +1,92 @@
<template> <template>
<Dialog :title="dialogTitle" v-model="dialogVisible" width="1080"> <div class="stock-out-panel">
<el-form <div class="stock-out-panel__header">
ref="formRef" <div class="stock-out-panel__title">{{ dialogTitle }}</div>
:model="formData" <el-button text @click="closeForm">
:rules="formRules" <Icon icon="ep:close" />
label-width="100px" </el-button>
v-loading="formLoading" </div>
:disabled="disabled" <div class="stock-out-dialog" v-loading="formLoading">
> <el-form
<el-row :gutter="20"> ref="formRef"
<el-col :span="8"> :model="formData"
<el-form-item :label="t('SparePartsManagement.SpareOut.no')" prop="no"> :rules="formRules"
<el-input label-width="100px"
disabled :disabled="disabled"
v-model="formData.no" >
:placeholder="t('SparePartsManagement.SpareOut.placeholderNoAuto')" <el-row :gutter="20">
/> <el-col :span="8">
</el-form-item> <el-form-item :label="t('SparePartsManagement.SpareOut.no')" prop="no">
</el-col> <el-input
disabled
<el-col :span="8"> v-model="formData.no"
<el-form-item :label="t('SparePartsManagement.SpareOut.outTime')" prop="outTime"> :placeholder="t('SparePartsManagement.SpareOut.placeholderNoAuto')"
<el-date-picker />
v-model="formData.outTime" </el-form-item>
type="date" </el-col>
value-format="x"
:placeholder="t('SparePartsManagement.SpareOut.placeholderOutTime')" <el-col :span="8">
class="!w-1/1" <el-form-item :label="t('SparePartsManagement.SpareOut.outTime')" prop="outTime">
/> <el-date-picker
</el-form-item> v-model="formData.outTime"
</el-col> type="date"
<el-col :span="8"> value-format="x"
<el-form-item :label="t('SparePartsManagement.SpareOut.outType')" prop="outType"> :placeholder="t('SparePartsManagement.SpareOut.placeholderOutTime')"
<el-select class="!w-1/1"
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-form-item> </el-col>
</el-col> <el-col :span="8">
<el-form-item :label="t('SparePartsManagement.SpareOut.outType')" prop="outType">
<el-select
<el-col :span="8"> disabled
<el-form-item :label="t('SparePartsManagement.SpareOut.remark')" prop="remark"> v-model="formData.outType"
<el-input clearable
type="textarea" filterable
v-model="formData.remark" :placeholder="t('SparePartsManagement.SpareOut.placeholderOutType')"
:rows="1" class="!w-1/1"
:placeholder="t('SparePartsManagement.SpareOut.placeholderRemark')" >
/> <el-option
</el-form-item> v-for="item in options"
</el-col> :key="item.value"
</el-row> :label="item.label"
</el-form> :value="item.value"
<!-- 子表的表单 --> :disabled="item.disabled"
<ContentWrap> />
<el-tabs v-model="subTabsName" class="-mt-15px -mb-10px"> </el-select>
<el-tab-pane :label="t('SparePartsManagement.SpareOut.itemListTitle')" name="item"> </el-form-item>
<StockOutItemForm ref="itemFormRef" :items="formData.items" :disabled="disabled" /> </el-col>
</el-tab-pane>
</el-tabs>
</ContentWrap> <el-col :span="8">
<template #footer> <el-form-item :label="t('SparePartsManagement.SpareOut.remark')" prop="remark">
<el-button @click="submitForm" type="primary" :disabled="formLoading" v-if="!disabled"> <el-input
{{ t('action.save') }} 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>
<el-button @click="dialogVisible = false">{{ t('dialog.close') }}</el-button> </div>
</template> </div>
</Dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { StockOutApi, StockOutVO } from '@/api/erp/stock/out' import { StockOutApi, StockOutVO } from '@/api/erp/stock/out'
@ -92,7 +100,6 @@ defineOptions({ name: 'StockOutForm' })
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
const dialogVisible = ref(false) //
const dialogTitle = ref('') // const dialogTitle = ref('') //
const formLoading = ref(false) // 12 const formLoading = ref(false) // 12
const formType = ref('') // create - update - detail - const formType = ref('') // create - update - detail -
@ -146,7 +153,6 @@ const itemFormRef = ref()
/** 打开弹窗 */ /** 打开弹窗 */
const open = async (type: string, id?: number) => { const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type) dialogTitle.value = t('action.' + type)
formType.value = type formType.value = type
resetForm() resetForm()
@ -163,8 +169,12 @@ const open = async (type: string, id?: number) => {
} }
defineExpose({ open }) // open defineExpose({ open }) // open
const closeForm = () => {
emit('closed')
}
/** 提交表单 */ /** 提交表单 */
const emit = defineEmits(['success']) // success const emit = defineEmits(['success', 'closed']) // success closed
const submitForm = async () => { const submitForm = async () => {
// //
await formRef.value.validate() await formRef.value.validate()
@ -180,9 +190,9 @@ const submitForm = async () => {
await StockOutApi.updateStockOut(data) await StockOutApi.updateStockOut(data)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} }
dialogVisible.value = false
// //
emit('success') emit('success')
closeForm()
} finally { } finally {
formLoading.value = false formLoading.value = false
} }
@ -201,3 +211,57 @@ const resetForm = () => {
formRef.value?.resetFields() formRef.value?.resetFields()
} }
</script> </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> <template>
<div class="stock-out-page">
<ContentWrap> <template v-if="!formVisible">
<ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form <el-form
class="-mb-15px" class="-mb-15px"
@ -211,9 +212,10 @@
@pagination="getList" @pagination="getList"
/> />
</ContentWrap> </ContentWrap>
</template>
<!-- 表单弹窗添加/修改 --> <StockOutForm v-else ref="formRef" @success="getList" @closed="formVisible = false" />
<StockOutForm ref="formRef" @success="getList" /> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -289,8 +291,12 @@ const resetQuery = () => {
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const formRef = ref()
const openForm = (type: string, id?: number) => { const formVisible = ref(false)
formRef.value.open(type, id)
const openForm = async (type: string, id?: number) => {
formVisible.value = true
await nextTick()
formRef.value?.open(type, id)
} }
/** 删除按钮操作 */ /** 删除按钮操作 */

Loading…
Cancel
Save