Commit addc33fb by cwq0219

修改

1 parent 98b43fc2
...@@ -143,7 +143,6 @@ export default { ...@@ -143,7 +143,6 @@ export default {
watch: { watch: {
isVisible (val) { isVisible (val) {
// this.disabled = this.editForm.trafficCode ? true : false
val && (this.deviceNum = this.editForm.deviceNum) val && (this.deviceNum = this.editForm.deviceNum)
val && (this.deviceName = this.editForm.deviceName) val && (this.deviceName = this.editForm.deviceName)
this.$refs.editRuleForm && this.$refs.editRuleForm.resetFields() this.$refs.editRuleForm && this.$refs.editRuleForm.resetFields()
...@@ -156,7 +155,6 @@ export default { ...@@ -156,7 +155,6 @@ export default {
async isCodeExist (rule, value, callback) { async isCodeExist (rule, value, callback) {
if (this.deviceNum !== value || this.deviceName !== this.editForm.deviceName) { if (this.deviceNum !== value || this.deviceName !== this.editForm.deviceName) {
const res = await isExistApi({ deviceNum: value, deviceName: this.editForm.deviceName, stationCode: this.editForm.stationCode }) const res = await isExistApi({ deviceNum: value, deviceName: this.editForm.deviceName, stationCode: this.editForm.stationCode })
// console.log(res)
res.deviceNum ? callback(new Error(rule.message)) : callback() res.deviceNum ? callback(new Error(rule.message)) : callback()
} }
}, },
......
...@@ -66,14 +66,6 @@ ...@@ -66,14 +66,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-column <el-table-column
align="center" align="center"
...@@ -81,14 +73,6 @@ ...@@ -81,14 +73,6 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<auth-button :data="scope.row"></auth-button> <auth-button :data="scope.row"></auth-button>
<!-- <el-button
type="text"
@click="handleEdit(scope.row, scope.$index)"
>编辑</el-button>
<el-button
type="text"
@click="handleDelete(scope.$index, scope.row)"
>删除</el-button> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -231,16 +215,9 @@ export default { ...@@ -231,16 +215,9 @@ export default {
}, },
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']) params = this.delObjMutiAttr(params, ['createTime', 'keyWord', 'pageCount', 'pageSize', 'updateTime', 'stationName', 'stationCode'])
// console.log(params)
editApi(params).then(res => { editApi(params).then(res => {
// console.log(res)
this.handleEditClose() this.handleEditClose()
notice.okTips() notice.okTips()
this.loadingGetList() this.loadingGetList()
...@@ -251,25 +228,15 @@ export default { ...@@ -251,25 +228,15 @@ export default {
// 导入 // 导入
importFile (e) { importFile (e) {
// const params = {
// file: e.target.files[0]
// }
const name = e.target.files[0].name const name = e.target.files[0].name
// const arr = name.split('.')
this.fileInfo.fileType = name.split('.')[1] this.fileInfo.fileType = name.split('.')[1]
// // 转码base64 // // 转码base64
const reader = new FileReader() const reader = new FileReader()
reader.readAsDataURL(e.target.files[0]) reader.readAsDataURL(e.target.files[0])
// console.log(e.target.files[0])
reader.onload = event => { reader.onload = event => {
// console.log(event.target.result)
const imgFile = event.target.result const imgFile = event.target.result
const arrBase64 = imgFile.split(',') const arrBase64 = imgFile.split(',')
// this.fileInfo.fileBase = e.target.result
this.fileInfo.fileBase = arrBase64[1] this.fileInfo.fileBase = arrBase64[1]
// console.log(this.fileInfo.fileBase)
// const fileParams = this.fileInfo.fileType + '@' + this.fileInfo.fileBase
// console.log(fileParams)
var params = { var params = {
file: this.fileInfo.fileType + '@' + this.fileInfo.fileBase file: this.fileInfo.fileType + '@' + this.fileInfo.fileBase
} }
...@@ -290,12 +257,11 @@ export default { ...@@ -290,12 +257,11 @@ export default {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
} }
}).then(res => { }).then(res => {
// console.log(res) let url = res.data.data.url
if (!res.data.data.url) { if (!url) {
notice.okTips() notice.okTips()
} else { } else {
// window.location.href = res.data.data.url this.$open(url)
this.$open(res.data.data.url)
notice.errorTips() notice.errorTips()
} }
document.getElementById('fileUpload').value = null document.getElementById('fileUpload').value = null
...@@ -303,18 +269,12 @@ export default { ...@@ -303,18 +269,12 @@ export default {
notice.errorTips() notice.errorTips()
document.getElementById('fileUpload').value = null document.getElementById('fileUpload').value = null
}) })
// importApi(params, noSignAttr).then(res => {
// notice.okTips()
// }).catch(() => {
// notice.errorTips()
// })
} }
}, },
exportFile () { exportFile () {
const params = this.getParams() const params = this.getParams()
exportApi(params).then(res => { exportApi(params).then(res => {
// window.location.href = res.url
this.$open(res.url) this.$open(res.url)
notice.okTips() notice.okTips()
}).catch(() => { }).catch(() => {
...@@ -324,20 +284,17 @@ export default { ...@@ -324,20 +284,17 @@ export default {
/* 接口请求-end */ /* 接口请求-end */
// 搜索 // 搜索
handleSearch () { handleSearch () {
console.log(this.searchForm)
this.loadingGetList() this.loadingGetList()
}, },
// 页码 // 页码
handleSizeChange (value) { handleSizeChange (value) {
// console.log(value)
this.pageSize = value this.pageSize = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
}, },
handleCurrentChange (value) { handleCurrentChange (value) {
// console.log(value)
this.currentPage = value this.currentPage = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
...@@ -348,17 +305,14 @@ export default { ...@@ -348,17 +305,14 @@ export default {
}, },
handleEditConfirm () { handleEditConfirm () {
// console.log(JSON.parse(JSON.stringify(this.editForm))) var editParams = _.cloneDeep(this.editForm)
var editParams = JSON.parse(JSON.stringify(this.editForm))
this.editDevice(editParams) this.editDevice(editParams)
}, },
// 表格-编辑 // 表格-编辑
handleEdit (row) { handleEdit (row) {
// console.log(index)
// console.log(row) // console.log(row)
console.log(row) this.editForm = _.cloneDeep(row)
this.editForm = JSON.parse(JSON.stringify(row))
this.editVisible = !this.editVisible this.editVisible = !this.editVisible
}, },
...@@ -368,12 +322,6 @@ export default { ...@@ -368,12 +322,6 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// // console.log(index)
// console.log(row)
// this.$message({
// type: 'success',
// message: '删除成功'
// })
removeApi({ removeApi({
id: row.id, id: row.id,
usedStatus: 2 usedStatus: 2
...@@ -390,11 +338,6 @@ export default { ...@@ -390,11 +338,6 @@ export default {
</script> </script>
<style scoped> <style scoped>
/* .import-button {
overflow: hidden;
position: relative;
cursor: pointer;
} */
.import-input { .import-input {
opacity: 0; opacity: 0;
position: absolute; position: absolute;
......
...@@ -19,23 +19,6 @@ ...@@ -19,23 +19,6 @@
@clear="loadingGetList" @clear="loadingGetList"
clearable> clearable>
</el-input> </el-input>
<!-- <el-select
v-if="item.type == 'input'"
v-model="searchForm[item.model]"
:placeholder="'请输入' + item.label"
@clear="remoteAndGetList(item.model)"
clearable
filterable
remote
:remote-method="(query) => remoteArr(query, item.model)"
>
<el-option
v-for="i in remoteOptionArr[item.model]"
:key="i[item.model]"
:label="i[item.model]"
:value="i[item.model]"
></el-option>
</el-select> -->
<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]"
...@@ -109,10 +92,6 @@ ...@@ -109,10 +92,6 @@
<auth-button <auth-button
:data="scope.row" :data="scope.row"
></auth-button> ></auth-button>
<!-- <auth-button
label="删除"
@e-auth-click="handleDelete(scope.$index, scope.row)"
></auth-button> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -138,13 +117,6 @@ export default { ...@@ -138,13 +117,6 @@ export default {
name: 'fimsMaintainManagement', name: 'fimsMaintainManagement',
data () { data () {
return { return {
// 远程搜索-返回数组
remoteOptionArr: {
taskCode: [],
downDeviceNum: [],
userName: [],
subsystemCode: []
},
// 搜索 // 搜索
searchForm: { searchForm: {
taskCode: '', taskCode: '',
...@@ -153,7 +125,7 @@ export default { ...@@ -153,7 +125,7 @@ export default {
userName: '', userName: '',
createTime: '', createTime: '',
trafficCode: '', trafficCode: '',
stationName: '', stationCode: '',
subsystemCode: '', subsystemCode: '',
downType: '', downType: '',
subsystemTypeCode: '' subsystemTypeCode: ''
...@@ -188,7 +160,7 @@ export default { ...@@ -188,7 +160,7 @@ export default {
}, { }, {
label: '车辆站点', label: '车辆站点',
type: 'select', type: 'select',
model: 'stationName', model: 'stationCode',
options: [] options: []
}, { }, {
label: '子系统编号', label: '子系统编号',
...@@ -341,7 +313,7 @@ export default { ...@@ -341,7 +313,7 @@ export default {
...mapActions('d2admin/base', ['load']), ...mapActions('d2admin/base', ['load']),
async loadBaseData () { async loadBaseData () {
const modelToOptions = { 'stationName': 'station', 'subsystemTypeCode': 'subsys' } const modelToOptions = { 'stationCode': 'station', 'subsystemTypeCode': 'subsys' }
const data = await this.load() const data = await this.load()
if (data) { if (data) {
for (var item in modelToOptions) { for (var item in modelToOptions) {
...@@ -349,34 +321,6 @@ export default { ...@@ -349,34 +321,6 @@ export default {
this.searchFormArr[pos].options = data[modelToOptions[item]] this.searchFormArr[pos].options = data[modelToOptions[item]]
} }
} }
// this.load().then(res => {
// for(var item in modelToOptions) {
// let pos = this.searchFormArr.findIndex(arrItem => arrItem.model == item)
// this.searchFormArr[pos].options = res[modelToOptions[item]]
// }
// })
},
// 防抖
debounce (fn, delay = 50) {
let timer = null
return (...args) => {
clearTimeout(timer)
timer = setTimeout(() => {
fn.apply(this.args)
}, delay)
}
},
// 远程搜索
remoteArr (value, attr) {
this.debounce(this.getRemote(attr, value), 50)
},
// 清空远程搜索列表;表格数据刷新
remoteAndGetList (attr) {
this.remoteOptionArr[attr] = []
this.loadingGetList()
}, },
loadingGetList () { loadingGetList () {
...@@ -385,25 +329,17 @@ export default { ...@@ -385,25 +329,17 @@ export default {
}, },
/* 接口请求-start */ /* 接口请求-start */
getParams () { getParams () {
var time = [{attr: 'startTime', addTime: '00:00:00'}, {attr: 'endTime', addTime: '23:59:59'}]
this.searchForm.createTime && this.searchForm.createTime.map((value, i) => this.searchForm[time[i].attr] = value + ' ' + time[i].addTime)
return { return {
pageCount: this.pageSize, pageCount: this.pageSize,
pageSize: this.currentPage, pageSize: this.currentPage,
...this.searchForm ...this.searchForm
} }
}, },
getRemote (attr, value) {
let params = {}
params[attr] = value
delete params.pageCount
delete params.pageSize
getListApi(params).then(res => {
this.remoteOptionArr[attr] = res.maintainList
})
},
getList () { getList () {
const params = this.getParams() const params = this.getParams()
params.startTime = params.createTime ? params.createTime[0] + ' ' + '00:00:00 ' : ''
params.endTime = params.createTime ? params.createTime[1] + ' ' + '23:59:59' : ''
delete params.createTime delete params.createTime
// console.log(params) // console.log(params)
getListApi(params).then(res => { getListApi(params).then(res => {
...@@ -417,8 +353,6 @@ export default { ...@@ -417,8 +353,6 @@ export default {
}, },
exportOrder () { exportOrder () {
const params = this.getParams() const params = this.getParams()
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 delete params.createTime
exportApi(params).then(res => { exportApi(params).then(res => {
this.$open(res.url) this.$open(res.url)
...@@ -452,12 +386,6 @@ export default { ...@@ -452,12 +386,6 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// console.log(index)
// console.log(row)
// this.$message({
// type: 'success',
// message: '删除成功'
// })
removeApi({ removeApi({
id: row.id id: row.id
}).then(res => { }).then(res => {
......
...@@ -7,10 +7,7 @@ ...@@ -7,10 +7,7 @@
:before-close="handleClose" :before-close="handleClose"
width="800px" width="800px"
> >
<!-- <embed src="file:///D:/project需求/高铁/物料申请单_20190830150550.pdf" width="100%" height="800px"></embed> -->
<iframe width="100%" height="680px" scrolling="yes" frameborder="0" :src="pdfUrl"></iframe> <iframe width="100%" height="680px" 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> </el-dialog>
</div> </div>
</template> </template>
...@@ -43,12 +40,9 @@ export default { ...@@ -43,12 +40,9 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
// .detailDialog{ .detailDialog{
// .el-dialog__header, .el-dialog__body {
// .el-dialog__body { padding: 0 20px;
// padding: 0; }
// padding: 0; }
// background-color: #202223
// }
// }
</style> </style>
...@@ -9,22 +9,6 @@ ...@@ -9,22 +9,6 @@
> >
<el-form-item label="订单编号"> <el-form-item label="订单编号">
<el-input v-model="searchForm.orderCode" placeholder="请输入订单编号" @clear="loadingGetList" clearable></el-input> <el-input v-model="searchForm.orderCode" placeholder="请输入订单编号" @clear="loadingGetList" clearable></el-input>
<!-- <el-select
v-model="searchForm.orderCode"
placeholder="请输入订单编号"
@clear="remoteAndGetList('orderCode')"
clearable
filterable
remote
:remote-method="(query) => remoteArr(query, 'orderCode')"
>
<el-option
v-for="item in remoteOptionArr.orderCode"
:key="item.orderCode"
:label="item.orderCode"
:value="item.orderCode"
></el-option>
</el-select> -->
</el-form-item> </el-form-item>
<el-form-item label="订单类型"> <el-form-item label="订单类型">
<el-select v-model="searchForm.orderType" placeholder="请选择订单类型" @clear="loadingGetList" clearable filterable> <el-select v-model="searchForm.orderType" placeholder="请选择订单类型" @clear="loadingGetList" clearable filterable>
...@@ -34,22 +18,6 @@ ...@@ -34,22 +18,6 @@
</el-form-item> </el-form-item>
<el-form-item label="申请人"> <el-form-item label="申请人">
<el-input v-model="searchForm.userName" placeholder="请输入申请人" @clear="loadingGetList" clearable></el-input> <el-input v-model="searchForm.userName" placeholder="请输入申请人" @clear="loadingGetList" clearable></el-input>
<!-- <el-select
v-model="searchForm.userName"
placeholder="请输入申请人"
@clear="remoteAndGetList('userName')"
clearable
filterable
remote
:remote-method="(query) => remoteArr(query, 'userName')"
>
<el-option
v-for="item in remoteOptionArr.userName"
:key="item.userName"
:label="item.userName"
:value="item.userName"
></el-option>
</el-select> -->
</el-form-item> </el-form-item>
<el-form-item label="订单状态"> <el-form-item label="订单状态">
<el-select v-model="searchForm.status" placeholder="请选择订单状态" @clear="loadingGetList" clearable filterable> <el-select v-model="searchForm.status" placeholder="请选择订单状态" @clear="loadingGetList" clearable filterable>
...@@ -78,7 +46,6 @@ ...@@ -78,7 +46,6 @@
<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">
<auth-button category="Button"></auth-button> <auth-button category="Button"></auth-button>
<!-- <auth-button label="订单下载" type="" @e-auth-click="exportFile"></auth-button> -->
</el-col> </el-col>
</el-row> </el-row>
<el-table <el-table
...@@ -122,14 +89,6 @@ ...@@ -122,14 +89,6 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<auth-button :data="scope.row"></auth-button> <auth-button :data="scope.row"></auth-button>
<!-- <el-button
label="查看详情"
@click="handleDetail(scope.row, scope.$index)"
></el-button>
<auth-button
label="删除"
@e-auth-click="handleDelete(scope.$index, scope.row)"
></auth-button> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -164,11 +123,6 @@ export default { ...@@ -164,11 +123,6 @@ export default {
}, },
data () { data () {
return { return {
// 远程搜索-返回数组
remoteOptionArr: {
orderCode: [],
userName: []
},
detailVisible: false, detailVisible: false,
dialogTitle: '', dialogTitle: '',
pdfUrl: '', pdfUrl: '',
...@@ -245,55 +199,23 @@ export default { ...@@ -245,55 +199,23 @@ export default {
}, },
methods: { methods: {
// 防抖
debounce (fn, delay = 50) {
let timer = null
return (...args) => {
clearTimeout(timer)
timer = setTimeout(() => {
fn.apply(this.args)
}, delay)
}
},
// 远程搜索
remoteArr (value, attr) {
this.debounce(this.getRemote(attr, value), 50)
},
// 清空远程搜索列表;表格数据刷新
remoteAndGetList (attr) {
this.remoteOptionArr[attr] = []
this.loadingGetList()
},
loadingGetList () { loadingGetList () {
this.tableLoading = true this.tableLoading = true
this.getList() this.getList()
}, },
/* 接口请求-start */ /* 接口请求-start */
getParams () { getParams () {
var time = [{attr: 'startTime', addTime: '00:00:00'}, {attr: 'endTime', addTime: '23:59:59'}]
this.searchForm.createTime && this.searchForm.createTime.map((value, i) => this.searchForm[time[i].attr] = value + ' ' + time[i].addTime)
return { return {
pageCount: this.pageSize, pageCount: this.pageSize,
pageSize: this.currentPage, pageSize: this.currentPage,
...this.searchForm ...this.searchForm
} }
}, },
getRemote (attr, value) {
let params = {}
params[attr] = value
delete params.pageCount
delete params.pageSize
getListApi(params).then(res => {
this.remoteOptionArr[attr] = res.orderList
})
},
getList () { getList () {
const params = this.getParams() const params = this.getParams()
// console.log(params)
!params.orderCode && delete params.orderCode !params.orderCode && delete params.orderCode
params.startTime = params.createTime ? params.createTime[0] + ' ' + '00:00:00 ' : ''
params.endTime = params.createTime ? params.createTime[1] + ' ' + '23:59:59' : ''
delete params.createTime delete params.createTime
// console.log(params) // console.log(params)
getListApi(params).then(res => { getListApi(params).then(res => {
...@@ -305,26 +227,14 @@ export default { ...@@ -305,26 +227,14 @@ export default {
this.tableLoading = false this.tableLoading = false
}) })
}, },
editSubSystem (value) {
const params = value
// params.method = value.id ? methods.Edit : methods.Add
detailApi(params).then(res => {
this.handleEditClose()
notice.okTips()
this.loadingGetList()
}).catch(() => {
notice.errorTips()
})
},
exportFile () { exportFile () {
const params = this.getParams() const params = this.getParams()
!params.orderCode && delete params.orderCode !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 delete params.createTime
exportApi(params).then(res => { exportApi(params).then(res => {
this.$open(res.url) this.$open(res.url)
// notice.okTips() notice.okTips()
}).catch(() => { }).catch(() => {
notice.errorTips() notice.errorTips()
}) })
...@@ -354,11 +264,9 @@ export default { ...@@ -354,11 +264,9 @@ export default {
// 表格-查看详情 // 表格-查看详情
handleDetail (row) { handleDetail (row) {
// console.log(row)
downloadApi({ downloadApi({
orderCode: row.orderCode orderCode: row.orderCode
}).then(res => { }).then(res => {
// console.log(res)
this.dialogTitle = row.orderType === 1 ? '物料申请' : '物料报废' this.dialogTitle = row.orderType === 1 ? '物料申请' : '物料报废'
this.pdfUrl = res.url this.pdfUrl = res.url
this.detailVisible = !this.detailVisible this.detailVisible = !this.detailVisible
...@@ -373,7 +281,6 @@ export default { ...@@ -373,7 +281,6 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// console.log(row)
removeApi({ removeApi({
orderCode: row.orderCode orderCode: row.orderCode
}).then(() => { }).then(() => {
......
...@@ -37,14 +37,6 @@ ...@@ -37,14 +37,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
...@@ -69,8 +61,7 @@ export default { ...@@ -69,8 +61,7 @@ export default {
data () { data () {
return { return {
searchForm: { searchForm: {
keyWord: '', keyWord: ''
responsible: ''
}, },
// 表格 // 表格
tableLoading: false, tableLoading: false,
......
...@@ -126,7 +126,7 @@ export default { ...@@ -126,7 +126,7 @@ export default {
methods: { methods: {
async isCodeExist (rule, value, callback) { async isCodeExist (rule, value, callback) {
if (this.editForm.trafficCode) { if (this.editForm.trafficCode && !this.editForm.id) {
const res = await isExistApi({ subsystemCode: value, trafficCode: this.editForm.trafficCode }) const res = await isExistApi({ subsystemCode: value, trafficCode: this.editForm.trafficCode })
res.subsystemCode ? callback(new Error(rule.message)) : callback() res.subsystemCode ? callback(new Error(rule.message)) : callback()
} }
......
...@@ -37,41 +37,9 @@ ...@@ -37,41 +37,9 @@
</el-form-item> </el-form-item>
<el-form-item label="车辆编号"> <el-form-item label="车辆编号">
<el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" @clear="loadingGetList" clearable></el-input> <el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" @clear="loadingGetList" clearable></el-input>
<!-- <el-select
v-model="searchForm.trafficCode"
placeholder="请输入车辆编号"
@clear="remoteAndGetList('trafficCode')"
clearable
filterable
remote
:remote-method="(query) => remoteArr(query, 'trafficCode')"
>
<el-option
v-for="item in remoteOptionArr.trafficCode"
:key="item.trafficCode"
:label="item.trafficCode"
:value="item.trafficCode"
></el-option>
</el-select> -->
</el-form-item> </el-form-item>
<el-form-item label="生产厂家"> <el-form-item label="生产厂家">
<el-input v-model="searchForm.merchantName" placeholder="请输入生产厂家" @clear="loadingGetList" clearable></el-input> <el-input v-model="searchForm.merchantName" placeholder="请输入生产厂家" @clear="loadingGetList" clearable></el-input>
<!-- <el-select
v-model="searchForm.merchantName"
placeholder="请输入生产厂家"
@clear="remoteAndGetList('merchantName')"
clearable
filterable
remote
:remote-method="(query) => remoteArr(query, 'merchantName')"
>
<el-option
v-for="item in remoteOptionArr.merchantName"
:key="item.merchantName"
:label="item.merchantName"
:value="item.merchantName"
></el-option>
</el-select> -->
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleSearch">查询</el-button> <el-button type="primary" icon="el-icon-search" @click="handleSearch">查询</el-button>
...@@ -81,8 +49,6 @@ ...@@ -81,8 +49,6 @@
<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">
<auth-button category="Button" :data="editFormReset"></auth-button> <auth-button category="Button" :data="editFormReset"></auth-button>
<!-- <el-button @click="handleEdit(editFormReset)">添加子系统</el-button> -->
<!-- <auth-button label="添加子系统" type="" @e-auth-click="handleEdit(editFormReset)"></auth-button> -->
</el-col> </el-col>
</el-row> </el-row>
<el-table <el-table
...@@ -123,14 +89,6 @@ ...@@ -123,14 +89,6 @@
<auth-button <auth-button
:data="scope.row" :data="scope.row"
></auth-button> ></auth-button>
<!-- <auth-button
label="编辑"
@e-auth-click="handleEdit(scope.row, scope.$index)"
></auth-button>
<auth-button
label="删除"
@e-auth-click="handleDelete(scope.$index, scope.row)"
></auth-button> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -168,16 +126,16 @@ export default { ...@@ -168,16 +126,16 @@ export default {
data () { data () {
return { return {
// 远程搜索-返回数组 // 远程搜索-返回数组
remoteOptionArr: { // remoteOptionArr: {
subsystemCode: [], // subsystemCode: []
trafficCode: [], // },
merchantName: []
},
// 新增/编辑弹窗 // 新增/编辑弹窗
editVisible: false, editVisible: false,
editFormReset: { editFormReset: {
id: '',
subsystemCode: '', subsystemCode: '',
systemType: '', subsystemTypeCode: '',
subsystemType: '',
trafficCode: '', trafficCode: '',
merchantName: '', merchantName: '',
sendSequence: '', sendSequence: '',
...@@ -186,8 +144,10 @@ export default { ...@@ -186,8 +144,10 @@ export default {
gatewayPort: '' gatewayPort: ''
}, },
editForm: { editForm: {
id: '',
subsystemCode: '', subsystemCode: '',
systemType: '', subsystemTypeCode: '',
subsystemType: '',
trafficCode: '', trafficCode: '',
merchantName: '', merchantName: '',
sendSequence: '', sendSequence: '',
...@@ -251,27 +211,16 @@ export default { ...@@ -251,27 +211,16 @@ export default {
this.baseData.subsys = data this.baseData.subsys = data
}, },
// 防抖
debounce (fn, delay = 50) {
let timer = null
return (...args) => {
clearTimeout(timer)
timer = setTimeout(() => {
fn.apply(this.args)
}, delay)
}
},
// 远程搜索 // 远程搜索
remoteArr (value, attr) { // remoteArr (value, attr) {
this.debounce(this.getRemote(attr, value), 50) // _.delay(this.getRemote, 50, {attr, value})
}, // },
// 清空远程搜索列表;表格数据刷新 // 清空远程搜索列表;表格数据刷新
remoteAndGetList (attr) { // remoteAndGetList (attr) {
this.remoteOptionArr[attr] = [] // this.remoteOptionArr[attr] = []
this.loadingGetList() // this.loadingGetList()
}, // },
loadingGetList () { loadingGetList () {
this.tableLoading = true this.tableLoading = true
...@@ -285,16 +234,16 @@ export default { ...@@ -285,16 +234,16 @@ export default {
...this.searchForm ...this.searchForm
} }
}, },
getRemote (attr, value) {
let params = {} // getRemote (item) {
params[attr] = value // let params = {}
delete params.pageCount // params[item.attr] = item.value
delete params.pageSize // delete params.pageSize
getListApi(params).then(res => { // getListApi(params).then(res => {
console.log(res) // this.remoteOptionArr[item.attr] = new Set(res.subsystemList)
this.remoteOptionArr[attr] = res.subsystemList // })
}) // },
},
getList () { getList () {
const params = this.getParams() const params = this.getParams()
getListApi(params).then(res => { getListApi(params).then(res => {
...@@ -307,38 +256,17 @@ export default { ...@@ -307,38 +256,17 @@ export default {
}) })
}, },
delObjMutiAttr (obj, key) {
},
editSubSystem (value) { editSubSystem (value) {
const params = { // console.log(value)
id: '', const params = _.cloneDeep(this.editFormReset)
subsystemCode: '', Object.keys(params).map(key => params[key] = value[key])
trafficCode: '', params.subsystemType = this.baseData.subsys.find(item => item.confCode === params.subsystemTypeCode).confValue
subsystemType: '',
subsystemTypeCode: '',
merchantName: '',
sendSequence: '',
sendPort: '',
gatewayUrl: '',
gatewayPort: ''
}
if (!value.id) { if (!value.id) {
delete params.id delete params.id
} else { } else {
delete params.subsystemCode delete params.subsystemCode
delete params.trafficCode 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) // console.log(params)
editApi(params).then(res => { editApi(params).then(res => {
...@@ -368,20 +296,8 @@ export default { ...@@ -368,20 +296,8 @@ export default {
this.loadingGetList() this.loadingGetList()
}, },
// resetForm (obj) {
// for (var item in obj) {
// if (obj[item] instanceof Array) {
// obj[item] = []
// } else {
// obj[item] = ''
// }
// }
// },
handleEditClose () { handleEditClose () {
this.editVisible = !this.editVisible this.editVisible = !this.editVisible
// this.resetForm(this.editForm)
// console.log(this.editForm)
}, },
handleEditConfirm () { handleEditConfirm () {
...@@ -401,12 +317,6 @@ export default { ...@@ -401,12 +317,6 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// console.log(index)
// console.log(row)
// this.$message({
// type: 'success',
// message: '删除成功'
// })
removeApi({ removeApi({
id: row.id, id: row.id,
usedStatus: 2 usedStatus: 2
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<span style="margin-right: 20px;">子系统类型</span> <span style="margin-right: 20px;">子系统类型</span>
<el-radio-group v-model="subSystemRadio" @change="radioChange"> <el-radio-group v-model="subSystemRadio" @change="getPie">
<el-radio-button <el-radio-button
v-for="(item, index) in baseData.subsys" v-for="(item, index) in baseData.subsys"
:key="index" :key="index"
...@@ -28,22 +28,6 @@ ...@@ -28,22 +28,6 @@
> >
<el-form-item label="车辆编号"> <el-form-item label="车辆编号">
<el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" @clear="loadingGetList" clearable></el-input> <el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" @clear="loadingGetList" clearable></el-input>
<!-- <el-select
v-model="searchForm.trafficCode"
placeholder="请输入车辆编号"
@clear="remoteAndGetList('trafficCode')"
clearable
filterable
remote
:remote-method="(query) => remoteArr(query, 'trafficCode')"
>
<el-option
v-for="item in remoteOptionArr.trafficCode"
:key="item"
:label="item"
:value="item"
></el-option>
</el-select> -->
</el-form-item> </el-form-item>
<el-form-item label="归属车辆段"> <el-form-item label="归属车辆段">
<el-select v-model="searchForm.stationCode" placeholder="请选择归属车辆段" @clear="loadingGetList" filterable clearable> <el-select v-model="searchForm.stationCode" placeholder="请选择归属车辆段" @clear="loadingGetList" filterable clearable>
...@@ -54,30 +38,8 @@ ...@@ -54,30 +38,8 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="车辆状态">
<el-select v-model="searchForm.openType" placeholder="请选择车辆状态" @clear="loadingGetList" filterable clearable>
<el-option value="1" label="是"></el-option>
<el-option value="2" label="否"></el-option>
</el-select>
</el-form-item>
<el-form-item label="子系统编号"> <el-form-item label="子系统编号">
<el-input v-model="searchForm.subsystemCode" placeholder="请输入子系统编号" @clear="loadingGetList" clearable></el-input> <el-input v-model="searchForm.subsystemCode" placeholder="请输入子系统编号" @clear="loadingGetList" clearable></el-input>
<!-- <el-select
v-model="searchForm.subsystemCode"
placeholder="请输入子系统编号"
@clear="remoteAndGetList('subsystemCode')"
clearable
filterable
remote
:remote-method="(query) => remoteArr(query, 'subsystemCode')"
>
<el-option
v-for="item in remoteOptionArr.subsystemCode"
:key="item"
:label="item"
:value="item"
></el-option>
</el-select> -->
</el-form-item> </el-form-item>
<el-form-item label="子系统状态"> <el-form-item label="子系统状态">
<el-select v-model="searchForm.onlineStatus" placeholder="请选择子系统状态" @clear="loadingGetList" filterable clearable> <el-select v-model="searchForm.onlineStatus" placeholder="请选择子系统状态" @clear="loadingGetList" filterable clearable>
...@@ -93,7 +55,6 @@ ...@@ -93,7 +55,6 @@
<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">
<auth-button category="Button"></auth-button> <auth-button category="Button"></auth-button>
<!-- <auth-button label="导出" type="Button" @e-auth-click="exportFile"></auth-button> -->
</el-col> </el-col>
</el-row> </el-row>
<el-table <el-table
...@@ -118,8 +79,10 @@ ...@@ -118,8 +79,10 @@
> >
<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 style="width:80px; font-size: 14px;" v-if="tableData[scope.$index][item.prop] == '1'" type="success" size="medium">在网</el-tag> <el-tag
<el-tag style="width:80px; font-size: 14px;" v-else type="info" size="medium">离网</el-tag> style="width: 80px; font-size: 14px;"
:type="tag.type[scope.row.onlineStatus]"
>{{tag.label[scope.row.onlineStatus]}}</el-tag>
</template> </template>
<template v-else> <template v-else>
{{tableData[scope.$index][item.prop]}} {{tableData[scope.$index][item.prop]}}
...@@ -147,21 +110,15 @@ import { getListApi, reportApi, exportApi } from '@api/systemMonitor' ...@@ -147,21 +110,15 @@ import { getListApi, reportApi, exportApi } from '@api/systemMonitor'
import notice from '@/common/notice' import notice from '@/common/notice'
import { mapActions } from 'vuex' import { mapActions } from 'vuex'
import { cloneDeep } from 'lodash' import { cloneDeep } from 'lodash'
// import { BaseData } from '@/common/constants'
// require('echarts/lib/chart/pie')
// require('echarts/lib/component/tooltip')
// let echarts = require('echarts/lib/echarts')
export default { export default {
name: 'index', name: 'index',
data () { data () {
return { return {
// 远程搜索-返回数组
remoteOptionArr: {
trafficCode: [],
subsystemCode: []
},
subSystemRadio: '全部', subSystemRadio: '全部',
tag: Object.freeze({
type: ['', 'success', 'info'],
label: ['', '在网', '离网']
}),
// 绘图 // 绘图
totalECharts: '', totalECharts: '',
totalOptions: { totalOptions: {
...@@ -213,7 +170,7 @@ export default { ...@@ -213,7 +170,7 @@ export default {
formatter: '{b}: {c}' formatter: '{b}: {c}'
} }
}, },
data: [ { data: [{
name: '故障', name: '故障',
value: 0, value: 0,
itemStyle: { itemStyle: {
...@@ -233,7 +190,6 @@ export default { ...@@ -233,7 +190,6 @@ export default {
searchForm: { searchForm: {
trafficCode: '', trafficCode: '',
stationCode: '', stationCode: '',
openType: '',
subsystemCode: '', subsystemCode: '',
onlineStatus: '' onlineStatus: ''
}, },
...@@ -287,29 +243,6 @@ export default { ...@@ -287,29 +243,6 @@ export default {
this.baseData.station = _.cloneDeep(station) this.baseData.station = _.cloneDeep(station)
this.baseData.subsys = _.cloneDeep(subsys) this.baseData.subsys = _.cloneDeep(subsys)
this.baseData.subsys.unshift({ confCode: '', confValue: '全部' }) this.baseData.subsys.unshift({ confCode: '', confValue: '全部' })
// console.log(this.baseData)
},
// 防抖
debounce (fn, delay = 50) {
let timer = null
return (...args) => {
clearTimeout(timer)
timer = setTimeout(() => {
fn.apply(this.args)
}, delay)
}
},
// 远程搜索
remoteArr (value, attr) {
this.debounce(this.getRemote(attr, value), 50)
},
// 清空远程搜索列表;表格数据刷新
remoteAndGetList (attr) {
this.remoteOptionArr[attr] = []
this.loadingGetList()
}, },
loadingGetList () { loadingGetList () {
...@@ -324,16 +257,7 @@ export default { ...@@ -324,16 +257,7 @@ export default {
...this.searchForm ...this.searchForm
} }
}, },
getRemote (attr, value) {
let params = {}
params[attr] = value
delete params.pageCount
delete params.pageSize
getListApi(params).then(res => {
// console.log(res)
this.remoteOptionArr[attr] = new Set(res.subsystemList.map(item => item[attr]))
})
},
getList () { getList () {
const params = this.getParams() const params = this.getParams()
getListApi(params).then(res => { getListApi(params).then(res => {
...@@ -345,11 +269,10 @@ export default { ...@@ -345,11 +269,10 @@ export default {
this.tableLoading = false this.tableLoading = false
}) })
}, },
getPie (subsystemTypeCode = '') { getPie (label = '') {
const params = { const params = {
subsystemTypeCode: subsystemTypeCode subsystemTypeCode: label ? this.baseData.subsys.find(item => item.confValue === label).confCode : ''
} }
// console.log(params)
reportApi(params).then(res => { reportApi(params).then(res => {
this.drawPie(res) this.drawPie(res)
}).catch(() => { }).catch(() => {
...@@ -359,21 +282,8 @@ export default { ...@@ -359,21 +282,8 @@ 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
this.$open(res.url) this.$open(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(() => { }).catch(() => {
notice.errorTips() notice.errorTips()
}) })
...@@ -384,29 +294,17 @@ export default { ...@@ -384,29 +294,17 @@ export default {
// normalNum 正常数量 // normalNum 正常数量
// breakdownNum 故障数量 // breakdownNum 故障数量
drawPie (params) { drawPie (params) {
this.totalOptions.series[0].data[0].value = params.onlineNum ? params.onlineNum : 0 let item = this.totalOptions.series[0]
this.totalOptions.series[0].data[1].value = params.offlineNum ? params.offlineNum : 0 item.data[0].value = params.onlineNum ? params.onlineNum : 0
item.data[1].value = params.offlineNum ? params.offlineNum : 0
this.totalOptions.series[1].data[0].value = params.breakdownNum ? params.breakdownNum : 0
this.totalOptions.series[1].data[1].value = params.normalNum ? params.normalNum : 0 item = this.totalOptions.series[1]
item.data[0].value = params.breakdownNum ? params.breakdownNum : 0
item.data[1].value = params.normalNum ? params.normalNum : 0
this.totalECharts.setOption(this.totalOptions) this.totalECharts.setOption(this.totalOptions)
}, },
radioChange (label) {
// console.log(label)
// 请求后端数据--参数
var value = ''
for (var i in this.baseData.subsys) {
if (this.baseData.subsys[i].confValue === label) {
value = this.baseData.subsys[i].confCode
break
}
}
// 调接口
this.getPie(value)
},
// 搜索 // 搜索
handleSearch () { handleSearch () {
// 调接口 // 调接口
......
...@@ -19,10 +19,11 @@ ...@@ -19,10 +19,11 @@
:disabled="disabled" :disabled="disabled"
v-model="editForm.trafficCode" v-model="editForm.trafficCode"
placeholder="请输入车辆编号" placeholder="请输入车辆编号"
clearable
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="归属车辆段" prop="stationCode"> <el-form-item label="归属车辆段" prop="stationCode">
<el-select v-model="editForm.stationCode" placeholder="请选择归属车辆段" clearable filterable> <el-select v-model="editForm.stationCode" placeholder="请选择归属车辆段" 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"
...@@ -98,8 +99,10 @@ export default { ...@@ -98,8 +99,10 @@ export default {
methods: { methods: {
async isCodeExist (rule, value, callback) { async isCodeExist (rule, value, callback) {
const res = await isExistApi({ trafficCode: value }) if(!this.editForm.id) {
res.trafficCode ? callback(new Error(rule.message)) : callback() const res = await isExistApi({ trafficCode: value })
res.trafficCode ? callback(new Error(rule.message)) : callback()
}
}, },
handleClose () { handleClose () {
......
...@@ -9,22 +9,6 @@ ...@@ -9,22 +9,6 @@
> >
<el-form-item label="车辆编号"> <el-form-item label="车辆编号">
<el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" @clear="loadingGetList" clearable></el-input> <el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" @clear="loadingGetList" clearable></el-input>
<!-- <el-select
v-model="searchForm.trafficCode"
placeholder="请输入车辆编号"
@clear="remoteAndGetList('trafficCode')"
clearable
filterable
remote
:remote-method="(query) => remoteArr(query, 'trafficCode')"
>
<el-option
v-for="item in remoteOptionArr.trafficCode"
:key="item.trafficCode"
:label="item.trafficCode"
:value="item.trafficCode"
></el-option>
</el-select> -->
</el-form-item> </el-form-item>
<el-form-item label="归属车辆段"> <el-form-item label="归属车辆段">
<el-select v-model="searchForm.stationCode" placeholder="请选择归属车辆段" @clear="loadingGetList" clearable filterable> <el-select v-model="searchForm.stationCode" placeholder="请选择归属车辆段" @clear="loadingGetList" clearable filterable>
...@@ -37,22 +21,6 @@ ...@@ -37,22 +21,6 @@
</el-form-item> </el-form-item>
<el-form-item label="维修承包商"> <el-form-item label="维修承包商">
<el-input v-model="searchForm.merchantName" placeholder="请输入维修承包商" @clear="loadingGetList" clearable></el-input> <el-input v-model="searchForm.merchantName" placeholder="请输入维修承包商" @clear="loadingGetList" clearable></el-input>
<!-- <el-select
v-model="searchForm.merchantName"
placeholder="请输入维修承包商"
@clear="remoteAndGetList('merchantName')"
clearable
filterable
remote
:remote-method="(query) => remoteArr(query, 'merchantName')"
>
<el-option
v-for="item in remoteOptionArr.merchantName"
:key="item.merchantName"
:label="item.merchantName"
:value="item.merchantName"
></el-option>
</el-select> -->
</el-form-item> </el-form-item>
<el-form-item label="状态"> <el-form-item label="状态">
<el-select v-model="searchForm.openType" placeholder="请选择状态" @clear="loadingGetList" clearable filterable> <el-select v-model="searchForm.openType" placeholder="请选择状态" @clear="loadingGetList" clearable filterable>
...@@ -142,11 +110,9 @@ ...@@ -142,11 +110,9 @@
<script> <script>
import EditDialog from './editDialog' import EditDialog from './editDialog'
import { BaseData } from '@/common/constants' import { BaseData } from '@/common/constants'
// import { mapActions } from 'vuex'
import { getListApi, methods, editApi, removeApi } from '@api/trafficManagement' import { getListApi, methods, editApi, removeApi } from '@api/trafficManagement'
import notice from '@/common/notice' import notice from '@/common/notice'
import { clearTimeout, setTimeout } from 'timers' import { clearTimeout, setTimeout } from 'timers'
// import { debounce } from 'lodash';
export default { export default {
name: 'fimsTrafficManagement', name: 'fimsTrafficManagement',
components: { components: {
...@@ -154,14 +120,10 @@ export default { ...@@ -154,14 +120,10 @@ export default {
}, },
data () { data () {
return { return {
// 远程搜索-返回数组
remoteOptionArr: {
trafficCode: [],
merchantName: []
},
// 新增/编辑弹窗 // 新增/编辑弹窗
editVisible: false, editVisible: false,
editFormReset: { editFormReset: {
id: '',
trafficCode: '', trafficCode: '',
stationCode: '', stationCode: '',
stationName: '', stationName: '',
...@@ -169,6 +131,7 @@ export default { ...@@ -169,6 +131,7 @@ export default {
openType: '' openType: ''
}, },
editForm: { editForm: {
id: '',
trafficCode: '', trafficCode: '',
stationCode: '', stationCode: '',
stationName: '', stationName: '',
...@@ -227,28 +190,6 @@ export default { ...@@ -227,28 +190,6 @@ export default {
this.baseData.station = data this.baseData.station = data
}, },
// 防抖
debounce (fn, delay = 50) {
let timer = null
return (...args) => {
clearTimeout(timer)
timer = setTimeout(() => {
fn.apply(this.args)
}, delay)
}
},
// 远程搜索
remoteArr (value, attr) {
this.debounce(this.getRemote(attr, value), 50)
},
// 清空远程搜索列表;表格数据刷新
remoteAndGetList (attr) {
this.remoteOptionArr[attr] = []
this.loadingGetList()
},
loadingGetList () { loadingGetList () {
this.tableLoading = true this.tableLoading = true
this.getList() this.getList()
...@@ -261,15 +202,7 @@ export default { ...@@ -261,15 +202,7 @@ export default {
...this.searchForm ...this.searchForm
} }
}, },
getRemote (attr, value) {
let params = {}
params[attr] = value
delete params.pageCount
delete params.pageSize
getListApi(params).then(res => {
this.remoteOptionArr[attr] = new Set(res.trafficList.map(item => item[attr]))
})
},
getList () { getList () {
const params = this.getParams() const params = this.getParams()
getListApi(params).then(res => { getListApi(params).then(res => {
...@@ -283,25 +216,12 @@ export default { ...@@ -283,25 +216,12 @@ export default {
}, },
editTraffic (value) { editTraffic (value) {
// console.log(value) // console.log(value)
const params = { const params = _.cloneDeep(this.editFormReset)
id: '', Object.keys(params).map(key => params[key] = value[key])
trafficCode: '', params.stationName = this.baseData.station.find(item => item.confCode === params.stationCode).confValue
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 !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()
...@@ -333,20 +253,18 @@ export default { ...@@ -333,20 +253,18 @@ export default {
handleEditClose () { handleEditClose () {
this.editVisible = !this.editVisible this.editVisible = !this.editVisible
delete this.editForm.id // delete this.editForm.id
}, },
handleEditConfirm () { handleEditConfirm () {
// console.log(JSON.parse(JSON.stringify(this.editForm))) var editParams = _.cloneDeep(this.editForm)
var editParams = JSON.parse(JSON.stringify(this.editForm))
this.editTraffic(editParams) this.editTraffic(editParams)
}, },
// 表格-编辑 // 表格-编辑
handleEdit (row) { handleEdit (row) {
// console.log(index)
// console.log(row) // console.log(row)
this.editForm = JSON.parse(JSON.stringify(row)) this.editForm = _.cloneDeep(row)
this.editVisible = !this.editVisible this.editVisible = !this.editVisible
}, },
...@@ -356,12 +274,6 @@ export default { ...@@ -356,12 +274,6 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// console.log(index)
// console.log(row)
// this.$message({
// type: 'success',
// message: '删除成功'
// })
removeApi({ removeApi({
id: row.id, id: row.id,
usedStatus: 2 usedStatus: 2
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!