陈薪名 1 year ago
parent
commit
c400c01cc4
  1. 5
      src/api/wms/workstation/index.ts
  2. 6
      src/utils/disposition/defaultButtons.ts
  3. 124
      src/views/wms/itembasic/ItembasicDetail.vue
  4. 87
      src/views/wms/itembasic/ItembasicForm.vue
  5. 2
      src/views/wms/itempackaging/index.vue
  6. 4
      src/views/wms/workstation/WorkstationForm.vue
  7. 134
      src/views/wms/workstation/WorkstationImportForm.vue
  8. 21
      src/views/wms/workstation/index.vue

5
src/api/wms/workstation/index.ts

@ -44,3 +44,8 @@ export const deleteWorkstation = async (id: number) => {
export const exportWorkstation = async (params) => {
return await request.download({ url: `/wms/workstation/export-excel`, params })
}
// 下载用户导入模板
export const importWorkstationTemplate = () => {
return request.download({ url: '/wms/workstation/get-import-template' })
}

6
src/utils/disposition/defaultButtons.ts

@ -119,7 +119,8 @@ export function formSaveBtn(option:any) {
hide: false,
type: 'primary',
icon: 'ep:select',
color: ''
color: '',
float:'right'
})
}
@ -130,7 +131,8 @@ export function formCloseBtn(option:any) {
name: 'close',
hide: false,
icon: 'ep:closeBold',
color: ''
color: '',
float:'right'
})
}

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

@ -1,37 +1,37 @@
<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>
<div class="font-size-18px">
{{ detailData.code }} <span class="ml-20px font-size-16px">{{ detailData.name }}</span>
</div>
</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>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane label="详情" name="Detail">
<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>
</el-tab-pane>
<el-tab-pane :label="item.value" :name="item.label" v-for="(item,index) in tabs" :key="index">
<ContentWrap>
<Table :columns="ItemBasic.allSchemas.tableColumns" :data="tableObject.tableList" :loading="tableObject.loading"
:pagination="{
total: tableObject.total
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" />
</ContentWrap>
</el-tab-pane>
</el-tabs>
</template>
<script lang="ts" setup>
@ -42,11 +42,13 @@ 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'
const { query } = useRoute() //
import * as ItembasicApi from '@/api/wms/itembasic'
import * as UserApi from '@/api/system/user'
const activeName = ref('Detail')
//
const queryParams = reactive({
title: '',
@ -107,6 +109,11 @@ const changeRecordData = reactive({
}]
}]
})
const detailData = ref("")//
onMounted(async () => {
//
detailData.value = await getItembasic(query.id)
})
//
const importTemplateData = reactive({
templateUrl: UserApi.importUserTemplate(),
@ -138,13 +145,52 @@ const deleteAnnexSuccess = async () => {
}
//
const remarksSubmitSucss = () => {
console.log('提交陈工');
console.log('提交成功');
}
const detailData = ref()
const { query } = useRoute() //
console.log(query);
onMounted(async () => {
//
detailData.value =await getItembasic(query.id)
//
// const supplierItems = reactive({
// supplierItemsList: [{
// code: '646456',
// name: '978978'
// }],
// total: 20,
// pageSize: 1,
// currentPage: 2
// })
// tabs
const tabs = ref([{
value:'供应商物品',
label:'SupplierItems'
}, {
value: '客户物品',
label: 'CustomerItems'
}, {
value: '采购订单',
label: 'PurchaseOrder'
}, {
value: '要货计划',
label: 'PurchasingPlan'
}, {
value: '库存余额',
label: 'InventoryBalance'
}, {
value: '库存事务',
label: 'InventoryTransactions'
}, {
value: '预计入库存',
label: 'ExpectedIn'
}, {
value: '预计出库存',
label: 'ExpectedOut'
}])
//
const { tableObject, tableMethods } = useTable({
getListApi: ItembasicApi.getItembasicPage //
})
console.log(tableObject);
//
const { getList, setSearchParams } = tableMethods
getList()
</script>

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

@ -5,8 +5,13 @@
</div>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
<!-- <el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button> -->
<!-- 列表头部 -->
<TableHead
:HeadButttondata="Butttondata"
@buttonBaseClick="buttonBaseClick"
/>
</template>
</Dialog>
@ -15,6 +20,7 @@
import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict'
import * as ItembasicApi from '@/api/wms/itembasic'
import { ItemBasic, ItemBasicRules } from '@/utils/disposition/tableColumns.ts'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
const { t } = useI18n() //
const message = useMessage() //
@ -23,49 +29,6 @@ const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
code: undefined,
name: undefined,
desc1: undefined,
desc2: undefined,
status: undefined,
uom: undefined,
altUom: undefined,
isStdPack: undefined,
enableBuy: undefined,
enableMake: undefined,
enableOutsourcing: undefined,
isRecycled: undefined,
isPhantom: undefined,
abcClass: undefined,
type: undefined,
category: undefined,
itemGroup: undefined,
color: undefined,
configuration: undefined,
project: undefined,
eqLevel: undefined,
validityDays: undefined,
available: undefined,
activeTime: undefined,
expireTime: undefined,
remark: undefined
})
const formRules = reactive({
code: [{ required: true, message: '代码不能为空', trigger: 'blur' }],
status: [{ required: true, message: '状态不能为空', trigger: 'change' }],
uom: [{ 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' }],
validityDays: [{ required: true, message: '有效天数不能为空', trigger: 'blur' }],
available: [{ required: true, message: '是否可用不能为空', trigger: 'blur' }]
})
const formRef = ref() // Ref
/** 打开弹窗 */
@ -75,14 +38,14 @@ const open = async (type: string, id?: number) => {
formType.value = type
resetForm()
//
if (id) {
formLoading.value = true
try {
formData.value = await ItembasicApi.getItembasic(id)
} finally {
formLoading.value = false
}
}
// if (id) {
// formLoading.value = true
// try {
// formData.value = await ItembasicApi.getItembasic(id)
// } finally {
// formLoading.value = false
// }
// }
}
defineExpose({ open }) // open
@ -144,6 +107,24 @@ const resetForm = () => {
}
formRef.value?.resetFields()
}
//
const Butttondata = [
defaultButtons.formSaveBtn(null), //
defaultButtons.formCloseBtn(null), //
]
//
const buttonBaseClick = (val, item) => {
//
if (val == 'save') {
console.log(417, item)
}
//
else if (val == 'close') {
dialogVisible.value = false
}
}
</script>
<style scoped>

2
src/views/wms/itempackaging/index.vue

@ -174,6 +174,8 @@ const HeadButttondata = [
// color: ''
// },
]
console.log(HeadButttondata);
//
const buttonBaseClick = (val, item) => {

4
src/views/wms/workstation/WorkstationForm.vue

@ -66,7 +66,7 @@
<el-form-item label="是否可用" prop="available">
<el-select v-model="formData.available" placeholder="请选择是否可用">
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.TRUE_FALSE)"
v-for="dict in getStrDictOptions(DICT_TYPE.TRUE_FALSE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -110,7 +110,7 @@
</Dialog>
</template>
<script setup lang="ts">
import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import * as WorkstationApi from '@/api/wms/workstation'
const { t } = useI18n() //

134
src/views/wms/workstation/WorkstationImportForm.vue

@ -0,0 +1,134 @@
<template>
<Dialog v-model="dialogVisible" title="工位信息导入" width="400">
<el-upload
ref="uploadRef"
v-model:file-list="fileList"
:action="importUrl + '?updateSupport=' + updateSupport"
:auto-upload="false"
:disabled="formLoading"
:headers="uploadHeaders"
:limit="1"
:on-error="submitFormError"
:on-exceed="handleExceed"
:on-success="submitFormSuccess"
accept=".xlsx, .xls"
drag
>
<Icon icon="ep:upload" />
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<template #tip>
<div class="el-upload__tip text-center">
<div class="el-upload__tip">
<el-checkbox v-model="updateSupport" />
是否更新已经存在的工位信息数据
</div>
<span>仅允许导入 xlsxlsx 格式文件</span>
<el-link
:underline="false"
style="font-size: 12px; vertical-align: baseline"
type="primary"
@click="importTemplate"
>
下载模板
</el-link>
</div>
</template>
</el-upload>
<template #footer>
<el-button :disabled="formLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
</Dialog>
</template>
<script lang="ts" setup>
import * as WorkstationApi from '@/api/wms/workstation'
import { getAccessToken, getTenantId } from '@/utils/auth'
import download from '@/utils/download'
defineOptions({ name: 'WmsItembasicImportForm' })
const message = useMessage() //
const dialogVisible = ref(false) //
const formLoading = ref(false) //
const uploadRef = ref()
const importUrl =
import.meta.env.VITE_BASE_URL + import.meta.env.VITE_API_URL + '/wms/workstation/import'
const uploadHeaders = ref() // Header
const fileList = ref([]) //
const updateSupport = ref(0) //
/** 打开弹窗 */
const open = () => {
dialogVisible.value = true
resetForm()
}
defineExpose({ open }) // open
/** 提交表单 */
const submitForm = async () => {
if (fileList.value.length == 0) {
message.error('请上传文件')
return
}
//
uploadHeaders.value = {
Authorization: 'Bearer ' + getAccessToken(),
'tenant-id': getTenantId()
}
formLoading.value = true
uploadRef.value!.submit()
}
/** 文件上传成功 */
const emits = defineEmits(['success'])
const submitFormSuccess = (response: any) => {
if (response.code !== 0) {
message.error(response.msg)
formLoading.value = false
return
}
//
// const data = response.data
// console.log(data)
// let text = '' + data.createUsernames.length + ';'
// for (let username of data.createUsernames) {
// text += '< ' + username + ' >'
// }
// text += '' + data.updateUsernames.length + ';'
// for (const username of data.updateUsernames) {
// text += '< ' + username + ' >'
// }
// text += '' + Object.keys(data.failureUsernames).length + ';'
// for (const username in data.failureUsernames) {
// text += '< ' + username + ': ' + data.failureUsernames[username] + ' >'
// }
// message.alert(text)
//
emits('success')
}
/** 上传错误提示 */
const submitFormError = (): void => {
message.error('上传失败,请您重新上传!')
formLoading.value = false
}
/** 重置表单 */
const resetForm = () => {
//
formLoading.value = false
uploadRef.value?.clearFiles()
}
/** 文件数超出提示 */
const handleExceed = (): void => {
message.error('最多只能上传一个文件!')
}
/** 下载模板操作 */
const importTemplate = async () => {
const res = await WorkstationApi.importWorkstationTemplate()
download.excel(res, '工位信息导入模版.xls')
}
</script>

21
src/views/wms/workstation/index.vue

@ -80,7 +80,7 @@
class="!w-240px"
>
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.TRUE_FALSE)"
v-for="dict in getStrDictOptions(DICT_TYPE.TRUE_FALSE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -148,6 +148,12 @@
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="warning"
@click="handleImport"
v-hasPermi="['wms:workstation:import']">
<Icon icon="ep:upload" /> 导入
</el-button>
<el-button
type="success"
@click="handleExport"
@ -235,14 +241,18 @@
<!-- 表单弹窗添加/修改 -->
<WorkstationForm ref="formRef" @success="getList" />
<!-- 用户导入对话框 -->
<WorkstationImportForm ref="importFormRef" @success="getList" />
</template>
<script setup lang="ts">
import { DICT_TYPE, getStrDictOptions, getIntDictOptions } from '@/utils/dict'
import { DICT_TYPE, getStrDictOptions} from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import * as WorkstationApi from '@/api/wms/workstation'
import WorkstationForm from './WorkstationForm.vue'
import WorkstationImportForm from './WorkstationImportForm.vue'
defineOptions({ name: 'Workstation' })
@ -297,9 +307,16 @@ const resetQuery = () => {
handleQuery()
}
/** 用户导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
console.log(id)
formRef.value.open(type, id)
}

Loading…
Cancel
Save