This commit is contained in:
joylink_cuiweidong 2022-07-19 16:53:54 +08:00
commit 45e6c90be9

View File

@ -150,7 +150,87 @@
</el-tab-pane>
<el-tab-pane label="查询" name="search">
<div class="search-box">
<div>查询</div>
<div class="box-title">
<div class="contant-null" />
<div class="contant-text">查询条件</div>
<div class="contant-icon" @click="active5=!active5">
<i v-if="active1" class="el-icon-arrow-down" />
<i v-else class="el-icon-arrow-up" />
</div>
</div>
<div v-show="active5" class="search-condition">
<div class="condition-top">
<el-radio v-model="searchObj.timeType" label="1">时间范围</el-radio>
<el-radio v-model="searchObj.timeType" label="2">精确匹配发令时间</el-radio>
</div>
<div class="condition-border" style="padding: 5px 10px">
<div v-if="searchObj.timeType==1">
<div class="condition-row">
<span style="margin-right: 5px"></span>
<el-date-picker v-model="searchObj.startTime" style="flex: 1" type="datetime" placeholder="选择日期时间" value-format="yyyy-MM-dd HH:mm:ss" />
</div>
<div class="condition-row">
<span style="margin-right: 5px"></span>
<el-date-picker v-model="searchObj.endTime" style="flex: 1" type="datetime" placeholder="选择日期时间" value-format="yyyy-MM-dd HH:mm:ss" />
</div>
</div>
<div v-else class="condition-row">
<span style="margin-right: 5px">发令时间</span>
<el-date-picker v-model="searchObj.sendTime" style="flex: 1" type="datetime" placeholder="选择日期时间" value-format="yyyy-MM-dd HH:mm:ss" />
</div>
</div>
<div class="condition-row">
<el-checkbox v-model="searchObj.hasNumber">命令号</el-checkbox>
<el-input v-model="searchObj.number" />
</div>
<div class="condition-border">
<div class="condition-row">
<el-checkbox v-model="searchObj.hasCompanyOfSender">发令单位</el-checkbox>
<el-input v-model="searchObj.companyOfSender" />
</div>
<div class="condition-row">
<el-checkbox v-model="searchObj.hasCompanyOfReceiver">受令单位</el-checkbox>
<el-input v-model="searchObj.companyOfReceiver" />
</div>
<div>
<el-checkbox v-model="searchObj.hasTitleKey">命令标题或者内容 关键字</el-checkbox>
<el-input v-model="searchObj.titleKey" />
</div>
<div>
<el-select v-model="searchObj.allSigned" placeholder="请选择">
<el-option
v-for="item in searchSignedOption"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
</div>
<div class="condition-btn">
<el-button type="primary" @click="search">查询</el-button>
<el-button type="primary" style="width: 100px" @click="clearCondition">清除</el-button>
</div>
</div>
<el-table ref="table5" class="search-table" :data="searchTable" border style="width: 100%" height="100%" highlight-current-row @current-change="handleCurrentChange($event, 'table5')">
<el-table-column prop="number" label="命令号" width="80" />
<el-table-column prop="transferNumber" label="识别号" width="80" />
<el-table-column prop="title" label="命令标题" show-overflow-tooltip />
<el-table-column prop="sendTime" label="接收单位" show-overflow-tooltip width="160">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ JoinDeviceNameStr(scope.row.receiverInfos) || '' }}</span>
</template>
</el-table-column>
<el-table-column prop="sendTime" label="发令时间" width="160" />
<el-table-column prop="senderName" label="发令人" />
<el-table-column prop="companyOfSender" label="发令单位" />
<el-table-column label="命令类型" width="100">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ typeObj[scope.row.type] || '' }}</span>
</template>
</el-table-column>
<el-table-column prop="content" label="命令正文" show-overflow-tooltip />
</el-table>
</div>
</el-tab-pane>
</el-tabs>
@ -337,8 +417,8 @@ export default {
author: '',
receiverIds: [],
type: 'NORMAL',
content: '',
allSigned: ''
content: ''
// allSigned: ''
},
rules: {
title: [
@ -356,10 +436,33 @@ export default {
active2: true,
active3: true,
active4: true,
active5: true,
timeTypeRadio: '1',
numTime: 24,
seachData: [],
cacheTableData: [],
currentInfo: {}
currentInfo: {},
searchObj: {
timeType: '1',
startTime: '',
endTime: '',
sendTime: '',
hasNumber: false,
number: '',
hasCompanyOfSender: false,
companyOfSender: '',
hasCompanyOfReceiver: false,
companyOfReceiver: '',
hasTitleKey: false,
titleKey: '',
allSigned: ''
},
searchTable: [],
searchSignedOption: [
{ value: '', label: '全部'},
{ value: true, label: '只显示签收完成的'},
{ value: false, label: '只显示未签收完成的'}
]
};
},
computed: {
@ -462,8 +565,67 @@ export default {
beforeDestroy() {},
mounted() {},
methods:{
search() {
this.searchTable = [];
this.searchCmd().then(res => {
this.getSearchTable();
});
},
getSearchTable() {
const list = this.seachData.filter(item => {
return this.conditionFilter(item);
});
this.searchTable = list;
},
conditionFilter(item) {
let status = true;
if (this.searchObj.timeType == '1') {
if (this.searchObj.startTime && new Date(this.searchObj.startTime).getTime() > new Date(item.sendTime).getTime()) {
status = false;
}
if (this.searchObj.endTime && new Date(this.searchObj.endTime).getTime() < new Date(item.sendTime).getTime()) {
status = false;
}
}
if (this.searchObj.timeType == '2' && this.searchObj.sendTime) {
if (this.searchObj.sendTime != item.sendTime) {
status = false;
}
}
if (this.searchObj.hasNumber && this.searchObj.number) {
if (this.searchObj.number != item.number) {
status = false;
}
}
if (this.searchObj.hasCompanyOfSender && this.searchObj.companyOfSender) {
if (this.searchObj.companyOfSender != item.companyOfSender) {
status = false;
}
}
if (this.searchObj.hasCompanyOfReceiver && this.searchObj.companyOfReceiver) {
const findObj = Object.keys(item.receiverInfos).find(ii => {
const device = this.$store.getters['map/getDeviceByCode'](ii);
const name = device ? device.name : '';
return name == this.searchObj.companyOfReceiver;
});
if (!findObj) {
status = false;
}
}
if (this.searchObj.hasTitleKey && this.searchObj.titleKey) {
if (!item.title.includes(this.searchObj.titleKey) && !item.content.includes(this.searchObj.titleKey)) {
status = false;
}
}
if (this.searchObj.allSigned != '') {
if (this.searchObj.allSigned != item.allSigned) {
status = false;
}
}
return status;
},
setCurrentRow(obj, refName) {
const tableArr = ['table1', 'table2', 'table3', 'table4'];
const tableArr = ['table1', 'table2', 'table3', 'table4', 'table5'];
tableArr.forEach(key => {
if (key != refName) {
this.$refs[key] && this.$refs[key].setCurrentRow();
@ -475,7 +637,10 @@ export default {
handleCurrentChange(obj, refName) {
if (!obj) { return; }
this.currentInfo = obj;
this.command = {...obj};
// this.command = {...obj};
Object.keys(this.command).forEach(key => {
this.command[key] = obj[key] || '';
});
this.setCurrentRow(obj, refName);
const infoList = Object.keys(this.currentInfo.receiverInfos || {});
if (infoList.length) {
@ -525,6 +690,24 @@ export default {
console.log('刷新');
this.searchCmd();
},
clearCondition() {
this.searchTable = [];
this.searchObj = {
timeType: '1',
startTime: '',
endTime: '',
sendTime: '',
hasNumber: false,
number: '',
hasCompanyOfSender: false,
companyOfSender: '',
hasCompanyOfReceiver: false,
companyOfReceiver: '',
hasTitleKey: false,
titleKey: '',
allSigned: ''
};
},
createCmd() {
this.$confirm('当前调度命令已经被编辑修改过了,你要放弃所有的修改吗?', '操作提示', {
confirmButtonText: '是',
@ -551,8 +734,8 @@ export default {
author: '',
receiverIds: [],
type: 'NORMAL',
content: '',
allSigned: ''
content: ''
// allSigned: ''
};
this.currentInfo = {};
this.$refs.table && this.$refs.table.clearSelection();
@ -639,11 +822,15 @@ export default {
});
},
searchCmd() {
sendCommandNew(this.group, 'CTC_QUERY_DISPATCH_COMMAND').then((res) => {
console.log(res, '---res----');
this.seachData = res.data;
}).catch(error => {
this.$messageBox('查询调度命令失败:' + error.message);
return new Promise((resolve, reject) => {
sendCommandNew(this.group, 'CTC_QUERY_DISPATCH_COMMAND').then((res) => {
console.log(res, '---res----');
this.seachData = res.data;
resolve();
}).catch(error => {
this.$messageBox('查询调度命令失败:' + error.message);
reject(error.message);
});
});
}
}
@ -687,12 +874,49 @@ export default {
color: blue;
}
}
.search-box {
height: 720px;
display: flex;
flex-direction: column;
justify-content: center;
.search-condition {
padding: 5px;
.condition-top {
padding: 5px;
}
.condition-btn {
padding: 10px;
text-align: center;
}
}
.search-table {
flex: 1;
}
.condition-border {
margin: 10px 0;
padding: 5px;
border: 1px solid #92ACD7;
div {
margin: 5px 0;
}
}
.condition-row {
display: flex;
justify-content: space-between;
align-items: center;
height: 32px;
line-height: 32px;
}
.el-checkbox {
margin-right: 5px;
}
}
}
/deep/ .el-tabs__item {
height: 30px !important;
line-height: 30px !important;
}
.middle {
.middle, .left {
/deep/ .el-form-item {
margin-bottom: 0px;
.el-form-item__error {
@ -720,4 +944,7 @@ export default {
.dispatcher-cmd .el-dialog {
margin-top: 8vh !important;
}
.dispatcher-cmd .el-tabs--border-card>.el-tabs__content {
padding: 5px !important;
}
</style>