Browse Source

单体出厂检验功能

master
wangyufei 1 month ago
parent
commit
013a13b027
  1. 1
      src/components/BasicForm/src/BasicForm.vue
  2. 4
      src/utils/disposition/defaultButtons.ts
  3. 378
      src/views/battery/monomer/index.vue

1
src/components/BasicForm/src/BasicForm.vue

@ -78,6 +78,7 @@
<el-input v-model="formSchema.value" v-if="isDetail && formTypeDetail == 'InputString'" /> <el-input v-model="formSchema.value" v-if="isDetail && formTypeDetail == 'InputString'" />
</template> </template>
</Form> </Form>
<slot name="tableForm"></slot>
<Tabs ref="tabRef" v-if="includeCollectionTable&&formType=='create'&&tableAllSchemas&&tableAllSchemas.tableFormColumns.find(item=>item.field == 'itemCode')" :tabsList="[{ <Tabs ref="tabRef" v-if="includeCollectionTable&&formType=='create'&&tableAllSchemas&&tableAllSchemas.tableFormColumns.find(item=>item.field == 'itemCode')" :tabsList="[{
label: '明细', label: '明细',
prop: 'TableForm' prop: 'TableForm'

4
src/utils/disposition/defaultButtons.ts

@ -10,7 +10,7 @@ const { t } = useI18n()
export function defaultAddBtn(option: any) { export function defaultAddBtn(option: any) {
return __defaultBtnOption(option, { return __defaultBtnOption(option, {
label: t(`ts.动态数据`).replace('ts.', ''), label: t(`ts.动态数据`).replace('ts.', ''),
name: 'add', name: 'addDynamic',
hide: false, hide: false,
type: 'primary', type: 'primary',
icon: 'ep:plus', icon: 'ep:plus',
@ -22,7 +22,7 @@ export function defaultAddBtn(option: any) {
export function defaultAddStaticBtn(option: any) { export function defaultAddStaticBtn(option: any) {
return __defaultBtnOption(option, { return __defaultBtnOption(option, {
label: t(`ts.静态数据`).replace('ts.', ''), label: t(`ts.静态数据`).replace('ts.', ''),
name: 'add', name: 'addStatic',
hide: false, hide: false,
type: 'warning', type: 'warning',
icon: 'ep:plus', icon: 'ep:plus',

378
src/views/battery/monomer/index.vue

@ -14,6 +14,7 @@
:allSchemas="Monomer.allSchemas" :allSchemas="Monomer.allSchemas"
/> />
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table <Table
@ -48,7 +49,146 @@
:apiCreate="MonomerApi.createMonomer" :apiCreate="MonomerApi.createMonomer"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
:isBusiness="false" :isBusiness="false"
/> >
<template #tableForm>
<!-- 单体产线设备 -->
<div class="table">
<TableForm
ref="tableFormDeviceRef"
class="w-[100%]"
:isShowButton="isStatic&&tableDataDevice.length==0||!isStatic"
:isShowReduceButtonSelection="true"
:tableFields="CellDevice.allSchemas.tableFormColumns"
:tableData="tableDataDevice"
:tableFormRules="CellDeviceRules"
@handleAddTable="handleAddTable('Device')"
@handleDeleteTable="(item, index)=>handleDeleteTable(item, index,'Device')"
@tableSelectionDelete="(selection)=>tableSelectionDelete(selection,'Device')"
@inpuFocus="inpuFocus"
@inputStringBlur="inputStringBlur"
:routeName="routeName"
>
<!-- <template v-slot="{ row }">
<slot :row="row"></slot>
</template> -->
</TableForm>
</div>
<!-- 单体产线环境 -->
<div class="table marr20">
<TableForm
ref="tableFormEnvRef"
class="w-[100%]"
:isShowButton="isStatic&&tableDataEnv.length==0||!isStatic"
:isShowReduceButtonSelection="true"
:tableFields="CellEnv.allSchemas.tableFormColumns"
:tableData="tableDataEnv"
:tableFormRules="CellEnvRules"
@handleAddTable="handleAddTable('Env')"
@handleDeleteTable="(item, index)=>handleDeleteTable(item, index,'Env')"
@tableSelectionDelete="(selection)=>tableSelectionDelete(selection,'Env')"
@inpuFocus="inpuFocus"
@inputStringBlur="inputStringBlur"
:routeName="routeName"
>
<!-- <template v-slot="{ row }">
<slot :row="row"></slot>
</template> -->
</TableForm>
</div>
<!-- 单体极片 -->
<div class="table marr20">
<TableForm
ref="tableFormPlateRef"
class="w-[100%]"
:isShowButton="isStatic&&tableDataPlate.length==0||!isStatic"
:isShowReduceButtonSelection="true"
:tableFields="CellPlate.allSchemas.tableFormColumns"
:tableData="tableDataPlate"
:tableFormRules="CellPlateRules"
@handleAddTable="handleAddTable('Plate')"
@handleDeleteTable="(item, index)=>handleDeleteTable(item, index,'Plate')"
@tableSelectionDelete="(selection)=>tableSelectionDelete(selection,'Plate')"
@inpuFocus="inpuFocus"
@inputStringBlur="inputStringBlur"
:routeName="routeName"
>
<!-- <template v-slot="{ row }">
<slot :row="row"></slot>
</template> -->
</TableForm>
</div>
<!-- 单体卷芯或叠芯 -->
<div class="table marr20">
<TableForm
ref="tableFormCoreRef"
class="w-[100%]"
:isShowButton="isStatic&&tableDataCore.length==0||!isStatic"
:isShowReduceButtonSelection="true"
:tableFields="CellCore.allSchemas.tableFormColumns"
:tableData="tableDataCore"
:tableFormRules="CellCoreRules"
@handleAddTable="handleAddTable('Core')"
@handleDeleteTable="(item, index)=>handleDeleteTable(item, index,'Core')"
@tableSelectionDelete="(selection)=>tableSelectionDelete(selection,'Core')"
@inpuFocus="inpuFocus"
@inputStringBlur="inputStringBlur"
:routeName="routeName"
>
<!-- <template v-slot="{ row }">
<slot :row="row"></slot>
</template> -->
</TableForm>
</div>
<!-- 单体产品 -->
<div class="table marr20">
<TableForm
ref="tableFormProdRef"
class="w-[100%]"
:isShowButton="isStatic&&tableDataProd.length==0||!isStatic"
:isShowReduceButtonSelection="true"
:tableFields="CellProd.allSchemas.tableFormColumns"
:tableData="tableDataProd"
:tableFormRules="CellProdRules"
@handleAddTable="handleAddTable('Prod')"
@handleDeleteTable="(item, index)=>handleDeleteTable(item, index,'Prod')"
@tableSelectionDelete="(selection)=>tableSelectionDelete(selection,'Prod')"
@inpuFocus="inpuFocus"
@inputStringBlur="inputStringBlur"
:routeName="routeName"
>
<!-- <template v-slot="{ row }">
<slot :row="row"></slot>
</template> -->
</TableForm>
</div>
<!-- 单体产品 -->
<div class="table marr20">
<TableForm
ref="tableFormPassRef"
class="w-[100%]"
:isShowButton="isStatic&&tableDataPass.length==0||!isStatic"
:isShowReduceButtonSelection="true"
:tableFields="CellPass.allSchemas.tableFormColumns"
:tableData="tableDataPass"
:tableFormRules="CellPassRules"
@handleAddTable="handleAddTable('Pass')"
@handleDeleteTable="(item, index)=>handleDeleteTable(item, index,'Pass')"
@tableSelectionDelete="(selection)=>tableSelectionDelete(selection,'Pass')"
@inpuFocus="inpuFocus"
@inputStringBlur="inputStringBlur"
:routeName="routeName"
>
<!-- <template v-slot="{ row }">
<slot :row="row"></slot>
</template> -->
</TableForm>
</div>
</template>
</BasicForm>
<SearchTable
ref="searchTableRef"
@searchTableSuccess="searchTableSuccess1"/>
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="Monomer.allSchemas" /> <Detail ref="detailRef" :isBasic="true" :allSchemas="Monomer.allSchemas" />
@ -58,6 +198,26 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
// 线
import * as CellDeviceApi from '@/api/battery/cellDevice'
import { CellDevice,CellDeviceRules } from '@/views/battery/cellDevice/cellDevice.data'
// 线
import * as CellEnvApi from '@/api/battery/cellEnv'
import { CellEnv,CellEnvRules } from '@/views/battery/cellEnv/cellEnv.data'
//
import { CellPlate,CellPlateRules } from '@/views/battery/cellPlate/cellPlate.data'
import * as CellPlateApi from '@/api/battery/cellPlate'
//
import { CellCore,CellCoreRules } from '@/views/battery/cellCore/cellCore.data'
import * as CellCoreApi from '@/api/battery/cellCore'
//
import { CellProd,CellProdRules } from '@/views/battery/cellProd/cellProd.data'
import * as CellProdApi from '@/api/battery/cellProd'
//
import { CellPass,CellPassRules } from '@/views/battery/cellPass/cellPass.data'
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 } from './monomer.data'
import * as MonomerApi from '@/api/battery/monomer' import * as MonomerApi from '@/api/battery/monomer'
@ -100,7 +260,7 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddStaticBtn({hasPermi:'battery:monomer:update'}), // defaultButtons.defaultAddStaticBtn({hasPermi:'battery:monomer:update'}), //
defaultButtons.defaultAddBtn({hasPermi:'battery:monomer:create'}), // defaultButtons.defaultAddBtn({hasPermi:'battery:monomer:create'}), //
// defaultButtons.defaultImportBtn({hasPermi:'battery:cellDevice:import'}), // // defaultButtons.defaultImportBtn({hasPermi:'battery:cellDevice:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'battery:monomer:export'}), // defaultButtons.defaultExportBtn({hasPermi:'battery:monomer:export'}), //
@ -119,7 +279,8 @@ const HeadButttondata = [
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'addStatic'||val == 'addDynamic') { //
isStatic.value = val == 'addStatic'
openForm('create') openForm('create')
} else if (val == 'import') { // } else if (val == 'import') { //
handleImport() handleImport()
@ -155,6 +316,9 @@ const buttonTableClick = async (val, row) => {
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref() const basicFormRef = ref()
const openForm = (type: string, row?: any) => { const openForm = (type: string, row?: any) => {
if(tableObject.tableList.length>0){
row = tableObject.tableList[0]
}
basicFormRef.value.open(type, row) basicFormRef.value.open(type, row)
} }
@ -241,6 +405,167 @@ const searchFormClick = (searchData) => {
getList() // getList() //
} }
const tableFormDeviceRef = ref()
const tableDataDevice = ref([]) //线
const tableFormEnvRef = ref()
const tableDataEnv = ref([]) //线
const tableFormPlateRef = ref()
const tableDataPlate = ref([]) //
const tableFormCoreRef = ref()
const tableDataCore = ref([]) //
const tableFormProdRef = ref()
const tableDataProd = ref([]) //
const tableFormPassRef = ref()
const tableDataPass = ref([]) //
//
const searchTableRef = ref()
const isStatic = ref(true)
// 'Device' 'Env'
const addTableType = ref('')
const handleAddTable = (type)=>{
addTableType.value = type
let allSchemas = CellDevice.allSchemas
let apiPage = CellDeviceApi.getCellDevicePage
let tableTitle = ''
if(type == 'Device'){
//
tableTitle = '单体产线设备'
allSchemas = CellDevice.allSchemas
apiPage = CellDeviceApi.getCellDevicePage
}else if(type == 'Env'){
//
tableTitle = '单体产线环境'
allSchemas = CellEnv.allSchemas
apiPage = CellEnvApi.getCellEnvPage
}else if(type == 'Plate'){
//
tableTitle = '单体极片'
allSchemas = CellPlate.allSchemas
apiPage = CellPlateApi.getCellPlatePage
}else if(type == 'Core'){
//
tableTitle = '单体卷芯或叠芯'
allSchemas = CellCore.allSchemas
apiPage = CellCoreApi.getCellCorePage
}else if(type == 'Prod'){
//
tableTitle = '单体产品'
allSchemas = CellProd.allSchemas
apiPage = CellProdApi.getCellProdPage
}else if(type == 'Pass'){
//
tableTitle = '单体直通率'
allSchemas = CellPass.allSchemas
apiPage = CellPassApi.getCellPassPage
}
searchTableRef.value.open(
tableTitle,
allSchemas,
apiPage,
"hahaha",
"hahaha",
!isStatic.value,
'tableForm',
null,
{
//
// supplierCode:formRef.value.formRef.formModel.supplierCode,
// itemCode:formRef.value.formRef.formModel.itemCode
},
undefined,
false,
undefined
)
}
//
const handleDeleteTable = (item, index, type) => {
if(type == 'Device'){
//
tableDataDevice.value.splice(index, 1)
}else if(type == 'Env'){
//
tableDataEnv.value.splice(index, 1)
}else if(type == 'Plate'){
//
tableDataPlate.value.splice(index, 1)
}else if(type == 'Core'){
//
tableDataCore.value.splice(index, 1)
}else if(type == 'Prod'){
//
tableDataProd.value.splice(index, 1)
}else if(type == 'Pass'){
//
tableDataPass.value.splice(index, 1)
}
}
//
const tableSelectionDelete = (selection,type) => {
if(type == 'Device'){
//
tableDataDevice.value = tableDataDevice.value.filter(item => !selection.includes(item))
}else if(type == 'Env'){
//
tableDataEnv.value = tableDataEnv.value.filter(item => !selection.includes(item))
}else if(type == 'Plate'){
//
tableDataPlate.value = tableDataPlate.value.filter(item => !selection.includes(item))
}else if(type == 'Core'){
//
tableDataCore.value = tableDataCore.value.filter(item => !selection.includes(item))
}else if(type == 'Prod'){
//
tableDataProd.value = tableDataProd.value.filter(item => !selection.includes(item))
}else if(type == 'Pass'){
//
tableDataPass.value = tableDataPass.value.filter(item => !selection.includes(item))
}
}
//
// val row
const searchTableSuccess1 = (formField, searchField, val, type, row) => {
console.log('searchTableSuccess1',formField, searchField, val, type, row)
if (formField == 'hahaha') {
if(addTableType.value == 'Device'){
//
tableDataDevice.value = tableDataDevice.value.concat(val)
}else if(addTableType.value == 'Env'){
//
tableDataEnv.value = tableDataEnv.value.concat(val)
}else if(addTableType.value == 'Plate'){
//
tableDataPlate.value = tableDataPlate.value.concat(val)
}else if(addTableType.value == 'Core'){
//
tableDataCore.value = tableDataCore.value.concat(val)
}else if(addTableType.value == 'Prod'){
//
tableDataProd.value = tableDataProd.value.concat(val)
}else if(addTableType.value == 'Pass'){
//
tableDataPass.value = tableDataPass.value.concat(val)
}
}
}
const inpuFocus = ()=>{
}
const inputStringBlur = ()=>{
}
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()
@ -248,3 +573,50 @@ onMounted(async () => {
}) })
</script> </script>
<style lang="scss" scoped>
.marr20{
margin-top: 20px;
}
.table {
border: 1px solid #dedede;
border-radius: 8px;
padding: 10px;
width: calc(100% - 32px);
display: flex;
::v-deep(.el-table__body) {
padding: 10px 0px;
}
::v-deep(.el-table--default .el-table__cell) {
padding: 2px 0px;
border: none;
}
::v-deep(.el-table td.el-table__cell .el-form-item__content) {
display: flex !important;
align-items: center !important;
justify-content: center !important;
}
::v-deep(.el-table td.el-table__cell div) {
overflow: visible;
}
::v-deep(.el-icon) {
display: block;
}
}
button .button {
> div {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
> div {
margin-left: 6px;
text-decoration: underline;
color: #409eff;
}
}
}
</style>

Loading…
Cancel
Save