| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458 |
- <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"
- @search-reset="searchReset"
- @refresh-change="refreshChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @search-criteria-switch="searchCriteriaSwitch"
- >
- <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="KH"
- />
- </template>
- <template slot="fleetIdSearch">
- <crop-select v-model="search.fleetId" corpType="KH"></crop-select>
- </template>
- </avue-crud>
- </basic-container>
- </div>
- </template>
- <script>
- import { getCarList, carSubmit, carRemove } from "@/api/landTransportation/car";
- import {getToken} from '@/util/auth';
- export default {
- name: "index",
- data(){
- return{
- dataList:[],
- option:{
- searchIcon: true,
- searchIndex: 2,
- searchMenuSpan: 24,
- 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,
- },{
- 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,
- span: 8,
- searchSpan: 8,
- },{
- label: '注册日期',
- prop: 'registerDate',
- index: 17,
- width: 140,
- cell: true,
- overHidden: true,
- search:true,
- span: 8,
- searchSpan: 8,
- },{
- label: '报废日期',
- prop: 'scrapDate',
- index: 18,
- width: 140,
- cell: true,
- overHidden: true,
- search:true,
- span: 8,
- searchSpan: 8,
- },{
- label: '外廓尺寸mm',
- prop: 'oto',
- index: 19,
- width: 140,
- cell: true,
- overHidden: true,
- search:true,
- span: 8,
- searchSpan: 8,
- },{
- label: '总重量kg',
- prop: 'totalWeight',
- index: 20,
- width: 140,
- cell: true,
- overHidden: true,
- search:true,
- span: 8,
- searchSpan: 8,
- },{
- label: '核定重量kg',
- prop: 'approvedWeight',
- index: 21,
- width: 140,
- cell: true,
- overHidden: true,
- search:true,
- span: 8,
- searchSpan: 8,
- },{
- label: '装备重量kg',
- prop: 'equipmentWeight',
- index: 22,
- width: 140,
- cell: true,
- overHidden: true,
- search:true,
- span: 8,
- searchSpan: 8,
- },{
- label: '附件',
- prop: 'fileList',
- type: 'dynamic',
- hide: true,
- showColumn: false,
- span:24,
- children: {
- align: 'center',
- headerAlign: 'center',
- rowAdd:(done)=>{
- // this.$message.success('新增回调');
- done()
- },
- rowDel:(row,done)=>{
- // this.$message.success('删除回调'+JSON.stringify(row));
- done();
- },
- column: [{
- width: 200,
- label: '文件名称',
- prop: "fileName",
- formslot: true
- }, {
- width: 360,
- label: '文件地址',
- prop: "url"
- }, {
- width: 200,
- label: '文件属性',
- type: "select",
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=file_type",
- props: {
- label: "dictValue",
- value: "dictValue"
- }
- }, {
- label: '备注',
- prop: "remarks",
- }]
- }
- }]
- },
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- pageSizes: [10,50,100,200,300]
- },
- search: {},
- loading: false,
- action: "/api/blade-resource/oss/endpoint/put-file",
- headers: { "Blade-Auth": "Bearer " + getToken() },
- ids: [], // id集合
- form: {},
- }
- },
- 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: {
- // 获得高度
- searchCriteriaSwitch(type){
- if (type){
- this.option.height = this.option.height - 390
- }else {
- this.option.height = this.option.height + 390
- }
- this.$refs.crud.getTableHeight()
- },
- onLoad(page, params) {
- const queryParams = Object.assign({}, params, {
- 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;
- this.onLoad(this.page, params);
- 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>
|