Browse Source

备件选中回显

master
ljlong_2630 8 months ago
parent
commit
d642ff04e3
  1. 6
      src/api/eam/basic/item/index.ts
  2. 7
      src/api/eam/basic/rel/index.ts
  3. 6
      src/components/SearchTable/src/SearchTable.vue
  4. 2
      src/components/Table/src/Table.vue
  5. 25
      src/views/eam/device/deviceAccounts/index.vue

6
src/api/eam/basic/item/index.ts

@ -72,3 +72,9 @@ export const getItemList = async (params) => {
export const getaaa = async () => {
return await request.get({ url: `/eam/producePlan/produce`})
}
// 备件不分页
export const getItemNoPage = async (params) => {
return await request.get({ url: `/eam/item/noPage`, params })
}

7
src/api/eam/basic/rel/index.ts

@ -48,3 +48,10 @@ export const exportDeviceItem = async (params) => {
export const createDeviceItemBatch = async (data: Array<DeviceItemVO>) => {
return await request.post({url: `/rel/device-item/createBatch `, data });
};
// 查询设备备件关系列表
export const getDeviceItemNoPage = async (params) => {
return await request.get({ url: `/rel/device-item/noPage`, params })
}

6
src/components/SearchTable/src/SearchTable.vue

@ -134,7 +134,7 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
const searchTableRef = ref()
/** 提交表单 */
const emit = defineEmits(['searchTableSuccess']) // searchTableSuccess
const emit = defineEmits(['searchTableSuccess','onMountedCallBack']) // searchTableSuccess
const submitForm = async () => {
//
formLoading.value = true
@ -164,8 +164,8 @@ const submitForm = async () => {
}
}
const onMountedCallBack = (parent,tableRef)=>{
debugger
const onMountedCallBack = (parent, tableRef) => {
emit('onMountedCallBack', parent, tableRef)
}
</script>

2
src/components/Table/src/Table.vue

@ -52,7 +52,7 @@ export default defineComponent({
data: {
type: Array as PropType<Recordable[]>,
default: () => []
}
},
},
emits: ['update:pageSize', 'update:currentPage', 'register', 'update:sort'],
setup(props, { attrs, slots, emit, expose }) {

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

@ -93,7 +93,7 @@ import {
} from './deviceAccounts.data'
import { Item } from '@/views/eam/basic/item/item.data'
import * as ItemApi from '@/api/eam/basic/item'
import { createDeviceItemBatch, getDeviceItemPage } from '@/api/eam/basic/rel'
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'
@ -467,6 +467,27 @@ const qrCodeBatch = async (val,item) => {
window.open(src.value + "&number=" + qrCodeList)
}
const onMountedCallBack = (parent, searchTable) => {
getDeviceItemNoPage({ deviceNumber: deviceNumber.value }).then((res) => {
ItemApi.getItemNoPage().then(response => {
const selections = response.filter(element => {
let flag = false;
res.forEach(item => {
if (element.number == item.itemNumber) {
flag = true;
}
});
return flag;
});
// 使nextTick
// searchTable
if (searchTable && selections.length > 0) {
selections.forEach(row => {
searchTable.value.toggleRowSelection(row, true);
});
}
});
});
};
</script>

Loading…
Cancel
Save