Browse Source

设备台账代码差记录部分

master_hella_20240701
ljlong_2630 6 months ago
parent
commit
fd9945914f
  1. 20
      src/api/eam/attachmentFileUpload/index.ts
  2. 5
      src/api/eam/equipmentMainPart/index.ts
  3. 68
      src/api/eam/equipmentToolSparePart/index.ts
  4. 6
      src/api/eam/relationMainPart/index.ts
  5. 5
      src/api/eam/sparePart/index.ts
  6. 65
      src/api/eam/tableDataExtendedAttribute/index.ts
  7. 4
      src/components/Annex/src/Annex.vue
  8. 175
      src/components/Annex/src/AnnexLedger.vue
  9. 3
      src/components/AutoIncrementField/index.ts
  10. 106
      src/components/AutoIncrementField/src/AutoIncrementField.vue
  11. 1095
      src/components/Detail/src/DetailLedger.vue
  12. 7
      src/components/SearchTable/src/SearchTable.vue
  13. 8
      src/components/Table/src/Table.vue
  14. 2
      src/components/UploadFile/src/UploadFile.vue
  15. 4
      src/utils/disposition/defaultButtons.ts
  16. 115
      src/views/eam/equipmentAccounts/index.vue
  17. 135
      src/views/eam/equipmentToolSparePart/equipmentToolSparePart.data.ts
  18. 244
      src/views/eam/equipmentToolSparePart/index.vue
  19. 244
      src/views/eam/tableDataExtendedAttribute/index.vue
  20. 106
      src/views/eam/tableDataExtendedAttribute/tableDataExtendedAttribute.data.ts

20
src/api/eam/attachmentFileUpload/index.ts

@ -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 })
}

5
src/api/eam/equipmentMainPart/index.ts

@ -65,3 +65,8 @@ export const importTemplate = () => {
export const updateEnableCode = async (data: EquipmentMainPartVO) => {
return await request.post({ url: `/eam/equipment-main-part/ables` , data })
}
// 查询主要部件列表
export const getEquipmentMainPartNoPage = async (params) => {
return await request.get({ url: `/eam/equipment-main-part/noPage`, params })
}

68
src/api/eam/equipmentToolSparePart/index.ts

@ -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 })
}

6
src/api/eam/relationMainPart/index.ts

@ -59,3 +59,9 @@ export const importTemplate = () => {
export const getRelationMainPartNoPage = async (params) => {
return await request.get({ url: `/eam/relation/relation-main-part/noPage`, params })
}
// 新增主要部件批量关联
export const createRelationMainPartBatch = async (data: Array<RelationMainPartVO>) => {
return await request.post({ url: `/eam/relation/relation-main-part/createBatch`, data })
}

5
src/api/eam/sparePart/index.ts

@ -73,3 +73,8 @@ export const exportSparePart = async (params) => {
export const importTemplate = () => {
return request.download({ url: '/eam/sparepart/spare-part/get-import-template' })
}
// 查询备件基础列表
export const getSparePartNoPage = async (params) => {
return await request.get({ url: `/eam/sparepart/spare-part/noPage`, params })
}

65
src/api/eam/tableDataExtendedAttribute/index.ts

@ -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 })
}

4
src/components/Annex/src/Annex.vue

@ -75,8 +75,8 @@ const props = defineProps({
// emit
const emit = defineEmits(['handleAnnexSuccess', 'deleteAnnexSuccess','previewAnnexHandle'])
//
const handleAnnexSuccess = () => {
emit('handleAnnexSuccess')
const handleAnnexSuccess = (str,res,uploadFile) => {
emit('handleAnnexSuccess',str,res,uploadFile)
}
//

175
src/components/Annex/src/AnnexLedger.vue

@ -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>

3
src/components/AutoIncrementField/index.ts

@ -0,0 +1,3 @@
import AutoIncrementField from './src/AutoIncrementField.vue'
export { AutoIncrementField }

106
src/components/AutoIncrementField/src/AutoIncrementField.vue

@ -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>

1095
src/components/Detail/src/DetailLedger.vue

File diff suppressed because it is too large

7
src/components/SearchTable/src/SearchTable.vue

@ -24,6 +24,7 @@
v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage"
v-model:sort="tableObjectRef.sort"
:searchTableSelectionsList="searchTableSelectionsList"
:selection="true"
:reserveSelection="true"
row-key="id"
@ -72,6 +73,7 @@ const rowRef = ref()
const allSchemasRef = ref()
const multipleBol = ref(false)
const searchConditionRef = ref()
const searchTableSelectionsList = ref()//
const openData = (titleName: any, tableObject:any ,allSchemas: any,multiple: any) => {
dialogWidth.value = '80%'
@ -86,12 +88,12 @@ const openData = (titleName: any, tableObject:any ,allSchemas: any,multiple: any
searchSchema.value = allSchemas.searchSchema
tableColumns.value = allSchemas.tableColumns
}
const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, searchField: any,multiple: any, type: any, row: any, searchCondition:any , isCountRequestRe:any,isConcatDetailSchemas=false,detailSchemas: any) => {
const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, searchField: any,multiple: any, type: any, row: any, searchCondition:any , isCountRequestRe:any,isConcatDetailSchemas=false,detailSchemas: any, searchTableSelections:any) => {
dialogWidth.value = '80%'
HeadButttondata.value = [
defaultButtons.defaultFilterBtn(null), //
]
debugger
searchDialogVisible.value = true
formFieldRef.value = formField
searchFieldRef.value = searchField
@ -110,6 +112,7 @@ const open = (titleName: any, allSchemas: any,getApiPage: any, formField: any, s
multipleBol.value = multiple
// dialogTitle.value = t('action.' + type)
dialogTitle.value = t(`ts.${titleName}`).replace('ts.','')
searchTableSelectionsList.value = searchTableSelections
const {tableObject, tableMethods } = useTable({
getListApi: getPage.value //

8
src/components/Table/src/Table.vue

@ -57,7 +57,8 @@ export default defineComponent({
data: {
type: Array as PropType<Recordable[]>,
default: () => []
}
},
searchTableSelectionsList:[],//
},
emits: ['update:pageSize', 'update:currentPage', 'register', 'update:sort','getSelectionRows'],
setup(props, { attrs, slots, emit, expose }) {
@ -67,6 +68,11 @@ export default defineComponent({
onMounted(() => {
const tableRef = unref(elTableRef)
emit('register', tableRef?.$parent, elTableRef)
if (props.searchTableSelectionsList && props.searchTableSelectionsList.length > 0) {
props.searchTableSelectionsList.forEach(row => {
elTableRef.value.toggleRowSelection(row, true);
});
}
})
const pageSizeRef = ref(props.pageSize)

2
src/components/UploadFile/src/UploadFile.vue

@ -117,7 +117,7 @@ const handleFileSuccess: UploadProps['onSuccess'] = (res: any,uploadFile: any):
fileList.value = fileList.value.concat(uploadList.value)
uploadList.value = []
uploadNumber.value = 0
emit('update:modelValue', listToString(fileList.value))
emit('update:modelValue', listToString(fileList.value),res,uploadFile)
}
}
//

4
src/utils/disposition/defaultButtons.ts

@ -945,10 +945,10 @@ export function componentBtn(option:any) {
})
}
// 主列表-备件
export function itemBtn(option:any) {
export function sparePartBtn(option:any) {
return __defaultBtnOption(option,{
label: '备件',
name: 'item',
name: 'sparePart',
hide: false,
type: 'primary',
color: '',

115
src/views/eam/equipmentAccounts/index.vue

@ -51,10 +51,11 @@
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="EquipmentAccounts.allSchemas" />
<DetailLedger ref="detailRef" :isBasic="true" :allSchemas="EquipmentAccounts.allSchemas" :subTabs="subTabList" funcCode="device_mould_picture"/>
<!-- 主要部件 -->
<SearchTable ref="searchTableRef" @onMountedCallBack="onMountedCallBack" @searchTableSuccess="submitItem" />
<SearchTable ref="searchTableRef" @searchTableSuccess="submitEquipmentMainPartRelation" />
<!-- 备件 -->
<SearchTable ref="searchSparePartTableRef" @searchTableSuccess="submitSparePartRelation" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/equipment-accounts/import" :importTemplateData="importTemplateData" @success="importSuccess" />
</template>
@ -66,9 +67,15 @@ import * as EquipmentAccountsApi from '@/api/eam/equipmentAccounts'
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'
import DetailLedger from '@/components/Detail/src/DetailLedger.vue'
import { RelationMainPart,RelationMainPartRules } from '../relationMainPart/relationMainPart.data'
import * as RelationMainPartApi from '@/api/eam/relationMainPart'
import { EquipmentMainPart,EquipmentMainPartRules } from '../equipmentMainPart/equipmentMainPart.data'
import * as EquipmentMainPartApi from '@/api/eam/equipmentMainPart'
import { SparePart,SparePartRules } from '../sparePart/sparePart.data'
import * as SparePartApi from '@/api/eam/sparePart'
import { EquipmentToolSparePart,EquipmentToolSparePartRules } from '../equipmentToolSparePart/equipmentToolSparePart.data'
import * as EquipmentToolSparePartApi from '@/api/eam/equipmentToolSparePart'
defineOptions({ name: 'EquipmentAccounts' })
@ -77,9 +84,11 @@ const { t } = useI18n() // 国际化
const route = useRoute() //
const routeName = ref()
const deviceNumber = ref()
routeName.value = route.name
const tableColumns = ref(EquipmentAccounts.allSchemas.tableColumns)
const tabs = ref<{ label: string; prop: string; }[]>([])
const subTabList = ref([]);
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {
@ -139,7 +148,7 @@ const buttonBaseClick = (val, item) => {
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'eam:equipment-accounts:update'}), //
defaultButtons.componentBtn({hasPermi:'eam:equipment-accounts:component'}), //
defaultButtons.itemBtn({hasPermi:'eam:equipment-accounts:item'}), //
defaultButtons.sparePartBtn({hasPermi:'eam:equipment-accounts:item'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'eam:equipment-accounts:delete'}), //
]
@ -151,8 +160,8 @@ const buttonTableClick = async (val, row) => {
handleDelete(row.id)
} else if (val == 'component') { //
openComponent(row)
} else if (val == 'part') { //
openItem(row)
} else if (val == 'sparePart') { //
openSparePart(row)
}
}
@ -188,7 +197,8 @@ const formsSuccess = async (formType,data) => {
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
const openDetail = async (row: any, titleName: any, titleValue: any) => {
// subTabList.value = await
detailRef.value.openDetail(row, titleName, titleValue, 'basicEquipmentAccounts')
}
@ -247,31 +257,51 @@ const searchFormClick = (searchData) => {
const searchTableRef = ref()
const searchSparePartTableRef = ref()
const searchTableSelections = ref([])
// const syncData = async () => {
// await RelationMainPartApi.getRelationMainPartNoPage({ deviceNumber: deviceNumber.value }).then(async (res) => {
// await ItemApi.getItemNoPage().then(response => {
// searchTableSelections.value = response.filter(element => {
// let flag = false;
// res.forEach(item => {
// if (element.number == item.itemNumber) {
// flag = true;
// }
// });
// return flag;
// });
// });
// });
// };
const searchTableSparePartSelections = ref([])
const syncData = async (row) => {
await RelationMainPartApi.getRelationMainPartNoPage({ equipmentCode: row.code }).then(async (res) => {
await EquipmentMainPartApi.getEquipmentMainPartNoPage({}).then(response => {
searchTableSelections.value = response.filter(element => {
let flag = false;
res.forEach(item => {
if (element.code == item.mainPartCode) {
flag = true;
}
});
return flag;
});
});
});
};
const syncSparePartData = async (row) => {
await EquipmentToolSparePartApi.getEquipmentToolSparePartNoPage({ equipmentCode: row.code }).then(async (res) => {
await SparePartApi.getSparePartNoPage({}).then(response => {
searchTableSparePartSelections.value = response.filter(element => {
let flag = false;
res.forEach(item => {
if (element.code == item.sparePartCode) {
flag = true;
}
});
return flag;
});
});
});
};
/** 绑定备件操作 */
const openComponent = async (row : any) => {
await syncData(row)
searchTableRef.value.open(
'选择部件',
RelationMainPart.allSchemas,
RelationMainPartApi.getRelationMainPartPage,
null,
RelationMainPart.allSchemas.searchSchema,
EquipmentMainPart.allSchemas,
EquipmentMainPartApi.getEquipmentMainPartPage,
'equipmentMainPart',
EquipmentMainPart.allSchemas.searchSchema,
true,
null,//type
row,
null,
null,
null,
@ -280,8 +310,35 @@ const searchFormClick = (searchData) => {
)
}
const openItem = async (number : String) => {
const openSparePart = async (row : any) => {
await syncSparePartData(row)
searchSparePartTableRef.value.open(
'选择备件',
SparePart.allSchemas,
SparePartApi.getSparePartPage,
'sparePartPart',
SparePart.allSchemas.searchSchema,
true,
null,//type
row,
null,
null,
null,
null,
searchTableSparePartSelections.value
)
}
const submitEquipmentMainPartRelation = (formField, searchField, val, formRef, rowRef) => {
const deviceMainPartRelList = val.map((element) => ({
mainPartCode: element.code,
equipmentCode: rowRef.code,
type: 'DEVICE'
}))
RelationMainPartApi.createRelationMainPartBatch(deviceMainPartRelList).then(res => {
message.success(t('common.createSuccess'))
getList()
})
}
/** 初始化 **/

135
src/views/eam/equipmentToolSparePart/equipmentToolSparePart.data.ts

@ -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'
}
}
]))

244
src/views/eam/equipmentToolSparePart/index.vue

@ -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>

244
src/views/eam/tableDataExtendedAttribute/index.vue

@ -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>

106
src/views/eam/tableDataExtendedAttribute/tableDataExtendedAttribute.data.ts

@ -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…
Cancel
Save