From 1e1c416c6aa6596feb333b75d882ffeede73d3c9 Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期二, 08 四月 2025 17:37:34 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/SetAmount.vue |   88 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 77 insertions(+), 11 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/SetAmount.vue b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/SetAmount.vue
index 0928d90..10fccb5 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/SetAmount.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/SetAmount.vue
@@ -1,7 +1,48 @@
 <script setup>
-import {ref} from "vue";
+import {onMounted, ref} from "vue";
 import {defineEmits} from 'vue';
+import request from "@/utils/request";
+import {ElMessage} from "element-plus";
 
+onMounted(async() => {
+  await firstLoading()
+})
+
+const firstLoading = async() => {
+  request.post(`/glassOptimize/getConfiguration/纾ㄩ噺`).then((res) => {
+    if (res.code == "200") {
+      const rawData = res.data.data;
+      if (Array.isArray(rawData) && rawData.length > 0) {
+        const formattedData = rawData.map(item => {
+          const formattedItem = {};
+          for (const key in item) {
+            if (typeof item[key] === 'string') {
+              //鍘婚櫎瀛楃涓插睘鎬у�煎紑澶村拰缁撳熬鐨勫弻寮曞彿
+              formattedItem[key] = item[key].replace(/^\"|\"$/g, '');
+            } else {
+              formattedItem[key] = item[key];
+            }
+          }
+          return formattedItem;
+        });
+        quicksetLeft.value=formattedData[0].leftEdge
+        quicksetTop.value=formattedData[0].upEdge
+        quicksetRight.value=formattedData[0].rightEdge
+        quicksetBottom.value=formattedData[0].downEdge
+        controlValue.value=formattedData[0].quickEdge
+        if(formattedData[0].autoFillEdge=="true"){
+          check.value=true
+        }else{
+          check.value=false
+        }
+        minAutoLenght.value=formattedData[0].minAutoLenght
+
+      }
+    } else {
+      ElMessage.warning(res.msg)
+    }
+  });
+};
 function setupComponent() {
   // 鍚勪釜杈撳叆妗嗙粦瀹氱殑鍊硷紝鍒濆鍖栦负0
   const quicksetTop = ref('0');
@@ -10,6 +51,7 @@
   const quicksetLeft = ref('0');
   // 鐢ㄤ簬鎺у埗鐨勮緭鍏ュ�硷紝鍒濆鍖栦负1
   const controlValue = ref('1');
+  const minAutoLenght = ref('0');
 
   const syncValues = () => {
     // 灏嗘帶鍒跺�艰祴缁欏叾浠栧洓涓粍浠�
@@ -24,6 +66,7 @@
     quicksetBottom,
     quicksetLeft,
     controlValue,
+    minAutoLenght,
     syncValues
   };
 }
@@ -33,10 +76,11 @@
   quicksetBottom,
   quicksetLeft,
   controlValue,
+  minAutoLenght,
   syncValues
 } = setupComponent();
 
-const check = ref(true)
+const check = ref()
 
 const emit = defineEmits(['set-amount']);
 const props = defineProps({
@@ -44,14 +88,36 @@
 });
 
 const setAmount = () => {
-  const amountData = {
-    quicksetTop: quicksetTop.value,
-    quicksetRight: quicksetRight.value,
-    quicksetBottom: quicksetBottom.value,
-    quicksetLeft: quicksetLeft.value
-  };
-  emit('set-amount', amountData);
-  props.closeDialog(2);
+  let json = "{"
+  json+='"left_edge":"'+quicksetLeft.value+'",'
+  json+='"up_edge":"'+quicksetTop.value+'",'
+  json+='"right_edge":"'+quicksetRight.value+'",'
+  json+='"down_edge":"'+quicksetBottom.value+'",'
+  json+='"auto_fill_edge":"'+check.value+'",'
+  json+='"quick_edge":"'+controlValue.value+'",'
+  json+='"min_auto_lenght":"'+minAutoLenght.value+'"'
+  json+="}"
+
+  let configuration={
+    json:json,
+  }
+
+  request.post(`/glassOptimize/saveConfiguration/纾ㄩ噺`,configuration).then((res) => {
+    if(res.code==200 && res.data===true){
+      const amountData = {
+        quicksetTop: quicksetTop.value,
+        quicksetRight: quicksetRight.value,
+        quicksetBottom: quicksetBottom.value,
+        quicksetLeft: quicksetLeft.value,
+        controlValue:controlValue.value,
+        minAutoLenght:minAutoLenght.value,
+      };
+      emit('set-amount', amountData);
+      props.closeDialog(2);
+    } else {
+      ElMessage.warning(res.msg)
+    }
+  });
 };
 
 </script>
@@ -81,7 +147,7 @@
       <div style="margin-top: 30px">
       <span>鎴愬搧杈归暱澶т簬绛変簬澶氬皯鏃惰嚜鍔ㄥ~鍏�(鍗曚綅: mm)</span>
       <el-checkbox v-model="check" style="margin: 5px 0 0 12px;"/>
-      <vxe-input style="width: 100px; height: 40px; margin-left: 5px" placeholder="0"/>
+      <vxe-input style="width: 100px; height: 40px; margin-left: 5px" v-model="minAutoLenght" placeholder=""/>
       </div>
     </div>
   </div>

--
Gitblit v1.8.0