无人机管理后台前端(已迁走)
chenyao
2025-09-11 206a737eaec3d920f3bce764fdff0fc8652e9b0a
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<!-- 运营收益 -->
<template>
  <div class="operatingIncome">
    <div class="search-box">
      <el-form :model="params" inline>
        <el-form-item label="空域名称:">
          <el-input v-model="params.algName" placeholder="请输入空域名称" clearable />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="getList">搜索</el-button>
          <el-button @click="cancelSearch">取消</el-button>
        </el-form-item>
      </el-form>
      <div>
        <el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
      </div>
    </div>
    <div class="mange-table">
            <el-table border :data="tableList" class="custom-header">
                <el-table-column label="序号" type="index" width="60"></el-table-column>
        <el-table-column prop="model_name" label="营业收入" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column prop="alg_type" label="综合总成本费用" align="center"></el-table-column>
        <el-table-column prop="alg_type" label="净利润" align="center"></el-table-column>
        <el-table-column prop="alg_type" label="财务内部收益率" align="center"></el-table-column>
        <el-table-column prop="alg_type" label="市场空间" align="center"></el-table-column>
                <el-table-column label="操作" width="180" align="center">
                    <template #default="scope">
            <el-button icon="el-icon-view" type="text" @click="handleDetail(scope.row)">查看</el-button>
                        <el-button icon="el-icon-edit" type="text" @click="handleDelete">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </div>
        <div class="pagination">
            <el-pagination class="ztzf-pagination" popper-class="custom-pagination-dropdown" background
                :page-sizes="[10, 20, 30, 40, 50, 100]" :size="size" v-model:current-page="params.current"
                v-model:page-size="params.size" layout="total, sizes, prev, pager, next, jumper" :total="total"
                @size-change="handleSizeChange" @current-change="handleCurrentChange" />
        </div>
  </div>
  <el-dialog class="ztzf-dialog" append-to-body v-model="isShowView" title="查看"
        :width="pxToRem(600)" :close-on-click-modal="false" :destroy-on-close="true">
        <div class="content">
      <table class="view-table" border>
        <tr>
          <td class="label">空域类型</td>
          <td class="value">{{ rowView.model_name }}</td>
          <td class="label">创建时间</td>
          <td class="value">{{ rowView.alg_type }}</td>
        </tr>
      </table>
    </div>
    </el-dialog>
  <el-dialog class="ztzf-dialog" append-to-body v-model="isShowEditView" title="新增"
        :width="pxToRem(800)" :close-on-click-modal="false" :destroy-on-close="true">
        <div class="content-edit">
      <el-form ref="ruleFormRef" :model="editParams" :rules="rules" inline>
        <el-form-item label="空域名称">
          <el-input v-model="editParams.model_name" />
        </el-form-item>
        <el-form-item label="空域名称">
          <el-input v-model="editParams.model_name" />
        </el-form-item>
        <el-form-item label="空域名称">
          <el-input v-model="editParams.model_name" />
        </el-form-item>
        <el-form-item label="空域名称">
          <el-input v-model="editParams.model_name" />
        </el-form-item>
        <el-form-item label="空域名称">
          <el-input v-model="editParams.model_name" />
        </el-form-item>
        <el-form-item label="空域名称">
          <el-input v-model="editParams.model_name" />
        </el-form-item>
        <div class="btns">
          <el-button type="primary" @click="submit(ruleFormRef)">确认</el-button>
          <el-button @click="isShowEditView = false">取消</el-button>
        </div>
      </el-form>
    </div>
    </el-dialog>
</template>
<script setup>
import { getAlgorithmManageList, algorithmManageEdit } from '@/api/operatingIncome/operatingIncome';
import { getDictionaryByCode } from '@/api/system/dictbiz';
 
const total = ref(0)
const params = ref({
  current: 1,
  size: 10,
  algName: '',
  algTypeCode: '',
});
 
let tableList = ref([])
 
let isShowView = ref(false)
 
let rowView = ref({})
 
let isShowEditView = ref(false)
 
let sfTypes = ref([])
const ruleFormRef = ref()
let editParams = ref({
  model_name: '',
  alg_type: '',
  qua_rate: '',
  pass_rate: '',
  event_type: '',
  remark: ''
})
const rules = reactive({
  qua_rate: [
    { required: true, message: '请输入最低准确率', trigger: 'blur' },
    {
      validator: (rule, value, callback) => {
        if (!/^\d+(\.\d+)?$/.test(value)) {
          callback(new Error('请输入有效的数字(整数或小数)'));
        } else if (parseFloat(value) < 0.4) {
          callback(new Error('最低准确率不能小于0.4'));
        } else if (parseFloat(value) >= parseFloat(editParams.value.pass_rate)) {
          callback(new Error('最低准确率必须小于最高准确率'));
        } else {
          callback();
        }
      },
      trigger: 'blur'
    }
  ],
  pass_rate: [
    { required: true, message: '请输入最低准确率', trigger: 'blur' },
    {
      validator: (rule, value, callback) => {
        if (!/^\d+(\.\d+)?$/.test(value)) {
          callback(new Error('请输入有效的数字(整数或小数)'));
        } else if (parseFloat(value) > 0.8) {
          callback(new Error('最高准确率不能大于0.8'));
        } else {
          callback();
        }
      },
      trigger: 'blur'
    }
  ],
  event_type: [
    {
      required: true,
      message: '请选择事件生成类型',
      trigger: 'change',
    },
  ],
})
 
function cancelSearch() {
  params.value = {
    algName: '',
    algTypeCode: '',
  }
  getList()
}
 
function getList() {
  getAlgorithmManageList(params.value).then(res => {
    tableList.value = res.data.data.records || []
    total.value = res.data.data.total || 0
  })
}
function getSFType() {
  getDictionaryByCode('WORK_ORDER_TYPE').then(res => {
    sfTypes.value = res.data.data.WORK_ORDER_TYPE || []
  });
}
function handleDetail(row) {
  isShowView.value = true
  rowView.value = row
}
function handleDelete(row) {
  console.log(row)
}
function handleAdd(row) {
  isShowEditView.value = true
  // editParams.value = { ...row }
}
 
async function submit(formValidate) {
  if (!formValidate) return
  await formValidate.validate((valid, fields) => {
    if (valid) {
      algorithmManageEdit(editParams.value).then(res => {
        isShowEditView.value = false
        getList()
      })
    } 
  })
}
 
onMounted(() => {
  getList()
  getSFType()
})
</script>
 
<style lang="scss" scoped>
  .operatingIncome {
    height: 0;
    flex: 1;
    margin: 0 10px 10px 10px;
    background-color: #ffffff;
    padding: 10px 20px;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    .search-box {
      height: 80px;
    }
 
    :deep(.el-input) {
      .el-input__wrapper {
        width: 200px;
      }
    }
 
    // 表格
    .mange-table {
      height: 0;
      flex: 1;
      margin-top: 18px;
      overflow: auto;
    }
    :deep(.el-pagination) {
      display: flex;
      justify-content: right;
    }
 
    :deep(.el-pagination button) {
      background: center center no-repeat none !important;
      color: #8eb8ea !important;
    }
    :deep(.ztzf-select){
      .el-select__selection {
        width: 200px;
      }
    }
  }
  
 .content {
  padding: 20px;
  
  .view-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #EBEEF5;
    
    tr {
      &:not(:last-child) {
        border-bottom: 1px solid #EBEEF5;
      }
      
      td {
        padding: 12px 10px;
        
        &.label {
          width: 140px;
          text-align: right;
          // color: #909399;
          // background-color: #F5F7FA;
          border-right: 1px solid #EBEEF5;
        }
        
        &.value {
          width: 180px;
          // color: #303133;
        }
      }
    }
  }
}
.content-edit {
  .el-form {
    .el-form-item {
      width: 300px;
      :deep(.el-form-item__label) {
        width: 120px;
      }
      
    }
    .btns {
        display: flex;
        justify-content: center
      }
  }
}
</style>