Browse Source

检验记录筛选参数

hella_online_20240829
张立 7 months ago
parent
commit
b01120730d
  1. 155
      src/views/qms/inspectionRecord/index.vue

155
src/views/qms/inspectionRecord/index.vue

@ -1,27 +1,47 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="InspectionRecordMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search
:schema="InspectionRecordMain.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName" <TableHead
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" :HeadButttondata="HeadButttondata"
:allSchemas="InspectionRecordMain.allSchemas" /> @button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="InspectionRecordMain.allSchemas"
/>
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table v-clientTable :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{ <Table
v-clientTable
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
:pagination="{
total: tableObject.total total: tableObject.total
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" }"
v-model:sort="tableObject.sort"> v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #number="{ row }"> <template #number="{ row }">
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> <el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
<span>{{ row.number }}</span> <span>{{ row.number }}</span>
</el-button> </el-button>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase
:Butttondata="butttondata(row)"
@button-base-click="buttonTableClick($event, row)"
/>
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -46,27 +66,45 @@
:tableFormRules="InspectionJobPackageRules" :tableFormRules="InspectionJobPackageRules"
:rules="InspectionTemplateRules" :rules="InspectionTemplateRules"
@submitForm="submitFormExecute" @submitForm="submitFormExecute"
/> />
<Detail <Detail
ref="detailRef" :isBasic="false" :allSchemas="InspectionRecordMain.allSchemas" ref="detailRef"
:detailAllSchemas="InspectionRecordDetail.allSchemas" :detailAllSchemasRules="InspectionRecordDetailRules" :isBasic="false"
:allSchemas="InspectionRecordMain.allSchemas"
:detailAllSchemas="InspectionRecordDetail.allSchemas"
:detailAllSchemasRules="InspectionRecordDetailRules"
:apiCreate="InspectionRecordDetailApi.createInspectionRecordDetail" :apiCreate="InspectionRecordDetailApi.createInspectionRecordDetail"
:apiUpdate="InspectionRecordDetailApi.updateInspectionRecordDetail" :apiUpdate="InspectionRecordDetailApi.updateInspectionRecordDetail"
:apiPage="InspectionRecordDetailApi.getInspectionRecordDetailPage" :apiPage="InspectionRecordDetailApi.getInspectionRecordDetailPage"
:apiDelete="InspectionRecordDetailApi.deleteInspectionRecordDetail" @searchTableSuccessDetail="searchTableSuccessDetail" :apiDelete="InspectionRecordDetailApi.deleteInspectionRecordDetail"
:isShowAddBtn="false" :detailButtonIsShow="true" @searchTableSuccessDetail="searchTableSuccessDetail"
:isShowAddBtn="false"
:detailButtonIsShow="true"
/> />
<!-- 包装信息 --> <!-- 包装信息 -->
<ListTable ref="listTableRef" titleName="包装信息" :allSchemas="InspectionRecordMain.allSchemas" <ListTable
:detailAllSchemas="InspectionRecordPackage.allSchemas" :detailAllSchemasRules="InspectionRecordPackageRules" ref="listTableRef"
:list="list"/> titleName="包装信息"
:allSchemas="InspectionRecordMain.allSchemas"
:detailAllSchemas="InspectionRecordPackage.allSchemas"
:detailAllSchemasRules="InspectionRecordPackageRules"
:list="list"
/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { InspectionRecordMain, InspectionRecordMainRules, InspectionRecordDetail, InspectionRecordDetailRules,InspectionRecordPackage, InspectionRecordPackageRules,InspectionRecordUser,InspectionRecordUserRules} from './inspectionRecordMain.data' import {
InspectionRecordMain,
InspectionRecordMainRules,
InspectionRecordDetail,
InspectionRecordDetailRules,
InspectionRecordPackage,
InspectionRecordPackageRules,
InspectionRecordUser,
InspectionRecordUserRules
} from './inspectionRecordMain.data'
// import { InspectionJobPackage,InspectionJobPackageRules} from '../inspectionJob/inspectionJobMain.data' // import { InspectionJobPackage,InspectionJobPackageRules} from '../inspectionJob/inspectionJobMain.data'
import * as InspectionRecordPackageApi from '@/api/qms/inspectionRecord/InspectionRecordPackage/InspectionRecordPackage' import * as InspectionRecordPackageApi from '@/api/qms/inspectionRecord/InspectionRecordPackage/InspectionRecordPackage'
import * as InspectionRecordMainApi from '@/api/qms/inspectionRecord/inspectionRecordMain' import * as InspectionRecordMainApi from '@/api/qms/inspectionRecord/inspectionRecordMain'
@ -100,14 +138,14 @@ import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(InspectionRecordMain.allSchemas.tableColumns) const tableColumns = ref(InspectionRecordMain.allSchemas.tableColumns)
if (routeName.value == 'InspectRecordMain') { if (routeName.value == 'InspectRecordMain') {
tableColumns.value = tableColumns.value.filter(item=>{ tableColumns.value = tableColumns.value.filter((item) => {
return item.label != '操作' return item.label != '操作'
}) })
} }
// //
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
if (routeName.value == 'InspectRecordMain') { if (routeName.value == 'InspectRecordMain') {
tableColumns.value = val.filter(item=>{ tableColumns.value = val.filter((item) => {
return item.label != '操作' return item.label != '操作'
}) })
} else { } else {
@ -115,8 +153,6 @@ import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
} }
} }
// //
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: InspectionRecordMainApi.getInspectionRecordMainPage // getListApi: InspectionRecordMainApi.getInspectionRecordMainPage //
@ -130,29 +166,35 @@ import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
// defaultButtons.defaultExportBtn(null), // // defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null) //
] ]
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { // if (val == 'add') {
//
openForm('create') openForm('create')
} else if (val == 'import') { // } else if (val == 'import') {
//
handleImport() handleImport()
} else if (val == 'export') { // } else if (val == 'export') {
//
handleExport() handleExport()
} else if (val == 'refresh') { // } else if (val == 'refresh') {
//
getList() getList()
} else if (val == 'filtrate') { // } else if (val == 'filtrate') {
} else { // //
} else {
//
console.log('其他按钮', item) console.log('其他按钮', item)
} }
} }
const isShowMainButton = (row, val) => { const isShowMainButton = (row, val) => {
if(!row.callbackRequestNumber) {//callbackRequestNumber使 if (!row.callbackRequestNumber) {
return true; //callbackRequestNumber使
return true
} }
if (row.useDecision) { if (row.useDecision) {
return row.isPublished return row.isPublished
@ -178,15 +220,21 @@ const buttonBaseClick = (val, item) => {
const butttondata = (row) => { const butttondata = (row) => {
return [ return [
// defaultButtons.mainListOrderCOMPLETEBtn({ hide: isShowMainButton(row, ['INCOMPLETE']) }), // // defaultButtons.mainListOrderCOMPLETEBtn({ hide: isShowMainButton(row, ['INCOMPLETE']) }), //
defaultButtons.mainApplyDecisionBtn({ hide: isShowMainButton(row, null), hasPermi:'qms:inspection-recode-main:edit'}), // 使 defaultButtons.mainApplyDecisionBtn({
hide: isShowMainButton(row, null),
hasPermi: 'qms:inspection-recode-main:edit'
}), // 使
// defaultButtons.mainListDeleteBtn(null), // // defaultButtons.mainListDeleteBtn(null), //
defaultButtons.mainListOrderPubBtn({ hide: isShowMainButton(row, 'publish'), hasPermi:'qms:inspection-recode-main:pub'}), // defaultButtons.mainListOrderPubBtn({
hide: isShowMainButton(row, 'publish'),
hasPermi: 'qms:inspection-recode-main:pub'
}), //
defaultButtons.mainListPackageBtn({ hide: isShowPackageBtn(row, ['11']) }), // defaultButtons.mainListPackageBtn({ hide: isShowPackageBtn(row, ['11']) }), //
// defaultButtons.mainListJobExeBtn({ // defaultButtons.mainListJobExeBtn({
// hide:row.useDecision, // hide:row.useDecision,
// hasPermi: 'qms:inspection-recode-main:execute', // hasPermi: 'qms:inspection-recode-main:execute',
// }), // // }), //
defaultButtons.mainListEditBtn({ hide:isShowEditBtn(row,['11'])}), // defaultButtons.mainListEditBtn({ hide: isShowEditBtn(row, ['11']) }) //
] ]
} }
@ -196,25 +244,27 @@ const buttonBaseClick = (val, item) => {
// const useDecisionList = InspectionRecordMain.allSchemas.formSchema.filter(item=>item.field == "useDecision") // const useDecisionList = InspectionRecordMain.allSchemas.formSchema.filter(item=>item.field == "useDecision")
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'applyDecision') { // if (val == 'applyDecision') {
//
// 1使 // 1使
if (row.estimateCode == 1) { if (row.estimateCode == 1) {
InspectionRecordMain.allSchemas.formSchema.forEach((itemColumn) => { InspectionRecordMain.allSchemas.formSchema.forEach((itemColumn) => {
if(itemColumn.field == "useDecision"){ if (itemColumn.field == 'useDecision') {
itemColumn.componentProps.options=useDecisionList?.filter(item=>item.value==1) itemColumn.componentProps.options = useDecisionList?.filter((item) => item.value == 1)
} }
}) })
} else if (row.estimateCode == 2) { } else if (row.estimateCode == 2) {
InspectionRecordMain.allSchemas.formSchema.forEach((itemColumn) => { InspectionRecordMain.allSchemas.formSchema.forEach((itemColumn) => {
if(itemColumn.field == "useDecision"){ if (itemColumn.field == 'useDecision') {
itemColumn.componentProps.options=useDecisionList?.filter(item=>item.value!=1) itemColumn.componentProps.options = useDecisionList?.filter((item) => item.value != 1)
} }
}) })
} }
openUseForm('update', row) openUseForm('update', row)
}else if (val == 'mainPackage') { // } else if (val == 'mainPackage') {
//
list.value = await InspectionRecordPackageApi.getInspectionRecordPackageList(row.id) list.value = await InspectionRecordPackageApi.getInspectionRecordPackageList(row.id)
list.value.forEach(item=>{ list.value.forEach((item) => {
item.qualifiedAmount = item.qualifiedAmount ? item.qualifiedAmount : 0 item.qualifiedAmount = item.qualifiedAmount ? item.qualifiedAmount : 0
item.noQualifiedAmount = item.noQualifiedAmount ? item.noQualifiedAmount : 0 item.noQualifiedAmount = item.noQualifiedAmount ? item.noQualifiedAmount : 0
item.destroyAmount = item.destroyAmount ? item.destroyAmount : 0 item.destroyAmount = item.destroyAmount ? item.destroyAmount : 0
@ -222,11 +272,14 @@ const buttonBaseClick = (val, item) => {
}) })
// row.status = '1' // row.status = '1'
listTableRef.value.openPackage(row, '包装信息', InspectionRecordPackage.allSchemas.tableColumns) listTableRef.value.openPackage(row, '包装信息', InspectionRecordPackage.allSchemas.tableColumns)
}else if (val == 'delete') { // } else if (val == 'delete') {
//
handleDelete(row.id) handleDelete(row.id)
}else if (val == 'mainOrderPub') { // } else if (val == 'mainOrderPub') {
//
handleOrderPub(row) handleOrderPub(row)
}else if (val == 'edit') { // } else if (val == 'edit') {
//
// //
execute('execute', row) execute('execute', row)
} }
@ -275,7 +328,6 @@ const buttonBaseClick = (val, item) => {
} catch {} } catch {}
} }
// //
const execute = async (type: string, row?: number) => { const execute = async (type: string, row?: number) => {
@ -301,7 +353,7 @@ const execute = async (type: string, row?: number) => {
* tableForm方法 * tableForm方法
*/ */
const tableFormKeys = {} const tableFormKeys = {}
InspectionRecordDetail.allSchemas.tableFormColumns.forEach(item => { InspectionRecordDetail.allSchemas.tableFormColumns.forEach((item) => {
tableFormKeys[item.field] = item.default ? item.default : '' tableFormKeys[item.field] = item.default ? item.default : ''
}) })
const tableData = ref([]) const tableData = ref([])
@ -349,6 +401,14 @@ const submitFormExecute = async (formType, data) => {
// //
const searchFormClick = (searchData) => { const searchFormClick = (searchData) => {
let isHave = searchData?.filters?.some((item) => item.column == 'inspectionType')
if (!isHave) {
searchData.filters.push({
action: '!=',
column: 'inspectionType',
value: '11'
})
}
tableObject.params = { tableObject.params = {
isSearch: true, isSearch: true,
filters: searchData.filters filters: searchData.filters
@ -359,7 +419,8 @@ const submitFormExecute = async (formType, data) => {
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
tableObject.params = { tableObject.params = {
available: true available: true,
excludeInspectionType: '11'
} }
getList() getList()
}) })

Loading…
Cancel
Save