From cab6ab717f0f799c86cc7cb6aefbb73640208cd0 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期二, 14 十一月 2023 16:40:43 +0800
Subject: [PATCH] 查看页面编辑产品时图片无法修改
---
src/views/productManage/product/IconCropper.vue | 28 ++++++++++---
src/views/productManage/product/AddProductDialog.vue | 77 ++++++++++++++++++++++++--------------
2 files changed, 69 insertions(+), 36 deletions(-)
diff --git a/src/views/productManage/product/AddProductDialog.vue b/src/views/productManage/product/AddProductDialog.vue
index fdd3521..d1b5371 100644
--- a/src/views/productManage/product/AddProductDialog.vue
+++ b/src/views/productManage/product/AddProductDialog.vue
@@ -71,21 +71,24 @@
style="width: 85%"
v-if="
editConfig.title == '缂栬緫' ||
- (editConfig.title == '鏂板缓' &&
- codenumer &&
- (explain != '' || isIdDisabled))
+ (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%"
+ <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-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
@@ -205,11 +208,18 @@
</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-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 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">
@@ -503,8 +513,8 @@
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";
+import codeMixin from "@/components/mixin/codeMixin"
+import { getDataByType } from "@/api/data"
export default {
mixins: [codeMixin],
name: "AddProductDialog",
@@ -539,12 +549,12 @@
editConfig: this.editCommonConfig,
rules: {
name: [{ required: true, message: "璇疯緭鍏ヤ骇鍝佸悕绉�", trigger: "blur" }],
- id: [{ required: true, validator: this.validateCheckCode, trigger: ["change",'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: ["change",'blur' ] }],
+ unit: [{ required: true, message: "璇疯緭鍏ュ崟浣�", trigger: ["change", "blur"] }],
// 閲囪喘绫诲瀷
- purchaseType: [{ required: true, message: "璇烽�夋嫨", trigger: "blur" }],
+ purchaseType: [{ required: true, message: "璇烽�夋嫨", trigger: "blur" }]
},
memberOptions: [{ name: "绠$悊鍛�", id: 1 }],
productCategoryOptions: [], // 浜у搧绫诲埆
@@ -583,17 +593,25 @@
{ name: "鍏朵粬", id: "鍏朵粬" }
],
statisticsMap: {
- 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,//鏈�澶ч噸璁㈣揣
+ 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,
fileFormdata: null, // 涓婁紶鍥剧墖鍏ュ弬
- purchaseTypeList: getDataByType("purchaseType"),
+ purchaseTypeList: getDataByType("purchaseType")
}
},
created() {
@@ -612,16 +630,16 @@
this.editClick()
}
this.setOptionalFieldsToEmpty()
- this.formInfo();
+ this.formInfo()
},
methods: {
formInfo() {
- this.objCode.type = "鐗╂枡缂栫爜";
- this.objCode.codeStandID = "";
+ this.objCode.type = "鐗╂枡缂栫爜"
+ this.objCode.codeStandID = ""
if (this.editConfig.infomation.codeStandardID) {
- this.objCode.codeStandID = this.editConfig.infomation.codeStandardID;
+ this.objCode.codeStandID = this.editConfig.infomation.codeStandardID
}
- this.getRCodeStandardList();
+ this.getRCodeStandardList()
},
/**
* 闈炲繀濉」鍚庣杩斿洖鐨勬槸鏁板瓧 0,琛ㄥ崟闇�瑕佺┖涓叉墠鑳借涓烘湭閫夋嫨鍥炴樉
@@ -697,6 +715,7 @@
this.showEdit = false
this.showButton = false
this.showFooter = true
+ this.isView = false
this.setTableForm()
},
// 淇濆瓨
@@ -732,19 +751,19 @@
saveEditRequest(attachmentIDs) {
let requestUrl = this.editConfig.title === "鏂板缓" ? addProduct : updateProduct
this.unsetFieldsToNumber()
- let params={
+ let params = {
...this.editConfig.infomation,
attachmentIDs
}
if (this.editConfig.title == "鏂板缓") {
- params.codeStandardID = this.autoCodeObj.codeStandardID;
- params.autoIncr = this.autoCodeObj.maxAutoIncr;
+ 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.$message.success(this.editConfig.title === "鏂板缓" ? "娣诲姞" : "缂栬緫" + "鎴愬姛!")
this.$parent.getData()
}
}, console.error)
diff --git a/src/views/productManage/product/IconCropper.vue b/src/views/productManage/product/IconCropper.vue
index cc074b0..ee360dc 100644
--- a/src/views/productManage/product/IconCropper.vue
+++ b/src/views/productManage/product/IconCropper.vue
@@ -127,16 +127,30 @@
fileName: ""
}
},
- mounted() {
- console.log(this.imageUrl)
- if (!this.isView && this.imageUrl?.length > 0) {
- this.isPreview = true
- this.previewImg = this.imageUrl
- } else {
- this.isPreview = false
+ computed: {
+ myIsView() {
+ return this.isView
}
},
+ watch: {
+ myIsView() {
+ this.setImgMethods()
+ }
+ },
+ mounted() {
+ console.log(this.imageUrl)
+ this.setImgMethods()
+ },
methods: {
+ // 璁剧疆涓婁紶/鏇存崲鍥剧墖鏄剧ず鏂规硶
+ setImgMethods() {
+ if (!this.isView && this.imageUrl?.length > 0) {
+ this.isPreview = true
+ this.previewImg = this.imageUrl
+ } else {
+ this.isPreview = false
+ }
+ },
// 涓婁紶鎸夐挳 闄愬埗鍥剧墖澶у皬鍜岀被鍨�
handleChangeUpload(file, fileList) {
const isJPG = file.raw.type === "image/jpeg" || file.raw.type === "image/png"
--
Gitblit v1.8.0