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