| | |
| | | // 统一请求路径前缀在libs/axios.js中修改 |
| | | import { getRequest, getNoAuthRequest, postNoAuthRequest, postRequest, putRequest } from '@/libs/axios'; |
| | | import { getRequest, getNoAuthRequest, postNoAuthRequest, postRequest, putRequest, getmethod } from '@/libs/axios'; |
| | | |
| | | |
| | | // 认证 |
| | |
| | | export const token = (params) => { |
| | | return getNoAuthRequest('/oauth2/token', params) |
| | | } |
| | | |
| | | |
| | | |
| | | // 获取随机secretKey |
| | |
| | | return getRequest('/orderTask2/getByPage', params) |
| | | } |
| | | |
| | | //配送信息统计表 |
| | | //获取所有签收统计列表信息 |
| | | export const getSignList = (pageNum, pageSize, carName, sendDateStart, sendDateEnd) => { |
| | | return getRequest(`/signCount/selectBySign?pageSize=${pageSize}&pageNum=${pageNum}&carName=${carName}&sendDateStart=${sendDateStart}&sendDateEnd=${sendDateEnd}`) |
| | | } |
| | | export const getSignByMonth = (pageNum, pageSize, carName,StatisticalType) => { |
| | | return getRequest(`/signCount/selectBySign?pageSize=${pageSize}&pageNum=${pageNum}&carName=${carName}&StatisticalType=${StatisticalType}`) |
| | | } |
| | | // 签收统计导出列表 |
| | | export const outExcel = (pageNum, pageSize, carName, sendDateStart, sendDateEnd) => { |
| | | return getmethod(`/signCount/outExcels?pageSize=${pageSize}&pageNum=${pageNum}&carName=${carName}&sendDateStart=${sendDateStart}&sendDateEnd=${sendDateEnd}`) |
| | | } |
| | | |
| | |
| | | return Promise.resolve(err); |
| | | }); |
| | | |
| | | export const getRequest = (url, params) => { |
| | | export const getRequest = (url, params, responseType = null) => { |
| | | let accessToken = getStore('accessToken'); |
| | | return axios({ |
| | | method: 'get', |
| | |
| | | params: params, |
| | | headers: { |
| | | 'accessToken': accessToken, |
| | | } |
| | | }, |
| | | responseType:responseType |
| | | }); |
| | | }; |
| | | export const getmethod = (url, params) => { |
| | | let accessToken = getStore('accessToken'); |
| | | return axios({ |
| | | method: 'get', |
| | | url: `${baseApi}${url}`, |
| | | params: params, |
| | | headers: { |
| | | 'accessToken': accessToken, |
| | | }, |
| | | responseType:"blob" |
| | | }); |
| | | }; |
| | | |
New file |
| | |
| | | export const exportColumn = [ |
| | | { |
| | | title: "车牌号", |
| | | key: "carNo", |
| | | width: 100, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "司机", |
| | | key: "addOilCode", |
| | | width: 140, |
| | | sortable: true, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "配送员", |
| | | key: "addDate", |
| | | width: 150, |
| | | sortable: true, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "年 月", |
| | | key: "money", |
| | | minWidth: 100, |
| | | sortable: true, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "01段", |
| | | key: "amount", |
| | | width: 130, |
| | | sortable: true, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "02段", |
| | | key: "mileage", |
| | | minWidth: 100, |
| | | sortable: true, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "03段", |
| | | key: "oilWear", |
| | | minWidth: 100, |
| | | sortable: true, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "04段", |
| | | key: "remarks", |
| | | minWidth: 150, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "05段", |
| | | key: "remarks", |
| | | minWidth: 150, |
| | | align: "center", |
| | | }, |
| | | ] |
| | | export const childColumn = [ |
| | | { |
| | | title: "第一周", |
| | | width: 118, |
| | | align: "center", |
| | | key: "sendDate" |
| | | }, |
| | | ] |
| | | export const childColumnTwo = [ |
| | | { |
| | | title: "第一周", |
| | | width: 118, |
| | | align: "center", |
| | | key: "proportion" |
| | | }, |
| | | ] |
| | | export const childColumnthree = [ |
| | | { |
| | | title: "第一周", |
| | | width: 118, |
| | | align: "center", |
| | | key: "proportion" |
| | | }, |
| | | ] |
| | | export const childData = [ |
| | | { |
| | | one: "第一周", |
| | | }, |
| | | { |
| | | one: "第二周", |
| | | |
| | | }, |
| | | { |
| | | one: "第三周", |
| | | }, |
| | | { |
| | | one: "第四周", |
| | | }, |
| | | ] |
| | | export const childDataTwo = [ |
| | | { |
| | | one: "", |
| | | }, |
| | | { |
| | | one: "", |
| | | }, |
| | | { |
| | | one: "", |
| | | }, |
| | | { |
| | | one: "", |
| | | }, |
| | | ] |
New file |
| | |
| | | .permModal { |
| | | .ivu-modal-body { |
| | | max-height: 560px; |
| | | overflow: auto; |
| | | } |
| | | } |
| | | |
| | | .depModal { |
| | | .ivu-modal-body { |
| | | max-height: 500px; |
| | | overflow: auto; |
| | | } |
| | | } |
| | | |
| | | .Sign .ivu-table-cell { |
| | | text-align: center; |
| | | } |
| | | |
| | | .Sign .ivu-table td { |
| | | border-bottom: 0; |
| | | } |
| | | .isshow{ |
| | | display: block; |
| | | } |
| | | //设置表格的样式 |
| | | .ivu-table td.no_border>.ivu-table-cell { |
| | | padding-left: 0; |
| | | padding-right: 0; |
| | | } |
| | | |
| | | .no_border.ivu-table-wrapper { |
| | | border: none; |
| | | } |
| | | |
| | | .no_border.ivu-table td, |
| | | .no_border.ivu-table th { |
| | | border: none; |
| | | } |
| | | |
| | | .no_border .ivu-table.ivu-table-default::after, |
| | | .no_border .ivu-table.ivu-table-default::before { |
| | | display: none !important; |
| | | } |
| | | |
| | | .no_border .ivu-table-column-center { |
| | | border-right: none; |
| | | } |
| | | |
| | | .no_border .ivu-table-row:last-child .ivu-table-column-center { |
| | | border-bottom: none; |
| | | } |
| | | |
| | | //设置日期选择器的间距 |
| | | .ivu-date-picker { |
| | | padding-left: 2px !important; |
| | | } |
| | | |
| | | .init-button { |
| | | margin-left: 8px; |
| | | } |
New file |
| | |
| | | <style lang="less"> |
| | | @import "@/styles/table-common.less"; |
| | | @import "@/styles/drawer-common.less"; |
| | | @import "./signManage.less"; |
| | | </style> |
| | | <template> |
| | | <div class="search"> |
| | | <Card> |
| | | <Row class="operation"> |
| | | <Date-picker v-model="value" @on-change="getDataByDate" value-format="yyyy-MM-dd" type="daterange" |
| | | placement="bottom-start" placeholder="请选择日期" style="width: 240px;padding-left: 20px"> |
| | | </Date-picker> |
| | | <Button @click="init" icon="md-refresh" class="init-button">刷新</Button> |
| | | <Button type="dashed" @click="openTip = !openTip">{{ |
| | | openTip ? "关闭提示" : "开启提示" |
| | | }} |
| | | </Button> |
| | | <Input v-model="carNo" suffix="ios-search" @on-change="getSign" placeholder="输入车牌号搜索" clearable |
| | | style="width: 250px" /> |
| | | <Button @click="exportExcel" class="init-button export-button">导出本页数据</Button> |
| | | <!-- <Button @click="exportAllExcel" class="init-button export-button">导出全部数据</Button> --> |
| | | <div @click="switchnum = 1"> |
| | | <Button class="init-button export-button">日签收率</Button> |
| | | </div> |
| | | <div @click="switchnum = 2"> |
| | | <Button class="init-button export-button">月签收率</Button> |
| | | </div> |
| | | </Row> |
| | | <Alert show-icon v-show="openTip"> |
| | | 已选择 |
| | | <span class="select-count">{{ selectList.length }}</span> 项 |
| | | <a class="select-clear" @click="clearSelectAll">清空</a> |
| | | </Alert> |
| | | <!-- 日签收率的表 --> |
| | | <div v-show="switchnum === 1"> |
| | | <Table :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom" |
| | | :span-method="handleSpan" @on-sort-change="changeSort" @on-selection-change="changeSelect"></Table> |
| | | </div> |
| | | <!-- 月签收率的表 --> |
| | | <div v-show="switchnum === 2"> |
| | | <Table :loading="loading" border :columns="columnsMonth" :data="monthData" sortable="custom" |
| | | :span-method="handleSpan" @on-sort-change="changeSort" @on-selection-change="changeSelect"> |
| | | </Table> |
| | | </div> |
| | | <div v-show="switchnum === 1"> |
| | | <Row type="flex" justify="end" class="page"> |
| | | <Page :current="pageNum" :total="total" :page-size="pageSize" @on-change="changePage" |
| | | @on-page-size-change="changePageSize" :page-size-opts="[18, 36]" size="small" show-total show-elevator |
| | | show-sizer></Page> |
| | | </Row> |
| | | </div> |
| | | <div v-show="switchnum === 2"> |
| | | <Row type="flex" justify="end" class="page"> |
| | | <Page :current="pageNum" :total="totalmonth" :page-size="pageSize" @on-change="changePage" |
| | | @on-page-size-change="changePageSize" :page-size-opts="[18, 36]" size="small" show-total show-elevator |
| | | show-sizer></Page> |
| | | </Row> |
| | | </div> |
| | | </Card> |
| | | |
| | | <!-- 编辑 --> |
| | | <Modal :title="modalTitle" v-model="roleModalVisible" :mask-closable="false" :width="500"> |
| | | <Form ref="carForm" :model="carForm" :label-width="80" :rules="carFormValidate"> |
| | | <FormItem label="品牌" prop="brand"> |
| | | <Input v-model="carForm.brand" /> |
| | | </FormItem> |
| | | <FormItem label="型号" prop="model"> |
| | | <Input v-model="carForm.model" /> |
| | | </FormItem> |
| | | <FormItem label="排量" prop="displacement"> |
| | | <Input v-model="carForm.displacement" /> |
| | | </FormItem> |
| | | <Form-item label="购置年份"> |
| | | <Row> |
| | | <Col span="11"> |
| | | <Date-picker @on-change="change1" type="date" value="yyyy-MM-dd" placeholder="选择日期" |
| | | v-model="carForm.buyYear"></Date-picker> |
| | | </Col> |
| | | </Row> |
| | | </Form-item> |
| | | <FormItem label="牌照" prop="carNo"> |
| | | <Input v-model="carForm.carNo" /> |
| | | </FormItem> |
| | | <FormItem label="加油卡号" prop="addOilCode"> |
| | | <Input v-model="carForm.addOilCode" /> |
| | | </FormItem> |
| | | <FormItem label="车辆编号" prop="code"> |
| | | <Input v-model="carForm.code" /> |
| | | </FormItem> |
| | | <FormItem label="司机" prop="userId"> |
| | | <Select v-model="carForm.userId" filterable> |
| | | <Option :value="0">请选择</Option> |
| | | <Option v-for="item in userList" :value="item.id" :key="item.id">{{ item.nickname }}</Option> |
| | | </Select> |
| | | </FormItem> |
| | | <FormItem label="配送员" prop="followUserId"> |
| | | <Select v-model="carForm.followUserId" filterable> |
| | | <Option :value="0" :key="0">请选择</Option> |
| | | <Option v-for="item in driverList" :value="item.id" :key="item.id">{{ item.nickname }}</Option> |
| | | </Select> |
| | | </FormItem> |
| | | </Form> |
| | | <div slot="footer"> |
| | | <Button type="text" @click="carRole">取消</Button> |
| | | <Button type="primary" :loading="submitLoading" @click="submitCar">提交 |
| | | </Button> |
| | | </div> |
| | | </Modal> |
| | | <Modal :title="modalTitle" v-model="equipmentVisible" :mask-closable="false" :width="1044"> |
| | | <Row class="operation" style="padding-bottom: 20px"> |
| | | <Button @click="addEquipment" type="primary" icon="md-add">添加设备</Button> |
| | | <Button @click="init" icon="md-refresh">刷新</Button> |
| | | </Row> |
| | | <Table :loading="loading" border :columns="columns2" :data="data2" ref="table" sortable="custom" |
| | | @on-sort-change="changeSort" @on-selection-change="changeSelect"> |
| | | |
| | | |
| | | </Table> |
| | | </Modal> |
| | | <Modal :title="modalTitle" v-model="addEquipmentVisible" :mask-closable="false" :width="500"> |
| | | <Form ref="equipmentForm" :model="equipmentForm" :label-width="80" :rules="equipmentFormValidate"> |
| | | <FormItem label="设备类型" prop="type"> |
| | | <Select v-model="equipmentForm.type"> |
| | | <Option :value="0">车机</Option> |
| | | <Option :value="1">摄像机</Option> |
| | | <Option :value="2">抓拍机</Option> |
| | | <Option :value="3">pad</Option> |
| | | </Select> |
| | | </FormItem> |
| | | <FormItem label="状态" prop="status"> |
| | | <Select v-model="equipmentForm.status"> |
| | | <Option :value="0">正常</Option> |
| | | <Option :value="1">异常</Option> |
| | | </Select> |
| | | </FormItem> |
| | | <FormItem label="编号" prop="code"> |
| | | <Input v-model="equipmentForm.code" /> |
| | | </FormItem> |
| | | <FormItem label="ip地址" prop="ip"> |
| | | <Input v-model="equipmentForm.ip" /> |
| | | </FormItem> |
| | | <FormItem label="端口号" prop="port"> |
| | | <Input v-model="equipmentForm.port" /> |
| | | </FormItem> |
| | | |
| | | </Form> |
| | | <div slot="footer"> |
| | | <Button type="text" @click="carRole">取消</Button> |
| | | <Button type="primary" :loading="submitLoading" @click="submitEquipment">提交 |
| | | </Button> |
| | | </div> |
| | | </Modal> |
| | | <!-- 菜单权限 --> |
| | | <Drawer :title="modalTitle" v-model="permModalVisible" :mask-closable="false" :width="500" draggable> |
| | | <div :style="{ maxHeight: maxHeight }" class="drawer-content"> |
| | | <div style="position: relative"> |
| | | <Tree ref="tree" :data="permData" show-checkbox :render="renderContent" :check-strictly="true"></Tree> |
| | | <Spin size="large" fix v-if="treeLoading"></Spin> |
| | | </div> |
| | | </div> |
| | | <div class="drawer-footer br"> |
| | | <Button type="primary" :loading="submitPermLoading" @click="submitPermEdit">提交 |
| | | </Button> |
| | | <Button @click="selectTreeAll">全选/反选</Button> |
| | | <Select v-model="openLevel" @on-change="changeOpen" style="width: 110px" transfer> |
| | | <Option value="0">展开所有</Option> |
| | | <Option value="1">收合所有</Option> |
| | | <Option value="2">仅展开一级</Option> |
| | | <Option value="3">仅展开两级</Option> |
| | | </Select> |
| | | <Button type="text" @click="cancelPermEdit">取消</Button> |
| | | </div> |
| | | </Drawer> |
| | | <!-- 数据权限 --> |
| | | <Modal :title="modalTitle" v-model="carModalVisible" :mask-closable="false" :width="500" class="depModal"> |
| | | <Form :label-width="85" ref="removeForm" :model="removeForm"> |
| | | <FormItem label="移除原因" prop="removeReason"> |
| | | <Input v-model="removeForm.removeReason" /> |
| | | </FormItem> |
| | | </Form> |
| | | <div v-show="dataType == 1" style="margin-top: 15px"> |
| | | <div style="position: relative"> |
| | | <Tree ref="depTree" :data="depData" :load-data="loadData" @on-toggle-expand="expandCheckDep" multiple |
| | | style="margin-top: 15px"></Tree> |
| | | <Spin size="large" fix v-if="depTreeLoading"></Spin> |
| | | </div> |
| | | </div> |
| | | <div slot="footer"> |
| | | <Button type="text" @click="depModalVisible = false">取消</Button> |
| | | <Button type="primary" :loading="submitDepLoading" @click="submitRemove">提交 |
| | | </Button> |
| | | </div> |
| | | </Modal> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | getAllPermissionList, |
| | | setDefaultRole, |
| | | editRolePerm, |
| | | initDepartment, |
| | | loadDepartment, |
| | | editRoleDep, |
| | | } from "@/api/index"; |
| | | |
| | | import { |
| | | getAll, |
| | | addCar, |
| | | getCarList, |
| | | editCar, |
| | | deleteCar, |
| | | getEquipment, |
| | | addEquipment, |
| | | getUser, |
| | | getDriver, |
| | | deleteEquipment, |
| | | getSignList, |
| | | getLicense, |
| | | getSignByMonth, |
| | | outExcel |
| | | } from "@/api/open"; |
| | | import util from "@/libs/util.js"; |
| | | import { childColumn, childData, childDataTwo, childColumnTwo, childColumnthree } from "./exportColumn" |
| | | import Vue from "vue" |
| | | export default { |
| | | name: "car-manage", |
| | | data() { |
| | | return { |
| | | maxHeight: 510, |
| | | openTip: true, |
| | | openLevel: "0", |
| | | loading: true, |
| | | treeLoading: true, |
| | | depTreeLoading: true, |
| | | submitPermLoading: false, |
| | | submitDepLoading: false, |
| | | searchKey: "", |
| | | sortColumn: "createTime", |
| | | sortType: "desc", |
| | | modalType: 0, |
| | | roleModalVisible: false, |
| | | addEquipmentVisible: false, |
| | | equipmentVisible: false, |
| | | carModalVisible: false, |
| | | permModalVisible: false, |
| | | depModalVisible: false, |
| | | modalTitle: "", |
| | | searchForm: { |
| | | // 搜索框初始化对象 |
| | | pageNumber: 1, // 当前页数 |
| | | pageSize: 10, // 页面大小 |
| | | sort: "createTime", // 默认排序字段 |
| | | order: "desc", // 默认排序方式 |
| | | key: "", |
| | | }, |
| | | carForm: { |
| | | status: 0 |
| | | }, |
| | | type: { |
| | | type: 0 |
| | | }, |
| | | equipmentForm: { |
| | | status: 0 |
| | | }, |
| | | removeForm: { |
| | | status: 1 |
| | | }, |
| | | carFormValidate: { |
| | | name: [ |
| | | { required: true, message: "角色名称不能为空", trigger: "change" }, |
| | | ], |
| | | }, |
| | | submitLoading: false, |
| | | selectList: [], |
| | | columns: [ |
| | | { |
| | | type: "selection", |
| | | width: 60, |
| | | align: "center", |
| | | }, |
| | | { |
| | | type: "index", |
| | | title: "序号", |
| | | width: 80, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "车牌号", |
| | | key: "carName", |
| | | width: 120, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "司机", |
| | | key: "userName", |
| | | width: 100, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "配送员", |
| | | key: "name", |
| | | width: 100, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "年月", |
| | | key: "sendMonth", |
| | | minWidth: 120, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "01段", |
| | | // key: "oneBatch", |
| | | minWidth: 140, |
| | | align: "center", |
| | | children: [ |
| | | { |
| | | title: '日期', |
| | | align: 'center', |
| | | key: 'sendDate', |
| | | minWidth: 120, |
| | | className: 'no_border', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumn, |
| | | "show-header": false, |
| | | data: params.row.childone, |
| | | align: 'center', |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | }, |
| | | { |
| | | title: '日签收率', |
| | | align: 'center', |
| | | className: 'no_border', |
| | | minWidth: 120, |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumnTwo, |
| | | data: params.row.childone, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | title: "02段", |
| | | key: "twoBatch", |
| | | minWidth: 140, |
| | | align: "center", |
| | | children: [ |
| | | { |
| | | title: '日期', |
| | | align: 'center', |
| | | key: 'model', |
| | | minWidth: 120, |
| | | className: 'no_border', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumn, |
| | | data: params.row.childtwo, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | }, |
| | | { |
| | | title: '日签收率', |
| | | align: 'center', |
| | | key: 'model', |
| | | minWidth: 120, |
| | | className: 'no_border', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumnTwo, |
| | | data: params.row.childtwo, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | title: "03段", |
| | | key: "threeBatch", |
| | | minWidth: 140, |
| | | align: "center", |
| | | children: [ |
| | | { |
| | | title: '日期', |
| | | align: 'center', |
| | | key: 'model', |
| | | minWidth: 120, |
| | | className: 'no_border', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumn, |
| | | data: params.row.childthree, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | }, |
| | | { |
| | | title: '日签收率', |
| | | align: 'center', |
| | | key: 'model', |
| | | minWidth: 120, |
| | | className: 'no_border', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumnTwo, |
| | | data: params.row.childthree, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | title: "04段", |
| | | key: "fourBatch", |
| | | minWidth: 140, |
| | | align: "center", |
| | | tooltip: true, |
| | | children: [ |
| | | { |
| | | title: '日期', |
| | | align: 'center', |
| | | key: 'model', |
| | | minWidth: 120, |
| | | className: 'no_border', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumn, |
| | | data: params.row.childfour, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | }, |
| | | { |
| | | title: '日签收率', |
| | | align: 'center', |
| | | key: 'model', |
| | | minWidth: 120, |
| | | className: 'no_border', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumnTwo, |
| | | data: params.row.childfour, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | title: "05段", |
| | | key: "fiveBatch", |
| | | minWidth: 140, |
| | | align: "center", |
| | | children: [ |
| | | { |
| | | title: '日期', |
| | | align: 'center', |
| | | key: 'model', |
| | | minWidth: 120, |
| | | className: 'no_border', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumn, |
| | | data: params.row.childfive, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | }, |
| | | { |
| | | title: '日签收率', |
| | | align: 'center', |
| | | key: 'model', |
| | | minWidth: 120, |
| | | className: 'no_border', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumnTwo, |
| | | data: params.row.childfive, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | }, |
| | | ] |
| | | }, |
| | | ], |
| | | columnsMonth: [ |
| | | { |
| | | type: "selection", |
| | | width: 60, |
| | | align: "center", |
| | | }, |
| | | { |
| | | type: "index", |
| | | title: "序号", |
| | | width: 80, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "车牌号", |
| | | key: "carName", |
| | | width: 120, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "司机", |
| | | key: "userName", |
| | | width: 100, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "配送员", |
| | | key: "name", |
| | | width: 100, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "年月", |
| | | key: "sendMonth", |
| | | minWidth: 120, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "01段", |
| | | minWidth: 140, |
| | | align: "center", |
| | | children: [ |
| | | { |
| | | title: '月份', |
| | | align: 'center', |
| | | key: 'sendDate', |
| | | minWidth: 120, |
| | | className: 'no_border', |
| | | render: (h, params) => { |
| | | console.log(params.row.childone); |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumn, |
| | | "show-header": false, |
| | | data: params.row.childone, |
| | | align: 'center', |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | }, |
| | | { |
| | | title: '月签收率', |
| | | align: 'center', |
| | | key: 'proportion', |
| | | minWidth: 120, |
| | | className: 'no_border Sign', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumnthree, |
| | | data: params.row.childone, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | title: "02段", |
| | | key: "twoBatch", |
| | | minWidth: 140, |
| | | align: "center", |
| | | children: [ |
| | | { |
| | | title: '月份', |
| | | align: 'center', |
| | | key: 'model', |
| | | minWidth: 120, |
| | | className: 'no_border', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumn, |
| | | data: params.row.childtwo, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | }, |
| | | { |
| | | title: '月签收率', |
| | | align: 'center', |
| | | // key: 'proportion', |
| | | minWidth: 120, |
| | | className: 'no_border Sign', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumnthree, |
| | | data: params.row.childtwo, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | title: "03段", |
| | | key: "threeBatch", |
| | | minWidth: 140, |
| | | align: "center", |
| | | children: [ |
| | | { |
| | | title: '月份', |
| | | align: 'center', |
| | | key: 'model', |
| | | minWidth: 120, |
| | | className: 'no_border', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumn, |
| | | data: params.row.childthree, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | }, |
| | | { |
| | | title: '月签收率', |
| | | align: 'center', |
| | | // key: 'model', |
| | | minWidth: 120, |
| | | className: 'no_border Sign', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumnthree, |
| | | data: params.row.childthree, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | } |
| | | ], |
| | | }, |
| | | { |
| | | title: "04段", |
| | | key: "fourBatch", |
| | | minWidth: 140, |
| | | align: "center", |
| | | tooltip: true, |
| | | children: [ |
| | | { |
| | | title: '月份', |
| | | align: 'center', |
| | | key: 'model', |
| | | minWidth: 120, |
| | | className: 'no_border', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumn, |
| | | data: params.row.childfour, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | }, |
| | | { |
| | | title: '月签收率', |
| | | align: 'center', |
| | | // key: 'model', |
| | | minWidth: 120, |
| | | className: 'no_border Sign', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumnthree, |
| | | data: params.row.childfour, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | title: "05段", |
| | | key: "fiveBatch", |
| | | minWidth: 140, |
| | | align: "center", |
| | | children: [ |
| | | { |
| | | title: '月份', |
| | | align: 'center', |
| | | key: 'model', |
| | | minWidth: 120, |
| | | className: 'no_border', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumn, |
| | | data: params.row.childfive, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | }, |
| | | { |
| | | title: '月签收率', |
| | | align: 'center', |
| | | // key: 'model', |
| | | minWidth: 120, |
| | | className: 'no_border Sign', |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h("Table", { |
| | | props: { |
| | | columns: childColumnthree, |
| | | data: params.row.childfive, |
| | | "show-header": false, |
| | | }, |
| | | }), |
| | | ]) |
| | | }, |
| | | } |
| | | ] |
| | | }, |
| | | ], |
| | | columns2: [ |
| | | { |
| | | type: "selection", |
| | | width: 60, |
| | | align: "center", |
| | | }, |
| | | { |
| | | type: "index", |
| | | width: 60, |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: "设备类型", |
| | | key: "type", |
| | | width: 130, |
| | | sortable: true, |
| | | render: (h, params) => { |
| | | let re = ""; |
| | | if (params.row.type == 0) { |
| | | return h("div", [ |
| | | h("Badge", { |
| | | props: { |
| | | text: "车机", |
| | | }, |
| | | }), |
| | | ]); |
| | | } else if (params.row.type == 1) { |
| | | return h("div", [ |
| | | h("Badge", { |
| | | props: { |
| | | text: "摄像机", |
| | | }, |
| | | }), |
| | | ]); |
| | | } else if (params.row.type == 2) { |
| | | return h("div", [ |
| | | h("Badge", { |
| | | props: { |
| | | text: "抓拍机", |
| | | }, |
| | | }), |
| | | ]); |
| | | } else if (params.row.type == 3) { |
| | | return h("div", [ |
| | | h("Badge", { |
| | | props: { |
| | | text: "pad", |
| | | }, |
| | | }), |
| | | ]); |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | title: "编号", |
| | | key: "code", |
| | | width: 120, |
| | | }, |
| | | { |
| | | title: "状态", |
| | | key: "status", |
| | | width: 120, |
| | | sortable: true, |
| | | render: (h, params) => { |
| | | let re = ""; |
| | | if (params.row.status == 0) { |
| | | return h("div", [ |
| | | h("Badge", { |
| | | props: { |
| | | status: "success", |
| | | text: "正常", |
| | | }, |
| | | }), |
| | | ]); |
| | | } else if (params.row.status == 1) { |
| | | return h("div", [ |
| | | h("Badge", { |
| | | props: { |
| | | status: "error", |
| | | text: "停用", |
| | | }, |
| | | }), |
| | | ]); |
| | | } |
| | | }, |
| | | }, |
| | | { |
| | | title: "ip地址", |
| | | key: "ip", |
| | | width: 120, |
| | | }, |
| | | { |
| | | title: "端口号", |
| | | key: "port", |
| | | width: 120, |
| | | sortable: true, |
| | | }, |
| | | { |
| | | title: "操作", |
| | | key: "action", |
| | | align: "center", |
| | | width: 280, |
| | | render: (h, params) => { |
| | | return h("div", [ |
| | | h( |
| | | "a", |
| | | { |
| | | on: { |
| | | click: () => { |
| | | this.editEquipment(params.row); |
| | | }, |
| | | }, |
| | | }, |
| | | "编辑" |
| | | ), |
| | | h("Divider", { |
| | | props: { |
| | | type: "vertical", |
| | | }, |
| | | }), |
| | | h( |
| | | "a", |
| | | { |
| | | on: { |
| | | click: () => { |
| | | this.removeEquipment(params.row); |
| | | }, |
| | | }, |
| | | }, |
| | | "删除" |
| | | ), |
| | | ]); |
| | | }, |
| | | }, |
| | | ], |
| | | data: [], |
| | | data2: [], |
| | | total: 0, |
| | | total2: 0, |
| | | totalmonth: 0, |
| | | permData: [], |
| | | editRolePermId: "", |
| | | selectAllFlag: false, |
| | | depData: [], |
| | | dataType: 0, |
| | | carId: '', |
| | | driverList: [], |
| | | userList: [], |
| | | editDepartments: [], |
| | | buyYear: '', |
| | | //选择日期 |
| | | value: [], |
| | | // 页码 |
| | | pageNum: 1, |
| | | // 每页条数 |
| | | pageSize: 18, |
| | | // 车牌号 |
| | | carNo: "", |
| | | // 开始日期 |
| | | beginTime: "", |
| | | // 结束日期 |
| | | endTime: "", |
| | | // 按月查询的data |
| | | monthData: [], |
| | | // 导出的数据 |
| | | exportData: "", |
| | | // 日 月签收率两张表的切换 |
| | | switchnum: 1 |
| | | }; |
| | | }, |
| | | created() { |
| | | //请求数据 |
| | | this.getSign() |
| | | // 按月请求的数据 |
| | | this.getSignByMonthList() |
| | | }, |
| | | methods: { |
| | | getSign() { |
| | | getSignList(this.pageNum, this.pageSize, this.carNo, this.beginTime, this.endTime).then(result => { |
| | | this.loading = false; |
| | | if (result.success) { |
| | | this.data = result.result.records; |
| | | this.total = result.result.total; |
| | | this.data = this.merge(this.data) |
| | | // console.log(this.data); |
| | | } |
| | | }) |
| | | }, |
| | | getSignByMonthList() { |
| | | getSignByMonth(this.pageNum, this.pageSize, this.carNo, 3).then(result => { |
| | | this.loading = false; |
| | | if (result.success) { |
| | | this.dataMonth = result.result.records |
| | | this.totalmonth = result.result.total; |
| | | this.monthData = this.merge(this.dataMonth) |
| | | // console.log(this.monthData); |
| | | } |
| | | }) |
| | | }, |
| | | merge(index) { |
| | | let dataInfo = {}; |
| | | index.forEach((item, index) => { |
| | | let { userName, carName, sendMonth, name } = item; |
| | | if (!dataInfo[userName]) { |
| | | dataInfo[userName] = { |
| | | userName, |
| | | carName, |
| | | sendMonth, |
| | | name, |
| | | childone: [], |
| | | childtwo: [], |
| | | childthree: [], |
| | | childfour: [], |
| | | childfive: [] |
| | | } |
| | | } |
| | | if (item.batch === "01段") { |
| | | dataInfo[userName].childone.push(item); |
| | | } |
| | | if (item.batch === "02段") { |
| | | dataInfo[userName].childtwo.push(item); |
| | | } |
| | | if (item.batch === "03段") { |
| | | dataInfo[userName].childthree.push(item); |
| | | } |
| | | if (item.batch === "04段") { |
| | | dataInfo[userName].childfour.push(item); |
| | | } |
| | | if (item.batch === "05段") { |
| | | dataInfo[userName].childfive.push(item); |
| | | } |
| | | }); |
| | | let list = Object.values(dataInfo); |
| | | list.forEach(item => { |
| | | let arr = new Array(5 - item.childone.length).fill({ proportion: "" }) |
| | | let arr1 = new Array(5 - item.childtwo.length).fill({ proportion: "" }) |
| | | let arr2 = new Array(5 - item.childthree.length).fill({ proportion: "" }) |
| | | let arr3 = new Array(5 - item.childfour.length).fill({ proportion: "" }) |
| | | let arr4 = new Array(5 - item.childfive.length).fill({ proportion: "" }) |
| | | item.childone = [...item.childone, ...arr] |
| | | item.childtwo = [...item.childtwo, ...arr1] |
| | | item.childthree = [...item.childthree, ...arr2] |
| | | item.childfour = [...item.childfour, ...arr3] |
| | | item.childfive = [...item.childfive, ...arr4] |
| | | }) |
| | | return list |
| | | }, |
| | | handleSummary({ columns, data }) { |
| | | const sums = {}; |
| | | columns.forEach((column, index) => { |
| | | const key = column.key; |
| | | if (index === 0) { |
| | | sums[key] = { |
| | | key, |
| | | value: '总价' |
| | | }; |
| | | return; |
| | | } |
| | | const values = data.map(item => Number(item[key])); |
| | | if (!values.every(value => isNaN(value))) { |
| | | const v = values.reduce((prev, curr) => { |
| | | const value = Number(curr); |
| | | if (!isNaN(value)) { |
| | | return prev + curr; |
| | | } else { |
| | | return prev; |
| | | } |
| | | }, 0); |
| | | sums[key] = { |
| | | key, |
| | | value: v + ' 元' |
| | | }; |
| | | } else { |
| | | sums[key] = { |
| | | key, |
| | | value: 'N/A' |
| | | }; |
| | | } |
| | | }); |
| | | console.log(sums) |
| | | return sums; |
| | | }, |
| | | // 导出为excel |
| | | exportExcel() { |
| | | outExcel(this.pageNum, this.pageSize, this.carNo, this.beginTime, this.endTime).then((res) => { |
| | | let blob = new Blob([res], { type: 'application/vnd.ms-excel' }); |
| | | let url = URL.createObjectURL(blob); |
| | | const link = document.createElement('a'); //创建a标签 |
| | | link.href = url; |
| | | link.download = '配送信息.xlsx'; //重命名文件 |
| | | link.click(); |
| | | URL.revokeObjectURL(url); |
| | | }) |
| | | }, |
| | | exportAllExcel() { |
| | | outExcel().then(res => { |
| | | let blob = new Blob([res], { type: 'application/vnd.ms-excel' }); |
| | | let url = URL.createObjectURL(blob); |
| | | const link = document.createElement('a'); //创建a标签 |
| | | link.href = url; |
| | | link.download = '全部配送信息.xlsx'; //重命名文件 |
| | | link.click(); |
| | | URL.revokeObjectURL(url); |
| | | }) |
| | | }, |
| | | handleSpan({ row, column, rowIndex, columnIndex }) { |
| | | if (rowIndex || !rowIndex) { |
| | | return {} |
| | | } |
| | | }, |
| | | change1(e) { |
| | | this.buyYear = e; |
| | | }, |
| | | init() { |
| | | this.getDataList(); |
| | | // 获取所有菜单权限树 |
| | | }, |
| | | renderContent(h, { root, node, data }) { |
| | | let icon = ""; |
| | | if (data.level == 0) { |
| | | icon = "ios-navigate"; |
| | | } else if (data.level == 1) { |
| | | icon = "md-list-box"; |
| | | } else if (data.level == 2) { |
| | | icon = "md-list"; |
| | | } else if (data.level == 3) { |
| | | icon = "md-radio-button-on"; |
| | | } else { |
| | | icon = "md-radio-button-off"; |
| | | } |
| | | return h( |
| | | "span", |
| | | { |
| | | style: { |
| | | display: "inline-block", |
| | | cursor: "pointer", |
| | | }, |
| | | on: { |
| | | click: () => { |
| | | if (data.status == -1) { |
| | | return; |
| | | } |
| | | data.checked = !data.checked; |
| | | }, |
| | | }, |
| | | }, |
| | | [ |
| | | h("span", [ |
| | | h("Icon", { |
| | | props: { |
| | | type: icon, |
| | | size: "16", |
| | | }, |
| | | style: { |
| | | "margin-right": "8px", |
| | | "margin-bottom": "3px", |
| | | }, |
| | | }), |
| | | h("span", data.title), |
| | | ]), |
| | | ] |
| | | ); |
| | | }, |
| | | changePage(v) { |
| | | this.pageNum = v |
| | | this.getSign(); |
| | | this.getSignByMonthList() |
| | | this.clearSelectAll(); |
| | | }, |
| | | changePageSize(v) { |
| | | this.pageSize = v; |
| | | this.getSign(); |
| | | this.getSignByMonthList() |
| | | }, |
| | | getAllUser() { |
| | | getDriver({ type: 0 }).then((res) => { |
| | | if (res.success) { |
| | | this.userList = res.result; |
| | | } |
| | | }); |
| | | //this.type.type=1; |
| | | getDriver({ type: 1 }).then((res) => { |
| | | if (res.success) { |
| | | this.driverList = res.result; |
| | | } |
| | | }); |
| | | this.type.type = 0; |
| | | console.log(this.userList); |
| | | console.log(this.driverList); |
| | | }, |
| | | changeSort(e) { |
| | | this.searchForm.sort = e.key; |
| | | this.searchForm.order = e.order; |
| | | if (e.order == "normal") { |
| | | this.searchForm.order = ""; |
| | | } |
| | | this.getDataList(); |
| | | }, |
| | | //格式化时间 |
| | | selectDate(dateData) { |
| | | let date = new Date(dateData) |
| | | let y = date.getFullYear() |
| | | let m = date.getMonth() + 1 |
| | | m = m < 10 ? ('0' + m) : m |
| | | let d = date.getDate() |
| | | d = d < 10 ? ('0' + d) : d |
| | | const time = y + '-' + m + '-' + d; |
| | | return time |
| | | }, |
| | | //根据选择的日期返回数据 |
| | | getDataByDate() { |
| | | this.loading = true; |
| | | if (this.value[0] != "" && this.value[1] != "") { |
| | | this.beginTime = this.selectDate(this.value[0]); |
| | | this.endTime = this.selectDate(this.value[1]); |
| | | this.page = false; |
| | | } else { |
| | | // var date = new Date(); |
| | | // this.endTime = this.selectDate(date); |
| | | // this.value[1] = this.endTime; |
| | | // date.setDate(1); |
| | | // this.value[0] = date; |
| | | // this.beginTime = this.selectDate(date); |
| | | this.beginTime = ""; |
| | | this.endTime = "" |
| | | } |
| | | this.getSign(); |
| | | }, |
| | | // 获取表格数据 |
| | | getDataList() { |
| | | // this.loading = true; |
| | | // getCarList(this.searchForm).then((res) => { |
| | | // this.loading = false; |
| | | // if (res.success) { |
| | | // console.log(res) |
| | | // this.data = res.result.records; |
| | | // this.total = res.result.total; |
| | | // } |
| | | // }); |
| | | }, |
| | | getEquipmentList(carId) { |
| | | this.loading = true; |
| | | this.searchForm.carId = carId; |
| | | getEquipment(this.searchForm).then((res) => { |
| | | this.loading = false; |
| | | if (res.success) { |
| | | this.data2 = res.result.records; |
| | | } |
| | | }); |
| | | }, |
| | | getPermList() { |
| | | this.treeLoading = true; |
| | | getAllPermissionList().then((res) => { |
| | | if (res.success) { |
| | | this.deleteDisableNode(res.result); |
| | | this.permData = res.result; |
| | | this.treeLoading = false; |
| | | } |
| | | this.treeLoading = false; |
| | | }); |
| | | }, |
| | | // 递归标记禁用节点 |
| | | deleteDisableNode(permData) { |
| | | let that = this; |
| | | permData.forEach(function (e) { |
| | | if (e.status == -1) { |
| | | e.title = "[已禁用] " + e.title; |
| | | e.disabled = true; |
| | | } |
| | | if (e.children && e.children.length > 0) { |
| | | that.deleteDisableNode(e.children); |
| | | } |
| | | }); |
| | | }, |
| | | carRole() { |
| | | this.roleModalVisible = false; |
| | | }, |
| | | submitCar() { |
| | | if (this.carForm.userId == undefined || this.carForm.userId == 0) { |
| | | this.carForm.userId = ""; |
| | | } |
| | | if (this.carForm.followUserId == undefined || this.carForm.followUserId == 0) { |
| | | this.carForm.followUserId = ""; |
| | | } |
| | | this.carForm.buyYear = this.buyYear; |
| | | this.$refs.carForm.validate((valid) => { |
| | | if (valid) { |
| | | if (this.modalType == 0) { |
| | | // 添加 |
| | | this.submitLoading = true; |
| | | addCar(this.carForm).then((res) => { |
| | | this.submitLoading = false; |
| | | if (res.success) { |
| | | this.$Message.success("操作成功"); |
| | | this.getDataList(); |
| | | this.roleModalVisible = false; |
| | | } |
| | | }); |
| | | } else { |
| | | this.submitLoading = true; |
| | | editCar(this.carForm).then((res) => { |
| | | this.submitLoading = false; |
| | | if (res.success) { |
| | | this.$Message.success("操作成功"); |
| | | this.getDataList(); |
| | | this.roleModalVisible = false; |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | submitEquipment() { |
| | | this.$refs.equipmentForm.validate((valid) => { |
| | | this.equipmentForm.carId = this.carId; |
| | | if (valid) { |
| | | if (this.modalType == 0) { |
| | | // 添加 |
| | | this.submitLoading = true; |
| | | addEquipment(this.equipmentForm).then((res) => { |
| | | this.submitLoading = false; |
| | | if (res.success) { |
| | | this.$Message.success("操作成功"); |
| | | this.getEquipmentList(this.carId); |
| | | this.addEquipmentVisible = false; |
| | | this.getEquipmentList(this.carId); |
| | | } |
| | | }); |
| | | } else { |
| | | this.submitLoading = true; |
| | | addEquipment(this.equipmentForm).then((res) => { |
| | | this.submitLoading = false; |
| | | if (res.success) { |
| | | this.$Message.success("操作成功"); |
| | | this.getEquipmentList(this.carId); |
| | | this.addEquipmentVisible = false; |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | }); |
| | | }, |
| | | submitRemove() { |
| | | this.$refs.removeForm.validate((valid) => { |
| | | if (valid) { |
| | | this.submitLoading = true; |
| | | editCar(this.removeForm).then((res) => { |
| | | this.submitLoading = false; |
| | | if (res.success) { |
| | | this.$Message.success("操作成功"); |
| | | this.getDataList(); |
| | | this.carModalVisible = false; |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | equipment(row) { |
| | | this.carId = row.id |
| | | this.getEquipmentList(row.id); |
| | | this.modalType = 0; |
| | | this.modalTitle = "设备信息"; |
| | | this.$refs.carForm.resetFields(); |
| | | delete this.carForm.id; |
| | | this.equipmentVisible = true; |
| | | }, |
| | | addCar() { |
| | | this.carForm = {}; |
| | | this.getAllUser(); |
| | | this.modalType = 0; |
| | | this.modalTitle = "添加车辆"; |
| | | this.$refs.carForm.resetFields(); |
| | | delete this.carForm.id; |
| | | this.roleModalVisible = true; |
| | | }, |
| | | addEquipment() { |
| | | this.equipmentForm = {}; |
| | | this.modalType = 0; |
| | | this.modalTitle = "添加设备"; |
| | | this.$refs.carForm.resetFields(); |
| | | delete this.carForm.id; |
| | | this.addEquipmentVisible = true; |
| | | }, |
| | | edit(v) { |
| | | this.getAllUser(); |
| | | this.buyYear = v.buyYear; |
| | | this.modalType = 1; |
| | | this.modalTitle = "编辑"; |
| | | this.$refs.carForm.resetFields(); |
| | | // 转换null为"" |
| | | for (let attr in v) { |
| | | if (v[attr] == null) { |
| | | v[attr] = ""; |
| | | } |
| | | } |
| | | let str = JSON.stringify(v); |
| | | let roleInfo = JSON.parse(str); |
| | | this.carForm = roleInfo; |
| | | this.roleModalVisible = true; |
| | | }, |
| | | editEquipment(v) { |
| | | this.modalType = 1; |
| | | this.modalTitle = "编辑设备"; |
| | | this.$refs.equipmentForm.resetFields(); |
| | | // 转换null为"" |
| | | for (let attr in v) { |
| | | if (v[attr] == null) { |
| | | v[attr] = ""; |
| | | } |
| | | } |
| | | let str = JSON.stringify(v); |
| | | let roleInfo = JSON.parse(str); |
| | | this.equipmentForm = roleInfo; |
| | | this.addEquipmentVisible = true; |
| | | }, |
| | | removeCar(v) { |
| | | this.dataType = 0; |
| | | this.modalTitle = "移除车辆"; |
| | | this.$refs.carForm.resetFields(); |
| | | // 转换null为"" |
| | | for (let attr in v) { |
| | | if (v[attr] == null) { |
| | | v[attr] = ""; |
| | | } |
| | | } |
| | | let str = JSON.stringify(v); |
| | | let roleInfo = JSON.parse(str); |
| | | roleInfo.status = 1 |
| | | this.removeForm = roleInfo; |
| | | this.carModalVisible = true; |
| | | |
| | | }, |
| | | remove(v) { |
| | | this.$Modal.confirm({ |
| | | title: "确认删除", |
| | | content: "您确认要删除吗 ", |
| | | loading: true, |
| | | onOk: () => { |
| | | deleteCar({ ids: v.id }).then((res) => { |
| | | this.$Modal.remove(); |
| | | if (res.success) { |
| | | this.clearSelectAll(); |
| | | this.$Message.success("删除成功"); |
| | | this.getDataList(); |
| | | } |
| | | }); |
| | | }, |
| | | }); |
| | | }, |
| | | removeEquipment(v) { |
| | | this.$Modal.confirm({ |
| | | title: "确认删除", |
| | | content: "您确认要删除吗 ", |
| | | loading: true, |
| | | onOk: () => { |
| | | deleteEquipment({ ids: v.id }).then((res) => { |
| | | this.$Modal.remove(); |
| | | if (res.success) { |
| | | this.clearSelectAll(); |
| | | this.$Message.success("删除成功"); |
| | | this.getEquipmentList(this.carId); |
| | | } |
| | | }); |
| | | }, |
| | | }); |
| | | }, |
| | | setDefault(v) { |
| | | this.loading = true; |
| | | let params = { |
| | | id: v.id, |
| | | isDefault: true, |
| | | }; |
| | | setDefaultRole(params).then((res) => { |
| | | this.loading = false; |
| | | if (res.success) { |
| | | this.$Message.success("操作成功"); |
| | | this.getDataList(); |
| | | } |
| | | }); |
| | | }, |
| | | cancelDefault(v) { |
| | | this.loading = true; |
| | | let params = { |
| | | id: v.id, |
| | | isDefault: false, |
| | | }; |
| | | setDefaultRole(params).then((res) => { |
| | | this.loading = false; |
| | | if (res.success) { |
| | | this.$Message.success("操作成功"); |
| | | this.getDataList(); |
| | | } |
| | | }); |
| | | }, |
| | | clearSelectAll() { |
| | | this.$refs.table.selectAll(false); |
| | | }, |
| | | changeSelect(e) { |
| | | this.selectList = e; |
| | | }, |
| | | delAll() { |
| | | if (this.selectList.length <= 0) { |
| | | this.$Message.warning("您还未选择要删除的数据"); |
| | | return; |
| | | } |
| | | this.$Modal.confirm({ |
| | | title: "确认删除", |
| | | content: "您确认要删除所选的 " + this.selectList.length + " 条数据?", |
| | | loading: true, |
| | | onOk: () => { |
| | | let ids = ""; |
| | | this.selectList.forEach(function (e) { |
| | | ids += e.id + ","; |
| | | }); |
| | | ids = ids.substring(0, ids.length - 1); |
| | | deleteCar({ ids: ids }).then((res) => { |
| | | this.$Modal.remove(); |
| | | if (res.success) { |
| | | this.$Message.success("删除成功"); |
| | | this.clearSelectAll(); |
| | | this.getDataList(); |
| | | } |
| | | }); |
| | | }, |
| | | }); |
| | | }, |
| | | editPerm(v) { |
| | | this.editRolePermId = v.id; |
| | | this.modalTitle = "分配 " + v.name + " 的菜单权限"; |
| | | // 匹配勾选 |
| | | let rolePerms = v.permissions; |
| | | if (this.treeLoading) { |
| | | this.$Message.warning("菜单权限数据加载中,请稍后点击查看"); |
| | | return; |
| | | } |
| | | // 递归判断子节点 |
| | | this.checkPermTree(this.permData, rolePerms); |
| | | this.permModalVisible = true; |
| | | }, |
| | | // 递归判断子节点 |
| | | checkPermTree(permData, rolePerms) { |
| | | let that = this; |
| | | permData.forEach(function (p) { |
| | | if (that.hasPerm(p, rolePerms) && p.status != -1) { |
| | | p.checked = true; |
| | | } else { |
| | | p.checked = false; |
| | | } |
| | | if (p.children && p.children.length > 0) { |
| | | that.checkPermTree(p.children, rolePerms); |
| | | } |
| | | }); |
| | | }, |
| | | // 判断角色拥有的权限节点勾选 |
| | | hasPerm(p, rolePerms) { |
| | | let flag = false; |
| | | for (let i = 0; i < rolePerms.length; i++) { |
| | | if (p.id == rolePerms[i].permissionId) { |
| | | flag = true; |
| | | break; |
| | | } |
| | | } |
| | | if (flag) { |
| | | return true; |
| | | } |
| | | return false; |
| | | }, |
| | | // 全选反选 |
| | | selectTreeAll() { |
| | | this.selectAllFlag = !this.selectAllFlag; |
| | | let select = this.selectAllFlag; |
| | | this.selectedTreeAll(this.permData, select); |
| | | }, |
| | | // 递归全选节点 |
| | | selectedTreeAll(permData, select) { |
| | | let that = this; |
| | | permData.forEach(function (e) { |
| | | e.checked = select; |
| | | if (e.children && e.children.length > 0) { |
| | | that.selectedTreeAll(e.children, select); |
| | | } |
| | | }); |
| | | }, |
| | | submitPermEdit() { |
| | | this.submitPermLoading = true; |
| | | let permIds = ""; |
| | | let selectedNodes = this.$refs.tree.getCheckedNodes(); |
| | | selectedNodes.forEach(function (e) { |
| | | permIds += e.id + ","; |
| | | }); |
| | | permIds = permIds.substring(0, permIds.length - 1); |
| | | editRolePerm({ |
| | | roleId: this.editRolePermId, |
| | | permIds: permIds, |
| | | }).then((res) => { |
| | | this.submitPermLoading = false; |
| | | if (res.success) { |
| | | this.$Message.success("操作成功"); |
| | | // 标记重新获取菜单数据 |
| | | this.$store.commit("setAdded", false); |
| | | util.initRouter(this); |
| | | this.getDataList(); |
| | | this.permModalVisible = false; |
| | | } |
| | | }); |
| | | }, |
| | | cancelPermEdit() { |
| | | this.permModalVisible = false; |
| | | }, |
| | | loadData(item, callback) { |
| | | loadDepartment(item.id, { openDataFilter: false }).then((res) => { |
| | | if (res.success) { |
| | | res.result.forEach(function (e) { |
| | | e.selected = false; |
| | | if (e.isParent) { |
| | | e.loading = false; |
| | | e.children = []; |
| | | } |
| | | if (e.status == -1) { |
| | | e.title = "[已禁用] " + e.title; |
| | | e.disabled = true; |
| | | } |
| | | }); |
| | | callback(res.result); |
| | | } |
| | | }); |
| | | }, |
| | | expandCheckDep(v) { |
| | | // 判断展开子节点 |
| | | this.checkDepTree(v.children, this.editDepartments); |
| | | }, |
| | | // 判断子节点 |
| | | checkDepTree(depData, roleDepIds) { |
| | | let that = this; |
| | | depData.forEach(function (p) { |
| | | if (that.hasDepPerm(p, roleDepIds)) { |
| | | p.selected = true; |
| | | } else { |
| | | p.selected = false; |
| | | } |
| | | }); |
| | | }, |
| | | // 判断角色拥有的权限节点勾选 |
| | | hasDepPerm(p, roleDepIds) { |
| | | let flag = false; |
| | | for (let i = 0; i < roleDepIds.length; i++) { |
| | | if (p.id == roleDepIds[i].departmentId) { |
| | | flag = true; |
| | | break; |
| | | } |
| | | } |
| | | if (flag) { |
| | | return true; |
| | | } |
| | | return false; |
| | | }, |
| | | submitDepEdit() { |
| | | let depIds = ""; |
| | | if (this.dataType == 1) { |
| | | let selectedNodes = this.$refs.depTree.getSelectedNodes(); |
| | | selectedNodes.forEach(function (e) { |
| | | depIds += e.id + ","; |
| | | }); |
| | | depIds = depIds.substring(0, depIds.length - 1); |
| | | } |
| | | this.submitDepLoading = true; |
| | | editRoleDep({ |
| | | roleId: this.editRolePermId, |
| | | dataType: this.dataType, |
| | | depIds: depIds, |
| | | }).then((res) => { |
| | | this.submitDepLoading = false; |
| | | if (res.success) { |
| | | this.$Message.success("操作成功"); |
| | | this.getDataList(); |
| | | this.depModalVisible = false; |
| | | } |
| | | }); |
| | | }, |
| | | changeOpen(v) { |
| | | if (v == "0") { |
| | | this.permData.forEach((e) => { |
| | | e.expand = true; |
| | | if (e.children && e.children.length > 0) { |
| | | e.children.forEach((c) => { |
| | | c.expand = true; |
| | | if (c.children && c.children.length > 0) { |
| | | c.children.forEach(function (b) { |
| | | b.expand = true; |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } else if (v == "1") { |
| | | this.permData.forEach((e) => { |
| | | e.expand = false; |
| | | if (e.children && e.children.length > 0) { |
| | | e.children.forEach((c) => { |
| | | c.expand = false; |
| | | if (c.children && c.children.length > 0) { |
| | | c.children.forEach(function (b) { |
| | | b.expand = false; |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } else if (v == "2") { |
| | | this.permData.forEach((e) => { |
| | | e.expand = true; |
| | | if (e.children && e.children.length > 0) { |
| | | e.children.forEach((c) => { |
| | | c.expand = false; |
| | | if (c.children && c.children.length > 0) { |
| | | c.children.forEach(function (b) { |
| | | b.expand = false; |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } else if (v == "3") { |
| | | this.permData.forEach((e) => { |
| | | e.expand = true; |
| | | if (e.children && e.children.length > 0) { |
| | | e.children.forEach((c) => { |
| | | c.expand = true; |
| | | if (c.children && c.children.length > 0) { |
| | | c.children.forEach(function (b) { |
| | | b.expand = false; |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | }, |
| | | mounted() { |
| | | this.maxHeight = Number(document.documentElement.clientHeight - 121) + "px"; |
| | | this.init(); |
| | | }, |
| | | }; |
| | | </script> |