From 2e99f3e099c8541808312eae125c7af5a498e122 Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期三, 03 一月 2024 16:07:00 +0800
Subject: [PATCH] 修改出入库明细headerTitle刷新丢失的问题
---
src/views/productManage/product/AddProductDialog.vue | 152 ++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 126 insertions(+), 26 deletions(-)
diff --git a/src/views/productManage/product/AddProductDialog.vue b/src/views/productManage/product/AddProductDialog.vue
index 28db941..d1b5371 100644
--- a/src/views/productManage/product/AddProductDialog.vue
+++ b/src/views/productManage/product/AddProductDialog.vue
@@ -66,6 +66,30 @@
style="width: 85%"
></el-input>
</el-form-item>
+ <el-form-item label="浜у搧缂栫爜" prop="id">
+ <el-input
+ style="width: 85%"
+ v-if="
+ editConfig.title == '缂栬緫' ||
+ (editConfig.title == '鏂板缓' && codenumer && (explain != '' || isIdDisabled))
+ "
+ :disabled="editConfig.title != '鏂板缓'"
+ v-model="editConfig.infomation.id"
+ placeholder="璇疯緭鍏ョ紪鐮�"
+ >
+ </el-input>
+ <span v-else-if="editConfig.title == '鏂板缓'" style="color: #f56c6c; width: 85%"
+ >璇蜂紭鍏堥厤缃紪鐮佽鑼� <el-button type="text" @click="numberClick"> 閰嶇疆瑙勮寖 </el-button></span
+ >
+ </el-form-item>
+ <el-form-item label="浜у搧瑙勬牸" prop="specs">
+ <el-input
+ style="width: 85%"
+ :disabled="!showFooter"
+ v-model="editConfig.infomation.specs"
+ placeholder="璇疯緭鍏�"
+ ></el-input>
+ </el-form-item>
<el-form-item label="浜у搧绫诲瀷" prop="productType">
<el-select
v-model="editConfig.infomation.productType"
@@ -140,7 +164,7 @@
:min="0"
:controls="false"
size="mini"
- style="width: 81%"
+ style="width: 85%"
:disabled="!showFooter"
></el-input-number>
</el-form-item>
@@ -162,7 +186,7 @@
:min="0"
:controls="false"
size="mini"
- style="width: 81%"
+ style="width: 85%"
:disabled="!showFooter"
></el-input-number>
</el-form-item>
@@ -182,6 +206,21 @@
>
</el-option>
</el-select>
+ </el-form-item>
+ <el-form-item label="浜у搧鍨嬪彿" prop="type">
+ <el-input
+ style="width: 85%"
+ :disabled="!showFooter"
+ v-model="editConfig.infomation.type"
+ placeholder="璇疯緭鍏�"
+ ></el-input>
+ </el-form-item>
+ <el-form-item label="閲囪喘绫诲瀷" prop="purchaseType">
+ <el-radio-group :disabled="!showFooter" v-model="editConfig.infomation.purchaseType">
+ <el-radio v-for="item in purchaseTypeList" :key="item.id" :label="item.id">{{
+ item.name
+ }}</el-radio>
+ </el-radio-group>
</el-form-item>
<el-form-item label="鍐呴儴缂栫爜" prop="internalReference">
<el-input
@@ -205,9 +244,9 @@
</div>
<div class="all">
<!-- <div class="second-label">澶囨敞</div> -->
- <el-form-item label="澶囨敞" prop="internalNotes">
+ <el-form-item label="澶囨敞" prop="note">
<el-input
- v-model.trim="editConfig.infomation.internalNotes"
+ v-model.trim="editConfig.infomation.note"
placeholder="璇疯緭鍏�"
size="mini"
type="textarea"
@@ -473,8 +512,11 @@
import IconCropper from "./IconCropper"
import { getProductCategoryList } from "@/api/product/productCategory"
import { getProductList, addProduct, updateProduct } from "@/api/product/product"
-
+import { uploadFiles } from "@/api/common/other"
+import codeMixin from "@/components/mixin/codeMixin"
+import { getDataByType } from "@/api/data"
export default {
+ mixins: [codeMixin],
name: "AddProductDialog",
props: {
editCommonConfig: {
@@ -507,9 +549,12 @@
editConfig: this.editCommonConfig,
rules: {
name: [{ required: true, message: "璇疯緭鍏ヤ骇鍝佸悕绉�", trigger: "blur" }],
+ id: [{ required: true, validator: this.validateCheckCode, trigger: ["change", "blur"] }],
model: [{ required: true, message: "璇烽�夋嫨鐗╂枡绫诲瀷", trigger: "change" }],
// salePrice: [{ required: true, message: "璇疯緭鍏ラ攢鍞环鏍�", trigger: "blur" }],
- unit: [{ required: true, message: "璇疯緭鍏ュ崟浣�", trigger: "blur" }]
+ unit: [{ required: true, message: "璇疯緭鍏ュ崟浣�", trigger: ["change", "blur"] }],
+ // 閲囪喘绫诲瀷
+ purchaseType: [{ required: true, message: "璇烽�夋嫨", trigger: "blur" }]
},
memberOptions: [{ name: "绠$悊鍛�", id: 1 }],
productCategoryOptions: [], // 浜у搧绫诲埆
@@ -548,31 +593,54 @@
{ name: "鍏朵粬", id: "鍏朵粬" }
],
statisticsMap: {
- inLibrary: 0 // 鍦ㄥ簱
+ amount: this.editCommonConfig.infomation.amount ? this.editCommonConfig.infomation.amount : 0, // 鍦ㄥ簱
+ predictionAmount: this.editCommonConfig.infomation.predictionAmount
+ ? this.editCommonConfig.infomation.predictionAmount
+ : 0, //棰勬祴
+ inputAmount: this.editCommonConfig.infomation.inputAmount ? this.editCommonConfig.infomation.inputAmount : 0, //杩�
+ outputAmount: this.editCommonConfig.infomation.outputAmount ? this.editCommonConfig.infomation.outputAmount : 0, //鍑�
+ reorderRuleNum: this.editCommonConfig.infomation.reorderRuleNum
+ ? this.editCommonConfig.infomation.reorderRuleNum
+ : 0, //閲嶈璐ц鍒欐暟閲�
+ minInventoryRule: this.editCommonConfig.infomation.minInventoryRule
+ ? this.editCommonConfig.infomation.minInventoryRule
+ : 0, //鏈�灏忛噸璁㈣揣
+ maxInventoryRule: this.editCommonConfig.infomation.maxInventoryRule
+ ? this.editCommonConfig.infomation.maxInventoryRule
+ : 0 //鏈�澶ч噸璁㈣揣
},
- isView: false
+ isView: false,
+ fileFormdata: null, // 涓婁紶鍥剧墖鍏ュ弬
+ purchaseTypeList: getDataByType("purchaseType")
}
},
created() {
if (this.editConfig.title === "缂栬緫" && !this.editConfig.autoEdit) {
this.isView = true
}
- // if (this.editConfig.title === "鏂板缓") {
- // this.editConfig.infomation.imageSrc = ""
- // } else {
- // this.editConfig.infomation.imageSrc = "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"
- // }
this.getProductCategoryList()
this.getProductList()
this.setTableForm()
this.setBottonView()
this.statisticsMap.inLibrary = this.editConfig?.infomation?.amount ?? 0
+ // 杩涘嚭鍙g殑浜у搧 鏁伴噺 杩樻病鏈�
+ this.statisticsMap.enter = this.editConfig?.infomation?.amount ?? 0
+ this.statisticsMap.exit = this.editConfig?.infomation?.amount ?? 0
if (this.editConfig.autoEdit) {
this.editClick()
}
this.setOptionalFieldsToEmpty()
+ this.formInfo()
},
methods: {
+ formInfo() {
+ this.objCode.type = "鐗╂枡缂栫爜"
+ this.objCode.codeStandID = ""
+ if (this.editConfig.infomation.codeStandardID) {
+ this.objCode.codeStandID = this.editConfig.infomation.codeStandardID
+ }
+ this.getRCodeStandardList()
+ },
/**
* 闈炲繀濉」鍚庣杩斿洖鐨勬槸鏁板瓧 0,琛ㄥ崟闇�瑕佺┖涓叉墠鑳借涓烘湭閫夋嫨鍥炴樉
*/
@@ -647,6 +715,7 @@
this.showEdit = false
this.showButton = false
this.showFooter = true
+ this.isView = false
this.setTableForm()
},
// 淇濆瓨
@@ -654,20 +723,50 @@
console.log(this.editConfig.infomation)
this.$refs[formName].validate((valid) => {
if (valid) {
- let requestUrl = this.editConfig.title === "鏂板缓" ? addProduct : updateProduct
- this.unsetFieldsToNumber()
- requestUrl({
- ...this.editConfig.infomation
- }).then((res) => {
- console.log(res)
- this.editConfig.visible = false
- if (res.code === 200) {
- this.$message.success("娣诲姞鎴愬姛")
- this.$parent.getData()
+ console.log(this.fileFormdata == null)
+ let attachmentIDs = []
+ if (this.fileFormdata == null) {
+ if (this.editConfig.infomation.attachmentList?.length > 0) {
+ this.editConfig.infomation.attachmentList.forEach((ele) => {
+ attachmentIDs.push(ele.id)
+ })
+ } else {
+ attachmentIDs = []
}
- }, console.error)
+ this.saveEditRequest(attachmentIDs)
+ } else {
+ uploadFiles(this.fileFormdata).then((res) => {
+ if (res.code == 200) {
+ res.data.forEach((ele) => {
+ attachmentIDs.push(ele.id)
+ })
+ }
+ this.saveEditRequest(attachmentIDs)
+ })
+ }
}
})
+ },
+ // 淇濆瓨/缂栬緫鎺ュ彛璇锋眰
+ saveEditRequest(attachmentIDs) {
+ let requestUrl = this.editConfig.title === "鏂板缓" ? addProduct : updateProduct
+ this.unsetFieldsToNumber()
+ let params = {
+ ...this.editConfig.infomation,
+ attachmentIDs
+ }
+ if (this.editConfig.title == "鏂板缓") {
+ params.codeStandardID = this.autoCodeObj.codeStandardID
+ params.autoIncr = this.autoCodeObj.maxAutoIncr
+ }
+ requestUrl(params).then((res) => {
+ console.log(res)
+ this.editConfig.visible = false
+ if (res.code === 200) {
+ this.$message.success(this.editConfig.title === "鏂板缓" ? "娣诲姞" : "缂栬緫" + "鎴愬姛!")
+ this.$parent.getData()
+ }
+ }, console.error)
},
// 鍒犻櫎
delClick() {},
@@ -728,8 +827,9 @@
this.tableData.splice(scope.$index, 1)
},
// 涓婁紶鍥剧墖
- getImageData(data) {
- console.log(data, "鍥剧墖鏁版嵁")
+ getImageData(formdata) {
+ this.fileFormdata = formdata
+ // console.log(formdata, "鍥剧墖鏁版嵁")
},
// 杩涘嚭鐐瑰嚮
inOutBoundClick() {
--
Gitblit v1.8.0