Browse Source

基础数据模板上传

master
yejiaxing 10 months ago
parent
commit
b6a1e78989
  1. 49
      src/api/eam/basic/deviceMoldItems/index.ts
  2. 64
      src/api/eam/basic/item/index.ts
  3. 54
      src/api/eam/basic/location/index.ts
  4. 46
      src/api/eam/basic/rel/index.ts
  5. 58
      src/api/eam/basic/supplier/index.ts
  6. 54
      src/views/eam/basic/deviceItem/deviceItem.data.ts
  7. 244
      src/views/eam/basic/deviceItem/index.vue
  8. 79
      src/views/eam/basic/deviceMoldItems/deviceMoldItems.data.ts
  9. 244
      src/views/eam/basic/deviceMoldItems/index.vue
  10. 244
      src/views/eam/basic/item/index.vue
  11. 130
      src/views/eam/basic/item/item.data.ts
  12. 244
      src/views/eam/basic/location/index.vue
  13. 87
      src/views/eam/basic/location/location.data.ts
  14. 244
      src/views/eam/basic/supplier/index.vue
  15. 92
      src/views/eam/basic/supplier/supplier.data.ts

49
src/api/eam/basic/deviceMoldItems/index.ts

@ -0,0 +1,49 @@
import request from '@/config/axios'
export interface DeviceMoldItemsVO {
name: string
deviceNumber: string
type: string
status: string
siteId: string
available: string
concurrencyStamp: number
}
// 查询项记录表(设备 模具 保养 维修 巡检点检)列表
export const getDeviceMoldItemsPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/device-mold-items/senior', data })
} else {
return await request.get({ url: `/eam/device-mold-items/page`, params })
}
}
// 查询项记录表(设备 模具 保养 维修 巡检点检)详情
export const getDeviceMoldItems = async (id: number) => {
return await request.get({ url: `/eam/device-mold-items/get?id=` + id })
}
// 新增项记录表(设备 模具 保养 维修 巡检点检)
export const createDeviceMoldItems = async (data: DeviceMoldItemsVO) => {
return await request.post({ url: `/eam/device-mold-items/create`, data })
}
// 修改项记录表(设备 模具 保养 维修 巡检点检)
export const updateDeviceMoldItems = async (data: DeviceMoldItemsVO) => {
return await request.put({ url: `/eam/device-mold-items/update`, data })
}
// 删除项记录表(设备 模具 保养 维修 巡检点检)
export const deleteDeviceMoldItems = async (id: number) => {
return await request.delete({ url: `/eam/device-mold-items/delete?id=` + id })
}
// 导出项记录表(设备 模具 保养 维修 巡检点检) Excel
export const exportDeviceMoldItems = async (params) => {
return await request.download({ url: `/eam/device-mold-items/export-excel`, params })
}

64
src/api/eam/basic/item/index.ts

@ -0,0 +1,64 @@
import request from '@/config/axios'
export interface ItemVO {
number: string
name: string
brand: string
specifications: string
isConstant: string
subject: string
classification: string
uom: string
singlePrice: number
reprocurement: number
safetyStock: number
cost: string
purchaser: string
financer: string
isFramework: string
isRadeIn: string
siteId: string
available: string
concurrencyStamp: number
}
// 查询备件列表
export const getItemPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/item/senior', data })
} else {
return await request.get({ url: `/eam/item/page`, params })
}
}
// 查询备件详情
export const getItem = async (id: number) => {
return await request.get({ url: `/eam/item/get?id=` + id })
}
// 新增备件
export const createItem = async (data: ItemVO) => {
return await request.post({ url: `/eam/item/create`, data })
}
// 修改备件
export const updateItem = async (data: ItemVO) => {
return await request.put({ url: `/eam/item/update`, data })
}
// 删除备件
export const deleteItem = async (id: number) => {
return await request.delete({ url: `/eam/item/delete?id=` + id })
}
// 导出备件 Excel
export const exportItem = async (params) => {
return await request.download({ url: `/eam/item/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/item/get-import-template' })
}

54
src/api/eam/basic/location/index.ts

@ -0,0 +1,54 @@
import request from '@/config/axios'
export interface LocationVO {
number: string
name: string
description: string
areaNumber: string
type: string
isInAccount: string
siteId: string
available: string
concurrencyStamp: number
}
// 查询库位列表
export const getLocationPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/location/senior', data })
} else {
return await request.get({ url: `/eam/location/page`, params })
}
}
// 查询库位详情
export const getLocation = async (id: number) => {
return await request.get({ url: `/eam/location/get?id=` + id })
}
// 新增库位
export const createLocation = async (data: LocationVO) => {
return await request.post({ url: `/eam/location/create`, data })
}
// 修改库位
export const updateLocation = async (data: LocationVO) => {
return await request.put({ url: `/eam/location/update`, data })
}
// 删除库位
export const deleteLocation = async (id: number) => {
return await request.delete({ url: `/eam/location/delete?id=` + id })
}
// 导出库位 Excel
export const exportLocation = async (params) => {
return await request.download({ url: `/eam/location/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/location/get-import-template' })
}

46
src/api/eam/basic/rel/index.ts

@ -0,0 +1,46 @@
import request from '@/config/axios'
export interface DeviceItemVO {
itemNumber: string
deviceNumber: string
siteId: string
available: string
concurrencyStamp: number
}
// 查询设备备件关系列表
export const getDeviceItemPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/rel/device-item/senior', data })
} else {
return await request.get({ url: `/rel/device-item/page`, params })
}
}
// 查询设备备件关系详情
export const getDeviceItem = async (id: number) => {
return await request.get({ url: `/rel/device-item/get?id=` + id })
}
// 新增设备备件关系
export const createDeviceItem = async (data: DeviceItemVO) => {
return await request.post({ url: `/rel/device-item/create`, data })
}
// 修改设备备件关系
export const updateDeviceItem = async (data: DeviceItemVO) => {
return await request.put({ url: `/rel/device-item/update`, data })
}
// 删除设备备件关系
export const deleteDeviceItem = async (id: number) => {
return await request.delete({ url: `/rel/device-item/delete?id=` + id })
}
// 导出设备备件关系 Excel
export const exportDeviceItem = async (params) => {
return await request.download({ url: `/rel/device-item/export-excel`, params })
}

58
src/api/eam/basic/supplier/index.ts

@ -0,0 +1,58 @@
import request from '@/config/axios'
export interface SupplierVO {
number: string
name: string
shortName: string
address: string
country: string
city: string
phone: string
fax: string
postId: string
contacts: string
available: string
remark: string
siteId: string
}
// 查询供应商列表
export const getSupplierPage = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = {...params}
return await request.post({ url: '/eam/supplier/senior', data })
} else {
return await request.get({ url: `/eam/supplier/page`, params })
}
}
// 查询供应商详情
export const getSupplier = async (id: number) => {
return await request.get({ url: `/eam/supplier/get?id=` + id })
}
// 新增供应商
export const createSupplier = async (data: SupplierVO) => {
return await request.post({ url: `/eam/supplier/create`, data })
}
// 修改供应商
export const updateSupplier = async (data: SupplierVO) => {
return await request.put({ url: `/eam/supplier/update`, data })
}
// 删除供应商
export const deleteSupplier = async (id: number) => {
return await request.delete({ url: `/eam/supplier/delete?id=` + id })
}
// 导出供应商 Excel
export const exportSupplier = async (params) => {
return await request.download({ url: `/eam/supplier/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/eam/supplier/get-import-template' })
}

54
src/views/eam/basic/deviceItem/deviceItem.data.ts

@ -0,0 +1,54 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
// 表单校验
export const DeviceItemRules = reactive({
itemNumber: [required],
deviceNumber: [required],
concurrencyStamp: [required],
})
export const DeviceItem = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '备件代码',
field: 'itemNumber',
sort: 'custom',
isSearch: true,
},
{
label: '设备代码',
field: 'deviceNumber',
sort: 'custom',
isSearch: true,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isSearch: true,
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
isSearch: true,
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

244
src/views/eam/basic/deviceItem/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="DeviceItem.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="DeviceItem.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="DeviceItemRules"
:formAllSchemas="DeviceItem.allSchemas"
:apiUpdate="DeviceItemApi.updateDeviceItem"
:apiCreate="DeviceItemApi.createDeviceItem"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceItem.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/rel/device-item/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { DeviceItem,DeviceItemRules } from './deviceItem.data'
import * as DeviceItemApi from '@/api/eam/basic/rel'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'DeviceItem' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(DeviceItem.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: DeviceItemApi.getDeviceItemPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:deviceItem:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:deviceItem:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:deviceItem:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:deviceItem:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceItem:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =DeviceItem.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await DeviceItemApi.createDeviceItem(data)
message.success(t('common.createSuccess'))
} else {
await DeviceItemApi.updateDeviceItem(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicDeviceItem')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await DeviceItemApi.deleteDeviceItem(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await DeviceItemApi.exportDeviceItem(tableObject.params)
download.excel(data, '设备备件关系.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '设备备件关系导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await DeviceItemApi.importTemplate()
})
</script>

79
src/views/eam/basic/deviceMoldItems/deviceMoldItems.data.ts

@ -0,0 +1,79 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const DeviceMoldItemsRules = reactive({
name: [required],
deviceNumber: [required],
type: [required],
status: [required],
concurrencyStamp: [required],
})
export const DeviceMoldItems = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '保养项名称',
field: 'name',
sort: 'custom',
isSearch: true,
},
{
label: '设备模具编号',
field: 'deviceNumber',
sort: 'custom',
isSearch: true,
},
{
label: '类型设备、模具枚举',
field: 'type',
sort: 'custom',
isSearch: true,
form: {
component: 'SelectV2'
},
},
{
label: '项类型枚举维修、保养、巡检点检',
field: 'status',
sort: 'custom',
isSearch: true,
form: {
component: 'SelectV2'
},
},
{
label: '创建时间',
field: 'createTime',
sort: 'custom',
formatter: dateFormatter,
isForm: false,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

244
src/views/eam/basic/deviceMoldItems/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="DeviceMoldItems.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="DeviceMoldItems.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="DeviceMoldItemsRules"
:formAllSchemas="DeviceMoldItems.allSchemas"
:apiUpdate="DeviceMoldItemsApi.updateDeviceMoldItems"
:apiCreate="DeviceMoldItemsApi.createDeviceMoldItems"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="DeviceMoldItems.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/device-mold-items/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { DeviceMoldItems,DeviceMoldItemsRules } from './deviceMoldItems.data'
import * as DeviceMoldItemsApi from '@/api/eam/basic/deviceMoldItems'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'DeviceMoldItems' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(DeviceMoldItems.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: DeviceMoldItemsApi.getDeviceMoldItemsPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:deviceMoldItems:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:deviceMoldItems:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:deviceMoldItems:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:deviceMoldItems:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:deviceMoldItems:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =DeviceMoldItems.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await DeviceMoldItemsApi.createDeviceMoldItems(data)
message.success(t('common.createSuccess'))
} else {
await DeviceMoldItemsApi.updateDeviceMoldItems(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicDeviceMoldItems')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await DeviceMoldItemsApi.deleteDeviceMoldItems(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await DeviceMoldItemsApi.exportDeviceMoldItems(tableObject.params)
download.excel(data, '项记录表(设备 模具 保养 维修 巡检点检).xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '项记录表(设备 模具 保养 维修 巡检点检)导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await DeviceMoldItemsApi.importTemplate()
})
</script>

244
src/views/eam/basic/item/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="Item.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="Item.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="ItemRules"
:formAllSchemas="Item.allSchemas"
:apiUpdate="ItemApi.updateItem"
:apiCreate="ItemApi.createItem"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="Item.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/item/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { Item,ItemRules } from './item.data'
import * as ItemApi from '@/api/eam/basic/item'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'Item' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(Item.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: ItemApi.getItemPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:item:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:item:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:item:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:item:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:item:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =Item.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await ItemApi.createItem(data)
message.success(t('common.createSuccess'))
} else {
await ItemApi.updateItem(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicItem')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await ItemApi.deleteItem(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await ItemApi.exportItem(tableObject.params)
download.excel(data, '备件.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '备件导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await ItemApi.importTemplate()
})
</script>

130
src/views/eam/basic/item/item.data.ts

@ -0,0 +1,130 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
// 表单校验
export const ItemRules = reactive({
number: [required],
name: [required],
uom: [required],
concurrencyStamp: [required],
})
export const Item = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编号唯一标识',
field: 'number',
sort: 'custom',
isSearch: true,
},
{
label: '名称',
field: 'name',
sort: 'custom',
isSearch: true,
},
{
label: '品牌',
field: 'brand',
sort: 'custom',
},
{
label: '规格型号',
field: 'specifications',
sort: 'custom',
},
{
label: '是否存储TRUE/FALSE',
field: 'isConstant',
sort: 'custom',
},
{
label: '科目代码枚举工具、易耗品、备品备件、机物料',
field: 'subject',
sort: 'custom',
},
{
label: '枚举分类 A、B、C',
field: 'classification',
sort: 'custom',
},
{
label: '单位',
field: 'uom',
sort: 'custom',
},
{
label: '单价',
field: 'singlePrice',
sort: 'custom',
},
{
label: '重点采购',
field: 'reprocurement',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '安全库存',
field: 'safetyStock',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '成本中心',
field: 'cost',
sort: 'custom',
},
{
label: '采购员',
field: 'purchaser',
sort: 'custom',
},
{
label: '财务',
field: 'financer',
sort: 'custom',
},
{
label: '是否框架协议TRUE/FALSE',
field: 'isFramework',
sort: 'custom',
},
{
label: '是否以旧换新TRUE/FALSE',
field: 'isRadeIn',
sort: 'custom',
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

244
src/views/eam/basic/location/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="Location.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="Location.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="LocationRules"
:formAllSchemas="Location.allSchemas"
:apiUpdate="LocationApi.updateLocation"
:apiCreate="LocationApi.createLocation"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="Location.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/location/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { Location,LocationRules } from './location.data'
import * as LocationApi from '@/api/eam/basic/location'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'Location' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(Location.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: LocationApi.getLocationPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:location:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:location:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:location:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:location:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:location:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =Location.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await LocationApi.createLocation(data)
message.success(t('common.createSuccess'))
} else {
await LocationApi.updateLocation(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicLocation')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await LocationApi.deleteLocation(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await LocationApi.exportLocation(tableObject.params)
download.excel(data, '库位.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '库位导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await LocationApi.importTemplate()
})
</script>

87
src/views/eam/basic/location/location.data.ts

@ -0,0 +1,87 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
// 表单校验
export const LocationRules = reactive({
number: [required],
name: [required],
areaNumber: [required],
concurrencyStamp: [required],
})
export const Location = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编号唯一标识',
field: 'number',
sort: 'custom',
isSearch: true,
},
{
label: '名称',
field: 'name',
sort: 'custom',
isSearch: true,
},
{
label: '描述',
field: 'description',
sort: 'custom',
isSearch: true,
form: {
component: 'Editor',
componentProps: {
valueHtml: '',
height: 200
}
},
},
{
label: '库区编号',
field: 'areaNumber',
sort: 'custom',
isSearch: true,
},
{
label: '类型',
field: 'type',
sort: 'custom',
isSearch: true,
form: {
component: 'SelectV2'
},
},
{
label: '是否账内账外默认TRUE账内FALSE账外',
field: 'isInAccount',
sort: 'custom',
isSearch: true,
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
},
{
label: '并发乐观锁',
field: 'concurrencyStamp',
sort: 'custom',
isSearch: true,
form: {
component: 'InputNumber',
value: 0
},
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))

244
src/views/eam/basic/supplier/index.vue

@ -0,0 +1,244 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="Supplier.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="Supplier.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="SupplierRules"
:formAllSchemas="Supplier.allSchemas"
:apiUpdate="SupplierApi.updateSupplier"
:apiCreate="SupplierApi.createSupplier"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="Supplier.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/supplier/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { Supplier,SupplierRules } from './supplier.data'
import * as SupplierApi from '@/api/eam/basic/supplier'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
defineOptions({ name: 'Supplier' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref(Supplier.allSchemas.tableColumns)
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
})
}
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
const { tableObject, tableMethods } = useTable({
getListApi: SupplierApi.getSupplierPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'eam:supplier:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'eam:supplier:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'eam:supplier:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:supplier:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'eam:supplier:delete'}), //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.id)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =Supplier.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await SupplierApi.createSupplier(data)
message.success(t('common.createSuccess'))
} else {
await SupplierApi.updateSupplier(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicSupplier')
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await SupplierApi.deleteSupplier(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await SupplierApi.exportSupplier(tableObject.params)
download.excel(data, '供应商.xlsx')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: '供应商导入模版.xlsx'
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
importTemplateData.templateUrl = await SupplierApi.importTemplate()
})
</script>

92
src/views/eam/basic/supplier/supplier.data.ts

@ -0,0 +1,92 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
// 表单校验
export const SupplierRules = reactive({
number: [required],
name: [required],
})
export const Supplier = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '编号唯一标识',
field: 'number',
sort: 'custom',
isSearch: true,
},
{
label: '名称',
field: 'name',
sort: 'custom',
isSearch: true,
},
{
label: '简称',
field: 'shortName',
sort: 'custom',
isSearch: true,
},
{
label: '地址',
field: 'address',
sort: 'custom',
isSearch: true,
},
{
label: '国家',
field: 'country',
sort: 'custom',
isSearch: true,
},
{
label: '城市',
field: 'city',
sort: 'custom',
isSearch: true,
},
{
label: '电话',
field: 'phone',
sort: 'custom',
isSearch: true,
},
{
label: '传真',
field: 'fax',
sort: 'custom',
},
{
label: '邮编',
field: 'postId',
sort: 'custom',
},
{
label: '联系人',
field: 'contacts',
sort: 'custom',
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
},
{
label: '备注',
field: 'remark',
sort: 'custom',
},
{
label: '地点ID',
field: 'siteId',
sort: 'custom',
isSearch: true,
},
{
label: '操作',
field: 'action',
isForm: false,
table: {
width: 150,
fixed: 'right'
}
}
]))
Loading…
Cancel
Save