|
|
@ -1,36 +1,20 @@ |
|
|
|
<template> |
|
|
|
<ContentWrap> |
|
|
|
<!-- 搜索工作栏 --> |
|
|
|
<Search |
|
|
|
:schema="DeviceAccounts.allSchemas.searchSchema" |
|
|
|
@search="setSearchParams" |
|
|
|
@reset="setSearchParams" |
|
|
|
/> |
|
|
|
<Search :schema="DeviceAccounts.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="DeviceAccounts.allSchemas" |
|
|
|
/> |
|
|
|
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" |
|
|
|
:allSchemas="DeviceAccounts.allSchemas" /> |
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
|
<ContentWrap> |
|
|
|
<Table |
|
|
|
:columns="tableColumns" |
|
|
|
:data="tableObject.tableList" |
|
|
|
:loading="tableObject.loading" |
|
|
|
:pagination="{ |
|
|
|
<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" |
|
|
|
> |
|
|
|
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" |
|
|
|
v-model:sort="tableObject.sort"> |
|
|
|
<template #number="{ row }"> |
|
|
|
<el-button type="primary" link @click="openDetail(row, '编号', row.number)"> |
|
|
|
<span>{{ row.number }}</span> |
|
|
@ -43,446 +27,421 @@ |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
|
<BasicForm |
|
|
|
ref="basicFormRef" |
|
|
|
@success="formsSuccess" |
|
|
|
:rules="DeviceAccountsRules" |
|
|
|
:formAllSchemas="DeviceAccounts.allSchemas" |
|
|
|
:apiUpdate="DeviceAccountsApi.updateDeviceAccounts" |
|
|
|
:apiCreate="DeviceAccountsApi.createDeviceAccounts" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
:isBusiness="false" |
|
|
|
/> |
|
|
|
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="DeviceAccountsRules" |
|
|
|
:formAllSchemas="DeviceAccounts.allSchemas" :apiUpdate="DeviceAccountsApi.updateDeviceAccounts" |
|
|
|
:apiCreate="DeviceAccountsApi.createDeviceAccounts" @searchTableSuccess="searchTableSuccess" :isBusiness="false" /> |
|
|
|
|
|
|
|
<SearchTable ref="searchTableRef" @onMountedCallBack="onMountedCallBack" @searchTableSuccess="submitItem" /> |
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
|
<DetailDeviceLedger |
|
|
|
ref="detailRef" |
|
|
|
:tabs="DeviceLedgerTabsList" |
|
|
|
:subTabs="DeviceLedgerSubTabsList" |
|
|
|
:isBasic="true" |
|
|
|
:allSchemas="allSchemas" |
|
|
|
@changeTabs="changeTabs" |
|
|
|
:detailAllSchemas="detailAllSchemas" |
|
|
|
:apiPage="apiPage" |
|
|
|
:tabsExtend="tabsExtend" |
|
|
|
:tabName="tabName" |
|
|
|
:tableObjectExtend="tableObjectExtend" |
|
|
|
:getImageApi="uploadApi.getImage" |
|
|
|
:uploadImage="uploadApi.uploadImage" |
|
|
|
:defaultParams="defaultParams" |
|
|
|
:dialogApiPage="dialogApiPage" |
|
|
|
:dialogAllSchemas="dialogAllSchemas" |
|
|
|
/> |
|
|
|
<DetailDeviceLedger ref="detailRef" :tabs="DeviceLedgerTabsList" :subTabs="DeviceLedgerSubTabsList" :isBasic="true" |
|
|
|
:allSchemas="allSchemas" @changeTabs="changeTabs" :detailAllSchemas="detailAllSchemas" :apiPage="apiPage" |
|
|
|
:tabsExtend="tabsExtend" :tabName="tabName" :tableObjectExtend="tableObjectExtend" :getImageApi="uploadApi.getImage" |
|
|
|
:uploadImage="uploadApi.uploadImage" :defaultParams="defaultParams" :dialogApiPage="dialogApiPage" |
|
|
|
:dialogAllSchemas="dialogAllSchemas" /> |
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
|
<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> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { |
|
|
|
DeviceAccounts, |
|
|
|
DeviceAccountsRules, |
|
|
|
} from './deviceAccounts.data' |
|
|
|
import { Item } from '@/views/eam/basic/item/item.data' |
|
|
|
import * as ItemApi from '@/api/eam/basic/item' |
|
|
|
import { createDeviceItemBatch, getDeviceItemPage,getDeviceItemNoPage } from '@/api/eam/basic/rel' |
|
|
|
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import { DeviceLedgerTabsList } from '@/utils/disposition/tabsList' |
|
|
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|
|
|
import DetailDeviceLedger from '@/components/Detail/src/DetailDeviceLedger.vue' |
|
|
|
import { DeviceRepair } from '@/views/eam/device/deviceRepair/deviceRepair.data' |
|
|
|
import { DeviceItem } from '@/views/eam/basic/deviceItem/deviceItem.data' |
|
|
|
import * as deviceRepairApi from '@/api/eam/device/deviceRepair' |
|
|
|
import * as uploadApi from '@/api/eam/upload' |
|
|
|
import * as DeviceMaintainOrderMainApi from '@/api/eam/device/deviceMaintainOrderMain' |
|
|
|
import * as DeviceMaintainOrderDetailApi from '@/api/eam/device/deviceMaintainOrderDetail' |
|
|
|
import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain' |
|
|
|
import * as deviceMaintenanceDetailApi from '@/api/eam/device/deviceMaintenanceDetail' |
|
|
|
import { getAccessToken } from '@/utils/auth' |
|
|
|
|
|
|
|
import { |
|
|
|
DeviceMaintainOrderMain, |
|
|
|
DeviceMaintainOrderDetail, |
|
|
|
} from '../devicemaintainjob/deviceMaintainOrderMain.data' |
|
|
|
import { |
|
|
|
DeviceMaintenanceMain, |
|
|
|
DeviceMaintenanceDetail |
|
|
|
} from '../devicemaintenancejob/deviceMaintenanceMain.data' |
|
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' |
|
|
|
|
|
|
|
defineOptions({ name: 'DeviceAccounts' }) |
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
|
const { t } = useI18n() // 国际化 |
|
|
|
|
|
|
|
const route = useRoute() // 路由信息 |
|
|
|
const routeName = ref() |
|
|
|
const deviceNumber = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref(DeviceAccounts.allSchemas.tableColumns) |
|
|
|
|
|
|
|
const allSchemas = ref(DeviceAccounts.allSchemas) |
|
|
|
const detailAllSchemas = ref() |
|
|
|
const apiPage = ref() |
|
|
|
const itemCodeRow = ref() |
|
|
|
const tableObjectExtend = ref() |
|
|
|
const defaultParams = ref({}) |
|
|
|
const dialogApiPage = ref() |
|
|
|
const dialogAllSchemas = ref() |
|
|
|
const BASE_URL = import.meta.env.VITE_JMREPORT_BASE_URL |
|
|
|
const src = ref(BASE_URL + '/jmreport/view/924818618605031424?token=' + getAccessToken()) |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
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: DeviceAccountsApi.getDeviceAccountsPage // 分页接口 |
|
|
|
}) |
|
|
|
|
|
|
|
// 获得表格的各种操作 |
|
|
|
const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
|
defaultButtons.defaultAddBtn(null), // 新增 |
|
|
|
defaultButtons.selectQrCodeBatchBtn(null), //批量生成二维码 |
|
|
|
// defaultButtons.defaultImportBtn(null), // 导入 |
|
|
|
// defaultButtons.defaultExportBtn(null), // 导出 |
|
|
|
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 == 'qrCodeBatch') { |
|
|
|
// 批量生成二维码 |
|
|
|
qrCodeBatch(val, item) |
|
|
|
} else if (val == 'export') { |
|
|
|
// 导出 |
|
|
|
handleExport() |
|
|
|
} else if (val == 'refresh') { |
|
|
|
// 刷新 |
|
|
|
getList() |
|
|
|
} else if (val == 'filtrate') { |
|
|
|
// 筛选 |
|
|
|
} else { |
|
|
|
// 其他按钮 |
|
|
|
console.log('其他按钮', item) |
|
|
|
import download from '@/utils/download' |
|
|
|
import { |
|
|
|
DeviceAccounts, |
|
|
|
DeviceAccountsRules, |
|
|
|
} from './deviceAccounts.data' |
|
|
|
import { Item } from '@/views/eam/basic/item/item.data' |
|
|
|
import * as ItemApi from '@/api/eam/basic/item' |
|
|
|
import { createDeviceItemBatch, getDeviceItemPage, getDeviceItemNoPage } from '@/api/eam/basic/rel' |
|
|
|
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import { DeviceLedgerTabsList } from '@/utils/disposition/tabsList' |
|
|
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|
|
|
import DetailDeviceLedger from '@/components/Detail/src/DetailDeviceLedger.vue' |
|
|
|
import { DeviceRepair } from '@/views/eam/device/deviceRepair/deviceRepair.data' |
|
|
|
import { DeviceItem } from '@/views/eam/basic/deviceItem/deviceItem.data' |
|
|
|
import * as deviceRepairApi from '@/api/eam/device/deviceRepair' |
|
|
|
import * as uploadApi from '@/api/eam/upload' |
|
|
|
import * as DeviceMaintainOrderMainApi from '@/api/eam/device/deviceMaintainOrderMain' |
|
|
|
import * as DeviceMaintainOrderDetailApi from '@/api/eam/device/deviceMaintainOrderDetail' |
|
|
|
import * as DeviceMaintenanceMainApi from '@/api/eam/device/deviceMaintenanceMain' |
|
|
|
import * as deviceMaintenanceDetailApi from '@/api/eam/device/deviceMaintenanceDetail' |
|
|
|
import { getAccessToken } from '@/utils/auth' |
|
|
|
|
|
|
|
import { |
|
|
|
DeviceMaintainOrderMain, |
|
|
|
DeviceMaintainOrderDetail, |
|
|
|
} from '../devicemaintainjob/deviceMaintainOrderMain.data' |
|
|
|
import { |
|
|
|
DeviceMaintenanceMain, |
|
|
|
DeviceMaintenanceDetail |
|
|
|
} from '../devicemaintenancejob/deviceMaintenanceMain.data' |
|
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' |
|
|
|
|
|
|
|
defineOptions({ name: 'DeviceAccounts' }) |
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
|
const { t } = useI18n() // 国际化 |
|
|
|
|
|
|
|
const route = useRoute() // 路由信息 |
|
|
|
const routeName = ref() |
|
|
|
const deviceNumber = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref(DeviceAccounts.allSchemas.tableColumns) |
|
|
|
|
|
|
|
const allSchemas = ref(DeviceAccounts.allSchemas) |
|
|
|
const detailAllSchemas = ref() |
|
|
|
const apiPage = ref() |
|
|
|
const itemCodeRow = ref() |
|
|
|
const tableObjectExtend = ref() |
|
|
|
const defaultParams = ref({}) |
|
|
|
const dialogApiPage = ref() |
|
|
|
const dialogAllSchemas = ref() |
|
|
|
const BASE_URL = import.meta.env.VITE_JMREPORT_BASE_URL |
|
|
|
const src = ref(BASE_URL + '/jmreport/view/924818618605031424?token=' + getAccessToken()) |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
formRef.setValues(setV) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
const updataTableColumns = (val) => { |
|
|
|
tableColumns.value = val |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = [ |
|
|
|
defaultButtons.mainListEditBtn(null), // 编辑 |
|
|
|
// defaultButtons.mainListDeleteBtn(null), // 删除 |
|
|
|
defaultButtons.selectQrCodeBtn(null), //二维码 |
|
|
|
defaultButtons.selectItemBtn(null) //备件 |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'edit') { |
|
|
|
// 编辑 |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'selectQrCode') { |
|
|
|
// 二维码 |
|
|
|
openQrCode(row.number) |
|
|
|
} else if (val == 'selectItem') { |
|
|
|
openItem(row.number) |
|
|
|
} else if (val == 'qrCode') { |
|
|
|
window.open(src.value + "&number='" + row.number + "'") |
|
|
|
} else { |
|
|
|
// 其他按钮 |
|
|
|
console.log('其他按钮', val, row) |
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
|
getListApi: DeviceAccountsApi.getDeviceAccountsPage // 分页接口 |
|
|
|
}) |
|
|
|
|
|
|
|
// 获得表格的各种操作 |
|
|
|
const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
|
defaultButtons.defaultAddBtn(null), // 新增 |
|
|
|
defaultButtons.selectQrCodeBatchBtn(null), //批量生成二维码 |
|
|
|
// defaultButtons.defaultImportBtn(null), // 导入 |
|
|
|
// defaultButtons.defaultExportBtn(null), // 导出 |
|
|
|
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 == 'qrCodeBatch') { |
|
|
|
// 批量生成二维码 |
|
|
|
qrCodeBatch(val, item) |
|
|
|
} else if (val == 'export') { |
|
|
|
// 导出 |
|
|
|
handleExport() |
|
|
|
} else if (val == 'refresh') { |
|
|
|
// 刷新 |
|
|
|
getList() |
|
|
|
} else if (val == 'filtrate') { |
|
|
|
// 筛选 |
|
|
|
} else { |
|
|
|
// 其他按钮 |
|
|
|
console.log('其他按钮', item) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = [ |
|
|
|
defaultButtons.mainListEditBtn(null), // 编辑 |
|
|
|
// defaultButtons.mainListDeleteBtn(null), // 删除 |
|
|
|
defaultButtons.selectQrCodeBtn(null), //二维码 |
|
|
|
defaultButtons.selectItemBtn(null) //备件 |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
|
const basicFormRef = ref() |
|
|
|
const openForm = (type: string, row?: any) => { |
|
|
|
basicFormRef.value.open(type, row) |
|
|
|
} |
|
|
|
|
|
|
|
// form表单提交 |
|
|
|
const formsSuccess = async (formType, data) => { |
|
|
|
var isHave = DeviceAccounts.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 |
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'edit') { |
|
|
|
// 编辑 |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'selectQrCode') { |
|
|
|
// 二维码 |
|
|
|
openQrCode(row.number) |
|
|
|
} else if (val == 'selectItem') { |
|
|
|
openItem(row.number) |
|
|
|
} else if (val == 'qrCode') { |
|
|
|
window.open(src.value + "&number='" + row.number + "'") |
|
|
|
} else { |
|
|
|
// 其他按钮 |
|
|
|
console.log('其他按钮', val, row) |
|
|
|
} |
|
|
|
} |
|
|
|
if (data.activeTime == 0) data.activeTime = null |
|
|
|
if (data.expireTime == 0) data.expireTime = null |
|
|
|
if (formType === 'create') { |
|
|
|
await DeviceAccountsApi.createDeviceAccounts(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
} else { |
|
|
|
await DeviceAccountsApi.updateDeviceAccounts(data) |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
} |
|
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
getList() |
|
|
|
} |
|
|
|
|
|
|
|
/** 详情操作 */ |
|
|
|
const detailRef = ref() |
|
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
|
itemCodeRow.value = row.number |
|
|
|
tabsExtend.value = 1 |
|
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicDeviceAccounts') |
|
|
|
} |
|
|
|
|
|
|
|
/** 删除按钮操作 */ |
|
|
|
const handleDelete = async (id: number) => { |
|
|
|
try { |
|
|
|
// 删除的二次确认 |
|
|
|
await message.delConfirm() |
|
|
|
// 发起删除 |
|
|
|
await DeviceAccountsApi.deleteDeviceAccounts(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 DeviceAccountsApi.exportDeviceAccounts(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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
|
const basicFormRef = ref() |
|
|
|
const openForm = (type : string, row ?: any) => { |
|
|
|
basicFormRef.value.open(type, row) |
|
|
|
} |
|
|
|
getList() // 刷新当前列表 |
|
|
|
} |
|
|
|
|
|
|
|
const DeviceLedgerSubTabsList = getStrDictOptions(DICT_TYPE.DEVICE_DOC_TYPE) |
|
|
|
const tabsExtend = ref() |
|
|
|
const tabName = ref() |
|
|
|
const funcCode = ref('device_mould_picture') |
|
|
|
// tabs 切换事件 |
|
|
|
const changeTabs = (item) => { |
|
|
|
if (item.prop == 'Image') { |
|
|
|
tabsExtend.value = 1 |
|
|
|
tabName.value = item.label |
|
|
|
funcCode.value = 'device_mould_picture' |
|
|
|
// apiPage.value = CustomeritemApi.getCustomeritemPage |
|
|
|
// detailAllSchemas.value = Customeritem.allSchemas |
|
|
|
} else if (item.prop == 'Word') { |
|
|
|
tabsExtend.value = 2 |
|
|
|
tabName.value = item.label |
|
|
|
funcCode.value = 'device_mould_attachment' |
|
|
|
// apiPage.value = PurchaseDetailApi.getPurchaseDetailPage |
|
|
|
// detailAllSchemas.value = PurchaseMain.allSchemas |
|
|
|
} else if (item.prop == 'Part') { |
|
|
|
tabsExtend.value = 4 |
|
|
|
tabName.value = item.label |
|
|
|
defaultParams.value = { |
|
|
|
deviceNumber: itemCodeRow |
|
|
|
|
|
|
|
// form表单提交 |
|
|
|
const formsSuccess = async (formType, data) => { |
|
|
|
var isHave = DeviceAccounts.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 |
|
|
|
} |
|
|
|
} |
|
|
|
apiPage.value = getDeviceItemPage |
|
|
|
detailAllSchemas.value = DeviceItem.allSchemas |
|
|
|
} else if (item.prop == 'DeviceReportRecord') { |
|
|
|
tabsExtend.value = 4 |
|
|
|
tabName.value = item.label |
|
|
|
defaultParams.value = { |
|
|
|
deviceNumber: itemCodeRow |
|
|
|
if (data.activeTime == 0) data.activeTime = null |
|
|
|
if (data.expireTime == 0) data.expireTime = null |
|
|
|
if (formType === 'create') { |
|
|
|
await DeviceAccountsApi.createDeviceAccounts(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
} else { |
|
|
|
await DeviceAccountsApi.updateDeviceAccounts(data) |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
} |
|
|
|
apiPage.value = deviceRepairApi.getDeviceRepairPage |
|
|
|
detailAllSchemas.value = DeviceRepair.allSchemas |
|
|
|
} else if (item.prop == 'RepairRecord') { |
|
|
|
tabsExtend.value = 3 |
|
|
|
tabName.value = item.label |
|
|
|
defaultParams.value = { |
|
|
|
deviceNumber: itemCodeRow |
|
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
getList() |
|
|
|
} |
|
|
|
|
|
|
|
/** 详情操作 */ |
|
|
|
const detailRef = ref() |
|
|
|
const openDetail = (row : any, titleName : any, titleValue : any) => { |
|
|
|
itemCodeRow.value = row.number |
|
|
|
tabsExtend.value = 1 |
|
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicDeviceAccounts') |
|
|
|
} |
|
|
|
|
|
|
|
/** 删除按钮操作 */ |
|
|
|
const handleDelete = async (id : number) => { |
|
|
|
try { |
|
|
|
// 删除的二次确认 |
|
|
|
await message.delConfirm() |
|
|
|
// 发起删除 |
|
|
|
await DeviceAccountsApi.deleteDeviceAccounts(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 DeviceAccountsApi.exportDeviceAccounts(tableObject.params) |
|
|
|
download.excel(data, '设备台账.xlsx') |
|
|
|
} catch { |
|
|
|
} finally { |
|
|
|
exportLoading.value = false |
|
|
|
} |
|
|
|
apiPage.value = DeviceMaintenanceMainApi.getDeviceMaintenanceMainPage |
|
|
|
detailAllSchemas.value = DeviceMaintenanceMain.allSchemas |
|
|
|
dialogApiPage.value = deviceMaintenanceDetailApi.getDeviceMaintenanceDetailPage |
|
|
|
dialogAllSchemas.value = DeviceMaintenanceDetail.allSchemas |
|
|
|
} else if (item.prop == 'MaintenanceRecord') { |
|
|
|
tabsExtend.value = 3 |
|
|
|
tabName.value = item.label |
|
|
|
defaultParams.value = { |
|
|
|
deviceNumber: itemCodeRow |
|
|
|
} |
|
|
|
|
|
|
|
/** 导入 */ |
|
|
|
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 |
|
|
|
} |
|
|
|
apiPage.value = DeviceMaintainOrderMainApi.getDeviceMaintainOrderMainPage |
|
|
|
detailAllSchemas.value = DeviceMaintainOrderMain.allSchemas |
|
|
|
dialogApiPage.value = DeviceMaintainOrderDetailApi.getDeviceMaintainOrderDetailPage |
|
|
|
dialogAllSchemas.value = DeviceMaintainOrderDetail.allSchemas |
|
|
|
getList() // 刷新当前列表 |
|
|
|
} |
|
|
|
// detailAllSchemas.value.tableColumns.map((item, index) => { |
|
|
|
// if (item.field == 'action') { |
|
|
|
// detailAllSchemas.value.tableColumns.splice(index, 1) |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// 当前物料代码作为条件 |
|
|
|
tableObjectExtend.value = [ |
|
|
|
{ |
|
|
|
key: 'itemCode', |
|
|
|
value: itemCodeRow.value |
|
|
|
|
|
|
|
const DeviceLedgerSubTabsList = getStrDictOptions(DICT_TYPE.DEVICE_DOC_TYPE) |
|
|
|
const tabsExtend = ref() |
|
|
|
const tabName = ref() |
|
|
|
const funcCode = ref('device_mould_picture') |
|
|
|
// tabs 切换事件 |
|
|
|
const changeTabs = (item) => { |
|
|
|
if (item.prop == 'Image') { |
|
|
|
tabsExtend.value = 1 |
|
|
|
tabName.value = item.label |
|
|
|
funcCode.value = 'device_mould_picture' |
|
|
|
// apiPage.value = CustomeritemApi.getCustomeritemPage |
|
|
|
// detailAllSchemas.value = Customeritem.allSchemas |
|
|
|
} else if (item.prop == 'Word') { |
|
|
|
tabsExtend.value = 2 |
|
|
|
tabName.value = item.label |
|
|
|
funcCode.value = 'device_mould_attachment' |
|
|
|
// apiPage.value = PurchaseDetailApi.getPurchaseDetailPage |
|
|
|
// detailAllSchemas.value = PurchaseMain.allSchemas |
|
|
|
} else if (item.prop == 'Part') { |
|
|
|
tabsExtend.value = 4 |
|
|
|
tabName.value = item.label |
|
|
|
defaultParams.value = { |
|
|
|
deviceNumber: itemCodeRow |
|
|
|
} |
|
|
|
apiPage.value = getDeviceItemPage |
|
|
|
detailAllSchemas.value = DeviceItem.allSchemas |
|
|
|
} else if (item.prop == 'DeviceReportRecord') { |
|
|
|
tabsExtend.value = 4 |
|
|
|
tabName.value = item.label |
|
|
|
defaultParams.value = { |
|
|
|
deviceNumber: itemCodeRow |
|
|
|
} |
|
|
|
apiPage.value = deviceRepairApi.getDeviceRepairPage |
|
|
|
detailAllSchemas.value = DeviceRepair.allSchemas |
|
|
|
} else if (item.prop == 'RepairRecord') { |
|
|
|
tabsExtend.value = 3 |
|
|
|
tabName.value = item.label |
|
|
|
defaultParams.value = { |
|
|
|
deviceNumber: itemCodeRow |
|
|
|
} |
|
|
|
apiPage.value = DeviceMaintenanceMainApi.getDeviceMaintenanceMainPage |
|
|
|
detailAllSchemas.value = DeviceMaintenanceMain.allSchemas |
|
|
|
dialogApiPage.value = deviceMaintenanceDetailApi.getDeviceMaintenanceDetailPage |
|
|
|
dialogAllSchemas.value = DeviceMaintenanceDetail.allSchemas |
|
|
|
} else if (item.prop == 'MaintenanceRecord') { |
|
|
|
tabsExtend.value = 3 |
|
|
|
tabName.value = item.label |
|
|
|
defaultParams.value = { |
|
|
|
deviceNumber: itemCodeRow |
|
|
|
} |
|
|
|
apiPage.value = DeviceMaintainOrderMainApi.getDeviceMaintainOrderMainPage |
|
|
|
detailAllSchemas.value = DeviceMaintainOrderMain.allSchemas |
|
|
|
dialogApiPage.value = DeviceMaintainOrderDetailApi.getDeviceMaintainOrderDetailPage |
|
|
|
dialogAllSchemas.value = DeviceMaintainOrderDetail.allSchemas |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 初始化 **/ |
|
|
|
onMounted(async () => { |
|
|
|
getList() |
|
|
|
importTemplateData.templateUrl = await DeviceAccountsApi.importTemplate() |
|
|
|
}) |
|
|
|
|
|
|
|
/** 二维码 */ |
|
|
|
const openQrCode = async (number: String) => { |
|
|
|
// const data = await DeviceAccountsApi.getQrCode(number) |
|
|
|
// const url = window.URL.createObjectURL(new Blob([data])) |
|
|
|
// const link = document.createElement('a') |
|
|
|
// link.style.display = 'none' |
|
|
|
// link.href = url |
|
|
|
// link.setAttribute('download', '设备二维码.png') |
|
|
|
// document.body.appendChild(link) |
|
|
|
// link.click() |
|
|
|
// try { |
|
|
|
// // 删除的二次确认 |
|
|
|
// await message.delConfirm() |
|
|
|
// // 发起删除 |
|
|
|
// await DeviceAccountsApi.deleteDeviceAccounts(id) |
|
|
|
// message.success(t('common.delSuccess')) |
|
|
|
// // 刷新列表 |
|
|
|
// await getList() |
|
|
|
// } catch {} |
|
|
|
} |
|
|
|
|
|
|
|
const searchTableRef = ref() |
|
|
|
/** 绑定备件操作 */ |
|
|
|
const openItem = async (number: String) => { |
|
|
|
deviceNumber.value = number |
|
|
|
await CallBack1() |
|
|
|
searchTableRef.value.open( |
|
|
|
'选择备件', |
|
|
|
Item.allSchemas, |
|
|
|
ItemApi.getItemPage, |
|
|
|
null, |
|
|
|
Item.allSchemas.searchSchema, |
|
|
|
true, |
|
|
|
null, |
|
|
|
null, |
|
|
|
null, |
|
|
|
null, |
|
|
|
searchTableSelections.value |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => { |
|
|
|
const deviceItemRelList = selections.map((element) => ({ |
|
|
|
deviceNumber: deviceNumber.value, |
|
|
|
itemNumber: element.number |
|
|
|
})) |
|
|
|
createDeviceItemBatch(deviceItemRelList).then((res) => { |
|
|
|
console.log('res', res) |
|
|
|
// detailAllSchemas.value.tableColumns.map((item, index) => { |
|
|
|
// if (item.field == 'action') { |
|
|
|
// detailAllSchemas.value.tableColumns.splice(index, 1) |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// 当前物料代码作为条件 |
|
|
|
tableObjectExtend.value = [ |
|
|
|
{ |
|
|
|
key: 'itemCode', |
|
|
|
value: itemCodeRow.value |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 初始化 **/ |
|
|
|
onMounted(async () => { |
|
|
|
getList() |
|
|
|
importTemplateData.templateUrl = await DeviceAccountsApi.importTemplate() |
|
|
|
}) |
|
|
|
console.log('deviceItemRelList', deviceItemRelList) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const getDeviceItemBindData = async (params) => { |
|
|
|
const response = await getDeviceItemPage(params); |
|
|
|
return response?.data; |
|
|
|
} |
|
|
|
|
|
|
|
const qrCodeBatch = async (val,item) => { |
|
|
|
const qrCodeList = tableObject.tableList.map(item => `'${item?.number}'`).join(', ') |
|
|
|
window.open(src.value + "&number=" + qrCodeList) |
|
|
|
} |
|
|
|
const searchTableSelections = ref([]) |
|
|
|
const CallBack1 = async () => { |
|
|
|
await getDeviceItemNoPage({ 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; |
|
|
|
} |
|
|
|
|
|
|
|
/** 二维码 */ |
|
|
|
const openQrCode = async (number : String) => { |
|
|
|
// const data = await DeviceAccountsApi.getQrCode(number) |
|
|
|
// const url = window.URL.createObjectURL(new Blob([data])) |
|
|
|
// const link = document.createElement('a') |
|
|
|
// link.style.display = 'none' |
|
|
|
// link.href = url |
|
|
|
// link.setAttribute('download', '设备二维码.png') |
|
|
|
// document.body.appendChild(link) |
|
|
|
// link.click() |
|
|
|
// try { |
|
|
|
// // 删除的二次确认 |
|
|
|
// await message.delConfirm() |
|
|
|
// // 发起删除 |
|
|
|
// await DeviceAccountsApi.deleteDeviceAccounts(id) |
|
|
|
// message.success(t('common.delSuccess')) |
|
|
|
// // 刷新列表 |
|
|
|
// await getList() |
|
|
|
// } catch {} |
|
|
|
} |
|
|
|
|
|
|
|
const searchTableRef = ref() |
|
|
|
/** 绑定备件操作 */ |
|
|
|
const openItem = async (number : String) => { |
|
|
|
deviceNumber.value = number |
|
|
|
await CallBack1() |
|
|
|
searchTableRef.value.open( |
|
|
|
'选择备件', |
|
|
|
Item.allSchemas, |
|
|
|
ItemApi.getItemPage, |
|
|
|
null, |
|
|
|
Item.allSchemas.searchSchema, |
|
|
|
true, |
|
|
|
null, |
|
|
|
null, |
|
|
|
null, |
|
|
|
null, |
|
|
|
searchTableSelections.value |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => { |
|
|
|
const deviceItemRelList = selections.map((element) => ({ |
|
|
|
deviceNumber: deviceNumber.value, |
|
|
|
itemNumber: element.number |
|
|
|
})) |
|
|
|
createDeviceItemBatch(deviceItemRelList).then((res) => { |
|
|
|
console.log('res', res) |
|
|
|
}) |
|
|
|
console.log('deviceItemRelList', deviceItemRelList) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const getDeviceItemBindData = async (params) => { |
|
|
|
const response = await getDeviceItemPage(params); |
|
|
|
return response?.data; |
|
|
|
} |
|
|
|
|
|
|
|
const qrCodeBatch = async (val, item) => { |
|
|
|
const qrCodeList = tableObject.tableList.map(item => `'${item?.number}'`).join(', ') |
|
|
|
window.open(src.value + "&number=" + qrCodeList) |
|
|
|
} |
|
|
|
const searchTableSelections = ref([]) |
|
|
|
const CallBack1 = async () => { |
|
|
|
await getDeviceItemNoPage({ 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; |
|
|
|
}); |
|
|
|
return flag; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
}; |
|
|
|
</script> |
|
|
|