Browse Source

上传视频

master
zhang_li 12 months ago
parent
commit
412a21c0e2
  1. 8
      src/components/BasicForm/src/BasicForm.vue
  2. 241
      src/components/Detail/src/TemplateDetails.vue
  3. 11
      src/components/UploadFile/src/Preview.vue
  4. 4
      src/views/spc/detectiontemplate/index.vue
  5. 72
      src/views/spc/detectiontemplate/templateItemDetails.data.ts

8
src/components/BasicForm/src/BasicForm.vue

@ -1,5 +1,5 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible" :width="isBusiness?'60%':'40%'">
<Dialog :title="dialogTitle" v-model="dialogVisible" :width="width?width:isBusiness?'60%':'40%'">
<Form
ref="formRef"
v-loading="formLoading"
@ -108,6 +108,11 @@ const props = defineProps({
// required: false,
// default: null
// },
width:{
type: String,
required: false,
default: ''
},
})
const { t } = useI18n() //
@ -120,6 +125,7 @@ const formType = ref('') // 表单的类型:create - 新增;update - 修改
const formRef = ref() // Ref
const formSchema = ref(props.formAllSchemas?.formSchema)
const width = ref(props.width)
/** 弹层操作 */
// formField form

241
src/components/Detail/src/TemplateDetails.vue

@ -1,70 +1,86 @@
<template>
<div>
<el-drawer v-model="isShowDrawer" title="模版检测项" direction="rtl" size="80%" v-loading="detailLoading">
<!-- <template #header>
<el-drawer
v-model="isShowDrawer"
title="模版检测项"
direction="rtl"
size="80%"
v-loading="detailLoading"
>
<!-- <template #header>
<div class="font-size-18px">
{{ titleValueRef }} <span class="ml-20px font-size-16px">{{ titleNameRef }}</span>
</div>
</template> -->
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="TemplateItemDetails.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search
:schema="TemplateItemDetails.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="TemplateItemDetails.allSchemas"
/>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="TemplateItemDetails.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<Table
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total
}"
v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{ row }">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase
:Butttondata="butttondata"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
</Table>
</ContentWrap>
</el-drawer>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="TemplateItemDetailsRules"
:formAllSchemas="TemplateItemDetails.allSchemas"
:searchTableParams="searchTableParams"
:apiUpdate="TemplateItemDetailsApi.updateTemplateItemDetails"
:apiCreate="TemplateItemDetailsApi.createTemplateItemDetails"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
/>
</div>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="formsSuccess"
:rules="TemplateItemDetailsRules"
:formAllSchemas="TemplateItemDetails.allSchemas"
:searchTableParams="searchTableParams"
:apiUpdate="TemplateItemDetailsApi.updateTemplateItemDetails"
:apiCreate="TemplateItemDetailsApi.createTemplateItemDetails"
@searchTableSuccess="searchTableSuccess"
:isBusiness="false"
:width="width"
/>
</div>
</template>
<script lang="ts" setup>
defineOptions({ name: 'TemplateDetailsDetail' })
import download from '@/utils/download'
import { TemplateItemDetails,TemplateItemDetailsRules } from '@/views/spc/detectiontemplate/templateItemDetails.data'
import {
TemplateItemDetails,
TemplateItemDetailsRules
} from '@/views/spc/detectiontemplate/templateItemDetails.data'
import * as TemplateItemDetailsApi from '@/api/spc/templateItemDetails'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
const message = useMessage() //
@ -72,7 +88,7 @@ const { t } = useI18n() // 国际化
const route = useRoute() //
const routeName = ref()
const isShowDrawer = ref(false)
const templateId = ref("")
const templateId = ref('')
// routeName.value = route.name
// routeName.value = routeName.value.substring(0,routeName.value.length - 4) + 'Detail'
const props = defineProps({
@ -136,48 +152,52 @@ const props = defineProps({
required: false,
default: null
},
width:{
type: String,
required: false,
default: ''
},
})
const tableColumns = ref(TemplateItemDetails.allSchemas.tableColumns)
const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => {
if(row){
console.log('tableColumns',tableColumns.value)
if (row) {
isShowDrawer.value = true
templateId.value = row.id;
templateId.value = row.id
let param = {
templateId:templateId.value
templateId: templateId.value
}
setSearchParams(param);
await setSearchParams(param)
}
}
defineExpose({ openDetail }) // open
const formsSuccess = async (formType,data) => {
data.templateId = templateId.value;
if(data.type=='NUMBER'&& data.upLimit<data.downLimit){
message.error('数值型上限值要大于下限')
return;
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await TemplateItemDetailsApi.createTemplateItemDetails(data)
message.success(t('common.createSuccess'))
} else {
await TemplateItemDetailsApi.updateTemplateItemDetails(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
const formsSuccess = async (formType, data) => {
data.templateId = templateId.value
if (data.type == 'NUMBER' && data.upLimit < data.downLimit) {
message.error('数值型上限值要大于下限')
return
}
if (data.activeTime == 0) data.activeTime = null
if (data.expireTime == 0) data.expireTime = null
if (formType === 'create') {
await TemplateItemDetailsApi.createTemplateItemDetails(data)
message.success(t('common.createSuccess'))
} else {
await TemplateItemDetailsApi.updateTemplateItemDetails(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
//
const masterParmas=ref({
masterId:'',//id
number: '',//
status: '',//
const masterParmas = ref({
masterId: '', //id
number: '', //
status: '' //
})
routeName.value = route.name
const tableColumns = ref(TemplateItemDetails.allSchemas.tableColumns)
//
const updataTableColumns = (val) => {
@ -186,12 +206,12 @@ const updataTableColumns = (val) => {
//
const searchTableParams = ref([
//{
// formField: 'productItemCode',
// searchTableTitle: '',
// searchTableAllSchemas: Itembasic.allSchemas,
// searchTablePage: ItembasicApi.getItembasicPage
//}
//{
// formField: 'productItemCode',
// searchTableTitle: '',
// searchTableAllSchemas: Itembasic.allSchemas,
// searchTablePage: ItembasicApi.getItembasicPage
//}
])
const { tableObject, tableMethods } = useTable({
@ -208,7 +228,7 @@ const HeadButttondata = [
// defaultButtons.defaultExportBtn({hasPermi:'wms:templateItemDetails:export'}), //
defaultButtons.defaultFreshBtn(null), //
// defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
@ -221,16 +241,22 @@ const HeadButttondata = [
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
if (val == 'add') {
//
openForm('create')
} else if (val == 'import') { //
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') { //
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') { //
} else if (val == 'refresh') {
//
getList()
} else if (val == 'filtrate') { //
} else { //
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
@ -238,14 +264,16 @@ const buttonBaseClick = (val, item) => {
// -
const butttondata = [
defaultButtons.mainListEditBtn(null), //
defaultButtons.mainListDeleteBtn(null), //
defaultButtons.mainListDeleteBtn(null) //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'delete') { //
} else if (val == 'delete') {
//
handleDelete(row.id)
}
}
@ -253,6 +281,21 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
if(type=='update')
console.log(row)
TemplateItemDetails.allSchemas.formSchema.forEach(item=>{
if(item.component == 'UploadFile'){
if(row[item.field]){
item.componentProps.modelValue = [{
name:row[item.field],
url:row[item.field],
}]
}else{
item.componentProps.modelValue =[]
}
}
})
basicFormRef.value.open(type, row)
}
@ -320,9 +363,7 @@ const searchFormClick = (searchData) => {
/** 初始化 **/
onMounted(async () => {
// importTemplateData.templateUrl = await TemplateItemDetailsApi.importTemplate()
})
</script>

11
src/components/UploadFile/src/Preview.vue

@ -0,0 +1,11 @@
<template>
<div class="preview">
1
</div>
</template>
<script lang="ts" setup>
</script>
<style scoped lang="scss">
</style>

4
src/views/spc/detectiontemplate/index.vue

@ -63,6 +63,7 @@
:apiPage="TemplateItemDetailsApi.getTemplateItemDetailsPage"
:apiDelete="TemplateItemDetailsApi.deleteTemplateItemDetails"
:Echo="Echo"
width="60%"
@searchTableSuccessDetail="searchTableSuccessDetail"
/>
@ -107,7 +108,8 @@ const { tableObject, tableMethods } = useTable({
})
//
const { getList, setSearchParams } = tableMethods
const {getList, setSearchParams } = tableMethods
//
const HeadButttondata = [

72
src/views/spc/detectiontemplate/templateItemDetails.data.ts

@ -107,34 +107,54 @@ export const TemplateItemDetails = useCrudSchemas(reactive<CrudSchema[]>([
isSearch: false,
isTable:false,
form:{
component:'UploadImg',
component:'UploadFile',
componentProps:{
fileType:['image/jpeg', 'image/png', 'image/gif','video/mp4','video/webm'],
fileSize:20,
limit:1,
upData:{
tableId:0,tableName:"detection_template_item_details"
},
modelValue:[]
}
}
},
{
label: '工具图',
field: 'image2',
sort: 'custom',
isSearch: false,
isTable:false,
form:{
component:'UploadFile',
componentProps:{
fileType:['image/jpeg', 'image/png', 'image/gif','video/mp4','video/webm'],
fileSize:20,
limit:1,
upData:{
tableId:0,tableName:"detection_template_item_details"
}
}
}
},
{
label: '操作指导书',
field: 'image3',
sort: 'custom',
isSearch: false,
isTable:false,
form:{
component:'UploadFile',
componentProps:{
fileType:['image/jpeg', 'image/png', 'image/gif','video/mp4','video/webm'],
fileSize:20,
limit:1,
upData:{
tableId:0,tableName:"detection_template_item_details"
}
}
}
},
// {
// label: '工具图',
// field: 'image2',
// sort: 'custom',
// isSearch: false,
// isTable:false,
// form:{
// component:'UploadImg',
// componentProps:{
// upData:{
// tabelId:1,tableName:"detection"
// }
// }
// }
// },
// {
// label: '操作指导书',
// field: 'image3',
// sort: 'custom',
// isSearch: false,
// isTable:false,
// form:{
// component:'UploadImg',
// }
// },
{
label: '创建时间',
field: 'createTime',

Loading…
Cancel
Save