zhangzeli
2021-11-01 baa03e2f9b1388a673e39cc3f2c1b055b16e513e
src/views/your/car-manage/carManage.vue
@@ -78,7 +78,8 @@
        <Form-item label="购置年份">
          <Row>
            <Col span="11">
              <Date-picker @on-change="change1" type="date" value="yyyy-MM-dd" placeholder="选择日期" v-model="carForm.buyYear"></Date-picker>
              <Date-picker @on-change="change1" type="date"
                           value="yyyy-MM-dd" placeholder="选择日期" v-model="carForm.buyYear"></Date-picker>
            </Col>
          </Row>
        </Form-item>
@@ -93,6 +94,13 @@
          >提交</Button
        >
      </div>
    </Modal>
    <Modal :title="modalTitle" v-model="equipmentVisible" :mask-closable="false" :width="1200">
      <Table :loading="loading" border :columns="columns2" :data="data2" ref="table"
             sortable="custom" @on-sort-change="changeSort" @on-selection-change="changeSelect">
      </Table>
    </Modal>
    <!-- 菜单权限 -->
    <Drawer
@@ -191,6 +199,7 @@
  getCarList,
  editCar,
  deleteCar,
  getEquipment,
} from "@/api/open";
import util from "@/libs/util.js";
export default {
@@ -210,6 +219,7 @@
      sortType: "desc",
      modalType: 0,
      roleModalVisible: false,
      equipmentVisible: false,
      carModalVisible: false,
      permModalVisible: false,
      depModalVisible: false,
@@ -320,6 +330,22 @@
                {
                  on: {
                    click: () => {
                      this.equipment(params.row);
                    },
                  },
                },
                "设备"
              ),
              h("Divider", {
                props: {
                  type: "vertical",
                },
              }),
              h(
                "a",
                {
                  on: {
                    click: () => {
                      this.removeCar(params.row);
                    },
                  },
@@ -362,7 +388,139 @@
          },
        },
      ],
      columns2: [
        {
          type: "selection",
          width: 60,
          align: "center",
        },
        {
          type: "index",
          width: 60,
          align: "center",
        },
        {
          title: "设备类型",
          key: "type",
          width: 100,
          sortable: true,
        },
        {
          title: "编号",
          key: "code",
          width: 100,
        },
        {
          title: "状态",
          key: "status",
          width: 100,
          sortable: true,
          render: (h, params) => {
            let re = "";
            if (params.row.status == 0) {
              return h("div", [
                h("Badge", {
                  props: {
                    status: "success",
                    text: "正常",
                  },
                }),
              ]);
            } else if (params.row.status == 1) {
              return h("div", [
                h("Badge", {
                  props: {
                    status: "error",
                    text: "移除",
                  },
                }),
              ]);
            }
          },
        },
        {
          title: "ip地址",
          key: "ip",
          width: 100,
        },
        {
          title: "端口号",
          key: "port",
          width: 100,
          sortable: true,
        },
        {
          title: "操作",
          key: "action",
          align: "center",
          width: 280,
          render: (h, params) => {
            return h("div", [
              h(
                      "a",
                      {
                        on: {
                          click: () => {
                            this.equipment(params.row);
                          },
                        },
                      },
                      "设备"
              ),
              h("Divider", {
                props: {
                  type: "vertical",
                },
              }),
              h(
                      "a",
                      {
                        on: {
                          click: () => {
                            this.removeCar(params.row);
                          },
                        },
                      },
                      "移除车辆"
              ),
              h("Divider", {
                props: {
                  type: "vertical",
                },
              }),
              h(
                      "a",
                      {
                        on: {
                          click: () => {
                            this.edit(params.row);
                          },
                        },
                      },
                      "编辑"
              ),
              h("Divider", {
                props: {
                  type: "vertical",
                },
              }),
              h(
                      "a",
                      {
                        on: {
                          click: () => {
                            this.remove(params.row);
                          },
                        },
                      },
                      "删除"
              ),
            ]);
          },
        },
      ],
      data: [],
      data2: [],
      total: 0,
      permData: [],
      editRolePermId: "",
@@ -455,6 +613,16 @@
        }
      });
    },
    getEquipmentList() {
      this.loading = true;
      getEquipment(this.searchForm).then((res) => {
        this.loading = false;
        if (res.success) {
          this.data2 = res.result.records;
          this.total = res.result.total;
        }
      });
    },
    getPermList() {
      this.treeLoading = true;
      getAllPermissionList().then((res) => {
@@ -526,6 +694,14 @@
        }
      });
    },
    equipment() {
      this.getEquipmentList();
      this.modalType = 0;
      this.modalTitle = "设备信息";
      this.$refs.carForm.resetFields();
      delete this.carForm.id;
      this.equipmentVisible = true;
    },
    addCar() {
      this.modalType = 0;
      this.modalTitle = "添加车辆";