Ver código fonte

fix-车辆管理

LAPTOP-U5GOA5HA\zz 1 ano atrás
pai
commit
4f5447327d

+ 25 - 10
src/api/clw/car.js

@@ -1,44 +1,59 @@
 import request from '@/utils/request'
 
 // 查询车辆管理列表
-export function listCar (query) {
+export function listCar(query) {
   return request({
     url: '/clw/car/list',
     method: 'get',
-    params: query
+    params: query,
   })
 }
 
 // 查询车辆管理详细
-export function getCar (id) {
+export function getCar(id) {
   return request({
     url: '/clw/car/' + id,
-    method: 'get'
+    method: 'get',
   })
 }
 
 // 新增车辆管理
-export function addCar (data) {
+export function addCar(data) {
   return request({
     url: '/clw/car',
     method: 'post',
-    data: data
+    data: data,
   })
 }
 
 // 修改车辆管理
-export function updateCar (data) {
+export function updateCar(data) {
   return request({
     url: '/clw/car',
     method: 'put',
-    data: data
+    data: data,
   })
 }
 
 // 删除车辆管理
-export function delCar (id) {
+export function delCar(id) {
   return request({
     url: '/clw/car/' + id,
-    method: 'delete'
+    method: 'delete',
   })
 }
+// 用户列表
+export function getUserList(params) {
+  return request({
+    url: '/system/user/list',
+    method: 'get',
+    params,
+  })
+}
+// 车辆分类树
+export function getCategoryTree() {
+  return request({
+    url: '/clw/category/tree',
+    method: 'get'
+  })
+}

+ 20 - 24
src/components/FileUpload/index.vue

@@ -15,15 +15,13 @@
       <div v-if="value == '' || value == null">
         <span v-if="type == 'image'">
           <a-icon :type="loading ? 'loading' : 'plus'" />
-          <div class="ant-upload-text">
-            上传
-          </div>
+          <div class="ant-upload-text">上传</div>
         </span>
       </div>
     </a-upload>
     <span v-if="value && type == 'file'">
-      <br>
-      <a :href="value" target="_blank" >{{ value }}</a>
+      <br />
+      <a :href="value" target="_blank">{{ value }}</a>
     </span>
   </div>
 </template>
@@ -37,36 +35,34 @@ export default {
   props: {
     value: {
       type: String,
-      default: ''
+      default: '',
     },
     type: {
       type: String,
-      default: 'image'
+      default: 'image',
     },
     count: {
       type: Number,
-      default: 1
-    }
-  },
-  components: {
+      default: 1,
+    },
   },
-  data () {
+  components: {},
+  data() {
     return {
       loading: false,
       open: false,
       uploadImgUrl: process.env.VUE_APP_BASE_API + '/common/upload',
       headers: {
-        Authorization: 'Bearer ' + storage.get(ACCESS_TOKEN)
-      }
+        Authorization: 'Bearer ' + storage.get(ACCESS_TOKEN),
+      },
     }
   },
-  mounted () {
-  },
+  mounted() {},
   methods: {
-    handleCancel () {
+    handleCancel() {
       this.previewVisible = false
     },
-    async handleChange (info) {
+    async handleChange(info) {
       if (info.file.status === 'uploading') {
         this.loading = true
         return
@@ -79,17 +75,18 @@ export default {
         }
         this.loading = false
         this.$emit('input', info.file.response.url)
+        this.$emit('UpdateImg', info.file.response.fileName)
       }
     },
-    beforeUpload (file) {
+    beforeUpload(file) {
       // 文件类型(file.type)、大小限制(file.size)
-      const isLt2M = file.size / 1024 / 1024 < 2
+      const isLt2M = file.size / 1024 / 1024 < 20
       if (!isLt2M) {
-        this.$message.error('图片大小限制 2MB!')
+        this.$message.error('图片大小限制 20MB!')
       }
       return isLt2M
-    }
-  }
+    },
+  },
 }
 </script>
 <style lang="less" scoped>
@@ -97,5 +94,4 @@ img {
   width: 128px;
   height: 128px;
 }
-
 </style>

+ 1 - 1
src/components/SettingDrawer/SettingDrawer.vue

@@ -217,7 +217,7 @@ export default {
   tableSize: '${this.tableSize}',
   tableBordered: ${this.tableBordered},
   hideFooter: ${this.hideFooter},
-  title: '若依管理系统',
+  title: '两江消防车联网系统',
   production: process.env.NODE_ENV === 'production' && process.env.VUE_APP_PREVIEW !== 'true'
 }`
       this.$copyText(text).then(message => {

+ 2 - 2
src/config/defaultSettings.js

@@ -24,6 +24,6 @@ export default {
   tableSize: 'middle',
   tableBordered: false,
   hideFooter: true,
-  title: '若依管理系统',
-  production: process.env.NODE_ENV === 'production' && process.env.VUE_APP_PREVIEW !== 'true'
+  title: '两江消防车联网系统',
+  production: process.env.NODE_ENV === 'production' && process.env.VUE_APP_PREVIEW !== 'true',
 }

+ 0 - 3
src/utils/screenLog.js

@@ -1,9 +1,6 @@
 /* eslint-disable */
 export const printANSI = () => {
   // console.clear()
-  console.log('[两江消防车联网系统] created()')
-  console.log('POWERED BY 两江消防车联网系统')
   // ASCII - ANSI Shadow
   let text = `两江消防车联网系统`
-  console.log(`%c${text}`, 'color: #0f41a6;font-size: 50px;')
 }

+ 14 - 2
src/views/cardIot/components/FireStationDetails.vue

@@ -5,7 +5,7 @@
       <div style="display: flex; justify-content: space-between">
         <div>
           车牌号:
-          <span >{{ carinfo.plateNumber ? carinfo.plateNumber : '暂无' }}</span>
+          <span>{{ carinfo.plateNumber ? carinfo.plateNumber : '暂无' }}</span>
         </div>
         <div>
           车辆类型:
@@ -49,6 +49,11 @@ export default {
       id: '',
     }
   },
+  computed: {
+    carIds() {
+      return this.$route.query.id
+    },
+  },
   watch: {
     deptIds: {
       handler(val) {
@@ -67,11 +72,18 @@ export default {
   },
   methods: {
     FunInfo() {
-      getCarInfo(this.id).then((res) => {
+      getCarInfo(this.id || this.carIds).then((res) => {
+        console.log('-------路由传参', res)
         this.carinfo = res.data
       })
     },
   },
+  mounted() {
+    if (this.carIds) {
+      this.FunInfo()
+    }
+    console.log('-------路由传参', this.carIds)
+  },
   // created() {
   //   this.FunInfo()
   // },

+ 7 - 3
src/views/cardIot/components/TreeCar.vue

@@ -89,7 +89,7 @@
       <div>showFlag---{{ showFlag }}</div>
       <div>showBtn---{{ showBtn }}</div>
       <div>videoid---------{{ videoid }}</div> -->
-      <div v-if="videoid || showFlag == true">
+      <div v-if="videoid || showFlag != false&&carIds">
         <Video :carInfo="carInfo" :videoid="videoid" />
         <!-- 机构详情 -->
         <FireStationDetails :deptIds="deptIds" />
@@ -122,7 +122,7 @@ const getParentKey = (key, tree) => {
   return parentKey
 }
 export default {
-  components: { Statistics, Video, FireStationDetails},
+  components: { Statistics, Video, FireStationDetails },
   props: {
     carId: String,
     showVideos: Boolean,
@@ -146,7 +146,7 @@ export default {
       handler(newVal) {
         if (newVal) {
           this.deptIds = newVal
-          this.values=newVal.plateNumber
+          this.values = newVal.plateNumber
         }
       },
     },
@@ -260,10 +260,14 @@ export default {
     this.FunTree()
     this.funcarList()
   },
+
   computed: {
     carTree() {
       return this.gData
     },
+    carIds() {
+      return this.$route.query.id
+    },
   },
 }
 </script>

+ 11 - 8
src/views/cardIot/index.vue

@@ -40,16 +40,20 @@ export default {
       isStart: false,
       isPause: true,
       showVideos: false,
-      idVal:{}
+      idVal: {},
     }
   },
+  computed: {
+    carIds() {
+      return this.$route.query.id
+    },
+  },
   methods: {
     $disabledFooter() {
       return true
     },
     clickCarItem(val) {
-      console.log(33333, val)
-      this.idVal=val
+      this.idVal = val
       this.showVideos = true
       this.carId = val.cqVehicleId
       this.idInfo = {
@@ -63,12 +67,11 @@ export default {
       this.idInfo = node
       this.$refs.pathHistory.clearAll()
       this.$refs.refMap.callback((that) => {
-        if(node.key.indexOf('dept')>=0){
-          that.map.setCenter([node.meta.lng ,node.meta.lat])
-        }else{
-          that.map.setCenter([node.meta.ssjgwd ,node.meta.ssjgjd])
+        if (node.key.indexOf('dept') >= 0) {
+          that.map.setCenter([node.meta.lng, node.meta.lat])
+        } else {
+          that.map.setCenter([node.meta.ssjgwd, node.meta.ssjgjd])
         }
-  
       })
     },
     rangEv(val) {

+ 263 - 154
src/views/clw/car/index.vue

@@ -1,124 +1,158 @@
 <template>
   <page-header-wrapper>
     <a-card :bordered="false">
-      <!-- 条件搜索 -->
-      <div class="table-page-search-wrapper">
-        <a-form layout="inline">
-          <a-row :gutter="48">
-            <a-col :md="8" :sm="24">
-              <a-form-item label="车牌号" prop="plateNumber">
-                <a-input v-model="queryParam.plateNumber" placeholder="请输入车牌号" allow-clear/>
-              </a-form-item>
-            </a-col>
-            <template v-if="advanced">
-              <a-col :md="8" :sm="24">
-                <a-form-item label="高度" prop="height">
-                  <a-input v-model="queryParam.height" placeholder="请输入高度" allow-clear/>
-                </a-form-item>
-              </a-col>
-              <a-col :md="8" :sm="24">
-                <a-form-item label="0可使、1使用中、2维修中、3已停用" prop="status">
-                  <a-select placeholder="请选择0可使、1使用中、2维修中、3已停用" v-model="queryParam.status" style="width: 100%" allow-clear>
-                    <a-select-option v-for="(d, index) in dict.type.public_car_staus" :key="index" :value="d.value">{{ d.label }}</a-select-option>
-                  </a-select>
-                </a-form-item>
-              </a-col>
-            </template>
-            <a-col :md="!advanced && 8 || 24" :sm="24">
-              <span class="table-page-search-submitButtons" :style="advanced && { float: 'right', overflow: 'hidden' } || {} ">
-                <a-button type="primary" @click="handleQuery"><a-icon type="search" />查询</a-button>
-                <a-button style="margin-left: 8px" @click="resetQuery"><a-icon type="redo" />重置</a-button>
-                <a @click="toggleAdvanced" style="margin-left: 8px">
-                  {{ advanced ? '收起' : '展开' }}
-                  <a-icon :type="advanced ? 'up' : 'down'"/>
-                </a>
-              </span>
-            </a-col>
-          </a-row>
-        </a-form>
-      </div>
-      <!-- 操作 -->
-      <div class="table-operations">
-        <a-button type="primary" @click="$refs.createForm.handleAdd()" v-hasPermi="['clw:car:add']">
-          <a-icon type="plus" />新增
-        </a-button>
-        <a-button type="primary" :disabled="single" @click="$refs.createForm.handleUpdate(undefined, ids)" v-hasPermi="['clw:car:edit']">
-          <a-icon type="edit" />修改
-        </a-button>
-        <a-button type="danger" :disabled="multiple" @click="handleDelete" v-hasPermi="['clw:car:remove']">
-          <a-icon type="delete" />删除
-        </a-button>
-        <a-button type="primary" @click="handleExport" v-hasPermi="['clw:car:export']">
-          <a-icon type="download" />导出
-        </a-button>
-        <table-setting
-          :style="{float: 'right'}"
-          :table-size.sync="tableSize"
-          v-model="columns"
-          :refresh-loading="loading"
-          @refresh="getList" />
-      </div>
-      <!-- 增加修改 -->
-      <create-form
-        ref="createForm"
-        :sourceOptions="dict.type.car_source"
-        :domesticImportOptions="dict.type.car_domestic_import"
-        :typeOptions="dict.type.car_type"
-        :statusOptions="dict.type.public_car_staus"
-        :iotOptions="dict.type.sys_yes_no"
-        @ok="getList"
-      />
-      <!-- 数据展示 -->
-      <a-table
-        :loading="loading"
-        :size="tableSize"
-        rowKey="id"
-        :columns="columns"
-        :data-source="list"
-        :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
-        :pagination="false"
-        :bordered="tableBordered"
-      >
-        <span slot="operation" slot-scope="text, record">
-          <a-divider type="vertical" v-hasPermi="['clw:car:edit']" />
-          <a @click="$refs.createForm.handleUpdate(record, undefined)" v-hasPermi="['clw:car:edit']">
-            <a-icon type="edit" />修改
-          </a>
-          <a-divider type="vertical" v-hasPermi="['clw:car:remove']" />
-          <a @click="handleDelete(record)" v-hasPermi="['clw:car:remove']">
-            <a-icon type="delete" />删除
-          </a>
-        </span>
-      </a-table>
-      <!-- 分页 -->
-      <a-pagination
-        class="ant-table-pagination"
-        show-size-changer
-        show-quick-jumper
-        :current="queryParam.pageNum"
-        :total="total"
-        :page-size="queryParam.pageSize"
-        :showTotal="total => `共 ${total} 条`"
-        @showSizeChange="onShowSizeChange"
-        @change="changeSize"
-      />
+      <a-row>
+        <a-col :span="5">
+          <!-- 树 -->
+          <Trees ref="deptTree" :carTypeList="carTypeList" @select="clickDeptNode" />
+        </a-col>
+        <a-col :span="1"></a-col>
+        <a-col :span="18">
+          <!-- 条件搜索 -->
+          <div class="table-page-search-wrapper">
+            <a-form layout="inline">
+              <a-row :gutter="48">
+                <a-col :md="8" :sm="10">
+                  <a-form-item label="车牌号" prop="plateNumber">
+                    <a-input v-model="queryParam.plateNumber" placeholder="请输入车牌号" allow-clear />
+                  </a-form-item>
+                </a-col>
+                <a-col :md="8" :sm="12">
+                    <a-form-item label="机构名称" prop="deptId">
+                      <a-select placeholder="请选择" v-model="queryParam.deptId" style="width: 100%" allow-clear>
+                        <a-select-option
+                          v-for="(d, index) in deptIdList"
+                          :key="index"
+                          :value="d.id"
+                          >{{ d.lable }}</a-select-option
+                        >
+                      </a-select>
+                    </a-form-item>
+                  </a-col>
+                <template v-if="advanced">
+                 
+                  <a-col :md="8" :sm="24">
+                    <a-form-item label="状态" prop="status">
+                      <a-select placeholder="请选择" v-model="queryParam.status" style="width: 100%" allow-clear>
+                        <a-select-option
+                          v-for="(d, index) in dict.type.public_car_staus"
+                          :key="index"
+                          :value="d.value"
+                          >{{ d.label }}</a-select-option
+                        >
+                      </a-select>
+                    </a-form-item>
+                  </a-col>
+                </template>
+                <a-col :md="(!advanced && 8) || 24" :sm="24">
+                  <span
+                    class="table-page-search-submitButtons"
+                    :style="(advanced && { float: 'right', overflow: 'hidden' }) || {}"
+                  >
+                    <a-button type="primary" @click="handleQuery"><a-icon type="search" />查询</a-button>
+                    <a-button style="margin-left: 8px" @click="resetQuery"><a-icon type="redo" />重置</a-button>
+                    <a @click="toggleAdvanced" style="margin-left: 8px">
+                      {{ advanced ? '收起' : '展开' }}
+                      <a-icon :type="advanced ? 'up' : 'down'" />
+                    </a>
+                  </span>
+                </a-col>
+              </a-row>
+            </a-form>
+          </div>
+          <!-- 操作 -->
+          <div class="table-operations">
+            <a-button type="primary" @click="$refs.createForm.handleAdd()" v-hasPermi="['clw:car:add']">
+              <a-icon type="plus" />新增
+            </a-button>
+            <a-button
+              type="primary"
+              :disabled="single"
+              @click="$refs.createForm.handleUpdate(undefined, ids)"
+              v-hasPermi="['clw:car:edit']"
+            >
+              <a-icon type="edit" />修改
+            </a-button>
+            <a-button type="danger" :disabled="multiple" @click="handleDelete" v-hasPermi="['clw:car:remove']">
+              <a-icon type="delete" />删除
+            </a-button>
+            <a-button type="primary" @click="handleExport" v-hasPermi="['clw:car:export']">
+              <a-icon type="download" />导出
+            </a-button>
+            <table-setting
+              :style="{ float: 'right' }"
+              :table-size.sync="tableSize"
+              v-model="columns"
+              :refresh-loading="loading"
+              @refresh="getList"
+            />
+          </div>
+          <!-- 增加修改 -->
+          <create-form
+            ref="createForm"
+            :sourceOptions="dict.type.car_source"
+            :domesticImportOptions="dict.type.car_domestic_import"
+            :typeOptions="dict.type.car_type"
+            :deptOptions="deptOptions"
+            :statusOptions="dict.type.public_car_staus"
+            :iotOptions="dict.type.cmmon_yes_no"
+            :carTypeList="carTypeList"
+            @ok="getList"
+          />
+          <!-- 数据展示 -->
+          <a-table
+            :loading="loading"
+            :size="tableSize"
+            rowKey="id"
+            :columns="columns"
+            :data-source="list"
+            :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+            :pagination="false"
+            :bordered="tableBordered"
+          >
+            <span slot="operation" slot-scope="text, record">
+              <a-divider type="vertical" v-hasPermi="['clw:car:edit']" />
+              <a @click="$refs.createForm.handleUpdate(record, undefined)" v-hasPermi="['clw:car:edit']">
+                <a-icon type="edit" />修改
+              </a>
+              <a @click="seeCarInfo(record)" v-hasPermi="['monitor:operlog:query']"> <a-icon type="eye" />详情 </a>
+              <a-divider type="vertical" v-hasPermi="['clw:car:remove']" />
+              <a @click="handleDelete(record)" v-hasPermi="['clw:car:remove']"> <a-icon type="delete" />删除 </a>
+            </span>
+          </a-table>
+          <!-- 分页 -->
+          <a-pagination
+            class="ant-table-pagination"
+            show-size-changer
+            show-quick-jumper
+            :current="queryParam.pageNum"
+            :total="total"
+            :page-size="queryParam.pageSize"
+            :showTotal="(total) => `共 ${total} 条`"
+            @showSizeChange="onShowSizeChange"
+            @change="changeSize"
+          />
+        </a-col>
+      </a-row>
     </a-card>
   </page-header-wrapper>
 </template>
 
 <script>
-import { listCar, delCar } from '@/api/clw/car'
+import { listCar, delCar, getCategoryTree } from '@/api/clw/car'
 import CreateForm from './modules/CreateForm'
 import { tableMixin } from '@/store/table-mixin'
-
+import { deptTreeSelect } from '@/api/system/user'
+import Trees from './modules/Trees.vue'
 export default {
   name: 'Car',
   components: {
-    CreateForm
+    CreateForm,
+    Trees,
   },
   mixins: [tableMixin],
-  dicts: ['car_source', 'car_domestic_import', 'car_type', 'public_car_staus', 'sys_yes_no'],
-  data () {
+  dicts: ['car_source', 'car_domestic_import', 'car_type', 'public_car_staus', 'cmmon_yes_no'],
+  data() {
     return {
       list: [],
       selectedRowKeys: [],
@@ -134,62 +168,115 @@ export default {
       total: 0,
       // 查询参数
       queryParam: {
-        deptId: null,
+        depName: null,
         plateNumber: null,
         height: null,
         status: null,
         pageNum: 1,
-        pageSize: 10
+        pageSize: 10,
+        categoryId: null,
       },
       columns: [
         {
-          title: '部门ID',
-          dataIndex: 'deptId',
+          title: '机构名称',
+          dataIndex: 'depName',
           ellipsis: true,
-          align: 'center'
+          align: 'center',
+          width: '230px',
         },
         {
           title: '车牌号',
           dataIndex: 'plateNumber',
           ellipsis: true,
-          align: 'center'
+          align: 'center',
         },
         {
           title: '负责人',
-          dataIndex: 'userId',
+          dataIndex: 'owner',
           ellipsis: true,
-          align: 'center'
+          align: 'center',
         },
         {
           title: '车辆类型',
-          dataIndex: 'categoryId',
+          dataIndex: 'cryName',
           ellipsis: true,
-          align: 'center'
+          align: 'center',
+        },
+        {
+          title: '车辆状态',
+          dataIndex: 'status',
+          ellipsis: true,
+          align: 'center',
         },
         {
           title: '操作',
           dataIndex: 'operation',
           width: '18%',
           scopedSlots: { customRender: 'operation' },
-          align: 'center'
-        }
+          align: 'center',
+          width: '230px',
+        },
+      ],
+      deptOptions: [
+        {
+          id: 0,
+          label: '',
+          children: [],
+        },
+      ],
+      carTypeList: [
+        {
+          categoryId: 0,
+          categoryName: '',
+          children: [],
+        },
+      ],
+      //机构
+      deptIdList:[
+        {
+          id:239,
+          lable:'两江新区消防救援支队'
+        },
+        {
+          id:233,
+          lable:'两江新区支队鸳鸯消防救援站'
+        },
+        {
+          id:232,
+          lable:'两江新区支队翠云消防救援站'
+        },
+        {
+          id:234,
+          lable:'两江新区支队龙头寺消防救援站'
+        },
+        {
+          id:229,
+          lable:'两江新区支队大竹林特勤站'
+        },
+        {
+          id:231,
+          lable:'两江新区支队礼嘉消防救援站'
+        },
+        {
+          id:230,
+          lable:'两江新区支队奥园消防救援站'
+        },
       ]
     }
   },
-  filters: {
-  },
-  created () {
+  filters: {},
+  created() {
     this.getList()
+    this.getDeptTree()
+    this.funCarType()
   },
-  computed: {
-  },
-  watch: {
-  },
+  computed: {},
+  watch: {},
   methods: {
     /** 查询车辆管理列表 */
-    getList () {
+    getList() {
       this.loading = true
-      listCar(this.queryParam).then(response => {
+      listCar(this.queryParam).then((response) => {
         this.list = response.rows
         this.total = response.total
         this.loading = false
@@ -197,76 +284,98 @@ export default {
     },
 
     /** 搜索按钮操作 */
-    handleQuery () {
+    handleQuery() {
       this.queryParam.pageNum = 1
       this.getList()
     },
     /** 重置按钮操作 */
-    resetQuery () {
+    resetQuery() {
       this.queryParam = {
         deptId: undefined,
         plateNumber: undefined,
         height: undefined,
         status: undefined,
         pageNum: 1,
-        pageSize: 10
+        pageSize: 10,
       }
       this.handleQuery()
     },
-    onShowSizeChange (current, pageSize) {
+    onShowSizeChange(current, pageSize) {
       this.queryParam.pageSize = pageSize
       this.getList()
     },
-    changeSize (current, pageSize) {
+    changeSize(current, pageSize) {
       this.queryParam.pageNum = current
       this.queryParam.pageSize = pageSize
       this.getList()
     },
-    onSelectChange (selectedRowKeys, selectedRows) {
+    onSelectChange(selectedRowKeys, selectedRows) {
       this.selectedRowKeys = selectedRowKeys
       this.selectedRows = selectedRows
-      this.ids = this.selectedRows.map(item => item.id)
+      this.ids = this.selectedRows.map((item) => item.id)
       this.single = selectedRowKeys.length !== 1
       this.multiple = !selectedRowKeys.length
     },
-    toggleAdvanced () {
+    toggleAdvanced() {
       this.advanced = !this.advanced
     },
     /** 删除按钮操作 */
-    handleDelete (row) {
+    handleDelete(row) {
       var that = this
       const ids = row.id || this.ids
       this.$confirm({
         title: '确认删除所选中数据?',
         content: '当前选中编号为' + ids + '的数据',
-        onOk () {
-          return delCar(ids)
-            .then(() => {
-              that.onSelectChange([], [])
-              that.getList()
-              that.$message.success(
-                '删除成功',
-                3
-              )
+        onOk() {
+          return delCar(ids).then(() => {
+            that.onSelectChange([], [])
+            that.getList()
+            that.$message.success('删除成功', 3)
           })
         },
-        onCancel () {}
+        onCancel() {},
       })
     },
     /** 导出按钮操作 */
-    handleExport () {
+    handleExport() {
       var that = this
       this.$confirm({
         title: '是否确认导出?',
         content: '此操作将导出当前条件下所有数据而非选中数据',
-        onOk () {
-          that.download('clw/car/export', {
-            ...that.queryParam
-          }, `car_${new Date().getTime()}.xlsx`)
+        onOk() {
+          that.download(
+            'clw/car/export',
+            {
+              ...that.queryParam,
+            },
+            `car_${new Date().getTime()}.xlsx`
+          )
         },
-        onCancel () {}
+        onCancel() {},
       })
-    }
-  }
+    },
+    getDeptTree() {
+      deptTreeSelect().then((response) => {
+        this.deptOptions = response.data
+      })
+    },
+    clickDeptNode(node) {
+      this.queryParam.categoryId = node
+      this.getList()
+    },
+    funCarType() {
+      getCategoryTree().then((res) => {
+        this.carTypeList = res.data
+      })
+    },
+    seeCarInfo(node) {
+      this.$router.push({
+          path: '/cardiot',
+          query: {
+              id: node.id,
+          }
+      })
+    },
+  },
 }
 </script>

+ 388 - 256
src/views/clw/car/modules/CreateForm.vue

@@ -1,153 +1,311 @@
 <template>
-  <a-drawer width="35%" :label-col="4" :wrapper-col="14" :visible="open" @close="onClose">
+  <a-drawer width="85%" :label-col="4" :wrapper-col="14" :visible="open" @close="onClose">
     <a-divider orientation="left">
       <b>{{ formTitle }}</b>
     </a-divider>
     <a-form-model ref="form" :model="form" :rules="rules">
-      <a-form-model-item label="部门ID" prop="deptId" >
-      </a-form-model-item>
-      <a-form-model-item label="车牌号" prop="plateNumber" >
-        <a-input v-model="form.plateNumber" placeholder="请输入车牌号" />
-      </a-form-model-item>
-      <a-form-model-item label="负责人" prop="userId" >
-      </a-form-model-item>
-      <a-form-model-item label="车辆类型" prop="categoryId" >
-      </a-form-model-item>
-      <a-form-model-item label="终端绑定" prop="terminalBind" >
-        <a-input v-model="form.terminalBind" placeholder="请输入终端绑定" />
-      </a-form-model-item>
-      <a-form-model-item label="车辆来源" prop="source" >
-        <a-select placeholder="请选择车辆来源" v-model="form.source">
-          <a-select-option v-for="(d, index) in sourceOptions" :key="index" :value="d.value" >{{ d.label }}</a-select-option>
-        </a-select>
-      </a-form-model-item>
-      <a-form-model-item label="国产/进口" prop="domesticImport" >
-        <a-select placeholder="请选择国产/进口" v-model="form.domesticImport">
-          <a-select-option v-for="(d, index) in domesticImportOptions" :key="index" :value="d.value" >{{ d.label }}</a-select-option>
-        </a-select>
-      </a-form-model-item>
-      <a-form-model-item label="制造国" prop="manufactureCountry" >
-        <a-input v-model="form.manufactureCountry" placeholder="请输入制造国" />
-      </a-form-model-item>
-      <a-form-model-item label="制造企业" prop="manufactureCompany" >
-        <a-input v-model="form.manufactureCompany" placeholder="请输入制造企业" />
-      </a-form-model-item>
-      <a-form-model-item label="车辆品牌" prop="brand" >
-        <a-input v-model="form.brand" placeholder="请输入车辆品牌" />
-      </a-form-model-item>
-      <a-form-model-item label="车辆型号" prop="model" >
-        <a-input v-model="form.model" placeholder="请输入车辆型号" />
-      </a-form-model-item>
-      <a-form-model-item label="车辆识别代码" prop="identificationCode" >
-        <a-input v-model="form.identificationCode" placeholder="请输入车辆识别代码" />
-      </a-form-model-item>
-      <a-form-model-item label="车辆颜色" prop="color" >
-        <a-input v-model="form.color" placeholder="请输入车辆颜色" />
-      </a-form-model-item>
-      <a-form-model-item label="燃油种类" prop="fuelType" >
-        <a-input v-model="form.fuelType" placeholder="请输入燃油种类" />
-      </a-form-model-item>
-      <a-form-model-item label="发动机号" prop="engineNumber" >
-        <a-input v-model="form.engineNumber" placeholder="请输入发动机号" />
-      </a-form-model-item>
-      <a-form-model-item label="车辆排量" prop="emissions" >
-        <a-input v-model="form.emissions" placeholder="请输入车辆排量" />
-      </a-form-model-item>
-      <a-form-model-item label="发动机功率" prop="power" >
-        <a-input v-model="form.power" placeholder="请输入发动机功率" />
-      </a-form-model-item>
-      <a-form-model-item label="长度" prop="length" >
-        <a-input v-model="form.length" placeholder="请输入长度" />
-      </a-form-model-item>
-      <a-form-model-item label="宽度" prop="width" >
-        <a-input v-model="form.width" placeholder="请输入宽度" />
-      </a-form-model-item>
-      <a-form-model-item label="高度" prop="height" >
-        <a-input v-model="form.height" placeholder="请输入高度" />
-      </a-form-model-item>
-      <a-form-model-item label="油箱容积/L" prop="fuelCapacity" >
-        <a-input v-model="form.fuelCapacity" placeholder="请输入油箱容积/L" />
-      </a-form-model-item>
-      <a-form-model-item label="座位数量" prop="seatNumber" >
-        <a-input v-model="form.seatNumber" placeholder="请输入座位数量" />
-      </a-form-model-item>
-      <a-form-model-item label="气缸数量" prop="cylinderNumber" >
-        <a-input v-model="form.cylinderNumber" placeholder="请输入气缸数量" />
-      </a-form-model-item>
-      <a-form-model-item label="出厂日期" prop="manufactureDate" >
-        <a-date-picker style="width: 100%" v-model="form.manufactureDate" format="YYYY-MM-DD HH:mm:ss" allow-clear/>
-      </a-form-model-item>
-      <a-form-model-item label="sim卡号" prop="simNumber" >
-        <a-input v-model="form.simNumber" placeholder="请输入sim卡号" />
-      </a-form-model-item>
-      <a-form-model-item label="车辆类型" prop="type" >
-        <a-select placeholder="请选择车辆类型" v-model="form.type">
-          <a-select-option v-for="(d, index) in typeOptions" :key="index" :value="d.value" >{{ d.label }}</a-select-option>
-        </a-select>
-      </a-form-model-item>
-      <a-form-model-item label="联系电话" prop="phone" >
-        <a-input v-model="form.phone" placeholder="请输入联系电话" />
-      </a-form-model-item>
-      <a-form-model-item label="车主姓名" prop="owner" >
-        <a-input v-model="form.owner" placeholder="请输入车主姓名" />
-      </a-form-model-item>
-      <a-form-model-item label="第三方车辆ID" prop="thirdVehicledId" >
+      <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="所属消防站" prop="deptId">
+            <a-tree-select
+              v-model="form.deptId"
+              style="width: 100%"
+              :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
+              :tree-data="deptOptions"
+              placeholder="请选择"
+              :replaceFields="{ children: 'children', title: 'label', key: 'id', value: 'id' }"
+              tree-default-expand-all
+            >
+            </a-tree-select>
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="10">
+          <a-form-model-item label="车牌号" prop="plateNumber">
+            <a-input v-model="form.plateNumber" placeholder="请输入车牌号" />
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="负责人" prop="userId">
+            <a-select placeholder="请选择负责人" v-model="form.userId">
+              <a-select-option v-for="(d, index) in userList" :key="index" :value="d.userId">{{
+                d.nickName
+              }}</a-select-option>
+            </a-select>
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="10">
+          <a-form-model-item label="车辆类型" prop="categoryId">
+            <a-tree-select
+              v-model="form.categoryId"
+              style="width: 100%"
+              :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
+              :tree-data="carTypeList"
+              placeholder="请选择"
+              :replaceFields="{ children: 'children', title: 'categoryName', key: 'categoryId', value: 'categoryId' }"
+              tree-default-expand-all
+            >
+            </a-tree-select>
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="是否物联:" prop="iot">
+            <a-select placeholder="请选择是否物联" v-model="form.iot">
+              <a-select-option v-for="(d, index) in iotOptions" :key="index" :value="d.value">{{
+                d.label
+              }}</a-select-option>
+            </a-select>
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="10">
+          <a-form-model-item label="车辆来源" prop="source">
+            <a-select placeholder="请选择车辆来源" v-model="form.source">
+              <a-select-option v-for="(d, index) in sourceOptions" :key="index" :value="d.value">{{
+                d.label
+              }}</a-select-option>
+            </a-select>
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="国产/进口" prop="domesticImport">
+            <a-select placeholder="请选择国产/进口" v-model="form.domesticImport">
+              <a-select-option v-for="(d, index) in domesticImportOptions" :key="index" :value="d.value">{{
+                d.label
+              }}</a-select-option>
+            </a-select>
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="10">
+          <a-form-model-item label="制造国" prop="manufactureCountry">
+            <a-input v-model="form.manufactureCountry" placeholder="请输入制造国" />
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="制造企业" prop="manufactureCompany">
+            <a-input v-model="form.manufactureCompany" placeholder="请输入制造企业" />
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="10">
+          <a-form-model-item label="车辆品牌" prop="brand">
+            <a-input v-model="form.brand" placeholder="请输入车辆品牌" />
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="车辆型号" prop="model">
+            <a-input v-model="form.model" placeholder="请输入车辆型号" />
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="10">
+          <a-form-model-item label="车辆识别代码" prop="identificationCode">
+            <a-input v-model="form.identificationCode" placeholder="请输入车辆识别代码" />
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="车辆颜色" prop="color">
+            <a-input v-model="form.color" placeholder="请输入车辆颜色" />
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="10">
+          <a-form-model-item label="燃油种类" prop="fuelType">
+            <a-input v-model="form.fuelType" placeholder="请输入燃油种类" />
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="发动机号" prop="engineNumber">
+            <a-input v-model="form.engineNumber" placeholder="请输入发动机号" />
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="10">
+          <a-form-model-item label="车辆排量" prop="emissions">
+            <a-input v-model="form.emissions" placeholder="请输入车辆排量" />
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="发动机功率" prop="power">
+            <a-input v-model="form.power" placeholder="请输入发动机功率" />
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="10">
+          <a-form-model-item label="长度" prop="length">
+            <a-input v-model="form.length" placeholder="请输入长度" />
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="宽度" prop="width">
+            <a-input v-model="form.width" placeholder="请输入宽度" />
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="10">
+          <a-form-model-item label="高度" prop="height">
+            <a-input v-model="form.height" placeholder="请输入高度" />
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="油箱容积/L" prop="fuelCapacity">
+            <a-input v-model="form.fuelCapacity" placeholder="请输入油箱容积/L" />
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="10">
+          <a-form-model-item label="座位数量" prop="seatNumber">
+            <a-input v-model="form.seatNumber" placeholder="请输入座位数量" />
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="气缸数量" prop="cylinderNumber">
+            <a-input v-model="form.cylinderNumber" placeholder="请输入气缸数量" />
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="10">
+          <a-form-model-item label="出厂日期" prop="manufactureDate">
+            <a-date-picker
+              style="width: 100%"
+              v-model="form.manufactureDate"
+              format="YYYY-MM-DD HH:mm:ss"
+              allow-clear
+            />
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row>
+        <!-- <a-col :span="10">
+          <a-form-model-item label="sim卡号" prop="simNumber">
+            <a-input v-model="form.simNumber" placeholder="请输入sim卡号" />
+          </a-form-model-item>
+        </a-col> -->
+
+        <a-col :span="10">
+          <a-form-model-item label="照片" prop="photo">
+            <file-upload v-model="form.photo" type="image" @UpdateImg="UpdateImg"></file-upload>
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <!-- <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="联系电话" prop="phone">
+            <a-input v-model="form.phone" placeholder="请输入联系电话" />
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="10">
+          <a-form-model-item label="车主姓名" prop="owner">
+            <a-input v-model="form.owner" placeholder="请输入车主姓名" />
+          </a-form-model-item>
+        </a-col>
+      </a-row> -->
+      <!-- <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="第三方车辆ID" prop="thirdVehicledId">
         <a-input v-model="form.thirdVehicledId" placeholder="请输入第三方车辆ID" />
       </a-form-model-item>
-      <a-form-model-item label="液位展示JSON串" prop="liquidConfig" >
+        </a-col>
+        <a-col :span="10">
+          <a-form-model-item label="液位展示JSON串" prop="liquidConfig">
         <a-input v-model="form.liquidConfig" placeholder="请输入液位展示JSON串" />
       </a-form-model-item>
-      <a-form-model-item label="装备日期" prop="allocateDate" >
-        <a-date-picker style="width: 100%" v-model="form.allocateDate" format="YYYY-MM-DD HH:mm:ss" allow-clear/>
-      </a-form-model-item>
-      <a-form-model-item label="备注" prop="remark" >
-        <a-input v-model="form.remark" placeholder="请输入内容" type="textarea" allow-clear />
-      </a-form-model-item>
-      <a-form-model-item label="文档,引文逗号隔开" prop="document" >
-        <file-upload v-model="form.document" type="file"></file-upload>
-      </a-form-model-item>
-      <a-form-model-item label="多张照片引文逗号隔开" prop="photo" >
-        <file-upload v-model="form.photo" type="image"></file-upload>
-      </a-form-model-item>
-      <a-form-model-item label="0可使、1使用中、2维修中、3已停用" prop="status" >
-        <a-select placeholder="请选择0可使、1使用中、2维修中、3已停用" v-model="form.status">
-          <a-select-option v-for="(d, index) in statusOptions" :key="index" :value="d.value" >{{ d.label }}</a-select-option>
-        </a-select>
-      </a-form-model-item>
-      <a-form-model-item label="百公里油耗" prop="fuelConsumption" >
-        <a-input v-model="form.fuelConsumption" placeholder="请输入百公里油耗" />
-      </a-form-model-item>
-      <a-form-model-item label="重庆车辆ID" prop="cqVehicleId" >
+        </a-col>
+      </a-row> -->
+      <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="装备日期" prop="allocateDate">
+            <a-date-picker style="width: 100%" v-model="form.allocateDate" format="YYYY-MM-DD HH:mm:ss" allow-clear />
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="10">
+          <a-form-model-item label="车速限制" prop="speedLimit">
+            <a-input v-model="form.speedLimit" placeholder="请输入车速限制" />
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="文档" prop="document">
+            <file-upload v-model="form.document" type="file" @UpdateImg="UpdateDociment"></file-upload>
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="10">
+          <a-form-model-item label="车辆类型" prop="type">
+            <a-select placeholder="请选择车辆类型" v-model="form.type">
+              <a-select-option v-for="(d, index) in typeOptions" :key="index" :value="d.value">{{
+                d.label
+              }}</a-select-option>
+            </a-select>
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="状态" prop="status">
+            <a-select placeholder="请选择" v-model="form.status">
+              <a-select-option v-for="(d, index) in statusOptions" :key="index" :value="d.value">{{
+                d.label
+              }}</a-select-option>
+            </a-select>
+          </a-form-model-item>
+        </a-col>
+        <a-col :span="10">
+          <a-form-model-item label="百公里油耗" prop="fuelConsumption">
+            <a-input v-model="form.fuelConsumption" placeholder="请输入百公里油耗" />
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <!-- <a-row>
+      <a-col :span=10>
+        <a-form-model-item label="重庆车辆ID" prop="cqVehicleId">
         <a-input v-model="form.cqVehicleId" placeholder="请输入重庆车辆ID" />
       </a-form-model-item>
-      <a-form-model-item label="定位数据" prop="location" >
+      </a-col>
+      <a-col :span=10>
+        <a-form-model-item label="定位数据" prop="location">
         <a-input v-model="form.location" placeholder="请输入定位数据" />
       </a-form-model-item>
-      <a-form-model-item label="电子围栏ID" prop="electricFenceId" >
+      </a-col>
+     </a-row> -->
+      <a-row>
+        <!-- <a-col :span="10">
+        <a-form-model-item label="电子围栏ID" prop="electricFenceId">
         <a-input v-model="form.electricFenceId" placeholder="请输入电子围栏ID" />
       </a-form-model-item>
-      <a-form-model-item label="价格" prop="bidPrice" >
-        <a-input v-model="form.bidPrice" placeholder="请输入价格" />
-      </a-form-model-item>
-      <a-form-model-item label="是否物联:0否、1是" prop="iot" >
-        <a-select placeholder="请选择是否物联:0否、1是" v-model="form.iot">
-          <a-select-option v-for="(d, index) in iotOptions" :key="index" :value="d.value" >{{ d.label }}</a-select-option>
-        </a-select>
-      </a-form-model-item>
-      <a-form-model-item label="离线时间" prop="offineTime" >
-        <a-input v-model="form.offineTime" placeholder="请输入离线时间" />
-      </a-form-model-item>
-      <a-form-model-item label="车速限制" prop="speedLimit" >
-        <a-input v-model="form.speedLimit" placeholder="请输入车速限制" />
+      </a-col> -->
+        <a-col :span="10">
+          <a-form-model-item label="价格" prop="bidPrice">
+            <a-input v-model="form.bidPrice" placeholder="请输入价格" />
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-row>
+        <a-col :span="10">
+          <a-form-model-item label="离线时间" prop="offineTime">
+            <a-input v-model="form.offineTime" placeholder="请输入离线时间" />
+          </a-form-model-item>
+        </a-col>
+      </a-row>
+      <a-form-model-item label="备注" prop="remark">
+        <a-input v-model="form.remark" placeholder="请输入内容" type="textarea" allow-clear />
       </a-form-model-item>
       <div class="bottom-control">
         <a-space>
-          <a-button type="primary" :loading="submitLoading" @click="submitForm">
-            保存
-          </a-button>
-          <a-button type="dashed" @click="cancel">
-            取消
-          </a-button>
+          <a-button type="primary" :loading="submitLoading" @click="submitForm"> 保存 </a-button>
+          <a-button type="dashed" @click="cancel"> 取消 </a-button>
         </a-space>
       </div>
     </a-form-model>
@@ -155,35 +313,42 @@
 </template>
 
 <script>
-import { getCar, addCar, updateCar } from '@/api/clw/car'
+import { getCar, addCar, updateCar, getUserList } from '@/api/clw/car'
 
 export default {
   name: 'CreateForm',
   props: {
     sourceOptions: {
       type: Array,
-      required: true
+      required: true,
     },
     domesticImportOptions: {
       type: Array,
-      required: true
+      required: true,
     },
     typeOptions: {
       type: Array,
-      required: true
+      required: true,
     },
     statusOptions: {
       type: Array,
-      required: true
+      required: true,
     },
     iotOptions: {
       type: Array,
-      required: true
-    }
-  },
-  components: {
+      required: true,
+    },
+    deptOptions: {
+      type: Array,
+      required: true,
+    },
+    carTypeList: {
+      type: Array,
+      required: true,
+    },
   },
-  data () {
+  components: {},
+  data() {
     return {
       submitLoading: false,
       formTitle: '',
@@ -273,129 +438,79 @@ export default {
 
         offineTime: null,
 
-        speedLimit: null
-
+        speedLimit: null,
       },
       // 1增加,2修改
       formType: 1,
       open: false,
       rules: {
-        deptId: [
-          { required: true, message: '部门ID不能为空', trigger: 'change' }
-        ],
-
-        plateNumber: [
-          { required: true, message: '车牌号不能为空', trigger: 'blur' }
-        ],
+        deptId: [{ required: true, message: '所属消防站不能为空', trigger: 'change' }],
 
-        userId: [
-          { required: true, message: '负责人不能为空', trigger: 'change' }
-        ],
+        plateNumber: [{ required: true, message: '车牌号不能为空', trigger: 'blur' }],
 
-        categoryId: [
-          { required: true, message: '车辆类型不能为空', trigger: 'change' }
-        ],
+        userId: [{ required: true, message: '负责人不能为空', trigger: 'change' }],
 
-        terminalBind: [
-          { required: true, message: '终端绑定不能为空', trigger: 'blur' }
-        ],
+        categoryId: [{ required: true, message: '车辆类型不能为空', trigger: 'change' }],
 
-        source: [
-          { required: true, message: '车辆来源不能为空', trigger: 'change' }
-        ],
+        iot: [{ required: true, message: '请选择是否接入物联网', trigger: 'change' }],
 
-        domesticImport: [
-          { required: true, message: '国产/进口不能为空', trigger: 'change' }
-        ],
+        source: [{ required: true, message: '车辆来源不能为空', trigger: 'change' }],
 
-        manufactureCountry: [
-          { required: true, message: '制造国不能为空', trigger: 'blur' }
-        ],
+        domesticImport: [{ required: true, message: '国产/进口不能为空', trigger: 'change' }],
 
-        manufactureCompany: [
-          { required: true, message: '制造企业不能为空', trigger: 'blur' }
-        ],
+        // manufactureCountry: [{ required: true, message: '制造国不能为空', trigger: 'blur' }],
 
-        brand: [
-          { required: true, message: '车辆品牌不能为空', trigger: 'blur' }
-        ],
+        // manufactureCompany: [{ required: true, message: '制造企业不能为空', trigger: 'blur' }],
 
-        model: [
-          { required: true, message: '车辆型号不能为空', trigger: 'blur' }
-        ],
+        // brand: [{ required: true, message: '车辆品牌不能为空', trigger: 'blur' }],
 
-        identificationCode: [
-          { required: true, message: '车辆识别代码不能为空', trigger: 'blur' }
-        ],
+        // model: [{ required: true, message: '车辆型号不能为空', trigger: 'blur' }],
 
-        color: [
-          { required: true, message: '车辆颜色不能为空', trigger: 'blur' }
-        ],
+        // identificationCode: [{ required: true, message: '车辆识别代码不能为空', trigger: 'blur' }],
 
-        fuelType: [
-          { required: true, message: '燃油种类不能为空', trigger: 'blur' }
-        ],
+        // color: [{ required: true, message: '车辆颜色不能为空', trigger: 'blur' }],
 
-        engineNumber: [
-          { required: true, message: '发动机号不能为空', trigger: 'blur' }
-        ],
+        // fuelType: [{ required: true, message: '燃油种类不能为空', trigger: 'blur' }],
 
-        emissions: [
-          { required: true, message: '车辆排量不能为空', trigger: 'blur' }
-        ],
+        // engineNumber: [{ required: true, message: '发动机号不能为空', trigger: 'blur' }],
 
-        power: [
-          { required: true, message: '发动机功率不能为空', trigger: 'blur' }
-        ],
+        // emissions: [{ required: true, message: '车辆排量不能为空', trigger: 'blur' }],
 
-        length: [
-          { required: true, message: '长度不能为空', trigger: 'blur' }
-        ],
+        // power: [{ required: true, message: '发动机功率不能为空', trigger: 'blur' }],
 
-        width: [
-          { required: true, message: '宽度不能为空', trigger: 'blur' }
-        ],
+        // length: [{ required: true, message: '长度不能为空', trigger: 'blur' }],
 
-        height: [
-          { required: true, message: '高度不能为空', trigger: 'blur' }
-        ],
+        // width: [{ required: true, message: '宽度不能为空', trigger: 'blur' }],
 
-        fuelCapacity: [
-          { required: true, message: '油箱容积/L不能为空', trigger: 'blur' }
-        ],
+        // height: [{ required: true, message: '高度不能为空', trigger: 'blur' }],
 
-        seatNumber: [
-          { required: true, message: '座位数量不能为空', trigger: 'blur' }
-        ],
+        // fuelCapacity: [{ required: true, message: '油箱容积/L不能为空', trigger: 'blur' }],
 
-        cylinderNumber: [
-          { required: true, message: '气缸数量不能为空', trigger: 'blur' }
-        ]
+        // seatNumber: [{ required: true, message: '座位数量不能为空', trigger: 'blur' }],
 
-      }
+        // cylinderNumber: [{ required: true, message: '气缸数量不能为空', trigger: 'blur' }],
+      },
+      userList: [],
     }
   },
-  filters: {
-  },
-  created () {
-  },
-  computed: {
-  },
-  watch: {
-  },
-  mounted () {
+  filters: {},
+  created() {
+    this.funUserList()
   },
+  computed: {},
+  watch: {},
+  mounted() {},
   methods: {
-    onClose () {
+    onClose() {
       this.open = false
     },
     // 取消按钮
-    cancel () {
+    cancel() {
       this.open = false
       this.reset()
     },
     // 表单重置
-    reset () {
+    reset() {
       this.formType = 1
       this.form = {
         deptId: null,
@@ -482,23 +597,22 @@ export default {
 
         offineTime: null,
 
-        speedLimit: null
-
+        speedLimit: null,
       }
     },
     /** 新增按钮操作 */
-    handleAdd (row) {
+    handleAdd(row) {
       this.reset()
       this.formType = 1
       this.open = true
-      this.formTitle = '添加'
+      this.formTitle = '添加车辆'
     },
     /** 修改按钮操作 */
-    handleUpdate (row, ids) {
+    handleUpdate(row, ids) {
       this.reset()
       this.formType = 2
       const id = row ? row.id : ids
-      getCar(id).then(response => {
+      getCar(id).then((response) => {
         this.form = response.data
         this.open = true
         this.formTitle = '修改'
@@ -506,37 +620,55 @@ export default {
     },
     /** 提交按钮 */
     submitForm: function () {
-      this.$refs.form.validate(valid => {
+      this.$refs.form.validate((valid) => {
         if (valid) {
           this.submitLoading = true
           if (this.form.id !== undefined && this.form.id !== null) {
-            updateCar(this.form).then(response => {
-              this.$message.success(
-                '修改成功',
-                3
-              )
-              this.open = false
-              this.$emit('ok')
-            }).finally(() => {
-              this.submitLoading = false
-            })
+            updateCar(this.form)
+              .then((response) => {
+                this.$message.success('修改成功', 3)
+                this.open = false
+                this.$emit('ok')
+              })
+              .finally(() => {
+                this.submitLoading = false
+              })
           } else {
-            addCar(this.form).then(response => {
-              this.$message.success(
-                '新增成功',
-                3
-              )
-              this.open = false
-              this.$emit('ok')
-            }).finally(() => {
-              this.submitLoading = false
-            })
+            addCar(this.form)
+              .then((response) => {
+                this.$message.success('新增成功', 3)
+                this.open = false
+                this.$emit('ok')
+              })
+              .finally(() => {
+                this.submitLoading = false
+              })
           }
         } else {
           return false
         }
       })
-    }
-  }
+    },
+    funUserList() {
+      const params = {
+        pageSize: 100,
+        pageNum: 1,
+      }
+      getUserList(params).then((res) => {
+        this.userList = res.rows
+      })
+    },
+    UpdateImg(val) {
+      this.form.photo = val
+    },
+    UpdateDociment(val) {
+      this.form.document = val
+    },
+  },
 }
 </script>
+<style lang="less" scoped>
+/deep/.ant-col-10 {
+  margin-right: 30px;
+}
+</style>

+ 93 - 0
src/views/clw/car/modules/Trees.vue

@@ -0,0 +1,93 @@
+<template>
+  <div>
+    <a-input-search style="margin-bottom: 8px" placeholder="请输入消防队单位关键字" @change="filterNode" />
+    <a-tree
+      :expanded-keys="expandedKeys"
+      :auto-expand-parent="autoExpandParent"
+      :tree-data="carTypeList"
+      :replaceFields="replaceFields"
+      @select="handleNodeClick"
+      @expand="onExpand"
+    >
+    </a-tree>
+  </div>
+</template>
+<script>
+const getParentKey = (id, tree) => {
+  let parentKey
+  for (let i = 0; i < tree.length; i++) {
+    const node = tree[i]
+    if (node.children) {
+      if (node.children.some((item) => item.categoryId === id)) {
+        parentKey = node.categoryId
+      } else if (getParentKey(id, node.children)) {
+        parentKey = getParentKey(id, node.children)
+      }
+    }
+  }
+  return parentKey
+}
+export default {
+  name: 'DeptTree',
+  props: {
+    carTypeList: {
+      type: Array,
+      required: true,
+    },
+  },
+  components: {},
+  data() {
+    return {
+      replaceFields: { children: 'children', title: 'categoryName', key: 'categoryId', value: 'categoryId' },
+      deptNodes: [],
+      expandedKeys: [],
+      searchValue: '',
+      autoExpandParent: true,
+    }
+  },
+  filters: {},
+  created() {},
+  computed: {},
+  watch: {},
+  methods: {
+    getAllDeptNode(nodes) {
+      if (!nodes || nodes.length === 0) {
+        return []
+      }
+      nodes.forEach((node) => {
+        // console.log('----node',node);
+        this.deptNodes.push({ categoryId: node.categoryId, categoryName: node.categoryName })
+        return this.getAllDeptNode(node.children)
+      })
+    },
+    // 筛选节点
+    filterNode(e) {
+      this.getAllDeptNode(this.carTypeList)
+      const value = e.target.value
+      const gData = this.carTypeList
+      const expandedKeys = this.deptNodes
+        .map((item) => {
+          if (item.categoryName.indexOf(value) > -1) {
+            return getParentKey(item.categoryId, gData)
+          }
+          return null
+        })
+        .filter((item, i, self) => item && self.indexOf(item) === i)
+      Object.assign(this, {
+        expandedKeys: expandedKeys,
+        searchValue: value,
+        autoExpandParent: true,
+      })
+      this.deptNodes = []
+    },
+    // 节点单击事件
+    handleNodeClick(keys, event) {
+      this.$emit('select', keys[0])
+    },
+    onExpand(expandedKeys) {
+      this.expandedKeys = expandedKeys
+      this.autoExpandParent = false
+    },
+  },
+}
+</script>