Browse Source

BUG修改

hella_online_20240816
parent
commit
5b24a6d958
  1. 73
      src/api/qms/inspectionQ3/index.ts
  2. 421
      src/views/qms/inspectionQ3/index.vue
  3. 546
      src/views/qms/inspectionQ3/inspectionQ3.data.ts
  4. 478
      src/views/qms/inspectionQThree/index.vue
  5. 618
      src/views/qms/inspectionQThree/inspectionQ3.data.ts
  6. 106
      src/views/wms/inventoryjobManage/scrap/scrapRequestMain/scrapRequestMain.data.ts

73
src/api/qms/inspectionQ3/index.ts

@ -1,73 +0,0 @@
import request from '@/config/axios'
export interface Q3VO {
id: number
number: string
q1Number: string
itemCode: string
qty: number
code: string
uom: string
desc: string
defectLocation: string
defectType: string
problemReason: string
priority: number
responUser: string
amount: number
costCode: string
handleTime: Date
status: string
available: string
deletionTime: Date
deleterId: string
extraProperties: string
concurrencyStamp: number
siteId: string
}
// 查询Q3通知单列表
export const getQ3Page = async (params) => {
if (params.isSearch) {
delete params.isSearch
const data = { ...params }
return await request.post({ url: '/qms/inspectionQ3/senior', data })
} else {
return await request.get({ url: `/qms/inspectionQ3/page`, params })
}
}
// 查询Q3通知单详情
export const getQ3 = async (id: number) => {
return await request.get({ url: `/qms/inspectionQ3/get?id=` + id })
}
// 新增Q3通知单
export const createQ3 = async (data: Q3VO) => {
return await request.post({ url: `/qms/inspectionQ3/create`, data })
}
// 修改Q3通知单
export const updateQ3 = async (data: Q3VO) => {
return await request.put({ url: `/qms/inspectionQ3/update`, data })
}
// 删除Q3通知单
export const deleteQ3 = async (id: number) => {
return await request.delete({ url: `/qms/inspectionQ3/delete?id=` + id })
}
// 导出Q3通知单 Excel
export const exportQ3 = async (params) => {
return await request.download({ url: `/qms/inspectionQ3/export-excel`, params })
}
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/qms/inspectionQ3/get-import-template' })
}
// 完成
export const finishQ3 = async (id: number) => {
return await request.get({ url: `/qms/inspectionQ3/finish?id=` + id })
}

421
src/views/qms/inspectionQ3/index.vue

@ -1,11 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search <Search :schema="[...InspectionQ3Main.allSchemas.searchSchema,...InspectionQ3Detail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" />
:schema="Q3.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
@ -15,12 +11,13 @@
:routeName="routeName" :routeName="routeName"
@updataTableColumns="updataTableColumns" @updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick" @searchFormClick="searchFormClick"
:allSchemas="Q3.allSchemas" :allSchemas="InspectionQ3Main.allSchemas"
:detailAllSchemas="InspectionQ3Detail.allSchemas"
/> />
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<Table <Table v-clientTable
:columns="tableColumns" :columns="tableColumns"
:data="tableObject.tableList" :data="tableObject.tableList"
:loading="tableObject.loading" :loading="tableObject.loading"
@ -32,60 +29,79 @@
v-model:sort="tableObject.sort" 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,$index }">
<ButtonBase <ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" />
:Butttondata="butttondata(row)"
@button-base-click="buttonTableClick($event, row)"
/>
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm
ref="basicFormRef" ref="formRef"
@success="formsSuccess" :isOpenSearchTable="true"
:rules="Q3Rules" fieldTableColumn="itemCode"
:formAllSchemas="Q3.allSchemas" @success="getList"
:apiUpdate="Q3Api.updateQ3" :rules="InspectionQ3MainRules"
:apiCreate="Q3Api.createQ3" :formAllSchemas="InspectionQ3Main.allSchemas"
:tableAllSchemas="InspectionQ3Detail.allSchemas"
:tableFormRules="InspectionQ3DetailRules"
:tableData="tableData"
:apiUpdate="InspectionQ3MainApi.updateInspectionQ3Main"
:apiCreate="InspectionQ3MainApi.createInspectionQ3Main"
:isBusiness="true"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
:isShowReduceButtonSelection="true"
@tableSelectionDelete="tableSelectionDelete"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
:isBusiness="false" @submitForm="submitForm"
@onChange="onChange" @onChange="onChange"
/> @clearSearchInput="onChange"
:sumFormDataByTableCustom ="(formRef,formModel,tableData)=>{
tableData.forEach(item=>{
item.qty = item.countQty*item.packQty
})
}"
>
<!-- <template #default="{row}">
<el-input-number disabled v-model="row.qty"></el-input-number>
</template> -->
</BasicForm>
<!-- 详情 --> <!-- 详情 -->
<Detail ref="detailRef" :isBasic="true" :allSchemas="Q3.allSchemas" /> <Detail
ref="detailRef"
<!-- 导入 --> :isBasic="false"
<ImportForm :allSchemas="InspectionQ3Main.allSchemas"
ref="importFormRef" :detailAllSchemas="InspectionQ3Detail.allSchemas"
url="/basic/Q3/import" :detailAllSchemasRules="InspectionQ3DetailRules"
:importTemplateData="importTemplateData" :apiCreate="InspectionQ3DetailApi.createInspectionQ3Detail"
@success="importSuccess" :apiUpdate="InspectionQ3DetailApi.updateInspectionQ3Detail"
:apiPage="InspectionQ3DetailApi.getInspectionQ3DetailPage"
:apiDelete="InspectionQ3DetailApi.deleteInspectionQ3Detail"
@searchTableSuccessDetail="searchTableSuccessDetail"
:detailValidate="detailValidate"
/> />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import download from '@/utils/download' import download from '@/utils/download'
import { Q3, Q3Rules } from './inspectionQ3.data' import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import * as Q3Api from '@/api/qms/inspectionQ3' import { InspectionQ3Main,InspectionQ3MainRules,InspectionQ3Detail,InspectionQ3DetailRules } from './inspectionQ3.data'
import * as InspectionQ3MainApi from '@/api/qms/inspectionQ3/inspectionQ3Main'
import * as InspectionQ3DetailApi from '@/api/qms/inspectionQ3/inspectionQ3Detail'
import * as defaultButtons from '@/utils/disposition/defaultButtons' import * as defaultButtons from '@/utils/disposition/defaultButtons'
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 * as ProductionlineitemApi from '@/api/wms/productionlineitem' import * as ProductionlineitemApi from '@/api/wms/productionlineitem'
import * as StdcostpriceApi from '@/api/wms/stdcostprice' import * as StdcostpriceApi from '@/api/wms/stdcostprice'
import { formatDate } from '@/utils/formatTime' import { formatDate } from '@/utils/formatTime'
import { useUserStore } from '@/store/modules/user' //
const userStore = useUserStore() defineOptions({ name: 'InspectionQ3Main' })
defineOptions({ name: 'InspectionQ3' })
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
@ -93,46 +109,68 @@ const { t } = useI18n() // 国际化
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref(Q3.allSchemas.tableColumns) const tableColumns = ref([...InspectionQ3Main.allSchemas.tableColumns,...InspectionQ3Detail.allSchemas.tableMainColumns])
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
// //
const priceObj = ref() const priceObj = ref()
const searchTableSuccess = (formField, searchField, val, formRef) => { const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
nextTick(async() => { nextTick(async() => {
const setV = {} const setV = {}
if (type == 'tableForm') {
//
if (formField == 'itemCode') { if (formField == 'itemCode') {
console.log(val) val.forEach(item=>{
setV['uom'] = val[0]['uom'] let tableForm = JSON.parse(JSON.stringify(tableFormKeys))
console.log(formRef.formModel.qty) if(tableData.value.find(item1=>item1['itemCode'] == item['itemCode'])) return
// let res = await ProductionlineitemApi.selectItemCodeToProductionLineCode(val[0].code) const newRow = JSON.parse(JSON.stringify({...tableForm,...item}))
ProductionlineitemApi.selectItemCodeToProductionLineCode(val[0].code).then((res) => { newRow['itemCode'] = item['code']
console.log(res) newRow['uom'] = item['uom']
if (res?.length > 0) { tableData.value.push(newRow)
formRef.formModel.defectLocation = res[0].productionLineCode
Q3.allSchemas.formSchema.forEach(item=>{
if (item.field == 'defectLocation') {
item.componentProps.options = res
}
})
}
})
const params = {
by: "ASC",
filters: [{column: "itemCode", action: "==", value: val[0].code}],
pageNo: 1,
pageSize: 500,
sort: ""
}
params.isSearch = true
StdcostpriceApi.getStdcostpricePage(params).then((res) => {
if (res.list?.length > 0) {
priceObj.value = res.list[0]
formRef.setValues({
amount: (parseFloat(formRef.formModel.qty) * parseFloat(priceObj.value.price)).toFixed(6)
}) })
}
})
// row['uom'] = val[0]['uom']
// console.log(formRef.formModel.qty)
// // let res = await ProductionlineitemApi.selectItemCodeToProductionLineCode(val[0].code)
// ProductionlineitemApi.selectItemCodeToProductionLineCode(val[0].code).then((res) => {
// console.log(res)
// if (res?.length > 0) {
// formRef.formModel.defectLocation = res[0].productionLineCode
// InspectionQ3Detail.allSchemas.formSchema.forEach(item=>{
// if (item.field == 'defectLocation') {
// item.componentProps.options = res
// }
// })
// }
// })
// const params = {
// by: "ASC",
// filters: [{column: "itemCode", action: "==", value: val[0].code}],
// pageNo: 1,
// pageSize: 500,
// sort: ""
// }
// params.isSearch = true
// StdcostpriceApi.getStdcostpricePage(params).then((res) => {
// if (res.list?.length > 0) {
// priceObj.value = res.list[0]
// formRef.setValues({
// amount: (parseFloat(formRef.formModel.qty) * parseFloat(priceObj.value.price)).toFixed(6)
// })
// }
// })
}
if (formField == 'costCode') {
console.log(11111)
row['costCode'] = val[0]['costcentreCode']
} }
if (formField == 'q1Number') { if (formField == 'q1Number') {
//Q1 //Q1
@ -142,7 +180,9 @@ const searchTableSuccess = (formField, searchField, val, formRef) => {
}) })
setV[formField] = list.join(',') setV[formField] = list.join(',')
formRef.setValues(setV) formRef.setValues(setV)
}
} else { } else {
const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
formRef.setValues(setV) formRef.setValues(setV)
} }
@ -150,17 +190,25 @@ const searchTableSuccess = (formField, searchField, val, formRef) => {
} }
const onChange =(field,e)=>{ const onChange =(field,e)=>{
if (field == 'qty') { if (field == 'qty') {
basicFormRef.value.formRef.formModel.amount = (parseFloat( basicFormRef.value.formRef.formModel.qty) * parseFloat( priceObj.value.price)).toFixed(6) formRef.value.formRef.formModel.amount = (parseFloat( formRef.value.formRef.formModel.qty) * parseFloat( priceObj.value.price)).toFixed(6)
} }
} }
//
// const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
const updataTableColumns = (val) => { nextTick(() => {
tableColumns.value = val const setV = {}
if (formField == 'itemCode') {
setV['itemCode'] = val[0]['code']
setV['uom'] = val[0]['uom']
} else {
setV[formField] = val[0][searchField]
}
formRef.setValues(setV)
})
} }
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: Q3Api.getQ3Page // getListApi: InspectionQ3DetailApi.getInspectionQ3DetailPage //
}) })
// //
@ -168,44 +216,28 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({ hasPermi: 'qms:Q3:create' }), // defaultButtons.defaultAddBtn({hasPermi:'qms:inspection-Q3-main:create'}), //
defaultButtons.defaultImportBtn({ hasPermi: 'qms:Q3:import' }), // defaultButtons.defaultExportBtn({hasPermi:'qms:inspection-Q3-main:export'}), //
defaultButtons.defaultExportBtn({ hasPermi: 'qms:Q3:export' }), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null) // defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
] ]
// //
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 == 'export') { //
//
handleImport()
} 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 (val.indexOf(row.status) > -1) { if (val.indexOf(row.status) > -1) {
return false return false
@ -215,23 +247,29 @@ const isShowMainButton = (row, val) => {
} }
// - // -
const butttondata = (row) => { const butttondata = (row,$index) => {
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1
if(findIndex>-1&&findIndex<$index){
return []
}
return [ return [
defaultButtons.mainListEditBtn({ defaultButtons.mainListEditBtn({
hide: isShowMainButton(row, ['0']), hide: isShowMainButton(row, ['0']),
hasPermi: 'qms:Q3:update' hasPermi: 'qms:inspection-Q3-main:update'
}), // }), //
defaultButtons.mainListDeleteBtn({ defaultButtons.mainListDeleteBtn({
hide: isShowMainButton(row, ['0']), hide: isShowMainButton(row, ['0']),
hasPermi: 'qms:Q3:delete' hasPermi: 'qms:inspection-Q3-main:delete'
}), // }), //
defaultButtons.mainListFinishBtn({ defaultButtons.mainListFinishBtn({
hide: isShowMainButton(row, ['0']), hide: isShowMainButton(row, ['0']),
hasPermi: 'qms:Q3:finish' hasPermi: 'qms:inspection-Q3-main:finish'
}) // }) //
] ]
} }
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { if (val == 'edit') {
@ -241,14 +279,14 @@ const buttonTableClick = async (val, row) => {
// //
handleDelete(row.id) handleDelete(row.id)
} else if (val == 'finish') { } else if (val == 'finish') {
// //
handleFinish(row.id) handleFinish(row.id)
} }
} }
const handleFinish = async (id: number) => { const handleFinish = async (id: number) => {
try { try {
await Q3Api.finishQ3(id) await InspectionQ3MainApi.finishInspectionQ3Main(id)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
// //
await getList() await getList()
@ -256,63 +294,38 @@ const handleFinish = async (id: number) => {
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref() const formRef = ref()
const openForm = (type: string, row?: any) => { const openForm =async (type: string, row?: number) => {
basicFormRef.value.open(type, row) tableData.value = [] //
if (type == 'create') { //
nextTick(() => { if (type == 'update') {
basicFormRef.value.formRef.setValues({ // tableform
handleTime: new Date().getTime(), InspectionQ3Main.allSchemas.formSchema.map(itemColumns => {
priority: '3' if(itemColumns.field == 'workshopCode') {
}) itemColumns.componentProps.isSearchList = false
}) itemColumns.componentProps.disabled = true
} }
}
// form
const formsSuccess = async (formType, data) => {
data.responUser = userStore.getUser.id
var isHave = Q3.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.qty == 0) {
message.error('数量不能为0')
return
}
if (data.amount == 0) {
message.error('金额不能为0')
return
}
if (data.activeTime == 0) data.activeTime = null
if (data.expireTime == 0) data.expireTime = null
try {
basicFormRef.value.formLoading = true
if (formType === 'create') {
await Q3Api.createQ3(data)
message.success(t('common.createSuccess'))
} else { } else {
await Q3Api.updateQ3(data) // tableform
message.success(t('common.updateSuccess')) InspectionQ3Main.allSchemas.formSchema.map(itemColumns => {
if(itemColumns.field == 'workshopCode') {
itemColumns.componentProps.isSearchList = true
itemColumns.componentProps.disabled = false
} }
basicFormRef.value.dialogVisible = false })
basicFormRef.value.formLoading = false
getList()
} finally {
basicFormRef.value.formLoading = false
} }
formRef.value.open(type, row)
} }
//
const { wsCache } = useCache()
/** 详情操作 */ /** 详情操作 */
const detailRef = ref() const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => { const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicQ3') const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode))
detailRef.value.openDetail(row, titleName, titleValue,"requestIssueMain")
} }
/** 删除按钮操作 */ /** 删除按钮操作 */
@ -320,11 +333,13 @@ const handleDelete = async (id: number) => {
try { try {
// //
await message.delConfirm() await message.delConfirm()
tableObject.loading = true
// //
await Q3Api.deleteQ3(id) await InspectionQ3MainApi.deleteInspectionQ3Main(id)
tableObject.loading = false
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
// //
await getList() buttonBaseClick('refresh',null)
} catch {} } catch {}
} }
@ -336,25 +351,112 @@ const handleExport = async () => {
await message.exportConfirm() await message.exportConfirm()
// //
exportLoading.value = true exportLoading.value = true
const excelTitle = ref(route.meta.title) const data = await InspectionQ3MainApi.exportInspectionQ3Main(tableObject.params)
const data = await Q3Api.exportQ3(tableObject.params) download.excel(data, `${route.meta.title}】【${formatDate(new Date())}】.xlsx`)
download.excel(data, `${excelTitle.value}】【${formatDate(new Date())}】.xlsx`)
} catch { } catch {
} finally { } finally {
exportLoading.value = false exportLoading.value = false
} }
} }
/**
* tableForm方法
*/
const tableFormKeys = {}
InspectionQ3Detail.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
//
const handleAddTable = () => {
// 线
let tableForm = JSON.parse(JSON.stringify(tableFormKeys))
if (tableData.value.length > 0) {
// tableForm.productionLineCode = tableData.value[0].productionLineCode
// tableForm.workStationCode = tableData.value[0].workStationCode
}
tableData.value.push(tableForm)
}
//
const handleDeleteTable = (item, index) => {
let itemIndex = tableData.value.indexOf(item)
if(itemIndex>-1){
tableData.value.splice(itemIndex, 1)
}
}
const tableSelectionDelete = (selection) => {
tableData.value = tableData.value.filter(item => !selection.includes(item))
}
//
const submitForm = async (formType, submitData) => {
let data = {...submitData}
if(data.masterId){
data.id = data.masterId
}
data.subList = tableData.value //
if(tableData.value.find(item => (item.qty <= 0))) {
message.warning('数量必须大于0')
formRef.value.formLoading = false
return
}
// 线
// if (tableData.value.length > 0) {
// let productionLineCode = tableData.value[0].productionLineCode
// let workStationCode = tableData.value[0].workStationCode
// for(var i=0;i<tableData.value.length;i++) {
// if(productionLineCode !== tableData.value[i].productionLineCode){
// message.warning('线')
// formRef.value.formLoading = false
// return;
// }
// if(workStationCode !== tableData.value[i].workStationCode){
// message.warning('')
// formRef.value.formLoading = false
// return;
// }
// }
// }
formRef.value.formLoading = true
try {
if (formType === 'create') {
await InspectionQ3MainApi.createInspectionQ3Main(data)
message.success(t('common.createSuccess'))
} else {
await InspectionQ3MainApi.updateInspectionQ3Main(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
if (formType === 'create') {
getList()
}else{
buttonBaseClick('refresh',null)
}
} finally {
formRef.value.formLoading = false
}
}
// /
const detailValidate = async (data) => {
// let rs = false
// TODO: /线
return true
}
/** 导入 */ /** 导入 */
const importFormRef = ref() const importFormRef = ref()
const handleImport = () => { const handleImport = () => {
importFormRef.value.open() importFormRef.value.open()
} }
// //
const importTemplateData = reactive({ const importTemplateData = reactive({
templateUrl: '', templateUrl: '',
templateTitle: `${route.meta.title}】导入模版.xlsx` templateTitle: `${route.meta.title}】导入模版.xlsx`
}) })
// //
const importSuccess = () => { const importSuccess = () => {
getList() getList()
@ -372,6 +474,5 @@ const searchFormClick = (searchData) => {
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
getList() getList()
importTemplateData.templateUrl = await Q3Api.importTemplate()
}) })
</script> </script>

546
src/views/qms/inspectionQ3/inspectionQ3.data.ts

@ -4,39 +4,35 @@ import { dateFormatter } from '@/utils/formatTime'
import * as InspectionQ1Api from '@/api/qms/inspectionQ1' import * as InspectionQ1Api from '@/api/qms/inspectionQ1'
import { Q1 } from '@/views/qms/inspectionQ1/inspectionQ1.data' import { Q1 } from '@/views/qms/inspectionQ1/inspectionQ1.data'
import * as ItembasicApi from '@/api/wms/itembasic'
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
import * as QadCostcentreApi from '@/api/wms/qadCostcentre' import * as QadCostcentreApi from '@/api/wms/qadCostcentre'
import { QadCostcentre } from '@/views/wms/basicDataManage/subject/qadCostcentre/qadCostcentre.data' import { QadCostcentre } from '@/views/wms/basicDataManage/subject/qadCostcentre/qadCostcentre.data'
import * as ItembasicApi from '@/api/wms/itembasic' const { t } = useI18n() // 国际化
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值
const queryParams = {
pageSize: 10,
pageNo: 1,
code: 'IssueRequest'
}
// 获取当前操作人的部门
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { TableColumn } from '@/types/table'
import { fa } from 'element-plus/es/locale'
const userStore = useUserStore() const userStore = useUserStore()
const userDept = userStore.userSelfInfo.dept
// id 转str 否则form回显匹配不到
userDept.id = userDept.id.toString()
const userDeptArray: any = [userDept]
// 表单校验 /**
export const Q3Rules = reactive({ * @returns {Array}
number: [required], */
itemCode: [required], export const InspectionQ3Main = useCrudSchemas(
qty: [required],
code: [required],
defectLocation: [required],
defectType: [
{ required: true, message: '缺陷类型不能为空', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
problemReason: [
{ required: true, message: '问题原因不能为空', trigger: 'blur' },
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
],
priority: [required],
amount: [required],
costCode: [required],
handleTime: [required],
available: [required],
concurrencyStamp: [required]
})
export const Q3 = useCrudSchemas(
reactive<CrudSchema[]>([ reactive<CrudSchema[]>([
{ {
label: '通知单号', label: '通知单号',
@ -53,6 +49,7 @@ export const Q3 = useCrudSchemas(
label: 'Q1通知单号', label: 'Q1通知单号',
field: 'q1Number', field: 'q1Number',
sort: 'custom', sort: 'custom',
isSearch: true,
table: { table: {
width: 150 width: 150
}, },
@ -90,8 +87,201 @@ export const Q3 = useCrudSchemas(
} }
] // 失去焦点校验参数 ] // 失去焦点校验参数
} }
}
},
{
label: '负责用户',
field: 'responUser',
sort: 'custom',
isSearch: false,
table: {
width: 120
},
form: {
componentProps: {
value: userStore.getUser.nickname,
disabled: true
}
}
},
{
label: '优先级',
field: 'priority',
sort: 'custom',
dictType: DICT_TYPE.QUALITY_NOTIFICATION_PRIORITY,
dictClass: 'string',
isSearch: false,
isTable: false,
tableForm: {
type: 'Select'
}
},
{
label: '处理时间',
field: 'handleTime',
isSearch: false,
table: {
width: 180
},
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
}
}
},
{
label: '汇总金额',
field: 'summaryAmount',
sort: 'custom',
isSearch: false,
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 0,
precision: 2
}
}
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
isSearch: true,
isForm: false
},
{
label: '数量',
field: 'qty',
sort: 'custom',
isSearch: false,
isForm: false
},
{
label: '计量单位',
field: 'uom',
sort: 'custom',
isSearch: false,
isForm: false
},
{
label: '单价',
field: 'price',
sort: 'custom',
isSearch: false,
isForm: false
},
{
label: '金额',
field: 'amount',
sort: 'custom',
isTable: true,
isForm: false,
isSearch: false,
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 0,
precision: 2
}
}
},
{
label: '成本中心代码',
field: 'costCode',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择成本中心', // 输入框占位文本
searchField: 'costcentreCode', // 查询弹窗赋值字段
searchTitle: '成本中心信息', // 查询弹窗标题
searchAllSchemas: QadCostcentre.allSchemas, // 查询弹窗所需类
searchPage: QadCostcentreApi.getQadCostcentrePage, // 查询弹窗所需分页方法
searchCondition: [
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
],
verificationParams: [
{
key: 'costcentreCode',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true
}
] // 失去焦点校验参数
}
}
},
{
label: '缺陷编码',
field: 'defectCode',
sort: 'custom',
isSearch: false,
isForm: false
}, },
isSearch: true {
label: '缺陷位置',
field: 'defectLocation',
sort: 'custom',
isSearch: false,
isForm: false
},
{
label: '缺陷类型',
field: 'defectType',
sort: 'custom',
isSearch: false,
isForm: false,
form: {
component: 'Select'
}
},
{
label: '问题原因',
field: 'problemReason',
sort: 'custom',
isSearch: false,
isForm: false
},
{
label: '描述',
field: 'desc',
sort: 'custom',
isSearch: false,
table: {
width: '150'
},
form: {
component: 'Input',
componentProps: {
type: 'textarea'
}
}
}, },
{ {
label: '状态', label: '状态',
@ -99,8 +289,8 @@ export const Q3 = useCrudSchemas(
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.PUBLISHE_STATUS, dictType: DICT_TYPE.PUBLISHE_STATUS,
dictClass: 'string', dictClass: 'string',
isForm: false,
isSearch: false, isSearch: false,
isForm: false,
tableForm: { tableForm: {
type: 'Select', type: 'Select',
disabled: true disabled: true
@ -112,16 +302,96 @@ export const Q3 = useCrudSchemas(
} }
}, },
{ {
label: '物料代码', label: '是否可用',
field: 'itemCode', field: 'available',
sort: 'custom', sort: 'custom',
isSearch: false,
isForm: false,
isTable: false,
isDetail: false
},
{
label: '创建时间',
field: 'createTime',
isTable: true,
isForm: false,
table: {
width: 180
},
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
}
},
isSearch: true, isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
}
},
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 230,
fixed: 'right'
}
}
])
)
export const InspectionQ3MainRules = reactive({
workshopCode: [{ required: true, message: '请选择车间代码', trigger: 'change' }],
productionLineCode: [{ required: true, message: '请选择生产线代码', trigger: 'change' }],
// fromWarehouseCode: [
// { required: true, message: '请选择从仓库代码', trigger: 'change' }
// ],
// dueTime: [
// { required: true, message: '请选择截止时间', trigger: 'change' }
// ],
remark: [{ max: 50, message: '不得超过50个字符', trigger: 'blur' }]
})
/**
* @returns {Array}
*/
export const InspectionQ3Detail = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '通知单号',
field: 'number',
sort: 'custom',
isSearch: false,
isTable: false,
isTableForm: false
},
{
label: '物料号',
field: 'itemCode',
sort: 'custom',
isTable: false,
isSearch: false,
table: { table: {
width: 150 width: 150
}, },
tableForm: { tableForm: {
enterSearch: true, isInpuFocusShow: false,
isInpuFocusShow: true, disabled:true,
searchListPlaceholder: '请选择物料代码', // 输入框占位文本 searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段 searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题 searchTitle: '物料基础信息', // 查询弹窗标题
@ -134,6 +404,8 @@ export const Q3 = useCrudSchemas(
isMainValue: false isMainValue: false
} }
], ],
isShowTableFormSearch: true, //tableForm下方是否出现输入框
isRepeat: true,//tableForm下方输入框是否可以重复添加该条数据
verificationParams: [ verificationParams: [
{ {
key: 'code', key: 'code',
@ -179,18 +451,14 @@ export const Q3 = useCrudSchemas(
label: '数量', label: '数量',
field: 'qty', field: 'qty',
sort: 'custom', sort: 'custom',
isTable: true,
isSearch: false, isSearch: false,
table: { isTable: false,
width: 150
}, tableForm: {
form: { type: 'InputNumber',
component: 'InputNumber',
componentProps: {
min: 0, min: 0,
precision: 2 precision: 2
} }
}
}, },
{ {
label: '单位', label: '单位',
@ -199,7 +467,7 @@ export const Q3 = useCrudSchemas(
dictType: DICT_TYPE.UOM, dictType: DICT_TYPE.UOM,
dictClass: 'string', dictClass: 'string',
isSearch: false, isSearch: false,
isTable: true, isTable: false,
tableForm: { tableForm: {
type: 'Select', type: 'Select',
disabled: true disabled: true
@ -211,86 +479,16 @@ export const Q3 = useCrudSchemas(
} }
}, },
{ {
label: '编码', label: '单价',
field: 'code', field: 'price',
sort: 'custom', sort: 'custom',
dictType: DICT_TYPE.QMS_Q3_CODE,
dictClass: 'string',
isSearch: true,
isTable: true,
tableForm: {
type: 'Select'
}
},
{
label: '缺陷位置',
field: 'defectLocation',
sort: 'custom',
dictClass: 'string',
isSearch: false,
isTable: false,
form: {
component: 'Select',
componentProps: {
options: [],
optionsAlias: {
labelField: 'productionLineName',
valueField: 'productionLineCode'
},
filterable: true,
}
}
},
{
label: '缺陷类型',
field: 'defectType',
sort: 'custom',
isSearch: false,
isTable: false,
table: {
width: '150'
},
form: {
component: 'Input'
}
},
{
label: '问题原因',
field: 'problemReason',
sort: 'custom',
isSearch: false,
isTable: false, isTable: false,
table: {
width: '150'
},
form: {
component: 'Input'
}
},
{
label: '优先级',
field: 'priority',
sort: 'custom',
dictType: DICT_TYPE.QUALITY_NOTIFICATION_PRIORITY,
dictClass: 'string',
isSearch: false, isSearch: false,
isTable: false,
tableForm: { tableForm: {
type: 'Select' disabled: true
}
},
{
label: '负责用户',
field: 'responUser',
sort: 'custom',
isSearch: false,
isForm: true,
table: {
width: 120
}, },
form: { form: {
componentProps: { componentProps: {
value: userStore.getUser.nickname,
disabled: true disabled: true
} }
} }
@ -299,16 +497,15 @@ export const Q3 = useCrudSchemas(
label: '金额', label: '金额',
field: 'amount', field: 'amount',
sort: 'custom', sort: 'custom',
isTable: false,
isSearch: false, isSearch: false,
table: { isTable: false,
width: 150 isForm: false,
tableForm: {
disabled: true
}, },
form: { form: {
component: 'InputNumber',
componentProps: { componentProps: {
min: 0, disabled: true
precision: 2
} }
} }
}, },
@ -319,11 +516,8 @@ export const Q3 = useCrudSchemas(
isSearch: false, isSearch: false,
isTable: false, isTable: false,
isForm: true, isForm: true,
form: { tableForm: {
// labelMessage: '信息提示说明!!!', isInpuFocusShow: true,
componentProps: {
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择成本中心', // 输入框占位文本 searchListPlaceholder: '请选择成本中心', // 输入框占位文本
searchField: 'costcentreCode', // 查询弹窗赋值字段 searchField: 'costcentreCode', // 查询弹窗赋值字段
searchTitle: '成本中心信息', // 查询弹窗标题 searchTitle: '成本中心信息', // 查询弹窗标题
@ -347,94 +541,78 @@ export const Q3 = useCrudSchemas(
} }
] // 失去焦点校验参数 ] // 失去焦点校验参数
} }
},
{
label: '缺陷编码',
field: 'defectCode',
sort: 'custom',
dictType: DICT_TYPE.QMS_Q3_CODE,
dictClass: 'string',
isSearch: true,
isTable: true,
tableForm: {
type: 'Select'
} }
}, },
{ {
label: '处理时间', label: '缺陷位置',
field: 'handleTime', field: 'defectLocation',
sort: 'custom',
dictClass: 'string',
isSearch: false, isSearch: false,
isTable: false, isTable: false,
table: {
width: 180
},
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
form: { form: {
component: 'DatePicker', component: 'Select',
componentProps: { componentProps: {
style: { width: '100%' }, options: [],
type: 'datetime', optionsAlias: {
dateFormat: 'YYYY-MM-DD HH:mm:ss', labelField: 'productionLineName',
valueFormat: 'x' valueField: 'productionLineCode'
},
filterable: true
} }
} }
}, },
{ {
label: '描述', label: '缺陷类型',
field: 'desc', field: 'defectType',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: false,
table: { isTable: false,
width: '150'
},
form: { form: {
component: 'Input', component: 'Select'
componentProps: {
type: 'textarea'
}
} }
}, },
{ {
label: '是否可用', label: '问题原因',
field: 'available', field: 'problemReason',
sort: 'custom', sort: 'custom',
isSearch: false, isSearch: false,
isForm: false,
isTable: false, isTable: false,
isDetail: false
},
{
label: '创建时间',
field: 'createTime',
isTable: true,
isForm: false,
table: {
width: 180
},
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
form: { form: {
component: 'DatePicker', component: 'Select'
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
} }
}, },
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
},
},
},
{ {
label: '操作', label: '操作',
field: 'action', field: 'action',
isForm: false, hiddenInMain: true,
isDetail: false, isDetail: false,
isForm: false,
table: { table: {
width: 150, width: 200,
fixed: 'right' fixed: 'right'
} },
isTableForm: false
} }
]) ])
) )
//表单校验
export const InspectionQ3DetailRules = reactive({
itemCode: [{ required: true, message: '请选择物料代码', trigger: 'change' }],
packingNumber: [{ required: true, message: '请输入包装号', trigger: 'blur' }],
batch: [{ required: true, message: '请输入批次', trigger: 'blur' }],
inventoryStatus: [{ required: true, message: '请选择库存状态', trigger: 'change' }],
toLocationCode: [{ required: true, message: '请输入到库位代码', trigger: 'blur' }]
})

478
src/views/qms/inspectionQThree/index.vue

@ -1,478 +0,0 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="[...InspectionQ3Main.allSchemas.searchSchema,...InspectionQ3Detail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" />
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="InspectionQ3Main.allSchemas"
:detailAllSchemas="InspectionQ3Detail.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table v-clientTable
: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 #number="{row}">
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row,$index }">
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="formRef"
:isOpenSearchTable="true"
fieldTableColumn="itemCode"
@success="getList"
:rules="InspectionQ3MainRules"
:formAllSchemas="InspectionQ3Main.allSchemas"
:tableAllSchemas="InspectionQ3Detail.allSchemas"
:tableFormRules="InspectionQ3DetailRules"
:tableData="tableData"
:apiUpdate="InspectionQ3MainApi.updateInspectionQ3Main"
:apiCreate="InspectionQ3MainApi.createInspectionQ3Main"
:isBusiness="true"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
:isShowReduceButtonSelection="true"
@tableSelectionDelete="tableSelectionDelete"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
@onChange="onChange"
@clearSearchInput="onChange"
:sumFormDataByTableCustom ="(formRef,formModel,tableData)=>{
tableData.forEach(item=>{
item.qty = item.countQty*item.packQty
})
}"
>
<!-- <template #default="{row}">
<el-input-number disabled v-model="row.qty"></el-input-number>
</template> -->
</BasicForm>
<!-- 详情 -->
<Detail
ref="detailRef"
:isBasic="false"
:allSchemas="InspectionQ3Main.allSchemas"
:detailAllSchemas="InspectionQ3Detail.allSchemas"
:detailAllSchemasRules="InspectionQ3DetailRules"
:apiCreate="InspectionQ3DetailApi.createInspectionQ3Detail"
:apiUpdate="InspectionQ3DetailApi.updateInspectionQ3Detail"
:apiPage="InspectionQ3DetailApi.getInspectionQ3DetailPage"
:apiDelete="InspectionQ3DetailApi.deleteInspectionQ3Detail"
@searchTableSuccessDetail="searchTableSuccessDetail"
:detailValidate="detailValidate"
/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import { InspectionQ3Main,InspectionQ3MainRules,InspectionQ3Detail,InspectionQ3DetailRules } from './inspectionQ3.data'
import * as InspectionQ3MainApi from '@/api/qms/inspectionQ3/inspectionQ3Main'
import * as InspectionQ3DetailApi from '@/api/qms/inspectionQ3/inspectionQ3Detail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import * as ProductionlineitemApi from '@/api/wms/productionlineitem'
import * as StdcostpriceApi from '@/api/wms/stdcostprice'
import { formatDate } from '@/utils/formatTime'
//
defineOptions({ name: 'InspectionQ3Main' })
const message = useMessage() //
const { t } = useI18n() //
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref([...InspectionQ3Main.allSchemas.tableColumns,...InspectionQ3Detail.allSchemas.tableMainColumns])
//
const updataTableColumns = (val) => {
tableColumns.value = val
}
//
const priceObj = ref()
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
nextTick(async() => {
const setV = {}
if (type == 'tableForm') {
//
if (formField == 'itemCode') {
val.forEach(item=>{
let tableForm = JSON.parse(JSON.stringify(tableFormKeys))
if(tableData.value.find(item1=>item1['itemCode'] == item['itemCode'])) return
const newRow = JSON.parse(JSON.stringify({...tableForm,...item}))
newRow['itemCode'] = item['code']
newRow['uom'] = item['uom']
tableData.value.push(newRow)
})
// row['uom'] = val[0]['uom']
// console.log(formRef.formModel.qty)
// // let res = await ProductionlineitemApi.selectItemCodeToProductionLineCode(val[0].code)
// ProductionlineitemApi.selectItemCodeToProductionLineCode(val[0].code).then((res) => {
// console.log(res)
// if (res?.length > 0) {
// formRef.formModel.defectLocation = res[0].productionLineCode
// InspectionQ3Detail.allSchemas.formSchema.forEach(item=>{
// if (item.field == 'defectLocation') {
// item.componentProps.options = res
// }
// })
// }
// })
// const params = {
// by: "ASC",
// filters: [{column: "itemCode", action: "==", value: val[0].code}],
// pageNo: 1,
// pageSize: 500,
// sort: ""
// }
// params.isSearch = true
// StdcostpriceApi.getStdcostpricePage(params).then((res) => {
// if (res.list?.length > 0) {
// priceObj.value = res.list[0]
// formRef.setValues({
// amount: (parseFloat(formRef.formModel.qty) * parseFloat(priceObj.value.price)).toFixed(6)
// })
// }
// })
}
if (formField == 'costCode') {
console.log(11111)
row['costCode'] = val[0]['costcentreCode']
}
if (formField == 'q1Number') {
//Q1
let list = []
val.forEach((item) => {
list.push(item[searchField])
})
setV[formField] = list.join(',')
formRef.setValues(setV)
}
} else {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
}
})
}
const onChange =(field,e)=>{
if (field == 'qty') {
formRef.value.formRef.formModel.amount = (parseFloat( formRef.value.formRef.formModel.qty) * parseFloat( priceObj.value.price)).toFixed(6)
}
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
nextTick(() => {
const setV = {}
if (formField == 'itemCode') {
setV['itemCode'] = val[0]['code']
setV['uom'] = val[0]['uom']
} else {
setV[formField] = val[0][searchField]
}
formRef.setValues(setV)
})
}
const { tableObject, tableMethods } = useTable({
getListApi: InspectionQ3DetailApi.getInspectionQ3DetailPage //
})
//
const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'qms:inspection-Q3-main:create'}), //
defaultButtons.defaultExportBtn({hasPermi:'qms:inspection-Q3-main:export'}), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
]
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
openForm('create')
} else if (val == 'export') { //
handleExport()
} else if (val == 'refresh') { //
getList()
} else if (val == 'filtrate') { //
} else { //
console.log('其他按钮', item)
}
}
//
const isShowMainButton = (row, val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
// -
const butttondata = (row,$index) => {
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1
if(findIndex>-1&&findIndex<$index){
return []
}
return [
defaultButtons.mainListEditBtn({
hide: isShowMainButton(row, ['0']),
hasPermi: 'qms:inspection-Q3-main:update'
}), //
defaultButtons.mainListDeleteBtn({
hide: isShowMainButton(row, ['0']),
hasPermi: 'qms:inspection-Q3-main:delete'
}), //
defaultButtons.mainListFinishBtn({
hide: isShowMainButton(row, ['0']),
hasPermi: 'qms:inspection-Q3-main:finish'
}) //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'delete') {
//
handleDelete(row.id)
} else if (val == 'finish') {
//
handleFinish(row.id)
}
}
const handleFinish = async (id: number) => {
try {
await InspectionQ3MainApi.finishInspectionQ3Main(id)
message.success(t('common.updateSuccess'))
//
await getList()
} catch {}
}
/** 添加/修改操作 */
const formRef = ref()
const openForm =async (type: string, row?: number) => {
tableData.value = [] //
//
if (type == 'update') {
// tableform
InspectionQ3Main.allSchemas.formSchema.map(itemColumns => {
if(itemColumns.field == 'workshopCode') {
itemColumns.componentProps.isSearchList = false
itemColumns.componentProps.disabled = true
}
})
} else {
// tableform
InspectionQ3Main.allSchemas.formSchema.map(itemColumns => {
if(itemColumns.field == 'workshopCode') {
itemColumns.componentProps.isSearchList = true
itemColumns.componentProps.disabled = false
}
})
}
formRef.value.open(type, row)
}
//
const { wsCache } = useCache()
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode))
detailRef.value.openDetail(row, titleName, titleValue,"requestIssueMain")
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
tableObject.loading = true
//
await InspectionQ3MainApi.deleteInspectionQ3Main(id)
tableObject.loading = false
message.success(t('common.delSuccess'))
//
buttonBaseClick('refresh',null)
} catch {}
}
/** 导出按钮操作 */
const exportLoading = ref(false) //
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await InspectionQ3MainApi.exportInspectionQ3Main(tableObject.params)
download.excel(data, `${route.meta.title}】【${formatDate(new Date())}】.xlsx`)
} catch {
} finally {
exportLoading.value = false
}
}
/**
* tableForm方法
*/
const tableFormKeys = {}
InspectionQ3Detail.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
//
const handleAddTable = () => {
// 线
let tableForm = JSON.parse(JSON.stringify(tableFormKeys))
if (tableData.value.length > 0) {
// tableForm.productionLineCode = tableData.value[0].productionLineCode
// tableForm.workStationCode = tableData.value[0].workStationCode
}
tableData.value.push(tableForm)
}
//
const handleDeleteTable = (item, index) => {
let itemIndex = tableData.value.indexOf(item)
if(itemIndex>-1){
tableData.value.splice(itemIndex, 1)
}
}
const tableSelectionDelete = (selection) => {
tableData.value = tableData.value.filter(item => !selection.includes(item))
}
//
const submitForm = async (formType, submitData) => {
let data = {...submitData}
if(data.masterId){
data.id = data.masterId
}
data.subList = tableData.value //
if(tableData.value.find(item => (item.qty <= 0))) {
message.warning('数量必须大于0')
formRef.value.formLoading = false
return
}
// 线
// if (tableData.value.length > 0) {
// let productionLineCode = tableData.value[0].productionLineCode
// let workStationCode = tableData.value[0].workStationCode
// for(var i=0;i<tableData.value.length;i++) {
// if(productionLineCode !== tableData.value[i].productionLineCode){
// message.warning('线')
// formRef.value.formLoading = false
// return;
// }
// if(workStationCode !== tableData.value[i].workStationCode){
// message.warning('')
// formRef.value.formLoading = false
// return;
// }
// }
// }
formRef.value.formLoading = true
try {
if (formType === 'create') {
await InspectionQ3MainApi.createInspectionQ3Main(data)
message.success(t('common.createSuccess'))
} else {
await InspectionQ3MainApi.updateInspectionQ3Main(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
if (formType === 'create') {
getList()
}else{
buttonBaseClick('refresh',null)
}
} finally {
formRef.value.formLoading = false
}
}
// /
const detailValidate = async (data) => {
// let rs = false
// TODO: /线
return true
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
//
const importTemplateData = reactive({
templateUrl: '',
templateTitle: `${route.meta.title}】导入模版.xlsx`
})
//
const importSuccess = () => {
getList()
}
//
const searchFormClick = (searchData) => {
tableObject.params = {
isSearch: true,
filters: searchData.filters
}
getList() //
}
/** 初始化 **/
onMounted(async () => {
getList()
})
</script>

618
src/views/qms/inspectionQThree/inspectionQ3.data.ts

@ -1,618 +0,0 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
import { dateFormatter } from '@/utils/formatTime'
import * as InspectionQ1Api from '@/api/qms/inspectionQ1'
import { Q1 } from '@/views/qms/inspectionQ1/inspectionQ1.data'
import * as ItembasicApi from '@/api/wms/itembasic'
import { Itembasic } from '@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data'
import * as QadCostcentreApi from '@/api/wms/qadCostcentre'
import { QadCostcentre } from '@/views/wms/basicDataManage/subject/qadCostcentre/qadCostcentre.data'
const { t } = useI18n() // 国际化
// 获取自动提交自动通过自动执行,跳过任务直接删生成记录的默认值
const queryParams = {
pageSize: 10,
pageNo: 1,
code: 'IssueRequest'
}
// 获取当前操作人的部门
import { useUserStore } from '@/store/modules/user'
import { TableColumn } from '@/types/table'
import { fa } from 'element-plus/es/locale'
const userStore = useUserStore()
const userDept = userStore.userSelfInfo.dept
// id 转str 否则form回显匹配不到
userDept.id = userDept.id.toString()
const userDeptArray: any = [userDept]
/**
* @returns {Array}
*/
export const InspectionQ3Main = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '通知单号',
field: 'number',
sort: 'custom',
isSearch: true,
isForm: false,
table: {
width: 150,
fixed: 'left'
}
},
{
label: 'Q1通知单号',
field: 'q1Number',
sort: 'custom',
isSearch: true,
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
multiple: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择Q1通知单', // 输入框占位文本
searchField: 'number', // 查询弹窗赋值字段
searchTitle: 'Q1通知单', // 查询弹窗标题
searchAllSchemas: Q1.allSchemas, // 查询弹窗所需类
searchPage: InspectionQ1Api.getQ1Page, // 查询弹窗所需分页方法
searchCondition: [
{
key: 'available',
value: 'TRUE',
isMainValue: false
},
{
key: 'status',
value: '0',
isMainValue: false
}
],
verificationParams: [
{
key: 'number',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true
}
] // 失去焦点校验参数
}
}
},
{
label: '负责用户',
field: 'responUser',
sort: 'custom',
isSearch: false,
table: {
width: 120
},
form: {
componentProps: {
value: userStore.getUser.nickname,
disabled: true
}
}
},
{
label: '优先级',
field: 'priority',
sort: 'custom',
dictType: DICT_TYPE.QUALITY_NOTIFICATION_PRIORITY,
dictClass: 'string',
isSearch: false,
isTable: false,
tableForm: {
type: 'Select'
}
},
{
label: '处理时间',
field: 'handleTime',
isSearch: false,
table: {
width: 180
},
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
}
}
},
{
label: '汇总金额',
field: 'summaryAmount',
sort: 'custom',
isSearch: false,
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 0,
precision: 2
}
}
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
isSearch: true,
isForm: false
},
{
label: '数量',
field: 'qty',
sort: 'custom',
isSearch: false,
isForm: false
},
{
label: '计量单位',
field: 'uom',
sort: 'custom',
isSearch: false,
isForm: false
},
{
label: '单价',
field: 'price',
sort: 'custom',
isSearch: false,
isForm: false
},
{
label: '金额',
field: 'amount',
sort: 'custom',
isTable: true,
isForm: false,
isSearch: false,
table: {
width: 150
},
form: {
component: 'InputNumber',
componentProps: {
min: 0,
precision: 2
}
}
},
{
label: '成本中心代码',
field: 'costCode',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择成本中心', // 输入框占位文本
searchField: 'costcentreCode', // 查询弹窗赋值字段
searchTitle: '成本中心信息', // 查询弹窗标题
searchAllSchemas: QadCostcentre.allSchemas, // 查询弹窗所需类
searchPage: QadCostcentreApi.getQadCostcentrePage, // 查询弹窗所需分页方法
searchCondition: [
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
],
verificationParams: [
{
key: 'costcentreCode',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true
}
] // 失去焦点校验参数
}
}
},
{
label: '缺陷编码',
field: 'defectCode',
sort: 'custom',
isSearch: false,
isForm: false
},
{
label: '缺陷位置',
field: 'defectLocation',
sort: 'custom',
isSearch: false,
isForm: false
},
{
label: '缺陷类型',
field: 'defectType',
sort: 'custom',
isSearch: false,
isForm: false,
form: {
component: 'Select'
}
},
{
label: '问题原因',
field: 'problemReason',
sort: 'custom',
isSearch: false,
isForm: false
},
{
label: '描述',
field: 'desc',
sort: 'custom',
isSearch: false,
table: {
width: '150'
},
form: {
component: 'Input',
componentProps: {
type: 'textarea'
}
}
},
{
label: '状态',
field: 'status',
sort: 'custom',
dictType: DICT_TYPE.PUBLISHE_STATUS,
dictClass: 'string',
isSearch: false,
isForm: false,
tableForm: {
type: 'Select',
disabled: true
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '是否可用',
field: 'available',
sort: 'custom',
isSearch: false,
isForm: false,
isTable: false,
isDetail: false
},
{
label: '创建时间',
field: 'createTime',
isTable: true,
isForm: false,
table: {
width: 180
},
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x'
}
},
isSearch: true,
search: {
component: 'DatePicker',
componentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
}
}
},
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 230,
fixed: 'right'
}
}
])
)
export const InspectionQ3MainRules = reactive({
workshopCode: [{ required: true, message: '请选择车间代码', trigger: 'change' }],
productionLineCode: [{ required: true, message: '请选择生产线代码', trigger: 'change' }],
// fromWarehouseCode: [
// { required: true, message: '请选择从仓库代码', trigger: 'change' }
// ],
// dueTime: [
// { required: true, message: '请选择截止时间', trigger: 'change' }
// ],
remark: [{ max: 50, message: '不得超过50个字符', trigger: 'blur' }]
})
/**
* @returns {Array}
*/
export const InspectionQ3Detail = useCrudSchemas(
reactive<CrudSchema[]>([
{
label: '通知单号',
field: 'number',
sort: 'custom',
isSearch: false,
isTable: false,
isTableForm: false
},
{
label: '物料号',
field: 'itemCode',
sort: 'custom',
isTable: false,
isSearch: false,
table: {
width: 150
},
tableForm: {
isInpuFocusShow: false,
disabled:true,
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
searchCondition: [
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
],
isShowTableFormSearch: true, //tableForm下方是否出现输入框
isRepeat: true,//tableForm下方输入框是否可以重复添加该条数据
verificationParams: [
{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true
}
] // 失去焦点校验参数
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
searchCondition: [
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
],
verificationParams: [
{
key: 'code',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true
}
] // 失去焦点校验参数
}
}
},
{
label: '数量',
field: 'qty',
sort: 'custom',
isSearch: false,
isTable: false,
tableForm: {
type: 'InputNumber',
min: 0,
precision: 2
}
},
{
label: '单位',
field: 'uom',
sort: 'custom',
dictType: DICT_TYPE.UOM,
dictClass: 'string',
isSearch: false,
isTable: false,
tableForm: {
type: 'Select',
disabled: true
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '单价',
field: 'price',
sort: 'custom',
isTable: false,
isSearch: false,
tableForm: {
disabled: true
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '金额',
field: 'amount',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: false,
tableForm: {
disabled: true
},
form: {
componentProps: {
disabled: true
}
}
},
{
label: '成本中心代码',
field: 'costCode',
sort: 'custom',
isSearch: false,
isTable: false,
isForm: true,
tableForm: {
isInpuFocusShow: true,
searchListPlaceholder: '请选择成本中心', // 输入框占位文本
searchField: 'costcentreCode', // 查询弹窗赋值字段
searchTitle: '成本中心信息', // 查询弹窗标题
searchAllSchemas: QadCostcentre.allSchemas, // 查询弹窗所需类
searchPage: QadCostcentreApi.getQadCostcentrePage, // 查询弹窗所需分页方法
searchCondition: [
{
key: 'available',
value: 'TRUE',
isMainValue: false
}
],
verificationParams: [
{
key: 'costcentreCode',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true
}
] // 失去焦点校验参数
}
},
{
label: '缺陷编码',
field: 'defectCode',
sort: 'custom',
dictType: DICT_TYPE.QMS_Q3_CODE,
dictClass: 'string',
isSearch: true,
isTable: true,
tableForm: {
type: 'Select'
}
},
{
label: '缺陷位置',
field: 'defectLocation',
sort: 'custom',
dictClass: 'string',
isSearch: false,
isTable: false,
form: {
component: 'Select',
componentProps: {
options: [],
optionsAlias: {
labelField: 'productionLineName',
valueField: 'productionLineCode'
},
filterable: true
}
}
},
{
label: '缺陷类型',
field: 'defectType',
sort: 'custom',
isSearch: false,
isTable: false,
form: {
component: 'Select'
}
},
{
label: '问题原因',
field: 'problemReason',
sort: 'custom',
isSearch: false,
isTable: false,
form: {
component: 'Select'
}
},
{
label: '操作',
field: 'action',
hiddenInMain: true,
isDetail: false,
isForm: false,
table: {
width: 200,
fixed: 'right'
},
isTableForm: false
}
])
)
//表单校验
export const InspectionQ3DetailRules = reactive({
itemCode: [{ required: true, message: '请选择物料代码', trigger: 'change' }],
packingNumber: [{ required: true, message: '请输入包装号', trigger: 'blur' }],
batch: [{ required: true, message: '请输入批次', trigger: 'blur' }],
inventoryStatus: [{ required: true, message: '请选择库存状态', trigger: 'change' }],
toLocationCode: [{ required: true, message: '请输入到库位代码', trigger: 'blur' }]
})

106
src/views/wms/inventoryjobManage/scrap/scrapRequestMain/scrapRequestMain.data.ts

@ -8,8 +8,14 @@ import { Balance } from '@/views/wms/inventoryManage/balance/balance.data'
import { Warehouse } from '@/views/wms/basicDataManage/factoryModeling/warehouse/warehouse.data' import { Warehouse } from '@/views/wms/basicDataManage/factoryModeling/warehouse/warehouse.data'
import * as WarehouseApi from '@/api/wms/warehouse' import * as WarehouseApi from '@/api/wms/warehouse'
import * as InspectionQ3Api from '@/api/qms/inspectionQ3' import * as InspectionQ1Api from '@/api/qms/inspectionQ1'
import { Q3 } from '@/views/qms/inspectionQ3/inspectionQ3.data' import { Q1 } from '@/views/qms/inspectionQ1/inspectionQ1.data'
import * as InspectionQ2Api from '@/api/qms/inspectionQ2'
import { Q2 } from '@/views/qms/inspectionQ2/inspectionQ2.data'
import * as InspectionQ3Api from '@/api/qms/inspectionQ3/inspectionQ3Main'
import { InspectionQ3Main } from '@/views/qms/inspectionQ3/inspectionQ3.data'
const { t } = useI18n() // 国际化 const { t } = useI18n() // 国际化
@ -47,6 +53,96 @@ export const ScrapRequestMain = useCrudSchemas(
isForm: false, isForm: false,
isSearch: true isSearch: true
}, },
{
label: 'Q1通知单号',
field: 'q1Number',
sort: 'custom',
isSearch: false,
isDetail: true,
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
// multiple: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择Q1通知单号', // 输入框占位文本
searchField: 'number', // 查询弹窗赋值字段
searchTitle: 'Q1通知单号', // 查询弹窗标题
searchAllSchemas: Q1.allSchemas, // 查询弹窗所需类
searchPage: InspectionQ1Api.getQ1Page, // 查询弹窗所需分页方法
searchCondition: [
{
key: 'available',
value: 'TRUE',
isMainValue: false
},
{
key: 'status',
value: '0',
isMainValue: false
}
],
verificationParams: [
{
key: 'number',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true
}
] // 失去焦点校验参数
}
}
},
{
label: 'Q2通知单号',
field: 'q2Number',
sort: 'custom',
isSearch: false,
isDetail: true,
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
enterSearch: true,
// multiple: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择Q2通知单号', // 输入框占位文本
searchField: 'number', // 查询弹窗赋值字段
searchTitle: 'Q2通知单号', // 查询弹窗标题
searchAllSchemas: Q2.allSchemas, // 查询弹窗所需类
searchPage: InspectionQ2Api.getQ2Page, // 查询弹窗所需分页方法
searchCondition: [
{
key: 'available',
value: 'TRUE',
isMainValue: false
},
{
key: 'status',
value: '0',
isMainValue: false
}
],
verificationParams: [
{
key: 'number',
action: '==',
value: '',
isMainValue: false,
isSearch: true,
isFormModel: true
}
] // 失去焦点校验参数
}
}
},
{ {
label: 'Q3通知单号', label: 'Q3通知单号',
field: 'q3Number', field: 'q3Number',
@ -65,8 +161,8 @@ export const ScrapRequestMain = useCrudSchemas(
searchListPlaceholder: '请选择Q3通知单号', // 输入框占位文本 searchListPlaceholder: '请选择Q3通知单号', // 输入框占位文本
searchField: 'number', // 查询弹窗赋值字段 searchField: 'number', // 查询弹窗赋值字段
searchTitle: 'Q3通知单号', // 查询弹窗标题 searchTitle: 'Q3通知单号', // 查询弹窗标题
searchAllSchemas: Q3.allSchemas, // 查询弹窗所需类 searchAllSchemas: InspectionQ3Main.allSchemas, // 查询弹窗所需类
searchPage: InspectionQ3Api.getQ3Page, // 查询弹窗所需分页方法 searchPage: InspectionQ3Api.getInspectionQ3MainPage, // 查询弹窗所需分页方法
searchCondition: [ searchCondition: [
{ {
key: 'available', key: 'available',
@ -403,7 +499,7 @@ export const ScrapRequestMain = useCrudSchemas(
type: 'daterange', type: 'daterange',
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
} }
}, }
}, },
{ {
label: '创建者', label: '创建者',

Loading…
Cancel
Save