田源
2025-01-09 d7e3c8a813f8f85c89c06782f1e36e8089ffc31b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<template>
  <div style="display: flex">
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <!--      集成日志 任务 数据全部公用-->
      <el-form-item label="集成查询:" size="small">
        <el-select v-model="formInline.type" placeholder="请选择分类" @change="SelectChange">
          <el-option v-for="(item,index) in SearchObject.searchData" :key="item.value" :label="item.label"
                     :value="item.value"></el-option>
        </el-select>
      </el-form-item>
      <!--      集成日志 是否成功-->
      <el-form-item v-if="(status.type == 'loge' && status.stateFlag)" size="small">
        <el-select v-model="formInline.state" placeholder="请选择状态">
          <el-option label="是" value="true"></el-option>
          <el-option label="否" value="false"></el-option>
        </el-select>
      </el-form-item>
      <!--      集成日志类型-->
      <el-form-item v-if="(status.type == 'loge' && status.typeFlag)" size="small">
        <el-select v-model="formInline.cut" placeholder="请选择类型">
          <el-option label="数据推送" value="pushData"></el-option>
          <el-option label="分类推送" value="pushClassifyData"></el-option>
          <el-option label="编码申请" value="applyCode"></el-option>
          <el-option label="编码维护" value="syncEditData"></el-option>
          <el-option label="分类查询" value="queryClassify"></el-option>
          <el-option label="含编码规则的分类查询" value="queryClassifyRule"></el-option>
          <el-option label="数据查询" value="queryData"></el-option>
          <el-option label="标准申请" value="applyCodeForBZ"></el-option>
          <el-option label="部门申请" value="syncDataForOrg"></el-option>
          <el-option label="人员申请" value="syncDataForPerson"></el-option>
        </el-select>
      </el-form-item>
      <!--      集成任务 是否推送成功
      集成数据  是否分解任务-->
      <el-form-item v-if="((status.type == 'task' || status.type == 'data')&& status.stateTaskDataFlag)" size="small">
        <el-select v-model="formInline.stateTask" placeholder="请选择状态">
          <el-option label="是" value="true"></el-option>
          <el-option label="否" value="false"></el-option>
        </el-select>
      </el-form-item>
      <!--      集成任务 集成数据 推送类型-->
      <el-form-item v-if="((status.type === 'task' || status.type === 'data') && status.sendTypeFlga)" size="small">
        <el-select v-model="formInline.taskCut" placeholder="请选择推送类型">
          <el-option label="发布" value="Enabled"></el-option>
          <el-option label="回收" value="TakeBack"></el-option>
          <el-option label="停用" value="Disabled"></el-option>
        </el-select>
      </el-form-item>
      <!--      集成任务 创建日期  集成日志 记录时间-->
      <el-form-item v-if="((status.type == 'loge' ||status.type == 'task') && status.dateFlag)" size="small">
        <el-date-picker
          v-model="formInline.Date"
          placeholder="选择日期时间"
          type="date">
        </el-date-picker>
      </el-form-item>
      <!--      集成任务 最后推送时间-->
      <el-form-item v-if="status.type == 'task' && status.lastDateFlag" size="small">
        <el-date-picker
          v-model="formInline.lastDate"
          placeholder="选择日期时间"
          type="date">
        </el-date-picker>
      </el-form-item>
      <!--      公用模块-->
      <!--      输入内容-->
      <el-form-item v-if="shouldShowInput" size="small">
        <el-input v-model="formInline.text" placeholder="按下回车键进行查询!" @keyup.enter.native="SaveHandler"></el-input>
      </el-form-item>
      <!--      查询按钮-->
      <el-form-item v-if="shouldShowButton" size="small">
        <el-button size="small" type="success" @click="handleSearch">查询</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
 
<script>
import {getLogoList} from "@/api/docking/loge";
import {getDataList} from "@/api/docking/data";
import {getTaskList} from "@/api/docking/task";
 
export default {
  name: "VciDockingSearch",
  props: ['SearchObject', 'page', 'formInline', 'status'],
  data() {
    return {}
  },
  computed: {
    //输入框判断
    shouldShowInput() {
      const isLogeType = this.status.type === 'loge';
      const isTaskType = this.status.type === 'task';
      const isDataType = this.status.type === 'data';
      return (
        (isLogeType && !this.status.stateFlag && !this.status.dateFlag && !this.status.typeFlag) ||
        (isTaskType && !this.status.stateTaskDataFlag && !this.status.dateFlag && !this.status.lastDateFlag && !this.status.sendTypeFlga) ||
        (isDataType && !this.status.stateTaskDataFlag && !this.status.sendTypeFlga)
      );
    },
    //按钮判断
    shouldShowButton() {
      const isLogeType = this.status.type === 'loge';
      const isTaskType = this.status.type === 'task';
      const isDataType = this.status.type === 'data';
      return (
        (isLogeType && (this.status.dateFlag || this.status.stateFlag || this.status.typeFlag)) ||
        (isTaskType && (this.status.stateTaskDataFlag || this.status.dateFlag || this.status.lastDateFlag || this.status.sendTypeFlga)) ||
        (isDataType && (this.status.stateTaskDataFlag || this.status.sendTypeFlga))
      );
    }
  },
  methods: {
    SelectChange(val) {
      const logeType = this.status.type === 'loge';
      const taskType = this.status.type === 'task';
      const dataType = this.status.type === 'data';
      this.status.typeFlag = logeType && val === 5;
      this.status.dateFlag = (logeType && val === 6) || (taskType && val === 6);
      this.status.stateFlag = logeType && val === 7;
      this.status.lastDateFlag = taskType && val === 7;
      this.status.stateTaskDataFlag = (taskType && val === 8) || (dataType && val === 4);
      this.status.sendTypeFlga = (taskType && val === 5) || (dataType && val === 3);
    },
    SaveHandler() {
      let searchDataItem = Object.values(this.SearchObject.searchData).find(item => item.value === this.formInline.type);
      let name = searchDataItem ? searchDataItem.prop : null;
      if (!searchDataItem) {
        this.$message.error('未找到对应搜索类型请查看控制台输出!')
      }
      const requestApi = (api) => {
        api(this.page.currentPage, this.page.pageSize, 'createTime', 'desc', {[`conditionMap[${name}_like]`]: this.formInline.text})
          .then(res => {
            if (!res.data.data.records) {
              this.$message.error('暂未查到数据!');
            } else {
              let Data = res.data.data;
              this.$emit('getList', Data);
            }
          });
      }
 
      //日志
      if (this.status.type == 'loge') {
        requestApi(getLogoList);
      }
      //数据
      if (this.status.type == 'data') {
        requestApi(getDataList);
      }
      //任务
      if (this.status.type == 'task') {
        requestApi(getTaskList);
      }
    },
    handleSearch() {
      const {type, typeFlag, stateFlag, stateTaskDataFlag, dateFlag, lastDateFlag, sendTypeFlga} = this.status;
      const {currentPage, pageSize} = this.page;
      const {cut, state, stateTask, Date, lastDate, taskCut} = this.formInline;
      const requestParams = {};
      const requestApi = (api) => {
        api(currentPage, pageSize, 'createTime', 'desc', requestParams).then(res => {
          if (!res.data.data.records) {
            this.$message.error('暂未查到数据!');
          } else {
            let Data = res.data.data;
            this.$emit('getList', Data);
          }
        });
      }
      // 集成日志类型
      if (type === 'loge' && typeFlag) {
        requestParams['conditionMap[type_like]'] = cut;
      }
      // 集成日志是否成功
      if (type === 'loge' && stateFlag) {
        requestParams['conditionMap[interfaceStatus_like]'] = state;
      }
      // 集成任务 是否推送成功  集成数据  是否分解任务
      if ((type === 'task' || type === 'data') && stateTaskDataFlag) {
        requestParams['conditionMap[sendFlag_like]'] = stateTask;
      }
      // 集成任务 创建日期 和 集成日志 记录时间
      if ((type === 'loge' || type === 'task') && dateFlag) {
        const formattedDate = this.$moment(Date).format('YYYY-M-D');
        requestParams['conditionMap[createTime_like]'] = formattedDate;
      }
      // 集成任务 最后推送时间
      if (type === 'task' && lastDateFlag) {
        const formattedDate = this.$moment(lastDate).format('YYYY-M-D');
        requestParams['conditionMap[lastModifyTime_like]'] = formattedDate;
      }
      // 集成任务 集成数据 推送类型
      if ((type === 'task' || type === 'data') && sendTypeFlga) {
        requestParams['conditionMap[sendType_like]'] = taskCut;
      }
 
      if (type == 'loge') {
        requestApi(getLogoList);
      }
      if (type == 'data') {
        requestApi(getDataList);
      }
      if (type == 'task') {
        requestApi(getTaskList);
      }
    }
  }
}
</script>
 
<style lang="scss" scoped>
</style>