|
@ -30,18 +30,18 @@ |
|
|
:apiUpdate="ItemApi.updateItem" :apiCreate="ItemApi.createItem" @searchTableSuccess="searchTableSuccess" |
|
|
:apiUpdate="ItemApi.updateItem" :apiCreate="ItemApi.createItem" @searchTableSuccess="searchTableSuccess" |
|
|
:isBusiness="false" /> |
|
|
:isBusiness="false" /> |
|
|
|
|
|
|
|
|
|
|
|
<SearchTable ref="searchTableRef" @searchTableSuccess="submitItem" /> |
|
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
<!-- 详情 --> |
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Item.allSchemas" /> |
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Item.allSchemas" /> |
|
|
|
|
|
|
|
|
<!-- 选择设备 --> |
|
|
|
|
|
<SearchTable ref="searchTableRef" @success="formsSuccess" :formAllSchemas="Item.allSchemas" |
|
|
|
|
|
@searchTableSuccess="searchTableSuccess" /> |
|
|
|
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import download from '@/utils/download' |
|
|
import download from '@/utils/download' |
|
|
import { Item, ItemRules } from './item.data' |
|
|
import { Item, ItemRules } from './item.data' |
|
|
import * as ItemApi from '@/api/eam/basic/item' |
|
|
import * as ItemApi from '@/api/eam/basic/item' |
|
|
|
|
|
import { createDeviceItemBatch, getDeviceItemPage } from '@/api/eam/basic/rel' |
|
|
import { DeviceAccounts, DeviceAccountsRules } from '@/views/eam/device/deviceAccounts/deviceAccounts.data' |
|
|
import { DeviceAccounts, DeviceAccountsRules } from '@/views/eam/device/deviceAccounts/deviceAccounts.data' |
|
|
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' |
|
@ -54,34 +54,19 @@ |
|
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
const message = useMessage() // 消息弹窗 |
|
|
const { t } = useI18n() // 国际化 |
|
|
const { t } = useI18n() // 国际化 |
|
|
|
|
|
|
|
|
const route = useRoute() // 路由信息 |
|
|
const route = useRoute() // 路由信息 |
|
|
const routeName = ref() |
|
|
const routeName = ref() |
|
|
routeName.value = route.name |
|
|
routeName.value = route.name |
|
|
|
|
|
const itemNumber = ref(); |
|
|
const tableColumns = ref(Item.allSchemas.tableColumns) |
|
|
const tableColumns = ref(Item.allSchemas.tableColumns) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const paramNumber = ref([]) |
|
|
|
|
|
// 查询页面返回 |
|
|
// 查询页面返回 |
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
// console.log(formField); |
|
|
nextTick(() => { |
|
|
// console.log(val); |
|
|
const setV = {} |
|
|
let dataResult = []; |
|
|
setV[formField] = val[0][searchField] |
|
|
let param = []; |
|
|
formRef.setValues(setV) |
|
|
val.forEach((element) => { |
|
|
|
|
|
dataResult.push(element.number); |
|
|
|
|
|
}) |
|
|
}) |
|
|
paramNumber.value.push(formField, dataResult); |
|
|
|
|
|
ItemApi.genDevice(paramNumber.value); |
|
|
|
|
|
message.success(t('common.delSuccess ')) |
|
|
|
|
|
// 刷新列表 |
|
|
|
|
|
getList() |
|
|
|
|
|
|
|
|
|
|
|
// nextTick(() => { |
|
|
|
|
|
// const setV = {} |
|
|
|
|
|
// setV[formField] = val[0][searchField] |
|
|
|
|
|
// formRef.setValues(setV) |
|
|
|
|
|
// }) |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
// 字段设置 更新主列表字段 |
|
@ -100,18 +85,9 @@ |
|
|
const HeadButttondata = [ |
|
|
const HeadButttondata = [ |
|
|
// defaultButtons.defaultAddBtn(null), // 新增 |
|
|
// defaultButtons.defaultAddBtn(null), // 新增 |
|
|
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: '自定义扩展按钮', |
|
|
|
|
|
// name: 'zdy', |
|
|
|
|
|
// hide: false, |
|
|
|
|
|
// type: 'primary', |
|
|
|
|
|
// icon: 'Select', |
|
|
|
|
|
// color: '' |
|
|
|
|
|
// }, |
|
|
|
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
// 头部按钮事件 |
|
@ -131,7 +107,7 @@ |
|
|
// 列表-操作按钮 |
|
|
// 列表-操作按钮 |
|
|
const butttondata = [ |
|
|
const butttondata = [ |
|
|
defaultButtons.mainListEditBtn(null), // 编辑 |
|
|
defaultButtons.mainListEditBtn(null), // 编辑 |
|
|
defaultButtons.selectDeviceBtn(null), // 选择设备 |
|
|
defaultButtons.chooseDeviceBtn(null),//备件 |
|
|
defaultButtons.mainListDeleteBtn(null), // 删除 |
|
|
defaultButtons.mainListDeleteBtn(null), // 删除 |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
@ -139,21 +115,30 @@ |
|
|
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 == 'selectDevice') { // 筛选 |
|
|
} else if (val == 'chooseDevice') { |
|
|
selectDevice(row) |
|
|
openItem(row.number) |
|
|
} else if (val == 'delete') { // 删除 |
|
|
} else if (val == 'delete') { // 删除 |
|
|
handleDelete(row.id) |
|
|
handleDelete(row.id) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** 添加设备操作 */ |
|
|
/** 添加设备操作 */ |
|
|
// (titleName: any, allSchemas: any,getApiPage: any, formField: any, searchField: any,multiple: any, type: any, row: any, searchCondition:any , isCountRequestRe:any ) |
|
|
|
|
|
const searchTableRef = ref() |
|
|
const searchTableRef = ref() |
|
|
const selectDevice = (row) => { |
|
|
const openItem = (number : String) => { |
|
|
searchTableRef.value.open('设备列表11', DeviceAccounts.allSchemas, DeviceAccountsApi.getDeviceAccountsPage, row.number, '', true, '', ''); |
|
|
itemNumber.value = number; |
|
|
// ItemApi.createItem(row) |
|
|
searchTableRef.value.open('设备列表', DeviceAccounts.allSchemas, DeviceAccountsApi.getDeviceAccountsPage, null, Item.allSchemas.searchSchema, true, null, null, null, null); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => { |
|
|
|
|
|
const deviceItemRelList = selections.map(element => ({ |
|
|
|
|
|
itemNumber: itemNumber.value, |
|
|
|
|
|
deviceNumber: element.number, |
|
|
|
|
|
})); |
|
|
|
|
|
createDeviceItemBatch(deviceItemRelList).then(res => { |
|
|
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
|
|
}) |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
/** 添加/修改操作 */ |
|
|
const basicFormRef = ref() |
|
|
const basicFormRef = ref() |
|
|
const openForm = (type : string, row ?: any) => { |
|
|
const openForm = (type : string, row ?: any) => { |
|
|