Browse Source

2025-06-05

1、属性值没填写时,不让保存
2、数字为什么会有默认0
master
fengyuan_yang 7 months ago
parent
commit
e7af8e1057
  1. 30
      src/views/modules/demoComponents/orderProperties.vue
  2. 397
      src/views/modules/part/partInformation.vue

30
src/views/modules/demoComponents/orderProperties.vue

@ -1,17 +1,25 @@
<template>
<div>
<div style="margin-top: 5px">
{{approvalUsername}}
<template v-if="approvalUsername && approvalUsername.split(';').includes($store.state.user.name)">
<template v-if="isAuth('103001:tab1:save')">
<el-button type="primary" @click="clickSaveBtn" v-if="orderNo && proofingStatus === '审批中'" :disabled="disabled">新增</el-button>
</template>
<template v-if="isAuth('103001:tab1:update')">
<el-button type="primary" :loading="loading" v-if="orderNo && proofingStatus === '审批中'" :disabled="disabled" @click="clickSave">{{ attributeDialog?'编辑':'保存' }}</el-button>
</template>
<template v-if="isAuth('103001:tab1:save')">
<el-button type="primary" @click="refreshPropertiesModal" :disabled="disabled" v-if="attributeDialog && orderNo && proofingStatus === '审批中'">刷新属性模板</el-button>
</template>
<!-- <template v-if="approvalUsername && approvalUsername.split(';').includes($store.state.user.name)">-->
<!-- <template v-if="isAuth('103001:tab1:save')">-->
<!-- <el-button type="primary" @click="clickSaveBtn" v-if="orderNo && proofingStatus === '审批中'" :disabled="disabled">新增</el-button>-->
<!-- </template>-->
<!-- <template v-if="isAuth('103001:tab1:update')">-->
<!-- <el-button type="primary" :loading="loading" v-if="orderNo && proofingStatus === '审批中'" :disabled="disabled" @click="clickSave">{{ attributeDialog?'编辑':'保存' }}</el-button>-->
<!-- </template>-->
<!-- <template v-if="isAuth('103001:tab1:save')">-->
<!-- <el-button type="primary" @click="refreshPropertiesModal" :disabled="disabled" v-if="attributeDialog && orderNo && proofingStatus === '审批中'">刷新属性模板</el-button>-->
<!-- </template>-->
<!-- </template>-->
<template v-if="isAuth('103001:tab1:save')">
<el-button type="primary" @click="clickSaveBtn" v-if="orderNo" :disabled="disabled">新增</el-button>
</template>
<template v-if="isAuth('103001:tab1:update')">
<el-button type="primary" :loading="loading" v-if="orderNo" :disabled="disabled" @click="clickSave">{{ attributeDialog?'编辑':'保存' }}</el-button>
</template>
<template v-if="isAuth('103001:tab1:save')">
<el-button type="primary" @click="refreshPropertiesModal" :disabled="disabled" v-if="attributeDialog && orderNo">刷新属性模板</el-button>
</template>
</div>
<div class="rq " v-if="attributeDialog">

397
src/views/modules/part/partInformation.vue

@ -534,7 +534,11 @@
border
@selection-change="itemSelectionChange"
style="width: 100%">
<el-table-column type="selection" align="center" width="50"></el-table-column>
<el-table-column
type="selection"
align="center"
width="50">
</el-table-column>
<el-table-column
v-for="(item,index) in columnItemList" :key="index"
:sortable="item.columnSortable"
@ -552,8 +556,8 @@
</div>
<div v-else>
<div v-if="scope.row.valueChooseFlag !== 'Y'">
<el-input-number v-model="scope.row.numValue" style="padding: 0;width: 100%" v-if="scope.row.valueTypeDb === 'N'" :controls="false"></el-input-number>
<el-input v-model="scope.row.textValue" v-else></el-input>
<el-input-number v-if="scope.row.valueTypeDb === 'N'" v-model="scope.row.numValue" style="padding: 0;width: 100%" :controls="false"></el-input-number>
<el-input v-else v-model="scope.row.textValue"></el-input>
</div>
<div v-else>
<el-select style="width: 100%;" v-if="scope.row.valueTypeDb === 'T'" v-model="scope.row.textValue" clearable>
@ -800,161 +804,6 @@
</el-tab-pane>
</el-tabs>
<!-- 物料属性值编辑模态框 -->
<el-dialog title="物料属性" :close-on-click-modal="false" v-drag :visible.sync="updateItemModelFlag" width="1000px">
<div class="rq ">
<el-table
:data="updatePartItemList"
height="350px"
border
style="width: 100%;">
<el-table-column
v-for="(item,index) in updateColumnItemList" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed==''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
<el-table-column
prop="textValue"
header-align="center"
align="right"
min-width="80"
label="文本值">
<template slot-scope="scope">
<el-input v-if="scope.row.valueTypeDb === 'T' && scope.row.valueChooseFlag === 'N'" v-model="scope.row.textValue" style="height: 11px;width:98%"></el-input>
<el-select v-if="scope.row.valueTypeDb === 'T' && scope.row.valueChooseFlag === 'Y'" v-model="scope.row.textValue" style="width: 180px" placeholder="请选择">
<el-option v-for="item in scope.row.availableValueList" :key="index" :label="item.availableValue" :value="item.availableValue"></el-option>
</el-select>
<el-input v-if="scope.row.valueTypeDb !== 'T'" v-model="scope.row.textValue" disabled style="height: 11px;width:98%"></el-input>
</template>
</el-table-column>
<el-table-column
prop="numValue"
header-align="center"
align="right"
min-width="80"
label="数字值">
<template slot-scope="scope">
<el-input v-if="scope.row.valueTypeDb === 'N' && scope.row.valueChooseFlag === 'N'" v-model="scope.row.numValue" style="height: 11px;padding: 0px " allow-create>;width:98%"></el-input>
<el-select v-if="scope.row.valueTypeDb === 'N' && scope.row.valueChooseFlag === 'Y'" v-model="scope.row.numValue" style="width: 180px" placeholder="请选择">
<el-option v-for="item in scope.row.availableValueList" :key="index" :label="item.availableValue" :value="item.availableValue"></el-option>
</el-select>
<el-input v-if="scope.row.valueTypeDb !== 'N'" v-model="scope.row.numValue" disabled style="height: 11px;padding: 0px " allow-create>;width:98%"></el-input>
</template>
</el-table-column>
</el-table>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="commitItemValue()">保存</el-button>
<el-button type="primary" @click="updateItemModelFlag=false">关闭</el-button>
</span>
</el-dialog>
<!-- 物料属性-> 快速新增 -->
<el-dialog title="新增" :close-on-click-modal="false" v-drag :visible.sync="fastAddFlag" width="1000px">
<div style="font-size: 12px">
<el-form :inline="true" label-position="top" :model="itemData">
<el-form-item :label="'属性编码'">
<el-input v-model="itemData.propertiesItemNo" clearable style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'属性名称'">
<el-input v-model="itemData.itemDesc" clearable style="width: 150px"></el-input>
</el-form-item>
<el-form-item :label="' '">
<el-button type="primary" @click="queryPartItem()">查询</el-button>
</el-form-item>
</el-form>
</div>
<el-container style="margin-top: 0px;">
<el-main style="width: 350px;padding: 1px">
<span style="font-size: 12px" >可选属性</span>
<el-table
height="400px"
:data="itemList1"
border
ref="itemTable1"
@row-click="itemClickRow1"
@selection-change="selectionItem1"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="itNo"
header-align="center"
align="center"
min-width="80"
label="属性编码">
</el-table-column>
<el-table-column
prop="itemDesc"
header-align="center"
align="center"
min-width="200"
label="属性名称">
</el-table-column>
</el-table>
</el-main>
<el-main style="width: 10px;padding: 1px">
<div style="margin-top: 200px;margin-left: 18px">
<el-button type="primary" @click="addItem()">添加>></el-button>
</div>
<div style="margin-top: 15px;margin-left: 18px">
<el-button type="primary" @click="deleteItem()">删除<<</el-button>
</div>
</el-main>
<el-main style="width: 350px;padding: 1px">
<span style="font-size: 12px" >已有属性</span>
<el-table
height="400px"
:data="itemList2"
border
ref="itemTable2"
@row-click="itemClickRow2"
@selection-change="selectionItem2"
highlight-current-row
style="width: 100%">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="itNo"
header-align="center"
align="center"
min-width="80"
label="属性编码">
</el-table-column>
<el-table-column
prop="itemDesc"
header-align="center"
align="center"
min-width="200"
label="属性名称">
</el-table-column>
</el-table>
</el-main>
</el-container>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="fastAddFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 代理商-> 快速新增 -->
<el-dialog title="新增" @close="refreshDetailList" :close-on-click-modal="false" v-drag :visible.sync="agentModelFlag" width="900px">
<div style="font-size: 12px">
@ -3392,8 +3241,6 @@
itemModalFlag: false,
agentModelFlag: false,
manufacturerModelFlag: false,
updateItemModelFlag: false,
fastAddFlag: false,
locationModelFlag: false,
updateRevisionModelFlag: false,
updateRevisionModelDisableFlag: false,
@ -3506,7 +3353,10 @@
}
getPartCharacteristicList(tempData).then(({data}) => {
if (data && data.code === 0) {
this.partItemList = data.rows
this.partItemList = data.rows.map(item => ({
...item,
numValue: item.numValue === null ? undefined : item.numValue
}))
} else {
this.partItemList = []
}
@ -3667,7 +3517,6 @@
})
}
})
}).catch(() => {
})
},
@ -3709,191 +3558,6 @@
})
},
clickSave () {
if (!this.attributeDialog) { //
this.updateItemValue()
} else { //
this.copyAttributeList = JSON.parse(JSON.stringify(this.partItemList))
this.attributeDialog = false
}
},
//
updateItemValue () {
this.loading = true
let tempData = {
itemList: JSON.parse(JSON.stringify(this.copyAttributeList))
}
commitItemValue(tempData).then(({data}) => {
if (data && data.code === 0) {
this.getPartItem()
this.attributeDialog = true
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
this.loading = false
}).catch((error) => {
this.$message.error(error)
this.loading = false
})
},
/**
* 新增/删除物料属性
*/
addOrDelItem () {
if (!this.attributeDialog) {
this.$message.warning('请保存更改!')
return
}
this.itemSelections1 = null
this.itemSelections2 = null
this.itemData.propertiesItemNo = ''
this.itemData.itemDesc = ''
let tempData = {
site: this.partCurrentRow.site,
partNo: this.partCurrentRow.partNo,
codeNo: this.partCurrentRow.codeNo,
recordType: 'IP'
}
getItemLists(tempData).then(({data}) => {
this.itemList1 = data.row1
this.itemList2 = data.row2
})
this.fastAddFlag = true
},
//
itemClickRow1 (row) {
this.$refs.itemTable1.toggleRowSelection(row)
},
//
itemClickRow2 (row) {
this.$refs.itemTable2.toggleRowSelection(row)
},
selectionItem1 (val) {
this.itemSelections1 = val
},
selectionItem2 (val) {
this.itemSelections2 = val
},
//
addItem () {
if (this.itemSelections1 == null || this.itemSelections1.length === 0) {
this.$message.warning('请选择可选属性!')
return
}
let inData = {
site: this.$store.state.user.site,
partNo: this.partCurrentRow.partNo,
codeNo: this.partCurrentRow.codeNo,
codeDesc: this.partCurrentRow.codeDesc,
recordType: 'IP',
itemList: this.itemSelections1
}
addPartItem(inData).then(({data}) => {
if (data && data.code === 0) {
getItemLists(inData).then(({data}) => {
this.itemList1 = data.row1
this.itemList2 = data.row2
})
this.getPartItem()
this.itemSelections1 = []
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
//
deleteItem () {
if (this.itemSelections2 == null || this.itemSelections2.length === 0) {
this.$message.warning('请选择已有属性!')
return
}
let inData = {
site: this.$store.state.user.site,
partNo: this.partCurrentRow.partNo,
codeNo: this.partCurrentRow.codeNo,
codeDesc: this.partCurrentRow.codeDesc,
recordType: 'IP',
itemList: this.itemSelections2
}
deletePartItem(inData).then(({data}) => {
if (data && data.code === 0) {
getItemLists(inData).then(({data}) => {
this.itemList1 = data.row1
this.itemList2 = data.row2
})
this.getPartItem()
this.itemSelections2 = []
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
//
queryPartItem () {
this.itemData.partNo = this.partCurrentRow.partNo
this.itemData.codeNo = this.partCurrentRow.codeNo
this.itemData.partNo = this.partCurrentRow.partNo
queryPartItem(this.itemData).then(({data}) => {
if (data && data.code === 0) {
this.itemList1 = data.rows
} else {
this.itemList1 = []
}
})
},
//
commitItemValue () {
let tempData = {
itemList: JSON.parse(JSON.stringify(this.updatePartItemList))
}
commitItemValue(tempData).then(({data}) => {
if (data && data.code === 0) {
this.getPartItem()
this.updateItemModelFlag = false
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
// ======== ========
//
sizeChangeHandle (val) {
@ -3957,9 +3621,6 @@
// table
refreshCurrentTabTable () {
// if (this.activeTable === 'part_item') {
// this.getPartItem()
// } else
if (this.activeTable === 'part_agent') {
this.getPartAgent()
} else if (this.activeTable === 'part_file') {
@ -3972,22 +3633,6 @@
},
// ======== ========
//
getPartItem () {
let tempData = {
site: this.$store.state.user.site,
partNo: this.partCurrentRow.partNo,
codeNo: this.partCurrentRow.codeNo,
recordType: 'IP'
}
getPartItem(tempData).then(({data}) => {
if (data && data.code === 0) {
this.partItemList = data.rows
} else {
this.partItemList = []
}
})
},
//
getItemListByCodeNo () {
@ -3998,7 +3643,10 @@
}
getItemListByCodeNo(tempData).then(({data}) => {
if (data && data.code === 0) {
this.partItemList = data.rows
this.partItemList = data.rows.map(item => ({
...item,
numValue: item.numValue === null ? undefined : item.numValue
}))
} else {
this.partItemList = []
}
@ -5009,6 +4657,16 @@
this.$message.warning('存在物料属性,属性模板不能为空值!')
return
}
//
if (this.partItemList.length > 0
&& this.partItemList.some(item => {
const emptyText = [null, undefined, ''].includes(item.textValue)
const emptyNum = [null, undefined, ''].includes(item.numValue)
return emptyText && emptyNum
})) {
this.$message.warning('属性值不能为空值!')
return
}
if (this.modalData.flag === '2' && this.modalData.oldPartType === 'Manufactured' && this.modalData.partType === 'Manufactured Recipe') {
this.$confirm("该操作会删除物料BOM,请确认!", "提示", {
confirmButtonText: "确定",
@ -5295,7 +4953,10 @@
this.$message.warning('请选择属性!')
return
}
this.partItemList = [...this.partItemList,...this.characteristicSelections]
this.partItemList = [...this.partItemList,...this.characteristicSelections.map(item => ({
...item,
numValue: item.numValue === null ? undefined : item.numValue
}))]
this.saveItemModelFlag = false
},

Loading…
Cancel
Save