Browse Source

Merge branch 'master_hella' of http://dev.ccwin-in.com:3000/sfms3.0/sfms3.0-ui into master_hella

master_hella_20240701
zhaoxuebing 7 months ago
parent
commit
6cf556e864
  1. 4
      .env.development
  2. 1
      src/api/qms/inspectionMethod/index.ts
  3. 4
      src/components/UploadFile/src/UploadFile.vue
  4. 89
      src/views/qms/inspectionMethod/index.vue
  5. 32
      src/views/qms/inspectionMethod/inspectionMethod.data.ts
  6. 1
      src/views/qms/samplingProcess/samplingProcess.data.ts
  7. 2
      src/views/qms/samplingScheme/samplingScheme.data.ts
  8. 7
      src/views/system/systemInstallPackage/index.vue
  9. 13
      src/views/system/systemInstallPackage/systemInstallPackage.data.ts

4
.env.development

@ -4,10 +4,10 @@ NODE_ENV=development
VITE_DEV=false
# 请求路径
VITE_BASE_URL='http://localhost:12080'
VITE_BASE_URL='http://192.168.0.113:12080'
# 上传路径
VITE_UPLOAD_URL='http://localhost:12080/admin-api/infra/file/upload'
VITE_UPLOAD_URL='http://192.168.0.113:12080/admin-api/infra/file/upload'
# 接口前缀
VITE_API_BASEPATH=/dev-api

1
src/api/qms/inspectionMethod/index.ts

@ -33,6 +33,7 @@ export const createInspectionMethod = async (data: InspectionMethodVO) => {
// 修改检验方法
export const updateInspectionMethod = async (data: InspectionMethodVO) => {
// debugger
return await request.put({ url: `/qms/inspection-method/update`, data })
}

4
src/components/UploadFile/src/UploadFile.vue

@ -56,7 +56,7 @@ const props = defineProps({
title: propTypes.string.def('文件上传'),
updateUrl: propTypes.string.def(import.meta.env.VITE_UPLOAD_URL),
upData: propTypes.object.def(),
fileType: propTypes.array.def(['doc', 'xls', 'ppt', 'txt', 'pdf', 'pdf','png', 'jpg', 'jpeg']), // , ['png', 'jpg', 'jpeg']
fileType: propTypes.array.def(['apk','doc', 'xls', 'ppt', 'txt', 'pdf', 'pdf','png', 'jpg', 'jpeg']), // , ['png', 'jpg', 'jpeg']
fileSize: propTypes.number.def(5), // (MB)
limit: propTypes.number.def(5), //
autoUpload: propTypes.bool.def(true), //
@ -137,6 +137,7 @@ const handleRemove = (file) => {
}
const handlePreview: UploadProps['onPreview'] = (uploadFile) => {
console.log(uploadFile)
window.open(uploadFile.url)
}
//
const listToString = (list: UploadUserFile[], separator?: string) => {
@ -147,6 +148,7 @@ const listToString = (list: UploadUserFile[], separator?: string) => {
}
return strs != '' ? strs.substr(0, strs.length - 1) : ''
}
</script>
<style scoped lang="scss">
.upload-file-uploader {

89
src/views/qms/inspectionMethod/index.vue

@ -42,6 +42,13 @@
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:sumFormDataByForm ="(formRef,formModel)=>{
console.log(formModel)
const {videoAddress} = formModel
formRef.value.setValues({
installPackageUrl:videoAddress
})
}"
:rules="InspectionMethodRules"
:formAllSchemas="InspectionMethod.allSchemas"
:apiUpdate="InspectionMethodApi.updateInspectionMethod"
@ -149,26 +156,86 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
// debugger
console.log(row)
if(row && row.videoAddress.trim()){
row.filePathList = row.videoAddress.split(',')
}
if (row && row.filePathList && row.filePathList.length > 0) {
row.filePathListView = row.filePathList.map((item) => {
return {
name: item,
url: item
}
})
}
if(type=='create'){
const currentTime = new Date().getTime()
const fileId = InspectionMethod.allSchemas.formSchema.find(item=>item.field=='fileId')
const uploadFile = InspectionMethod.allSchemas.formSchema.find(item=>item.field=='videoAddress')
if(fileId){
fileId['value'] = currentTime
}
if(uploadFile){
uploadFile['componentProps']['upData']['tableId'] = currentTime
uploadFile['componentProps']['modelValue']= []
}
}else if(type=='update'){
const uploadFile = InspectionMethod.allSchemas.formSchema.find(item=>item.field=='videoAddress')
uploadFile['componentProps']['modelValue']= row.filePathListView
}
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =InspectionMethod.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
// data.filePathList = []
// data.tmp = []
console.log(data)
// for (let i = 0; i < data.filePathListView.length; i++) {
// data.filePathList.push(data.filePathListView[i].url)
// }
// data.filePathList = []
// for (let i = 0; i < data.filePathListView.length; i++) {
// data.filePathList.push(data.filePathListView[i].url)
// }
// if(data.filePathList.length>0){
// data.videoAddress = data.filePathList.join(',')
// }
// debugger
// if(data.filePathListView instanceof Array){
// for(let i=0; i<data.filePathListView.length; i++){
// data.tmp.push(data.filePathListView[i].url)
// }
// data.videoAddress = data.tmp.join(',')
// }else{
// data.videoAddress = data.filePathListView
// data.filePathListView = data.filePathListView.split(',').map(url=>{return {url}})
// }
// for (let i = 0; i < data.filePathListView.length; i++) {
// data.filePathList.push(data.filePathListView[i])
// }
// console.log(1111,data)
// var isHave =InspectionMethod.allSchemas.formSchema.some(function (item) {
// return item.field === 'activeTime' || item.field === 'expireTime';
// });
// if(isHave){
// if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
// message.error('')
// return;
// }
// }
// if(data.activeTime==0)data.activeTime = null;
// if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
delete data['uploadFile']
await InspectionMethodApi.createInspectionMethod(data)
message.success(t('common.createSuccess'))
} else {
// debugger
await InspectionMethodApi.updateInspectionMethod(data)
message.success(t('common.updateSuccess'))
}

32
src/views/qms/inspectionMethod/inspectionMethod.data.ts

@ -36,11 +36,11 @@ export const InspectionMethod = useCrudSchemas(reactive<CrudSchema[]>([
field: 'operationGuidance',
sort: 'custom',
},
{
label: '视频地址',
field: 'videoAddress',
sort: 'custom',
},
// {
// label: '视频地址',
// field: 'videoAddress',
// sort: 'custom',
// },
{
label: '是否可用',
field: 'available',
@ -51,6 +51,26 @@ export const InspectionMethod = useCrudSchemas(reactive<CrudSchema[]>([
component: 'SelectV2'
},
},
{
label: '文件',
field: 'videoAddress',
sort: 'custom',
isTable: false,
table: {
},
form: {
component: 'UploadFile',
componentProps: {
upData:{
tableName:'basicInspectionMethod',
tableId:'',
},
fileType:['doc', 'xls', 'ppt', 'txt'],
modelValue:[]
},
}
},
{
label: '创建时间',
field: 'createTime',
@ -66,5 +86,5 @@ export const InspectionMethod = useCrudSchemas(reactive<CrudSchema[]>([
width: 150,
fixed: 'right'
}
}
},
]))

1
src/views/qms/samplingProcess/samplingProcess.data.ts

@ -7,6 +7,7 @@ export const SamplingProcessRules = reactive({
sampleType: [required],
evaluationMode: [required],
available: [required],
description: [required],
})
export const SamplingProcess = useCrudSchemas(reactive<CrudSchema[]>([

2
src/views/qms/samplingScheme/samplingScheme.data.ts

@ -4,8 +4,8 @@ import { dateFormatter } from '@/utils/formatTime'
// 表单校验
export const SamplingSchemeRules = reactive({
code: [required],
// status: [required],
available: [required],
description: [required],
})
export const SamplingScheme = useCrudSchemas(reactive<CrudSchema[]>([

7
src/views/system/systemInstallPackage/index.vue

@ -141,10 +141,15 @@ const openForm = (type: string, row?: any) => {
if('create'==type){
const currentTime = new Date().getTime()
const fileId = SystemInstallPackage.allSchemas.formSchema.find(item=>item.field=='fileId')
fileId['value'] = currentTime
const uploadFile = SystemInstallPackage.allSchemas.formSchema.find(item=>item.field=='uploadFile')
if(fileId){
fileId['value'] = currentTime
}
if(uploadFile){
uploadFile['componentProps']['upData']['tableId'] = currentTime
}
}
basicFormRef.value.open(type, row)
}

13
src/views/system/systemInstallPackage/systemInstallPackage.data.ts

@ -14,6 +14,7 @@ export const SystemInstallPackage = useCrudSchemas(reactive<CrudSchema[]>([
label: 'id',
field: 'id',
sort: 'custom',
isForm:false,
},
{
label: '安装包名称',
@ -25,6 +26,13 @@ export const SystemInstallPackage = useCrudSchemas(reactive<CrudSchema[]>([
label: '安装包版本',
field: 'installPackageVersion',
sort: 'custom',
form: {
component: 'InputNumber',
componentProps: {
min: 0,
precision: 6
}
},
},
{
label: '安装路径',
@ -64,6 +72,7 @@ export const SystemInstallPackage = useCrudSchemas(reactive<CrudSchema[]>([
label: '附件id',
field: 'fileId',
sort: 'custom',
isForm:false,
form: {
componentProps: {
disabled: true
@ -87,7 +96,9 @@ export const SystemInstallPackage = useCrudSchemas(reactive<CrudSchema[]>([
tableId: '',
tableName: ''
},
limit:1
limit:1,
fileType:['apk'],
fileSize:35
}
},
},

Loading…
Cancel
Save