Browse Source

新增,详情

master
zhangli 1 year ago
parent
commit
9c3806e7c0
  1. 5
      src/components/Descriptions/src/Descriptions.vue
  2. 2
      src/components/Form/src/Form.vue
  3. 22
      src/router/modules/remaining.ts
  4. 84
      src/utils/disposition/tableColumns.ts
  5. 47
      src/views/detail/detail/index.vue
  6. 150
      src/views/wms/itembasic/ItembasicDetail.vue
  7. 189
      src/views/wms/itembasic/ItembasicForm.vue
  8. 27
      src/views/wms/itembasic/index.vue

5
src/components/Descriptions/src/Descriptions.vue

@ -21,6 +21,7 @@ const props = defineProps({
message: propTypes.string.def(''),
collapse: propTypes.bool.def(true),
columns: propTypes.number.def(1),
minWidth: propTypes.string.def('20px'),
schema: {
type: Array as PropType<DescriptionsSchema[]>,
default: () => []
@ -94,7 +95,7 @@ const toggleClick = () => {
</div>
<ElCollapseTransition>
<div v-show="show" :class="[`${prefixCls}-content`, 'p-10px']">
<div v-show="show" :class="[`${prefixCls}-content`]">
<ElDescriptions
:column="props.columns"
:direction="mobile ? 'vertical' : 'horizontal'"
@ -107,8 +108,8 @@ const toggleClick = () => {
<ElDescriptionsItem
v-for="item in schema"
:key="item.field"
min-width="80"
v-bind="getBindItemValue(item)"
label-align="right"
>
<template #label>
<slot

2
src/components/Form/src/Form.vue

@ -166,7 +166,7 @@ export default defineComponent({
<Com {...{ contentPosition: 'left', ...item.componentProps }}>{item?.label}</Com>
) : isCol ? (
// ElCol
<ElCol {...setGridProp(item.colProps)}>{renderFormItem(item)}</ElCol>
<ElCol {...setGridProp(item.colProps)}>{renderFormItem(item)}</ElCol>
) : (
renderFormItem(item)
)

22
src/router/modules/remaining.ts

@ -329,6 +329,28 @@ const remainingRouter: AppRouteRecordRaw[] = [
}
}
]
},
{
path: '/wms',
component: Layout,
name: 'wms',
meta: {
hidden: true
},
children: [
{
path: '/wms/itembasic-manage/itembasic-detail',
component: () => import('@/views/wms/itembasic/ItembasicDetail.vue'),
name: 'ItembasicDetail',
meta: {
noCache: true,
hidden: true,
canTo: true,
title: '物品详情',
activeMenu: '/wms/itembasic-manage/itembasic'
}
}
]
}
]

84
src/utils/disposition/tableColumns.ts

@ -193,16 +193,18 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
field: 'createTime',
isTable: true,
formatter: dateFormatter,
isForm: false,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
}
},
{ label: '备注', field: 'remark', isTable: false },
{ label: '创建者ID', field: 'creator', isTable: false },
{ label: '创建者ID', field: 'creator', isTable: false, isForm: false },
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false ,
table: {
width: 150
}
@ -211,19 +213,75 @@ export const ItemBasic = useCrudSchemas(reactive<CrudSchema[]>([
// 表单校验
export const ItemBasicRules = reactive({
mail: [
{ required: true, message: 'profile.rules.mail', trigger: 'blur' },
{
type: 'email',
message: 'profile.rules.truemail',
trigger: ['blur', 'change']
}
code: [
{ required: true, message: '请输入代码', trigger: 'blur' }
],
name: [
{ required: true, message: '请输入名称', trigger: 'blur' }
],
status: [
{ required: true, message: '请选择状态', trigger: 'change' }
],
uom: [
{ required: true, message: '请选择计量单位', trigger: 'change' }
],
altUom: [
{ required: true, message: '请选择替代计量单位', trigger: 'change' }
],
isStdPack: [
{ required: true, message: '请选择是否标包', trigger: 'change' }
],
enableBuy: [
{ required: true, message: '请选择是否可采购', trigger: 'change' }
],
enableMake: [
{ required: true, message: '请选择是否可制造', trigger: 'change' }
],
enableOutsourcing: [
{ required: true, message: '请选择是否可委外加工', trigger: 'change' }
],
isRecycled: [
{ required: true, message: '请选择回收件', trigger: 'change' }
],
isPhantom: [
{ required: true, message: '请选择虚零件', trigger: 'change' }
],
abcClass: [
{ required: true, message: '请选择ABC类', trigger: 'change' }
],
type: [
{ required: true, message: '请选择类型', trigger: 'change' }
],
category: [
{ required: true, message: '请选择种类', trigger: 'change' }
],
itemGroup: [
{ required: true, message: '请选择分组', trigger: 'change' }
],
color: [
{ required: true, message: '请选择颜色', trigger: 'change' }
],
configuration: [
{ required: true, message: '请选择配置', trigger: 'change' }
],
project: [
{ required: true, message: '请输入项目', trigger: 'blur' }
],
eqLevel: [
{ required: true, message: '请选择质量等级', trigger: 'change' }
],
validityDays: [
{ required: true, message: '请输入有效天数', trigger: 'change' }
],
available: [
{ required: true, message: '请选择是否可用', trigger: 'change' }
],
activeTime: [
{ required: true, message: '请输入生效时间', trigger: 'change' }
],
expireTime: [
{ required: true, message: '请输入失效时间', trigger: 'change' }
],
username: [required],
password: [required],
host: [required],
port: [required],
sslEnable: [required]
})
/**

47
src/views/detail/detail/index.vue

@ -18,7 +18,7 @@
<div class="flex">
<!-- 详情 -->
<ContentWrap class="w-[73%]">
1
<Form ref="formRef" v-loading="formLoading" :rules="rules" :schema="ItemBasic.allSchemas.formSchema" :is-col="true"/>
</ContentWrap>
<ContentWrap class="w-[27%] ml-16px">
<!-- 附件组件 -->
@ -39,7 +39,11 @@ import Annex from '@/components/Annex/src/Annex.vue'
import Remarks from '@/components/Remarks/src/Remarks.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import ChangeRecord from '@/components/ChangeRecord/src/ChangeRecord.vue'
import { ItemBasic } from '@/utils/disposition/tableColumns.ts'
import * as UserApi from '@/api/system/user'
//
const queryParams = reactive({
title: '',
@ -49,7 +53,7 @@ const queryParams = reactive({
pageSize: 100
})
const queryFormRef = ref() //
// const formLabel = ref(ItemBasic)//formlabel
//
const annexData = reactive({
annexList: [{
@ -133,4 +137,43 @@ const deleteAnnexSuccess = async () => {
const remarksSubmitSucss=()=>{
console.log('提交陈工');
}
import * as MailAccountApi from '@/api/system/mail/account'
import { allSchemas, rules } from '@/views/system/mail/account/account.data'
const { t } = useI18n() //
const message = useMessage() //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formRef = ref() // Ref
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
if (!formRef) return
const valid = await formRef.value.getElFormRef().validate()
if (!valid) return
//
formLoading.value = true
try {
const data = formRef.value.formModel as MailAccountApi.MailAccountVO
if (formType.value === 'create') {
await MailAccountApi.createMailAccount(data)
message.success(t('common.createSuccess'))
} else {
await MailAccountApi.updateMailAccount(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
</script>

150
src/views/wms/itembasic/ItembasicDetail.vue

@ -0,0 +1,150 @@
<template>
<!-- 搜索工作栏 -->
<ContentWrap>
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
<el-form-item label="部门名称" prop="title">
<el-input v-model="queryParams.name" placeholder="请输入部门名称" clearable class="!w-240px" />
</el-form-item>
<el-form-item>
<el-button type="info" plain @click="handleQuery">
<Icon icon="ep:search" class="mr-5px" /> 搜索
</el-button>
<el-button type="info" plain @click="resetQuery">
<Icon icon="ep:refresh" class="mr-5px" /> 重置
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<div class="flex">
<!-- 详情 -->
<ContentWrap class="w-[73%]">
<Descriptions :data="detailData" :schema="ItemBasic.allSchemas.detailSchema" :columns="2"/>
</ContentWrap>
<ContentWrap class="w-[27%] ml-16px">
<!-- 附件组件 -->
<Annex :data="annexData" @handleImport="handleImport" @deleteAnnex="deleteAnnexSuccess" />
<!-- 备注组件 -->
<Remarks :data="remarksData" class="mt-20px" @submitSucss="remarksSubmitSucss" />
<!-- 变更记录组件 -->
<ChangeRecord :data="changeRecordData" class="mt-20px" />
</ContentWrap>
<!-- 用户导入对话框 -->
<ImportForm ref="importFormRef" :importTemplateData="importTemplateData" @success="importSuccess" />
</div>
</template>
<script lang="ts" setup>
defineOptions({ name: 'Detail' })
import Annex from '@/components/Annex/src/Annex.vue'
import Remarks from '@/components/Remarks/src/Remarks.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import ChangeRecord from '@/components/ChangeRecord/src/ChangeRecord.vue'
import { ItemBasic } from '@/utils/disposition/tableColumns.ts'
import { getItembasic } from '@/api/wms/itembasic'
import * as UserApi from '@/api/system/user'
//
const queryParams = reactive({
title: '',
name: undefined,
status: undefined,
pageNo: 1,
pageSize: 100
})
const queryFormRef = ref() //
// const formLabel = ref(ItemBasic)//formlabel
//
const annexData = reactive({
annexList: [{
title: '文件名文件名2023-12-12.docx',
size: '150.02KB',
people: '贾先生',
time: '2023年5月6日 17:16:00',
}, {
title: '文件名文件名2023-12-15.docx',
size: '242KB',
people: '张张',
time: '2022年12月12日 17:16:00',
}]
})
//
const remarksData = reactive({
remarksList: [{
name: '诸葛亮',
text: '转朱阁,低绮户,照无眠。不应有恨,何事长向别时圆?人有悲欢离合,月有阴晴圆缺,此事古难全。但愿人长久,千里共婵娟。',
time: '2023年5月6日 17:16:00',
}, {
name: '刘备',
text: '转朱阁,低绮户,照无眠。不应有恨,何事长向别时圆?人有悲欢离合,月有阴晴圆缺,此事古难全。但愿人长久,千里共婵娟。',
time: '2022年12月12日 17:16:00',
}]
})
//
const changeRecordData = reactive({
changeRecordList: [{
name: '诸葛亮',
type: 1,
time: '2023年5月6日 17:16:00',
}, {
name: '刘备',
type: 2,
time: '2023年5月6日 17:16:00',
}, {
name: '曹操',
type: 3,
time: '2023年5月6日 17:16:00',
file: [{
name: '这是个附件的名字.docx',
url: 'http://localhost:12080/admin-api/system/user/get-import-template'
}, {
name: '这是个附件的名字.docx',
url: 'http://localhost:12080/admin-api/system/user/get-import-template'
}]
}]
})
//
const importTemplateData = reactive({
templateUrl: UserApi.importUserTemplate(),
templateTitle: '导入模版99.xls'
})
//
const importSuccess = () => {
}
/** 搜索按钮操作 */
const handleQuery = () => {
}
/** 重置按钮操作 */
const resetQuery = () => {
queryParams.pageNo = 1
queryFormRef.value.resetFields()
}
/** 用户导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const deleteAnnexSuccess = async () => {
console.log('删除成功');
}
//
const remarksSubmitSucss = () => {
console.log('提交陈工');
}
const detailData = ref()
const { query } = useRoute() //
console.log(query);
onMounted(async () => {
//
detailData.value =await getItembasic(query.id)
})
</script>

189
src/views/wms/itembasic/ItembasicForm.vue

@ -1,192 +1,8 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible">
<div class="p-20px m--10px" style="max-height: 600px;overflow-y: auto;">
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px" v-loading="formLoading"
>
<el-row>
<el-col :span="12">
<el-form-item label="代码" prop="code">
<el-input v-model="formData.code" placeholder="请输入代码" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="名称" prop="name">
<el-input v-model="formData.name" placeholder="请输入名称" />
</el-form-item>
<div class="p-20px m--10px" style="max-height: 500px;overflow-y: auto;">
<Form ref="formRef" v-loading="formLoading" :rules="ItemBasicRules" :schema="ItemBasic.allSchemas.formSchema" :is-col="true"/>
</el-col>
<el-col :span="12">
<el-form-item label="描述1" prop="desc1">
<el-input v-model="formData.desc1" placeholder="请输入描述1" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="描述2" prop="desc2">
<el-input v-model="formData.desc2" placeholder="请输入描述2" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="状态" prop="status">
<el-select v-model="formData.status" placeholder="请选择状态">
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.ITEM_STATUS)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="计量单位" prop="uom">
<el-select v-model="formData.uom" placeholder="请选择计量单位">
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.UOM)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="替代计量单位" prop="altUom">
<el-select v-model="formData.altUom" placeholder="请选择替代计量单位">
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.UOM)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否标包" prop="isStdPack">
<el-select v-model="formData.isStdPack" placeholder="请选择是否标包">
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.TRUE_FALSE)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="可采购" prop="enableBuy">
<el-select v-model="formData.enableBuy" placeholder="请选择可采购">
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.TRUE_FALSE)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="可制造" prop="enableMake">
<el-select v-model="formData.enableMake" placeholder="请选择可制造">
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.TRUE_FALSE)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="可委外加工" prop="enableOutsourcing">
<el-select v-model="formData.enableOutsourcing" placeholder="请选择可委外加工">
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.TRUE_FALSE)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="回收件" prop="isRecycled">
<el-select v-model="formData.isRecycled" placeholder="请选择回收件">
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.TRUE_FALSE)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="虚零件" prop="isPhantom">
<el-select v-model="formData.isPhantom" placeholder="请选择虚零件">
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.TRUE_FALSE)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="ABC类" prop="abcClass">
<el-select v-model="formData.abcClass" placeholder="请选择ABC类">
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.ABC_CLASS)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="类型" prop="type">
<el-select v-model="formData.type" placeholder="请选择类型">
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.ITEM_TYPE)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="种类" prop="category">
<el-select v-model="formData.category" placeholder="请选择种类">
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.ITEM_CATEGORY)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分组" prop="itemGroup">
<el-select v-model="formData.itemGroup" placeholder="请选择分组">
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.ITEM_GROUP)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="颜色" prop="color">
<el-select v-model="formData.color" placeholder="请选择颜色">
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.ITEM_COLOR)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="配置" prop="configuration">
<el-select v-model="formData.configuration" placeholder="请选择配置">
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.ITEM_CONFIGURATION)" :key="dict.value"
:label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="项目" prop="project">
<el-input v-model="formData.project" placeholder="请输入项目" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="质量等级" prop="eqLevel">
<el-select v-model="formData.eqLevel" placeholder="请选择质量等级">
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.EQ_LEVEL)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="有效天数" prop="validityDays">
<el-input v-model="formData.validityDays" placeholder="请输入有效天数" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否可用" prop="available">
<el-input v-model="formData.available" placeholder="请输入是否可用" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="生效时间" prop="activeTime">
<el-date-picker style="width: 100%;" v-model="formData.activeTime" type="date" value-format="x"
placeholder="选择生效时间" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="失效时间" prop="expireTime">
<el-date-picker style="width: 100%;" v-model="formData.expireTime" type="date" value-format="x"
placeholder="选择失效时间" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
@ -198,6 +14,7 @@
<script setup lang="ts">
import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict'
import * as ItembasicApi from '@/api/wms/itembasic'
import { ItemBasic, ItemBasicRules } from '@/utils/disposition/tableColumns.ts'
const { t } = useI18n() //
const message = useMessage() //

27
src/views/wms/itembasic/index.vue

@ -2,6 +2,10 @@
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="ItemBasic.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
  <el-button type="primary" @click="openForm('create')">
      <Icon icon="ep:plus" class="mr-5px" /> 新增
    </el-button>
<!-- <el-form
class="-mb-15px"
:model="queryParams"
@ -388,6 +392,14 @@
>
编辑
</el-button>
<el-button
link
type="primary"
@click="openDetail(row.id)"
v-hasPermi="['wms:itembasic:update']"
>
详情
</el-button>
<el-button
link
type="danger"
@ -400,15 +412,17 @@
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<ItembasicForm ref="formRef" @success="getList" />
<!-- 表单弹窗添加/修改 -->
<ItembasicForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import * as ItembasicApi from '@/api/wms/itembasic'
import ItembasicForm from './ItembasicForm.vue'
import ItembasicDetail from './ItembasicDetail.vue'
import { ItemBasic } from '@/utils/disposition/tableColumns'
const router = useRouter() //
// tableObject
// tableMethods
@ -465,6 +479,15 @@ const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
const openDetail = (id?: number) => {
// detailRef.value.open(id)
router.push({
path: '/wms/itembasic-manage/itembasic-detail',
query:{
id
}
})
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {

Loading…
Cancel
Save