修改状态
This commit is contained in:
		
							parent
							
								
									f29f1be8b3
								
							
						
					
					
						commit
						4b1b42d709
					
				| 
						 | 
					@ -52,6 +52,14 @@ export function editDevice(data) {
 | 
				
			||||||
      data: data,
 | 
					      data: data,
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					// 仓库管理--修改
 | 
				
			||||||
 | 
					export function editMachineStatus(data) {
 | 
				
			||||||
 | 
					  return request({
 | 
				
			||||||
 | 
					      url: '/material/ma_machine/editMachineStatus',
 | 
				
			||||||
 | 
					      method: 'put',
 | 
				
			||||||
 | 
					      data: data,
 | 
				
			||||||
 | 
					  })
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 仓库管理--新增
 | 
					// 仓库管理--新增
 | 
				
			||||||
export function addDevice(data) {
 | 
					export function addDevice(data) {
 | 
				
			||||||
| 
						 | 
					@ -93,5 +101,5 @@ export function editAssetsCode(data) {
 | 
				
			||||||
      url: '/material/ma_machine/editAssetsCode',
 | 
					      url: '/material/ma_machine/editAssetsCode',
 | 
				
			||||||
      method: 'post',
 | 
					      method: 'post',
 | 
				
			||||||
      data: data,
 | 
					      data: data,
 | 
				
			||||||
  }) 
 | 
					  })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -140,6 +140,15 @@
 | 
				
			||||||
          >
 | 
					          >
 | 
				
			||||||
            编辑
 | 
					            编辑
 | 
				
			||||||
          </el-button>
 | 
					          </el-button>
 | 
				
			||||||
 | 
					          <el-button
 | 
				
			||||||
 | 
					            size="mini"
 | 
				
			||||||
 | 
					            type="text"
 | 
				
			||||||
 | 
					            icon="el-icon-edit"
 | 
				
			||||||
 | 
					            @click="handleUpdateStatus(scope.row)"
 | 
				
			||||||
 | 
					            v-hasPermi="['ma:machine:edit']"
 | 
				
			||||||
 | 
					          >
 | 
				
			||||||
 | 
					            修改状态
 | 
				
			||||||
 | 
					          </el-button>
 | 
				
			||||||
          <!-- <el-button
 | 
					          <!-- <el-button
 | 
				
			||||||
              size="mini"
 | 
					              size="mini"
 | 
				
			||||||
              type="text"
 | 
					              type="text"
 | 
				
			||||||
| 
						 | 
					@ -361,7 +370,25 @@
 | 
				
			||||||
        <el-button @click="cancel">取 消</el-button>
 | 
					        <el-button @click="cancel">取 消</el-button>
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    </el-dialog>
 | 
					    </el-dialog>
 | 
				
			||||||
 | 
					    <!-- 设备状态修改对话框 -->
 | 
				
			||||||
 | 
					    <el-dialog title="修改设备状态" :visible.sync="statusUpdateOpen" width="500px" append-to-body>
 | 
				
			||||||
 | 
					      <el-form ref="statusFormRef" :model="statusForm" :rules="statusRules" label-width="80px">
 | 
				
			||||||
 | 
					        <el-form-item label="设备状态" prop="maStatus">
 | 
				
			||||||
 | 
					          <el-select v-model="statusForm.maStatus" placeholder="请选择设备状态" style="width: 100%">
 | 
				
			||||||
 | 
					            <el-option
 | 
				
			||||||
 | 
					              v-for="dict in dict.type.ma_machine_status"
 | 
				
			||||||
 | 
					              :key="dict.value"
 | 
				
			||||||
 | 
					              :label="dict.label"
 | 
				
			||||||
 | 
					              :value="dict.value"
 | 
				
			||||||
 | 
					            />
 | 
				
			||||||
 | 
					          </el-select>
 | 
				
			||||||
 | 
					        </el-form-item>
 | 
				
			||||||
 | 
					      </el-form>
 | 
				
			||||||
 | 
					      <div slot="footer" class="dialog-footer">
 | 
				
			||||||
 | 
					        <el-button @click="cancelStatusUpdate">取 消</el-button>
 | 
				
			||||||
 | 
					        <el-button type="primary" @click="submitStatusUpdate">确 定</el-button>
 | 
				
			||||||
 | 
					      </div>
 | 
				
			||||||
 | 
					    </el-dialog>
 | 
				
			||||||
    <!-- 二维码下载对话框 -->
 | 
					    <!-- 二维码下载对话框 -->
 | 
				
			||||||
    <el-dialog title="二维码查看" :visible.sync="uploadOpen" width="450px" append-to-body :close-on-click-modal="false">
 | 
					    <el-dialog title="二维码查看" :visible.sync="uploadOpen" width="450px" append-to-body :close-on-click-modal="false">
 | 
				
			||||||
      <div style="text-align: center" ref="codeQr" v-if="uploadOpen">
 | 
					      <div style="text-align: center" ref="codeQr" v-if="uploadOpen">
 | 
				
			||||||
| 
						 | 
					@ -407,6 +434,7 @@ import {
 | 
				
			||||||
  getListDevice,
 | 
					  getListDevice,
 | 
				
			||||||
  getDeviceDetail,
 | 
					  getDeviceDetail,
 | 
				
			||||||
  editDevice,
 | 
					  editDevice,
 | 
				
			||||||
 | 
					  editMachineStatus,
 | 
				
			||||||
  addDevice,
 | 
					  addDevice,
 | 
				
			||||||
  delDevice,
 | 
					  delDevice,
 | 
				
			||||||
  getDeviceType,
 | 
					  getDeviceType,
 | 
				
			||||||
| 
						 | 
					@ -503,7 +531,14 @@ export default {
 | 
				
			||||||
        // 上传的地址
 | 
					        // 上传的地址
 | 
				
			||||||
        url: process.env.VUE_APP_BASE_API + '/material/engineering/excelUpload'
 | 
					        url: process.env.VUE_APP_BASE_API + '/material/engineering/excelUpload'
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
 | 
					      statusUpdateOpen: false, // 状态修改对话框显示控制
 | 
				
			||||||
 | 
					      statusForm: { // 状态修改表单
 | 
				
			||||||
 | 
					        maId: null,
 | 
				
			||||||
 | 
					        maStatus: null
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      statusRules: { // 状态修改表单验证规则
 | 
				
			||||||
 | 
					        maStatus: [{ required: true, message: '请选择设备状态', trigger: 'change' }]
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
      // 表单参数
 | 
					      // 表单参数
 | 
				
			||||||
      form: {
 | 
					      form: {
 | 
				
			||||||
        qrCode: '',
 | 
					        qrCode: '',
 | 
				
			||||||
| 
						 | 
					@ -566,6 +601,36 @@ export default {
 | 
				
			||||||
        this.KeeperOptions = response.rows
 | 
					        this.KeeperOptions = response.rows
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    // 添加 handleUpdateStatus 方法
 | 
				
			||||||
 | 
					    handleUpdateStatus(row) {
 | 
				
			||||||
 | 
					      this.statusForm = {
 | 
				
			||||||
 | 
					        maId: row.maId,
 | 
				
			||||||
 | 
					        maStatus: row.maStatus
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      this.statusUpdateOpen = true
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 添加状态修改提交方法
 | 
				
			||||||
 | 
					    submitStatusUpdate() {
 | 
				
			||||||
 | 
					      this.$refs['statusFormRef'].validate(valid => {
 | 
				
			||||||
 | 
					        if (valid) {
 | 
				
			||||||
 | 
					          // 调用API更新设备状态
 | 
				
			||||||
 | 
					          editMachineStatus(this.statusForm).then(response => {
 | 
				
			||||||
 | 
					            this.$modal.msgSuccess('状态更新成功')
 | 
				
			||||||
 | 
					            this.statusUpdateOpen = false
 | 
				
			||||||
 | 
					            this.getList() // 刷新列表
 | 
				
			||||||
 | 
					          }).catch(error => {
 | 
				
			||||||
 | 
					            this.$modal.msgError('状态更新失败')
 | 
				
			||||||
 | 
					          })
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      })
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 添加取消状态修改方法
 | 
				
			||||||
 | 
					    cancelStatusUpdate() {
 | 
				
			||||||
 | 
					      this.statusUpdateOpen = false
 | 
				
			||||||
 | 
					      this.$refs['statusFormRef'].resetFields()
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async getRepairerData() {
 | 
					    async getRepairerData() {
 | 
				
			||||||
      const itemName = 'wei_xiu_role_ids'
 | 
					      const itemName = 'wei_xiu_role_ids'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue