| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678 |
- <template>
- <div>
- <basic-container>
- <avue-crud
- ref="crud"
- :data="dataList"
- :option="option"
- :page.sync="page"
- :search.sync="search"
- :table-loading="loading"
- v-model="form"
- @on-load="onLoad"
- @row-save="rowSave"
- @row-update="rowUpdate"
- @row-del="rowDel"
- @search-change="searchChange"
- :before-open="beforeOpen"
- @search-reset="searchReset"
- @refresh-change="refreshChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @search-criteria-switch="searchCriteriaSwitch"
- >
- <template slot="menuLeft">
- <el-button type="primary"
- size="small"
- icon="el-icon-upload2"
- @click="handleImport">导入
- </el-button>
- </template>
- <template slot="urlForm" slot-scope="{ row }">
- <el-input
- placeholder="文件地址"
- size="small"
- v-if="row.$cellEdit"
- v-model="row.url"
- class="input-with-select">
- <el-button size="small" type="primary" slot="prepend" @click="download(row)">查看</el-button>
- <el-upload
- class="upload-demo"
- :show-file-list="false"
- slot="append"
- :action="action"
- :headers="headers"
- :on-success="(response)=>{onSuccessTwo(response,row)}"
- :multiple="false">
- <el-button size="small" type="primary">上传</el-button>
- </el-upload>
- </el-input>
- <span v-else>{{ row.url }}</span>
- </template>
- <template slot="fleetIdForm" slot-scope="{ row }">
- <span>{{ row }}</span>
- <crop-select
- v-model="form.fleetId"
- corpType="CD"
- />
- </template>
- <template slot="fleetIdSearch">
- <crop-select v-model="search.fleetId" corpType="CD"></crop-select>
- </template>
- <template slot="fleetId" slot-scope="{row,disabled}">
- <span>{{ row.fleetName }}</span>
- </template>
- <template slot="driverId" slot-scope="{row,disabled}">
- <span>{{ row.driverName }}</span>
- </template>
- </avue-crud>
- <el-dialog title="导入"
- append-to-body
- :visible.sync="excelBox"
- width="555px">
- <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
- <template slot="excelTemplate">
- <el-button type="primary" @click="handleTemplate">
- 点击下载<i class="el-icon-download el-icon--right"></i>
- </el-button>
- </template>
- </avue-form>
- <p style="text-align: center;color: #DC0505">
- 温馨提示 第一次导入时请先下载模板
- </p>
- </el-dialog>
- </basic-container>
- </div>
- </template>
- <script>
- import {getCarList, carSubmit, carRemove, detailDelegationList, removeFile} from "@/api/landTransportation/car";
- import {getToken} from '@/util/auth';
- export default {
- name: "index",
- data() {
- return {
- dataList: [],
- excelOption: {
- submitBtn: false,
- emptyBtn: false,
- column: [
- {
- label: '模板下载',
- prop: 'excelTemplate',
- formslot: true,
- span: 24,
- }, {
- label: '模板上传',
- prop: 'excelFile',
- type: 'upload',
- drag: true,
- loadText: '模板上传中,请稍等',
- span: 24,
- propsHttp: {
- res: 'data'
- },
- tip: '请上传 .xls,.xlsx 标准格式文件',
- action: "/api/blade-client/land-vehicle/import-data"
- }
- ]
- },
- excelForm: {},
- option: {
- dialogWidth: '85%',
- searchIcon: true,
- searchIndex: 2,
- searchMenuSpan: 24,
- stripe: true,
- searchLabelWidth: 100,
- align: 'center',
- index: true,
- column: [{
- label: '车牌号',
- prop: 'plateNo',
- index: 1,
- width: 140,
- cell: true,
- overHidden: true,
- search: true,
- span: 8,
- searchSpan: 8,
- rules: [{
- required: true,
- message: "请输入车牌号",
- trigger: "blur"
- }],
- }, {
- label: '车队名称',
- prop: 'fleetId',
- index: 2,
- width: 140,
- cell: true,
- overHidden: true,
- search: true,
- span: 8,
- searchSpan: 8,
- }, {
- label: '司机名称',
- prop: 'driverId',
- index: 3,
- width: 140,
- cell: true,
- overHidden: true,
- search: true,
- span: 8,
- searchSpan: 8,
- type: 'select',
- filterable:true,
- dicUrl: "/api/blade-client/land-driver/driver-list?vehicleId={{key}}",
- props: {
- label: "name",
- value: "id"
- },
- }, {
- label: '挂车号',
- prop: 'trailerNo',
- index: 4,
- width: 140,
- cell: true,
- overHidden: true,
- search: true,
- span: 8,
- searchSpan: 8,
- }, {
- label: '燃油类型',
- prop: 'fuelType',
- index: 5,
- width: 140,
- cell: true,
- overHidden: true,
- search: true,
- span: 8,
- searchSpan: 8,
- }, {
- type: "select",
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=carType",
- props: {
- label: "dictValue",
- value: "dictValue"
- },
- label: '车辆类型',
- prop: 'type',
- index: 6,
- width: 140,
- cell: true,
- overHidden: true,
- search: true,
- span: 8,
- searchSpan: 8,
- }, {
- label: '车辆品牌',
- prop: 'brand',
- index: 7,
- width: 140,
- cell: true,
- overHidden: true,
- search: true,
- span: 8,
- searchSpan: 8,
- }, {
- label: '制造单位',
- prop: 'manufacturer',
- index: 8,
- width: 140,
- cell: true,
- overHidden: true,
- search: true,
- span: 8,
- searchSpan: 8,
- }, {
- label: '发证机关',
- prop: 'issuingAuthority',
- index: 9,
- width: 140,
- cell: true,
- overHidden: true,
- search: true,
- span: 8,
- searchSpan: 8,
- }, {
- label: '牵引车辆型号',
- prop: 'towModel',
- index: 10,
- width: 140,
- cell: true,
- overHidden: true,
- search: true,
- span: 8,
- searchSpan: 8,
- }, {
- label: '牵引车车架号',
- prop: 'towVin',
- index: 11,
- width: 140,
- cell: true,
- overHidden: true,
- search: true,
- span: 8,
- searchSpan: 8,
- }, {
- label: '挂车型号',
- prop: 'trailerModel',
- index: 12,
- width: 140,
- cell: true,
- overHidden: true,
- search: true,
- span: 8,
- searchSpan: 8,
- }, {
- label: '挂车车架号',
- prop: 'trailerVin',
- index: 13,
- width: 140,
- cell: true,
- overHidden: true,
- search: true,
- span: 8,
- searchSpan: 8,
- }, {
- label: '发动机型号',
- prop: 'engineModel',
- index: 14,
- width: 140,
- cell: true,
- overHidden: true,
- search: true,
- span: 8,
- searchSpan: 8,
- }, {
- label: '核载人数',
- prop: 'allowPassenger',
- index: 15,
- width: 140,
- cell: true,
- overHidden: true,
- search: true,
- span: 8,
- searchSpan: 8,
- }, {
- label: '购车日期',
- prop: 'purchaseDate',
- index: 16,
- width: 140,
- cell: true,
- overHidden: true,
- search: true,
- searchRange: true,
- span: 8,
- searchSpan: 8,
- type: "date",
- searchDefaultTime: ['00:00:00', '23:59:59'],
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss",
- }, {
- label: '注册日期',
- prop: 'registerDate',
- index: 17,
- width: 140,
- overHidden: true,
- type: "date",
- searchRange: true,
- search: true,
- span: 8,
- searchSpan: 8,
- searchDefaultTime: ['00:00:00', '23:59:59'],
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss",
- }, {
- label: '报废日期',
- prop: 'scrapDate',
- index: 18,
- width: 140,
- overHidden: true,
- search: true,
- searchRange: true,
- span: 8,
- searchSpan: 8,
- type: "date",
- searchDefaultTime: ['00:00:00', '23:59:59'],
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss",
- }, {
- label: '外廓尺寸mm',
- prop: 'oto',
- index: 19,
- width: 140,
- cell: true,
- overHidden: true,
- span: 8,
- searchSpan: 8,
- }, {
- label: '总重量kg',
- prop: 'totalWeight',
- index: 20,
- width: 140,
- cell: true,
- overHidden: true,
- span: 8,
- searchSpan: 8,
- }, {
- label: '核定重量kg',
- prop: 'approvedWeight',
- index: 21,
- width: 140,
- cell: true,
- overHidden: true,
- span: 8,
- searchSpan: 8,
- }, {
- label: '装备重量kg',
- prop: 'equipmentWeight',
- index: 22,
- width: 140,
- cell: true,
- overHidden: true,
- span: 8,
- searchSpan: 8,
- }, {
- label: '年审',
- prop: 'inspectExpired',
- overHidden: true,
- type: "date",
- searchRange: true,
- search: true,
- span: 8,
- searchSpan: 8,
- searchDefaultTime: ['00:00:00', '23:59:59'],
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss",
- }, {
- label: '保险',
- prop: 'insuranceExpired',
- overHidden: true,
- type: "date",
- searchRange: true,
- search: true,
- span: 8,
- searchSpan: 8,
- searchDefaultTime: ['00:00:00', '23:59:59'],
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss",
- }, {
- label: '位置获取来源',
- prop: 'locationSource',
- span: 8,
- searchSpan: 8,
- type: 'select',
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=location_source",
- props: {
- label: "dictValue",
- value: "dictKey"
- }
- }, {
- label: 'gpsid',
- index: 19,
- prop: 'gpsid',
- span: 8,
- searchSpan: 8,
- },
- // {
- // label: '信用等级',
- // width: 150,
- // span: 8,
- // searchSpan: 8,
- // prop: 'salesman',
- // search: true,
- // overHidden: true,
- // type: "select",
- // dicUrl: "/api/blade-system/dict-biz/dictionary?code=credit_rating",
- // props: {
- // label: "dictValue",
- // value: "dictKey"
- // },
- // },
- {
- label: '附件',
- prop: 'fileList',
- type: 'dynamic',
- hide: true,
- showColumn: false,
- span: 24,
- children: {
- align: 'center',
- stripe: true,
- headerAlign: 'center',
- rowAdd: (done) => {
- // this.$message.success('新增回调');
- done()
- },
- rowDel: (row, done) => {
- if (row.id) {
- removeFile(row.id).then(res => {
- done();
- })
- } else {
- done();
- }
- },
- column: [{
- width: 360,
- label: '文件地址',
- prop: "url"
- }, {
- width: 200,
- label: '文件名称',
- prop: "fileName",
- formslot: true
- }, {
- width: 200,
- label: '文件属性',
- type: "select",
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=file_type",
- props: {
- label: "dictValue",
- value: "dictValue"
- }
- }, {
- label: '备注',
- prop: "remarks",
- }]
- }
- },
- {
- label: '司机变更记录',
- prop: 'vehicleChangeList',
- type: 'dynamic',
- span: 24,
- hide: true,
- showColumn: false,
- children: {
- align: 'center',
- headerAlign: 'center',
- addBtn: false,
- stripe: true,
- delBtn: false,
- cellBtn: false,
- column: [
- {
- label: '司机名',
- prop: "driverName",
- cell: false
- }, {
- label: '变更人',
- prop: "changeUserName",
- cell: false
- }, {
- label: '变更日期',
- prop: "changeTime",
- cell: false
- }]
- }
- }
- ]
- },
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- pageSizes: [10, 50, 100, 200, 300]
- },
- query:{},
- search: {},
- loading: false,
- action: "/api/blade-resource/oss/endpoint/put-file",
- headers: {"Blade-Auth": "Bearer " + getToken()},
- ids: [], // id集合
- form: {},
- excelBox: false
- }
- },
- created() {
- let i = 0;
- this.option.column.forEach(item => {
- if (item.search) i++
- })
- if (i % 3 !== 0) {
- const num = 3 - Number(i % 3)
- this.option.searchMenuSpan = num * 8;
- this.option.searchMenuPosition = "right";
- }
- },
- methods: {
- handleImport() {
- this.excelBox = true;
- },
- uploadAfter(res, done, loading, column) {
- this.excelBox = false;
- this.refreshChange();
- done();
- },
- handleTemplate() {
- window.open(`/api/blade-client/land-vehicle/import-template?${this.website.tokenHeader}=${getToken()}`);
- },
- //点击行编辑时查看
- beforeOpen(done, type) {
- if (this.form.id) {
- detailDelegationList(this.form.id).then(res => {
- this.form = res.data.data
- done()
- })
- } else {
- done()
- }
- },
- // 获得高度
- searchCriteriaSwitch(type) {
- if (type) {
- this.option.height = this.option.height - 322
- } else {
- this.option.height = this.option.height + 322
- }
- this.$refs.crud.getTableHeight()
- },
- onLoad(page, params) {
- const queryParams = Object.assign({}, this.query, {
- size: page.pageSize,
- current: page.currentPage,
- })
- getCarList(queryParams).then(res => {
- this.dataList = res.data.data.records;
- this.page.total = res.data.data.total;
- this.option.height = window.innerHeight - 240;
- })
- },
- rowSave(form, done, loading) {
- carSubmit(form).then(res => {
- this.$message.success(form.id ? '修改成功' : '新增成功')
- })
- this.onLoad(this.page)
- done();
- },
- rowUpdate(form, index, done) {
- carSubmit(form).then(res => {
- this.$message.success(form.id ? '修改成功' : '新增成功')
- })
- this.onLoad(this.page)
- done();
- },
- rowDel(row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- const ids = this.ids.length == 0 ? row.id : this.ids.join(',');
- carRemove({ids}).then(res => {
- this.$message.success('删除成功');
- this.onLoad(this.page);
- })
- })
- },
- //附件上传成功
- onSuccessTwo(response, row) {
- row.url = response.data.link
- row.fileName = response.data.originalName
- },
- //下载附件
- download(row) {
- if (row.url) {
- window.open(row.url)
- } else {
- this.$message.warning('无附件,请上传附件后再查看');
- }
- },
- // 搜索
- searchChange(params, done) {
- this.page.currentPage = 1;
- let data = params
- if (data.purchaseDate) {
- data.beginPurchaseDate = params.purchaseDate[0]
- data.endPurchaseDate = params.purchaseDate[1]
- }
- if (data.registerDate) {
- data.beginRegisterDate = params.registerDate[0]
- data.endRegisterDate = params.registerDate[1]
- }
- if (data.scrapDate) {
- data.beginScrapDate = params.scrapDate[0]
- data.endScrapDate = params.scrapDate[1]
- }
- if (data.inspectExpired) {
- data.beginInspectExpired = params.inspectExpired[0]
- data.endInspectExpired = params.inspectExpired[1]
- }
- if (data.insuranceExpired) {
- data.beginInsuranceExpired = params.insuranceExpired[0]
- data.endInsuranceExpired = params.insuranceExpired[1]
- }
- delete data.purchaseDate
- delete data.registerDate
- delete data.scrapDate
- delete data.inspectExpired
- delete data.insuranceExpired
- this.query = data
- this.onLoad(this.page, data);
- done()
- },
- // 重置
- searchReset() {
- },
- //刷新
- refreshChange() {
- this.onLoad(this.page, this.search)
- },
- currentChange(currentPage) {
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize) {
- this.page.pageSize = pageSize;
- },
- },
- }
- </script>
- <style scoped>
- </style>
|