|
@ -43,13 +43,14 @@ |
|
|
<BasicForm |
|
|
<BasicForm |
|
|
ref="basicFormRef" |
|
|
ref="basicFormRef" |
|
|
@success="formsSuccess" |
|
|
@success="formsSuccess" |
|
|
:rules="MonomerRules" |
|
|
:rules="formRules" |
|
|
:formAllSchemas="Monomer.allSchemas" |
|
|
:formAllSchemas="formAllSchemas" |
|
|
:apiUpdate="MonomerApi.updateMonomer" |
|
|
:apiUpdate="MonomerApi.updateMonomer" |
|
|
:apiCreate="MonomerApi.createMonomer" |
|
|
:apiCreate="MonomerApi.createMonomer" |
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
:isBusiness="false" |
|
|
:isBusiness="false" |
|
|
> |
|
|
> |
|
|
|
|
|
|
|
|
<template #tableForm> |
|
|
<template #tableForm> |
|
|
<!-- 单体产线设备 --> |
|
|
<!-- 单体产线设备 --> |
|
|
<div class="table"> |
|
|
<div class="table"> |
|
@ -191,7 +192,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
<!-- 详情 --> |
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Monomer.allSchemas" /> |
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="formAllSchemas" /> |
|
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
<!-- 导入 --> |
|
|
<ImportForm ref="importFormRef" url="/battery/cell-device/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|
|
<ImportForm ref="importFormRef" url="/battery/cell-device/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|
@ -219,7 +220,7 @@ import * as CellPassApi from '@/api/battery/cellPass' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import download from '@/utils/download' |
|
|
import download from '@/utils/download' |
|
|
import { Monomer,MonomerRules } from './monomer.data' |
|
|
import { Monomer,MonomerRules,StaticMonomer,StaticMonomerRules,DynamicMonomer,DynamicMonomerRules} from './monomer.data' |
|
|
import * as MonomerApi from '@/api/battery/monomer' |
|
|
import * as MonomerApi from '@/api/battery/monomer' |
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
@ -238,6 +239,9 @@ const routeName = ref() |
|
|
routeName.value = route.name |
|
|
routeName.value = route.name |
|
|
const tableColumns = ref(Monomer.allSchemas.tableColumns) |
|
|
const tableColumns = ref(Monomer.allSchemas.tableColumns) |
|
|
|
|
|
|
|
|
|
|
|
const formRules = ref(StaticMonomerRules) |
|
|
|
|
|
const formAllSchemas = ref(StaticMonomer.allSchemas) |
|
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
// 查询页面返回 |
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
nextTick(() => { |
|
|
nextTick(() => { |
|
@ -330,25 +334,23 @@ const buttonTableClick = async (val, row) => { |
|
|
const basicFormRef = ref() |
|
|
const basicFormRef = ref() |
|
|
const openForm = async (type: string, row?: any) => { |
|
|
const openForm = async (type: string, row?: any) => { |
|
|
|
|
|
|
|
|
|
|
|
if(isStatic.value){ |
|
|
|
|
|
// 静态 |
|
|
|
|
|
formRules.value = StaticMonomerRules |
|
|
|
|
|
formAllSchemas.value = StaticMonomer.allSchemas |
|
|
|
|
|
basicFormRef.value.updateFormAllSchemas(StaticMonomer.allSchemas) |
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
// 动态 |
|
|
|
|
|
formRules.value = DynamicMonomerRules |
|
|
|
|
|
formAllSchemas.value = DynamicMonomer.allSchemas |
|
|
|
|
|
basicFormRef.value.updateFormAllSchemas(DynamicMonomer.allSchemas) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(type == 'create'&&tableObject.tableList.length>0){ |
|
|
if(type == 'create'&&isStatic.value){ |
|
|
if(isStatic.value){ |
|
|
let defaultRow = await MonomerApi.getMonomer(1) |
|
|
// 静态 |
|
|
row = defaultRow |
|
|
Monomer.allSchemas.formSchema.forEach(item=>{ |
|
|
|
|
|
if(item.field=='type'){ |
|
|
|
|
|
item.value = 'static' |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
let defaultRow = await MonomerApi.getMonomer(1) |
|
|
|
|
|
row = defaultRow |
|
|
|
|
|
}else{ |
|
|
|
|
|
// 动态 |
|
|
|
|
|
Monomer.allSchemas.formSchema.forEach(item=>{ |
|
|
|
|
|
if(item.field=='type'){ |
|
|
|
|
|
item.value = 'moving' |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
if(row){ |
|
|
if(row){ |
|
|
// 设备 |
|
|
// 设备 |
|
@ -382,15 +384,7 @@ const openForm = async (type: string, row?: any) => { |
|
|
|
|
|
|
|
|
// form表单提交 |
|
|
// form表单提交 |
|
|
const formsSuccess = async (formType,data) => { |
|
|
const formsSuccess = async (formType,data) => { |
|
|
var isHave =Monomer.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.activeTime==0)data.activeTime = null; |
|
|
if(data.expireTime==0)data.expireTime = null; |
|
|
if(data.expireTime==0)data.expireTime = null; |
|
|
// 设备 |
|
|
// 设备 |
|
@ -419,6 +413,19 @@ const formsSuccess = async (formType,data) => { |
|
|
/** 详情操作 */ |
|
|
/** 详情操作 */ |
|
|
const detailRef = ref() |
|
|
const detailRef = ref() |
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
|
|
|
if(row.type=='static'){ |
|
|
|
|
|
// 静态 |
|
|
|
|
|
formRules.value = StaticMonomerRules |
|
|
|
|
|
formAllSchemas.value = StaticMonomer.allSchemas |
|
|
|
|
|
basicFormRef.value.updateFormAllSchemas(StaticMonomer.allSchemas) |
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
// 动态 |
|
|
|
|
|
formRules.value = DynamicMonomerRules |
|
|
|
|
|
formAllSchemas.value = DynamicMonomer.allSchemas |
|
|
|
|
|
basicFormRef.value.updateFormAllSchemas(DynamicMonomer.allSchemas) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicCellDevice') |
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicCellDevice') |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|