From c87a6f7310ca992d7f058a8f286b095c9a632c90 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期四, 21 九月 2023 16:51:58 +0800
Subject: [PATCH] 位置+产品类型的接口联调+业务类型的字段添加

---
 src/assets/style/reset-element.scss                                  |    4 
 src/views/warehouseManage/bussinessType/AddBussinessType.vue         |   59 ++++--
 src/components/makepager/TableCommonView.vue                         |    3 
 src/views/warehouseManage/warehouse/index.vue                        |    8 
 src/api/warehouseManage/warehouse.js                                 |   41 ++++
 src/views/productManage/productCategory/AddProductCategoryDialog.vue |   21 +
 src/api/data.js                                                      |   34 +++
 src/views/warehouseManage/position/AddDialog.vue                     |  270 ++++++++++++++++++-----------
 src/views/warehouseManage/bussinessType/index.vue                    |    7 
 src/views/productManage/productCategory/index.vue                    |    2 
 src/views/warehouseManage/position/index.vue                         |   73 +++++--
 src/views/warehouseManage/warehouse/AddDialog.vue                    |   14 +
 12 files changed, 373 insertions(+), 163 deletions(-)

diff --git a/src/api/data.js b/src/api/data.js
index f98678f..36a8533 100644
--- a/src/api/data.js
+++ b/src/api/data.js
@@ -138,6 +138,38 @@
     id: 2
   }
 ]
+// 浣嶇疆
+// 浣嶇疆绫诲瀷
+const positionType=[
+  {
+    name: "渚涘簲鍟嗕綅缃�",
+    id: 1
+  },
+  {
+    name: "瑙嗗浘",
+    id: 2
+  },
+  {
+    name: "鍐呴儴浣嶇疆",
+    id: 3
+  },
+  {
+    name: "瀹㈡埛浣嶇疆",
+    id: 4
+  },
+  {
+    name: "搴撳瓨鎹熷け",
+    id: 5
+  },
+  {
+    name: "鐢熶骇",
+    id: 6
+  },
+  {
+    name: "涓浆浣嶇疆",
+    id: 7
+  }
+]
 export const getDataByType = (type) => {
   if (type == "purchaseStatus") {
     return purchaseStatus
@@ -157,5 +189,7 @@
     return costingMethod
   }else if(type=='inventoryValuation'){
     return inventoryValuation
+  }else if(type=='positionType'){
+    return positionType;
   }
 }
diff --git a/src/api/warehouseManage/warehouse.js b/src/api/warehouseManage/warehouse.js
index b68f3f9..8e67a72 100644
--- a/src/api/warehouseManage/warehouse.js
+++ b/src/api/warehouseManage/warehouse.js
@@ -61,3 +61,44 @@
     data
   })
 }
+// 浣嶇疆  鍒楄〃
+export function getLocationList(data) {
+  return request({
+    url: "/api-wms/v1/location/getLocationList",
+    method: "post",
+    data
+  })
+}
+// 鍒涘缓浣嶇疆
+export function addLocation(data) {
+  return request({
+    url: "/api-wms/v1/location/addLocation",
+    method: "post",
+    data
+  })
+}
+// 鍒犻櫎浣嶇疆 
+export function deleteLocation(data) {
+  return request({
+    url: "/api-wms/v1/location/deleteLocation/"+data.id,
+    method: "delete",
+    data
+  })
+}
+// 浣嶇疆 璇︽儏
+export function getLocationDetails(data) {
+  return request({
+    url: "/api-wms/v1/location/getLocationDetails/"+data.id,
+    method: "get",
+    data
+  })
+}
+// 鏇存柊浣嶇疆
+export function updateLocation(data) {
+  return request({
+    url: "/api-wms/v1/location/updateLocation",
+    method: "post",
+    data
+  })
+}
+
diff --git a/src/assets/style/reset-element.scss b/src/assets/style/reset-element.scss
index ceca106..7bd3668 100644
--- a/src/assets/style/reset-element.scss
+++ b/src/assets/style/reset-element.scss
@@ -25,7 +25,9 @@
     padding: 0;
   }
 }
-
+.color_F56C6C{
+  color:#F56C6C;
+}
 // .el-menu-item {
 //   margin: 8px;
 //   border-radius: 6px;
diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue
index 5133ded..96fedc2 100644
--- a/src/components/makepager/TableCommonView.vue
+++ b/src/components/makepager/TableCommonView.vue
@@ -62,6 +62,9 @@
             :style="{ color: new Date().getTime() > new Date(scope.row[item.prop]).getTime() ? '#D23F3A' : '#606266' }"
             >{{ timeAgo(scope.row[item.prop]) }}</span
           >
+          <div v-else-if="item.conversion">
+            <span>{{ item.getStatus(scope.row[item.prop]) }}</span>
+          </div>
           <span
             v-else-if="item.isClick && scope.row[item.prop]"
             :class="item.className ? item.className : 'sel-name'"
diff --git a/src/views/productManage/productCategory/AddProductCategoryDialog.vue b/src/views/productManage/productCategory/AddProductCategoryDialog.vue
index a73afb8..afa9934 100644
--- a/src/views/productManage/productCategory/AddProductCategoryDialog.vue
+++ b/src/views/productManage/productCategory/AddProductCategoryDialog.vue
@@ -48,7 +48,7 @@
           <div class="basic-info-view">
             <el-row>
               <el-col :span="24">
-                <div style="margin-left: 20px">绫诲埆</div>
+                <div style="margin-left: 20px"><span class="color_F56C6C">*</span>绫诲埆</div>
                 <el-form-item label="" prop="name" label-width="20px">
                   <el-input
                     v-model="editConfig.infomation.name"
@@ -191,6 +191,7 @@
   updateProductCategory,
   deleteProductCategory,
 } from "@/api/product/productCategory";
+
 import { getDataByType } from "@/api/data";
 export default {
   name: "AddProductCategoryDialog",
@@ -259,9 +260,11 @@
       deleteProductCategory({ id: data.id }).then((res) => {
         if (res.code === 200) {
           this.editConfig.visible = false;
-          this.$message.success("鍒櫎鎴愬姛");
+          this.$message.success("鍒櫎鎴愬姛!");
           this.$emit("refresh");
-        }
+        } else {
+            this.$message.warning(res.msg?res.msg:"鍒犻櫎澶辫触!")
+         }
       });
     },
     // 缂栬緫
@@ -294,17 +297,21 @@
             addProductCategory(params).then((res) => {
               if (res.code === 200) {
                 this.editConfig.visible = false;
-                this.$message.success("娣诲姞鎴愬姛");
+                this.$message.success("娣诲姞鎴愬姛!");
                 this.$emit("refresh");
-              }
+              } else {
+                    this.$message.warning(res.msg?res.msg:"娣诲姞澶辫触!")
+                }
             });
           } else {
             updateProductCategory(params).then((res) => {
               if (res.code === 200) {
                 this.editConfig.visible = false;
-                this.$message.success("缂栬緫鎴愬姛");
+                this.$message.success("缂栬緫鎴愬姛!");
                 this.$emit("refresh");
-              }
+              } else {
+                    this.$message.warning(res.msg?res.msg:"缂栬緫澶辫触!")
+                }
             });
           }
         } else {
diff --git a/src/views/productManage/productCategory/index.vue b/src/views/productManage/productCategory/index.vue
index d6fe181..5dcca5f 100644
--- a/src/views/productManage/productCategory/index.vue
+++ b/src/views/productManage/productCategory/index.vue
@@ -3,7 +3,7 @@
     <div class="top">
       <SearchCommonView
         :add-title="'鏂板缓'"
-        :placeholder="'璇疯緭鍏ュ崟鍙�'"
+        :placeholder="'璇疯緭鍏ヤ骇鍝佺被鍨�'"
         :amount-view="false"
         @addCommonClick="addBtnClick"
         @searchClick="getList"
diff --git a/src/views/warehouseManage/bussinessType/AddBussinessType.vue b/src/views/warehouseManage/bussinessType/AddBussinessType.vue
index 4d907a1..772ae8a 100644
--- a/src/views/warehouseManage/bussinessType/AddBussinessType.vue
+++ b/src/views/warehouseManage/bussinessType/AddBussinessType.vue
@@ -15,8 +15,7 @@
             <span>鎵撳嵃</span>
           </span>
           <span class="btn" style="margin-left: 15px">
-            <i class="el-icon-s-tools"></i>
-            <span>鍔ㄤ綔</span>
+            <el-button plain size="mini" style="margin-left: 15px" @click="deleteClick">鍒犻櫎</el-button>
           </span>
           <el-button v-if="showEdit" plain size="mini" style="margin-left: 15px" @click="editClick">缂栬緫</el-button>
         </div>
@@ -37,10 +36,10 @@
             <el-row>
               <el-col :span="24">
                 <div style="margin-left: 20px">鍏ュ簱绫诲瀷</div>
-                <el-form-item label="" prop="client_name" label-width="20px">
+                <el-form-item label="" prop="name" label-width="20px">
                   <el-input
-                    v-model="editConfig.infomation.client_name"
-                    placeholder=""
+                    v-model="editConfig.infomation.name"
+                    placeholder="璇峰~鍐�"
                     :disabled="!showFooter"
                     style="width: 85%"
                   ></el-input>
@@ -61,9 +60,9 @@
                   </el-select>
                 </el-form-item>
                 
-                <el-form-item label="搴忓彿鍓嶇紑" prop="client_name" :label-width="labelWidth">
+                <el-form-item label="搴忓彿鍓嶇紑" prop="prefix" :label-width="labelWidth">
                   <el-input
-                    v-model="editConfig.infomation.client_name"
+                    v-model="editConfig.infomation.prefix"
                     placeholder=""
                     :disabled="!showFooter"
                     style="width: 85%"
@@ -149,9 +148,9 @@
                 <el-form-item
                   v-if="editConfig.infomation.baseOperationType === 1"
                   label="棰勫~鍐欎綔涓氳鎯�"
-                  prop="showOperations"
+                  prop="earlyOperations"
                 >
-                  <el-checkbox v-model="editConfig.infomation.showOperations"></el-checkbox>
+                  <el-checkbox v-model="editConfig.infomation.earlyOperations"></el-checkbox>
                 </el-form-item>
               </div>
             </div>
@@ -171,7 +170,7 @@
                     style="width: 85%"
                     :disabled="!showFooter"
                   >
-                    <el-option v-for="item in locationList" :key="item.id" :label="item.username" :value="item.id">
+                    <el-option v-for="item in positionlist" :key="item.id" :label="item.name" :value="item.id">
                     </el-option>
                   </el-select>
                 </el-form-item>
@@ -183,7 +182,7 @@
                     style="width: 85%"
                     :disabled="!showFooter"
                   >
-                    <el-option v-for="item in locationList" :key="item.id" :label="item.username" :value="item.id">
+                    <el-option v-for="item in positionlist" :key="item.id" :label="item.name" :value="item.id">
                     </el-option>
                   </el-select>
                 </el-form-item>
@@ -204,7 +203,7 @@
 </template>
 
 <script>
-import { addOperationType,updateOperationType,getWarehouseList,deleteOperationType} from "@/api/warehouseManage/warehouse"
+import { addOperationType,updateOperationType,getWarehouseList,deleteOperationType,getLocationList} from "@/api/warehouseManage/warehouse"
 import { getDataByType } from "@/api/data";
 export default {
   name: "AddBussinessType",
@@ -228,9 +227,9 @@
       editConfig: this.editCommonConfig,
       rules: {
         // 鍏ュ簱绫诲瀷
-        client_name: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }],
+        name: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }],
         // 鍓嶇紑
-        number: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }],
+        prefix: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }],
         baseOperationType: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
       },
       // 浣嶇疆
@@ -248,7 +247,8 @@
       showEdit: false, // 鏄惁鏄剧ず缂栬緫鎸夐挳
       isDelClick: false, // 鍒犻櫎鎸夐挳鏄惁鍙偣鍑�
       showFooter: false, // 鏄惁鏄剧ず鍙栨秷淇濆瓨
-      labelWidth: "90px"
+      labelWidth: "90px",
+      positionlist:[],
     }
   },
   created() {
@@ -258,6 +258,16 @@
   methods: {
     // 浠撳簱
     async getWarehouse() {
+      await getLocationList({
+        keyword:'',
+        page: 0,
+        pageSize: 0
+      }).then((res) => {
+        if (res.code === 200) {
+          this.positionlist = res.data?res.data:[]
+          this.$forceUpdate()
+        }
+      })
       await getWarehouseList({
         keyword: '',
         page: 0,
@@ -292,9 +302,11 @@
       deleteOperationType({ id: data.id }).then((res) => {
         if (res.code === 200) {
           this.editConfig.visible = false;
-          this.$message.success("鍒櫎鎴愬姛");
+          this.$message.success("鍒櫎鎴愬姛!");
           this.$emit("refresh");
-        }
+        } else {
+            this.$message.warning(res.msg?res.msg:"鍒犻櫎澶辫触!")
+         }
       });
     },
     // 缂栬緫
@@ -307,6 +319,10 @@
       let data =JSON.parse(JSON.stringify(this.editConfig.infomation));
       
       let params = {
+        // 鍏ュ簱绫诲瀷
+        name:data.name,
+        // 鍓嶇紑
+        prefix:data.prefix,
         // 浣滀笟绫诲瀷
         baseOperationType:data.baseOperationType,
         // 閫�璐х被鍨�
@@ -317,6 +333,7 @@
         warehouseId:data.warehouseId,
         // 鏄剧ず浣滀笟璇︽儏
         showOperations:data.showOperations,
+        earlyOperations:data.earlyOperations,
         // 淇濈暀鏂瑰紡
         reservationMethod:data.reservationMethod,
         // 榛樿鍘熶綅缃�
@@ -338,16 +355,20 @@
               addOperationType(params).then((res) => {
                 if (res.code === 200) {
                   this.editConfig.visible = false;
-                  this.$message.success("娣诲姞鎴愬姛");
+                  this.$message.success("娣诲姞鎴愬姛!");
                   this.$emit('refresh')
+                } else {
+                    this.$message.warning(res.msg?res.msg:"娣诲姞澶辫触!")
                 }
               });
             } else {
               updateOperationType(params).then((res) => {
                 if (res.code === 200) {
                   this.editConfig.visible = false;
-                  this.$message.success("缂栬緫鎴愬姛");
+                  this.$message.success("缂栬緫鎴愬姛!");
                   this.$emit('refresh')
+                } else {
+                    this.$message.warning(res.msg?res.msg:"缂栬緫澶辫触!")
                 }
               });
             }
diff --git a/src/views/warehouseManage/bussinessType/index.vue b/src/views/warehouseManage/bussinessType/index.vue
index d81f3dc..8c879f7 100644
--- a/src/views/warehouseManage/bussinessType/index.vue
+++ b/src/views/warehouseManage/bussinessType/index.vue
@@ -3,7 +3,7 @@
     <div class="top">
       <SearchCommonView
         :add-title="'鏂板缓'"
-        :placeholder="'璇疯緭鍏ュ崟鍙�'"
+        :placeholder="'璇疯緭鍏ュ叆搴撶被鍨�'"
         :amount-view="false"
         @addCommonClick="addBtnClick"
         @searchClick="getList"
@@ -77,7 +77,7 @@
       let tableColumn = [
         {
           label: "鍏ュ簱绫诲瀷",
-          prop: "id",
+          prop: "name",
           isShowColumn: true,
           default: true
         },
@@ -130,6 +130,8 @@
     addBtnClick() {
       this.editConfig.title = "鏂板缓"
       this.editConfig.infomation={
+         name:'',
+         prefix:'',
          // 浣滀笟绫诲瀷
          baseOperationType:null,
         // 閫�璐х被鍨�
@@ -140,6 +142,7 @@
         warehouseId:null,
         // 鏄剧ず浣滀笟璇︽儏
         showOperations:null,
+        earlyOperations:null,
         // 淇濈暀鏂瑰紡
         reservationMethod:null,
         // 榛樿鍘熶綅缃�
diff --git a/src/views/warehouseManage/position/AddDialog.vue b/src/views/warehouseManage/position/AddDialog.vue
index 8eb8bc8..2859b07 100644
--- a/src/views/warehouseManage/position/AddDialog.vue
+++ b/src/views/warehouseManage/position/AddDialog.vue
@@ -15,8 +15,7 @@
             <span>鎵撳嵃</span>
           </span>
           <span class="btn" style="margin-left: 15px">
-            <i class="el-icon-s-tools"></i>
-            <span>鍔ㄤ綔</span>
+            <el-button plain size="mini" style="margin-left: 15px" @click="deleteClick">鍒犻櫎</el-button>
           </span>
           <el-button v-if="showEdit" plain size="mini" style="margin-left: 15px" @click="editClick">缂栬緫</el-button>
         </div>
@@ -40,21 +39,31 @@
 
             <el-row>
               <el-col :span="24" class="line_height_30px">
-                <el-form-item label="浣嶇疆鍚嶇О" prop="client_name">
+                <el-form-item label="浣嶇疆鍚嶇О" prop="name">
                   <el-input
-                  :disabled="showEdit"
-                    v-model="editConfig.infomation.inspectionScale"
+                  :disabled="!showFooter"
+                    v-model="editConfig.infomation.name"
                     placeholder="璇疯緭鍏�"
                   ></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="24">
-                <el-form-item label="涓婄骇浣嶇疆" prop="client_name">
-                  <el-input
-                  :disabled="showEdit"
-                    v-model="editConfig.infomation.inspectionScale"
-                    placeholder="璇疯緭鍏�"
-                  ></el-input>
+                <el-form-item label="涓婄骇浣嶇疆" prop="parentId">
+                  <el-select
+                    v-model="editConfig.infomation.parentId"
+                    placeholder="璇烽�夋嫨"
+                    size="mini"
+                    style="width: 45%"
+                    :disabled="!showFooter"
+                  >
+                    <el-option
+                      v-for="item in positionList"
+                      :key="item.id"
+                      :label="item.name"
+                      :value="item.id"
+                    >
+                    </el-option>
+                  </el-select>
                 </el-form-item>
               </el-col>
             </el-row>
@@ -62,80 +71,96 @@
           <div class="bottom">
               <div class="left">
                 <div class="second-label">鍏朵粬淇℃伅</div>
-                <el-form-item label="浣嶇疆绫诲瀷" prop="desc">
+                <el-form-item label="浣嶇疆绫诲瀷" prop="type">
                   <el-select
-                   v-model="editConfig.value1"
+                   v-model="editConfig.infomation.type"
                     filterable
-                    :disabled="showEdit"
-                    clearable
+                    :disabled="!showFooter"
                     placeholder="璇烽�夋嫨"
                     style="width: 100%"
                     no-data-text="鏆傛棤鏁版嵁"
                   >
                     <el-option
-                      v-for="item in wareList"
+                      v-for="item in positionTypeList"
                       :key="item.id"
                       :label="item.name"
                       :value="item.id"
                     >
                     </el-option>
                   </el-select>
-                </el-form-item>
-                <el-form-item label="鏄竴涓姤搴熶綅缃�" prop="desc">
+                </el-form-item> 
+                <el-form-item label="鏄竴涓姤搴熶綅缃�" v-if="editConfig.infomation.type==3||editConfig.infomation.type==5" prop="isScrapLocation">
                   <el-checkbox
-                  :disabled="showEdit"
-                  v-model="editConfig.value2"
+                  :disabled="!showFooter"
+                  v-model="editConfig.infomation.isScrapLocation"
                   >
                   </el-checkbox>
                 </el-form-item>
-                <el-form-item label="鏄竴涓��鍥炰綅缃�" prop="desc">
+                <el-form-item label="鏄竴涓��鍥炰綅缃�" prop="isReturnLocation">
                   <el-checkbox
-                  :disabled="showEdit"
-                  v-model="editConfig.value2"
+                  :disabled="!showFooter"
+                  v-model="editConfig.infomation.isReturnLocation"
                   >
                   </el-checkbox>
                 </el-form-item>
-                <el-form-item label="琛ュ厖浣嶇疆" prop="desc">
+                <el-form-item label="琛ュ厖浣嶇疆" v-if="editConfig.infomation.type==3" prop="replenishLocation">
                   <el-checkbox
-                  :disabled="showEdit"
-                  v-model="editConfig.value2"
+                  :disabled="!showFooter"
+                  v-model="editConfig.infomation.replenishLocation"
                   >
                   </el-checkbox>
                 </el-form-item>
               </div>
-              <div class="left">
+              <div class="left" v-if="editConfig.infomation.type==3||editConfig.infomation.type==7">
                 <div class="second-label">寰幆璁℃暟</div>
-                <el-form-item label="鐩樼偣棰戠巼锛堝ぉ锛�" prop="desc">
+                <el-form-item label="鐩樼偣棰戠巼锛堝ぉ锛�" prop="countFrequency">
                   <el-input
-                    :disabled="showEdit"
-                    v-model="editConfig.infomation.inspectionScale"
+                   :disabled="!showFooter"
+                    v-model="editConfig.infomation.countFrequency"
                     placeholder="璇疯緭鍏�"
                   ></el-input>
                 </el-form-item>
-                <el-form-item label="鏈�杩戞湁鏁堢洏鐐�" prop="desc">
-                  <el-input
-                    :disabled="showEdit"
-                    v-model="editConfig.infomation.inspectionScale"
-                    placeholder="璇疯緭鍏�"
-                  ></el-input>
+                <el-form-item label="鏈�杩戞湁鏁堢洏鐐�" prop="recentlyCount">
+                  <el-date-picker
+                   :disabled="!showFooter"
+                    v-model="editConfig.infomation.recentlyCount"
+                    type="date"
+                    placeholder="閫夋嫨鏃ユ湡"
+                    value-format="yyyy-MM-dd"
+                  >
+                  </el-date-picker>
                 </el-form-item>
-                <el-form-item label="棰勮涓嬩竴娆$洏鐐�" prop="desc">
-                  <el-input
-                    :disabled="showEdit"
-                    v-model="editConfig.infomation.inspectionScale"
-                    placeholder="璇疯緭鍏�"
-                  ></el-input>
+                <el-form-item label="棰勮涓嬩竴娆$洏鐐�" prop="nextCount">
+                  <el-date-picker
+                   :disabled="!showFooter"
+                    v-model="editConfig.infomation.nextCount"
+                    type="date"
+                    placeholder="閫夋嫨鏃ユ湡"
+                    value-format="yyyy-MM-dd"
+                  >
+                  </el-date-picker>
                 </el-form-item>
               </div>
           </div>
+          <el-form-item label="" prop="notes" label-width="20px">
+                  <el-input
+                    :disabled="!showFooter"
+                      type="textarea"
+                      placeholder="澶栭儴澶囨敞"
+                      :autosize="{ minRows: 3, maxRows: 4 }"
+                      maxlength="500"
+                      clearable
+                      v-model="editConfig.infomation.notes"
+                  ></el-input>
+          </el-form-item>
           <div class="bottom">
-            <div class="left">
-                <div class="second-label">鐗╂祦</div>
-                <el-form-item label="涓嬭浇绛栫暐" prop="desc">
+            <!-- <div class="left"> -->
+                <!-- <div class="second-label">鐗╂祦</div> -->
+                <!-- <el-form-item label="涓嬭浇绛栫暐" prop="desc">
                   <el-select
                    v-model="editConfig.value1"
                     filterable
-                    :disabled="showEdit"
+                    :disabled="!showFooter"
                     clearable
                     placeholder="璇烽�夋嫨"
                     style="width: 100%"
@@ -149,18 +174,8 @@
                     >
                     </el-option>
                   </el-select>
-                </el-form-item>
-                <el-form-item label="澶栭儴澶囨敞" prop="desc">
-                  <el-input
-                     :disabled="showEdit"
-                      type="textarea"
-                      :autosize="{ minRows: 3, maxRows: 4 }"
-                      maxlength="500"
-                      clearable
-                      v-model="editConfig.value1"
-                  ></el-input>
-                </el-form-item>
-              </div>
+                </el-form-item> -->
+              <!-- </div> -->
           </div>
         </div>
       </el-form>
@@ -174,6 +189,8 @@
 </template>
 
 <script>
+import { addLocation,updateLocation,deleteLocation } from "@/api/warehouseManage/warehouse"
+import { getDataByType } from "@/api/data";
 export default {
   name: "AddScrapDialog",
   props: {
@@ -186,6 +203,9 @@
           infomation: {}
         }
       }
+    },
+    positionList:{
+      type:[Array]
     }
   },
   components: {},
@@ -195,57 +215,42 @@
       dialogWidth: "50%",
       editConfig: this.editCommonConfig,
       rules: {
-      
-        number: [{ required: true, message: "璇疯緭鍏ラ��娆惧崟缂栧彿", trigger: "blur" }],
-        refundDate: [{ required: true, message: "璇烽�夋嫨閫�娆炬棩鏈�", trigger: "change" }],
-        memberId: [{ required: true, message: "璇烽�夋嫨閿�鍞礋璐d汉", trigger: "change" }],
-        sale_return_nunber: [{ required: true, message: "璇烽�夋嫨閿�鍞��璐у崟", trigger: "change" }]
+        name: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }],
+        countFrequency: [{
+            required: false,
+            message: "璇峰~鍐欎笉灏忎簬0鐨勬暟瀛�",
+            trigger: "change",
+          },
+          {
+            validator: this.validatorNum,
+            trigger: "blur",
+          },],
       },
-      memberOptions: [],
-      paymentTypeListOptions: [],
       showEdit: false, // 鏄惁鏄剧ず缂栬緫鎸夐挳
       showFooter: false, // 鏄惁鏄剧ず鍙栨秷淇濆瓨
-      currentState: "todo", // 褰撳墠鐘舵��
-      wareList:[
-        {
-          name:'鐩存帴鎺ユ敹浜у搧锛�1姝ユ敹璐э級',
-          id:1,
-          disabled:false,
-        },
-        {
-          name:'鎺ュ埌浜у搧鍒版敹鏂欏尯锛屽啀鍏ュ簱锛�2姝ユ敹璐э級',
-          id:2,
-          disabled:true,
-        },
-        {
-          name:'鎺ユ敹浜у搧鍒版敹鏂欏尯锛屾楠岋紝鐒跺悗鍏ュ簱锛�3姝ユ敹璐э級',
-          id:3,
-          disabled:true,
-        }
-      ],
-      wareoutList:[
-        {
-          name:'鐩存帴鍑哄簱锛�1姝ワ級',
-          id:1,
-          disabled:false,
-        },
-        {
-          name:'閫佸埌寰呭嚭搴撳尯锛屽啀閫佽揣锛�2姝ュ彂璐э級',
-          id:2,
-          disabled:true,
-        },
-        {
-          name:'鍖呰浜у搧锛屽彂閫佸埌寰呭嚭搴撳尯锛屽啀閫佽揣锛�3姝ュ彂璐э級',
-          id:3,
-          disabled:true,
-        }
-      ],
+      positionTypeList: getDataByType("positionType"),
     }
   },
   created() {
     this.setBottonView()
   },
   methods: {
+    validatorNum(rule, value, callback) {
+      if (value) {
+        if (value == undefined || value == null) {
+          callback(new Error("璇疯緭鍏ユ湁鏁堟暟瀛�"));
+        } else {
+          var reg = /^\+?[0-9]\d*$/;
+          if (!reg.test(value)) {
+            callback(new Error("璇峰~鍐欎笉灏忎簬0鐨勬暟瀛�"));
+          } else {
+            callback();
+          }
+        }
+      } else {
+        callback();
+      }
+    },
     // 璺嚎
     productClick() {
       
@@ -267,13 +272,76 @@
     handleClose() {
       this.editConfig.visible = false
     },
+    // 鍒櫎
+    deleteClick() {
+      let data = JSON.parse(JSON.stringify(this.editConfig.infomation));
+      deleteLocation({ id: data.id }).then((res) => {
+        if (res.code == 200) {
+          this.editConfig.visible = false;
+          this.$message.success("鍒櫎鎴愬姛!");
+          this.$emit("refresh");
+        } else {
+            this.$message.warning(res.msg?res.msg:"鍒犻櫎澶辫触!")
+         }
+      });
+    },
     // 缂栬緫
     editClick() {
       this.showEdit = false
       this.showFooter = true
     },
+    saveParams() {
+      let data =JSON.parse(JSON.stringify(this.editConfig.infomation));
+      
+      let params = {
+        name:data.name,
+        parentId:data.parentId+'',
+        type:data.type,
+        isScrapLocation:data.isScrapLocation,
+        isReturnLocation:data.isReturnLocation,
+        replenishLocation:data.replenishLocation,
+        countFrequency:data.countFrequency?Number(data.countFrequency):0,
+        recentlyCount:data.recentlyCount,
+        nextCount:data.nextCount,
+        notes:data.notes,
+      }
+      if(data.id){
+        params.id=data.id
+      }
+      return params;
+    },
     // 淇濆瓨
-    saveClick() {}
+    saveClick(formName) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          const params = this.saveParams();
+            if (this.editConfig.title === "鏂板缓") {
+              addLocation(params).then((res) => {
+                if (res.code == 200) {
+                  this.editConfig.visible = false;
+                  this.$message.success("娣诲姞鎴愬姛!");
+                  this.$emit('refresh')
+                } else {
+                    this.$message.warning(res.msg?res.msg:"娣诲姞澶辫触!")
+                }
+              });
+            } else {
+              updateLocation(params).then((res) => {
+                if (res.code == 200) {
+                  this.editConfig.visible = false;
+                  this.$message.success("缂栬緫鎴愬姛!");
+                  this.$emit('refresh')
+                } else {
+                    this.$message.warning(res.msg?res.msg:"缂栬緫澶辫触!")
+                }
+              });
+            }
+        }else {
+          console.log("error submit");
+          return false;
+        }
+      });
+    }
   }
 }
 </script>
diff --git a/src/views/warehouseManage/position/index.vue b/src/views/warehouseManage/position/index.vue
index fe6eb63..5a562a0 100644
--- a/src/views/warehouseManage/position/index.vue
+++ b/src/views/warehouseManage/position/index.vue
@@ -23,16 +23,15 @@
       </div>
     </div>
     <!-- 鏂板缓/缂栬緫 -->
-    <AddDialog v-if="editConfig.visible" :edit-common-config="editConfig" />
+    <AddDialog v-if="editConfig.visible" @refresh="refresh" :positionList="tableList.tableInfomation" :edit-common-config="editConfig" />
   </div>
 </template>
 
 <script>
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
-import { getProductList } from "@/api/product/product"
-// import DetailProduct from "@/views/productManage/product/DetailProduct"
+import { getLocationList } from "@/api/warehouseManage/warehouse"
 import AddDialog from "@/views/warehouseManage/position/AddDialog"
-
+import { getDataByType } from "@/api/data";
 export default {
   name: "WarehouseView",
   props: {},
@@ -47,7 +46,8 @@
         visible: false,
         title: "鏂板缓",
         infomation: {}
-      }
+      },
+      positionTypeList: getDataByType("positionType"),
     }
   },
   created() {
@@ -77,57 +77,82 @@
       let tableColumn = [
         {
           label: "浣嶇疆",
-          prop: "id",
+          prop: "jointName",
           isShowColumn: true,
           default: true
         },
         {
           label: "浣嶇疆绫诲瀷",
-          prop: "deviceName",
+          prop: "type",
           isShowColumn: true,
-          default: true
+          default: true,
+          conversion: true,
+          getStatus: this.getTypesList,
         }
       ]
       return tableColumn
+    },
+    getTypesList(val){
+      let string='--'
+      if(val){
+        for (let i in this.positionTypeList) {
+          if (this.positionTypeList[i].id == val) {
+            return this.positionTypeList[i].name;
+          }
+        }
+      }
+      return string;
     },
     selTableCol(val) {
       this.showcol = val
       this.tableList.tableColumn = this.setTableColumn(val)
     },
     // 璇锋眰鏁版嵁
-    async getData(val, content) {
-      await getProductList({
-        [val]: content,
+    async getData() {
+      await getLocationList({
+        keyword: this.keyword,
         page: this.pagerOptions.currPage,
         pageSize: this.pagerOptions.pageSize
       }).then((res) => {
-        if (res.data.code === 200) {
-          const list = res.data.data.list.map((item) => {
-            return {
-              ...item,
-              supplierNumber: item.supplier.number,
-              status: "鑽夌",
-              preTime: "2023-09-04 11:20:00"
-            }
-          })
-          this.tableList.tableInfomation = list || []
-          this.pagerOptions.totalCount = res.data.data.total
+        if (res.code === 200) {
+          const list = res.data?res.data:[]
+          this.tableList.tableInfomation = list
+          this.pagerOptions.totalCount = res.total
         }
       })
     },
+    refresh(){
+      this.pagerOptions.currPage=1
+      this.getData()
+    },
     // 鎼滅储
     getList(val) {
-      console.log(val)
+      this.keyword=val;
+      this.pagerOptions.currPage=1
+      this.getData()
     },
     // 琛岀偣鍑�
     tableRowClick(row) {
       console.log(row)
-      this.editConfig.visible = true
       this.editConfig.title = "缂栬緫"
       this.editConfig.infomation = { ...row }
+      this.editConfig.infomation.parentId=Number(this.editConfig.infomation.parentId);
+      this.editConfig.visible = true
     },
     // 鏂板缓
     addBtnClick() {
+      this.editConfig.infomation={
+        name:'',
+        parentId:null,
+        type:3,
+        isScrapLocation:null,
+        isReturnLocation:null,
+        replenishLocation:null,
+        countFrequency:0,
+        recentlyCount:'',
+        nextCount:'',
+        notes:'',
+      }
       this.editConfig.visible = true
       this.editConfig.title = "鏂板缓"
     }
diff --git a/src/views/warehouseManage/warehouse/AddDialog.vue b/src/views/warehouseManage/warehouse/AddDialog.vue
index 662ca4c..8b1bb89 100644
--- a/src/views/warehouseManage/warehouse/AddDialog.vue
+++ b/src/views/warehouseManage/warehouse/AddDialog.vue
@@ -180,9 +180,11 @@
       deleteWarehouse({ id: data.id }).then((res) => {
         if (res.code === 200) {
           this.editConfig.visible = false;
-          this.$message.success("鍒櫎鎴愬姛");
+          this.$message.success("鍒櫎鎴愬姛!");
           this.$emit("refresh");
-        }
+        }else {
+                    this.$message.warning(res.msg?res.msg:"鍒櫎澶辫触!")
+                }
       });
     },
     // 缂栬緫
@@ -215,16 +217,20 @@
               addWarehouse(params).then((res) => {
                 if (res.code === 200) {
                   this.editConfig.visible = false;
-                  this.$message.success("娣诲姞鎴愬姛");
+                  this.$message.success("娣诲姞鎴愬姛!");
                   this.$emit('refresh')
+                }else {
+                    this.$message.warning(res.msg?res.msg:"娣诲姞澶辫触!")
                 }
               });
             } else {
               updateWarehouse(params).then((res) => {
                 if (res.code === 200) {
                   this.editConfig.visible = false;
-                  this.$message.success("缂栬緫鎴愬姛");
+                  this.$message.success("缂栬緫鎴愬姛!");
                   this.$emit('refresh')
+                }else {
+                    this.$message.warning(res.msg?res.msg:"缂栬緫澶辫触!")
                 }
               });
             }
diff --git a/src/views/warehouseManage/warehouse/index.vue b/src/views/warehouseManage/warehouse/index.vue
index 832163d..41e432b 100644
--- a/src/views/warehouseManage/warehouse/index.vue
+++ b/src/views/warehouseManage/warehouse/index.vue
@@ -82,7 +82,7 @@
         },
         {
           label: "搴撳瓨浣嶇疆",
-          prop: "deviceName",
+          prop: "warehouseLocation",
           isShowColumn: true,
           default: true
         },
@@ -125,21 +125,21 @@
     },
     // 琛岀偣鍑�
     tableRowClick(row) {
-      this.editConfig.visible = true
       this.editConfig.title = "缂栬緫"
       this.editConfig.infomation = { ...row }
+      this.editConfig.visible = true
     },
     // 鏂板缓
     addBtnClick() {
-      this.editConfig.visible = true
       this.editConfig.infomation={
         address:'',
-        buyToResupply:'',
+        buyToResupply:null,
         code:'',
         name:'',
         inboundTransportation:1,
         outboundTransportation:1,
       }
+      this.editConfig.visible = true
       this.editConfig.title = "鏂板缓"
     }
   }

--
Gitblit v1.8.0