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. 38
      src/views/qms/inspectionQ3/index.vue
  2. 246
      src/views/wms/inventoryjobManage/scrap/scrapRequestMain/index.vue

38
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
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
}
// 线
// 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 {

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

@ -1,7 +1,14 @@
<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>
<!-- 列表头部 -->
@ -17,7 +24,8 @@
<!-- 列表 -->
<ContentWrap>
<Table v-clientTable
<Table
v-clientTable
:columns="tableColumns"
:data="tableObject.tableList"
:loading="tableObject.loading"
@ -34,7 +42,10 @@
</el-button>
</template>
<template #action="{ row, $index }">
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" />
<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) => {
@ -130,12 +156,19 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
// })
//
if (formField == 'packingNumber') {
val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']&&item1['packingNumber']==item['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'])
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']
@ -151,14 +184,69 @@ 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) => {
nextTick(() => {
@ -170,8 +258,8 @@ 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 => {
let param = { itemCodes: val[0]['itemCode'] as string }
StdcostpriceApi.queryStdcostpriceByItemCode(param).then((res) => {
if (res && res.length > 0) {
setV['singlePrice'] = res[0].price
}
@ -198,7 +286,7 @@ const HeadButttondata = [
defaultButtons.defaultExportBtn({ hasPermi: 'wms:scrap-request-main:export' }), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
@ -211,13 +299,17 @@ 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') { //
} else if (val == 'refresh') {
//
if (tableObject.params.filters && tableObject.params.filters.length > 0) {
searchFormClick({
filters: tableObject.params.filters
@ -225,8 +317,10 @@ const buttonBaseClick = (val, item) => {
} else {
getList()
}
} else if (val == 'filtrate') { //
} else { //
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
@ -242,44 +336,75 @@ const isShowMainButton = (row,val) => {
// -
const butttondata = (row, $index) => {
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1
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.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)
}
}
@ -359,6 +484,13 @@ const handleHandle = async (id: number) => {
/** 添加/修改操作 */
const formRef = ref()
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,7 +500,9 @@ 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')
}
@ -409,7 +543,7 @@ const handleExport = async () => {
* tableForm方法
*/
const tableFormKeys = {}
ScrapRequestDetail.allSchemas.tableFormColumns.forEach(item => {
ScrapRequestDetail.allSchemas.tableFormColumns.forEach((item) => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
@ -426,7 +560,7 @@ const handleDeleteTable = (item, index) => {
}
}
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) => {
@ -437,17 +571,17 @@ const submitForm = async (formType, submitData) => {
data.subList = tableData.value //
try {
if (formType === 'create') {
console.log("【报废出库子列表】",data.subList)
console.log('【报废出库子列表】', data.subList)
if (data.subList.length == 0) {
message.warning("请添加子列表数据")
return;
message.warning('请添加子列表数据')
return
}
let flag = false;
let flag = false
data.subList.forEach((item) => {
if (item.qty == 0) {
message.warning("数量不能为0")
flag = true;
return;
message.warning('数量不能为0')
flag = true
return
}
})
if (flag) {
@ -475,14 +609,14 @@ const submitForm = async (formType, submitData) => {
// /
const detailValidate = (data) => {
let tag = false;
let tag = false
if (data.qty <= 0) {
message.warning('数量必须大于0')
tag = false;
return tag;
tag = false
return tag
} else {
tag = true;
return tag;
tag = true
return tag
}
}
@ -532,7 +666,9 @@ const inputNumberChange = (field, index, row, val) => {
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
detailRef.value.formRef.formRef.formModel.amount =
detailRef.value.formRef.formRef.formModel.qty *
detailRef.value.formRef.formRef.formModel.singlePrice
}
}

Loading…
Cancel
Save