Browse Source

Merge branch 'hella_online_20240803' of http://dev.ccwin-in.com:3000/sfms3.0/sfms3.0-ui into hella_online_20240803

hella_online_20240816
wangyufei 3 months ago
parent
commit
6966218777
  1. 40
      src/views/qms/inspectionQ3/index.vue
  2. 356
      src/views/wms/inventoryjobManage/scrap/scrapRequestMain/index.vue

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

@ -450,31 +450,25 @@ const submitForm = async (formType, submitData) => {
}
data.responUser = userStore.getUser.nickname
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') {
if(data.subList.length == 0){
message.warning("请添加子列表数据")
return;
}
let flag = false;
console.log(1111)
data.subList.forEach((item) => {
if(item.qty == 0){
message.warning("数量不能为0")
flag = true;
return;
}
})
if(flag){
return
}
formRef.value.formLoading = true
await InspectionQ3MainApi.createInspectionQ3Main(data)
message.success(t('common.createSuccess'))
} else {

356
src/views/wms/inventoryjobManage/scrap/scrapRequestMain/index.vue

@ -1,23 +1,31 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="[...ScrapRequestMain.allSchemas.searchSchema,...ScrapRequestDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" />
<Search
:schema="[
...ScrapRequestMain.allSchemas.searchSchema,
...ScrapRequestDetail.allSchemas.searchSchema
]"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ScrapRequestMain.allSchemas"
:detailAllSchemas="ScrapRequestDetail.allSchemas"
/>
<!-- 列表头部 -->
<TableHead
:HeadButttondata="HeadButttondata"
@button-base-click="buttonBaseClick"
:routeName="routeName"
@updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick"
:allSchemas="ScrapRequestMain.allSchemas"
:detailAllSchemas="ScrapRequestDetail.allSchemas"
/>
<!-- 列表 -->
<ContentWrap>
<Table v-clientTable
<Table
v-clientTable
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
@ -28,13 +36,16 @@
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)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row,$index }">
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" />
<template #action="{ row, $index }">
<ButtonBase
:Butttondata="butttondata(row, $index)"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
</Table>
</ContentWrap>
@ -61,6 +72,7 @@
@inputNumberChange="inputNumberChange"
@submitForm="submitForm"
@tableFormSelectOnBlur="tableFormSelectOnBlur"
@clearSearchInput="clearSearchInput"
/>
<!-- 详情 -->
@ -82,14 +94,26 @@
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/scrap-request-main/import" :importTemplateData="importTemplateData"
@success="importSuccess" :updateIsDisable="true" :coverIsDisable="true" :mode="2" />
<ImportForm
ref="importFormRef"
url="/wms/scrap-request-main/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
:updateIsDisable="true"
:coverIsDisable="true"
:mode="2"
/>
</template>
<script setup lang="ts">
import download from '@/utils/download'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import { ScrapRequestMain,ScrapRequestMainRules,ScrapRequestDetail,ScrapRequestDetailRules } from './scrapRequestMain.data'
import {
ScrapRequestMain,
ScrapRequestMainRules,
ScrapRequestDetail,
ScrapRequestDetailRules
} from './scrapRequestMain.data'
import * as ScrapRequestMainApi from '@/api/wms/scrapRequestMain'
import * as ScrapRequestDetailApi from '@/api/wms/scrapRequestDetail'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
@ -105,8 +129,10 @@ const { t } = useI18n() // 国际化
const route = useRoute() //
const routeName = ref()
routeName.value = route.name
const tableColumns = ref([...ScrapRequestMain.allSchemas.tableColumns,...ScrapRequestDetail.allSchemas.tableMainColumns])
const tableColumns = ref([
...ScrapRequestMain.allSchemas.tableColumns,
...ScrapRequestDetail.allSchemas.tableMainColumns
])
//
const updataTableColumns = (val) => {
@ -114,7 +140,7 @@ const updataTableColumns = (val) => {
}
//
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => {
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(() => {
if (type == 'tableForm') {
//
@ -129,21 +155,28 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
// tableData.value.push(newRow)
// })
//
if(formField == 'packingNumber'){
val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']&&item1['packingNumber']==item['packingNumber']))
if(val.length==0) return
let param = {'itemCodes':val.map(item=>item.itemCode).join(',') as string}
StdcostpriceApi.queryStdcostpriceByItemCode(param).then(res => {
val.forEach(item=>{
const itemCode = res.find(item1=>item1['itemCode']==item['itemCode'])
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item}))
if (formField == 'packingNumber') {
val = val.filter(
(item) =>
!tableData.value.find(
(item1) =>
item1['itemCode'] == item['itemCode'] &&
item1['packingNumber'] == item['packingNumber']
)
)
if (val.length == 0) return
let param = { itemCodes: val.map((item) => item.itemCode).join(',') as string }
StdcostpriceApi.queryStdcostpriceByItemCode(param).then((res) => {
val.forEach((item) => {
const itemCode = res.find((item1) => item1['itemCode'] == item['itemCode'])
const newRow = JSON.parse(JSON.stringify({ ...tableFormKeys, ...item }))
newRow[formField] = item[searchField]
newRow['packingNumber'] = item['packingNumber']
newRow['batch'] = item['batch']
newRow['fromLocationCode'] = item['locationCode']
newRow['itemCode'] = item['itemCode']
newRow['uom'] = item['uom']
newRow['singlePrice'] = itemCode?itemCode['price']:''
newRow['singlePrice'] = itemCode ? itemCode['price'] : ''
tableData.value.push(newRow)
})
// row['singlePrice'] = res.price
@ -151,16 +184,71 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
} else {
row[formField] = val[0][searchField]
}
} else {
const setV = {}
setV[formField] = val[0][searchField]
formRef.setValues(setV)
if (formField == 'q1Number') {
ScrapRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'q2Number' || item.field == 'q3Number') {
item.componentProps.enterSearch = false
item.componentProps.isSearchList = false
item.componentProps.disabled = true
}
})
}
if (formField == 'q2Number') {
ScrapRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'q1Number' || item.field == 'q3Number') {
item.componentProps.enterSearch = false
item.componentProps.isSearchList = false
item.componentProps.disabled = true
}
})
}
if (formField == 'q3Number') {
ScrapRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'q1Number' || item.field == 'q2Number') {
item.componentProps.enterSearch = false
item.componentProps.isSearchList = false
item.componentProps.disabled = true
}
})
}
}
})
}
const clearSearchInput = (field) => {
if (field == 'q1Number') {
ScrapRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'q2Number' || item.field == 'q3Number') {
item.componentProps.enterSearch = true
item.componentProps.isSearchList = true
item.componentProps.disabled = false
}
})
}
if (field == 'q2Number') {
ScrapRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'q1Number' || item.field == 'q3Number') {
item.componentProps.enterSearch = true
item.componentProps.isSearchList = true
item.componentProps.disabled = false
}
})
}
if (field == 'q3Number') {
ScrapRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'q1Number' || item.field == 'q1Number') {
item.componentProps.enterSearch = true
item.componentProps.isSearchList = true
item.componentProps.disabled = false
}
})
}
}
//
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
const searchTableSuccessDetail = (formField, searchField, val, formRef) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
@ -170,9 +258,9 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
setV['itemCode'] = val[0]['itemCode']
setV['uom'] = val[0]['uom']
//
let param = {'itemCodes':val[0]['itemCode'] as string}
StdcostpriceApi.queryStdcostpriceByItemCode(param).then(res => {
if(res&&res.length>0){
let param = { itemCodes: val[0]['itemCode'] as string }
StdcostpriceApi.queryStdcostpriceByItemCode(param).then((res) => {
if (res && res.length > 0) {
setV['singlePrice'] = res[0].price
}
})
@ -182,7 +270,7 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
//
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom']
const Echo = []
const Echo = []
const { tableObject, tableMethods } = useTable({
getListApi: ScrapRequestDetailApi.getScrapRequestDetailPage //
@ -193,12 +281,12 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:scrap-request-main:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:scrap-request-main:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:scrap-request-main:export'}), //
defaultButtons.defaultAddBtn({ hasPermi: 'wms:scrap-request-main:create' }), //
defaultButtons.defaultImportBtn({ hasPermi: 'wms:scrap-request-main:import' }), //
defaultButtons.defaultExportBtn({ hasPermi: 'wms:scrap-request-main:export' }), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
@ -211,28 +299,34 @@ const HeadButttondata = [
//
const buttonBaseClick = (val, item) => {
if (val == 'add') { //
if (val == 'add') {
//
openForm('create')
} else if (val == 'import') { //
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') { //
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') { //
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) {
} else if (val == 'refresh') {
//
if (tableObject.params.filters && tableObject.params.filters.length > 0) {
searchFormClick({
filters: tableObject.params.filters
})
} else {
getList()
}
} else if (val == 'filtrate') { //
} else { //
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
//
const isShowMainButton = (row,val) => {
const isShowMainButton = (row, val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
@ -241,45 +335,76 @@ const isShowMainButton = (row,val) => {
}
// -
const butttondata = (row,$index) => {
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1
if(findIndex>-1&&findIndex<$index){
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.mainListCloseBtn({hide:isShowMainButton(row,['1','2','3','4','6']),hasPermi:'wms:scrap-request-main:close'}), //
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['5']),hasPermi:'wms:scrap-request-main:reAdd'}), //
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:scrap-request-main:submit'}), //
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:scrap-request-main:refused'}), //
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:scrap-request-main:agree'}), //
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:scrap-request-main:handle'}), //
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:scrap-request-main:update'}), //
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:scrap-request-main:delete'}), //
]
return [
defaultButtons.mainListCloseBtn({
hide: isShowMainButton(row, ['1', '2', '3', '4', '6']),
hasPermi: 'wms:scrap-request-main:close'
}), //
defaultButtons.mainListReAddBtn({
hide: isShowMainButton(row, ['5']),
hasPermi: 'wms:scrap-request-main:reAdd'
}), //
defaultButtons.mainListSubmitBtn({
hide: isShowMainButton(row, ['1']),
hasPermi: 'wms:scrap-request-main:submit'
}), //
defaultButtons.mainListTurnDownBtn({
hide: isShowMainButton(row, ['2']),
hasPermi: 'wms:scrap-request-main:refused'
}), //
defaultButtons.mainListApproveBtn({
hide: isShowMainButton(row, ['2']),
hasPermi: 'wms:scrap-request-main:agree'
}), //
defaultButtons.mainListHandleBtn({
hide: isShowMainButton(row, ['3']),
hasPermi: 'wms:scrap-request-main:handle'
}), //
defaultButtons.mainListEditBtn({
hide: isShowMainButton(row, ['1']),
hasPermi: 'wms:scrap-request-main:update'
}) //
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:scrap-request-main:delete'}), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'mainClose') { //
if (val == 'mainClose') {
//
console.log('列表-操作按钮事件-关闭')
handleClose(row.masterId)
} else if (val == 'mainReAdd') { //
} else if (val == 'mainReAdd') {
//
console.log('列表-操作按钮事件-重新添加')
handleReAdd(row.masterId)
} else if (val == 'mainSubmit') { //
} else if (val == 'mainSubmit') {
//
console.log('列表-操作按钮事件-提交审批')
handleSubmit(row.masterId)
} else if (val == 'mainTurnDown') { //
} else if (val == 'mainTurnDown') {
//
console.log('列表-操作按钮事件-驳回')
handleRefused(row.masterId)
} else if (val == 'mainApprove') { //
} else if (val == 'mainApprove') {
//
console.log('列表-操作按钮事件-审批通过')
handleAgree(row.masterId)
} else if (val == 'mainHandle') { //
} else if (val == 'mainHandle') {
//
handleHandle(row.masterId)
} else if (val == 'edit') { //
} else if (val == 'edit') {
//
openForm('update', row)
} else if (val == 'delete') { //
} else if (val == 'delete') {
//
handleDelete(row.masterId)
}
}
@ -292,7 +417,7 @@ const handleClose = async (id: number) => {
await ScrapRequestMainApi.closeScrapRequestMain(id)
message.success(t('common.closeSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
buttonBaseClick('refresh', null)
} catch {}
}
@ -304,7 +429,7 @@ const handleReAdd = async (id: number) => {
await ScrapRequestMainApi.reAddScrapRequestMain(id)
message.success(t('common.reAddSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
buttonBaseClick('refresh', null)
} catch {}
}
@ -316,7 +441,7 @@ const handleSubmit = async (id: number) => {
await ScrapRequestMainApi.submitScrapRequestMain(id)
message.success(t('common.submitSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
buttonBaseClick('refresh', null)
} catch {}
}
@ -328,7 +453,7 @@ const handleRefused = async (id: number) => {
await ScrapRequestMainApi.refusedScrapRequestMain(id)
message.success(t('common.refusedSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
buttonBaseClick('refresh', null)
} catch {}
}
@ -340,7 +465,7 @@ const handleAgree = async (id: number) => {
await ScrapRequestMainApi.agreeScrapRequestMain(id)
message.success(t('common.agreeSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
buttonBaseClick('refresh', null)
} catch {}
}
@ -352,13 +477,20 @@ const handleHandle = async (id: number) => {
await ScrapRequestMainApi.handleScrapRequestMain(id)
message.success(t('common.handleSuccess'))
tableObject.loading = false
buttonBaseClick('refresh',null)
buttonBaseClick('refresh', null)
} catch {}
}
/** 添加/修改操作 */
const formRef = ref()
const openForm =async (type: string, row?: number) => {
const openForm = async (type: string, row?: number) => {
ScrapRequestMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'q1Number' || item.field == 'q2Number' || item.field == 'q3Number') {
item.componentProps.enterSearch = true
item.componentProps.isSearchList = true
item.componentProps.disabled = false
}
})
tableData.value = [] //
formRef.value.open(type, row)
}
@ -368,9 +500,11 @@ 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
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,'requestScrapMain')
detailRef.value.openDetail(row, titleName, titleValue, 'requestScrapMain')
}
/** 删除按钮操作 */
@ -384,7 +518,7 @@ const handleDelete = async (id: number) => {
tableObject.loading = false
message.success(t('common.delSuccess'))
//
buttonBaseClick('refresh',null)
buttonBaseClick('refresh', null)
} catch {}
}
@ -406,10 +540,10 @@ const handleExport = async () => {
}
/**
* tableForm方法
*/
* tableForm方法
*/
const tableFormKeys = {}
ScrapRequestDetail.allSchemas.tableFormColumns.forEach(item => {
ScrapRequestDetail.allSchemas.tableFormColumns.forEach((item) => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
@ -421,36 +555,36 @@ const handleAddTable = () => {
//
const handleDeleteTable = (item, index) => {
let itemIndex = tableData.value.indexOf(item)
if(itemIndex>-1){
if (itemIndex > -1) {
tableData.value.splice(itemIndex, 1)
}
}
const tableSelectionDelete = (selection) => {
tableData.value = tableData.value.filter(item => !selection.includes(item))
tableData.value = tableData.value.filter((item) => !selection.includes(item))
}
//
const submitForm = async (formType, submitData) => {
let data = {...submitData}
if(data.masterId){
let data = { ...submitData }
if (data.masterId) {
data.id = data.masterId
}
data.subList = tableData.value //
try {
if (formType === 'create') {
console.log("【报废出库子列表】",data.subList)
if(data.subList.length == 0){
message.warning("请添加子列表数据")
return;
console.log('【报废出库子列表】', data.subList)
if (data.subList.length == 0) {
message.warning('请添加子列表数据')
return
}
let flag = false;
let flag = false
data.subList.forEach((item) => {
if(item.qty == 0){
message.warning("数量不能为0")
flag = true;
return;
}
if (item.qty == 0) {
message.warning('数量不能为0')
flag = true
return
}
})
if(flag){
if (flag) {
return
}
formRef.value.formLoading = true
@ -465,8 +599,8 @@ const submitForm = async (formType, submitData) => {
//
if (formType === 'create') {
getList()
}else{
buttonBaseClick('refresh',null)
} else {
buttonBaseClick('refresh', null)
}
} finally {
formRef.value.formLoading = false
@ -475,14 +609,14 @@ const submitForm = async (formType, submitData) => {
// /
const detailValidate = (data) => {
let tag = false;
if(data.qty <= 0){
let tag = false
if (data.qty <= 0) {
message.warning('数量必须大于0')
tag = false;
return tag;
}else {
tag = true;
return tag;
tag = false
return tag
} else {
tag = true
return tag
}
}
@ -525,14 +659,16 @@ const tableFormSelectOnBlur = (field, val, row, index) => {
}
const inputNumberChange = (field, index, row, val) => {
if(field == 'qty' || field == 'singlePrice'){
if (field == 'qty' || field == 'singlePrice') {
row.amount = row.qty * row.singlePrice
}
}
const qtyOnChange = (field,val) =>{
if(field == 'qty' || field == 'singlePrice'){
detailRef.value.formRef.formRef.formModel.amount = detailRef.value.formRef.formRef.formModel.qty * detailRef.value.formRef.formRef.formModel.singlePrice
const qtyOnChange = (field, val) => {
if (field == 'qty' || field == 'singlePrice') {
detailRef.value.formRef.formRef.formModel.amount =
detailRef.value.formRef.formRef.formModel.qty *
detailRef.value.formRef.formRef.formModel.singlePrice
}
}

Loading…
Cancel
Save