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
5a891f3b32
  1. 27
      src/api/qms/inspectionRequest/InspectionRequestPackage.ts
  2. 5
      src/api/qms/inspectionRequest/index.ts
  3. 186
      src/components/ListTable/src/ListTable.vue
  4. 36
      src/views/qms/inspection/inspectionRequest/index.vue
  5. 17
      src/views/qms/inspection/inspectionRequest/inspectionMain.data.ts

27
src/api/qms/inspectionRequest/InspectionRequestPackage.ts

@ -0,0 +1,27 @@
import request from '@/config/axios'
export interface InspectionRequestPackageVO {
number: string
packageCode: string
packageSpecificationCode: string
amount: string
measuringUnit: string
}
//查询包装列表
export const getInspectionRequestPackageList = async (id: number) => {
return await request.get({ url: `/qms/inspection-request-package/list?masterId=` + id })
}
// 新增检验申请
export const createInspectionRequestPackage = async (data: InspectionRequestPackageVO) => {
return await request.post({ url: `/qms/inspection-request-package/create`, data })
}
// 修改检验申请
export const updateInspectionRequestPackage = async (data: InspectionRequestPackageVO) => {
return await request.put({ url: `/qms/inspection-request-package/update`, data })
}
// 删除检验申请
export const deleteInspectionRequestPackage = async (id: number) => {
return await request.delete({ url: `/qms/inspection-request-package/delete?id=` + id })
}

5
src/api/qms/inspectionRequest/index.ts

@ -86,8 +86,3 @@ export const refusedInspectRequestMain = async (id) => {
export const handleInspectRequestMain = async (id) => {
return await request.put({ url: `/qms/inspection-request-main/handle?id=` + id })
}
//查询检验申请列表
export const getInspectionRequestPackageList = async (id: number) => {
return await request.get({ url: `/qms/inspection-request-package/list?masterId=` + id })
}

186
src/components/ListTable/src/ListTable.vue

@ -1,40 +1,202 @@
<template>
<div>
<Dialog v-model="isPackageShow" :title="dialogTitle" :width="width?width:'900px'" v-loading="packageLoading">
<Dialog
v-model="isPackageShow"
:title="dialogTitle"
:width="width ? width : '900px'"
v-loading="packageLoading"
>
<TableHead
:HeadButttondata="HeadButttondata"
:masterId="masterParmas.masterId"
@button-base-click="buttonBaseClick"
:allSchemas="detailAllSchemas"
/>
<Table
ref="searchTableRef"
:columns="columns"
:data="allList"
:reserveSelection="true"
row-key="id"
/>
>
<template #action="{ row }">
<ButtonBase
:Butttondata="butttondata"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
</Table>
</Dialog>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="formRef"
:rules="detailAllSchemasRules"
:formAllSchemas="detailAllSchemas"
:isBusiness="false"
:apiUpdate="apiUpdate"
:apiCreate="apiCreate"
:isDetail="true"
:detailData="detailData"
@success="submitForm"
/>
</div>
</template>
<script lang="ts" setup>
const isPackageShow = ref(false)
const packageLoading = ref(false)
const dialogTitle = ref()
import * as defaultButtons from '@/utils/disposition/defaultButtons'
const message = useMessage() //
const columns = ref()
const allList = ref()
const { t } = useI18n() //
//
const props = defineProps({
width: {
type: String,
required: false
},
//
detailAllSchemas: {
type: Object,
required: true,
default: null
},
//
detailAllSchemasRules: {
type: Object,
required: true,
default: null
},
// API
apiCreate: {
type: Function,
required: false,
default: null
},
// API
apiUpdate: {
type: Function,
required: false,
default: null
},
//
detailValidate: {
type: Function,
required: false,
default: null
},
//
detailButtonIsShowDelete: {
type: Boolean,
required: false,
default: true
},
//
list: {
type: Object,
required: true,
default: null
}
})
const isPackageShow = ref(false)
const packageLoading = ref(false)
const dialogTitle = ref()
const columns = ref()
const allList = ref([])
//
const masterParmas = ref({
masterId: '', //id
number: '' //
})
const openPackage = async (row?: any, titleName?: any,tableColumns?: any,list?: any) => {
//
const HeadButttondata = ref()
// -
const butttondata = ref()
const detailData = ref({})
const openPackage = async (row?: any, titleName?: any, tableColumns?: any, list?: any) => {
isPackageShow.value = true
detailData.value = row
masterParmas.value.masterId = row.masterId || row.id
masterParmas.value.number = row.number
if(detailData.value.status ==1){
HeadButttondata.value = [
defaultButtons.defaultAddBtn(null) //
]
butttondata.value =[
defaultButtons.mainListEditBtn(null), //
defaultButtons.mainListDeleteBtn(null) //
]
columns.value = tableColumns
}else{
columns.value = tableColumns.filter(item=>item.field != 'action')
}
if (titleName) {
dialogTitle.value = titleName
}
columns.value = tableColumns.filter(item => (item.field !== 'action'))
allList.value = list
}
defineExpose({ openPackage }) // open
//
const isShowMainButton = (row, val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
//
const buttonBaseClick = (val, item) => {
if (val == 'add') {
//
openForm('create')
}
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = async (type: string, row?: number) => {
formRef.value.open(type, row, masterParmas.value)
}
const submitForm = async (formType, data) => {
try {
// detailValidate
const rs = (await props.detailValidate) ? await props.detailValidate(data) : true
if (!rs) return
emit('ListTableSubmit', formType, data)
//
} finally {
formRef.value.formLoading = false
}
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'delete') {
//
handleDelete(row)
}
}
const handleDelete = async (row: any) => {
try {
//
await message.delConfirm()
//
emit('ListTableSubmit', 'detele', row)
} catch {}
}
const emit = defineEmits(['ListTableSubmit']) // success
defineExpose({ openPackage, formRef }) // open
watch(
() => props.list,
(newValue) => {
allList.value = newValue
formRef.value.dialogVisible = false
},
{
deep: true
}
)
</script>

36
src/views/qms/inspection/inspectionRequest/index.vue

@ -1,4 +1,5 @@
<template>
<div>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="InspectionMain.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
@ -45,24 +46,31 @@
/>
<!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="InspectionMain.allSchemas" />
<!-- <Detail ref="detailRef" :isBasic="true" :allSchemas="InspectionMain.allSchemas" /> -->
<!-- <Detail ref="detailRef" :isBasic="false" :allSchemas="InspectionMain.allSchemas"
:detailAllSchemas="InspectionRequestPackage.allSchemas" :detailAllSchemasRules="InspectionRequestPackageRules"
:apiPage="InspectionMainApi.getInspectionRequestPackageList"
/> -->
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/request/inspection-main/import" :importTemplateData="importTemplateData"
@success="importSuccess" />
<!-- 包装信息 -->
<ListTable ref="listTableRef" titleName="包装信息" />
<ListTable ref="listTableRef" titleName="包装信息" :allSchemas="InspectionMain.allSchemas"
:detailAllSchemas="InspectionRequestPackage.allSchemas" :detailAllSchemasRules="InspectionRequestPackageRules"
:list="list" @ListTableSubmit='ListTableSubmit'/>
</div>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { InspectionMain, InspectionMainRules,InspectionRequestPackage,InspectionRequestPackageRules } from './inspectionMain.data'
import * as InspectionMainApi from '@/api/qms/inspectionRequest'
import * as InspectionRequestPackageApi from '@/api/qms/inspectionRequest/InspectionRequestPackage'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import ListTable from '@/components/ListTable/src/ListTable.vue'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
// import { InspectionJobPackage} from '../inspectionJob/inspectionJobMain.data'
defineOptions({ name: 'InspectionMain' })
@ -157,12 +165,13 @@
defaultButtons.mainListSubmitBtn({ hide: isShowMainButton(row, ['1']), hasPermi: 'qms:inspection-request-main:submit' }), //
defaultButtons.mainListTurnDownBtn({ hide: isShowMainButton(row, ['2']), hasPermi: 'qms:inspection-request-main:refused' }), //
defaultButtons.mainListApproveBtn({ hide: isShowMainButton(row, ['2']), hasPermi: 'qms:inspection-request-main:agree' }), //
defaultButtons.mainListHandleBtn({ hide: isShowMainButton(row, ['3']), hasPermi: 'qms:inspection-request-main:handle' }), //
defaultButtons.mainListHandleBtn({ hide: isShowMainButton(row, ['3']), hasPermi: 'qms:inspection-request-main:handle' }), //
defaultButtons.mainListPackageBtn(null), //
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'qms:inspection-request-main:edit'}), //
]
}
const listTableRef = ref()
const list = ref([])
// -
const buttonTableClick = async (val, row) => {
if (val == 'mainClose') { //
@ -180,8 +189,9 @@ const listTableRef = ref()
} else if (val == 'edit') { //
openForm('update', row)
}else if (val == 'mainPackage') { //
const list = await InspectionMainApi.getInspectionRequestPackageList(row.id)
listTableRef.value.openPackage(row,'包装信息',InspectionRequestPackage.allSchemas.tableColumns,list)
list.value = await InspectionRequestPackageApi.getInspectionRequestPackageList(row.id)
// row.status = '1'
listTableRef.value.openPackage(row,'包装信息',InspectionRequestPackage.allSchemas.tableColumns)
}
}
@ -374,6 +384,20 @@ const handleAddTable = () => {
//
const handleDeleteTable = (item, index) => {
tableData.value.splice(index, 1)
}
const ListTableSubmit =async (formType,data)=>{
console.log(formType,data)
if (formType === 'create') {
await InspectionRequestPackageApi.createInspectionRequestPackage(data)
message.success(t('common.createSuccess'))
} else if(formType === 'updete') {
await InspectionRequestPackageApi.updateInspectionRequestPackage(data)
message.success(t('common.updateSuccess'))
}else {
await InspectionRequestPackageApi.deleteInspectionRequestPackage(data.id)
message.success(t('common.updateSuccess'))
}
list.value = await InspectionRequestPackageApi.getInspectionRequestPackageList(data.masterId)
}
/** 初始化 **/
onMounted(async () => {

17
src/views/qms/inspection/inspectionRequest/inspectionMain.data.ts

@ -433,7 +433,12 @@ export const InspectionRequestPackage = useCrudSchemas(reactive<CrudSchema[]>([
table:{
width:200
},
isTableForm:false
isTableForm:false,
form:{
componentProps:{
disabled:true
}
}
},
{
label: '包装号',
@ -487,4 +492,14 @@ export const InspectionRequestPackage = useCrudSchemas(reactive<CrudSchema[]>([
width:150
}
},
{
label: '操作',
field: 'action',
isForm: false,
isTable:true,
table: {
width: 120,
fixed: 'right'
}
}
]))

Loading…
Cancel
Save