Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d4cdffbaf5
@ -139,6 +139,47 @@
|
|||||||
<n-input type="textarea" v-model:value="formData.ncContent" placeholder="请输入NC代码内容" />
|
<n-input type="textarea" v-model:value="formData.ncContent" placeholder="请输入NC代码内容" />
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
</n-gi>
|
</n-gi>
|
||||||
|
<n-gi>
|
||||||
|
<n-form-item path="fileId" label="上传文件">
|
||||||
|
<!--:default-file-list="fileList"-->
|
||||||
|
<!-- <n-upload
|
||||||
|
:action="URL"
|
||||||
|
:headers="{
|
||||||
|
Authorization:TOKEN
|
||||||
|
}"
|
||||||
|
list-type="image-card"
|
||||||
|
>
|
||||||
|
点击上传
|
||||||
|
</n-upload> -->
|
||||||
|
<!-- @before-upload ="flchang"
|
||||||
|
@change="flchang"
|
||||||
|
@remove="flchang"-->
|
||||||
|
<n-upload
|
||||||
|
directory-dnd
|
||||||
|
auto-upload="false"
|
||||||
|
:action="URL"
|
||||||
|
:headers="{
|
||||||
|
Authorization:TOKEN
|
||||||
|
}"
|
||||||
|
:max="20"
|
||||||
|
v-model:file-list="flist"
|
||||||
|
@finish="flchang"
|
||||||
|
@remove="flremove"
|
||||||
|
>
|
||||||
|
|
||||||
|
<n-upload-dragger>
|
||||||
|
<div>
|
||||||
|
<n-icon size="40" :depth="3">
|
||||||
|
<CloudUploadOutline />
|
||||||
|
</n-icon>
|
||||||
|
</div>
|
||||||
|
<n-text style="font-size: 14px">
|
||||||
|
点击或者拖动文件到该区域来上传
|
||||||
|
</n-text>
|
||||||
|
</n-upload-dragger>
|
||||||
|
</n-upload>
|
||||||
|
</n-form-item>
|
||||||
|
</n-gi>
|
||||||
<n-gi>
|
<n-gi>
|
||||||
<n-form-item label="备注">
|
<n-form-item label="备注">
|
||||||
<n-input type="textarea" v-model:value="formData.remark" placeholder="请输入备注" />
|
<n-input type="textarea" v-model:value="formData.remark" placeholder="请输入备注" />
|
||||||
@ -275,7 +316,8 @@ import {
|
|||||||
RefreshOutline,
|
RefreshOutline,
|
||||||
AddOutline,
|
AddOutline,
|
||||||
ArrowDownCircleOutline,
|
ArrowDownCircleOutline,
|
||||||
EllipsisHorizontalOutline
|
EllipsisHorizontalOutline,
|
||||||
|
CloudUploadOutline
|
||||||
} from '@vicons/ionicons5'
|
} from '@vicons/ionicons5'
|
||||||
|
|
||||||
import { useUserStore } from '@/stores/user'
|
import { useUserStore } from '@/stores/user'
|
||||||
@ -292,12 +334,21 @@ import {
|
|||||||
deleteIssue
|
deleteIssue
|
||||||
} from '@/api/nccode'
|
} from '@/api/nccode'
|
||||||
|
|
||||||
|
import
|
||||||
|
{
|
||||||
|
multifilelist
|
||||||
|
} from '@/api/illustrated'
|
||||||
|
|
||||||
const dialog = useDialog()
|
const dialog = useDialog()
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
|
|
||||||
const userStore = useUserStore()
|
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)
|
const hasPermission = (permission: string) => userStore.hasPermission(permission)
|
||||||
|
|
||||||
@ -567,6 +618,7 @@ let formData = reactive<any>({
|
|||||||
workCenter:'', //工作中心
|
workCenter:'', //工作中心
|
||||||
deviceId:'', //设备ID
|
deviceId:'', //设备ID
|
||||||
deviceName:'', //设备名称
|
deviceName:'', //设备名称
|
||||||
|
fileId:'',
|
||||||
status:1, //状态:1-启用 0-禁用
|
status:1, //状态:1-启用 0-禁用
|
||||||
// isIssued:1, //是否已下发:1-已下发 0-未下发
|
// isIssued:1, //是否已下发:1-已下发 0-未下发
|
||||||
// issueTime:null, //下发时间
|
// issueTime:null, //下发时间
|
||||||
@ -602,6 +654,24 @@ const cztype = reactive<any>({
|
|||||||
3:'复制'
|
3:'复制'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
//文件上传回调
|
||||||
|
let flist = ref<any>([])
|
||||||
|
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) {
|
function addhand(type:any,row?:any) {
|
||||||
addModel.value = true
|
addModel.value = true
|
||||||
formData.value?.restoreValidation()
|
formData.value?.restoreValidation()
|
||||||
@ -615,6 +685,7 @@ function addhand(type:any,row?:any) {
|
|||||||
formData.deviceId = row.deviceId
|
formData.deviceId = row.deviceId
|
||||||
formData.deviceName = row.deviceName
|
formData.deviceName = row.deviceName
|
||||||
formData.status = row.status
|
formData.status = row.status
|
||||||
|
formData.fileId = row.fileId+','
|
||||||
// formData.isIssued = row.isIssued
|
// formData.isIssued = row.isIssued
|
||||||
// formData.issueTime = row.issueTime
|
// formData.issueTime = row.issueTime
|
||||||
// formData.issueBy = row.issueBy
|
// formData.issueBy = row.issueBy
|
||||||
@ -624,6 +695,29 @@ function addhand(type:any,row?:any) {
|
|||||||
}else{
|
}else{
|
||||||
formData.ncCode = ''
|
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{
|
}else{
|
||||||
formData.id = ''
|
formData.id = ''
|
||||||
formData.ncCode = ''
|
formData.ncCode = ''
|
||||||
@ -637,6 +731,8 @@ function addhand(type:any,row?:any) {
|
|||||||
// formData.issueTime = ''
|
// formData.issueTime = ''
|
||||||
// formData.issueBy = ''
|
// formData.issueBy = ''
|
||||||
formData.remark = ''
|
formData.remark = ''
|
||||||
|
formData.fileId = ''
|
||||||
|
flist.value.splice(0)
|
||||||
}
|
}
|
||||||
if(type == 1 || type == 3){
|
if(type == 1 || type == 3){
|
||||||
generateNccode().then(rps => {
|
generateNccode().then(rps => {
|
||||||
@ -646,6 +742,7 @@ function addhand(type:any,row?:any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addEdi(){
|
function addEdi(){
|
||||||
|
formData.fileId = formData.fileId.replace(/,+$/,'')
|
||||||
if(isstype.value == 1){
|
if(isstype.value == 1){
|
||||||
return addnccode(formData)
|
return addnccode(formData)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,6 +90,8 @@
|
|||||||
v-model:value="formData.sectionId"
|
v-model:value="formData.sectionId"
|
||||||
cascade
|
cascade
|
||||||
checkable
|
checkable
|
||||||
|
default-expand-all
|
||||||
|
:default-value="[formData.sectionId]"
|
||||||
:options="sectionList"
|
:options="sectionList"
|
||||||
/>
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
@ -441,6 +443,8 @@ async function loadDictOptions() {
|
|||||||
async function loadSection() {
|
async function loadSection() {
|
||||||
const data = await deptApi.tree()
|
const data = await deptApi.tree()
|
||||||
sectionList = buildOptions(data);
|
sectionList = buildOptions(data);
|
||||||
|
console.log(sectionList,'sectionList')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildOptions(d: any[]): TreeNode[] {
|
function buildOptions(d: any[]): TreeNode[] {
|
||||||
|
|||||||
@ -796,7 +796,7 @@ function addEdi(){
|
|||||||
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(() => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user