siontion 5 months ago
commit 952e68a998

@ -7,7 +7,13 @@
<img src="/src/assets/imgs/status/status16.png" v-if="formData.notificationStatus == 3" alt="" />
<img src="/src/assets/imgs/status/status8.png" v-else-if="formData.notificationStatus == 2" alt="" />
</div> -->
<el-form ref="formRef" label-width="160px" :rules="formRules" :model="formData" v-loading="formLoading">
<el-form
ref="formRef"
label-width="160px"
:rules="formRules"
:model="formData"
v-loading="formLoading"
>
<!-- 基础信息 横向布局 -->
<el-card class="hl-card-info">
<template #header>
@ -16,13 +22,28 @@
<el-row>
<el-col :span="8">
<el-form-item label="品质异常通知单" prop="code">
<el-input disabled class="!w-260px" v-model="formData.code" placeholder="请输入品异常通知单" />
<el-input
disabled
class="!w-260px"
v-model="formData.code"
placeholder="请输入品异常通知单"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="质检类型" prop="type">
<el-select disabled class="!w-260px" v-model="formData.type" placeholder="请选择质检类型">
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.BIZ_INSPECTION_TYPE)" :key="dict.value" :label="dict.label" :value="dict.value" />
<el-select
disabled
class="!w-260px"
v-model="formData.type"
placeholder="请选择质检类型"
>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.BIZ_INSPECTION_TYPE)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
@ -41,7 +62,12 @@
</el-col>
<el-col :span="8">
<el-form-item label="生产车间" prop="workshopId">
<WorkshopSelect disabled v-model="formData.workshopId" class="!w-260px" @update:newValue="handleSelectedWorkshop" />
<WorkshopSelect
disabled
v-model="formData.workshopId"
class="!w-260px"
@update:newValue="handleSelectedWorkshop"
/>
</el-form-item>
</el-col>
</el-row>
@ -73,24 +99,107 @@
</el-col>
<el-col :span="8">
<el-form-item label="异常数量" prop="amount">
<el-input disabled class="!w-260px" v-model="formData.amount" placeholder="请输入异常数量" />
<el-input
disabled
class="!w-260px"
v-model="formData.amount"
placeholder="请输入异常数量"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="责任人" prop="owner">
<el-input disabled v-model="formData.ownerName" class="!w-260px" placeholder="请输入责任人" />
<el-input
disabled
v-model="formData.ownerName"
class="!w-260px"
placeholder="请输入责任人"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="16">
<el-form-item label="情况描述" prop="remark">
<el-input type="textarea" disabled v-model="formData.remark" placeholder="请输入情况描述" />
<el-input
type="textarea"
disabled
v-model="formData.remark"
placeholder="请输入情况描述"
/>
</el-form-item>
</el-col>
</el-row>
</el-card>
<!-- 附件信息 -->
<el-card class="hl-card-info" v-if="active != 'create'">
<template #header>
<div class="hl-card-info-icona"></div><span class="hl-card-info-text">附件信息</span>
</template>
<el-row>
<el-col v-if="active != 'detail'">
<el-upload
ref="attachmentUploadRef"
multiple
:action="uploadUrl"
:headers="uploadHeaders"
name="files"
:show-file-list="false"
:auto-upload="false"
:data="uploadData"
:on-change="attachmentUploadChange"
:on-error="handleError"
:on-success="handleSuccess"
:before-upload="before"
class="upload-file-uploader"
>
<el-button type="primary"> <Icon icon="ep:upload-filled" />上传 </el-button>
</el-upload>
</el-col>
<el-col>
<el-card class="hl-incard">
<el-table
:data="formData.attachments"
class="hl-table"
v-loading.fullscreen.lock="uploading"
element-loading-text="附件上传中..."
element-loading-background="rgba(122, 122, 122, 0.6)"
>
<el-table-column prop="name" label="文件名称" align="center" />
<el-table-column
prop="createTime"
align="center"
label="上传时间"
:formatter="dateFormatter"
/>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
v-if="'update,create,deliver'.indexOf(active) > -1"
link
type="danger"
size="small"
@click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)"
>
删除
</el-button>
<el-button
v-if="!!scope.row.id"
link
type="primary"
size="small"
@click="downloadAttachment(scope.row.name, scope.row.url)"
>
下载
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
</el-card>
<!-- 系统信息 -->
<el-card class="hl-card-info">
<template #header>
<div class="hl-card-info-icona"></div><span class="hl-card-info-text">系统信息</span>
@ -103,13 +212,25 @@
</el-col>
<el-col :span="8">
<el-form-item label="创建时间" prop="createTime">
<el-date-picker class="!w-260px" v-model="formData.createTime" type="datetime" value-format="x" placeholder="" disabled />
<el-date-picker
class="!w-260px"
v-model="formData.createTime"
type="datetime"
value-format="x"
placeholder=""
disabled
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单据状态" prop="notificationStatus">
<el-select disabled v-model="formData.notificationStatus" placeholder="">
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.BIZ_UNQUALIFIED_NOTIFICATION_STATUS)" :key="dict.value" :label="dict.label" :value="dict.value" />
<el-option
v-for="dict in getIntDictOptions(DICT_TYPE.BIZ_UNQUALIFIED_NOTIFICATION_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
@ -122,13 +243,25 @@
</el-col>
<el-col :span="8">
<el-form-item label="审核时间" prop="auditTime">
<el-date-picker class="!w-260px" v-model="formData.auditTime" type="datetime" value-format="x" placeholder="" disabled />
<el-date-picker
class="!w-260px"
v-model="formData.auditTime"
type="datetime"
value-format="x"
placeholder=""
disabled
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="审核意见" prop="auditOpinion1">
<el-select disabled v-model="formData.auditOpinion" placeholder="">
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.BIZ_UNQUALIFIED_NOTIFICATION_OPINION)" :key="dict.value" :label="dict.label" :value="dict.value" />
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.BIZ_UNQUALIFIED_NOTIFICATION_OPINION)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
@ -137,23 +270,38 @@
<el-dialog v-model="activeOpinionDialogVisible" title="" width="30%" center>
<el-form-item label="审核意见" prop="auditOpinion">
<el-select clearable v-model="formData.auditOpinion" placeholder="请选择审核意见">
<el-option v-for="dict in getStrDictOptions(DICT_TYPE.BIZ_UNQUALIFIED_NOTIFICATION_OPINION)" :key="dict.value" :label="dict.label" :value="dict.value" />
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.BIZ_UNQUALIFIED_NOTIFICATION_OPINION)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<template #footer>
<span class="dialog-footer">
<el-button @click="activeOpinionDialogVisible = false"> </el-button>
<el-button type="primary" @click="submitForm('AUDIT') && (activeOpinionDialogVisible = false)"> </el-button>
<el-button
type="primary"
@click="submitForm('AUDIT') && (activeOpinionDialogVisible = false)"
> </el-button
>
</span>
</template>
</el-dialog>
</el-form>
<div class="text-center hl-footer">
<el-button @click="goback" size="large"> </el-button>
<el-button v-if="formData.notificationStatus == 2 && active != 'detail'" @click="activeOpinionDialogVisible = true" type="primary" :disabled="formLoading" size="large"> </el-button>
<el-button
v-if="formData.notificationStatus == 2 && active != 'detail'"
@click="activeOpinionDialogVisible = true"
type="primary"
:disabled="formLoading"
size="large"
> </el-button
>
</div>
</el-card>
</template>
<script setup lang="ts">
import { ref } from 'vue'
@ -164,9 +312,12 @@ import { useCommonStore } from '@/store/modules/common'
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
import ProcedureSelect from '@/views/biz/hlvuestyle/procedureSelect.vue'
import WorkshopSelect from '@/views/biz/hlvuestyle/workshopSelect.vue'
import type { UploadProps, UploadUserFile } from 'element-plus'
import { getAccessToken, getTenantId } from '@/utils/auth'
defineOptions({ name: 'UnqualifiedNotificationDetail' })
const reload = inject('reload')
import { deleteFileLogic, downloadFile, getFilePage } from '@/api/infra/file'
import download from '@/utils/download'
const reload: any = inject('reload')
const { t } = useI18n() //
const message = useMessage() //
const commonStore = useCommonStore()
@ -196,7 +347,8 @@ const formData = ref({
auditor: undefined,
auditOpinion: undefined,
status: undefined,
workshopId: undefined
workshopId: undefined,
attachments: []
})
const formRef = ref() // Ref
@ -231,7 +383,8 @@ const resetForm = () => {
auditor: undefined,
auditOpinion: undefined,
status: undefined,
workshopId: undefined
workshopId: undefined,
attachments: []
}
formRef.value?.resetFields()
}
@ -245,6 +398,17 @@ const queryData = async (id?: number) => {
formLoading.value = true
try {
formData.value = await UnqualifiedNotificationApi.getUnqualifiedNotification(id)
//
let attParams = {
pageNo: 1,
pageSize: 99,
businessId: id,
businessType: businessType.value
}
formData.value.attachments = (await getFilePage(attParams)).list
} finally {
formLoading.value = false
}
@ -260,6 +424,12 @@ const submitForm = async (operate) => {
const data = formData.value as unknown as UnqualifiedNotificationApi.UnqualifiedNotificationVO
let dataId = await UnqualifiedNotificationApi.operateUnqualifiedNotification(data)
//
if (attachmentUploadFiles.value.length > 0) {
uploadData.value.businessId = formData.value.id
await attachmentUploadRef.value!.submit()
}
message.success(t('common.operationSuccess'))
commonStore.setStore('id', dataId)
commonStore.setStore('active', 'detail')
@ -282,9 +452,136 @@ onMounted(() => {
})
//
const handleSelectedWorkshop = (newValue: any) => {
console.log(newValue);
formData.value.workshopId = newValue?.id
}
//
const attachmentUploadRef = ref()
const attachmentUploadFiles = ref<UploadUserFile[]>([])
const uploading = ref(false)
const businessType = ref('QUALITY')
const uploadUrl = ref(import.meta.env.VITE_UPLOAD_BATCH_URL)
const uploadData = ref({
businessType: businessType.value,
businessId: formData.value.id,
businessFileType: 'QUALITYAnomaly'
})
const uploadHeaders = ref({
Authorization: 'Bearer ' + getAccessToken(),
'tenant-id': getTenantId()
})
const attachmentUploadChange = (file, files) => {
attachmentUploadFiles.value = files
refreshAttachments(files, 'QUALITYAnomaly')
}
//
const sumbefore = ref(0)
const successfulUploadsCount = ref(0)
const failedUploadsCount = ref(0)
const failedAttachments = ref<UploadUserFile[]>([])
const failedAttachmentsName = ref()
//
const handleSuccess = (response: any, file: UploadUserFile) => {
successfulUploadsCount.value++
// ...
// console.log('', successfulUploadsCount.value)
}
//
const handleError = (error: Error, file: UploadUserFile) => {
failedUploadsCount.value++
if (failedUploadsCount.value > 0) {
//
// failedAttachments.value
failedAttachments.value.push(file)
failedAttachmentsName.value = failedAttachments.value.map((value) => value.name)
}
// console.log('', failedUploadsCount.value)
}
//
const before = (rawFile) => {
sumbefore.value++
}
const refreshAttachments = (files, type) => {
formData.value.attachments = files.filter((value) => value.id)
//
const newFiles = files.filter(
(file) => !formData.value.attachments.some((att) => att.name === file.name)
)
for (let i = 0; i < newFiles.length; i++) {
let file = newFiles[i]
file.businessFileType = type
file.createTime = new Date()
formData.value.attachments.push(file)
}
//
formData.value.attachments.sort((v1, v2) => v1.createTime - v2.createTime)
//
const sum = successfulUploadsCount.value + failedUploadsCount.value
// console.log('', sum)
// console.log('', sumbefore.value)
if (sumbefore.value !== sum && sumbefore.value !== 0 && sum !== 0) {
// console.log('',uploading.value)
uploading.value = true
} else if (sum == sumbefore.value && sumbefore.value > 0 && sum > 0) {
// console.log(' ')
if (failedUploadsCount.value > 0) {
ElMessageBox.alert(
// 使
`文件名为:${failedAttachmentsName.value.join(' / ')}上传失败`,
`文件格式不正确或网络问题 请您稍后再试`,
{
dangerouslyUseHTMLString: false,
confirmButtonText: '知道了',
center: true
}
)
}
reload()
uploading.value = false
}
}
// /** */
// const onDeleteItem = (index) => {
// if (formData.value.deliverOrderSubs.length == 1) {
// message.warning('')
// return
// }
// formData.value.deliverOrderSubs.splice(index, 1)
// }
// const onDeleteItem2 = (index) => {
// formData.value.deliverOrderOtherSubs.splice(index, 1)
// }
//
const handleDeleteAttachment = async (index, type) => {
const deletedAttachments = formData.value.attachments.splice(index, 1)
for (let i = 0; i < deletedAttachments.length; i++) {
const attachment = deletedAttachments[i]
if (attachment.id) {
//
await deleteFileLogic(attachment.id)
}
//
attachmentUploadFiles.value = attachmentUploadFiles.value.filter((file1) => {
return file1.name != attachment.name
})
}
}
//
const downloadAttachment = async (name, url) => {
const data = await downloadFile(url)
download.any(data, name)
}
</script>
<style scoped>
</style>
<style scoped></style>

@ -16,7 +16,7 @@ onLaunch(async () => {
appId: 'com.chanko.yunxi.mes.android'
}
const res = await appUpdateApi(params)
console.log('1-0', res.versionId)
console.log('1-0', res,res.versionId)
plus.runtime.getProperty(plus.runtime.appid, function (wgtinfo) {
const version = wgtinfo.version || plus.runtime.version
console.log('1-1', res.versionId,version)
@ -26,9 +26,10 @@ onLaunch(async () => {
showCancel: false,
confirmText: '立即更新',
content: res.remark || 'APP有新版本发布点击 立即更新 进行最新版本下载。',
success: (res) => {
if (res.confirm) {
onSureClick(res.url)
success: (res2) => {
if (res2.confirm) {
console.log(999,res.url)
plus.runtime.openURL(res.url)
}
}
})
@ -44,30 +45,6 @@ onShow(async () => {
onHide(() => {
console.log('App Hide')
})
const onSureClick = (upDataUrl) => {
var downloadTask = uni.downloadFile({
url: upDataUrl,
success: (downloadResult) => {
if (downloadResult.statusCode === 200) {
plus.runtime.install(downloadResult.tempFilePath, {
force: false
}, function () {
plus.runtime.restart();
}, (e) => {
console.log(e)
uni.showToast({
title: '安装升级包失败',
icon: 'none'
})
});
}
}
});
//
downloadTask.onProgressUpdate((e) => {
//
})
}
</script>
<style lang="scss">

Loading…
Cancel
Save