gjy 4 роки тому
батько
коміт
b338416970

+ 59 - 45
src/views/warehouse/warehouseManagementDelete.vue

@@ -3,7 +3,7 @@
   <div class="homepage">
     <el-row>
       <el-col :span="20">
-        <h2 class="bg-left title">删除库</h2>
+        <h2 class="bg-left title">删除库</h2>
       </el-col>
       <el-col :span="4" class="bg-right">
         <el-button
@@ -35,18 +35,41 @@
           </template>
         </el-table-column>
         <el-table-column prop="warehouseName" label="仓库名称">
-
         </el-table-column>
-        <el-table-column prop="warehousePrivate" label="仓库所在地">
-          <template scope="scope">
-            {{scope.row.warehousePrivate}}{{scope.row.warehouseCity}}{{scope.row.warehouseArea}}
-          </template>
+        <el-table-column prop="warehouseLocation" label="仓库所在地">
         </el-table-column>
-        <el-table-column prop="residual" label="应余库存(吨)">
+        <el-table-column prop="nowStorage" label="应余库存(吨)">
         </el-table-column>
-        <el-table-column prop="personCharge" label="负责人"> </el-table-column>
-
+        <el-table-column prop="personCharge;" label="负责人"></el-table-column>
         <el-table-column prop="address" label="操作" width="200">
+          <!-- <template slot-scope="scope">
+            <ws-button
+              type="primary"
+              @click="handleHide(scope.row)"
+              v-hasPermission="
+                `${$permission('PERMISSIONS.PURSPAPPLINFO_CREATEINSTORE')}`
+              "
+              v-if="scope.row.showFlag == 0"
+              >显示</ws-button
+            >
+            <ws-button
+              type="primary"
+              @click="handleHide(scope.row)"
+              v-hasPermission="
+                `${$permission('PERMISSIONS.PURSPAPPLINFO_CREATEINSTORE')}`
+              "
+              v-if="scope.row.showFlag == 1"
+              >隐藏</ws-button
+            >
+            <ws-button
+              type="primary"
+              @click="handleDelete(sv-ifcope.row)"
+              v-hasPermission="
+                `${$permission('PERMISSIONS.PURSPAPPLINFO_CREATEINSTORE')}`
+              "
+              >删除</ws-button
+            >
+          </template> -->
           <template slot-scope="scope">
             <div
               class="record"
@@ -71,6 +94,7 @@
 </template>
 <script>
 import {
+  getList,
   delectlist,
   deletewarehouse,
   hide,
@@ -167,41 +191,6 @@ export default {
     handleCloe() {
       this.dialogViewSpareMoney = false
     },
-    //删除
-    handleDelete(row) {
-      if(row.residual == 0){
-    // console.log(row)
-    this.$confirm(`此操作永久删除该仓库全部信息,是否确认删除`, {
-      cancelButtonText: '取消',
-      confirmButtonText: '确定',
-      type: 'warning',
-    })
-      .then(() => {
-        deletewarehouse({ id: row.id })
-          .toPromise()
-          .then((response) => {
-            this.$notify.success({
-              title: '成功',
-              message: '删除成功',
-            })
-            this.getList()
-          })
-          .catch((response) => {
-            // console.log(3333)
-            // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
-          })
-      })
-      .catch(() => {
-        return false
-      })
-      }else{
-         this.$message({
-            message: '还有应余库存,不能删除此仓库!',
-            type: 'warning',
-          })
-          return
-      }
-  },
     //隐藏
     handleHide(row) {
       if (row.showFlag == 1) {
@@ -245,7 +234,32 @@ export default {
       }
     },
   },
-  
+  handleDelete(row) {
+    // console.log(row)
+    this.$confirm(`此操作永久删除该仓库全部信息,是否确认删除`, {
+      cancelButtonText: '取消',
+      confirmButtonText: '确定',
+      type: 'warning',
+    })
+      .then(() => {
+        deletewarehouse({ id: row.id })
+          .toPromise()
+          .then((response) => {
+            this.$notify.success({
+              title: '成功',
+              message: '删除成功',
+            })
+            this.getList()
+          })
+          .catch((response) => {
+            // console.log(3333)
+            // EventBus.$emit('error', this.$t('showMessage.asteriskRequired'))
+          })
+      })
+      .catch(() => {
+        return false
+      })
+  },
   // deletecontract(){},
   //删除
   approve() {},

+ 72 - 33
src/views/warehouse/warehouseManagementEdit.vue

@@ -16,6 +16,10 @@
     </el-row>
     <div>
       <ws-form ref="deptBudgetList" :model="deptBudgetList">
+        <el-radio-group v-model="warehouseType" @change="warehouseTypechange">
+          <el-radio label="1">自有库</el-radio>
+          <el-radio label="2">临时库</el-radio>
+        </el-radio-group>
         <div class="small-title">基本信息</div>
         <!--基本信息-->
         <ws-info-table>
@@ -87,14 +91,19 @@
             />
           </ws-form-item>
           <!--总储量(吨)-->
-          <ws-form-item label="总储量(吨)" span="1" prop="totalStorage">
+          <ws-form-item
+            v-if="warehouseType == 1"
+            label="总储量(吨)"
+            span="1"
+            prop="totalStorage"
+          >
             <!-- <ws-input
               v-model="deptBudgetList.totalStorage"
               placeholder="请输入总储量(吨)"
               maxlength="20"
               size="small"
             /> -->
-            {{totalStorage}}
+            {{ totalStorage }}
           </ws-form-item>
         </ws-info-table>
         <div v-for="(item, index) in deptBudgetList.warehousePositionInfoList">
@@ -146,8 +155,9 @@
         </div>
       </ws-form>
       <ws-form ref="deptBudgetList" :model="deptBudgetList">
-        <div class="small-title">上传仓库照片</div>
+        <div v-if="warehouseType == 1" class="small-title">上传仓库照片</div>
         <ws-upload
+          v-if="warehouseType == 1"
           ref="upload"
           table-name="maintain_work_order"
           oss-key="mainPlan"
@@ -227,6 +237,7 @@ export default {
       contractType: 2,
       startDate: null,
       endDate: null,
+      warehouseType: '1',
       unitList: [],
       baseId: '',
       // 提交类型
@@ -255,22 +266,32 @@ export default {
     this.loaddata()
     this.showType = this.isShow
   },
-computed : {
-   totalStorage :function() {
-     var sum  = 0
-     if(this.deptBudgetList.warehousePositionInfoList){
-       for(var i = 0;i < this.deptBudgetList.warehousePositionInfoList.length; i++ ){
-      sum += Number(this.deptBudgetList.warehousePositionInfoList[i].maxStorage)
-     }
-     }    
-     return sum
+  computed: {
+    totalStorage: function () {
+      var sum = 0
+      if (this.deptBudgetList.warehousePositionInfoList) {
+        for (
+          var i = 0;
+          i < this.deptBudgetList.warehousePositionInfoList.length;
+          i++
+        ) {
+          sum += Number(
+            this.deptBudgetList.warehousePositionInfoList[i].maxStorage
+          )
+        }
+      }
+      return sum
     },
-},
+  },
   methods: {
     //返回按钮
     returnWarehouse() {
       this.deptBudgetList = {}
-      this.$router.push({ path: 'warehouseManagementList' })   
+      this.$router.push({ path: 'warehouseManagementList' })
+    },
+    warehouseTypechange() {
+      this.deptBudgetList = {}
+      this.loaddata()
     },
     marker: function (item) {
       this.deptBudgetList.warehousePositioning =
@@ -351,7 +372,10 @@ computed : {
     },
     loaddata() {
       // 仓库名称
-      xiala({ compId: sessionStorage.getItem('ws-pf_compId') })
+      xiala({
+        compId: sessionStorage.getItem('ws-pf_compId'),
+        warehouseType: this.warehouseType,
+      })
         .toPromise()
         .then((response) => {
           this.packtypeList = response
@@ -391,21 +415,24 @@ computed : {
 
     //提交
     submit() {
-       if(!this.deptBudgetList.warehouseName){
+      if (!this.deptBudgetList.warehouseName) {
         this.$message({
           message: '仓库名称不能为空!',
           type: 'warning',
         })
         return
       }
-      if(this.deptBudgetList.warehouseName.length < 2 || this.deptBudgetList.warehouseName.length > 20){
+      if (
+        this.deptBudgetList.warehouseName.length < 2 ||
+        this.deptBudgetList.warehouseName.length > 20
+      ) {
         this.$message({
           message: '仓库名长度不符合要求!',
           type: 'warning',
         })
         return
       }
-       if(!this.deptBudgetList.personCharge){
+      if (!this.deptBudgetList.personCharge) {
         this.$message({
           message: '负责人不能为空!',
           type: 'warning',
@@ -422,35 +449,37 @@ computed : {
         })
         return
       }
-       if(!this.deptBudgetList.personPhone){
+      if (!this.deptBudgetList.personPhone) {
         this.$message({
           message: '负责人电话不能为空!',
           type: 'warning',
         })
         return
       }
-      if(this.deptBudgetList.personPhone.length != 11){
+      if (this.deptBudgetList.personPhone.length != 11) {
         this.$message({
           message: '手机号输入有误!',
           type: 'warning',
         })
         return
       }
-       if(!this.deptBudgetList.detailedAddress){
+      if (!this.deptBudgetList.detailedAddress) {
         this.$message({
           message: '详细地址不能为空!',
           type: 'warning',
         })
         return
       }
-      
-      if(this.totalStorage <= 0){
-        this.$message({
-          message: '仓位储量不能为空!',
-          type: 'warning',
-        })
-        return
+      if (this.warehouseType == 1) {
+        if (this.totalStorage <= 0) {
+          this.$message({
+            message: '仓位储量不能为空!',
+            type: 'warning',
+          })
+          return
+        }
       }
+
       if (
         this.deptBudgetList.detailedAddress.length < 2 ||
         this.deptBudgetList.detailedAddress.length > 20
@@ -461,14 +490,23 @@ computed : {
         })
         return
       }
-       for (var i = 0; i < this.deptBudgetList.warehousePositionInfoList.length; i++) {
-        for (var j = i + 1; j < this.deptBudgetList.warehousePositionInfoList.length; j++) {
+      for (
+        var i = 0;
+        i < this.deptBudgetList.warehousePositionInfoList.length;
+        i++
+      ) {
+        for (
+          var j = i + 1;
+          j < this.deptBudgetList.warehousePositionInfoList.length;
+          j++
+        ) {
           console.log(
             this.deptBudgetList.warehousePositionInfoList[i].binNumber,
             this.deptBudgetList.warehousePositionInfoList[j].binNumber
           )
           if (
-            this.deptBudgetList.warehousePositionInfoList[i].binNumber == this.deptBudgetList.warehousePositionInfoList[j].binNumber
+            this.deptBudgetList.warehousePositionInfoList[i].binNumber ==
+            this.deptBudgetList.warehousePositionInfoList[j].binNumber
           ) {
             this.$message({
               message: '仓位编号重复',
@@ -480,14 +518,15 @@ computed : {
       }
       this.$refs.deptBudgetList.validate((valid) => {
         if (valid) {
+          this.deptBudgetList.warehouseType = this.warehouseType
           this.deptBudgetList.baseId = this.baseId
           this.deptBudgetList.compId = this.compId
           this.deptBudgetList.contractType = 1
           edit(this.deptBudgetList)
             .toPromise()
             .then((response) => {
-              this.$message.success('编辑成功')     
-                            this.deptBudgetList = {}
+              this.$message.success('编辑成功')
+              this.deptBudgetList = {}
               this.$router.push({ path: 'warehouseManagementList' })
             })
         } else {

+ 1 - 1
src/views/warehouse/warehouseManagementList.vue

@@ -78,7 +78,7 @@
         style="width: 100%; margin-top: 20px"
         height="780"
       >
-        <el-table-column prop="warehouseName" label="库名" width="80">
+        <el-table-column prop="warehouseName" label="库名" width="80">
         </el-table-column>
         <el-table-column prop="binNumber" label="仓位编号" width="80">
         </el-table-column>

+ 23 - 4
src/views/warehouse/warehouseManagementLook.vue

@@ -21,6 +21,10 @@
       </el-col>
     </el-row>
     <div class="center">
+      <el-radio-group v-model="warehouseType" @change="warehouseTypechange">
+        <el-radio label="1">自有库</el-radio>
+        <el-radio label="2">临时库</el-radio>
+      </el-radio-group>
       <ws-form ref="deptBudgetList" :model="deptBudgetList">
         <div class="small-title">基本信息</div>
         <!--基本信息-->
@@ -75,7 +79,12 @@
             {{ deptBudgetList.detailedAddress }}
           </ws-form-item>
           <!--总储量(吨)-->
-          <ws-form-item label="总储量(吨)" span="1" prop="totalStorage">
+          <ws-form-item
+            v-show="warehouseType == 1"
+            label="总储量(吨)"
+            span="1"
+            prop="totalStorage"
+          >
             {{ totalStorage }}
           </ws-form-item>
         </ws-info-table>
@@ -101,7 +110,11 @@
               {{ item.maxStorage }}
             </ws-form-item>
             <!--现有储量-->
-            <ws-form-item :label='"现有储量("+item.nowStorage+"吨)"' span="1" prop="detailStorage" >
+            <ws-form-item
+              :label="'现有储量(' + item.nowStorage + '吨)'"
+              span="1"
+              prop="detailStorage"
+            >
               {{ item.detailStorage }}
             </ws-form-item>
             <!--备注(选填)-->
@@ -143,7 +156,6 @@ export default {
     isShow(val) {
       this.showType = val
     },
- 
   },
   data() {
     return {
@@ -167,6 +179,7 @@ export default {
       startDate: null,
       endDate: null,
       unitList: [],
+      warehouseType: '1',
       // 提交类型
       submitType: true,
       size: 10,
@@ -217,6 +230,9 @@ export default {
       this.$router.push({ path: 'warehouseManagementList' })
       this.deptBudgetList = {}
     },
+    warehouseTypechange() {
+      this.loaddata()
+    },
     dateFormat(fmt, date) {
       let ret
       const opt = {
@@ -262,7 +278,10 @@ export default {
     },
     loaddata() {
       // 仓库名称
-      xiala({ compId: sessionStorage.getItem('ws-pf_compId') })
+      xiala({
+        compId: sessionStorage.getItem('ws-pf_compId'),
+        warehouseType: this.warehouseType,
+      })
         .toPromise()
         .then((response) => {
           this.packtypeList = response