ll
liukangdong
2024-11-05 2f8216198bcf091bf7758326aef222d6631b258f
admin/src/views/vehicle/cars.vue
@@ -9,10 +9,14 @@
        <el-input v-model="searchForm.memberName" clearable placeholder="车主信息"
          @keypress.enter.native="search"></el-input>
      </el-form-item>
      <!-- <el-form-item label="" prop="cateName" title="车辆分类名称">
        <el-input v-model="searchForm.cateName" clearable placeholder="车辆分类名称"
          @keypress.enter.native="search"></el-input>
      </el-form-item> -->
      <el-form-item label="" prop="catePName" title="分类名称">
        <el-cascader v-model="searchForm.cateIds" @change="changeSel" clearable :options="cateList" :props="{
          label: 'name',
          value: 'id',
          children: 'childCategoryList',
          checkStrictly: true
        }"></el-cascader>
      </el-form-item>
      <el-form-item label="" prop="companyName" title="车主组织名称">
        <el-input v-model="searchForm.companyName" clearable placeholder="车主组织名称"
          @keypress.enter.native="search"></el-input>
@@ -37,9 +41,14 @@
    </el-form>
    <!-- 表格和分页 -->
    <template v-slot:table-wrap>
      <ul class="toolbar" v-permissions="['business:cars:create', 'business:parkBook:create']">
      <ul class="toolbar"
        v-permissions="['business:cars:create', 'business:cars:exportExcel', 'business:parkBook:create']">
        <li><el-button type="primary" @click="handleEdit" icon="el-icon-plus"
            v-permissions="['business:cars:create']">新建</el-button></li>
        <li><el-button type="primary" @click="$refs.OperaCarsImportWindowRef.open('人员导入', searchForm.companyType)" v-permissions="['business:cars:create']">车辆导入</el-button>
        </li>
        <li><el-button type="primary" @click="exportExcel" v-permissions="['business:cars:exportExcel']">导出</el-button>
        </li>
        <li><el-button type="primary" @click="startEmpowerBatch" icon="el-icon-plus"
            v-permissions="['business:parkbook:create']">下发授权</el-button></li>
      </ul>
@@ -55,7 +64,8 @@
        </el-table-column>
        <el-table-column prop="memberName" label="车主姓名" min-width="100px"></el-table-column>
        <el-table-column prop="memberPhone" label="车主手机号" min-width="100px"></el-table-column>
        <el-table-column prop="cateName" label="车辆分类" min-width="160px"></el-table-column>
        <el-table-column prop="catePName" label="一级分类" min-width="120px"></el-table-column>
        <el-table-column prop="cateName" label="二级分类" min-width="120px"></el-table-column>
        <el-table-column prop="companyName" label="车主组织" min-width="200px"></el-table-column>
        <el-table-column label="是否授权" align="center" min-width="100px">
          <template slot-scope="{row}">
@@ -70,7 +80,7 @@
                <span
                  :style="(item.hkStatus == 0 ? 'color:#2080f7' : (item.hkStatus == 1 ? 'color:green' : (item.hkStatus == 2 ? 'color:red' : '')))">【{{
                    item.hkStatus ==
                      0 ? '等待下发' : (item.hkStatus == 1 ? '下发成功' : (item.hkStatus == 2 ?'下发失败':''))}}】 </span>{{
                      0 ? '等待下发' : (item.hkStatus == 1 ? '下发成功' : (item.hkStatus == 2 ? '下发失败' : '')) }}】 </span>{{
                    item.parksName }}
              </span>
            </div>
@@ -111,6 +121,7 @@
    </template>
    <!-- 新建/修改 -->
    <OperaCarAuthWindow ref="operaCarAuthWindow" @success="handlePageChange" />
    <OperaCarsImportWindow ref="OperaCarsImportWindowRef" @success="handlePageChange" />
    <OperaCarsWindow v-if="isShowEdit" ref="operaCarsWindow" @close="isShowEdit = false" @success="handlePageChange" />
  </TableLayout>
</template>
@@ -121,10 +132,12 @@
import Pagination from '@/components/common/Pagination'
import OperaCarsWindow from '@/components/business/OperaCarsWindow'
import OperaCarAuthWindow from '@/components/business/OperaCarAuthWindow'
import OperaCarsImportWindow from './components/OperaCarsImportWindow'
import { fetchList } from '@/api/business/category.js'
export default {
  name: 'Cars',
  extends: BaseTable,
  components: { TableLayout, Pagination, OperaCarsWindow, OperaCarAuthWindow },
  components: { TableLayout, Pagination, OperaCarsWindow, OperaCarAuthWindow,OperaCarsImportWindow },
  data() {
    return {
      // 搜索
@@ -132,10 +145,16 @@
        code: '',
        memberName: '',
        companyName: '',
        cateIds: [],
        catePId: '',
        cateId: '',
        type: null,
        authStatus: null
        authStatus: null,
        ids: ''
      },
      isShowEdit: false
      isShowEdit: false,
      cateList: [],
      selIdsList: []
    }
  },
  created() {
@@ -146,8 +165,36 @@
      'field.main': 'id'
    })
    this.search()
    this.getCate()
  },
  methods: {
    handleSelectionChange(e) {
      this.searchForm.ids = e.map(i => i.id).join(',')
    },
    changeSel(e) {
      console.log(e)
      if (e && e.length == 1) {
        this.$set(this.searchForm, 'catePId', e[0])
        this.$set(this.searchForm, 'cateId', '')
      } else if (e && e.length == 2) {
        this.$set(this.searchForm, 'catePId', e[0])
        this.$set(this.searchForm, 'cateId', e[1])
      } else {
        this.$set(this.searchForm, 'catePId', '')
        this.$set(this.searchForm, 'cateId', '')
      }
      this.search()
    },
    getCate() {
      fetchList({
        model: {},
        capacity: 1000,
        page: 1,
      }).then(res => {
        this.cateList = res.records || []
      })
    },
    handleEdit(row) {
      this.isShowEdit = true
      let str = row && row.id ? '编辑车辆' : '新建车辆'