From fd6cd17c0f7a095be934f9e1d1fd7c3e10cad433 Mon Sep 17 00:00:00 2001
From: wente <329538422@qq.com>
Date: 星期二, 21 五月 2024 08:45:39 +0800
Subject: [PATCH] svgEditor以及RBD画图拖动自动吸附在一条线上
---
web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue | 51 +++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue b/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
index 571d45b..e0f2b52 100644
--- a/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
+++ b/web/src/views/modules/basicInfo/XhProductModel-AddOrUpdate.vue
@@ -8,11 +8,12 @@
<el-input v-model="dataForm.name"></el-input>
</zt-form-item>
<zt-form-item label="鑺傜偣绫诲瀷" prop="productType" rules="required">
- <zt-dict v-model="dataForm.productType" dict="product"></zt-dict>
+ <zt-dict v-model="dataForm.productType" dict="product" @input="getDefaultImg"
+ :disabled="disabled"></zt-dict>
</zt-form-item>
<zt-form-item label="杩愯鐘舵�佸浘" prop="operatImg" v-if="isShow">
- <el-input v-model="dataForm.operatImgName" @focus="selectPicture()"
- :readonly="readonly"></el-input>
+ <el-input v-model="dataForm.operatImgName" @focus="selectPicture()"></el-input>
+ <el-image v-if="dataForm.operatImg" :src="url+dataForm.operatImg" style="height: 50px;width: 50px"></el-image>
</zt-form-item>
<zt-form-item label="鎺掑簭" prop="sort">
<el-input v-model="dataForm.sort" :readonly="readonly"></el-input>
@@ -25,10 +26,13 @@
<script>
import PictureSelect from "@/views/modules/basicInfo/SelectPicture";
+ import Cookies from "js-cookie";
export default {
data() {
return {
+ disabled: false,
+ url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=`,
isTree: false,
isShow: true,
fileId: '',
@@ -39,7 +43,7 @@
name: '',
productType: '',
operatImg: '',
- operatImgName:'',
+ operatImgName: '',
sort: '',
status: ''
}
@@ -49,7 +53,7 @@
PictureSelect
},
methods: {
- init(id,params) {
+ init(id, params) {
if (params.type === 'tree') {
this.isTree = true
this.isShow = false
@@ -58,9 +62,28 @@
this.dataForm.pid = params.pid
this.dataForm.productType = params.type
}
+ if (this.dataForm.productType === 10 && id == null) {
+ this.getDefaultImg(this.dataForm.productType)
+ }
+ this.disabled = !!id;
+ },
+ // 鑾峰彇绯荤粺鍒楄〃
+ async getProductList() {
+ let res = await this.$http.get('/basicInfo/XhProductModel/getProductList')
+ this.productList = res.data
+ console.log(this.productList, 'getProductList')
+ },
+ async getDefaultImg(selected) {
+ console.log(selected, 'async getDefaultImg')
+ let params = {
+ productType: selected
+ }
+ let res = await this.$http.get(`/sysPictureBase/getDefaultImg`, {params: params})
+ this.dataForm.operatImgName = res.data.name
+ this.dataForm.operatImg = res.data.id
},
selectPicture() {
- this.$refs.pictureSelect.$refs.dialog.init()
+ this.$refs.pictureSelect.$refs.dialog.init(this.dataForm.productType)
},
openAddWin(row) {
this.dataForm.operatImgName = row.name
@@ -77,6 +100,22 @@
},
// 琛ㄥ崟鎻愪氦
async formSubmit() {
+ let flag = true
+ if (this.isTree) {
+ if (this.dataForm.productType !== '5' || this.dataForm.productType !== '4') {
+ this.$alert("涓嶆敮鎸佹柊澧炴鑺傜偣")
+ flag = false
+ }
+ } else {
+ if (this.dataForm.productType === '5' || this.dataForm.productType === '4') {
+ this.$alert("涓嶆敮鎸佹柊澧炴鑺傜偣")
+ flag = false
+ }
+ }
+
+ if (!flag) {
+ return
+ }
let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/basicInfo/XhProductModel/', this.dataForm)
if (res.success) {
await this.$tip.success()
--
Gitblit v1.9.1