Commit a804e4d6 by liimin

Merge branch 'master' of http://192.168.3.233:8090/glsx-web/tFIMS

2 parents e83d3798 22473faf
......@@ -16,10 +16,11 @@ function removeApi (data) {
return request(data)
}
function importApi (data) {
data.method = `${path}import`
return request(data)
}
// function importApi (data, noSignAttr) {
// console.log(data)
// data.method = `${path}import`
// return request(data, 'post', noSignAttr)
// }
function exportApi (data) {
data.method = `${path}export`
......@@ -30,6 +31,6 @@ export {
getListApi,
editApi,
removeApi,
importApi,
// importApi,
exportApi
}
import request from './request'
const path = 'fims.maintain.'
const path = 'fims.maintains.'
function getListApi (data) {
data.method = `${path}search`
data.method = `${path}list`
return request(data)
}
......
......@@ -17,6 +17,11 @@ function removeApi (data) {
return request(data)
}
function exportApi (data) {
data.method = `${path}export`
return request(data)
}
function downloadApi (data) {
data.method = `${path}download`
return request(data)
......@@ -26,5 +31,6 @@ export {
getListApi,
detailApi,
removeApi,
exportApi,
downloadApi
}
import request from './request'
const path = 'fims.reportlog.'
function getLogsApi (data) {
data.method = `${path}search`
return request(data)
}
function exportApi (data) {
data.method = `${path}export`
return request(data)
}
export {
getLogsApi,
exportApi
}
......@@ -9,8 +9,9 @@ import axios from '@/plugin/axios'
import sign from './sign'
import RequestMethods from './request.methods'
// import util from '@/libs/util'
const request = (params = {}, method = RequestMethods.GET) => {
const request = (params = {}, method = RequestMethods.GET, noSignAttr = []) => {
// params = util.deepClone(params)
// console.log(JSON.parse(JSON.stringify(params)))
params.source = '1'
params.app_key = '48e5e13229b82c1b4e6e8c96151f0637'
params.timestamp = new Date().getTime()
......@@ -22,7 +23,7 @@ const request = (params = {}, method = RequestMethods.GET) => {
return axios({
url,
method,
params: sign(params)
params: sign(params, noSignAttr),
})
}
export default request
......@@ -6,7 +6,7 @@
*/
import MD5 from 'js-md5'
const secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
const sign = params => {
const sign = (params, noSignAttr = []) => {
delete params.sign
const keys = Object.keys(params).sort()
var str = []
......@@ -14,9 +14,10 @@ const sign = params => {
if (typeof params[key] === 'object') params[key] = JSON.stringify(params[key])
}
keys.forEach(e => {
str.push(e + params[e])
!noSignAttr.includes(e) && str.push(e + params[e])
})
params.sign = MD5(secret + str.join('') + secret)
// console.log(params)
return params
}
export default sign
......@@ -39,6 +39,7 @@ new Vue({
// this.$store.commit('d2admin/search/init', menuHeader)
// },
mounted () {
Vue.config.devtools = true
// 展示系统信息
this.$store.commit('d2admin/releases/versionShow')
// 用户登录后从数据库加载一系列的设置
......
......@@ -352,7 +352,15 @@ export const resources = {
authId: '108',
parentId: '0'
},
component: _import('reportingLogs')
component: _import('reportingLogs'),
auth: [{
authId: '10801',
parentId: '108',
label: '导出',
category: 'Button',
type: 'button',
handle: 'handleExport'
}]
}
}
......
......@@ -60,7 +60,7 @@ export default {
get ({ state, dispatch }, name) {
return new Promise(async resolve => {
let __data = state[name]
if (!__data.length) {
if (__data) {
__data = await dispatch('getFromdb', `base.${name}`) || await dispatch('getFromAjax', name)
state[name] = __data
await dispatch('save2db', { path: `base.${name}`, value: __data })
......
......@@ -16,66 +16,66 @@
label="物料代码"
prop="deviceNum">
<el-input
:disabled="disabled" v-model="editForm.deviceNum" placeholder="请输入物料代码" clearable
v-model="editForm.deviceNum" placeholder="请输入物料代码" clearable
></el-input>
</el-form-item>
<el-form-item
label="物料编码"
prop="deviceCode">
<el-input
:disabled="disabled" v-model="editForm.deviceCode" placeholder="请输入物料编码" clearable
v-model="editForm.deviceCode" placeholder="请输入物料编码" clearable
></el-input>
</el-form-item>
<el-form-item
label="CRC物料号"
prop="crcCode">
<el-input
:disabled="disabled" v-model="editForm.crcCode" placeholder="请输入CRC物料号" clearable
v-model="editForm.crcCode" placeholder="请输入CRC物料号" clearable
></el-input>
</el-form-item>
<el-form-item
label="图号"
prop="drawNum">
<el-input
:disabled="disabled" v-model="editForm.drawNum" placeholder="请输入图号" clearable
v-model="editForm.drawNum" placeholder="请输入图号" clearable
></el-input>
</el-form-item>
<el-form-item
label="物料名称"
prop="deviceName">
<el-input
:disabled="disabled" v-model="editForm.deviceName" placeholder="请输入物料名称" clearable
v-model="editForm.deviceName" placeholder="请输入物料名称" clearable
></el-input>
</el-form-item>
<el-form-item
label="规格"
prop="specifications">
<el-input
:disabled="disabled" v-model="editForm.specifications" placeholder="请输入规格" clearable
v-model="editForm.specifications" placeholder="请输入规格" clearable
></el-input>
</el-form-item>
<el-form-item label="所在地" prop="stationName">
<el-select v-model="editForm.stationName" placeholder="请选择所在地" clearable filterable>
<el-option
<el-select v-model="editForm.stationName" placeholder="请选择所在地" clearable filterable disabled>
<!-- <el-option
v-for="(item, index) in station"
:key="index"
:value="item.confCode"
:label="item.confValue"
></el-option>
></el-option> -->
</el-select>
</el-form-item>
<el-form-item
label="库存数量"
prop="stockCount">
<el-input
:disabled="disabled" v-model="editForm.stockCount" placeholder="请输入库存数量" clearable
v-model="editForm.stockCount" placeholder="请输入库存数量" clearable
></el-input>
</el-form-item>
<el-form-item
label="责任人"
prop="responsible">
<el-input
:disabled="disabled" v-model="editForm.responsible" placeholder="请输入责任人" clearable
v-model="editForm.responsible" placeholder="请输入责任人" clearable
></el-input>
</el-form-item>
</el-form>
......@@ -97,7 +97,6 @@ export default {
name: 'EditDialog',
data () {
return {
disabled: false,
rules: {
deviceNum: [
{ required: true, message: '请输入物料代码', trigger: 'blur' }
......@@ -134,7 +133,7 @@ export default {
type: Boolean,
default: false
},
station: Array,
// station: Array,
editForm: Object
},
......
......@@ -19,12 +19,6 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="责任人">
<el-select v-model="searchForm.responsible" placeholder="请选择责任人" clearable filterable>
<el-option value="1" label="张三"></el-option>
<el-option value="2" label="李四"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
......@@ -44,6 +38,7 @@
>
<input
type="file"
id="fileUpload"
class="import-input"
accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
@change="importFile($event)" />
......@@ -110,7 +105,6 @@
<edit-dialog
:isVisible="editVisible"
:editForm="editForm"
:station="baseData.station"
@closeDialog="handleEditClose"
@confirmDialog="handleEditConfirm"
></edit-dialog>
......@@ -120,8 +114,10 @@
<script>
import EditDialog from './editDialog'
import { BaseData } from '@/common/constants'
import { getListApi, editApi, removeApi, importApi, exportApi } from '@api/deviceManagement'
import { getListApi, editApi, removeApi, exportApi } from '@api/deviceManagement'
import notice from '@/common/notice'
import qs from 'qs'
import sign from '@api/sign'
export default {
name: 'deviceManagement',
components: {
......@@ -147,8 +143,7 @@ export default {
// 搜索
searchForm: {
keyWord: '',
stationCode: '',
responsible: ''
stationCode: ''
},
// 表格
tableLoading: false,
......@@ -187,7 +182,8 @@ export default {
total: 30,
baseData: {
station: []
}
},
fileInfo: { fileType: '', fileBase: '' },
}
},
......@@ -198,7 +194,8 @@ export default {
methods: {
async loadBaseData () {
this.baseData.station = await this.$store.dispatch('d2admin/base/get', BaseData.STATION.KEY)
const data = await this.$store.dispatch('d2admin/base/get', BaseData.STATION.KEY)
this.baseData.station = data.confes
},
loadingGetList () {
......@@ -217,7 +214,8 @@ export default {
getList () {
const params = this.getParams()
getListApi(params).then(res => {
this.tableData = res
this.tableData = res.deviceList
this.total = res.pagination.totalCount
this.tableLoading = false
}).catch(err => {
notice.errorTips(err)
......@@ -225,7 +223,20 @@ export default {
})
},
delObjMutiAttr (obj, keys) {
keys.map(key => delete obj[key])
return obj
},
editDevice (params) {
for (var i in this.baseData.station) {
if (this.baseData.station[i].confCode === params.stationCode) {
params.stationName = this.baseData.station[i].confValue
break
}
}
// console.log(params)
params = this.delObjMutiAttr(params, ['createTime', 'keyWord', 'pageCount', 'pageSize', 'updateTime', 'stationName', 'stationCode'])
editApi(params).then(res => {
// console.log(res)
this.handleEditClose()
......@@ -238,20 +249,70 @@ export default {
// 导入
importFile (e) {
const params = {
file: e.target.files[0]
// const params = {
// file: e.target.files[0]
// }
const name = e.target.files[0].name
// const arr = name.split('.')
this.fileInfo.fileType = name.split('.')[1]
// // 转码base64
const reader = new FileReader()
reader.readAsDataURL(e.target.files[0])
// console.log(e.target.files[0])
reader.onload = event => {
// console.log(event.target.result)
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
// this.fileInfo.fileBase = e.target.result
this.fileInfo.fileBase = arrBase64[1]
// console.log(this.fileInfo.fileBase)
// const fileParams = this.fileInfo.fileType + '@' + this.fileInfo.fileBase
// console.log(fileParams)
var params = {
file: this.fileInfo.fileType + '@' + this.fileInfo.fileBase
}
const noSignAttr = ['file']
params.source = '1'
params.app_key = '48e5e13229b82c1b4e6e8c96151f0637'
params.timestamp = new Date().getTime()
params.v = '1.0.0'
params.format = 'json'
params.method = 'fims.device.import'// params.method
// console.log(params)
params = sign(params, noSignAttr)
axios.post('http://192.168.3.191:8944/router', qs.stringify({
...params
}),
{
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).then(res => {
// console.log(res)
if(!res.data.data.url) {
notice.okTips()
} else {
window.location.href = res.data.data.url
notice.errorTips()
}
document.getElementById('fileUpload').value = null;
}).catch(err => {
notice.errorTips(err)
document.getElementById('fileUpload').value = null;
})
// importApi(params, noSignAttr).then(res => {
// notice.okTips()
// }).catch(err => {
// notice.errorTips()
// })
}
console.log(params)
importApi(params).then(res => {
notice.okTips()
}).catch(err => {
notice.errorTips()
})
},
exportFile () {
const params = this.getParams()
exportApi(params).then(res => {
console.log(res)
window.location.href = res.url
notice.okTips()
}).catch(err => {
notice.errorTips()
......@@ -310,8 +371,12 @@ export default {
// type: 'success',
// message: '删除成功'
// })
removeApi(row).then(res => {
removeApi({
id: row.id,
usedStatus: 2
}).then(res => {
notice.okTips()
this.loadingGetList()
}).catch(err => {
notice.errorTips()
})
......
......@@ -14,13 +14,13 @@
<el-input
v-if="item.type == 'input'"
v-model="searchForm[item.model]"
:placeholder= "'请输入' + item.label"
:placeholder= "'请输入' + item.label"
clearable>
</el-input>
<el-select
v-else-if="item.type == 'select'"
v-model="searchForm[item.model]"
:placeholder="'请选择' + item.label"
:placeholder= "'请选择' + item.label"
clearable
filterable>
<el-option
......@@ -33,8 +33,10 @@
<el-date-picker
v-else-if="item.type == 'datePick'"
v-model="searchForm[item.model]"
:placeholder="'请选择' + item.label"
value-format="yyyy-MM-dd"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
......@@ -138,11 +140,11 @@ export default {
type: 'select',
model: 'taskType',
options: [{
label: '系统',
value: '1'
confValue: '系统',
confCode: '1'
}, {
label: '人工',
value: '2'
confValue: '人工',
confCode: '2'
}]
}, {
label: '故障物料代码',
......@@ -162,10 +164,31 @@ export default {
model: 'stationName',
options: []
}, {
label: '子系统',
label: '子系统编号',
type: 'input',
model: 'subsystemCode'
}, {
label: '子系统类型',
type: 'select',
model: 'subsystemTypeCode',
options: []
}, {
label: '故障类型',
type: 'select',
model: 'downType',
options: [{
confValue: '临时维修',
confCode: '1'
}, {
confValue: '车辆整改',
confCode: '2'
}, {
confValue: '重点车次',
confCode: '3'
}, {
confValue: '181故障',
confCode: '4'
}]
}],
// 表格
tableLoading: false,
......@@ -178,7 +201,15 @@ export default {
prop: 'createTime'
}, {
label: '类型',
prop: 'taskType'
prop: 'taskType',
formatter: (cellValue) => {
if (cellValue.taskType) {
return {
1: '系统',
2: '人工'
}[cellValue.taskType]
}
}
}, {
label: '车辆编号',
prop: 'trafficCode'
......@@ -186,7 +217,7 @@ export default {
label: '车辆站点',
prop: 'stationName'
}, {
label: '子系统',
label: '子系统编号',
prop: 'subsystemCode'
}, {
label: '子系统类型',
......@@ -200,6 +231,19 @@ export default {
}
}
}, {
label: '故障类型',
prop: 'downType',
formatter: (cellValue) => {
if (cellValue.downType) {
return {
1: '临时维修',
2: '车辆整改',
3: '重点车次',
4: '181故障'
}[cellValue.downType]
}
}
}, {
label: '故障描述',
prop: 'downDescription'
}, {
......@@ -221,7 +265,15 @@ export default {
prop: 'downDeviceCode'
}, {
label: '故障物料处理',
prop: 'downDeviceTreatment'
prop: 'downDeviceTreatment',
formatter: (cellValue) => {
if (cellValue.downDeviceTreatment) {
return {
1: '返厂维修',
2: '报废'
}[cellValue.downDeviceTreatment]
}
}
}, {
label: '更换物料物料代码',
prop: 'replaceDeviceNum'
......@@ -256,7 +308,7 @@ export default {
if (data) {
for (var item in modelToOptions) {
let pos = this.searchFormArr.findIndex(arrItem => arrItem.model == item)
this.searchFormArr[pos].options = data[modelToOptions[item]]
this.searchFormArr[pos].options = data[modelToOptions[item]].confes
}
}
// this.load().then(res => {
......@@ -281,8 +333,13 @@ export default {
},
getList () {
const params = this.getParams()
params.selectStartTime = params.createTime ? params.createTime[0] + ' ' + '00:00:00 ' : ''
params.selectEndTime = params.createTime ? params.createTime[1] + ' ' + '23:59:59' : ''
delete params.createTime
// console.log(params)
getListApi(params).then(res => {
this.tableData = res
this.tableData = res.maintainList
this.total = res.pagination.totalCount
this.tableLoading = false
}).catch(err => {
notice.errorTips(err)
......@@ -291,7 +348,12 @@ export default {
},
exportOrder () {
const params = this.getParams()
params.selectStartTime = params.createTime[0] ? params.createTime[0] + ' ' + '00:00:00 ' : ''
params.selectEndTime = params.createTime[1] ? params.createTime[1] + ' ' + '23:59:59' : ''
delete params.createTime
exportApi(params).then(res => {
console.log(res)
window.location.href = res.url
notice.okTips()
}).catch(err => {
notice.errorTips()
......@@ -300,7 +362,7 @@ export default {
/* 接口请求-end */
// 搜索
handleSearch () {
console.log(this.searchForm)
// console.log(this.searchForm)
this.loadingGetList()
},
......@@ -331,8 +393,11 @@ export default {
// type: 'success',
// message: '删除成功'
// })
removeApi(row).then(res => {
removeApi({
id: row.id
}).then(res => {
notice.okTips()
this.loadingGetList()
}).catch(err => {
notice.errorTips()
})
......
<!-- -->
<!-- 查看详情 -->
<template>
<div class="detailDialog">
<el-dialog
......@@ -8,7 +8,7 @@
width="800px"
>
<!-- <embed src="file:///D:/project需求/高铁/物料申请单_20190830150550.pdf" width="100%" height="800px"></embed> -->
<iframe width="100%" height="800px" scrolling="yes" frameborder="0" src="https://web.stanford.edu/~xgzhou/zhou_book2017.pdf"></iframe>
<iframe width="100%" height="800px" scrolling="yes" frameborder="0" :src="pdfUrl"></iframe>
<!-- <iframe width="100%" height="550px" scrolling="yes" frameborder="0" src="https://pan.baidu.com/s/1Juauwf2c5nkNZuj6rc0W0Q"></iframe> -->
<!-- <embed width="100%" height="800px" src="https://web.stanford.edu/~xgzhou/zhou_book2017.pdf"> -->
</el-dialog>
......@@ -27,8 +27,8 @@ export default {
isVisible: {
type: Boolean,
default: false
}
// title:
},
pdfUrl: String
},
mounted () {},
......
......@@ -10,7 +10,13 @@
<el-input v-model="searchForm.orderCode" placeholder="请输入订单编号" clearable></el-input>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker v-model="searchForm.createTime" type="date" placeholder="请选择日期"></el-date-picker>
<el-date-picker
v-model="searchForm.createTime"
type="daterange"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item label="订单类型">
<el-select v-model="searchForm.orderType" placeholder="请选择订单类型" clearable filterable>
......@@ -23,8 +29,12 @@
</el-form-item>
<el-form-item label="订单状态">
<el-select v-model="searchForm.status" placeholder="请选择订单状态" clearable filterable>
<el-option label="审批中" value="1"></el-option>
<el-option label="已驳回" value="2"></el-option>
<el-option
v-for="(item, index) in statusArr"
:key="index"
:value="item.value"
:label="item.label"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
......@@ -98,6 +108,7 @@
<detail-dialog
:isVisible="detailVisible"
:title="dialogTitle"
:pdfUrl="pdfUrl"
@closeDialog="handleDetailClose"
></detail-dialog>
</d2-container>
......@@ -105,7 +116,7 @@
<script>
import DetailDialog from './detailDialog'
import { getListApi, detailApi, removeApi, downloadApi } from '@api/materiaOrderManagement'
import { getListApi, detailApi, removeApi, exportApi, downloadApi } from '@api/materiaOrderManagement'
import notice from '@/common/notice'
export default {
name: 'materiaOrderManagement',
......@@ -116,6 +127,7 @@ export default {
return {
detailVisible: false,
dialogTitle: '',
pdfUrl: '',
// 搜索
searchForm: {
orderCode: '',
......@@ -124,6 +136,25 @@ export default {
userName: '',
createTime: ''
},
statusArr: [{
value: 1,
label: '审批中'
}, {
value: 2,
label: '审批完成'
}, {
value: 3,
label: '已驳回'
}, {
value: 4,
label: '待发货'
}, {
value: 5,
label: '已发货'
}, {
value: 6,
label: '已签收'
}, ],
// 表格
tableLoading: false,
tableData: [],
......@@ -180,8 +211,15 @@ export default {
},
getList () {
const params = this.getParams()
// console.log(params)
!params.orderCode && delete params.orderCode
params.startTime = params.createTime[0] ? params.createTime[0] + ' ' + '00:00:00 ' : ''
params.endTime = params.createTime[1] ? params.createTime[1] + ' ' + '23:59:59' : ''
delete params.createTime
console.log(params)
getListApi(params).then(res => {
this.tableData = res
this.tableData = res.orderList
this.total = res.pagination.totalCount
this.tableLoading = false
}).catch(err => {
notice.errorTips(err)
......@@ -201,7 +239,13 @@ export default {
},
exportFile () {
const params = this.getParams()
downloadApi(params).then(res => {
!params.orderCode && delete params.orderCode
params.selectStartTime = params.createTime ? params.createTime[0] + ' ' + '00:00:00 ' : ''
params.endTime = params.createTime ? params.createTime[1] + ' ' + '23:59:59' : ''
delete params.createTime
exportApi(params).then(res => {
console.log(res)
window.location.href = res.url
notice.okTips()
}).catch(err => {
notice.errorTips()
......@@ -235,8 +279,17 @@ export default {
// 表格-查看详情
handleDetail (row) {
this.dialogTitle = row.orderType
this.detailVisible = !this.detailVisible
console.log(row)
detailApi({
orderCode: row.orderCode
}).then(res => {
console.log(res)
this.dialogTitle = row.orderType
this.pdfUrl = res.signatureUrl
this.detailVisible = !this.detailVisible
}).catch(err => {
notice.errorTips()
})
},
handleDelete (row) {
......@@ -245,8 +298,12 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
removeApi(row).then(res => {
// console.log(row)
removeApi({
orderCode: row.orderCode
}).then(res => {
notice.okTips()
this.loadingGetList()
}).catch(err => {
notice.errorTips()
})
......
......@@ -9,12 +9,6 @@
<el-form-item label="物料">
<el-input v-model="searchForm.keyWord" placeholder="请输入物料代码/编码/名称" clearable></el-input>
</el-form-item>
<el-form-item label="责任人">
<el-select v-model="searchForm.responsible" placeholder="请选择责任人" clearable filterable>
<el-option label="张三" value="1"></el-option>
<el-option label="李四" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
......@@ -129,7 +123,8 @@ export default {
getList () {
const params = this.getParams()
getListApi(params).then(res => {
this.tableData = res
this.tableData = res.deviceList
this.total = res.pagination.totalCount
this.tableLoading = false
}).catch(err => {
notice.errorTips(err)
......
......@@ -8,24 +8,28 @@
>
<el-form-item label="上报时间">
<el-date-picker
v-model="times"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
v-model="searchForm.reportTime"
type="daterange"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="车辆编号">
<el-input v-model="searchForm.carNum" placeholder="请输入车辆编号" clearable></el-input>
<el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" clearable></el-input>
</el-form-item>
<el-form-item label="归属车辆段">
<el-select v-model="searchForm.depot" placeholder="请选择" clearable filterable>
<el-option label="111" value="1"></el-option>
<el-option label="222" value="2"></el-option>
<el-select v-model="searchForm.stationId" placeholder="请选择" clearable filterable>
<el-option v-for="(item, index) in baseData.station"
:key="index"
:value="item.confCode"
:label="item.confValue"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="子系统编号">
<el-input v-model="searchForm.subsystemNum" placeholder="请输入子系统编号" clearable></el-input>
<el-input v-model="searchForm.subSystemCode" placeholder="请输入子系统编号" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch">查询</el-button>
......@@ -34,11 +38,12 @@
<el-row style="height: 40px; line-height: 40px">
<el-col :span="12">上报日志列表</el-col>
<el-col :span="12" style="text-align: right">
<el-button>导出</el-button>
<auth-button category="Button"></auth-button>
</el-col>
</el-row>
<el-table
:data="tableData"
v-loading="tableLoading"
border
style="margin: 20px 0;"
>
......@@ -56,14 +61,6 @@
:width="item.width"
align="center"
>
<template slot-scope="scope">
<template v-if="item.formatter">
{{item.formatter(scope.row)}}
</template>
<template v-else>
{{tableData[scope.$index][item.prop]}}
</template>
</template>
</el-table-column>
</el-table>
<el-pagination
......@@ -81,76 +78,114 @@
</template>
<script>
import { getLogsApi, exportApi } from '@api/reportingLogs'
import { BaseData } from '@/common/constants'
import notice from '@/common/notice'
export default {
name: 'reportingLogs',
data () {
return {
times: [],
tableLoading: false,
searchForm: {
beginTime: '',
endTime: '',
carNum: '',
depot: '',
subsystemNum: ''
// beginTime: '',
// endTime: '',
reportTime: '',
trafficCode: '',
stationId: '',
subSystemCode: ''
},
tableData: [{
reportTime: '2019-08-16 14:45:21',
carNum: 'CRH45661-5648',
depot: '青岛',
subsystemNum: '3#1F',
subsystemType: '座椅',
subsystemManufactor: '长春通富机电设备有限公司',
reportContent: '00x4561aa'
}, {
reportTime: '2019-08-16 14:45:21',
carNum: 'CRH45661-5648',
depot: '青岛',
subsystemNum: '3#1F',
subsystemType: '座椅',
subsystemManufactor: '长春通富机电设备有限公司',
reportContent: '00x4561aa'
}, {
reportTime: '2019-08-16 14:45:21',
carNum: 'CRH45661-5648',
depot: '青岛',
subsystemNum: '3#1F',
subsystemType: '座椅',
subsystemManufactor: '长春通富机电设备有限公司',
reportContent: '00x4561aa'
}],
tableData: [],
tableColumns: [{
label: '上报时间',
prop: 'reportTime'
}, {
label: '车辆编号',
prop: 'carNum'
prop: 'trafficCode'
}, {
label: '归属车辆段',
prop: 'depot'
prop: 'stationName'
}, {
label: '子系统编号',
prop: 'subsystemNum'
prop: 'subSystemCode'
}, {
label: '子系统类型',
prop: 'subsystemType'
prop: 'subSystemType'
}, {
label: '子系统厂家',
prop: 'subsystemManufactor'
prop: 'merchantName'
}, {
label: '上报内容',
prop: 'reportContent'
prop: 'reportValue'
}],
// 页码
currentPage: 1,
pageSize: 10,
total: 30
total: 30,
baseData: {
station: []
}
}
},
mounted() {
this.loadingGetList()
this.loadBaseData()
},
methods: {
async loadBaseData() {
const data = await this.$store.dispatch('d2admin/base/get', BaseData.STATION.KEY)
this.baseData.station = data.confes
},
loadingGetList () {
this.tableLoading = true
this.getList()
},
getParams () {
return Object.assign(
{
pageCount: this.pageSize,
pageSize: this.currentPage,
},
this.searchForm
)
},
getList () {
const params = this.getParams()
params.startTime = params.reportTime ? params.reportTime[0] + ' ' + '00:00:00 ' : ''
params.endTime = params.reportTime ? params.reportTime[1] + ' ' + '23:59:59' : ''
delete params.reportTime
getLogsApi(params).then(res => {
// res.pagination && (this.total = res.pagination.totalCount)
this.tableData = res.loges
this.total = res.pagination.totalCount
this.tableLoading = false
})
.catch(err => {
this.tableLoading = false
console.log(err)
})
},
handleExport() {
const params = this.getParams()
params.startTime = params.reportTime ? params.reportTime[0] + ' ' + '00:00:00 ' : ''
params.endTime = params.reportTime ? params.reportTime[1] + ' ' + '23:59:59' : ''
delete params.reportTime
exportApi(params).then(res => {
console.log(res)
window.location.href = res.url
notice.okTips()
}).catch(err => {
notice.errorTips()
})
},
// 搜索
handleSearch () {
console.log(this.searchForm)
this.loadingGetList()
},
// 页码
......@@ -158,12 +193,14 @@ export default {
console.log(value)
this.pageSize = value
// 调接口
this.loadingGetList()
},
handleCurrentChange (value) {
console.log(value)
this.currentPage = value
// 调接口
this.loadingGetList()
}
}
}
......
......@@ -31,8 +31,8 @@ import { constants } from 'fs';
placeholder="请输入车辆编号"
></el-input>
</el-form-item>
<el-form-item label="类型" prop="systemType">
<el-select v-model="editForm.systemType" placeholder="请选择类型" clearable filterable>
<el-form-item label="类型" prop="subsystemTypeCode">
<el-select v-model="editForm.subsystemTypeCode" placeholder="请选择类型" clearable filterable>
<el-option v-for="(item, index) in subsys"
:key="index"
:value="item.confCode"
......@@ -82,7 +82,7 @@ export default {
trafficCode: [
{ required: true, message: '请输入车辆编号', trigger: 'blur' }
],
systemType: [
subsystemTypeCode: [
{ required: true, message: '请选择类型', trigger: 'change' }
],
merchantName: [
......
......@@ -10,7 +10,7 @@
<el-input v-model="searchForm.subsystemCode" placeholder="请输入子系统编号" clearable></el-input>
</el-form-item>
<el-form-item label="类型">
<el-select v-model="searchForm.systemTypeCode" placeholder="请选择类型" clearable filterable>
<el-select v-model="searchForm.subsystemTypeCode" placeholder="请选择类型" clearable filterable>
<el-option v-for="(item, index) in baseData.subsys"
:key="index"
:value="item.confCode"
......@@ -142,7 +142,7 @@ export default {
// 搜索
searchForm: {
subsystemCode: '',
systemTypeCode: '',
subsystemTypeCode: '',
trafficCode: '',
merchantName: ''
},
......@@ -153,7 +153,7 @@ export default {
prop: 'subsystemCode'
}, {
label: '类型',
prop: 'systemType'
prop: 'subsystemType'
}, {
label: '车辆编号',
prop: 'trafficCode'
......@@ -190,9 +190,10 @@ export default {
methods: {
async loadBaseData () {
this.baseData.subsys = await this.$store.dispatch('d2admin/base/get', BaseData.SUBSYS.KEY)
},
async loadBaseData() {
const data = await this.$store.dispatch('d2admin/base/get', BaseData.SUBSYS.KEY)
this.baseData.subsys = data.confes
},
loadingGetList () {
this.tableLoading = true
......@@ -209,16 +210,49 @@ export default {
getList () {
const params = this.getParams()
getListApi(params).then(res => {
this.tableData = res
this.tableData = res.subsystemList
this.total = res.pagination.totalCount
this.tableLoading = false
}).catch(err => {
notice.errorTips(err)
this.tableLoading = false
})
},
delObjMutiAttr (obj, key) {
},
editSubSystem (value) {
const params = value
const params = {
id: '',
subsystemCode: '',
trafficCode: '',
subsystemType: '',
subsystemTypeCode: '',
merchantName: '',
sendSequence: '',
sendPort: '',
gatewayUrl: '',
gatewayPort: ''
}
if(!value.id) {
delete params.id
} else {
delete params.subsystemCode
delete params.trafficCode
}
for(var item in params) {
params[item] = value[item]
}
for (var i in this.baseData.subsys) {
if (this.baseData.subsys[i].confCode === params.subsystemTypeCode) {
params.subsystemType = this.baseData.subsys[i].confValue
break
}
}
params.method = value.id ? methods.Edit : methods.Add
// console.log(params)
editApi(params).then(res => {
this.handleEditClose()
notice.okTips()
......@@ -289,8 +323,12 @@ export default {
// type: 'success',
// message: '删除成功'
// })
removeApi(row).then(res => {
removeApi({
id: row.id,
usedStatus: 2
}).then(res => {
notice.okTips()
this.loadingGetList()
}).catch(err => {
notice.errorTips()
})
......
......@@ -92,8 +92,8 @@
>
<template v-if="item.prop" slot-scope="scope">
<template v-if="item.prop == 'onlineStatus'">
<el-tag v-if="tableData[scope.$index][item.prop] == '在网'" type="success" size="medium">{{ tableData[scope.$index][item.prop] }}</el-tag>
<el-tag v-else type="info" size="medium">{{ tableData[scope.$index][item.prop] }}</el-tag>
<el-tag v-if="tableData[scope.$index][item.prop] == '1'" type="success" size="medium">在网</el-tag>
<el-tag v-else type="info" size="medium">离网</el-tag>
</template>
<template v-else>
{{tableData[scope.$index][item.prop]}}
......@@ -226,7 +226,7 @@ export default {
prop: 'subsystemCode'
}, {
label: '子系统类型',
prop: 'subSystemType'
prop: 'subsystemType'
}, {
label: '子系统状态',
prop: 'onlineStatus'
......@@ -238,7 +238,7 @@ export default {
prop: 'stationCode'
}, {
label: '故障内容',
prop: 'downDescription'
prop: 'errorCode'
}],
// 翻页
currentPage: 1,
......@@ -247,7 +247,8 @@ export default {
baseData: {
station: [],
subsys: []
}
},
href: ''
}
},
......@@ -265,8 +266,9 @@ export default {
async loadBaseData () {
// this.baseData.station = await this.$store.dispatch('d2admin/base/get', BaseData.STATION.KEY)
const { station, subsys } = await this.load()
this.baseData.station = station
this.baseData.subsys = subsys
this.baseData.station = station.confes
this.baseData.subsys = JSON.parse(JSON.stringify(subsys.confes))
this.baseData.subsys.unshift({ confCode: '', confValue: '全部'})
// console.log(this.baseData)
},
......@@ -285,16 +287,17 @@ export default {
getList () {
const params = this.getParams()
getListApi(params).then(res => {
this.tableData = res
this.tableData = res.subsystemList
this.total = res.pagination.totalCount
this.tableLoading = false
}).catch(err => {
notice.errorTips(err)
this.tableLoading = false
})
},
getPie (systemTypeId = 1) {
getPie (subsystemTypeCode = '') {
const params = {
systemTypeId: systemTypeId
subsystemTypeCode: subsystemTypeCode
}
// console.log(params)
reportApi(params).then(res => {
......@@ -306,7 +309,20 @@ export default {
exportFile () {
const params = this.getParams()
exportApi(params).then(res => {
console.log(res)
// this.href = 'https://web.stanford.edu/~xgzhou/zhou_book2017.pdf'
window.location.href = res.url
notice.okTips()
// window.open(res.url, '_black')
// window.location.href = 'https://web.stanford.edu/~xgzhou/zhou_book2017.pdf'
// let url = window.URL.createObjectURL(new Blob(['https://web.stanford.edu/~xgzhou/zhou_book2017.pdf']))
// let link = document.createElement('a')
// link.style.display = 'none'
// link.href = url
// link.setAttribute('download', 'excel.xlsx')
// document.body.appendChild(link)
// link.click()
}).catch(err => {
notice.errorTips()
})
......@@ -330,9 +346,9 @@ export default {
// console.log(label)
// 请求后端数据--参数
var value = ''
for (var i in this.systemTypeArr) {
if (this.systemTypeArr[i].label === label) {
value = this.systemTypeArr[i].value
for (var i in this.baseData.subsys) {
if (this.baseData.subsys[i].confValue === label) {
value = this.baseData.subsys[i].confCode
break
}
}
......
......@@ -2,7 +2,7 @@
<template>
<div>
<el-dialog
:title="!editForm.trafficCode ? '添加车辆' : '编辑车辆'"
:title="title"
:visible.sync="isVisible"
:before-close="handleClose"
>
......@@ -21,8 +21,8 @@
placeholder="请输入车辆编号"
></el-input>
</el-form-item>
<el-form-item label="归属车辆段" prop="stationName">
<el-select v-model="editForm.stationName" placeholder="请选择归属车辆段" clearable filterable>
<el-form-item label="归属车辆段" prop="stationCode">
<el-select v-model="editForm.stationCode" placeholder="请选择归属车辆段" clearable filterable>
<el-option v-for="(item, index) in station"
:key="index"
:value="item.confCode"
......@@ -57,11 +57,12 @@ export default {
data () {
return {
disabled: false,
title: '添加车辆',
rules: {
trafficCode: [
{ required: true, message: '请输入车辆编号', trigger: 'blur' }
],
stationName: [
stationCode: [
{ required: true, message: '请选择归属车辆段', trigger: 'change' }
],
merchantName: [
......@@ -85,7 +86,8 @@ export default {
watch: {
isVisible (val) {
this.disabled = !!this.editForm.trafficCode
this.editForm.openType = this.editForm.trafficCode ? this.editForm.openType : '1'
this.title = !this.editForm.trafficCode ? '添加车辆' : '编辑车辆'
this.editForm.openType = this.editForm.trafficCode ? this.editForm.openType + '' : '1'
this.$refs.editRuleForm && this.$refs.editRuleForm.resetFields()
}
},
......
......@@ -25,8 +25,8 @@
</el-form-item>
<el-form-item label="状态">
<el-select v-model="searchForm.openType" placeholder="请选择状态" clearable filterable>
<el-option label="在网" value="1"></el-option>
<el-option label="离网" value="2"></el-option>
<el-option label="是" value="1"></el-option>
<el-option label="否" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item>
......@@ -184,9 +184,9 @@ export default {
},
methods: {
async loadBaseData () {
this.baseData.station = await this.$store.dispatch('d2admin/base/get', BaseData.STATION.KEY)
async loadBaseData() {
const data = await this.$store.dispatch('d2admin/base/get', BaseData.STATION.KEY)
this.baseData.station = data.confes
},
loadingGetList () {
......@@ -204,7 +204,8 @@ export default {
getList () {
const params = this.getParams()
getListApi(params).then(res => {
this.tableData = res
this.tableData = res.trafficList
this.total = res.pagination.totalCount
this.tableLoading = false
}).catch(err => {
notice.errorTips(err)
......@@ -212,8 +213,27 @@ export default {
})
},
editTraffic (value) {
const params = value
// console.log(value)
const params = {
id : '',
trafficCode: '',
stationCode: '',
stationName: '',
merchantName: '',
openType: ''
}
for(var item in params) {
params[item] = value[item]
}
for (var i in this.baseData.station) {
if (this.baseData.station[i].confCode === params.stationCode) {
params.stationName = this.baseData.station[i].confValue
break
}
}
!value.id ? delete params.id : delete params.trafficCode
params.method = value.id ? methods.Edit : methods.Add
// console.log(params)
editApi(params).then(res => {
this.handleEditClose()
notice.okTips()
......@@ -275,8 +295,12 @@ export default {
// type: 'success',
// message: '删除成功'
// })
removeApi(row).then(res => {
removeApi({
id: row.id,
usedStatus: 2
}).then(res => {
notice.okTips()
this.loadingGetList()
}).catch(err => {
notice.errorTips()
})
......
......@@ -7,21 +7,22 @@
label-width="85px"
>
<el-form-item label="用户">
<el-input v-model="searchForm.field" placeholder="请输入用户名/姓名/联系电话" clearable></el-input>
<el-input v-model="searchForm.userName" placeholder="请输入用户名/姓名/联系电话" clearable></el-input>
</el-form-item>
<el-form-item label="登录时间">
<el-date-picker
v-model="times"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
v-model="searchForm.loginTime"
type="daterange"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item label="登录方式">
<el-select v-model="searchForm.loginType" placeholder="请选择" clearable filterable>
<el-option label="111" value="1"></el-option>
<el-option label="222" value="2"></el-option>
<el-option label="PC" value="1"></el-option>
<el-option label="小程序" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item>
......@@ -32,9 +33,26 @@
<el-col>登录日志列表</el-col>
</el-row>
<el-table
:table="tableData"
:data="tableData"
v-loading="tableLoading"
border
style="margin: 20px 0;"
>
<el-table-column
align="center"
width="60px"
label="序号"
type='index'
></el-table-column>
<el-table-column
v-for="(item, index) in tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
align="center"
>
</el-table-column>
</el-table>
<el-pagination
background
......@@ -57,97 +75,33 @@ export default {
data () {
return {
tableLoading: false,
times: [],
searchForm: {
beginTime: '',
endTime: '',
field: '',
// beginTime: '',
// endTime: '',
loginTime: '',
userName: '',
loginType: ''
},
// tableData: [{
// loginTime: '2019-08-16 14:45:21',
// loginUser: 'abc123',
// userName: '张三',
// phone: '13511111111',
// loginType: 'PC',
// loginDevice: 'win10/chrome'
// }, {
// loginTime: '2019-08-16 14:45:21',
// loginUser: 'abc123',
// userName: '李四',
// phone: '13511111111',
// loginType: '小程序',
// loginDevice: 'iphone8'
// }, {
// loginTime: '2019-08-16 14:45:21',
// loginUser: 'abc123',
// userName: '王五',
// phone: '13511111111',
// loginType: 'PC',
// loginDevice: 'win10/chrome'
// }],
// tableColumns: [{
// label: '登录时间',
// prop: 'loginTime'
// }, {
// label: '登录用户',
// prop: 'loginUser'
// }, {
// label: '姓名',
// prop: 'userName'
// }, {
// label: '联系电话',
// prop: 'phone'
// }, {
// label: '登录方式',
// prop: 'loginType'
// }, {
// label: '登录设备',
// prop: 'loginDevice'
// }],
tableData: {
border: true,
align: 'center',
// height: parseInt(this.$client_height() - 140),
data: [],
column: [
{
label: '登录时间',
prop: 'loginTime'
},
{
label: '登录用户',
prop: 'loginUser'
},
{
label: '姓名',
prop: 'userName'
},
{
label: '联系电话',
prop: 'phone'
},
{
label: '登录方式',
prop: 'loginType'
},
{
label: '登录设备',
prop: 'loginDevice'
}
],
number: {
label: '序号',
width: '50px',
index: index => {
++index
return index < 10 && index > 0 ? '0' + index : index
}
},
console: {
}
},
tableData: [],
tableColumns: [{
label: '登录时间',
prop: 'loginTime'
}, {
label: '登录用户',
prop: 'loginName'
}, {
label: '姓名',
prop: 'userName'
}, {
label: '联系电话',
prop: 'mobile'
}, {
label: '登录方式',
prop: 'loginTypeValue'
}, {
label: '登录设备',
prop: 'deviceCode'
}],
// 页码
currentPage: 1,
pageSize: 10,
......@@ -167,21 +121,20 @@ export default {
return Object.assign(
{
pageCount: this.pageSize,
pageSize: this.pageNum
pageSize: this.currentPage,
},
this.searchForm
)
},
getList () {
if (this.times.length) {
this.searchForm.beginTime = this.times[0]
this.searchForm.endTime = this.times[1]
}
const params = this.getParams()
params.startTime = params.loginTime[0] ? params.loginTime[0] + ' ' + '00:00:00 ' : ''
params.endTime = params.loginTime[1] ? params.loginTime[1] + ' ' + '23:59:59' : ''
delete params.loginTime
getLoginlogs(params).then(res => {
// res.pagination && (this.total = res.pagination.totalCount)
this.tableData.data = res
console.log(this.tableData)
this.tableData = res.loges
this.total = res.pagination.totalCount
this.tableLoading = false
})
.catch(err => {
......@@ -196,15 +149,17 @@ export default {
// 页码
handleSizeChange (value) {
console.log(value)
// console.log(value)
this.pageSize = value
// 调接口
this.loadingGetList()
},
handleCurrentChange (value) {
console.log(value)
// console.log(value)
this.currentPage = value
// 调接口
this.loadingGetList()
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!