index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. <template>
  2. <div class="app-container algorithm">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
  4. <el-form-item label="开始时间" prop="inTime">
  5. <el-date-picker clearable size="small"
  6. v-model="queryParams.inTime"
  7. type="date"
  8. value-format="yyyy-MM-dd"
  9. placeholder="请选择开始时间">
  10. </el-date-picker>
  11. </el-form-item>
  12. <el-form-item label="结束时间" prop="outTime">
  13. <el-date-picker clearable size="small"
  14. v-model="queryParams.outTime"
  15. type="date"
  16. value-format="yyyy-MM-dd"
  17. placeholder="请选择结束时间">
  18. </el-date-picker>
  19. </el-form-item>
  20. <el-form-item label="处理状态" prop="inOutType">
  21. <el-select v-model="queryParams.status" placeholder="选择时间类型">
  22. <el-option
  23. v-for="item in dealStatus"
  24. :key="item.value"
  25. :label="item.label"
  26. :value="item.value">
  27. </el-option>
  28. </el-select>
  29. </el-form-item>
  30. <el-form-item label="是否通过" prop="inOutType">
  31. <el-select v-model="queryParams.isAlarm" placeholder="请选择是否通过">
  32. <el-option
  33. v-for="item in alarmList"
  34. :key="item.value"
  35. :label="item.label"
  36. :value="item.value">
  37. </el-option>
  38. </el-select>
  39. </el-form-item >
  40. <el-form-item>
  41. <p class="inquire-button-one" @click="handleQuery">查询</p>
  42. <p class="reset-button-one" @click="resetQuery">重置</p>
  43. </el-form-item>
  44. </el-form>
  45. <el-table v-loading="loading" :data="algorithmList" @selection-change="handleSelectionChange">
  46. <el-table-column label="类型" align="center" prop="algorithmType" >
  47. <template scope="scope">
  48. <p v-if="scope.row.algorithmType=='image'">图片类型</p>
  49. <p v-if="scope.row.algorithmType=='video'">视频类型</p>
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="算法名称" align="center" prop="algorithmName" />
  53. <el-table-column label="原始图" width="150">
  54. <template scope="scope">
  55. <img :src="scope.row.originalImg" width="120" style="cursor:pointer;" height="80" class="img" @click="imgBigBox(scope.row,'original')"/>
  56. </template>
  57. </el-table-column>
  58. <el-table-column label="请求时间" align="center" prop="createTime" />
  59. <el-table-column label="识别结果" width="150">
  60. <template scope="scope">
  61. <img :src="scope.row.algorithmResult" width="120" style="cursor:pointer;" height="80" class="img" @click="imgBigBox(scope.row,'result')"/>
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="响应时间" align="center" prop="outTime" />
  65. <el-table-column label="是否通过" align="center" prop="isAlarm">
  66. <template scope="scope">
  67. <p v-if="scope.row.isAlarm=='0'">不通过</p>
  68. <p v-if="scope.row.isAlarm=='1'">通过</p>
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="状态" align="center" prop="status" >
  72. <template scope="scope">
  73. <p v-if="scope.row.status=='0'">未处理</p>
  74. <p v-if="scope.row.status=='1'">已处理</p>
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  78. <template slot-scope="scope">
  79. <div class="button-box">
  80. <p class="table-min-button"
  81. style="margin-right:10px;"
  82. @click="handleUpdate(scope.row)"
  83. v-hasPermi="['laboratory:algorithm:edit']"
  84. ><i class="el-icon-edit-outline"></i>修改</p>
  85. <p class="table-min-button"
  86. @click="handleDelete(scope.row)"
  87. v-hasPermi="['laboratory:algorithm:remove']"
  88. ><i class="el-icon-edit-outline"></i>删除</p>
  89. </div>
  90. </template>
  91. </el-table-column>
  92. </el-table>
  93. <pagination :page-sizes="[20, 30, 40, 50]"
  94. v-show="total>0"
  95. :total="total"
  96. :page.sync="queryParams.pageNum"
  97. :limit.sync="queryParams.pageSize"
  98. @pagination="getList"
  99. />
  100. <!-- 添加或修改算法回调结果对话框 -->
  101. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  102. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  103. <el-form-item label="算法类型" prop="algorithmType">
  104. <el-input v-model="form.algorithmType" placeholder="请输入解析结果" />
  105. </el-form-item>
  106. <el-form-item label="算法名称" prop="algorithmName">
  107. <el-input v-model="form.algorithmName" placeholder="算法名称" />
  108. </el-form-item>
  109. </el-form>
  110. <div slot="footer" class="dialog-footer">
  111. <el-button type="primary" @click="submitForm">确 定</el-button>
  112. <el-button @click="cancel">取 消</el-button>
  113. </div>
  114. </el-dialog>
  115. <el-dialog :title="imgTitle" :visible.sync="imgOpen" width="800px" append-to-body>
  116. <div class="scrollbar-box" style="width:760px;max-height:700px;overflow-y: scroll;">
  117. <img :src="imgUrl" style="width:760px;">
  118. </div>
  119. </el-dialog>
  120. </div>
  121. </template>
  122. <script>
  123. import { listAlgorithm, getAlgorithm, delAlgorithm, addAlgorithm, updateAlgorithm } from "@/api/laboratory/algorithm";
  124. export default {
  125. name: "Algorithm",
  126. data() {
  127. return {
  128. imgTitle:"",
  129. imgOpen:false,
  130. imgUrl:"",
  131. // 遮罩层
  132. loading: true,
  133. // 选中数组
  134. ids: [],
  135. // 非单个禁用
  136. single: true,
  137. // 非多个禁用
  138. multiple: true,
  139. // 显示搜索条件
  140. showSearch: true,
  141. // 总条数
  142. total: 0,
  143. // 算法回调结果表格数据
  144. algorithmList: [],
  145. // 弹出层标题
  146. title: "",
  147. // 是否显示弹出层
  148. open: false,
  149. dealStatus: [
  150. {
  151. value: -1,
  152. label: '请选择'
  153. },
  154. {
  155. value: '0',
  156. label: '未处理'
  157. },
  158. {
  159. value: '1',
  160. label: '已处理'
  161. }
  162. ],
  163. alarmList: [
  164. {
  165. value: null,
  166. label: '请选择'
  167. },
  168. {
  169. value: '0',
  170. label: '否'
  171. },
  172. {
  173. value: '1',
  174. label: '是'
  175. }
  176. ],
  177. // 查询参数
  178. queryParams: {
  179. pageNum: 1,
  180. pageSize:20,
  181. algorithmType: null,
  182. algorithmResult: null,
  183. parseResult: null,
  184. parseResultMsg: null,
  185. signId: null,
  186. subId: null,
  187. isAlarm:null,
  188. inTime: null,
  189. outTime: null,
  190. status: -1
  191. },
  192. // 表单参数
  193. form: {},
  194. // 表单校验
  195. rules: {
  196. createTime: [
  197. { required: true, message: "签到id不能为空", trigger: "blur" }
  198. ]
  199. }
  200. };
  201. },
  202. created() {
  203. this.getList();
  204. },
  205. methods: {
  206. //点击放大图片
  207. imgBigBox(row,doType){
  208. if(doType=='original'){
  209. this.imgTitle = '算法名称:'+row.algorithmName;
  210. this.imgUrl = row.originalImg;
  211. }else if(doType=='result'){
  212. this.imgTitle = '算法名称:'+row.algorithmName;
  213. this.imgUrl = row.algorithmResult;
  214. }
  215. this.imgOpen = true;
  216. },
  217. /** 查询算法回调结果列表 */
  218. getList() {
  219. this.loading = true;
  220. listAlgorithm(this.queryParams).then( response => {
  221. this.algorithmList = response.rows;
  222. this.total = response.total;
  223. this.loading = false;
  224. });
  225. },
  226. // 取消按钮
  227. cancel() {
  228. this.open = false;
  229. this.reset();
  230. },
  231. // 表单重置
  232. reset() {
  233. this.form = {
  234. id: null,
  235. algorithmType: null,
  236. algorithmResult: null,
  237. parseResult: null,
  238. parseResultMsg: null,
  239. signId: null,
  240. subId: null,
  241. createTime: null
  242. };
  243. this.resetForm("form");
  244. },
  245. /** 搜索按钮操作 */
  246. handleQuery() {
  247. this.queryParams.pageNum = 1;
  248. this.getList();
  249. },
  250. /** 重置按钮操作 */
  251. resetQuery() {
  252. this.queryParams.status=-1;
  253. this.queryParams.isAlarm='';
  254. this.resetForm("queryForm");
  255. this.handleQuery();
  256. },
  257. // 多选框选中数据
  258. handleSelectionChange(selection) {
  259. this.ids = selection.map(item => item.id)
  260. this.single = selection.length!==1
  261. this.multiple = !selection.length
  262. },
  263. /** 新增按钮操作 */
  264. handleAdd() {
  265. this.reset();
  266. this.open = true;
  267. this.title = "添加算法回调结果";
  268. },
  269. /** 修改按钮操作 */
  270. handleUpdate(row) {
  271. this.reset();
  272. const id = row.id || this.ids
  273. getAlgorithm(id).then( response => {
  274. this.form = response.data;
  275. this.open = true;
  276. this.title = "修改算法";
  277. });
  278. },
  279. /** 提交按钮 */
  280. submitForm() {
  281. this.$refs["form"].validate(valid => {
  282. if (valid) {
  283. if (this.form.id != null) {
  284. updateAlgorithm(this.form).then( response => {
  285. this.msgSuccess("修改成功");
  286. this.open = false;
  287. this.getList();
  288. });
  289. } else {
  290. addAlgorithm(this.form).then( response => {
  291. this.msgSuccess("新增成功");
  292. this.open = false;
  293. this.getList();
  294. });
  295. }
  296. }
  297. });
  298. },
  299. /** 删除按钮操作 */
  300. handleDelete(row) {
  301. const ids = row.id || this.ids;
  302. this.$confirm('是否确认删除?', "警告", {
  303. confirmButtonText: "确定",
  304. cancelButtonText: "取消",
  305. type: "warning"
  306. }).then(function() {
  307. return delAlgorithm(ids);
  308. }).then(() => {
  309. this.getList();
  310. this.msgSuccess("删除成功");
  311. }).catch(() => {});
  312. },
  313. /** 导出按钮操作 */
  314. handleExport() {
  315. this.download('laboratory/algorithm/export', {
  316. ...this.queryParams
  317. }, `laboratory_algorithm.xlsx`)
  318. }
  319. }
  320. };
  321. </script>
  322. <style scoped lang="scss">
  323. .algorithm {
  324. display: flex!important;
  325. flex-direction: column;
  326. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  327. padding:20px 20px 20px!important;
  328. .button-box{
  329. width:190px;
  330. display: flex;
  331. margin:0 auto;
  332. }
  333. }
  334. </style>