瀏覽代碼

物料档案-新增维护新版本操作判断,以及新版本维护只允许修改批号及库存状态管理、序列号管理并进行保存

002390 2 年之前
父節點
當前提交
1d583c9047
共有 1 個文件被更改,包括 50 次插入12 次删除
  1. 50 12
      src/views/material/basicFile/details.vue

+ 50 - 12
src/views/material/basicFile/details.vue

@@ -9,7 +9,10 @@
       <el-row :gutter="10" class="mb10" v-if="updateButtonGroup || maintainNewVersion">
         <el-col :span="1.5">
           <el-button-group>
-            <el-button size="small" @click="handleSave" v-hasPermi="['system:material:add']">保存</el-button>
+            <el-button size="small" @click="handleSave"
+              v-hasPermi="['system:material:add', `${maintainNewVersion ? '' : 'system:material:versions'}`]">
+              保存
+            </el-button>
           </el-button-group>
         </el-col>
 
@@ -52,11 +55,11 @@
         </el-col>
 
         <!-- 维护新版本 -->
-      <!-- <el-col :span="1.5">
+        <el-col :span="1.5">
           <el-button-group>
-            <el-button size="small" @click="handleNewVersion">维护新版本</el-button>
+            <el-button size="small" @click="handleNewVersion" v-hasPermi="['system:material:versions']">维护新版本</el-button>
           </el-button-group>
-          </el-col> -->
+        </el-col>
 
       </el-row>
 
@@ -86,7 +89,7 @@
         <el-col :span="6" style="text-align: right;">
           <!-- 附件管理 -->
         <!-- <el-button-group>
-                                                              <el-button size="small" icon="el-icon-paperclip" @click="handleFile"></el-button></el-button-group> -->
+                                                                                                                  <el-button size="small" icon="el-icon-paperclip" @click="handleFile"></el-button></el-button-group> -->
 
           <!-- 切换 -->
         <!-- <el-button-group>
@@ -97,7 +100,7 @@
             <el-button size="small" icon="el-icon-arrow-right" :disabled="!handleBasicEdit"
               @click="handleChangePage('next')" />
             <el-button size="small" icon="el-icon-d-arrow-right" :disabled="!handleBasicEdit"
-                                                            @click="handleChangePage('end')" /></el-button-group> -->
+                                                                                                                @click="handleChangePage('end')" /></el-button-group> -->
         </el-col>
       </el-row>
 
@@ -407,7 +410,7 @@
               :disabled="!(materialType.isEdit && mt.edit)" v-model="scope.row[mt.prop]" :key="scope.row[mt.prop]">
               <el-option v-if="mt.dictId" v-for="d in mt.dictId" :key="d.dictValue" :label="d.dictLabel"
                 :value="d.dictValue">
-                                                                          </el-option></el-select> -->
+                                                                                                                              </el-option></el-select> -->
 
             <!-- 其他类型 -->
             <el-input v-else size="small" v-model="scope.row[mt.prop]" :readonly="!(materialType.isEdit && mt.edit)" />
@@ -739,9 +742,12 @@ export default {
   methods: {
     // 判断效期管理
     handleJudge(attribute) {
-
+      // 维护新版本才能修改:批号及库存状态管理(isInventoryStatus)、序列号管理(serialNoManager)
+      if (attribute.prop == 'isInventoryStatus' || attribute.prop == 'serialNoManager') {
+        return !(this.maintainNewVersion && attribute.edit);
+      }
       // 批号及库存状态管理(isInventoryStatus) 控制 效期管理是否展示(expiryDateManagerment)
-      if (attribute.prop == 'expiryDateManagerment') {
+      else if (attribute.prop == 'expiryDateManagerment') {
 
         if (this.basicData.value['isInventoryStatus'] == '2') this.basicData.value['expiryDateManagerment'] = '2';
 
@@ -1473,8 +1479,35 @@ export default {
     },
     // 维护新版本
     handleNewVersion() {
-      console.log('维护新版本');
-      this.maintainNewVersion = true;
+      let _this = this;
+      let data = {
+        // 物料编码
+        code: this.basicData.value.code
+      }
+      materialApi.versions(data).then(res => {
+        console.log(res, '维护新版本');
+        if (res.code == 200) {
+          _this.maintainNewVersion = res.data.result;
+        }
+      })
+    },
+    // 维护物料保存
+    handleSaveNewVersion(cb) {
+      let data = {
+        // 物料编码
+        materialCode: this.basicData.value.code,
+        //序列号管理; 2= 否,0= 是	
+        serialNoManager: this.basicData.value.serialNoManager,
+        // 批号及库存状态管理;2=否,0=是
+        isInventoryStatus: this.basicData.value.isInventoryStatus,
+      }
+      materialApi.saveVersions(data).then(res => {
+        console.log(res, '维护物料保存');
+        this.loading = false;
+        if (res.code == 200) {
+          cb();
+        }
+      })
     },
     // 取消保存
     handleCancel() {
@@ -1485,6 +1518,7 @@ export default {
     // 保存修改
     handleSave() {
       console.log('保存修改');
+      this.loading = true;
       // 普通保存修改
       this.updateButtonGroup && this.handleSaveMaterial(() => {
         this.updateButtonGroup = false;
@@ -1492,7 +1526,10 @@ export default {
       });
 
       // 维护新版本保存修改
-      this.maintainNewVersion && console.log('维护新版本保存修改');
+      this.maintainNewVersion && this.handleSaveNewVersion(() => {
+        this.maintainNewVersion = false;
+        this.handleRefresh();
+      })
     },
     // 物料类别列表选中
     handleSelectionType(list) {
@@ -1877,6 +1914,7 @@ export default {
       param.diCode = param.diCode.replace(/ /g, '');
       console.log(param, '保存物料以及相关页签param');
       materialApi.insertMaterialInfo(param).then(res => {
+        this.loading = false;
         console.log(res, '保存物料以及相关页签');
         if (res.code == 200) cb();
       })