123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345 |
- <template>
- <div class="app-container algorithm">
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
- <el-form-item label="开始时间" prop="inTime">
- <el-date-picker clearable size="small"
- v-model="queryParams.inTime"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="请选择开始时间">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="结束时间" prop="outTime">
- <el-date-picker clearable size="small"
- v-model="queryParams.outTime"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="请选择结束时间">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="处理状态" prop="inOutType">
- <el-select v-model="queryParams.status" placeholder="选择时间类型">
- <el-option
- v-for="item in dealStatus"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="是否报警" prop="inOutType">
- <el-select v-model="queryParams.isAlarm" placeholder="请选择是否报警">
- <el-option
- v-for="item in alarmList"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-form-item >
- <el-form-item>
- <p class="inquire-button-one" @click="handleQuery">查询</p>
- <p class="reset-button-one" @click="resetQuery">重置</p>
- </el-form-item>
- </el-form>
- <el-table v-loading="loading" :data="algorithmList" @selection-change="handleSelectionChange">
- <el-table-column label="类型" align="center" prop="algorithmType" >
- <template scope="scope">
- <p v-if="scope.row.algorithmType=='image'">图片类型</p>
- <p v-if="scope.row.algorithmType=='video'">视频类型</p>
- </template>
- </el-table-column>
- <el-table-column label="算法名称" align="center" prop="algorithmName" />
- <el-table-column label="原始图" width="150">
- <template scope="scope">
- <img :src="scope.row.originalImg" width="120" style="cursor:pointer;" height="80" class="img" @click="imgBigBox(scope.row,'original')"/>
- </template>
- </el-table-column>
- <el-table-column label="请求时间" align="center" prop="createTime" />
- <el-table-column label="识别结果" width="150">
- <template scope="scope">
- <img :src="scope.row.algorithmResult" width="120" style="cursor:pointer;" height="80" class="img" @click="imgBigBox(scope.row,'result')"/>
- </template>
- </el-table-column>
- <el-table-column label="响应时间" align="center" prop="outTime" />
- <el-table-column label="是否报警" align="center" prop="isAlarm">
- <template scope="scope">
- <p v-if="scope.row.isAlarm=='0'">否</p>
- <p v-if="scope.row.isAlarm=='1'">是</p>
- </template>
- </el-table-column>
- <el-table-column label="状态" align="center" prop="status" >
- <template scope="scope">
- <p v-if="scope.row.status=='0'">未处理</p>
- <p v-if="scope.row.status=='1'">已处理</p>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
- <template slot-scope="scope">
- <div class="button-box">
- <p class="table-min-button"
- style="margin-right:10px;"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['laboratory:algorithm:edit']"
- ><i class="el-icon-edit-outline"></i>修改</p>
- <p class="table-min-button"
- @click="handleDelete(scope.row)"
- v-hasPermi="['laboratory:algorithm:remove']"
- ><i class="el-icon-edit-outline"></i>删除</p>
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination :page-sizes="[20, 30, 40, 50]"
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- <!-- 添加或修改算法回调结果对话框 -->
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
- <el-form-item label="算法类型" prop="algorithmType">
- <el-input v-model="form.algorithmType" placeholder="请输入解析结果" />
- </el-form-item>
- <el-form-item label="算法名称" prop="algorithmName">
- <el-input v-model="form.algorithmName" placeholder="算法名称" />
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- <el-dialog :title="imgTitle" :visible.sync="imgOpen" width="800px" append-to-body>
- <div class="scrollbar-box" style="width:760px;max-height:700px;overflow-y: scroll;">
- <img :src="imgUrl" style="width:760px;">
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { listAlgorithm, getAlgorithm, delAlgorithm, addAlgorithm, updateAlgorithm } from "@/api/laboratory/algorithm";
- export default {
- name: "Algorithm",
- data() {
- return {
- imgTitle:"",
- imgOpen:false,
- imgUrl:"",
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 算法回调结果表格数据
- algorithmList: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- dealStatus: [
- {
- value: -1,
- label: '请选择'
- },
- {
- value: '0',
- label: '未处理'
- },
- {
- value: '1',
- label: '已处理'
- }
- ],
- alarmList: [
- {
- value: null,
- label: '请选择'
- },
- {
- value: '0',
- label: '否'
- },
- {
- value: '1',
- label: '是'
- }
- ],
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize:20,
- algorithmType: null,
- algorithmResult: null,
- parseResult: null,
- parseResultMsg: null,
- signId: null,
- subId: null,
- isAlarm:null,
- inTime: null,
- outTime: null,
- status: -1
- },
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- createTime: [
- { required: true, message: "签到id不能为空", trigger: "blur" }
- ]
- }
- };
- },
- created() {
- this.getList();
- },
- methods: {
- //点击放大图片
- imgBigBox(row,doType){
- if(doType=='original'){
- this.imgTitle = '算法名称:'+row.algorithmName;
- this.imgUrl = row.originalImg;
- }else if(doType=='result'){
- this.imgTitle = '算法名称:'+row.algorithmName;
- this.imgUrl = row.algorithmResult;
- }
- this.imgOpen = true;
- },
- /** 查询算法回调结果列表 */
- getList() {
- this.loading = true;
- listAlgorithm(this.queryParams).then( response => {
- this.algorithmList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- id: null,
- algorithmType: null,
- algorithmResult: null,
- parseResult: null,
- parseResultMsg: null,
- signId: null,
- subId: null,
- createTime: null
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.queryParams.status=-1;
- this.queryParams.isAlarm='';
- this.resetForm("queryForm");
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.id)
- this.single = selection.length!==1
- this.multiple = !selection.length
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- this.open = true;
- this.title = "添加算法回调结果";
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- const id = row.id || this.ids
- getAlgorithm(id).then( response => {
- this.form = response.data;
- this.open = true;
- this.title = "修改算法";
- });
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- if (this.form.id != null) {
- updateAlgorithm(this.form).then( response => {
- this.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- });
- } else {
- addAlgorithm(this.form).then( response => {
- this.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- });
- }
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const ids = row.id || this.ids;
- this.$confirm('是否确认删除?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return delAlgorithm(ids);
- }).then(() => {
- this.getList();
- this.msgSuccess("删除成功");
- }).catch(() => {});
- },
- /** 导出按钮操作 */
- handleExport() {
- this.download('laboratory/algorithm/export', {
- ...this.queryParams
- }, `laboratory_algorithm.xlsx`)
- }
- }
- };
- </script>
- <style scoped lang="scss">
- .algorithm {
- display: flex!important;
- flex-direction: column;
- box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
- padding:20px 20px 20px!important;
- .button-box{
- width:190px;
- display: flex;
- margin:0 auto;
- }
- }
- </style>
|