Преглед изворни кода

【修改】零售发货申请单计划单限制操作

howie пре 2 година
родитељ
комит
8f7edaac5a
1 измењених фајлова са 24 додато и 8 уклоњено
  1. 24 8
      src/views/supply/apply/apply_list.vue

+ 24 - 8
src/views/supply/apply/apply_list.vue

@@ -194,7 +194,7 @@
             :summary-method="$getSummaries"
             @selection-change="handleSelectionChange"
           >
-            <el-table-column align="center" type="selection" width="55" fixed="left" />
+            <el-table-column align="center" type="selection" width="55" fixed="left" :selectable="selectable" />
             <el-table-column align="left" label="订单状态" prop="type" min-width="120" show-overflow-tooltip>
               <template slot-scope="scope">
                 {{ scope.row.automaticStatus ? '非计划单推发货' : '计划单推发货' }}
@@ -377,7 +377,7 @@
                 <el-popconfirm
                   v-if="
                     $checkBtnRole('apply', $route.meta.roles) &&
-                    scope.row.automaticStatus &&
+                    !scope.row.automaticStatus &&
                     scope.row.examineStatus === 'SAVE'
                   "
                   style="margin-right: 10px"
@@ -389,7 +389,7 @@
                 <el-popconfirm
                   v-if="
                     $checkBtnRole('apply', $route.meta.roles) &&
-                    scope.row.automaticStatus &&
+                    !scope.row.automaticStatus &&
                     scope.row.examineStatus === 'WAIT'
                   "
                   style="margin-right: 10px"
@@ -401,7 +401,7 @@
                 <el-popconfirm
                   v-if="
                     $checkBtnRole('examine', $route.meta.roles) &&
-                    scope.row.automaticStatus &&
+                    !scope.row.automaticStatus &&
                     scope.row.examineStatus === 'OK'
                   "
                   style="margin-right: 10px"
@@ -413,7 +413,7 @@
                 <el-button
                   v-if="
                     $checkBtnRole('edit', $route.meta.roles) &&
-                    scope.row.automaticStatus &&
+                    !scope.row.automaticStatus &&
                     (scope.row.examineStatus === 'SAVE' || scope.row.examineStatus === 'FAIL') &&
                     scope.row.type === 1
                   "
@@ -425,7 +425,7 @@
                 <el-button
                   v-if="
                     $checkBtnRole('edit', $route.meta.roles) &&
-                    scope.row.automaticStatus &&
+                    !scope.row.automaticStatus &&
                     (scope.row.examineStatus === 'SAVE' || scope.row.examineStatus === 'FAIL') &&
                     scope.row.type === 2
                   "
@@ -437,7 +437,7 @@
                 <el-button
                   v-if="
                     $checkBtnRole('examine', $route.meta.roles) &&
-                    scope.row.automaticStatus &&
+                    !scope.row.automaticStatus &&
                     scope.row.examineStatus === 'WAIT'
                   "
                   type="text"
@@ -449,7 +449,7 @@
                 <el-popconfirm
                   v-if="
                     $checkBtnRole('del', $route.meta.roles) &&
-                    scope.row.automaticStatus &&
+                    !scope.row.automaticStatus &&
                     scope.row.examineStatus !== 'OK'
                   "
                   style="margin-left: 10px"
@@ -812,6 +812,22 @@ export default {
       }).then(res => {
         this.categoryList = res.data.records
       })
+    },
+    /**
+     * 根据条件禁用行复选框
+     * 函数返回值为false则禁用选择(反之亦然)
+     * @param {Object} row - 行数据
+     * @param {String} index - 索引值
+     * @return Boolean
+     */
+    selectable: function (row, index) {
+      if (row.automaticStatus) {
+        return false
+      }
+      return true
+      // 函数必须有返回值且是布尔值
+      // 页面刷新后该函数会执行 N 次进行判断(N 为表格行数)
+      // 如果没有返回值则默认返回false(全部无法选中)
     }
   }
 }