wl
2023-01-03 e1ac04b42be89ca26ff5f94c17c4e2eebe52a0a2
src/views/operate/car/myIndex/index.vue
@@ -5,46 +5,53 @@
                <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">
                    <el-button type="primary" class="addBtn" @click="handleAddCar">添加车辆</el-button>
                    <el-button type="primary" class="addBtn button-addition" @click="handleAddCar">添加车辆</el-button>
                </div>
            </div>
        </header>
        <main>
            <div class="mainContent">
                <div class="type-nav">
                    <div @click="changeTypeChecked(index)" v-for="(item,index) in typeList" :key="item.name"
                        :class="[item.checked ? 'is-active':'','type-item']">{{item.name}}</div>
                    <div @click="changeTypeChecked(index)" v-for="(item, index) in typeList" :key="item.name"
                        :class="[item.checked ? 'is-active' : '', 'type-item']">{{ item.name }}</div>
                </div>
                <!-- 数据展示 -->
                <el-table ref="multipleTable"
                    :header-cell-style="{background:'#06122c','font-size':'12px',color:'#4b9bb7','font-weight':'650','line-height':'45px'}"
                    :header-cell-style="{'font-weight': '650', 'line-height': '45px' }"
                    :data="tableData" style="width: 100%" :row-class-name="tableRowClassName"
                    @selection-change="tableChange">
                    <el-table-column type="selection" min-width="5">
                    </el-table-column>
                    <el-table-column prop="carNumber" label="车牌号" min-width="10">
                    </el-table-column>
                    <el-table-column prop="carModel" label="车型" min-width="10" v-if="mystatus===2">
                    <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 class="line">|</span>
                                <!-- <span @click="handleView(scope.row)">查看</span>
                                <span class="line">|</span> -->
                                <span @click="handleEdit(scope.row)">编辑</span>
                                <span class="line">|</span>
                                <span @click="handleDelete(scope.row)">删除</span>
@@ -53,20 +60,20 @@
                    </el-table-column>
                </el-table>
                <!-- 新增 -->
                <el-dialog :visible.sync="dialogAdd" width="60%" title="新增车辆"
                    v-if="dialogAdd" :before-close="handleClose">
                    <Mycreate v-if="mystatus === 1"  @closeDialog="closeDialog"></Mycreate>
                <el-dialog :visible.sync="dialogAdd" width="60%" title="新增车辆" v-if="dialogAdd"
                    :before-close="handleClose">
                    <Mycreate v-if="mystatus === 1" @closeDialog="closeDialog"></Mycreate>
                    <MySoil v-else @closeDialog="closeDialog"></MySoil>
                </el-dialog>
                <!-- 查看 -->
                <el-dialog :visible.sync="dialogView" width="60%" title="查看车辆信息"
                    v-if="dialogView" :before-close="handleNoClose">
                <el-dialog :visible.sync="dialogView" width="60%" title="查看车辆信息" v-if="dialogView"
                    :before-close="handleNoClose">
                    <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">
                <el-dialog :visible.sync="dialogEdit" width="60%" title="编辑车辆信息" v-if="dialogEdit"
                   >
                    <MyEditLaw v-if="mystatus === 1" @closeDialog="closeDialog" :info="info"></MyEditLaw>
                    <MyEditSoil v-else @closeDialog="closeDialog" :info="info"></MyEditSoil>
                </el-dialog>
@@ -80,9 +87,9 @@
                            <el-checkbox v-model="unsame" @change="disSame(tableData)">反选</el-checkbox>
                        </div>
                        <div class="funsItem">
                            <el-select v-model="myIdx" placeholder="批量操作" disabled>
                            <el-select v-model="myIdx" placeholder="批量操作" >
                                <el-option v-for="item in options" :key="item.value" :label="item.label"
                                    :value="item.value" :disabled="item.disabled">
                                    :value="item.value" :disabled="item.disabled" @click.native="selectChange">
                                </el-option>
                            </el-select>
                        </div>
@@ -107,16 +114,16 @@
import MyEditSoil from './edit/soil'
export default {
    components: {
        Mycreate,MySoil,MyViewLaw,
        MyViewSoil,MyEditLaw,MyEditSoil
        Mycreate, MySoil, MyViewLaw,
        MyViewSoil, MyEditLaw, MyEditSoil
    },
    data() {
        return {
            tableData: [],
            context: "",
            dialogAdd:false,
            dialogView:false,
            dialogEdit:false,
            dialogAdd: false,
            dialogView: false,
            dialogEdit: false,
            info: '',
            totalNum: null,
            pageSize: 10,
@@ -130,14 +137,14 @@
                    label: '批量操作',
                    disabled: true,
                },
                {
                    value: 1,
                    label: '批量启用',
                },
                {
                    value: 2,
                    label: '批量禁用',
                },
                // {
                //     value: 1,
                //     label: '批量启用',
                // },
                // {
                //     value: 2,
                //     label: '批量禁用',
                // },
                {
                    value: 3,
                    label: '批量删除',
@@ -156,9 +163,10 @@
                    checked: false,
                },
            ],
            mystatus:1,
            caseId:'',
            timer:null,
            mystatus: 1,
            caseId: '',
            timer: null,
            currentState: 1
        }
    },
    created() {
@@ -166,29 +174,28 @@
    },
    methods: {
        // 编辑车辆
        handleEdit(data){
            console.log(data)
        handleEdit(data) {
            this.dialogEdit = true
            this.info = data;
        },
        // 搜索车辆
        handleSearch(val){
            if(this.timer){
        handleSearch(val) {
            if (this.timer) {
                clearTimeout(this.timer);
            }
            this.timer = setTimeout(()=>{
            this.timer = setTimeout(() => {
                this.getCarList();
            },1000);
            }, 1000);
        },
        // 添加车辆
        handleAddCar(){
        handleAddCar() {
            this.dialogAdd = true;
        },
        // 监听表格
        tableChange(list) {
            this.tempList = [];
            list.forEach(item => {
                this.tempList.push(item.code);
                this.tempList.push(item.id);
            })
            if (list.length === this.tableData.length) {
                this.all = true;
@@ -207,17 +214,16 @@
            })
        },
        // 删除单条数据
        handleDelete({id}) {
        handleDelete({ id }) {
            this.$confirm('确认删除?')
                .then(_ => {
                    const {mystatus} = this
                    let myurl = mystatus === 1 ? 'deletion_enforce':'deletion_slag'
                    const { mystatus } = this
                    let myurl = mystatus === 1 ? 'deletion_enforce' : 'deletion_slag'
                    this.$axios({
                        method: 'delete',
                        url: `/sccg/car_Manage/${myurl}?id=${id}`,
                    })
                        .then(res => {
                            console.log(res);
                            this.$message({
                                type: res.code === 200 ? 'success' : 'warning',
                                message: res.message
@@ -226,43 +232,42 @@
                            this.getCarList();
                        })
                })
                .catch(_ => { console.log(2) });
                .catch(_ => { });
        },
        // 获取车辆列表
        async getCarList() {
            const { currentPage, pageSize, context, mystatus } = this;
            let arr =[];
            if(mystatus===1){
            let arr = [];
            if (mystatus === 1) {
                arr = await this.getLawCarList(currentPage, pageSize, context);
            }else{
            } else {
                arr = await this.getSoilCarList(currentPage, pageSize, context)
            }
            this.tableData = arr.records;
            this.totalNum = arr.total;
        },
        // 获取执法车
        async getLawCarList(currentPage,pageSize,carNum){
            let arr =[];
        async getLawCarList(currentPage, pageSize, carNum) {
            let arr = [];
            await this.$axios({
                method:'get',
                url:`sccg/car_Manage/query_enforce?current=${currentPage}&size=${pageSize}&carNum=${carNum}`,
                method: 'get',
                url: `sccg/car_Manage/query_enforce?current=${currentPage}&size=${pageSize}&carNum=${carNum}`,
            })
            .then(res=>{
                console.log(res);
                arr = res.data;
            })
                .then(res => {
                    arr = res.data;
                })
            return arr;
        },
        // 获取渣土车
        async getSoilCarList(currentPage,pageSize,carNum){
            let arr =[];
        async getSoilCarList(currentPage, pageSize, carNum) {
            let arr = [];
            await this.$axios({
                method:'get',
                url:`sccg/car_Manage/query_slag?current=${currentPage}&size=${pageSize}&carNum=${carNum}`,
                method: 'get',
                url: `sccg/car_Manage/query_slag?current=${currentPage}&size=${pageSize}&carNum=${carNum}`,
            })
            .then(res=>{
                arr = res.data;
            })
                .then(res => {
                    arr = res.data;
                })
            return arr;
        },
        // 更改执法车/渣土车
@@ -270,6 +275,7 @@
            this.typeList.forEach((item, index) => {
                if (index === idx) {
                    item.checked = true;
                    this.currentState=item.value;
                } else {
                    item.checked = false;
                }
@@ -308,28 +314,75 @@
                })
                .catch(_ => { });
        },
        async JumpView(data){
        async JumpView(data) {
            await this.getEventInfo(data.code);
        },
        handleNoClose(done){
        handleNoClose(done) {
            done();
        },
        opernDialog(data){
        opernDialog(data) {
            this.dialogAdd = true;
            this.caseId = data.id;
        },
        // 关闭界面
        closeDialog({flag,index}){
        closeDialog({ flag, index }) {
            this.dialogAdd = flag;
            this.dialogEdit = flag
            if(index===1){
            if (index === 1) {
                this.getCarList();
            }
        },
        handleView(data){
        handleView(data) {
            this.info = data;
            this.dialogView = true;
        }
        },
        selectChange(list) {
            if (this.tempList.length !== 0) {
                this.preMyIdx = list;
                this.mulDelete(this.tempList);
            } else {
                this.myIdx = this.preMyIdx;
                this.$message({
                    type: "warning",
                    message: "您还没选中任何数据",
                });
            }
        },
        // 多条数据删除
        mulDelete(idArr) {
            var path=""
            if(this.currentState==1){
                path="/sccg/car_Manage/batch_deletion_enforce?ids="
            }
            else{
                path="/sccg/car_Manage/batch_deletion_slag?ids="
            }
            this.$confirm("您确定要批量删除车辆信息吗?")
                .then((_) => {
                    this.$axios({
                        method: "delete",
                        url: path + idArr,
                    }).then((res) => {
                        if (res.code === 200) {
                            this.$message({
                                type: "success",
                                message: "批量删除车辆信息成功",
                            });
                            this.getCarList();
                        } else {
                            this.$message({
                                type: "error",
                                message: res.message,
                            });
                        }
                    });
                })
                .catch((err) => {
                    console.log(err);
                });
        },
    }
}
</script>
@@ -338,8 +391,9 @@
    text-align: left;
    margin: 10px 20px;
    color: #4b9bb7;
    header {
        background-color: #09152f;
        // background-color: #09152f;
        border: 1pox solid #fff;
        .headerContent {
@@ -362,7 +416,7 @@
                    color: #1d3f57;
                    &::v-deep .el-input__inner {
                        background-color: #09152f;
                        // background-color: #09152f;
                        border: 1px solid #17324c;
                    }
                }
@@ -390,18 +444,22 @@
            }
        }
    }
    &::v-deep .el-input__inner {
        background-color: #09152f;
        // background-color: #09152f;
        border: 1px solid #17324c;
    }
    main {
        background-color: #09152f;
        // background-color: #09152f;
        margin-top: 20px;
        padding-bottom: 50px;
        border: 1pox solid #fff;
        .btn span:hover{
        .btn span:hover {
            cursor: pointer;
        }
        .type-nav {
            display: flex;
            line-height: 40px;
@@ -419,7 +477,7 @@
            }
            .is-active {
                background-color: #070f22;
                // background-color: #070f22;
                border-radius: 4px;
                color: #fff;
            }
@@ -433,9 +491,11 @@
            .funs {
                display: flex;
                .funs-sp{
                .funs-sp {
                    border: 1px solid #17324c;
                }
                .funsItem {
                    line-height: 28px;
                    display: flex;
@@ -455,7 +515,7 @@
                    &::v-deep .el-input__inner {
                        border: none;
                        background-color: #09152f;
                        // background-color: #09152f;
                    }
                    &:hover {
@@ -480,7 +540,7 @@
                    &::v-deep li,
                    &::v-deep .btn-prev,
                    &::v-deep .btn-next {
                        background-color: #071f39;
                        // background-color: #071f39;
                        color: #4b9bb7;
                    }
@@ -493,8 +553,8 @@
        }
        .el-table {
            color: #4b9bb7;
            font-size: 10px;
            // color: #4b9bb7;
            // font-size: 10px;
            &::v-deep .cell {
                text-overflow: ellipsis;
@@ -503,7 +563,7 @@
            }
            &::v-deep .el-table__empty-block {
                background-color: #09152f;
                // background-color: #09152f;
            }
            &::v-deep .el-table__empty-block {
@@ -524,11 +584,11 @@
        }
        .el-table::v-deep .warning-row {
            background: #06122c;
            // background: #06122c;
        }
        .el-table::v-deep .success-row {
            background: #071f39;
            // background: #071f39;
        }
        &::v-deep .switchStyle .el-switch__label {
@@ -560,12 +620,14 @@
            width: 50px !important;
        }
    }
    .line{
    .line {
        padding: 0 5px;
    }
    &::v-deep .el-dialog__header,
    &::v-deep .el-dialog__body {
        background-color: #06122c;
        // background-color: #06122c;
    }
    &::v-deep .el-dialog__header {