chris vor 2 Jahren
Ursprung
Commit
53c1187912
2 geänderte Dateien mit 27 neuen und 4 gelöschten Zeilen
  1. 26 3
      src/views/modules/production/equipment.vue
  2. 1 1
      src/views/modules/works/work.vue

+ 26 - 3
src/views/modules/production/equipment.vue

@@ -125,11 +125,11 @@
           fixed="right"
           header-align="center"
           align="center"
-          width="180"
+          width="120"
           label="操作">
           <template slot-scope="scope">
             <el-button v-if="isAuth('prod:equipment:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id, false)">编辑</el-button>
-            <el-button v-if="isAuth('prod:equipment:updateState')" type="text" size="small" @click="damaged(scope.row.id)">报损</el-button>
+            <el-button v-if="isAuth('prod:equipment:updateState') && Number(scope.row.state) < 3" type="text" size="small" @click="damaged(scope.row.id)">报损</el-button>
   <!--          <el-button v-if="isAuth('prod:equipment:record')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id, true)">点检记录</el-button>-->
           </template>
         </el-table-column>
@@ -247,7 +247,30 @@
       },
       // 报损
       damaged (id) {
-        // todo
+        if (!id) return
+        this.$confirm(`确定报损?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.$http({
+            url: this.$http.adornUrl(`/biz-service/equipment/updateState/${id}`),
+            method: 'POST'
+          }).then(({data}) => {
+            if (data && data.code === '200') {
+              this.$message({
+                message: '操作成功',
+                type: 'success',
+                duration: 1500,
+                onClose: () => {
+                  this.getDataList()
+                }
+              })
+            } else {
+              this.$message.error(data.msg)
+            }
+          })
+        }).catch(() => {})
       },
       // 转换属性“状态”
       formatState (row) {

+ 1 - 1
src/views/modules/works/work.vue

@@ -440,7 +440,7 @@
           ></el-input>
         </el-form-item>
       </el-form>
-      <div slot="footer" class="dialog-footer">
+      <div slot="footer">
         <el-button @click="finishDialogFormVisible = false">取 消</el-button>
         <el-button type="primary" @click="finishSubmit">确 定</el-button>
       </div>