bug
zhangzeli
2022-01-11 80e514ca619fbb1fdc1559db4e97f24d61c68b46
src/views/your/car-manage/carManage.vue
@@ -8,7 +8,6 @@
    <Card>
      <Row class="operation">
        <Button @click="addCar" type="primary" icon="md-add">添加车辆</Button>
        <Button @click="delAll" icon="md-trash">批量删除</Button>
        <Button @click="init" icon="md-refresh">刷新</Button>
        <Button type="dashed" @click="openTip = !openTip">{{
          openTip ? "关闭提示" : "开启提示"
@@ -81,7 +80,24 @@
        <FormItem label="牌照" prop="carNo">
          <Input v-model="carForm.carNo" />
        </FormItem>
        <FormItem label="加油卡号" prop="addOilCode">
          <Input v-model="carForm.addOilCode" />
        </FormItem>
        <FormItem label="车辆编号" prop="code">
          <Input v-model="carForm.code" />
        </FormItem>
        <FormItem label="司机" prop="userId">
          <Select v-model="carForm.userId" filterable>
            <Option :value="0">请选择</Option>
            <Option v-for="item in userList" :value="item.id" :key="item.id">{{ item.nickname }}</Option>
          </Select>
        </FormItem>
        <FormItem label="配送员" prop="followUserId">
          <Select v-model="carForm.followUserId" filterable>
            <Option :value="0" :key="0">请选择</Option>
            <Option v-for="item in driverList" :value="item.id" :key="item.id">{{ item.nickname }}</Option>
          </Select>
        </FormItem>
      </Form>
      <div slot="footer">
        <Button type="text" @click="carRole">取消</Button>
@@ -234,6 +250,8 @@
  deleteCar,
  getEquipment,
  addEquipment,
  getUser,
  getDriver,
  deleteEquipment,
} from "@/api/open";
import util from "@/libs/util.js";
@@ -271,6 +289,9 @@
      carForm: {
        status : 0
      },
      type: {
        type : 0
      },
      equipmentForm: {
        status : 0
      },
@@ -298,29 +319,7 @@
        {
          title: "车牌号",
          key: "carNo",
          width: 100,
          sortable: true,
        },
        {
          title: "品牌",
          key: "brand",
          width: 100,
        },
        {
          title: "型号",
          key: "model",
          width: 100,
        },
        {
          title: "排量",
          key: "displacement",
          width: 100,
          sortable: true,
        },
        {
          title: "购置年份",
          key: "buyYear",
          minWidth: 120,
          width: 110,
          sortable: true,
        },
        {
@@ -358,9 +357,65 @@
          sortable: true,
        },
        {
          title: "司机",
          key: "nickName",
          width: 100,
        },
        {
          title: "配送员",
          key: "followNickName",
          width: 100,
        },
        {
          title: "品牌",
          key: "brand",
          width: 100,
        },
        {
          title: "型号",
          key: "model",
          width: 100,
        },
        {
          title: "排量",
          key: "displacement",
          width: 100,
        },
        {
          title: "加油卡号",
          key: "addOilCode",
          minWidth: 120,
          sortable: true,
          render: (h, params) => {
            return h("div",params.row.addOilCode=="undefined" ? '':params.row.addOilCode);
          }
        },
        {
          title: "编号",
          key: "code",
          minWidth: 120,
          sortable: true,
          render: (h, params) => {
            return h("div",params.row.code=="undefined" ? '':params.row.code);
          }
        },
        {
          title: "购置年份",
          key: "buyYear",
          minWidth: 120,
          sortable: true,
        },
        {
          title: "登记日期",
          key: "createTime",
          minWidth: 180,
          sortable: true,
        },
        {
          title: "操作",
          key: "action",
          align: "center",
          fixed: "right",
          width: 280,
          render: (h, params) => {
            return h("div", [
@@ -572,10 +627,13 @@
      depData: [],
      dataType: 0,
      carId: '',
      driverList: [],
      userList: [],
      editDepartments: [],
      buyYear:''
    };
  },
  methods: {
    change1(e){
      this.buyYear = e;
@@ -583,7 +641,6 @@
    init() {
      this.getDataList();
      // 获取所有菜单权限树
      this.getPermList();
    },
    renderContent(h, { root, node, data }) {
      let icon = "";
@@ -639,6 +696,22 @@
    changePageSize(v) {
      this.searchForm.pageSize = v;
      this.getDataList();
    },
    getAllUser(){
      getDriver({type:0}).then((res)=>{
        if (res.success){
          this.userList=res.result;
        }
      });
      //this.type.type=1;
      getDriver({type:1}).then((res)=>{
        if (res.success){
          this.driverList=res.result;
        }
      });
      this.type.type=0;
      console.log(this.userList);
      console.log(this.driverList);
    },
    changeSort(e) {
      this.searchForm.sort = e.key;
@@ -696,6 +769,12 @@
      this.roleModalVisible = false;
    },
    submitCar() {
      if(this.carForm.userId==undefined || this.carForm.userId==0){
        this.carForm.userId="";
      }
      if(this.carForm.followUserId==undefined || this.carForm.followUserId==0){
        this.carForm.followUserId="";
      }
      this.carForm.buyYear = this.buyYear;
      this.$refs.carForm.validate((valid) => {
        if (valid) {
@@ -780,6 +859,8 @@
      this.equipmentVisible = true;
    },
    addCar() {
      this.carForm={};
      this.getAllUser();
      this.modalType = 0;
      this.modalTitle = "添加车辆";
      this.$refs.carForm.resetFields();
@@ -795,9 +876,10 @@
      this.addEquipmentVisible = true;
    },
    edit(v) {
      this.getAllUser();
      this.buyYear = v.buyYear;
      this.modalType = 1;
      this.modalTitle = "编辑角色";
      this.modalTitle = "编辑";
      this.$refs.carForm.resetFields();
      // 转换null为""
      for (let attr in v) {