设备和NC代码/图文关联代码
This commit is contained in:
parent
73828f64d9
commit
83905a4579
@ -79,6 +79,14 @@ export interface DeviceRealtimeVO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export interface DocumentEntity {
|
||||||
|
id?:number,
|
||||||
|
name?:string,
|
||||||
|
code?:string,
|
||||||
|
fileId?:number,
|
||||||
|
}
|
||||||
|
|
||||||
export const deviceApi = {
|
export const deviceApi = {
|
||||||
|
|
||||||
page(params:{
|
page(params:{
|
||||||
@ -169,5 +177,13 @@ export const deviceApi = {
|
|||||||
url:"/biz/device/list",
|
url:"/biz/device/list",
|
||||||
method:"get"
|
method:"get"
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getDeviceByNcId(params:{ncId:number,page:number,pageSize:number}){
|
||||||
|
return request({
|
||||||
|
url:"biz/device/getDeviceByNcId",
|
||||||
|
method:"get",
|
||||||
|
params
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
92
src/api/deviceDocumentConnection.ts
Normal file
92
src/api/deviceDocumentConnection.ts
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
import { request } from '@/utils/request'
|
||||||
|
|
||||||
|
// 设备和nc/图纸关联表 类型定义
|
||||||
|
export interface DeviceDocumentConnection {
|
||||||
|
id?: number
|
||||||
|
|
||||||
|
deviceId?: number
|
||||||
|
|
||||||
|
sourceId?: number
|
||||||
|
|
||||||
|
devcieIds?:[],
|
||||||
|
|
||||||
|
sourceIds?:[]
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设备和nc/图纸关联表 API
|
||||||
|
export const deviceDocumentConnectionApi = {
|
||||||
|
// 分页查询
|
||||||
|
page(params: { page: number; pageSize: number; id?: number }) {
|
||||||
|
return request({ url: '/biz/deviceDocumentConnection/page', method: 'get', params })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取详情
|
||||||
|
detail(id: number) {
|
||||||
|
return request({ url: `/biz/deviceDocumentConnection/${id}`, method: 'get' })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
create(data: DeviceDocumentConnection) {
|
||||||
|
return request({ url: '/biz/deviceDocumentConnection', method: 'post', data })
|
||||||
|
},
|
||||||
|
|
||||||
|
createDevice(data:DeviceDocumentConnection) {
|
||||||
|
return request({
|
||||||
|
url:"biz/deviceDocumentConnection/createDevice",
|
||||||
|
method:"post",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
createDeviceDraw(data:DeviceDocumentConnection) {
|
||||||
|
return request({
|
||||||
|
url:"biz/deviceDocumentConnection/createDeviceDraw",
|
||||||
|
method:"post",
|
||||||
|
data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 修改
|
||||||
|
update(data: DeviceDocumentConnection) {
|
||||||
|
return request({ url: '/biz/deviceDocumentConnection', method: 'put', data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
delete(ids: number[]) {
|
||||||
|
return request({ url: `/biz/deviceDocumentConnection/${ids.join(',')}`, method: 'delete' })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 导出
|
||||||
|
export(params?: { ids?: number[]; id?: number }) {
|
||||||
|
const p: Record<string, any> = {}
|
||||||
|
if (params?.ids?.length) p.ids = params.ids.join(',')
|
||||||
|
if (params?.id !== undefined && params?.id !== null) p.id = params.id
|
||||||
|
return request({ url: `/biz/deviceDocumentConnection/export`, method: 'get', params: p, responseType: 'blob' })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 导入
|
||||||
|
importData(file: File) {
|
||||||
|
const formData = new FormData()
|
||||||
|
formData.append('file', file)
|
||||||
|
return request<{ success: number; fail: number; errors: string[] }>({
|
||||||
|
url: `/biz/deviceDocumentConnection/import`,
|
||||||
|
method: 'post',
|
||||||
|
data: formData,
|
||||||
|
headers: { 'Content-Type': 'multipart/form-data' }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 下载导入模板
|
||||||
|
downloadTemplate() {
|
||||||
|
return request({ url: `/biz/deviceDocumentConnection/template`, method: 'get', responseType: 'blob' })
|
||||||
|
},
|
||||||
|
|
||||||
|
list(params:{page:number,pageSize:number}) {
|
||||||
|
return request({
|
||||||
|
url:"biz/deviceDocumentConnection/list",
|
||||||
|
method:"get",
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -87,3 +87,12 @@ export function multifilelist(fileId:any) {
|
|||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function getDeviceByDrawingId(params:{drawId?:number,page:number,pageSize:number}) {
|
||||||
|
return request({
|
||||||
|
url:"/biz/device/getDeviceByDrawingId",
|
||||||
|
method:"get",
|
||||||
|
params
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -285,6 +285,53 @@
|
|||||||
</template>
|
</template>
|
||||||
</n-modal>
|
</n-modal>
|
||||||
|
|
||||||
|
<!--工艺文档抽屉-->
|
||||||
|
<n-drawer v-model:show="deviceDocumentConnectionVisible" width="1000">
|
||||||
|
<n-drawer-content :title="title">
|
||||||
|
<n-space justify="space-between" class="mb-3">
|
||||||
|
<n-checkbox v-model:checked="isAllCheck" @update:checked="handleAllCheck">
|
||||||
|
全选当前筛选文档
|
||||||
|
</n-checkbox>
|
||||||
|
<n-tag type="info">已勾选 {{ selectedDeviceIds.length }} 道文档</n-tag>
|
||||||
|
</n-space>
|
||||||
|
|
||||||
|
<!-- 工序表格,带复选框 -->
|
||||||
|
<n-data-table
|
||||||
|
:columns="deviceColumns"
|
||||||
|
:data="deviceList"
|
||||||
|
max-height="700"
|
||||||
|
v-model:checked-row-keys="selectedDeviceIds"
|
||||||
|
:row-key="rowKey"
|
||||||
|
:scroll-x="1200"
|
||||||
|
:loading="connectionLoading"
|
||||||
|
@update:checked-row-keys="handleUpateCheck"
|
||||||
|
/>
|
||||||
|
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||||
|
<n-pagination
|
||||||
|
v-model:page="connectionPagination.page"
|
||||||
|
v-model:page-size="connectionPagination.pageSize"
|
||||||
|
:item-count="connectionPagination.itemCount"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
show-size-picker
|
||||||
|
show-quick-jumper
|
||||||
|
@update:page="handleRelatePageChange"
|
||||||
|
@update:page-size="handleRelatePageSizeChange"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
共 {{ connectionPagination.itemCount }} 条
|
||||||
|
</template>
|
||||||
|
</n-pagination>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<n-button @click="deviceDocumentConnectionVisible = false">
|
||||||
|
取消
|
||||||
|
</n-button>
|
||||||
|
</template>
|
||||||
|
</n-drawer-content>
|
||||||
|
</n-drawer>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +342,7 @@ import {
|
|||||||
ref,
|
ref,
|
||||||
reactive,
|
reactive,
|
||||||
h,
|
h,
|
||||||
onMounted,
|
onMounted, computed,
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
|
|
||||||
|
|
||||||
@ -308,7 +355,7 @@ import {
|
|||||||
NGrid,
|
NGrid,
|
||||||
useMessage,
|
useMessage,
|
||||||
useDialog,
|
useDialog,
|
||||||
NDropdown,
|
NDropdown, NTag, type DataTableColumns,
|
||||||
} from 'naive-ui'
|
} from 'naive-ui'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -338,6 +385,9 @@ import
|
|||||||
{
|
{
|
||||||
multifilelist
|
multifilelist
|
||||||
} from '@/api/illustrated'
|
} from '@/api/illustrated'
|
||||||
|
import {DeviceDocumentConnection, deviceDocumentConnectionApi} from "@/api/deviceDocumentConnection.ts";
|
||||||
|
import {Device, deviceApi} from "@/api/device.ts";
|
||||||
|
import {RowData} from "naive-ui/es/data-table/src/interface";
|
||||||
|
|
||||||
const dialog = useDialog()
|
const dialog = useDialog()
|
||||||
|
|
||||||
@ -475,7 +525,7 @@ const columns = [
|
|||||||
align:'center',
|
align:'center',
|
||||||
title: '操作',
|
title: '操作',
|
||||||
key: 'actions',
|
key: 'actions',
|
||||||
width: 260,
|
width: 360,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
render(row:any) {
|
render(row:any) {
|
||||||
const buttons:any = []
|
const buttons:any = []
|
||||||
@ -544,7 +594,15 @@ const columns = [
|
|||||||
{ default: () => '删除'}
|
{ default: () => '删除'}
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
buttons.push(h(NButton, {
|
||||||
|
size: 'small',
|
||||||
|
type:'primary',
|
||||||
|
ghost:true,
|
||||||
|
onClick: () => {
|
||||||
|
handlerConnectionDevice(row)
|
||||||
|
} },
|
||||||
|
{ default: () => '关联设备'}
|
||||||
|
))
|
||||||
|
|
||||||
return buttons.length > 0 ? h(NSpace, {justify:'center'}, { default: () => buttons }) : '-'
|
return buttons.length > 0 ? h(NSpace, {justify:'center'}, { default: () => buttons }) : '-'
|
||||||
}
|
}
|
||||||
@ -896,15 +954,125 @@ function handleExport() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const deviceDocumentConnectionVisible = ref<Boolean>(false)
|
||||||
|
const title = ref<String>("")
|
||||||
|
|
||||||
|
const deviceDocumentConnection = ref<DeviceDocumentConnection>({})
|
||||||
|
const connectionLoading = ref<boolean>(false)
|
||||||
|
const connectionPagination = reactive({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 2,
|
||||||
|
itemCount: 0,
|
||||||
|
showSizePicker: true,
|
||||||
|
pageSizes: [10, 20, 50]
|
||||||
|
})
|
||||||
|
|
||||||
|
const deviceList = ref<Device[]>([])
|
||||||
|
const selectedDeviceIds = ref<Device[]>([])
|
||||||
|
|
||||||
|
function handlerConnectionDevice(row:any) {
|
||||||
|
deviceDocumentConnectionVisible.value = true
|
||||||
|
title.value = row.deviceName + "设备工艺文档关联"
|
||||||
|
deviceDocumentConnection.sourceId = row.id
|
||||||
|
getDeviceList(deviceDocumentConnection.sourceId)
|
||||||
|
}
|
||||||
|
|
||||||
|
//取消|全选
|
||||||
|
const isAllCheck = computed({
|
||||||
|
get() {
|
||||||
|
return deviceList.value.length > 0 && selectedDeviceIds.value.length === deviceList.value.length
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
if (val) {
|
||||||
|
selectedDeviceIds.value = deviceList.value.map(item => item.id)
|
||||||
|
}else {
|
||||||
|
selectedDeviceIds.value = []
|
||||||
|
}
|
||||||
|
loadCreateApi()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
const handleAllCheck = (val:boolean) => {
|
||||||
|
isAllCheck.value = val
|
||||||
|
}
|
||||||
|
|
||||||
|
// function rowKey(row:RowData){
|
||||||
|
// return row.id
|
||||||
|
// }
|
||||||
|
const handleUpateCheck = async (keys:Array<string | number>,)=>{
|
||||||
|
selectedDeviceIds.value = keys
|
||||||
|
loadCreateApi()
|
||||||
|
}
|
||||||
|
|
||||||
|
const loadCreateApi = async ()=>{
|
||||||
|
deviceDocumentConnection.deviceIds = selectedDeviceIds.value
|
||||||
|
deviceDocumentConnection.page = connectionPagination.page
|
||||||
|
deviceDocumentConnection.pageSize = connectionPagination.pageSize
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
await deviceDocumentConnectionApi.createDevice(deviceDocumentConnection)
|
||||||
|
message.success("关联成功")
|
||||||
|
getDeviceList(deviceDocumentConnection.sourceId)
|
||||||
|
|
||||||
|
}catch (error) {
|
||||||
|
message.error("关联失败")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async function getDeviceList(id) {
|
||||||
|
try {
|
||||||
|
const res = await deviceApi.getDeviceByNcId({
|
||||||
|
ncId:id,
|
||||||
|
page:connectionPagination.page,
|
||||||
|
pageSize:connectionPagination.pageSize
|
||||||
|
})
|
||||||
|
deviceList.value = res.list
|
||||||
|
connectionPagination.itemCount = res.total
|
||||||
|
|
||||||
|
//回显
|
||||||
|
selectedDeviceIds.value = deviceList.value.filter(item=>item.isBind).map(item=>item.id)
|
||||||
|
connectionLoading.value = false
|
||||||
|
}catch (error) {
|
||||||
|
message.error("获取关联异常")
|
||||||
|
connectionLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 分页
|
||||||
|
function handleRelatePageChange(page: number) {
|
||||||
|
connectionPagination.page = page
|
||||||
|
getDeviceList(deviceDocumentConnection.sourceId)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRelatePageSizeChange(pageSize: number) {
|
||||||
|
connectionPagination.pageSize = pageSize
|
||||||
|
connectionPagination.page = 1
|
||||||
|
getDeviceList(deviceDocumentConnection.sourceId)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const deviceColumns:DataTableColumns<Device> = [
|
||||||
|
{ type: 'selection' },
|
||||||
|
{title: '设备名称', key: 'deviceName',width:80},
|
||||||
|
{ title: "关联状态",key:"isBind",width:80,
|
||||||
|
render(row) {
|
||||||
|
const val = row.isBind;
|
||||||
|
if (val) {
|
||||||
|
return h(NTag, { type: "success" }, { default: () => "已关联" });
|
||||||
|
} else {
|
||||||
|
return h(NTag, { type: "default" }, { default: () => "未关联" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
getlist()
|
getlist()
|
||||||
|
|
||||||
//查看下发记录
|
|
||||||
// async function handleDispatchRecord(row:ncCode){
|
|
||||||
// const ncId = row.id
|
|
||||||
// // ncDispatchRecords.value = await
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
||||||
@ -933,8 +1101,6 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
//loadDictOptions()
|
|
||||||
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -243,11 +243,57 @@
|
|||||||
</template>
|
</template>
|
||||||
</n-drawer-content>
|
</n-drawer-content>
|
||||||
</n-drawer>
|
</n-drawer>
|
||||||
|
|
||||||
|
<!--工艺文档抽屉-->
|
||||||
|
<n-drawer v-model:show="deviceDocumentConnectionVisible" width="1200">
|
||||||
|
<n-drawer-content :title="title">
|
||||||
|
<n-space justify="space-between" class="mb-3">
|
||||||
|
<n-checkbox v-model:checked="isAllCheck" @update:checked="handleAllCheck">
|
||||||
|
全选当前筛选文档
|
||||||
|
</n-checkbox>
|
||||||
|
<n-tag type="info">已勾选 {{ selectedDocumentIds.length }} 道文档</n-tag>
|
||||||
|
</n-space>
|
||||||
|
|
||||||
|
<!-- 工序表格,带复选框 -->
|
||||||
|
<n-data-table
|
||||||
|
:columns="documentColumns"
|
||||||
|
:data="documentList"
|
||||||
|
max-height="700"
|
||||||
|
v-model:checked-row-keys="selectedDocumentIds"
|
||||||
|
:row-key="rowKey"
|
||||||
|
:scroll-x="1200"
|
||||||
|
:loading="connectionLoading"
|
||||||
|
@update:checked-row-keys="handleUpateCheck"
|
||||||
|
/>
|
||||||
|
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||||
|
<n-pagination
|
||||||
|
v-model:page="connectionPagination.page"
|
||||||
|
v-model:page-size="connectionPagination.pageSize"
|
||||||
|
:item-count="connectionPagination.itemCount"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
show-size-picker
|
||||||
|
show-quick-jumper
|
||||||
|
@update:page="handleRelatePageChange"
|
||||||
|
@update:page-size="handleRelatePageSizeChange"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
共 {{ connectionPagination.itemCount }} 条
|
||||||
|
</template>
|
||||||
|
</n-pagination>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<n-button @click="doShowInner">
|
||||||
|
取消
|
||||||
|
</n-button>
|
||||||
|
</template>
|
||||||
|
</n-drawer-content>
|
||||||
|
</n-drawer>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, reactive, h, onMounted} from 'vue'
|
import {ref, reactive, h, onMounted, computed} from 'vue'
|
||||||
import {useRouter} from 'vue-router'
|
import {useRouter} from 'vue-router'
|
||||||
import {
|
import {
|
||||||
NButton, NSpace, NTag, NIcon, NUpload, useMessage, useDialog, type DataTableColumns, type UploadCustomRequestOptions,
|
NButton, NSpace, NTag, NIcon, NUpload, useMessage, useDialog, type DataTableColumns, type UploadCustomRequestOptions,
|
||||||
@ -262,17 +308,17 @@ import {
|
|||||||
CloudUploadOutline,
|
CloudUploadOutline,
|
||||||
DownloadOutline, EllipsisHorizontalOutline
|
DownloadOutline, EllipsisHorizontalOutline
|
||||||
} from '@vicons/ionicons5'
|
} from '@vicons/ionicons5'
|
||||||
import {deviceApi, type Device} from '@/api/device'
|
import {deviceApi, type Device, DocumentEntity} from '@/api/device'
|
||||||
|
|
||||||
import {dictDataApi} from '@/api/org'
|
import {dictDataApi} from '@/api/org'
|
||||||
import {sectionApi} from '@/api/section'
|
import {deptApi , userApi} from '@/api/system'
|
||||||
import {deptApi, type SysDept , userApi} from '@/api/system'
|
import {DeviceAbnormalRecord} from "@/api/deviceAbnormalRecord.ts";
|
||||||
import {DeviceAbnormalRecord, deviceAbnormalRecordApi} from "@/api/deviceAbnormalRecord.ts";
|
|
||||||
|
|
||||||
import DeviceAbnormalRecordPage from '@/views/biz/device/DeviceAbnomarlRecord.vue'
|
import DeviceAbnormalRecordPage from '@/views/biz/device/DeviceAbnomarlRecord.vue'
|
||||||
import DeviceOperationLogPage from "@/views/biz/device/DeviceOperationLog.vue";
|
import DeviceOperationLogPage from "@/views/biz/device/DeviceOperationLog.vue";
|
||||||
import DeviceDispatchLogPage from "@/views/biz/device/DeviceDispatchLog.vue";
|
import DeviceDispatchLogPage from "@/views/biz/device/DeviceDispatchLog.vue";
|
||||||
import { S } from 'vue-router/dist/router-CWoNjPRp.mjs'
|
import {DeviceDocumentConnection, deviceDocumentConnectionApi} from "@/api/deviceDocumentConnection.ts";
|
||||||
|
import {RowData} from "naive-ui/es/data-table/src/interface";
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
const dialog = useDialog()
|
const dialog = useDialog()
|
||||||
@ -305,6 +351,66 @@ const deviceDispatchLogDrawerVisible = ref<Boolean>(false)
|
|||||||
//操作日志抽屉
|
//操作日志抽屉
|
||||||
const deviceOperationLogDrawerVisible = ref<Boolean>(false)
|
const deviceOperationLogDrawerVisible = ref<Boolean>(false)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//设备工艺文档关联
|
||||||
|
const deviceDocumentConnectionVisible = ref<Boolean>(false)
|
||||||
|
const documentList = ref<DocumentEntity[]>([])
|
||||||
|
const selectedDocumentIds = ref<number[]>([])
|
||||||
|
const deviceDocumentConnection = ref<DeviceDocumentConnection>({})
|
||||||
|
const connectionLoading = ref<boolean>(false)
|
||||||
|
const connectionPagination = reactive({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 2,
|
||||||
|
itemCount: 0,
|
||||||
|
showSizePicker: true,
|
||||||
|
pageSizes: [10, 20, 50]
|
||||||
|
})
|
||||||
|
|
||||||
|
//取消|全选
|
||||||
|
const isAllCheck = computed({
|
||||||
|
get() {
|
||||||
|
return documentList.value.length > 0 && selectedDocumentIds.value.length === documentList.value.length
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
if (val) {
|
||||||
|
selectedDocumentIds.value = documentList.value.map(item => item.id)
|
||||||
|
}else {
|
||||||
|
selectedDocumentIds.value = []
|
||||||
|
}
|
||||||
|
loadCreateApi()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleAllCheck = (val:boolean) => {
|
||||||
|
isAllCheck.value = val
|
||||||
|
}
|
||||||
|
|
||||||
|
function rowKey(row:RowData){
|
||||||
|
return row.id
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleUpateCheck = async (keys:Array<string | number>,)=>{
|
||||||
|
selectedDocumentIds.value = keys
|
||||||
|
loadCreateApi()
|
||||||
|
}
|
||||||
|
|
||||||
|
const loadCreateApi = async ()=>{
|
||||||
|
deviceDocumentConnection.sourceIds = selectedDocumentIds.value
|
||||||
|
deviceDocumentConnection.page = connectionPagination.page
|
||||||
|
deviceDocumentConnection.pageSize = connectionPagination.pageSize
|
||||||
|
|
||||||
|
try {
|
||||||
|
await deviceDocumentConnectionApi.create(deviceDocumentConnection)
|
||||||
|
message.success("关联成功")
|
||||||
|
getDocumentList(deviceDocumentConnection.deviceId);
|
||||||
|
}catch (error){
|
||||||
|
message.error("关联失败")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 搜索表单
|
// 搜索表单
|
||||||
const searchForm = reactive({
|
const searchForm = reactive({
|
||||||
deviceCode: null as number | null,
|
deviceCode: null as number | null,
|
||||||
@ -427,6 +533,10 @@ const columns: DataTableColumns<Device> = [
|
|||||||
{
|
{
|
||||||
label: '设备操作日志',
|
label: '设备操作日志',
|
||||||
key: 'deviceOperationLog',
|
key: 'deviceOperationLog',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '设备工艺文档关联',
|
||||||
|
key: 'deviceDocumentConnection'
|
||||||
}
|
}
|
||||||
], onSelect: (key: string) => {
|
], onSelect: (key: string) => {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
@ -439,6 +549,8 @@ const columns: DataTableColumns<Device> = [
|
|||||||
case "deviceOperationLog":
|
case "deviceOperationLog":
|
||||||
deviceOperationLog(row)
|
deviceOperationLog(row)
|
||||||
break
|
break
|
||||||
|
case "deviceDocumentConnection":
|
||||||
|
handleDeviceDocumentConnection(row)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@ -454,6 +566,31 @@ const columns: DataTableColumns<Device> = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
const documentColumns:DataTableColumns<Document> = [
|
||||||
|
{ type: 'selection' },
|
||||||
|
{title: '文档名称', key: 'name',width:80},
|
||||||
|
{title: '文档类型', key: 'type',width:80,
|
||||||
|
render: (row) => {
|
||||||
|
var opt = row.type;
|
||||||
|
if (opt == 1) return "图纸"
|
||||||
|
if (opt == 2) return "文件"
|
||||||
|
if (opt == 3) return "NC代码"
|
||||||
|
return "-"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ title: "关联状态",key:"isBind",width:80,
|
||||||
|
render(row) {
|
||||||
|
const val = row.isBind;
|
||||||
|
if (val) {
|
||||||
|
return h(NTag, { type: "success" }, { default: () => "已关联" });
|
||||||
|
} else {
|
||||||
|
return h(NTag, { type: "default" }, { default: () => "未关联" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
// 加载数据
|
// 加载数据
|
||||||
async function loadData() {
|
async function loadData() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
@ -731,13 +868,55 @@ async function deviceOperationLog(row: Device) {
|
|||||||
deviceId.value = row.id
|
deviceId.value = row.id
|
||||||
deviceOperationLogDrawerVisible.value = true
|
deviceOperationLogDrawerVisible.value = true
|
||||||
title.value = row.deviceName + "操作记录";
|
title.value = row.deviceName + "操作记录";
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDeviceDocumentConnection(row:Device) {
|
||||||
|
deviceDocumentConnectionVisible.value = true
|
||||||
|
title.value = row.deviceName + "设备工艺文档关联"
|
||||||
|
deviceDocumentConnection.deviceId = row.id
|
||||||
|
getDocumentList(row.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getDocumentList(id) {
|
||||||
|
try {
|
||||||
|
const res = await deviceDocumentConnectionApi.list({
|
||||||
|
deviceId:id,
|
||||||
|
page:connectionPagination.page,
|
||||||
|
pageSize:connectionPagination.pageSize
|
||||||
|
});
|
||||||
|
documentList.value = res.list
|
||||||
|
connectionPagination.itemCount = res.total
|
||||||
|
|
||||||
|
//回显
|
||||||
|
selectedDocumentIds.value = documentList.value.filter(item=> item.isBind).map(item=>item.id)
|
||||||
|
connectionLoading.value = false
|
||||||
|
}catch (error) {
|
||||||
|
console.log("异常信息:"+error);
|
||||||
|
message.error("获取关联异常")
|
||||||
|
connectionLoading.value = false
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 分页
|
||||||
|
function handleRelatePageChange(page: number) {
|
||||||
|
connectionPagination.page = page
|
||||||
|
getDocumentList(deviceDocumentConnection.deviceId)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRelatePageSizeChange(pageSize: number) {
|
||||||
|
connectionPagination.pageSize = pageSize
|
||||||
|
connectionPagination.page = 1
|
||||||
|
getDocumentList(deviceDocumentConnection.deviceId)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function doShowInner() {
|
function doShowInner() {
|
||||||
deviceAbnormalRecordDrawerVisible.value = false
|
deviceAbnormalRecordDrawerVisible.value = false
|
||||||
deviceOperationLogDrawerVisible.value = false
|
deviceOperationLogDrawerVisible.value = false
|
||||||
deviceDispatchLogDrawerVisible.value = false
|
deviceDispatchLogDrawerVisible.value = false
|
||||||
|
deviceDocumentConnectionVisible.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
369
src/views/biz/deviceDocumentConnection/index.vue
Normal file
369
src/views/biz/deviceDocumentConnection/index.vue
Normal file
@ -0,0 +1,369 @@
|
|||||||
|
<template>
|
||||||
|
<div class="page-container">
|
||||||
|
<n-card>
|
||||||
|
<!-- 搜索表单 -->
|
||||||
|
<div class="search-form">
|
||||||
|
<n-form inline :model="searchForm" label-placement="left">
|
||||||
|
<n-form-item label="主键ID">
|
||||||
|
<n-input v-model:value="searchForm.id" placeholder="请输入主键ID" clearable />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item>
|
||||||
|
<n-space>
|
||||||
|
<n-button type="primary" @click="handleSearch">
|
||||||
|
<template #icon><n-icon><SearchOutline /></n-icon></template>
|
||||||
|
搜索
|
||||||
|
</n-button>
|
||||||
|
<n-button @click="handleReset">
|
||||||
|
<template #icon><n-icon><RefreshOutline /></n-icon></template>
|
||||||
|
重置
|
||||||
|
</n-button>
|
||||||
|
</n-space>
|
||||||
|
</n-form-item>
|
||||||
|
</n-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 工具栏 -->
|
||||||
|
<div class="table-toolbar">
|
||||||
|
<n-space>
|
||||||
|
<n-button type="primary" @click="handleAdd">
|
||||||
|
<template #icon><n-icon><AddOutline /></n-icon></template>
|
||||||
|
新增
|
||||||
|
</n-button>
|
||||||
|
<n-button @click="importModalVisible = true">
|
||||||
|
<template #icon><n-icon><CloudUploadOutline /></n-icon></template>
|
||||||
|
导入
|
||||||
|
</n-button>
|
||||||
|
<n-button @click="handleExport">
|
||||||
|
<template #icon><n-icon><DownloadOutline /></n-icon></template>
|
||||||
|
导出{{ selectedIds.length > 0 ? `(${selectedIds.length})` : '' }}
|
||||||
|
</n-button>
|
||||||
|
<n-button type="error" :disabled="selectedIds.length === 0" @click="handleBatchDelete">
|
||||||
|
<template #icon><n-icon><TrashOutline /></n-icon></template>
|
||||||
|
删除
|
||||||
|
</n-button>
|
||||||
|
</n-space>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 表格 -->
|
||||||
|
<n-data-table
|
||||||
|
:columns="columns"
|
||||||
|
:data="tableData"
|
||||||
|
:loading="loading"
|
||||||
|
:pagination="pagination"
|
||||||
|
:row-key="(row) => row.id"
|
||||||
|
:scroll-x="1200"
|
||||||
|
@update:page="handlePageChange"
|
||||||
|
@update:page-size="handlePageSizeChange"
|
||||||
|
@update:checked-row-keys="handleCheck"
|
||||||
|
/>
|
||||||
|
</n-card>
|
||||||
|
|
||||||
|
<!-- 新增/编辑弹窗 -->
|
||||||
|
<n-modal v-model:show="modalVisible" preset="card" :title="modalTitle" style="width: 600px">
|
||||||
|
<n-form ref="formRef" :model="formData" :rules="formRules" label-placement="left" label-width="100px">
|
||||||
|
<n-form-item label="设备ID" path="deviceId">
|
||||||
|
<n-input v-model:value="formData.deviceId" placeholder="请输入设备ID" />
|
||||||
|
</n-form-item>
|
||||||
|
<n-form-item label="NC/图纸ID" path="sourceId">
|
||||||
|
<n-input v-model:value="formData.sourceId" placeholder="请输入NC/图纸ID" />
|
||||||
|
</n-form-item>
|
||||||
|
</n-form>
|
||||||
|
<template #footer>
|
||||||
|
<n-space justify="end">
|
||||||
|
<n-button @click="modalVisible = false">取消</n-button>
|
||||||
|
<n-button type="primary" @click="handleSubmit">确定</n-button>
|
||||||
|
</n-space>
|
||||||
|
</template>
|
||||||
|
</n-modal>
|
||||||
|
|
||||||
|
<!-- 导入弹窗 -->
|
||||||
|
<n-modal v-model:show="importModalVisible" preset="card" title="导入设备和nc/图纸关联表" style="width: 500px">
|
||||||
|
<n-space vertical>
|
||||||
|
<n-alert type="info">
|
||||||
|
<template #header>导入说明</template>
|
||||||
|
<ul style="margin: 0; padding-left: 16px; line-height: 1.8">
|
||||||
|
<li>请先下载导入模板,按模板格式填写数据</li>
|
||||||
|
<li>支持 .xlsx 或 .xls 格式</li>
|
||||||
|
</ul>
|
||||||
|
</n-alert>
|
||||||
|
<n-space>
|
||||||
|
<n-button type="primary" @click="handleDownloadTemplate">
|
||||||
|
<template #icon><n-icon><DownloadOutline /></n-icon></template>
|
||||||
|
下载模板
|
||||||
|
</n-button>
|
||||||
|
</n-space>
|
||||||
|
<n-upload :max="1" accept=".xlsx,.xls" :show-file-list="true" :custom-request="handleImportUpload">
|
||||||
|
<n-upload-dragger>
|
||||||
|
<div style="margin-bottom: 12px">
|
||||||
|
<n-icon size="48" :depth="3"><CloudUploadOutline /></n-icon>
|
||||||
|
</div>
|
||||||
|
<n-text style="font-size: 16px">点击或拖拽文件到此处上传</n-text>
|
||||||
|
<n-p depth="3" style="margin: 8px 0 0 0">支持 .xlsx 或 .xls 格式</n-p>
|
||||||
|
</n-upload-dragger>
|
||||||
|
</n-upload>
|
||||||
|
</n-space>
|
||||||
|
<template #footer>
|
||||||
|
<n-button @click="importModalVisible = false">关闭</n-button>
|
||||||
|
</template>
|
||||||
|
</n-modal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive, h, onMounted } from 'vue'
|
||||||
|
import { NButton, NSpace, NIcon, NUpload, useMessage, useDialog, type DataTableColumns, type UploadCustomRequestOptions } from 'naive-ui'
|
||||||
|
import { SearchOutline, RefreshOutline, AddOutline, TrashOutline, CreateOutline, CloudUploadOutline, DownloadOutline } from '@vicons/ionicons5'
|
||||||
|
import { deviceDocumentConnectionApi, type DeviceDocumentConnection } from '@/api/deviceDocumentConnection'
|
||||||
|
|
||||||
|
const message = useMessage()
|
||||||
|
const dialog = useDialog()
|
||||||
|
|
||||||
|
// 搜索表单
|
||||||
|
const searchForm = reactive({
|
||||||
|
id: null as number | null,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 表格数据
|
||||||
|
const tableData = ref<DeviceDocumentConnection[]>([])
|
||||||
|
const loading = ref(false)
|
||||||
|
const selectedIds = ref<number[]>([])
|
||||||
|
const pagination = reactive({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
itemCount: 0,
|
||||||
|
showSizePicker: true,
|
||||||
|
pageSizes: [10, 20, 50]
|
||||||
|
})
|
||||||
|
|
||||||
|
// 弹窗
|
||||||
|
const modalVisible = ref(false)
|
||||||
|
const modalTitle = ref('')
|
||||||
|
const importModalVisible = ref(false)
|
||||||
|
const formRef = ref()
|
||||||
|
const defaultFormData: DeviceDocumentConnection = {
|
||||||
|
deviceId: undefined,
|
||||||
|
sourceId: undefined,
|
||||||
|
}
|
||||||
|
const formData = reactive<DeviceDocumentConnection>({ ...defaultFormData })
|
||||||
|
|
||||||
|
// 字典选项(下拉框/单选框/复选框关联字典时使用)
|
||||||
|
|
||||||
|
// 表单校验规则
|
||||||
|
const formRules = {
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表格列
|
||||||
|
const columns: DataTableColumns<DeviceDocumentConnection> = [
|
||||||
|
{ type: 'selection' },
|
||||||
|
{ title: '主键ID', key: 'id' },
|
||||||
|
{ title: '设备ID', key: 'deviceId' },
|
||||||
|
{ title: 'NC/图纸ID', key: 'sourceId' },
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'actions',
|
||||||
|
width: 140,
|
||||||
|
fixed: 'right',
|
||||||
|
render(row) {
|
||||||
|
return h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'nowrap' } }, [
|
||||||
|
h(NButton, { size: 'small', quaternary: true, onClick: () => handleEdit(row) }, {
|
||||||
|
default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' 编辑']
|
||||||
|
}),
|
||||||
|
h(NButton, { size: 'small', quaternary: true, type: 'error', onClick: () => handleDelete(row) }, {
|
||||||
|
default: () => [h(NIcon, null, { default: () => h(TrashOutline) }), ' 删除']
|
||||||
|
})
|
||||||
|
])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
// 加载数据
|
||||||
|
async function loadData() {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const res = await deviceDocumentConnectionApi.page({
|
||||||
|
page: pagination.page,
|
||||||
|
pageSize: pagination.pageSize,
|
||||||
|
id: searchForm.id || undefined,
|
||||||
|
})
|
||||||
|
tableData.value = res.list
|
||||||
|
pagination.itemCount = res.total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
function handleSearch() {
|
||||||
|
pagination.page = 1
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置
|
||||||
|
function handleReset() {
|
||||||
|
searchForm.id = null
|
||||||
|
|
||||||
|
handleSearch()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分页
|
||||||
|
function handlePageChange(page: number) {
|
||||||
|
pagination.page = page
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePageSizeChange(pageSize: number) {
|
||||||
|
pagination.pageSize = pageSize
|
||||||
|
pagination.page = 1
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 选择
|
||||||
|
function handleCheck(keys: Array<string | number>) {
|
||||||
|
selectedIds.value = keys as number[]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
function handleAdd() {
|
||||||
|
modalTitle.value = '新增设备和nc/图纸关联表'
|
||||||
|
Object.assign(formData, defaultFormData)
|
||||||
|
modalVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
function handleEdit(row: DeviceDocumentConnection) {
|
||||||
|
modalTitle.value = '编辑设备和nc/图纸关联表'
|
||||||
|
Object.assign(formData, row)
|
||||||
|
modalVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交
|
||||||
|
async function handleSubmit() {
|
||||||
|
await formRef.value?.validate()
|
||||||
|
try {
|
||||||
|
const submitData = { ...formData } as DeviceDocumentConnection
|
||||||
|
if (submitData.id) {
|
||||||
|
await deviceDocumentConnectionApi.update(submitData)
|
||||||
|
message.success('修改成功')
|
||||||
|
} else {
|
||||||
|
await deviceDocumentConnectionApi.create(submitData)
|
||||||
|
message.success('新增成功')
|
||||||
|
}
|
||||||
|
modalVisible.value = false
|
||||||
|
loadData()
|
||||||
|
} catch (error) {
|
||||||
|
// 错误已在拦截器处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
function handleDelete(row: DeviceDocumentConnection) {
|
||||||
|
dialog.warning({
|
||||||
|
title: '提示',
|
||||||
|
content: '确定要删除该记录吗?',
|
||||||
|
positiveText: '确定',
|
||||||
|
negativeText: '取消',
|
||||||
|
onPositiveClick: async () => {
|
||||||
|
try {
|
||||||
|
await deviceDocumentConnectionApi.delete([row.id!])
|
||||||
|
message.success('删除成功')
|
||||||
|
loadData()
|
||||||
|
} catch (error) {
|
||||||
|
// 错误已在拦截器处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量删除
|
||||||
|
function handleBatchDelete() {
|
||||||
|
dialog.warning({
|
||||||
|
title: '提示',
|
||||||
|
content: `确定要删除选中的 ${selectedIds.value.length} 条记录吗?`,
|
||||||
|
positiveText: '确定',
|
||||||
|
negativeText: '取消',
|
||||||
|
onPositiveClick: async () => {
|
||||||
|
try {
|
||||||
|
await deviceDocumentConnectionApi.delete(selectedIds.value)
|
||||||
|
message.success('删除成功')
|
||||||
|
selectedIds.value = []
|
||||||
|
loadData()
|
||||||
|
} catch (error) {
|
||||||
|
// 错误已在拦截器处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出
|
||||||
|
async function handleExport() {
|
||||||
|
try {
|
||||||
|
const params: Record<string, any> = {}
|
||||||
|
if (selectedIds.value.length > 0) params.ids = selectedIds.value
|
||||||
|
if (searchForm.id != null) params.id = searchForm.id
|
||||||
|
const blob = await deviceDocumentConnectionApi.export(params)
|
||||||
|
const url = window.URL.createObjectURL(blob)
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = url
|
||||||
|
link.download = '设备和nc/图纸关联表数据.xlsx'
|
||||||
|
link.click()
|
||||||
|
window.URL.revokeObjectURL(url)
|
||||||
|
} catch (error) {
|
||||||
|
// 错误已在拦截器处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下载导入模板
|
||||||
|
async function handleDownloadTemplate() {
|
||||||
|
try {
|
||||||
|
const blob = await deviceDocumentConnectionApi.downloadTemplate()
|
||||||
|
const url = window.URL.createObjectURL(blob)
|
||||||
|
const link = document.createElement('a')
|
||||||
|
link.href = url
|
||||||
|
link.download = '设备和nc/图纸关联表导入模板.xlsx'
|
||||||
|
link.click()
|
||||||
|
window.URL.revokeObjectURL(url)
|
||||||
|
} catch (error) {
|
||||||
|
// 错误已在拦截器处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导入上传
|
||||||
|
async function handleImportUpload({ file }: UploadCustomRequestOptions) {
|
||||||
|
if (!file.file) return
|
||||||
|
try {
|
||||||
|
const result = await deviceDocumentConnectionApi.importData(file.file)
|
||||||
|
if (result.fail > 0) {
|
||||||
|
dialog.warning({
|
||||||
|
title: '导入结果',
|
||||||
|
content: `成功: ${result.success} 条,失败: ${result.fail} 条\n错误信息: ${(result.errors || []).join('\n') || '无'}`,
|
||||||
|
positiveText: '确定'
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
message.success(`导入成功,共 ${result.success} 条数据`)
|
||||||
|
importModalVisible.value = false
|
||||||
|
}
|
||||||
|
loadData()
|
||||||
|
} catch (error) {
|
||||||
|
// 错误已在拦截器处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载字典选项
|
||||||
|
async function loadDictOptions() {
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadData()
|
||||||
|
loadDictOptions()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.search-form {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-toolbar {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -499,16 +499,15 @@ async function handleSubmit() {
|
|||||||
if (typeof submitData.updateTime === 'number') {
|
if (typeof submitData.updateTime === 'number') {
|
||||||
submitData.updateTime = new Date(submitData.updateTime).toISOString().slice(0, 19).replace('T', ' ')
|
submitData.updateTime = new Date(submitData.updateTime).toISOString().slice(0, 19).replace('T', ' ')
|
||||||
}
|
}
|
||||||
console.log(submitData)
|
if (submitData.id) {
|
||||||
// if (submitData.id) {
|
await qcItemApi.update(submitData)
|
||||||
// await qcItemApi.update(submitData)
|
message.success('修改成功')
|
||||||
// message.success('修改成功')
|
} else {
|
||||||
// } else {
|
await qcItemApi.create(submitData)
|
||||||
// await qcItemApi.create(submitData)
|
message.success('新增成功')
|
||||||
// message.success('新增成功')
|
}
|
||||||
// }
|
modalVisible.value = false
|
||||||
// modalVisible.value = false
|
loadData()
|
||||||
// loadData()
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 错误已在拦截器处理
|
// 错误已在拦截器处理
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,11 +27,19 @@
|
|||||||
<n-form-item>
|
<n-form-item>
|
||||||
<n-space>
|
<n-space>
|
||||||
<n-button type="primary" @click="handleSearch">
|
<n-button type="primary" @click="handleSearch">
|
||||||
<template #icon><n-icon><SearchOutline /></n-icon></template>
|
<template #icon>
|
||||||
|
<n-icon>
|
||||||
|
<SearchOutline/>
|
||||||
|
</n-icon>
|
||||||
|
</template>
|
||||||
搜索
|
搜索
|
||||||
</n-button>
|
</n-button>
|
||||||
<n-button @click="handleReset">
|
<n-button @click="handleReset">
|
||||||
<template #icon><n-icon><RefreshOutline /></n-icon></template>
|
<template #icon>
|
||||||
|
<n-icon>
|
||||||
|
<RefreshOutline/>
|
||||||
|
</n-icon>
|
||||||
|
</template>
|
||||||
重置
|
重置
|
||||||
</n-button>
|
</n-button>
|
||||||
</n-space>
|
</n-space>
|
||||||
@ -43,7 +51,11 @@
|
|||||||
<div class="table-toolbar">
|
<div class="table-toolbar">
|
||||||
<n-space>
|
<n-space>
|
||||||
<n-button type="primary" @click="handleAdd">
|
<n-button type="primary" @click="handleAdd">
|
||||||
<template #icon><n-icon><AddOutline /></n-icon></template>
|
<template #icon>
|
||||||
|
<n-icon>
|
||||||
|
<AddOutline/>
|
||||||
|
</n-icon>
|
||||||
|
</template>
|
||||||
新增
|
新增
|
||||||
</n-button>
|
</n-button>
|
||||||
</n-space>
|
</n-space>
|
||||||
@ -99,7 +111,7 @@
|
|||||||
</n-form-item>
|
</n-form-item>
|
||||||
|
|
||||||
<n-form-item label="备注" path="remark">
|
<n-form-item label="备注" path="remark">
|
||||||
<n-input v-model:value="formData.remark" type="textarea" placeholder="请输入备注" />
|
<n-input v-model:value="formData.remark" type="textarea" placeholder="请输入备注"/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
</n-form>
|
</n-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
@ -122,14 +134,20 @@
|
|||||||
</n-alert>
|
</n-alert>
|
||||||
<n-space>
|
<n-space>
|
||||||
<n-button type="primary" @click="handleDownloadTemplate">
|
<n-button type="primary" @click="handleDownloadTemplate">
|
||||||
<template #icon><n-icon><DownloadOutline /></n-icon></template>
|
<template #icon>
|
||||||
|
<n-icon>
|
||||||
|
<DownloadOutline/>
|
||||||
|
</n-icon>
|
||||||
|
</template>
|
||||||
下载模板
|
下载模板
|
||||||
</n-button>
|
</n-button>
|
||||||
</n-space>
|
</n-space>
|
||||||
<n-upload :max="1" accept=".xlsx,.xls" :show-file-list="true" :custom-request="handleImportUpload">
|
<n-upload :max="1" accept=".xlsx,.xls" :show-file-list="true" :custom-request="handleImportUpload">
|
||||||
<n-upload-dragger>
|
<n-upload-dragger>
|
||||||
<div style="margin-bottom: 12px">
|
<div style="margin-bottom: 12px">
|
||||||
<n-icon size="48" :depth="3"><CloudUploadOutline /></n-icon>
|
<n-icon size="48" :depth="3">
|
||||||
|
<CloudUploadOutline/>
|
||||||
|
</n-icon>
|
||||||
</div>
|
</div>
|
||||||
<n-text style="font-size: 16px">点击或拖拽文件到此处上传</n-text>
|
<n-text style="font-size: 16px">点击或拖拽文件到此处上传</n-text>
|
||||||
<n-p depth="3" style="margin: 8px 0 0 0">支持 .xlsx 或 .xls 格式</n-p>
|
<n-p depth="3" style="margin: 8px 0 0 0">支持 .xlsx 或 .xls 格式</n-p>
|
||||||
@ -144,13 +162,29 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, h, onMounted } from 'vue'
|
import {ref, reactive, h, onMounted} from 'vue'
|
||||||
import { NButton, NSpace, NIcon, NUpload, useMessage, useDialog, type DataTableColumns, type UploadCustomRequestOptions } from 'naive-ui'
|
import {
|
||||||
import { SearchOutline, RefreshOutline, AddOutline, TrashOutline, CreateOutline, CloudUploadOutline, DownloadOutline } from '@vicons/ionicons5'
|
NButton,
|
||||||
import { stationHandoverApi, type StationHandover } from '@/api/stationHandover'
|
NSpace,
|
||||||
import { sectionApi,Section } from '@/api/section'
|
NIcon,
|
||||||
import { deviceApi,Device} from '@/api/device'
|
NUpload,
|
||||||
import { userApi,SysUser } from '@/api/system'
|
useMessage,
|
||||||
|
useDialog,
|
||||||
|
type DataTableColumns,
|
||||||
|
type UploadCustomRequestOptions
|
||||||
|
} from 'naive-ui'
|
||||||
|
import {
|
||||||
|
SearchOutline,
|
||||||
|
RefreshOutline,
|
||||||
|
AddOutline,
|
||||||
|
CreateOutline,
|
||||||
|
CloudUploadOutline,
|
||||||
|
DownloadOutline
|
||||||
|
} from '@vicons/ionicons5'
|
||||||
|
import {stationHandoverApi, type StationHandover} from '@/api/stationHandover'
|
||||||
|
import { Section } from '@/api/section'
|
||||||
|
import {deviceApi, Device} from '@/api/device'
|
||||||
|
import {userApi, SysUser} from '@/api/system'
|
||||||
import {deptApi} from "@/api/org.ts";
|
import {deptApi} from "@/api/org.ts";
|
||||||
import {TreeNode} from "echarts/types/src/data/Tree";
|
import {TreeNode} from "echarts/types/src/data/Tree";
|
||||||
|
|
||||||
@ -193,32 +227,31 @@ const defaultFormData: StationHandover = {
|
|||||||
receiverPersonId: undefined,
|
receiverPersonId: undefined,
|
||||||
handoverTime: undefined,
|
handoverTime: undefined,
|
||||||
}
|
}
|
||||||
const formData = reactive<StationHandover>({ ...defaultFormData })
|
const formData = reactive<StationHandover>({...defaultFormData})
|
||||||
|
|
||||||
// 字典选项(下拉框/单选框/复选框关联字典时使用)
|
// 字典选项(下拉框/单选框/复选框关联字典时使用)
|
||||||
|
|
||||||
// 表单校验规则
|
// 表单校验规则
|
||||||
const formRules = {
|
const formRules = {}
|
||||||
}
|
|
||||||
|
|
||||||
// 表格列
|
// 表格列
|
||||||
const columns: DataTableColumns<StationHandover> = [
|
const columns: DataTableColumns<StationHandover> = [
|
||||||
{ type: 'selection' },
|
{type: 'selection'},
|
||||||
{ title: '设备/工位', key: 'deviceName' },
|
{title: '设备/工位', key: 'deviceName'},
|
||||||
{ title: '上机人', key: 'handoverPerson' },
|
{title: '上机人', key: 'handoverPerson'},
|
||||||
{ title: '接收人', key: 'receiverPerson' },
|
{title: '接收人', key: 'receiverPerson'},
|
||||||
{ title: '交接时间', key: 'handoverTime' },
|
{title: '交接时间', key: 'handoverTime'},
|
||||||
{ title: '交接备注', key: 'remark' },
|
{title: '交接备注', key: 'remark'},
|
||||||
{ title: '创建时间', key: 'createTime', width: 180 },
|
{title: '创建时间', key: 'createTime', width: 180},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
key: 'actions',
|
key: 'actions',
|
||||||
width: 140,
|
width: 140,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
render(row) {
|
render(row) {
|
||||||
return h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'nowrap' } }, [
|
return h('div', {style: {display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'nowrap'}}, [
|
||||||
h(NButton, { size: 'small', quaternary: true, onClick: () => handleEdit(row) }, {
|
h(NButton, {size: 'small', quaternary: true, onClick: () => handleEdit(row)}, {
|
||||||
default: () => [h(NIcon, null, { default: () => h(CreateOutline) }), ' 编辑']
|
default: () => [h(NIcon, null, {default: () => h(CreateOutline)}), ' 编辑']
|
||||||
})
|
})
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
@ -229,7 +262,7 @@ const columns: DataTableColumns<StationHandover> = [
|
|||||||
async function loadData() {
|
async function loadData() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const deviceIds = searchForm.deviceIds != null ?JSON.stringify(searchForm.deviceIds) :null
|
const deviceIds = searchForm.deviceIds != null ? JSON.stringify(searchForm.deviceIds) : null
|
||||||
const res = await stationHandoverApi.page({
|
const res = await stationHandoverApi.page({
|
||||||
page: pagination.page,
|
page: pagination.page,
|
||||||
pageSize: pagination.pageSize,
|
pageSize: pagination.pageSize,
|
||||||
@ -298,7 +331,7 @@ function handleEdit(row: StationHandover) {
|
|||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
await formRef.value?.validate()
|
await formRef.value?.validate()
|
||||||
try {
|
try {
|
||||||
const submitData = { ...formData } as StationHandover
|
const submitData = {...formData} as StationHandover
|
||||||
if (typeof submitData.handoverTime === 'number') {
|
if (typeof submitData.handoverTime === 'number') {
|
||||||
submitData.handoverTime = new Date(submitData.handoverTime).toISOString().slice(0, 19).replace('T', ' ')
|
submitData.handoverTime = new Date(submitData.handoverTime).toISOString().slice(0, 19).replace('T', ' ')
|
||||||
}
|
}
|
||||||
@ -392,7 +425,7 @@ async function handleDownloadTemplate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 导入上传
|
// 导入上传
|
||||||
async function handleImportUpload({ file }: UploadCustomRequestOptions) {
|
async function handleImportUpload({file}: UploadCustomRequestOptions) {
|
||||||
if (!file.file) return
|
if (!file.file) return
|
||||||
try {
|
try {
|
||||||
const result = await stationHandoverApi.importData(file.file)
|
const result = await stationHandoverApi.importData(file.file)
|
||||||
@ -422,7 +455,8 @@ async function loadSection() {
|
|||||||
const data = await deptApi.tree()
|
const data = await deptApi.tree()
|
||||||
sectionList.value = buildOptions(data);
|
sectionList.value = buildOptions(data);
|
||||||
}
|
}
|
||||||
function handleUpdateValue(key:any) {
|
|
||||||
|
function handleUpdateValue(key: any) {
|
||||||
|
|
||||||
console.log(key);
|
console.log(key);
|
||||||
loadDevice(key)
|
loadDevice(key)
|
||||||
@ -446,15 +480,15 @@ function buildOptions(d: any[]): TreeNode[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//加载设备/工位
|
//加载设备/工位
|
||||||
async function loadDevice(sectionIdList:number[]) {
|
async function loadDevice(sectionIdList: number[]) {
|
||||||
const sectionIds = sectionIdList != null ?JSON.stringify(sectionIdList) :null
|
const sectionIds = sectionIdList != null ? JSON.stringify(sectionIdList) : null
|
||||||
const res = await deviceApi.getDeviceList({
|
const res = await deviceApi.getDeviceList({
|
||||||
sectionIds
|
sectionIds
|
||||||
})
|
})
|
||||||
deviceList.value = res.map((n:any)=>{
|
deviceList.value = res.map((n: any) => {
|
||||||
return {
|
return {
|
||||||
label:n.deviceName,
|
label: n.deviceName,
|
||||||
value:n.id
|
value: n.id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -462,10 +496,10 @@ async function loadDevice(sectionIdList:number[]) {
|
|||||||
//加载人员
|
//加载人员
|
||||||
async function loadUserList() {
|
async function loadUserList() {
|
||||||
const res = await userApi.getPathList();
|
const res = await userApi.getPathList();
|
||||||
userList.value = res.map((n:any)=>{
|
userList.value = res.map((n: any) => {
|
||||||
return {
|
return {
|
||||||
label:n.username,
|
label: n.username,
|
||||||
value:n.id
|
value: n.id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,23 +11,31 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
<n-form-item label="图文编号">
|
<n-form-item label="图文编号">
|
||||||
<n-input v-model:value="searchForm.drawingCode" placeholder="请输入图文编号" />
|
<n-input v-model:value="searchForm.drawingCode" placeholder="请输入图文编号"/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<!-- <n-form-item label="图文名称">
|
<n-form-item label="图文名称">
|
||||||
<n-input v-model:value="searchForm.drawingName" placeholder="请输入图文名称" />
|
<n-input v-model:value="searchForm.drawingName" placeholder="请输入图文名称"/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item label="图文版本">
|
<!-- <n-form-item label="图文版本">-->
|
||||||
<n-input v-model:value="searchForm.drawingVersion" placeholder="请输入图文版本" />
|
<!-- <n-input v-model:value="searchForm.drawingVersion" placeholder="请输入图文版本" />-->
|
||||||
</n-form-item> -->
|
<!-- </n-form-item> –>-->
|
||||||
|
|
||||||
|
|
||||||
<n-space>
|
<n-space>
|
||||||
<n-button type="primary" @click="search">
|
<n-button type="primary" @click="search">
|
||||||
<template #icon><n-icon><SearchOutline /></n-icon></template>
|
<template #icon>
|
||||||
|
<n-icon>
|
||||||
|
<SearchOutline/>
|
||||||
|
</n-icon>
|
||||||
|
</template>
|
||||||
搜索
|
搜索
|
||||||
</n-button>
|
</n-button>
|
||||||
<n-button @click="reset">
|
<n-button @click="reset">
|
||||||
<template #icon><n-icon><RefreshOutline /></n-icon></template>
|
<template #icon>
|
||||||
|
<n-icon>
|
||||||
|
<RefreshOutline/>
|
||||||
|
</n-icon>
|
||||||
|
</template>
|
||||||
重置
|
重置
|
||||||
</n-button>
|
</n-button>
|
||||||
</n-space>
|
</n-space>
|
||||||
@ -38,7 +46,7 @@
|
|||||||
<n-button v-if="hasPermission('biz:drawingFile:add')" type="primary" @click="addhand(1)" size="small">
|
<n-button v-if="hasPermission('biz:drawingFile:add')" type="primary" @click="addhand(1)" size="small">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<n-icon>
|
<n-icon>
|
||||||
<AddOutline />
|
<AddOutline/>
|
||||||
</n-icon>
|
</n-icon>
|
||||||
</template>
|
</template>
|
||||||
新增
|
新增
|
||||||
@ -54,7 +62,7 @@
|
|||||||
<n-button type="success" v-if="hasPermission('biz:drawingFile:export')" @click="handleExport" size="small">
|
<n-button type="success" v-if="hasPermission('biz:drawingFile:export')" @click="handleExport" size="small">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<n-icon>
|
<n-icon>
|
||||||
<ArrowDownCircleOutline />
|
<ArrowDownCircleOutline/>
|
||||||
</n-icon>
|
</n-icon>
|
||||||
</template>
|
</template>
|
||||||
导出
|
导出
|
||||||
@ -75,7 +83,8 @@
|
|||||||
@update:checked-row-keys="handleCheck"
|
@update:checked-row-keys="handleCheck"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div v-if="pagination.itemCount > pagination.pageSize" class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
<div v-if="pagination.itemCount > pagination.pageSize" class="pagination-container"
|
||||||
|
style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||||
<n-pagination
|
<n-pagination
|
||||||
v-model:page="pagination.page"
|
v-model:page="pagination.page"
|
||||||
v-model:page-size="pagination.pageSize"
|
v-model:page-size="pagination.pageSize"
|
||||||
@ -111,7 +120,7 @@
|
|||||||
<n-grid :cols="1" :x-gap="24">
|
<n-grid :cols="1" :x-gap="24">
|
||||||
<n-gi>
|
<n-gi>
|
||||||
<n-form-item path="drawingCode" label="图文编号">
|
<n-form-item path="drawingCode" label="图文编号">
|
||||||
<n-input v-model:value="formData.drawingCode" disabled placeholder="自动生成" />
|
<n-input v-model:value="formData.drawingCode" disabled placeholder="自动生成"/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
</n-gi>
|
</n-gi>
|
||||||
<n-gi>
|
<n-gi>
|
||||||
@ -128,12 +137,12 @@
|
|||||||
</n-radio-group>
|
</n-radio-group>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
</n-gi>
|
</n-gi>
|
||||||
<!-- <n-gi>
|
<n-gi>
|
||||||
<n-form-item path="drawingName" label="图文名称">
|
<n-form-item path="drawingName" label="图文名称">
|
||||||
<n-input v-model:value="formData.drawingName" placeholder="请输入图文名称" />
|
<n-input v-model:value="formData.drawingName" placeholder="请输入图文名称"/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
</n-gi>
|
</n-gi>
|
||||||
<n-gi>
|
<!-- <n-gi>
|
||||||
<n-form-item label="图文版本">
|
<n-form-item label="图文版本">
|
||||||
<n-input v-model:value="formData.drawingVersion" placeholder="请输入图文版本" />
|
<n-input v-model:value="formData.drawingVersion" placeholder="请输入图文版本" />
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
@ -206,7 +215,7 @@
|
|||||||
<n-upload-dragger>
|
<n-upload-dragger>
|
||||||
<div>
|
<div>
|
||||||
<n-icon size="40" :depth="3">
|
<n-icon size="40" :depth="3">
|
||||||
<CloudUploadOutline />
|
<CloudUploadOutline/>
|
||||||
</n-icon>
|
</n-icon>
|
||||||
</div>
|
</div>
|
||||||
<n-text style="font-size: 14px">
|
<n-text style="font-size: 14px">
|
||||||
@ -231,7 +240,8 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
|
|
||||||
@click="savehand"
|
@click="savehand"
|
||||||
>确认</n-button>
|
>确认
|
||||||
|
</n-button>
|
||||||
</n-space>
|
</n-space>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
@ -260,20 +270,66 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<n-space justify="end">
|
<n-space justify="end">
|
||||||
<n-button @click="issueModel = false">取消</n-button>
|
<n-button @click="issueModel = false">取消</n-button>
|
||||||
<n-button
|
<n-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="isssavehand"
|
@click="isssavehand"
|
||||||
>确认</n-button>
|
>确认
|
||||||
|
</n-button>
|
||||||
</n-space>
|
</n-space>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</n-modal>
|
</n-modal>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
<!--工艺文档抽屉-->
|
||||||
|
<n-drawer v-model:show="deviceDocumentConnectionVisible" width="1000">
|
||||||
|
<n-drawer-content :title="title">
|
||||||
|
<n-space justify="space-between" class="mb-3">
|
||||||
|
<n-checkbox v-model:checked="isAllCheck" @update:checked="handleAllCheck">
|
||||||
|
全选当前筛选文档
|
||||||
|
</n-checkbox>
|
||||||
|
<n-tag type="info">已勾选 {{ selectedDeviceIds.length }} 道文档</n-tag>
|
||||||
|
</n-space>
|
||||||
|
|
||||||
|
<!-- 工序表格,带复选框 -->
|
||||||
|
<n-data-table
|
||||||
|
:columns="deviceColumns"
|
||||||
|
:data="deviceList"
|
||||||
|
max-height="700"
|
||||||
|
v-model:checked-row-keys="selectedDeviceIds"
|
||||||
|
:row-key="rowKey"
|
||||||
|
:scroll-x="1200"
|
||||||
|
:loading="connectionLoading"
|
||||||
|
@update:checked-row-keys="handleUpateCheck"
|
||||||
|
/>
|
||||||
|
<div class="pagination-container" style="display: flex; justify-content: flex-end; margin-top: 12px">
|
||||||
|
<n-pagination
|
||||||
|
v-model:page="connectionPagination.page"
|
||||||
|
v-model:page-size="connectionPagination.pageSize"
|
||||||
|
:item-count="connectionPagination.itemCount"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
show-size-picker
|
||||||
|
show-quick-jumper
|
||||||
|
@update:page="handleRelatePageChange"
|
||||||
|
@update:page-size="handleRelatePageSizeChange"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
共 {{ connectionPagination.itemCount }} 条
|
||||||
|
</template>
|
||||||
|
</n-pagination>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<n-button @click="deviceDocumentConnectionVisible = false">
|
||||||
|
取消
|
||||||
|
</n-button>
|
||||||
|
</template>
|
||||||
|
</n-drawer-content>
|
||||||
|
</n-drawer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
@ -284,6 +340,7 @@ import {
|
|||||||
reactive,
|
reactive,
|
||||||
h,
|
h,
|
||||||
onMounted,
|
onMounted,
|
||||||
|
computed,
|
||||||
} from 'vue'
|
} from 'vue'
|
||||||
|
|
||||||
|
|
||||||
@ -298,7 +355,7 @@ import {
|
|||||||
// NGi,
|
// NGi,
|
||||||
NTag,
|
NTag,
|
||||||
useMessage,
|
useMessage,
|
||||||
useDialog,
|
useDialog, type DataTableColumns,
|
||||||
} from 'naive-ui'
|
} from 'naive-ui'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -309,7 +366,7 @@ import {
|
|||||||
CloudUploadOutline
|
CloudUploadOutline
|
||||||
} from '@vicons/ionicons5'
|
} from '@vicons/ionicons5'
|
||||||
|
|
||||||
import { useUserStore } from '@/stores/user'
|
import {useUserStore} from '@/stores/user'
|
||||||
//import { dictDataApi } from '@/api/org'
|
//import { dictDataApi } from '@/api/org'
|
||||||
import {
|
import {
|
||||||
addDrawing,
|
addDrawing,
|
||||||
@ -321,12 +378,15 @@ import {
|
|||||||
exportdraFile,
|
exportdraFile,
|
||||||
opertree,
|
opertree,
|
||||||
//filelist,
|
//filelist,
|
||||||
multifilelist
|
multifilelist,
|
||||||
|
getDeviceByDrawingId
|
||||||
} from '@/api/illustrated'
|
} from '@/api/illustrated'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
basicProcessPlanApi
|
basicProcessPlanApi
|
||||||
} from '@/api/basicProcessPlan'
|
} from '@/api/basicProcessPlan'
|
||||||
|
import {DeviceDocumentConnection, deviceDocumentConnectionApi} from "@/api/deviceDocumentConnection.ts";
|
||||||
|
import {Device} from "@/api/device.ts";
|
||||||
|
|
||||||
const URL = `${import.meta.env.VITE_APP_BASE_API}/sys/file/upload`
|
const URL = `${import.meta.env.VITE_APP_BASE_API}/sys/file/upload`
|
||||||
|
|
||||||
@ -349,13 +409,12 @@ const hasPermission = (permission: string) => userStore.hasPermission(permission
|
|||||||
const searchForm = reactive({
|
const searchForm = reactive({
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
drawingCode:'',
|
drawingCode: '',
|
||||||
drawingName:'',
|
drawingName: '',
|
||||||
drawingVersion:''
|
drawingVersion: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ==================== 表格 ====================
|
// ==================== 表格 ====================
|
||||||
const datalist = ref<any>([])
|
const datalist = ref<any>([])
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
@ -368,20 +427,19 @@ const pagination = reactive({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
align:"center",
|
align: "center",
|
||||||
title:"图文编号",
|
title: "图文编号",
|
||||||
key:"drawingCode",
|
key: "drawingCode",
|
||||||
minWidth:150
|
minWidth: 150
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: "center",
|
||||||
|
title: "图文名称",
|
||||||
|
key: "drawingName",
|
||||||
|
minWidth: 150
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// align:"center",
|
|
||||||
// title:"图文名称",
|
|
||||||
// key:"drawingName",
|
|
||||||
// minWidth:150
|
|
||||||
// },
|
|
||||||
// {
|
// {
|
||||||
// align:"center",
|
// align:"center",
|
||||||
// title:"图文版本",
|
// title:"图文版本",
|
||||||
@ -423,67 +481,68 @@ const columns = [
|
|||||||
// minWidth:150
|
// minWidth:150
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
align:"center",
|
align: "center",
|
||||||
title:"状态",
|
title: "状态",
|
||||||
key:"status",
|
key: "status",
|
||||||
minWidth:150,
|
minWidth: 150,
|
||||||
render(row:any) {
|
render(row: any) {
|
||||||
if(row.status == 1){
|
if (row.status == 1) {
|
||||||
return '启用'
|
return '启用'
|
||||||
}
|
}
|
||||||
return '禁用'
|
return '禁用'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align:"center",
|
align: "center",
|
||||||
title:"是否下发",
|
title: "是否下发",
|
||||||
key:"isIssued",
|
key: "isIssued",
|
||||||
minWidth:150,
|
minWidth: 150,
|
||||||
render(row:any) {
|
render(row: any) {
|
||||||
if(row.isIssued == 1){
|
if (row.isIssued == 1) {
|
||||||
return '已下发'
|
return '已下发'
|
||||||
}
|
}
|
||||||
return '未下发'
|
return '未下发'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align:"center",
|
align: "center",
|
||||||
title:"下发时间",
|
title: "下发时间",
|
||||||
key:"issueTime",
|
key: "issueTime",
|
||||||
minWidth:150
|
minWidth: 150
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
align:"center",
|
align: "center",
|
||||||
title:"下发人",
|
title: "下发人",
|
||||||
key:"issueBy",
|
key: "issueBy",
|
||||||
minWidth:150
|
minWidth: 150
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align:"center",
|
align: "center",
|
||||||
title:"备注",
|
title: "备注",
|
||||||
key:"remark",
|
key: "remark",
|
||||||
minWidth:150
|
minWidth: 150
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
align:'center',
|
align: 'center',
|
||||||
title: '操作',
|
title: '操作',
|
||||||
key: 'actions',
|
key: 'actions',
|
||||||
width: 220,
|
width: 320,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
render(row:any) {
|
render(row: any) {
|
||||||
const buttons:any = []
|
const buttons: any = []
|
||||||
|
|
||||||
if(hasPermission('biz:drawingFile:issue')){
|
if (hasPermission('biz:drawingFile:issue')) {
|
||||||
buttons.push(h(NButton, {
|
buttons.push(h(NButton, {
|
||||||
size: 'small',
|
size: 'small',
|
||||||
type:'info',
|
type: 'info',
|
||||||
ghost:true,
|
ghost: true,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
issuehand(row)
|
issuehand(row)
|
||||||
} },
|
}
|
||||||
{ default: () => '下发'}
|
},
|
||||||
|
{default: () => '下发'}
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
// if(hasPermission('biz:nccode:add')){
|
// if(hasPermission('biz:nccode:add')){
|
||||||
@ -498,22 +557,23 @@ const columns = [
|
|||||||
// ))
|
// ))
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if(hasPermission('biz:drawingFile:edit')){
|
if (hasPermission('biz:drawingFile:edit')) {
|
||||||
buttons.push(h(NButton, {
|
buttons.push(h(NButton, {
|
||||||
size: 'small',
|
size: 'small',
|
||||||
type:'primary',
|
type: 'primary',
|
||||||
ghost:true,
|
ghost: true,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
addhand(2,row)
|
addhand(2, row)
|
||||||
} },
|
}
|
||||||
{ default: () => '编辑'}
|
},
|
||||||
|
{default: () => '编辑'}
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
if(hasPermission('biz:drawingFile:remove')){
|
if (hasPermission('biz:drawingFile:remove')) {
|
||||||
buttons.push(h(NButton, {
|
buttons.push(h(NButton, {
|
||||||
size: 'small',
|
size: 'small',
|
||||||
type:'error',
|
type: 'error',
|
||||||
ghost:true,
|
ghost: true,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
dialog.warning({
|
dialog.warning({
|
||||||
title: '警告',
|
title: '警告',
|
||||||
@ -526,7 +586,7 @@ const columns = [
|
|||||||
message.success('操作成功')
|
message.success('操作成功')
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
search()
|
search()
|
||||||
},1000)
|
}, 1000)
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -535,21 +595,28 @@ const columns = [
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
} },
|
}
|
||||||
{ default: () => '删除'}
|
},
|
||||||
|
{default: () => '删除'}
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
buttons.push(h(NButton, {
|
||||||
|
size: 'small',
|
||||||
|
type: 'primary',
|
||||||
|
ghost: true,
|
||||||
|
onClick: () => {
|
||||||
|
handlerConnectionDevice(row)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{default: () => '设备关联'}
|
||||||
|
))
|
||||||
|
|
||||||
|
return buttons.length > 0 ? h(NSpace, {justify: 'center'}, {default: () => buttons}) : '-'
|
||||||
return buttons.length > 0 ? h(NSpace, {justify:'center'}, { default: () => buttons }) : '-'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//搜索数据
|
//搜索数据
|
||||||
function search() {
|
function search() {
|
||||||
pagination.page = 1
|
pagination.page = 1
|
||||||
@ -567,14 +634,13 @@ function reset() {
|
|||||||
|
|
||||||
//获取列表数据
|
//获取列表数据
|
||||||
function getlist() {
|
function getlist() {
|
||||||
drawinglist(searchForm).then((rps:any) => {
|
drawinglist(searchForm).then((rps: any) => {
|
||||||
datalist.value = rps.list
|
datalist.value = rps.list
|
||||||
pagination.itemCount = rps.total
|
pagination.itemCount = rps.total
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function handlePageChange(page: number) {
|
function handlePageChange(page: number) {
|
||||||
pagination.page = page
|
pagination.page = page
|
||||||
searchForm.page = page
|
searchForm.page = page
|
||||||
@ -604,19 +670,20 @@ function handlePageSizeChange(pageSize: number) {
|
|||||||
//查询用户
|
//查询用户
|
||||||
let loadingRef = ref(false)
|
let loadingRef = ref(false)
|
||||||
let yglist = ref<any>([])
|
let yglist = ref<any>([])
|
||||||
function slehand(v?:any) {
|
|
||||||
|
function slehand(v?: any) {
|
||||||
loadingRef.value = true
|
loadingRef.value = true
|
||||||
|
|
||||||
basicProcessPlanApi.page({
|
basicProcessPlanApi.page({
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 200,
|
pageSize: 200,
|
||||||
name: v,
|
name: v,
|
||||||
}).then((rps:any) =>{
|
}).then((rps: any) => {
|
||||||
if(rps.list && rps.list.length > 0){
|
if (rps.list && rps.list.length > 0) {
|
||||||
yglist.value = rps.list.map((n:any) => {
|
yglist.value = rps.list.map((n: any) => {
|
||||||
return {
|
return {
|
||||||
label:n.name,
|
label: n.name,
|
||||||
value:n.id //`${n.id}-${n.code}-${n.name}`
|
value: n.id //`${n.id}-${n.code}-${n.name}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -627,14 +694,14 @@ function slehand(v?:any) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatesle(v:any) {
|
function updatesle(v: any) {
|
||||||
if(v){
|
if (v) {
|
||||||
//let varr = v.split('-')
|
//let varr = v.split('-')
|
||||||
formData.processId = v+''
|
formData.processId = v + ''
|
||||||
// formData.processRouteStepId = varr[0]
|
// formData.processRouteStepId = varr[0]
|
||||||
// formData.processCode = varr[1]
|
// formData.processCode = varr[1]
|
||||||
// formData.processName = varr[2]
|
// formData.processName = varr[2]
|
||||||
}else{
|
} else {
|
||||||
formData.processId = ''
|
formData.processId = ''
|
||||||
// formData.processRouteStepId = ''
|
// formData.processRouteStepId = ''
|
||||||
// formData.processCode = ''
|
// formData.processCode = ''
|
||||||
@ -649,12 +716,12 @@ let addModel = ref(false)
|
|||||||
const addformRef = ref()
|
const addformRef = ref()
|
||||||
|
|
||||||
let formData = reactive<any>({
|
let formData = reactive<any>({
|
||||||
id:'',
|
id: '',
|
||||||
drawingCode:'', //图文编号
|
drawingCode: '', //图文编号
|
||||||
processId:'', //关联工序ID
|
processId: '', //关联工序ID
|
||||||
drawingType:0, //0 图纸 1 文件
|
drawingType: 0, //0 图纸 1 文件
|
||||||
fileId:'', //文件id
|
fileId: '', //文件id
|
||||||
status:1, //状态:1-启用 0-禁用
|
status: 1, //状态:1-启用 0-禁用
|
||||||
// drawingName:'', //图文名称
|
// drawingName:'', //图文名称
|
||||||
// drawingVersion:'', //图文版本
|
// drawingVersion:'', //图文版本
|
||||||
// processCode:'', //工序编码
|
// processCode:'', //工序编码
|
||||||
@ -674,7 +741,7 @@ let formData = reactive<any>({
|
|||||||
})
|
})
|
||||||
const addrules = {
|
const addrules = {
|
||||||
drawingCode: [
|
drawingCode: [
|
||||||
{ required: true, message: '请输入图文编号', trigger: 'blur' },
|
{required: true, message: '请输入图文编号', trigger: 'blur'},
|
||||||
// {
|
// {
|
||||||
// validator(rule:any,value: any) {
|
// validator(rule:any,value: any) {
|
||||||
// if(value > pauseform.qcNum){
|
// if(value > pauseform.qcNum){
|
||||||
@ -685,21 +752,22 @@ const addrules = {
|
|||||||
// trigger: ['blur']
|
// trigger: ['blur']
|
||||||
// }
|
// }
|
||||||
],
|
],
|
||||||
processId:[
|
processId: [
|
||||||
{ required: true, message: '请选择工序', trigger: 'blur' }
|
{required: true, message: '请选择工序', trigger: 'blur'}
|
||||||
],
|
],
|
||||||
fileId:[
|
fileId: [
|
||||||
{ required: true, message: '请上传文件', trigger: 'blur' }
|
{required: true, message: '请上传文件', trigger: 'blur'}
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//文件上传回调
|
//文件上传回调
|
||||||
let flist = ref<any>([])
|
let flist = ref<any>([])
|
||||||
function flchang(n:any) {
|
|
||||||
|
function flchang(n: any) {
|
||||||
let v = JSON.parse(n.event.target.responseText)
|
let v = JSON.parse(n.event.target.responseText)
|
||||||
if(v.data && v.data.id){
|
if (v.data && v.data.id) {
|
||||||
formData.fileId = formData.fileId + v.data.id+','
|
formData.fileId = formData.fileId + v.data.id + ','
|
||||||
}
|
}
|
||||||
console.log(formData.fileId)
|
console.log(formData.fileId)
|
||||||
}
|
}
|
||||||
@ -707,23 +775,24 @@ function flchang(n:any) {
|
|||||||
|
|
||||||
let isstype = ref<any>(1)
|
let isstype = ref<any>(1)
|
||||||
let selval = ref<any>('')
|
let selval = ref<any>('')
|
||||||
function addhand(type:any,row?:any) {
|
|
||||||
|
function addhand(type: any, row?: any) {
|
||||||
addModel.value = true
|
addModel.value = true
|
||||||
formData.value?.restoreValidation()
|
formData.value?.restoreValidation()
|
||||||
isstype.value = type
|
isstype.value = type
|
||||||
if(row){
|
if (row) {
|
||||||
//slehand('')
|
//slehand('')
|
||||||
formData.id = row.id
|
formData.id = row.id
|
||||||
formData.drawingCode = row.drawingCode
|
formData.drawingCode = row.drawingCode
|
||||||
formData.processId = row.processId
|
formData.processId = row.processId
|
||||||
formData.drawingType = row.drawingType
|
formData.drawingType = row.drawingType
|
||||||
formData.fileId = row.fileId+','
|
formData.fileId = row.fileId + ','
|
||||||
|
|
||||||
|
|
||||||
selval.value = row.processId
|
selval.value = row.processId
|
||||||
flist.value.splice(0)
|
flist.value.splice(0)
|
||||||
multifilelist(row.fileId).then(rps => {
|
multifilelist(row.fileId).then(rps => {
|
||||||
if(rps && rps.length > 0){
|
if (rps && rps.length > 0) {
|
||||||
|
|
||||||
// flist.value.push({
|
// flist.value.push({
|
||||||
// id: rps.id,
|
// id: rps.id,
|
||||||
@ -731,7 +800,7 @@ function addhand(type:any,row?:any) {
|
|||||||
// status: 'finished', // 关键:状态设为 'finished' 表示上传完成
|
// status: 'finished', // 关键:状态设为 'finished' 表示上传完成
|
||||||
// url: rps.url, // 用于预览
|
// url: rps.url, // 用于预览
|
||||||
// })
|
// })
|
||||||
flist.value = rps.map((n:any) => {
|
flist.value = rps.map((n: any) => {
|
||||||
return {
|
return {
|
||||||
id: n.id,
|
id: n.id,
|
||||||
name: n.originalName,
|
name: n.originalName,
|
||||||
@ -756,7 +825,7 @@ function addhand(type:any,row?:any) {
|
|||||||
// formData.plmStatus = row.plmStatus
|
// formData.plmStatus = row.plmStatus
|
||||||
// formData.status = row.status
|
// formData.status = row.status
|
||||||
// formData.remark = row.remark
|
// formData.remark = row.remark
|
||||||
}else{
|
} else {
|
||||||
formData.id = ''
|
formData.id = ''
|
||||||
formData.drawingCode = ''
|
formData.drawingCode = ''
|
||||||
formData.processId = ''
|
formData.processId = ''
|
||||||
@ -786,23 +855,23 @@ function addhand(type:any,row?:any) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addEdi(){
|
function addEdi() {
|
||||||
if(isstype.value == 1){
|
if (isstype.value == 1) {
|
||||||
return addDrawing(formData)
|
return addDrawing(formData)
|
||||||
}
|
}
|
||||||
return editDrawing(formData)
|
return editDrawing(formData)
|
||||||
}
|
}
|
||||||
|
|
||||||
function savehand() {
|
function savehand() {
|
||||||
addformRef.value?.validate((e:any) => {
|
addformRef.value?.validate((e: any) => {
|
||||||
if (!e) {
|
if (!e) {
|
||||||
formData.fileId = formData.fileId.replace(/,+$/,'')
|
formData.fileId = formData.fileId.replace(/,+$/, '')
|
||||||
addEdi().then(() => {
|
addEdi().then(() => {
|
||||||
message.success(isstype.value == 1?'新增成功':'修改成功')
|
message.success(isstype.value == 1 ? '新增成功' : '修改成功')
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getlist()
|
getlist()
|
||||||
addModel.value = false
|
addModel.value = false
|
||||||
},1500)
|
}, 1500)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -810,12 +879,13 @@ function savehand() {
|
|||||||
|
|
||||||
//表格选中
|
//表格选中
|
||||||
|
|
||||||
function rowKey(row:any) {
|
function rowKey(row: any) {
|
||||||
return row.id
|
return row.id
|
||||||
}
|
}
|
||||||
|
|
||||||
let chearr = ref<any>([])
|
let chearr = ref<any>([])
|
||||||
function handleCheck(v:any) {
|
|
||||||
|
function handleCheck(v: any) {
|
||||||
chearr.value = v
|
chearr.value = v
|
||||||
console.log(v)
|
console.log(v)
|
||||||
}
|
}
|
||||||
@ -841,15 +911,15 @@ let issequiplist = ref<any>([])
|
|||||||
//下发
|
//下发
|
||||||
let issueModel = ref(false)
|
let issueModel = ref(false)
|
||||||
let issformData = reactive<any>({
|
let issformData = reactive<any>({
|
||||||
taskid:'',
|
taskid: '',
|
||||||
equis:''
|
equis: ''
|
||||||
})
|
})
|
||||||
const issaddrules = {
|
const issaddrules = {
|
||||||
taskid:[
|
taskid: [
|
||||||
{ required: true, message: '请选择下发任务', trigger: 'blur' }
|
{required: true, message: '请选择下发任务', trigger: 'blur'}
|
||||||
],
|
],
|
||||||
equis:[
|
equis: [
|
||||||
{ required: true, message: '请选择下发设备', trigger: 'blur' }
|
{required: true, message: '请选择下发设备', trigger: 'blur'}
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -868,35 +938,38 @@ const issaddrules = {
|
|||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
let treeData:any = []
|
let treeData: any = []
|
||||||
let xfsbvalue = ref<Array<string | number>>([])
|
let xfsbvalue = ref<Array<string | number>>([])
|
||||||
let renderSourceList:any = ''
|
let renderSourceList: any = ''
|
||||||
|
|
||||||
let options = ref<any>([]) //flattenTree(createData())
|
let options = ref<any>([]) //flattenTree(createData())
|
||||||
|
|
||||||
function flattenTree(list: undefined | any[]) {
|
function flattenTree(list: undefined | any[]) {
|
||||||
const result: any[] = []
|
const result: any[] = []
|
||||||
|
|
||||||
function flatten(_list: any[] = []) {
|
function flatten(_list: any[] = []) {
|
||||||
_list.forEach((item) => {
|
_list.forEach((item) => {
|
||||||
//result.push(item)
|
//result.push(item)
|
||||||
if(item.childList){
|
if (item.childList) {
|
||||||
flatten(item.childList)
|
flatten(item.childList)
|
||||||
}else{
|
} else {
|
||||||
result.push(item)
|
result.push(item)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
flatten(list)
|
flatten(list)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
let issarr:any[] = []
|
let issarr: any[] = []
|
||||||
let imgCode = ref<any>('')
|
let imgCode = ref<any>('')
|
||||||
function tranupdate(v:any) {
|
|
||||||
|
function tranupdate(v: any) {
|
||||||
issarr = []
|
issarr = []
|
||||||
if(v.length > 0){
|
if (v.length > 0) {
|
||||||
v.forEach((n:any) => {
|
v.forEach((n: any) => {
|
||||||
if(n.split('-').length == 3){
|
if (n.split('-').length == 3) {
|
||||||
issarr.push(n)
|
issarr.push(n)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -904,7 +977,8 @@ function tranupdate(v:any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let imgid = ''
|
let imgid = ''
|
||||||
function issuehand(row:any) {
|
|
||||||
|
function issuehand(row: any) {
|
||||||
issueModel.value = true
|
issueModel.value = true
|
||||||
issarr = []
|
issarr = []
|
||||||
imgid = row.id
|
imgid = row.id
|
||||||
@ -913,18 +987,18 @@ function issuehand(row:any) {
|
|||||||
|
|
||||||
|
|
||||||
function isssavehand() {
|
function isssavehand() {
|
||||||
if(issarr.length > 0){
|
if (issarr.length > 0) {
|
||||||
drawingIssue({
|
drawingIssue({
|
||||||
id:imgid,
|
id: imgid,
|
||||||
twCode:issarr
|
twCode: issarr
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
message.success('操作成功')
|
message.success('操作成功')
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getlist()
|
getlist()
|
||||||
issueModel.value = false
|
issueModel.value = false
|
||||||
},1500)
|
}, 1500)
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
message.warning('请选择设备')
|
message.warning('请选择设备')
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -958,6 +1032,122 @@ function handleExport() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const deviceDocumentConnectionVisible = ref<Boolean>(false)
|
||||||
|
const title = ref<String>("")
|
||||||
|
|
||||||
|
const deviceDocumentConnection = ref<DeviceDocumentConnection>({})
|
||||||
|
const connectionLoading = ref<boolean>(false)
|
||||||
|
const connectionPagination = reactive({
|
||||||
|
page: 1,
|
||||||
|
pageSize: 2,
|
||||||
|
itemCount: 0,
|
||||||
|
showSizePicker: true,
|
||||||
|
pageSizes: [10, 20, 50]
|
||||||
|
})
|
||||||
|
|
||||||
|
const deviceList = ref<Device[]>([])
|
||||||
|
const selectedDeviceIds = ref<Device[]>([])
|
||||||
|
|
||||||
|
function handlerConnectionDevice(row:any) {
|
||||||
|
deviceDocumentConnectionVisible.value = true
|
||||||
|
title.value = row.deviceName + "图文工艺文档关联"
|
||||||
|
deviceDocumentConnection.sourceId = row.id
|
||||||
|
getDeviceList(deviceDocumentConnection.sourceId)
|
||||||
|
}
|
||||||
|
|
||||||
|
//取消|全选
|
||||||
|
const isAllCheck = computed({
|
||||||
|
get() {
|
||||||
|
return deviceList.value.length > 0 && selectedDeviceIds.value.length === deviceList.value.length
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
if (val) {
|
||||||
|
selectedDeviceIds.value = deviceList.value.map(item => item.id)
|
||||||
|
}else {
|
||||||
|
selectedDeviceIds.value = []
|
||||||
|
}
|
||||||
|
loadCreateApi()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
const handleAllCheck = (val:boolean) => {
|
||||||
|
isAllCheck.value = val
|
||||||
|
}
|
||||||
|
|
||||||
|
// function rowKey(row:RowData){
|
||||||
|
// return row.id
|
||||||
|
// }
|
||||||
|
const handleUpateCheck = async (keys:Array<string | number>,)=>{
|
||||||
|
selectedDeviceIds.value = keys
|
||||||
|
loadCreateApi()
|
||||||
|
}
|
||||||
|
|
||||||
|
const loadCreateApi = async ()=>{
|
||||||
|
deviceDocumentConnection.deviceIds = selectedDeviceIds.value
|
||||||
|
deviceDocumentConnection.page = connectionPagination.page
|
||||||
|
deviceDocumentConnection.pageSize = connectionPagination.pageSize
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
await deviceDocumentConnectionApi.createDeviceDraw(deviceDocumentConnection)
|
||||||
|
message.success("关联成功")
|
||||||
|
getDeviceList(deviceDocumentConnection.sourceId)
|
||||||
|
|
||||||
|
}catch (error) {
|
||||||
|
message.error("关联失败")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async function getDeviceList(id:number) {
|
||||||
|
try {
|
||||||
|
const res = await getDeviceByDrawingId({
|
||||||
|
drawId:id,
|
||||||
|
page:connectionPagination.page,
|
||||||
|
pageSize:connectionPagination.pageSize
|
||||||
|
})
|
||||||
|
deviceList.value = res.list
|
||||||
|
connectionPagination.itemCount = res.total
|
||||||
|
|
||||||
|
//回显
|
||||||
|
selectedDeviceIds.value = deviceList.value.filter(item=>item.isBind).map(item=>item.id)
|
||||||
|
connectionLoading.value = false
|
||||||
|
}catch (error) {
|
||||||
|
message.error("获取关联异常")
|
||||||
|
connectionLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 分页
|
||||||
|
function handleRelatePageChange(page: number) {
|
||||||
|
connectionPagination.page = page
|
||||||
|
getDeviceList(deviceDocumentConnection.sourceId)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRelatePageSizeChange(pageSize: number) {
|
||||||
|
connectionPagination.pageSize = pageSize
|
||||||
|
connectionPagination.page = 1
|
||||||
|
getDeviceList(deviceDocumentConnection.sourceId)
|
||||||
|
}
|
||||||
|
|
||||||
|
const deviceColumns:DataTableColumns<Device> = [
|
||||||
|
{ type: 'selection' },
|
||||||
|
{title: '设备名称', key: 'deviceName',width:80},
|
||||||
|
{ title: "关联状态",key:"isBind",width:80,
|
||||||
|
render(row) {
|
||||||
|
const val = row.isBind;
|
||||||
|
if (val) {
|
||||||
|
return h(NTag, { type: "success" }, { default: () => "已关联" });
|
||||||
|
} else {
|
||||||
|
return h(NTag, { type: "default" }, { default: () => "未关联" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
getlist()
|
getlist()
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@ -965,7 +1155,7 @@ onMounted(() => {
|
|||||||
opertree().then(rps => {
|
opertree().then(rps => {
|
||||||
treeData = rps
|
treeData = rps
|
||||||
options.value = flattenTree(treeData)
|
options.value = flattenTree(treeData)
|
||||||
renderSourceList = function (obj:any) {
|
renderSourceList = function (obj: any) {
|
||||||
return h(NTree, {
|
return h(NTree, {
|
||||||
style: 'margin: 0 4px;',
|
style: 'margin: 0 4px;',
|
||||||
keyField: 'value',
|
keyField: 'value',
|
||||||
@ -973,13 +1163,13 @@ onMounted(() => {
|
|||||||
selectable: false,
|
selectable: false,
|
||||||
blockLine: true,
|
blockLine: true,
|
||||||
checkOnClick: true,
|
checkOnClick: true,
|
||||||
childrenField:'childList',
|
childrenField: 'childList',
|
||||||
data: treeData,
|
data: treeData,
|
||||||
cascade:true,
|
cascade: true,
|
||||||
defaultExpandAll:true,
|
defaultExpandAll: true,
|
||||||
pattern:obj.pattern,
|
pattern: obj.pattern,
|
||||||
checkedKeys: xfsbvalue.value,
|
checkedKeys: xfsbvalue.value,
|
||||||
onUpdateCheckedKeys: (checkedKeys:any) => {
|
onUpdateCheckedKeys: (checkedKeys: any) => {
|
||||||
obj.onCheck(checkedKeys)
|
obj.onCheck(checkedKeys)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -319,8 +319,7 @@ const AssingWorkColumns :DataTableColumns<AssingWork> = [
|
|||||||
const showQcReport = ref<boolean>(false)
|
const showQcReport = ref<boolean>(false)
|
||||||
const reportTitle = ref<string>()
|
const reportTitle = ref<string>()
|
||||||
|
|
||||||
//懒加载子级
|
|
||||||
const loadingRowIds = ref<Set<number>>(new Set())
|
|
||||||
|
|
||||||
const AssingWorkDetailColums:DataTableColumns<AssingWorkDetail> = [
|
const AssingWorkDetailColums:DataTableColumns<AssingWorkDetail> = [
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user