Browse Source

设备台账详情

master
zhang_li 10 months ago
parent
commit
0e27057384
  1. 1
      src/api/eam/device/deviceAccounts/index.ts
  2. 5
      src/api/eam/upload/index.ts
  3. 145
      src/components/Detail/src/DetailDeviceLedger.vue
  4. 2
      src/components/UploadFile/src/UploadImg.vue
  5. 2
      src/components/UploadFile/src/UploadImgs.vue
  6. 1
      src/utils/dict.ts
  7. 7
      src/utils/disposition/tabsList.ts
  8. 33
      src/views/eam/device/deviceAccounts/deviceAccounts.data.ts
  9. 240
      src/views/eam/device/deviceAccounts/index.vue
  10. 1
      src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts

1
src/api/eam/device/deviceAccounts/index.ts

@ -63,3 +63,4 @@ export const importTemplate = () => {
export const getDeviceAccountsNoPage = async (params) => { export const getDeviceAccountsNoPage = async (params) => {
return await request.get({ url: `/eam/device-accounts/selectData`, params }) return await request.get({ url: `/eam/device-accounts/selectData`, params })
} }

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

@ -0,0 +1,5 @@
import request from '@/config/axios'
// 上传图片
export const uploadImage = async (data) => {
return await request.post({ url: `/eam/attachment-file/upload`, data })
}

145
src/components/Detail/src/DetailDeviceLedger.vue

@ -40,15 +40,40 @@
:allSchemas="detailAllSchemas" :allSchemas="detailAllSchemas"
/> />
<!-- 默认单表展现 --> <!-- 默认单表展现 -->
<Descriptions <!-- <Descriptions
v-if="isBasic && !tabsExtend" v-if="isBasic && !tabsExtend"
:data="detailData" :data="detailData"
:schema="allSchemas.detailSchema" :schema="allSchemas.detailSchema"
:columns="2" :columns="2"
/> -->
<div v-if="isBasic && tabsExtend == 1">
<Form
ref="imageFormRef"
:rules="upImageRules"
:schema="imageFormSchemas"
:is-col="true"
/> />
<el-button type="primary" @click="uploadImage">点击上传</el-button>
</div>
<el-tabs type="border-card" class="demo-tabs" v-if="isBasic && tabsExtend == 2" @tab-change="handleTabsChange">
<el-tab-pane
v-for="(item,index) in subTabsList"
:key="item.value"
:label="item.label"
:name="item.value"
>
<Form
:ref="'fileFormRef'+ ( index + 1 )"
:rules="upFileRules"
:schema="fileFormSchemas"
:is-col="true"
/>
<el-button type="primary" @click="uploadFile($event,index)">点击上传</el-button>
</el-tab-pane>
</el-tabs>
<!-- 单表切换tabs 展现table --> <!-- 单表切换tabs 展现table -->
<Table <Table
v-if="isBasic && tabsExtend" v-if="isBasic && tabsExtend == 3"
:columns="detailAllSchemasRef.tableColumns" :columns="detailAllSchemasRef.tableColumns"
:data="tableObjectRef.tableList" :data="tableObjectRef.tableList"
:loading="tableObjectRef.loading" :loading="tableObjectRef.loading"
@ -73,7 +98,13 @@
v-model:currentPage="tableObjectRef.currentPage" v-model:currentPage="tableObjectRef.currentPage"
> >
<template #photos="{ row }"> <template #photos="{ row }">
<div v-for="(item,index) in row.photos.split(',')" :key="index" style="color:#409eff ; cursor: pointer;" @click="openImage(item)">{{ item }}</div> <div
v-for="(item, index) in row.photos.split(',')"
:key="index"
style="color: #409eff; cursor: pointer"
@click="openImage(item)"
>{{ item }}</div
>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase <ButtonBase
@ -127,6 +158,8 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
import BasicForm from '@/components/BasicForm/src/BasicForm.vue' import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import DetailTable from '@/components/DetailTable/src/DetailTable.vue' import DetailTable from '@/components/DetailTable/src/DetailTable.vue'
import { getCurrentInstance} from 'vue'
const { proxy } = getCurrentInstance()
defineOptions({ name: 'Detail' }) defineOptions({ name: 'Detail' })
@ -146,6 +179,12 @@ const props = defineProps({
required: true, required: true,
default: null default: null
}, },
//
subTabs: {
type: Object,
required: true,
default: null
},
// //
isBasic: { isBasic: {
type: Boolean, type: Boolean,
@ -234,15 +273,15 @@ const props = defineProps({
buttondataTable: { buttondataTable: {
type: Array, type: Array,
required: false, required: false,
default: ()=>{ default: () => {
return [] return []
} }
}, },
// tabs table false // tabs table false
tabsExtend: { tabsExtend: {
type: Boolean, type: Number,
required: false, required: false,
default: false default: 1
}, },
// tableObject // tableObject
tableObjectExtend: { tableObjectExtend: {
@ -251,17 +290,42 @@ const props = defineProps({
default: null default: null
}, },
// //
detailButtonIsShow:{ detailButtonIsShow: {
type: Boolean, type: Boolean,
required: false, required: false,
default: false default: false
},
//
upImageRules: {
type: Array,
required: false,
default: null
},
imageFormAllSchemas: {
type: Object,
required: true,
default: null
},
//
upFileRules: {
type: Array,
required: false,
default: null
},
fileFormAllSchemas: {
type: Object,
required: true,
default: null
} }
}) })
const isShowDrawer = ref(false) const isShowDrawer = ref(false)
const detailLoading = ref(false) const detailLoading = ref(false)
const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : ''))) const tabsList = ref(JSON.parse(JSON.stringify(props.tabs ? props.tabs : '')))
const subTabsList = ref(JSON.parse(JSON.stringify(props.subTabs ? props.subTabs : '')))
const imageFormSchemas = ref(props.imageFormAllSchemas?.formSchema)
const fileFormSchemas = ref(props.fileFormAllSchemas?.formSchema)
console.log('imageFormSchemas', imageFormSchemas.value)
// Tabs // Tabs
const current = ref(0) const current = ref(0)
@ -272,7 +336,7 @@ const change = (item, index) => {
// //
const masterParmas = ref({ const masterParmas = ref({
number: '', //id number: '' //id
// number: '', // // number: '', //
// status: '' // // status: '' //
}) })
@ -290,16 +354,19 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
titleNameRef.value = titleName titleNameRef.value = titleName
titleValueRef.value = titleValue titleValueRef.value = titleValue
// //
if (!props.isBasic) { if (!props.isBasic || (props.isBasic && props.tabsExtend)) {
// id // id
masterParmas.value.number = row.number masterParmas.value.number = row.number
// masterParmas.value.number = row.number // masterParmas.value.number = row.number
// masterParmas.value.status = row.status // masterParmas.value.status = row.status
if (!props.isBasic) {
tableObjectRef.value.params = { tableObjectRef.value.params = {
number: row.number number: row.number
} }
await getList() await getList()
} }
}
isShowDrawer.value = true isShowDrawer.value = true
if (row) { if (row) {
detailLoading.value = true detailLoading.value = true
@ -311,7 +378,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
defaultButtons.defaultFilterBtn(null) // defaultButtons.defaultFilterBtn(null) //
] ]
} else { } else {
if(!props.detailButtonIsShow){ if (!props.detailButtonIsShow) {
HeadButttondata.value = [ HeadButttondata.value = [
defaultButtons.defaultAddBtn({ defaultButtons.defaultAddBtn({
hide: isShowMainButton(row, ['1']) hide: isShowMainButton(row, ['1'])
@ -354,14 +421,16 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
} }
// //
if(!props.detailButtonIsShow){ if (!props.detailButtonIsShow) {
buttondata.value = [...[ buttondata.value = [
...[
defaultButtons.mainListEditBtn({ defaultButtons.mainListEditBtn({
hide: isShowMainButton(row, ['1']) hide: isShowMainButton(row, ['1'])
}), // }), //
defaultButtons.mainListDeleteBtn({ defaultButtons.mainListDeleteBtn({
hide: isShowMainButton(row, ['1']) hide: isShowMainButton(row, ['1'])
})], // })
], //
...props.buttondataTable ...props.buttondataTable
] ]
} }
@ -372,7 +441,6 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
} }
defineExpose({ openDetail }) // open defineExpose({ openDetail }) // open
const tableObjectRef = ref() const tableObjectRef = ref()
const tableMethodsRef = ref() const tableMethodsRef = ref()
const detailAllSchemasRef = ref() const detailAllSchemasRef = ref()
@ -434,7 +502,7 @@ const buttonTableClick = async (val, row) => {
// //
handleDelete(row.id) handleDelete(row.id)
} else { } else {
emit('tableFormButton',val, row) emit('tableFormButton', val, row)
} }
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
@ -475,7 +543,10 @@ const emit = defineEmits([
'selectChangeDetail', 'selectChangeDetail',
'detailOpenForm', 'detailOpenForm',
'tableFormButton', 'tableFormButton',
'openImage' 'openImage',
'uploadImage',
'subTabsChick',
'uploadFile'
]) ])
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {
@ -521,9 +592,45 @@ const selectChangeDetail = (field, val) => {
emit('selectChangeDetail', field, val) emit('selectChangeDetail', field, val)
} }
// //
const openImage=(item)=>{ const openImage = (item) => {
emit('openImage', item) emit('openImage', item)
} }
const imageFormRef = ref()
//
const uploadImage =async () => {
console.log(imageFormRef)
const elForm = unref(imageFormRef)?.getElFormRef()
//
if (!elForm) return
const valid = await elForm.validate()
if (!valid) return
emit(
'uploadImage',
masterParmas.value.number,
imageFormRef.value.formModel.filePath.map((item) => item.url)
)
}
// tabs
const handleTabsChange=(e)=>{
console.log(e)
emit('subTabsChick',e)
}
//
const fileFormRef = ref()
const uploadFile=async(e,index)=>{
console.log(proxy.$refs)
console.log(proxy.$refs['fileFormRef'+(index+1)))
const elForm = unref(fileFormRef)?.getElFormRef()
//
if (!elForm) return
const valid = await elForm.validate()
if (!valid) return
emit(
'uploadFile',
masterParmas.value.number,
fileFormRef.value.formModel.filePath.map((item) => item.url)
)
}
// //
watch( watch(
() => props.apiPage, () => props.apiPage,
@ -534,7 +641,7 @@ watch(
tableObject.params.number = masterParmas.value.number tableObject.params.number = masterParmas.value.number
detailAllSchemasRef.value = props.detailAllSchemas detailAllSchemasRef.value = props.detailAllSchemas
if (props.tableObjectExtend) { if (props.tableObjectExtend) {
props.tableObjectExtend.forEach(item => { props.tableObjectExtend.forEach((item) => {
tableObject.params[item.key] = item.value tableObject.params[item.key] = item.value
}) })
} }

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

@ -1,7 +1,7 @@
<template> <template>
<div class="upload-box"> <div class="upload-box">
<el-upload <el-upload
:action="updateUrl + '?tableId=' + upData?.tableId + '&tableName=' + upData?.tableName" :action="updateUrl"
:id="uuid" :id="uuid"
:class="['upload', drag ? 'no-border' : '']" :class="['upload', drag ? 'no-border' : '']"
:multiple="false" :multiple="false"

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

@ -3,7 +3,7 @@
<el-upload <el-upload
v-model:file-list="fileList" v-model:file-list="fileList"
:accept="fileType.join(',')" :accept="fileType.join(',')"
:action="updateUrl + '?tableId=' + upData?.tableId + '&tableName=' + upData?.tableName" :action="updateUrl"
:before-upload="beforeUpload" :before-upload="beforeUpload"
:class="['upload', drag ? 'no-border' : '']" :class="['upload', drag ? 'no-border' : '']"
:drag="drag" :drag="drag"

1
src/utils/dict.ts

@ -222,6 +222,7 @@ export enum DICT_TYPE {
REQEUST_MODE = 'reqeust_mode', // 申请模式 REQEUST_MODE = 'reqeust_mode', // 申请模式
TIME_UNIT = 'time_unit', // 时间单位 TIME_UNIT = 'time_unit', // 时间单位
COUNT_TYPE = 'count_type', // 盘点类型 COUNT_TYPE = 'count_type', // 盘点类型
DEVICE_DOC_TYPE = 'device_doc_type', // 盘点类型
COUNT_SCOPE_TYPE = 'count_scope_type', // 盘点范围类型 COUNT_SCOPE_TYPE = 'count_scope_type', // 盘点范围类型
BARCODE_PREFIX = 'barcode_prefix', // 条码前缀 BARCODE_PREFIX = 'barcode_prefix', // 条码前缀
SETTLEMENT_TYPE = 'settlement_type', // 结算类型 SETTLEMENT_TYPE = 'settlement_type', // 结算类型

7
src/utils/disposition/tabsList.ts

@ -1,8 +1,5 @@
// 设备台账tabs标签 // 设备台账tabs标签
export const DeviceLedgerTabsList = [{ export const DeviceLedgerTabsList = [
label: "设备信息",
prop: 'info',
},
{ {
label: "设备图片", label: "设备图片",
prop: 'Image', prop: 'Image',
@ -17,7 +14,7 @@ export const DeviceLedgerTabsList = [{
}, },
{ {
label: "报修记录", label: "报修记录",
prop: 'deviceReportRecord', prop: 'DeviceReportRecord',
}, },
{ {
label: "维修记录", label: "维修记录",

33
src/views/eam/device/deviceAccounts/deviceAccounts.data.ts

@ -137,6 +137,39 @@ export const DeviceAccounts = useCrudSchemas(reactive<CrudSchema[]>([
table: { table: {
width: 200, width: 200,
fixed: 'right' fixed: 'right'
},
isDetail: false,
}
]))
// 表单校验
export const UpImageRules = reactive({
filePath: [required],
})
export const UpImage = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '上传图片',
field: 'filePath',
sort: 'custom',
isForm: true,
form:{
component:'UploadImgs',
} }
},
]))
// 表单校验
export const UpFileRules = reactive({
filePath: [required],
})
export const UploadFile = useCrudSchemas(reactive<CrudSchema[]>([
{
label: '上传文件',
field: 'filePath',
sort: 'custom',
isForm: true,
form:{
component:'UploadFile',
} }
},
])) ]))

240
src/views/eam/device/deviceAccounts/index.vue

@ -1,7 +1,11 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="DeviceAccounts.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search
:schema="DeviceAccounts.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
@ -27,13 +31,13 @@
v-model:currentPage="tableObject.currentPage" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
> >
<template #number="{row}"> <template #number="{ row }">
<el-button type="primary" link @click="openDetail(row, '编号', row.number)"> <el-button type="primary" link @click="openDetail(row, '编号', row.number)">
<span>{{ row.number }}</span> <span>{{ row.number }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, row)" />
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -50,17 +54,13 @@
:isBusiness="false" :isBusiness="false"
/> />
<SearchTable ref="searchTableRef" @searchTableSuccess="submitItem" />
<SearchTable
ref="searchTableRef"
@searchTableSuccess="submitItem"
/>
<!-- 详情 --> <!-- 详情 -->
<DetailDeviceLedger <DetailDeviceLedger
ref="detailRef" ref="detailRef"
:tabs="DeviceLedgerTabsList" :tabs="DeviceLedgerTabsList"
:subTabs="DeviceLedgerSubTabsList"
:isBasic="true" :isBasic="true"
:allSchemas="allSchemas" :allSchemas="allSchemas"
@changeTabs="changeTabs" @changeTabs="changeTabs"
@ -68,24 +68,47 @@
:apiPage="apiPage" :apiPage="apiPage"
:tabsExtend="tabsExtend" :tabsExtend="tabsExtend"
:tableObjectExtend="tableObjectExtend" :tableObjectExtend="tableObjectExtend"
:imageFormAllSchemas="UpImage.allSchemas"
:upImageRules="UpImageRules"
:fileFormAllSchemas="UploadFile.allSchemas"
:upFileRules="UpFileRules"
@uploadImage="uploadImage"
@subTabsChick="subTabsChick"
@uploadFile="uploadFile"
/> />
<!-- 导入 --> <!-- 导入 -->
<ImportForm ref="importFormRef" url="/eam/device-accounts/import" :importTemplateData="importTemplateData" @success="importSuccess" /> <ImportForm
ref="importFormRef"
url="/eam/device-accounts/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { DeviceAccounts, DeviceAccountsRules } from './deviceAccounts.data' import {
DeviceAccounts,
DeviceAccountsRules,
UpImage,
UpImageRules,
UploadFile,
UpFileRules
} from './deviceAccounts.data'
import { Item } from '@/views/eam/basic/item/item.data' import { Item } from '@/views/eam/basic/item/item.data'
import { createDeviceItemBatch,getDeviceItemPage } from '@/api/eam/basic/rel' import * as ItemApi from '@/api/eam/basic/item'
import { createDeviceItemBatch, getDeviceItemPage } from '@/api/eam/basic/rel'
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts' import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
import { DeviceLedgerTabsList } from '@/utils/disposition/tabsList' import { DeviceLedgerTabsList } from '@/utils/disposition/tabsList'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import DetailDeviceLedger from '@/components/Detail/src/DetailDeviceLedger.vue' import DetailDeviceLedger from '@/components/Detail/src/DetailDeviceLedger.vue'
import * as ItemApi from '@/api/eam/basic/item' import { DeviceRepair } from '@/views/eam/device/deviceRepair/deviceRepair.data'
import * as deviceRepairApi from '@/api/eam/device/deviceRepair'
import * as uploadApi from '@/api/eam/upload'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
defineOptions({ name: 'DeviceAccounts' }) defineOptions({ name: 'DeviceAccounts' })
@ -94,13 +117,15 @@ const { t } = useI18n() // 国际化
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
const deviceNumber = ref(); const deviceNumber = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(DeviceAccounts.allSchemas.tableColumns) const tableColumns = ref(DeviceAccounts.allSchemas.tableColumns)
const allSchemas = ref(Item.allSchemas) const allSchemas = ref(DeviceAccounts.allSchemas)
const detailAllSchemas = ref() const detailAllSchemas = ref()
const apiPage = ref() const apiPage = ref()
const itemCodeRow = ref()
const tableObjectExtend = ref()
// //
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef) => {
@ -130,7 +155,7 @@ const HeadButttondata = [
defaultButtons.defaultExportBtn(null), // defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null) //
// { // {
// label: '', // label: '',
// name: 'zdy', // name: 'zdy',
@ -143,16 +168,22 @@ const HeadButttondata = [
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') {
//
openForm('create') openForm('create')
} else if (val == 'import') { // } else if (val == 'import') {
//
handleImport() handleImport()
} else if (val == 'export') { // } else if (val == 'export') {
//
handleExport() handleExport()
} else if (val == 'refresh') { // } else if (val == 'refresh') {
//
getList() getList()
} else if (val == 'filtrate') { // } else if (val == 'filtrate') {
} else { // //
} else {
//
console.log('其他按钮', item) console.log('其他按钮', item)
} }
} }
@ -161,15 +192,17 @@ const buttonBaseClick = (val, item) => {
const butttondata = [ const butttondata = [
defaultButtons.mainListEditBtn(null), // defaultButtons.mainListEditBtn(null), //
// defaultButtons.mainListDeleteBtn(null), // // defaultButtons.mainListDeleteBtn(null), //
defaultButtons.selectQrCodeBtn(null),// defaultButtons.selectQrCodeBtn(null), //
defaultButtons.selectItemBtn(null),// defaultButtons.selectItemBtn(null) //
] ]
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') {
//
openForm('update', row) openForm('update', row)
} else if (val == 'selectQrCode') { // } else if (val == 'selectQrCode') {
//
openQrCode(row.number) openQrCode(row.number)
} else if (val == 'selectItem') { } else if (val == 'selectItem') {
openItem(row.number) openItem(row.number)
@ -179,23 +212,22 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref() const basicFormRef = ref()
const openForm = (type: string, row?: any) => { const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
// form // form
const formsSuccess = async (formType,data) => { const formsSuccess = async (formType, data) => {
var isHave =DeviceAccounts.allSchemas.formSchema.some(function (item) { var isHave = DeviceAccounts.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime'; return item.field === 'activeTime' || item.field === 'expireTime'
}); })
if(isHave){ if (isHave) {
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间') message.error('失效时间要大于生效时间')
return; return
} }
} }
if(data.activeTime==0)data.activeTime = null; if (data.activeTime == 0) data.activeTime = null
if(data.expireTime==0)data.expireTime = null; if (data.expireTime == 0) data.expireTime = null
if (formType === 'create') { if (formType === 'create') {
await DeviceAccountsApi.createDeviceAccounts(data) await DeviceAccountsApi.createDeviceAccounts(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
@ -210,6 +242,7 @@ const formsSuccess = async (formType,data) => {
/** 详情操作 */ /** 详情操作 */
const detailRef = ref() const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => { const openDetail = (row: any, titleName: any, titleValue: any) => {
itemCodeRow.value = row.number
detailRef.value.openDetail(row, titleName, titleValue, 'basicDeviceAccounts') detailRef.value.openDetail(row, titleName, titleValue, 'basicDeviceAccounts')
} }
@ -266,13 +299,85 @@ const searchFormClick = (searchData) => {
getList() // getList() //
} }
const DeviceLedgerSubTabsList = getStrDictOptions(DICT_TYPE.DEVICE_DOC_TYPE)
const tabsExtend = ref()
const funcCode = ref('device_mould_picture')
// tabs
const changeTabs = (item) => {
if (item.prop == 'Image') {
tabsExtend.value = 1
funcCode.value = 'device_mould_picture'
// apiPage.value = CustomeritemApi.getCustomeritemPage
// detailAllSchemas.value = Customeritem.allSchemas
} else if (item.prop == 'Word') {
tabsExtend.value = 2
funcCode.value = 'device_mould_attachment'
apiPage.value = PurchaseDetailApi.getPurchaseDetailPage
detailAllSchemas.value = PurchaseMain.allSchemas
} else if (item.prop == 'Part') {
tabsExtend.value = 3
apiPage.value = deviceRepairApi.getDeviceRepairPage
detailAllSchemas.value = DeviceRepair.allSchemas
} else if (item.prop == 'DeviceReportRecord') {
tabsExtend.value = 3
apiPage.value = BalanceApi.getBalancePage
detailAllSchemas.value = Balance.allSchemas
} else if (item.prop == 'RepairRecord') {
tabsExtend.value = 3
apiPage.value = ExpectinApi.getExpectinPage
detailAllSchemas.value = Expectin.allSchemas
} else if (item.prop == 'MaintenanceRecord') {
tabsExtend.value = 3
apiPage.value = ExpectinApi.getExpectinPage
detailAllSchemas.value = Expectin.allSchemas
}
detailAllSchemas.value.tableColumns.map((item, index) => {
if (item.field == 'action') {
detailAllSchemas.value.tableColumns.splice(index, 1)
}
})
//
tableObjectExtend.value = [
{
key: 'itemCode',
value: itemCodeRow.value
}
]
}
const uploadImage = (number, filePath, fileBusiType) => {
let data = {
number,
filePathList: filePath,
funcCode: funcCode.value,
fileBusiType: fileBusiType ? fileBusiType : ''
}
uploadApi.uploadImage(data).then((res) => {
console.log(res)
})
}
//
const fileBusiType = ref()
const subTabsChick = (e) => {
fileBusiType.value = e
}
//
const uploadFile = (number, filePath, fileBusiType) => {
let data = {
number,
filePathList: filePath,
funcCode: funcCode.value,
fileBusiType: fileBusiType ? fileBusiType : ''
}
uploadApi.uploadImage(data).then((res) => {
console.log(res)
})
}
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()
importTemplateData.templateUrl = await DeviceAccountsApi.importTemplate() importTemplateData.templateUrl = await DeviceAccountsApi.importTemplate()
}) })
/** 二维码 */ /** 二维码 */
const openQrCode = async (number: String) => { const openQrCode = async (number: String) => {
// const data = await DeviceAccountsApi.getQrCode(number) // const data = await DeviceAccountsApi.getQrCode(number)
@ -297,26 +402,37 @@ const openQrCode = async (number: String) => {
const searchTableRef = ref() const searchTableRef = ref()
/** 绑定备件操作 */ /** 绑定备件操作 */
const openItem = async (number: String) => { const openItem = async (number: String) => {
deviceNumber.value = number; deviceNumber.value = number
searchTableRef.value.open("选择备件",Item.allSchemas,getDeviceItemList,null,Item.allSchemas.searchSchema,true,null, null, null, null); searchTableRef.value.open(
'选择备件',
Item.allSchemas,
getDeviceItemList,
null,
Item.allSchemas.searchSchema,
true,
null,
null,
null,
null
)
} }
const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => { const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => {
const deviceItemRelList = selections.map(element => ({ const deviceItemRelList = selections.map((element) => ({
deviceNumber: deviceNumber.value, deviceNumber: deviceNumber.value,
itemNumber: element.number, itemNumber: element.number
})); }))
createDeviceItemBatch(deviceItemRelList).then(res => { createDeviceItemBatch(deviceItemRelList).then((res) => {
console.log('res', res); console.log('res', res)
}) })
console.log('deviceItemRelList', deviceItemRelList); console.log('deviceItemRelList', deviceItemRelList)
}; }
const getItemWithOutBind = async () => { const getItemWithOutBind = async () => {
try { try {
const res = await ItemApi.getItemPage({ const res = await ItemApi.getItemPage({
...Item.allSchemas.searchSchema ...Item.allSchemas.searchSchema
}); })
if (res.list?.length > 0) { if (res.list?.length > 0) {
// const response = await getDeviceItemPage(DeviceAccounts.allSchemas.searchSchema); // const response = await getDeviceItemPage(DeviceAccounts.allSchemas.searchSchema);
// const filteredList = res.list.filter(item => { // const filteredList = res.list.filter(item => {
@ -325,32 +441,30 @@ const getItemWithOutBind = async () => {
// }); // });
// }); // });
// console.log('filteredList',filteredList); // console.log('filteredList',filteredList);
const filteredList = res.list; const filteredList = res.list
return filteredList; // return filteredList //
} }
return []; // return [] //
} catch (error) { } catch (error) {
console.error(error); console.error(error)
throw error; // throw error //
} }
}; }
// getListApi getItemWithOutBind // getListApi getItemWithOutBind
const getDeviceItemList = async () => { const getDeviceItemList = async () => {
tableObject.loading = true; tableObject.loading = true
try { try {
const res = await getItemWithOutBind(); const res = await getItemWithOutBind()
let result = { let result = {
list : res, list: res,
total : res.length, total: res.length
} }
return result; return result
} catch (error) { } catch (error) {
console.error(error); console.error(error)
} finally { } finally {
tableObject.loading = false; tableObject.loading = false
} }
}; }
</script> </script>

1
src/views/eam/device/deviceMaintenanceMain/deviceMaintenanceMain.data.ts

@ -199,6 +199,7 @@ export const DeviceMaintenanceMain = useCrudSchemas(reactive<CrudSchema[]>([
isDetail:false isDetail:false
} }
])) ]))
export const DeviceMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([ export const DeviceMaintenanceDetail = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '故障描述', label: '故障描述',

Loading…
Cancel
Save