mg
2022-11-01 1445c7e1f76c4628f4619cf67150a63d6f8f5e90
src/views/operate/car/myIndex/index.vue
@@ -5,7 +5,11 @@
                <div class="search">
                    <span>车辆搜索:</span>
                    <div class="option">
                        <el-input @input="handleSearch" v-model="context" placeholder="请输入车牌号"></el-input>
                        <el-input v-model="context" placeholder="请输入车牌号"></el-input>
                    </div>
                    <div class="findBtn">
                        <el-button type="primary" @click="handleSearch">查询</el-button>
                    </div>
                </div>
                <div class="addCar">
@@ -30,22 +34,24 @@
                    </el-table-column>
                    <el-table-column prop="carModel" label="车型" min-width="10" v-if="mystatus===2">
                    </el-table-column>
                    <el-table-column prop="ownerName" label="车主姓名" min-width="10">
                    <el-table-column :prop="mystatus ===1 ? 'ownerName':'carOwner'" label="车主姓名" min-width="10">
                    </el-table-column>
                    <el-table-column prop="vehicleUser" label="车辆使用人员" min-width="10">
                    <el-table-column v-if="mystatus ===2" :prop="mystatus ===1 ? 'vehicleUser' : 'carUser'" label="车辆使用人员" min-width="10">
                    </el-table-column>
                    <el-table-column prop="contact" label="联系方式" min-width="10">
                    <el-table-column :prop="mystatus ===1 ? 'contact' : 'phone' " label="联系方式" min-width="10">
                    </el-table-column>
                    <el-table-column :prop="mystatus===1 ? 'belong' : 'geographicPosition'" :label="mystatus === 1 ? '所属部门':'施工地址'" min-width="10">
                    <el-table-column :prop="mystatus===1 ? 'pdepartName' : 'geographicPosition'" :label="mystatus === 1 ? '所属部门':'施工地址'" min-width="10">
                    </el-table-column>
                    <el-table-column :prop="mystatus===1 ? 'depart' : 'constructionOrg'" :label="mystatus === 1 ? '所属大队' : '施工单位'" min-width="10">
                    <el-table-column :prop="mystatus===1 ? 'departName' : 'constructionOrg'" :label="mystatus === 1 ? '所属大队' : '施工单位'" min-width="10">
                    </el-table-column>
                    <el-table-column prop="operation" label="操作" min-width="20">
                        <template slot-scope="scope">
                            <div class="btn">
                                <span @click="handleView(scope.row)">查看</span>
                                <!-- <span @click="handleView(scope.row)">查看</span>
                                <span class="line">|</span> -->
                                <span @click="handleEdit(scope.row)">编辑</span>
                                <span class="line">|</span>
                                <span>删除</span>
                                <span @click="handleDelete(scope.row)">删除</span>
                            </div>
                        </template>
                    </el-table-column>
@@ -62,13 +68,19 @@
                    <MyViewLaw v-if="mystatus === 1" :info="info"></MyViewLaw>
                    <MyViewSoil v-else :info="info"></MyViewSoil>
                </el-dialog>
                <!-- 编辑 -->
                <el-dialog :visible.sync="dialogEdit" width="60%" title="编辑车辆信息"
                    v-if="dialogEdit" :before-close="handleClose">
                    <MyEditLaw v-if="mystatus === 1" @closeDialog="closeDialog" :info="info"></MyEditLaw>
                    <MyEditSoil v-else @closeDialog="closeDialog" :info="info"></MyEditSoil>
                </el-dialog>
                <!-- tools -->
                <div class="tools">
                    <div class="funs">
                        <div class="funsItem">
                        <div class="funsItem funs-sp">
                            <el-checkbox v-model="all" @change="selectAll()">全选</el-checkbox>
                        </div>
                        <div class="funsItem">
                        <div class="funsItem funs-sp">
                            <el-checkbox v-model="unsame" @change="disSame(tableData)">反选</el-checkbox>
                        </div>
                        <div class="funsItem">
@@ -95,10 +107,12 @@
import MySoil from './create/soil'
import MyViewLaw from './update/law'
import MyViewSoil from './update/soil'
import MyEditLaw from './edit/law'
import MyEditSoil from './edit/soil'
export default {
    components: {
        Mycreate,MySoil,MyViewLaw,
        MyViewSoil
        MyViewSoil,MyEditLaw,MyEditSoil
    },
    data() {
        return {
@@ -106,6 +120,7 @@
            context: "",
            dialogAdd:false,
            dialogView:false,
            dialogEdit:false,
            info: '',
            totalNum: null,
            pageSize: 10,
@@ -113,7 +128,6 @@
            all: false,
            unsame: false,
            myIdx: 0,
            preMyIdx:0,
            options: [
                {
                    value: 0,
@@ -152,16 +166,22 @@
        }
    },
    created() {
        this.getUserList();
        this.getCarList();
    },
    methods: {
        // 编辑车辆
        handleEdit(data){
            console.log(data)
            this.dialogEdit = true
            this.info = data;
        },
        // 搜索车辆
        handleSearch(val){
            if(this.timer){
                clearTimeout(this.timer);
            }
            this.timer = setTimeout(()=>{
                this.getUserList();
                this.getCarList();
            },1000);
        },
        // 添加车辆
@@ -191,14 +211,14 @@
            })
        },
        // 删除单条数据
        handleDelete({ number }) {
            console.log(number);
        handleDelete({id}) {
            this.$confirm('确认删除?')
                .then(_ => {
                    console.log(1);
                    const {mystatus} = this
                    let myurl = mystatus === 1 ? 'deletion_enforce':'deletion_slag'
                    this.$axios({
                        method: 'delete',
                        url: `sccg/violations/delete?id=${number}`,
                        url: `/sccg/car_Manage/${myurl}?id=${id}`,
                    })
                        .then(res => {
                            console.log(res);
@@ -207,13 +227,13 @@
                                message: res.message
                            })
                            this.getUserList();
                            this.getCarList();
                        })
                })
                .catch(_ => { console.log(2) });
        },
        // 获取用户列表
        async getUserList() {
        // 获取车辆列表
        async getCarList() {
            const { currentPage, pageSize, context, mystatus } = this;
            let arr =[];
            if(mystatus===1){
@@ -221,7 +241,6 @@
            }else{
                arr = await this.getSoilCarList(currentPage, pageSize, context)
            }
            console.log(arr);
            this.tableData = arr.records;
            this.totalNum = arr.total;
        },
@@ -260,7 +279,7 @@
                }
            })
            this.mystatus = idx + 1;
            this.getUserList();
            this.getCarList();
        },
        // 设置表格斑马纹
        tableRowClassName({ row, rowIndex }) {
@@ -274,17 +293,17 @@
        // 当前页改变触发事件
        changeCurrentPage(page) {
            this.currentPage = page;
            this.getUserList();
            this.getCarList();
        },
        // 上一页点击事件
        handlePrev(page) {
            this.currentPage = page;
            this.getUserList();
            this.getCarList();
        },
        // 下一页点击事件
        handleNext(page) {
            this.currentPage = page;
            this.getUserList();
            this.getCarList();
        },
        handleClose(done) {
            this.$confirm('确认关闭?')
@@ -302,13 +321,13 @@
        opernDialog(data){
            this.dialogAdd = true;
            this.caseId = data.id;
            // console.log(data);
        },
        // 关闭界面
        closeDialog({flag,index}){
            this.dialogAdd = flag;
            this.dialogEdit = flag
            if(index===1){
                this.getUserList();
                this.getCarList();
            }
        },
        handleView(data){
@@ -418,12 +437,13 @@
            .funs {
                display: flex;
                .funs-sp{
                    border: 1px solid #17324c;
                }
                .funsItem {
                    line-height: 28px;
                    display: flex;
                    align-items: center;
                    border: 1px solid #17324c;
                    border-radius: 4px;
                    font-size: 12px;
                    margin-left: 10px;