import Taro from "@tarojs/taro";
import { createSlice } from "@reduxjs/toolkit";

// 当前设备：设备介绍页使用
const instrumentReducer = createSlice({
  name: "instrument", // store的名字
  initialState: {
    bindingStatus: 0, // 0已绑定，1未绑定，2已解绑
    createBy: null,
    createTime: "",
    exportFields: [],
    id: 0,
    instrumentId: 0,
    instrumentIdArray: null,
    instrumentName: "",
    instrumentSerialIdList: [],
    queryInstrumentIds: null,
    remark: null,
    serial: "", // 设备序列号
    source: "",
    status: 0, // 0正常 1停用
    updateBy: null,
    updateTime: null,
    validStatus: 1, // 1有效，0无效
  },
  reducers: {
    setInstrument(state, { payload }) {
      console.log("payload", payload);
      state = JSON.parse(JSON.stringify(payload));
    },
  },
});

export const { setInstrument } = instrumentReducer.actions;
export default instrumentReducer.reducer;
