ljlong_2630
6 months ago
20 changed files with 2395 additions and 52 deletions
@ -0,0 +1,20 @@ |
|||
import request from '@/config/axios' |
|||
// 上传图片
|
|||
export const uploadFiles = async (data) => { |
|||
return await request.post({ url: `/eam/attachment-file/upload`, data }) |
|||
} |
|||
|
|||
// 查询图片
|
|||
export const getFiles = async (data) => { |
|||
return await request.post({ url: `/eam/attachment-file/listNoPage`, data }) |
|||
} |
|||
|
|||
// 新增图片
|
|||
export const addFile = async (data) => { |
|||
return await request.post({ url: `/eam/attachment-file/create`, data }) |
|||
} |
|||
|
|||
// 删除图片
|
|||
export const delFile = async (id: number) => { |
|||
return await request.delete({ url: `/eam/attachment-file/delete?uid=`, id }) |
|||
} |
@ -0,0 +1,68 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface EquipmentToolSparePartVO { |
|||
id: number |
|||
sparePartCode: string |
|||
equipmentToolCode: string |
|||
type: string |
|||
usePosition: string |
|||
departmentCode: string |
|||
remark: string |
|||
siteId: string |
|||
available: string |
|||
deletionTime: Date |
|||
deleterId: byte[] |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询设备或工装与备件关联列表
|
|||
export const getEquipmentToolSparePartPage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/relation/equipment-tool-spare-part/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/relation/equipment-tool-spare-part/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询设备或工装与备件关联详情
|
|||
export const getEquipmentToolSparePart = async (id: number) => { |
|||
return await request.get({ url: `/eam/relation/equipment-tool-spare-part/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增设备或工装与备件关联
|
|||
export const createEquipmentToolSparePart = async (data: EquipmentToolSparePartVO) => { |
|||
return await request.post({ url: `/eam/relation/equipment-tool-spare-part/create`, data }) |
|||
} |
|||
|
|||
// 修改设备或工装与备件关联
|
|||
export const updateEquipmentToolSparePart = async (data: EquipmentToolSparePartVO) => { |
|||
return await request.put({ url: `/eam/relation/equipment-tool-spare-part/update`, data }) |
|||
} |
|||
|
|||
// 删除设备或工装与备件关联
|
|||
export const deleteEquipmentToolSparePart = async (id: number) => { |
|||
return await request.delete({ url: `/eam/relation/equipment-tool-spare-part/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出设备或工装与备件关联 Excel
|
|||
export const exportEquipmentToolSparePart = async (params) => { |
|||
return await request.download({ url: `/eam/relation/equipment-tool-spare-part/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/relation/equipment-tool-spare-part/get-import-template' }) |
|||
} |
|||
|
|||
// 新增设备或工装与备件关联
|
|||
export const createEquipmentToolSparePartBatch = async (data: Array<EquipmentToolSparePartVO>) => { |
|||
return await request.post({ url: `/eam/relation/equipment-tool-spare-part/createBatch`, data }) |
|||
} |
|||
|
|||
// 查询设备或工装与备件关联列表
|
|||
export const getEquipmentToolSparePartNoPage = async (params) => { |
|||
return await request.get({ url: `/eam/relation/equipment-tool-spare-part/noPage`, params }) |
|||
} |
|||
|
@ -0,0 +1,65 @@ |
|||
import request from '@/config/axios' |
|||
|
|||
export interface TableDataExtendedAttributeVO { |
|||
id: number |
|||
tableName: string |
|||
dataId: string |
|||
fieldName: string |
|||
fieldVal: string |
|||
siteId: string |
|||
available: string |
|||
departmentCode: number |
|||
remark: string |
|||
concurrencyStamp: number |
|||
} |
|||
|
|||
// 查询表数据扩展属性字段列表
|
|||
export const getTableDataExtendedAttributePage = async (params) => { |
|||
if (params.isSearch) { |
|||
delete params.isSearch |
|||
const data = {...params} |
|||
return await request.post({ url: '/eam/table-data-extended-attribute/senior', data }) |
|||
} else { |
|||
return await request.get({ url: `/eam/table-data-extended-attribute/page`, params }) |
|||
} |
|||
} |
|||
|
|||
// 查询表数据扩展属性字段详情
|
|||
export const getTableDataExtendedAttribute = async (id: number) => { |
|||
return await request.get({ url: `/eam/table-data-extended-attribute/get?id=` + id }) |
|||
} |
|||
|
|||
// 新增表数据扩展属性字段
|
|||
export const createTableDataExtendedAttribute = async (data: TableDataExtendedAttributeVO) => { |
|||
return await request.post({ url: `/eam/table-data-extended-attribute/create`, data }) |
|||
} |
|||
|
|||
// 修改表数据扩展属性字段
|
|||
export const updateTableDataExtendedAttribute = async (data: TableDataExtendedAttributeVO) => { |
|||
return await request.put({ url: `/eam/table-data-extended-attribute/update`, data }) |
|||
} |
|||
|
|||
// 删除表数据扩展属性字段
|
|||
export const deleteTableDataExtendedAttribute = async (id: number) => { |
|||
return await request.delete({ url: `/eam/table-data-extended-attribute/delete?id=` + id }) |
|||
} |
|||
|
|||
// 导出表数据扩展属性字段 Excel
|
|||
export const exportTableDataExtendedAttribute = async (params) => { |
|||
return await request.download({ url: `/eam/table-data-extended-attribute/export-excel`, params }) |
|||
} |
|||
|
|||
// 下载用户导入模板
|
|||
export const importTemplate = () => { |
|||
return request.download({ url: '/eam/table-data-extended-attribute/get-import-template' }) |
|||
} |
|||
|
|||
// 查询表数据扩展属性字段列表
|
|||
export const getTableDataExtendedAttributeNoPage = async (params) => { |
|||
return await request.get({ url: `/eam/table-data-extended-attribute/noPage`, params }) |
|||
} |
|||
|
|||
// 新增表数据扩展属性字段
|
|||
export const createTableDataExtendedAttributeBatch = async (data: Object) => { |
|||
return await request.post({ url: `/eam/table-data-extended-attribute/createBatch`, data }) |
|||
} |
@ -0,0 +1,175 @@ |
|||
<!-- 附件组件 --> |
|||
<template> |
|||
<div class="annex"> |
|||
<div class="title flex items-center"> |
|||
<!-- <div class="title-txt">附件</div> --> |
|||
<UploadFile :isShowFile="false" :isShowTip="false" :fileType="fileType" :title="t('ts.添加附件')" :upData="upData" :limit="10" |
|||
@update:modelValue="handleAnnexSuccess" v-if="showAddBtn&&annexData.annexList.length<5"/> |
|||
<!-- <el-button type='success' class="save-button" @click="saveEdit">保存当前操作</el-button> --> |
|||
</div> |
|||
<div class="list"> |
|||
<div class="item flex items-start" v-for="(item, index) in annexData.annexList" :key="index"> |
|||
<Icon icon="fa:file-text-o" color="#409eff" :size="30" class="mt-4px" /> |
|||
<div class="item-center" > |
|||
<div class="item-title" @click="downFile(item)">{{ item.name }}</div> |
|||
<div class="info mt-6px"> |
|||
<div class="info-txt"> |
|||
<div>{{ item.size }}KB</div> |
|||
<div>来自 {{ item.nickname }}</div> |
|||
</div> |
|||
<Icon icon="ep:picture" v-if="showPreview" class="cursor-pointer mr-2" :size="18" @click="preview(item)"/> |
|||
<Icon icon="ep:download" v-if="showDownload" class="cursor-pointer mr-2" :size="18" @click="downFile(item)" /> |
|||
<Icon icon="ep:delete" class="cursor-pointer" v-if="!hiddenDelete" :size="18" @click="deleteAnnex(item.id)" /> |
|||
</div> |
|||
<div class="time mt-6px ">{{ formatDate(item.createTime) }}</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<PreviewPDF ref="previewRef" /> |
|||
</template> |
|||
|
|||
<script lang="ts" setup> |
|||
import PreviewPDF from '@/components/PreviewPDF/index.vue' |
|||
import UploadFile from '@/components/UploadFile/src/UploadFile.vue' |
|||
import { formatDate } from '@/utils/formatTime' |
|||
import * as FileApi from '@/api/wms/file' |
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
defineComponent({ |
|||
name: 'AnnexLedger' |
|||
}) |
|||
// 接受父组件参数 |
|||
const props = defineProps({ |
|||
annexData: { |
|||
type: Object, |
|||
required: true |
|||
}, |
|||
upData: { |
|||
type: Object, |
|||
required: true |
|||
}, |
|||
fileType:{ |
|||
type:Array, |
|||
required: false, |
|||
default: () => { |
|||
return ['apk','doc', 'xls', 'ppt', 'txt', 'pdf','png', 'jpg', 'jpeg'] |
|||
} |
|||
}, |
|||
showPreview: { |
|||
type: Boolean, |
|||
required: false |
|||
}, |
|||
showDownload: { |
|||
type: Boolean, |
|||
required: false |
|||
}, |
|||
hiddenDelete: { |
|||
type: Boolean, |
|||
required: false |
|||
}, |
|||
showAddBtn: { |
|||
type: Boolean, |
|||
default: true |
|||
}, |
|||
}) |
|||
// 子传父的时候需要先定义好emit这个方法 |
|||
const emit = defineEmits(['handleAnnexSuccess', 'deleteAnnexSuccess','previewAnnexHandle','saveEdit']) |
|||
// 添加附件 |
|||
const handleAnnexSuccess = (str,res,uploadFile) => { |
|||
emit('handleAnnexSuccess',str,res,uploadFile) |
|||
} |
|||
const saveEdit = () => { |
|||
emit('saveEdit') |
|||
} |
|||
// 删除附件 |
|||
const deleteAnnex = async (id) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await FileApi.deleteFile(id) |
|||
message.success(t('common.delSuccess')) |
|||
} catch { } |
|||
emit('deleteAnnexSuccess',id) |
|||
} |
|||
const downFile = (item)=>{ |
|||
window.open(import.meta.env.VITE_BASE_URL + '/admin-api/infra/file/0/get/' + item.path) |
|||
} |
|||
const previewRef = ref<InstanceType<typeof PreviewPDF>>() |
|||
|
|||
const preview = (item)=>{ |
|||
console.log('preview==',item) |
|||
if(item.url.endsWith('.pdf')){ |
|||
previewRef.value?.openPreview(item.url) |
|||
}else{ |
|||
let imageArray = props.annexData.annexList.map(item=>item.url) |
|||
imageArray = imageArray.filter(item=>!item.endsWith('.pdf')) |
|||
previewRef.value?.openPreview(imageArray) |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
|
|||
<style scoped lang="scss"> |
|||
.title { |
|||
border-bottom: 1px solid #dedede; |
|||
justify-content: flex-end; |
|||
|
|||
.title-txt { |
|||
width: 80px; |
|||
text-align: center; |
|||
color: rgb(63, 158, 255); |
|||
border-bottom: 2px solid rgb(63, 158, 255); |
|||
height: 30px; |
|||
} |
|||
} |
|||
|
|||
.item { |
|||
border-bottom: 1px dashed #dedede; |
|||
padding: 20px 0px 10px; |
|||
|
|||
.item-center { |
|||
flex: 1; |
|||
margin-left: 16px; |
|||
overflow: hidden; |
|||
|
|||
.item-title { |
|||
font-size: 16px; |
|||
overflow: hidden; |
|||
white-space: nowrap; |
|||
text-overflow: ellipsis; |
|||
cursor: pointer; |
|||
} |
|||
|
|||
.info { |
|||
display: flex; |
|||
align-items: center; |
|||
|
|||
.info-txt { |
|||
flex: 1; |
|||
display: flex; |
|||
align-items: center; |
|||
|
|||
div { |
|||
color: #b6b6b6; |
|||
margin-right: 20px; |
|||
font-size: 14px; |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
.time { |
|||
color: #b6b6b6; |
|||
font-size: 14px; |
|||
} |
|||
} |
|||
} |
|||
.save-button{ |
|||
display: inline-block; |
|||
vertical-align: middle; |
|||
margin-bottom: 10px; |
|||
margin-left: 20px; |
|||
} |
|||
</style> |
@ -0,0 +1,3 @@ |
|||
import AutoIncrementField from './src/AutoIncrementField.vue' |
|||
|
|||
export { AutoIncrementField } |
@ -0,0 +1,106 @@ |
|||
vue |
|||
<template> |
|||
<el-form :model="form" :rules="rules" ref="formRef"> |
|||
<el-row v-for="(field, index) in fields" :key="index" :gutter="20"> |
|||
<el-col :span="10"> |
|||
<el-form-item :label="`${codeLabelPrefix} ${index + 1}`" :prop="field.code.prop"> |
|||
<el-input v-model="form[field.code.prop]" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="10"> |
|||
<el-form-item :label="`${valueLabelPrefix} ${index + 1}`" :prop="field.value.prop"> |
|||
<el-input v-model="form[field.value.prop]" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="4"> |
|||
<el-button type="danger" icon="el-icon-delete" @click="removeFields(index)">删除</el-button> |
|||
</el-col> |
|||
</el-row> |
|||
<el-button type="primary" @click="submitForm">提交</el-button> |
|||
<el-button @click="addFields">添加字段</el-button> |
|||
</el-form> |
|||
</template> |
|||
|
|||
<script setup> |
|||
import { ref, onMounted, watch, defineProps, defineEmits } from 'vue'; |
|||
import axios from 'axios'; |
|||
|
|||
const props = defineProps({ |
|||
initialData: { |
|||
type: Array, |
|||
default: () => [] |
|||
}, |
|||
codeLabelPrefix: { |
|||
type: String, |
|||
default: 'Code' |
|||
}, |
|||
valueLabelPrefix: { |
|||
type: String, |
|||
default: 'Value' |
|||
} |
|||
}); |
|||
|
|||
const emit = defineEmits(['submit']); |
|||
|
|||
const form = ref({}); |
|||
const fields = ref([]); |
|||
const rules = ref({}); |
|||
|
|||
const formRef = ref(null); |
|||
|
|||
const initializeForm = (data) => { |
|||
fields.value = []; |
|||
data.forEach((item, index) => { |
|||
const codeField = { label: `${props.codeLabelPrefix} ${index + 1}`, prop: `${props.codeLabelPrefix}${index + 1}` }; |
|||
const valueField = { label: `${props.valueLabelPrefix} ${index + 1}`, prop: `${props.valueLabelPrefix}${index + 1}` }; |
|||
fields.value.push({ code: codeField, value: valueField }); |
|||
form.value[codeField.prop] = item.code; |
|||
form.value[valueField.prop] = item.value; |
|||
rules.value[codeField.prop] = [{ required: true, message: `${props.codeLabelPrefix} 是必填项`, trigger: 'blur' }]; |
|||
rules.value[valueField.prop] = [{ required: true, message: `${props.valueLabelPrefix} 是必填项`, trigger: 'blur' }]; |
|||
}); |
|||
}; |
|||
|
|||
onMounted(() => { |
|||
initializeForm(props.initialData); |
|||
}); |
|||
|
|||
watch(() => props.initialData, (newData) => { |
|||
initializeForm(newData); |
|||
}); |
|||
|
|||
function addFields() { |
|||
const index = fields.value.length + 1; |
|||
const codeField = { label: `${props.codeLabelPrefix} ${index}`, prop: `${props.codeLabelPrefix}${index}` }; |
|||
const valueField = { label: `${props.valueLabelPrefix} ${index}`, prop: `${props.valueLabelPrefix}${index}` }; |
|||
fields.value.push({ code: codeField, value: valueField }); |
|||
form.value[codeField.prop] = ''; |
|||
form.value[valueField.prop] = ''; |
|||
rules.value[codeField.prop] = [{ required: true, message: `${props.codeLabelPrefix}${index} 是必填项` }]; |
|||
rules.value[valueField.prop] = [{ required: true, message: `${props.valueLabelPrefix}${index} 是必填项` }]; |
|||
} |
|||
|
|||
function removeFields(index) { |
|||
const removedFields = fields.value.splice(index, 1)[0]; |
|||
delete form.value[removedFields.code.prop]; |
|||
delete form.value[removedFields.value.prop]; |
|||
delete rules.value[removedFields.code.prop]; |
|||
delete rules.value[removedFields.value.prop]; |
|||
} |
|||
|
|||
function submitForm() { |
|||
formRef.value.validate(async (valid) => { |
|||
if (valid) { |
|||
const list = fields.value.map(field => ({ |
|||
code: form.value[field.code.prop], |
|||
value: form.value[field.value.prop] |
|||
})); |
|||
|
|||
emit('submit', list); |
|||
} else { |
|||
console.log('表单验证失败'); |
|||
return false; |
|||
} |
|||
}); |
|||
} |
|||
</script> |
File diff suppressed because it is too large
@ -0,0 +1,135 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const EquipmentToolSparePartRules = reactive({ |
|||
sparePartCode: [required], |
|||
equipmentToolCode: [required], |
|||
type: [required], |
|||
concurrencyStamp: [required] |
|||
}) |
|||
|
|||
export const EquipmentToolSparePart = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '备件编号', |
|||
field: 'sparePartCode', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '设备编码', |
|||
field: 'equipmentToolCode', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '类型', |
|||
field: 'type', |
|||
sort: 'custom', |
|||
dictType: DICT_TYPE.DEVICE_TYPE, |
|||
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
|||
isSearch: true, |
|||
form: { |
|||
component: 'SelectV2' |
|||
} |
|||
}, |
|||
{ |
|||
label: '使用部位', |
|||
field: 'usePosition', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '部门id', |
|||
field: 'departmentCode', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '地点ID', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '是否可用默认TRUE', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '删除时间', |
|||
field: 'deletionTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
form: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
type: 'datetime', |
|||
valueFormat: 'x' |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
label: '删除人id', |
|||
field: 'deleterId', |
|||
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' |
|||
} |
|||
} |
|||
])) |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="EquipmentToolSparePart.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="EquipmentToolSparePart.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="EquipmentToolSparePartRules" |
|||
:formAllSchemas="EquipmentToolSparePart.allSchemas" |
|||
:apiUpdate="EquipmentToolSparePartApi.updateEquipmentToolSparePart" |
|||
:apiCreate="EquipmentToolSparePartApi.createEquipmentToolSparePart" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="EquipmentToolSparePart.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/relation/equipment-tool-spare-part/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { EquipmentToolSparePart,EquipmentToolSparePartRules } from './equipmentToolSparePart.data' |
|||
import * as EquipmentToolSparePartApi from '@/api/eam/equipmentToolSparePart' |
|||
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: 'EquipmentToolSparePart' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(EquipmentToolSparePart.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: EquipmentToolSparePartApi.getEquipmentToolSparePartPage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'wms:equipmentToolSparePart:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'wms:equipmentToolSparePart:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'wms:equipmentToolSparePart: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:'wms:equipmentToolSparePart:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'wms:equipmentToolSparePart: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 =EquipmentToolSparePart.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 EquipmentToolSparePartApi.createEquipmentToolSparePart(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await EquipmentToolSparePartApi.updateEquipmentToolSparePart(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, 'basicEquipmentToolSparePart') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await EquipmentToolSparePartApi.deleteEquipmentToolSparePart(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 EquipmentToolSparePartApi.exportEquipmentToolSparePart(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 EquipmentToolSparePartApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,244 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<!-- 搜索工作栏 --> |
|||
<Search :schema="TableDataExtendedAttribute.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|||
</ContentWrap> |
|||
|
|||
<!-- 列表头部 --> |
|||
<TableHead |
|||
:HeadButttondata="HeadButttondata" |
|||
@button-base-click="buttonBaseClick" |
|||
:routeName="routeName" |
|||
@updataTableColumns="updataTableColumns" |
|||
@searchFormClick="searchFormClick" |
|||
:allSchemas="TableDataExtendedAttribute.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="TableDataExtendedAttributeRules" |
|||
:formAllSchemas="TableDataExtendedAttribute.allSchemas" |
|||
:apiUpdate="TableDataExtendedAttributeApi.updateTableDataExtendedAttribute" |
|||
:apiCreate="TableDataExtendedAttributeApi.createTableDataExtendedAttribute" |
|||
@searchTableSuccess="searchTableSuccess" |
|||
:isBusiness="false" |
|||
/> |
|||
|
|||
<!-- 详情 --> |
|||
<Detail ref="detailRef" :isBasic="true" :allSchemas="TableDataExtendedAttribute.allSchemas" /> |
|||
|
|||
<!-- 导入 --> |
|||
<ImportForm ref="importFormRef" url="/eam/table-data-extended-attribute/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import download from '@/utils/download' |
|||
import { TableDataExtendedAttribute,TableDataExtendedAttributeRules } from './tableDataExtendedAttribute.data' |
|||
import * as TableDataExtendedAttributeApi from '@/api/eam/tableDataExtendedAttribute' |
|||
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: 'TableDataExtendedAttribute' }) |
|||
|
|||
const message = useMessage() // 消息弹窗 |
|||
const { t } = useI18n() // 国际化 |
|||
|
|||
const route = useRoute() // 路由信息 |
|||
const routeName = ref() |
|||
routeName.value = route.name |
|||
const tableColumns = ref(TableDataExtendedAttribute.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: TableDataExtendedAttributeApi.getTableDataExtendedAttributePage // 分页接口 |
|||
}) |
|||
|
|||
// 获得表格的各种操作 |
|||
const { getList, setSearchParams } = tableMethods |
|||
|
|||
// 列表头部按钮 |
|||
const HeadButttondata = [ |
|||
defaultButtons.defaultAddBtn({hasPermi:'eam:table-data-extended-attribute:create'}), // 新增 |
|||
defaultButtons.defaultImportBtn({hasPermi:'eam:table-data-extended-attribute:import'}), // 导入 |
|||
defaultButtons.defaultExportBtn({hasPermi:'eam:table-data-extended-attribute: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:table-data-extended-attribute:update'}), // 编辑 |
|||
defaultButtons.mainListDeleteBtn({hasPermi:'eam:table-data-extended-attribute: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 =TableDataExtendedAttribute.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 TableDataExtendedAttributeApi.createTableDataExtendedAttribute(data) |
|||
message.success(t('common.createSuccess')) |
|||
} else { |
|||
await TableDataExtendedAttributeApi.updateTableDataExtendedAttribute(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, 'basicTableDataExtendedAttribute') |
|||
} |
|||
|
|||
/** 删除按钮操作 */ |
|||
const handleDelete = async (id: number) => { |
|||
try { |
|||
// 删除的二次确认 |
|||
await message.delConfirm() |
|||
// 发起删除 |
|||
await TableDataExtendedAttributeApi.deleteTableDataExtendedAttribute(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 TableDataExtendedAttributeApi.exportTableDataExtendedAttribute(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 TableDataExtendedAttributeApi.importTemplate() |
|||
}) |
|||
|
|||
</script> |
@ -0,0 +1,106 @@ |
|||
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
|||
import { dateFormatter } from '@/utils/formatTime' |
|||
|
|||
// 表单校验
|
|||
export const TableDataExtendedAttributeRules = reactive({ |
|||
tableName: [required], |
|||
dataId: [required], |
|||
fieldName: [required], |
|||
concurrencyStamp: [required] |
|||
}) |
|||
|
|||
export const TableDataExtendedAttribute = useCrudSchemas(reactive<CrudSchema[]>([ |
|||
{ |
|||
label: 'id', |
|||
field: 'id', |
|||
sort: 'custom', |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '表名称', |
|||
field: 'tableName', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '数据', |
|||
field: 'dataId', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '字段名称', |
|||
field: 'fieldName', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '字段值', |
|||
field: 'fieldVal', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '创建时间', |
|||
field: 'createTime', |
|||
sort: 'custom', |
|||
formatter: dateFormatter, |
|||
isSearch: true, |
|||
search: { |
|||
component: 'DatePicker', |
|||
componentProps: { |
|||
valueFormat: 'YYYY-MM-DD HH:mm:ss', |
|||
type: 'daterange', |
|||
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] |
|||
} |
|||
}, |
|||
isForm: false |
|||
}, |
|||
{ |
|||
label: '地点', |
|||
field: 'siteId', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '是否可用', |
|||
field: 'available', |
|||
sort: 'custom', |
|||
isSearch: true |
|||
}, |
|||
{ |
|||
label: '部门', |
|||
field: 'departmentCode', |
|||
sort: 'custom', |
|||
isSearch: true, |
|||
form: { |
|||
component: 'InputNumber', |
|||
value: 0 |
|||
} |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
field: 'remark', |
|||
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' |
|||
} |
|||
} |
|||
])) |
Loading…
Reference in new issue