From 6d65a183d5aa4b39dff37b9753e00c1992200ab5 Mon Sep 17 00:00:00 2001 From: andy <1042025947@qq.com> Date: Tue, 4 Aug 2026 17:31:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/NCcode/index.vue | 99 ++++++++++++++++++++++++++++++++- src/views/biz/station/index.vue | 4 ++ src/views/lllustrated/index.vue | 2 +- 3 files changed, 103 insertions(+), 2 deletions(-) diff --git a/src/views/NCcode/index.vue b/src/views/NCcode/index.vue index b7f6bc4..2e82b9e 100644 --- a/src/views/NCcode/index.vue +++ b/src/views/NCcode/index.vue @@ -139,6 +139,47 @@ + + + + + + + + +
+ + + +
+ + 点击或者拖动文件到该区域来上传 + +
+
+
+
@@ -275,7 +316,8 @@ import { RefreshOutline, AddOutline, ArrowDownCircleOutline, - EllipsisHorizontalOutline + EllipsisHorizontalOutline, + CloudUploadOutline } from '@vicons/ionicons5' import { useUserStore } from '@/stores/user' @@ -292,12 +334,21 @@ import { deleteIssue } from '@/api/nccode' +import +{ + multifilelist +} from '@/api/illustrated' + const dialog = useDialog() const message = useMessage() const userStore = useUserStore() +const URL = `${import.meta.env.VITE_APP_BASE_API}/sys/file/upload` + +const TOKEN = userStore.token + // 权限检查 const hasPermission = (permission: string) => userStore.hasPermission(permission) @@ -567,6 +618,7 @@ let formData = reactive({ workCenter:'', //工作中心 deviceId:'', //设备ID deviceName:'', //设备名称 + fileId:'', status:1, //状态:1-启用 0-禁用 // isIssued:1, //是否已下发:1-已下发 0-未下发 // issueTime:null, //下发时间 @@ -602,6 +654,24 @@ const cztype = reactive({ 3:'复制' }) +//文件上传回调 +let flist = ref([]) +function flchang(n:any) { + let v = JSON.parse(n.event.target.responseText) + if(v.data && v.data.id){ + formData.fileId = formData.fileId + v.data.id+',' + } +} + +function flremove(n:any) { + let reg = new RegExp(`${n.file.id},?`) + formData.fileId = formData.fileId.replace(reg,'') + + console.log(n,'flremove') + console.log(flist.value,'flist-r') + console.log(formData.fileId) +} + function addhand(type:any,row?:any) { addModel.value = true formData.value?.restoreValidation() @@ -615,6 +685,7 @@ function addhand(type:any,row?:any) { formData.deviceId = row.deviceId formData.deviceName = row.deviceName formData.status = row.status + formData.fileId = row.fileId+',' // formData.isIssued = row.isIssued // formData.issueTime = row.issueTime // formData.issueBy = row.issueBy @@ -624,6 +695,29 @@ function addhand(type:any,row?:any) { }else{ formData.ncCode = '' } + + flist.value.splice(0) + multifilelist(row.fileId).then(rps => { + if(rps && rps.length > 0){ + + // flist.value.push({ + // id: rps.id, + // name: rps.originalName, + // status: 'finished', // 关键:状态设为 'finished' 表示上传完成 + // url: rps.url, // 用于预览 + // }) + flist.value = rps.map((n:any) => { + return { + id: n.id, + name: n.originalName, + status: 'finished', // 关键:状态设为 'finished' 表示上传完成 + url: n.url, + } + }) + } + + }) + }else{ formData.id = '' formData.ncCode = '' @@ -637,6 +731,8 @@ function addhand(type:any,row?:any) { // formData.issueTime = '' // formData.issueBy = '' formData.remark = '' + formData.fileId = '' + flist.value.splice(0) } if(type == 1 || type == 3){ generateNccode().then(rps => { @@ -646,6 +742,7 @@ function addhand(type:any,row?:any) { } function addEdi(){ + formData.fileId = formData.fileId.replace(/,+$/,'') if(isstype.value == 1){ return addnccode(formData) } diff --git a/src/views/biz/station/index.vue b/src/views/biz/station/index.vue index e8f3d49..d6c4c60 100644 --- a/src/views/biz/station/index.vue +++ b/src/views/biz/station/index.vue @@ -90,6 +90,8 @@ v-model:value="formData.sectionId" cascade checkable + default-expand-all + :default-value="[formData.sectionId]" :options="sectionList" /> @@ -441,6 +443,8 @@ async function loadDictOptions() { async function loadSection() { const data = await deptApi.tree() sectionList = buildOptions(data); + console.log(sectionList,'sectionList') + } function buildOptions(d: any[]): TreeNode[] { diff --git a/src/views/lllustrated/index.vue b/src/views/lllustrated/index.vue index 37e301d..eb7466b 100644 --- a/src/views/lllustrated/index.vue +++ b/src/views/lllustrated/index.vue @@ -796,7 +796,7 @@ function addEdi(){ function savehand() { addformRef.value?.validate((e:any) => { if (!e) { - formData.fileId = formData.fileId.replace(/,$/,'') + formData.fileId = formData.fileId.replace(/,+$/,'') addEdi().then(() => { message.success(isstype.value == 1?'新增成功':'修改成功') setTimeout(() => {