| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359 |
- <template>
- <div>
- <basic-container>
- <avue-crud
- ref="crud"
- :data="dataList"
- :option="option"
- v-model="form"
- :table-loading="loading"
- :page.sync="page"
- @on-load="onLoad"
- @row-del="rowDel"
- @search-change="searchChange"
- @row-update="rowUpdate"
- :before-open="beforeOpen"
- @search-criteria-switch="searchCriteriaSwitch"
- @row-save="rowSave">
- <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-scope="scope" slot="fleetIdForm">
- <crop-select v-model="form.fleetId"/>
- </template>
- <template slot-scope="scope" slot="fleetIdSearch">
- <crop-select v-model="form.fleetId"/>
- </template>
- <template slot-scope="{type,size}" slot="menu">
- <el-button icon="el-icon-check" :size="size" :type="type">创建用户</el-button>
- </template>
- </avue-crud>
- </basic-container>
- </div>
- </template>
- <script>
- import {getToken} from "@/util/auth";
- import {
- saveDelegationList,
- removeDelegationList,
- selectInvoiceList,
- detailDelegationList, removeFile
- } from "@/api/landTransportation/driver";
- export default {
- name: "index",
- data(){
- return{
- form:{},
- dataList:[],
- loading:false,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- pageSizes: [10,50,100,200,300]
- },
- action: "/api/blade-resource/oss/endpoint/put-file",
- headers: { "Blade-Auth": "Bearer " + getToken() },
- option:{
- align:'center',
- dialogWidth:'85%',
- index: true,
- searchIcon: true,
- searchIndex: 2,
- searchLabelWidth:100,
- searchSpan:8,
- column:[{
- label: '司机姓名',
- prop: 'name',
- index: 1,
- width: 140,
- span: 8,
- cell: true,
- overHidden: true,
- search:true,
- },{
- label: '身份证号',
- prop: 'idCard',
- index: 1,
- width: 140,
- span: 8,
- cell: true,
- overHidden: true,
- search:true,
- },{
- label: '准驾车型',
- prop: 'permitModel',
- index: 1,
- width: 140,
- span: 8,
- cell: true,
- overHidden: true,
- search:true,
- },{
- label: '电话',
- prop: 'tel',
- index: 1,
- width: 140,
- span: 8,
- cell: true,
- overHidden: true,
- search:true,
- },{
- label: '所属车队',
- prop: 'fleetId',
- index: 1,
- width: 140,
- span: 8,
- cell: true,
- overHidden: true,
- search:true,
- },{
- label: '性别',
- prop: 'sex',
- index: 1,
- width: 140,
- span: 8,
- cell: true,
- overHidden: true,
- search:true,
- type: 'select',
- dicUrl: "/api/blade-system/dict/dictionary?code=sex",
- props: {
- label: "dictValue",
- value: "dictKey"
- },
- dataType: "number",
- },{
- label: '驾驶证有效期',
- prop: 'driveExpire',
- type: "date",
- format: 'yyyy-MM-dd',
- valueFormat: 'yyyy-MM-dd',
- index: 1,
- width: 140,
- span: 8,
- cell: true,
- overHidden: true,
- search:true,
- },{
- label: '资格证证件号',
- prop: 'qualifiedNo',
- index: 1,
- width: 140,
- span: 8,
- cell: true,
- overHidden: true,
- search:true,
- },{
- label: '资格证有效期',
- prop: 'qualifiedExpire',
- type: "date",
- format: 'yyyy-MM-dd',
- valueFormat: 'yyyy-MM-dd',
- index: 1,
- width: 140,
- span: 8,
- cell: true,
- overHidden: true,
- search:true,
- },{
- label: '押运证证件号',
- prop: 'escortNo',
- index: 1,
- width: 140,
- span: 8,
- cell: true,
- overHidden: true,
- search:true,
- },{
- label: '押运证有效期',
- prop: 'escortExpire',
- type: "date",
- format: 'yyyy-MM-dd',
- valueFormat: 'yyyy-MM-dd',
- index: 1,
- width: 140,
- span: 8,
- cell: true,
- overHidden: true,
- search:true,
- },{
- label: '附件',
- prop: 'fileList',
- type: 'dynamic',
- span:24,
- hide:true,
- showColumn:false,
- children: {
- align: 'center',
- headerAlign: 'center',
- rowAdd:(done)=>{
- // this.$message.success('新增回调');
- done()
- },
- rowDel:(row,done)=>{
- if (row.id) {
- removeFile(row.id).then(res=>{
- done();
- })
- }else {
- 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",
- }]
- }
- }]
- }
- }
- },
- 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 - 138
- }else {
- this.option.height = this.option.height + 138
- }
- this.$refs.crud.getTableHeight()
- },
- //附件上传成功
- 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('无附件,请上传附件后再查看');
- }
- },
- //新增
- rowSave(row,done,loading){
- console.log(row)
- saveDelegationList(row).then(res=>{
- this.$message.success('保存成功');
- this.onLoad(this.page)
- done()
- }, error => {
- window.console.log(error);
- loading();
- })
- },
- //点击行编辑时查看
- beforeOpen(done,type){
- detailDelegationList(this.form.id).then(res=>{
- this.form = res.data.data
- done()
- })
- },
- //修改
- rowUpdate(row,index,done,loading){
- saveDelegationList(row).then(res=>{
- this.$message.success('保存成功');
- this.onLoad(this.page)
- loading();
- // done()
- }, error => {
- window.console.log(error);
- loading();
- })
- },
- //检索
- onLoad(page, params) {
- let queryParams = {
- size: page.pageSize,
- current: page.currentPage,
- ...params
- }
- this.loading = true;
- selectInvoiceList(queryParams).then(res => {
- this.dataList = res.data.data.records
- this.page.total = res.data.data.total
- this.option.height = window.innerHeight - 240;
- }).finally(() => {
- this.loading = false;
- })
- },
- //搜索
- searchChange(params,done) {
- this.onLoad(this.page,params)
- done();
- },
- //列表删除
- rowDel(row){
- this.$confirm('此操作将永久删除该单据, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- removeDelegationList({ids:row.id}).then(res=>{
- this.$message.success('删除成功');
- this.onLoad(this.page)
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- }
- }
- </script>
- <style scoped>
- </style>
|