index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. <template>
  2. <div class="app-container">
  3. <div style="background-color: #fff;padding: 20px;border-radius: 10px; padding-bottom: 0;">
  4. <p style="margin: 0; font-weight: 800;font-size: 16px;color: #343434;display: flex;align-items: center;margin-bottom: 20px;border-left: 6px solid #03BF8A;margin-left: -20px;">
  5. <!-- <img src="../../../assets/images/icon_htgl_btzs.png" alt="" style="width: 16px;height: 20px;"> -->
  6. <span style="margin-left: 10px;">搜索条件</span>
  7. </p>
  8. <div style="padding-bottom: 0;margin-bottom: 20px;">
  9. <el-form class="qucheu" :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
  10. <el-form-item label="任务编号" prop="taskNum">
  11. <el-input
  12. v-model="queryParams.taskNum"
  13. placeholder="请输入任务编号"
  14. clearable
  15. @keyup.enter.native="handleQuery"
  16. />
  17. </el-form-item>
  18. <el-form-item style="border: 0;">
  19. <el-button style="background-color: #03BF8A; border-color: #03BF8A;" type="primary" size="mini" @click="handleQuery">搜索</el-button>
  20. <el-button size="mini" @click="resetQuery">重置</el-button>
  21. </el-form-item>
  22. </el-form>
  23. </div>
  24. </div>
  25. <el-row :gutter="10" class="mb8">
  26. <el-col :span="1.5">
  27. <el-button
  28. type="success"
  29. plain
  30. size="mini"
  31. @click="handleAdd"
  32. v-hasPermi="['manage:taskManage:add']"
  33. >新增</el-button>
  34. </el-col>
  35. <!-- <el-col :span="1.5">
  36. <el-button
  37. type="success"
  38. plain
  39. icon="el-icon-edit"
  40. size="mini"
  41. :disabled="single"
  42. @click="handleUpdate"
  43. v-hasPermi="['manage:taskManage:edit']"
  44. >修改</el-button>
  45. </el-col> -->
  46. <el-col :span="1.5">
  47. <el-button
  48. type="danger"
  49. plain
  50. size="mini"
  51. :disabled="multiple"
  52. @click="handleDelete"
  53. v-hasPermi="['manage:taskManage:remove']"
  54. >删除</el-button>
  55. </el-col>
  56. <el-col :span="1.5">
  57. <el-button
  58. type="warning"
  59. plain
  60. size="mini"
  61. @click="handleExport"
  62. v-hasPermi="['manage:taskManage:export']"
  63. >导出</el-button>
  64. </el-col>
  65. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  66. </el-row>
  67. <el-table :height="tableMaxHeight" v-loading="loading" :data="taskManageList" @selection-change="handleSelectionChange">
  68. <el-table-column type="selection" width="55" align="center" />
  69. <el-table-column label="任务编号" align="center" prop="taskNum" />
  70. <el-table-column label="任务描述" align="center" prop="taskDetails" />
  71. <el-table-column label="通道ID" align="center" prop="channelId" />
  72. <el-table-column label="视频地址" align="center" prop="videoAddress" />
  73. <el-table-column label="上报地址" align="center" prop="reportAddress" />
  74. <el-table-column label="算法编号" align="center" prop="algorithmSet" />
  75. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  76. <template slot-scope="scope">
  77. <el-button
  78. size="mini"
  79. style="width: 42px;height: 26px;
  80. background: #E5F9F3;
  81. border-radius: 4px;border: 1px solid #03BF8A;color: #03BF8A;
  82. "
  83. type="text"
  84. @click="handleUpdate(scope.row)"
  85. v-hasPermi="['manage:taskManage:edit']"
  86. >修改</el-button>
  87. <el-button
  88. size="mini"
  89. type="text"
  90. style="width: 42px;height: 26px;background: #FFF1EA;
  91. border-radius: 4px;border: 1px solid #FE570E;color: #FE570E;"
  92. @click="handleDelete(scope.row)"
  93. v-hasPermi="['manage:taskManage:remove']"
  94. >删除</el-button>
  95. </template>
  96. </el-table-column>
  97. </el-table>
  98. <pagination
  99. v-show="total>0"
  100. :total="total"
  101. :page.sync="queryParams.pageNum"
  102. :limit.sync="queryParams.pageSize"
  103. @pagination="getList"
  104. />
  105. <!-- 添加或修改任务管理对话框 -->
  106. <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
  107. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  108. <el-row>
  109. <el-col :span="12">
  110. <el-form-item label="任务编号" prop="taskNum">
  111. <el-input v-model="form.taskNum" placeholder="请输入任务编号" />
  112. </el-form-item>
  113. </el-col>
  114. <el-col :span="12">
  115. <el-form-item label="视频地址" prop="videoAddress">
  116. <el-input v-model="form.videoAddress" placeholder="请输入视频地址" />
  117. </el-form-item>
  118. </el-col>
  119. <el-col :span="12">
  120. <el-form-item label="上报地址" prop="reportAddress">
  121. <el-input v-model="form.reportAddress" placeholder="请输入上报地址" />
  122. </el-form-item>
  123. </el-col>
  124. <el-col :span="12">
  125. <el-form-item label="通道编号" prop="channelId">
  126. <el-select style="width: 100%;" v-model="form.channelId" placeholder="请选择通道ID">
  127. <el-option
  128. v-for="dict in channelNumberList "
  129. :key="dict.channelId"
  130. :label="dict.channelNum"
  131. :value="dict.channelId"
  132. ></el-option>
  133. </el-select>
  134. </el-form-item>
  135. </el-col>
  136. <el-col :span="24">
  137. <el-form-item label="算法编号" prop="algorithmSet">
  138. <el-select multiple style="width: 100%;" v-model="form.algorithmSet" placeholder="请选择算法编号">
  139. <el-option
  140. v-for="dict in dict.type.algorithm_settings"
  141. :key="dict.value"
  142. :label="dict.label"
  143. :value="dict.value"
  144. ></el-option>
  145. </el-select>
  146. </el-form-item>
  147. </el-col>
  148. <el-col :span="12">
  149. <el-form-item label="任务描述" prop="taskDetails">
  150. <el-input v-model="form.taskDetails" placeholder="请输入内容" />
  151. </el-form-item>
  152. </el-col>
  153. <el-col :span="12">
  154. <el-form-item label="备注" prop="remark">
  155. <el-input v-model="form.remark" placeholder="请输入内容" />
  156. </el-form-item>
  157. </el-col>
  158. </el-row>
  159. <!-- <el-form-item label="通道ID" prop="channelId">
  160. <el-input v-model="form.channelId" placeholder="请输入通道ID" />
  161. </el-form-item> -->
  162. </el-form>
  163. <div slot="footer" class="dialog-footer">
  164. <el-button style="background-color:#03BF8A ; border-color: #03BF8A;" type="primary" @click="submitForm">确 定</el-button>
  165. <el-button style="background-color:#DDEBE7 ; border-color: #DDEBE7; color: #475669;" @click="cancel">取 消</el-button>
  166. </div>
  167. </el-dialog>
  168. </div>
  169. </template>
  170. <script>
  171. import { listTaskManage, getTaskManage, delTaskManage, addTaskManage, updateTaskManage } from "@/api/manage/taskManage"
  172. import { listChannelNumber, getChannelNumber, delChannelNumber, addChannelNumber, updateChannelNumber } from "@/api/system/channelNumber"
  173. export default {
  174. name: "TaskManage",
  175. dicts: ['algorithm_settings'],
  176. data() {
  177. return {
  178. // 遮罩层
  179. loading: true,
  180. // 选中数组
  181. ids: [],
  182. // 非单个禁用
  183. single: true,
  184. // 非多个禁用
  185. multiple: true,
  186. // 显示搜索条件
  187. showSearch: true,
  188. // 总条数
  189. total: 0,
  190. // 任务管理表格数据
  191. taskManageList: [],
  192. channelNumberList:[],
  193. // 弹出层标题
  194. title: "",
  195. // 是否显示弹出层
  196. open: false,
  197. // 查询参数
  198. queryParams: {
  199. pageNum: 1,
  200. pageSize: 10,
  201. taskNum: null,
  202. taskDetails: null,
  203. channelId: null,
  204. videoAddress: null,
  205. reportAddress: null,
  206. algorithmSet: null,
  207. },
  208. // 表单参数
  209. form: {},
  210. // 表单校验
  211. rules: {
  212. taskNum: [
  213. { required: true, message: "不能为空", trigger: "blur" }
  214. ],
  215. algorithmSet: [
  216. { required: true, message: "不能为空", trigger: "blur" }
  217. ],
  218. },
  219. tableMaxHeight:'200',
  220. }
  221. },
  222. created() {
  223. this.getList()
  224. this.getListt()
  225. window.onresize = () => {
  226. this.changeTableMaxHeight()
  227. }
  228. this.changeTableMaxHeight()
  229. },
  230. mounted() {
  231. window.onresize = () => {
  232. this.changeTableMaxHeight()
  233. }
  234. this.changeTableMaxHeight()
  235. },
  236. methods: {
  237. /** 查询任务管理列表 */
  238. getList() {
  239. this.loading = true
  240. listTaskManage(this.queryParams).then(response => {
  241. this.taskManageList = response.rows
  242. this.total = response.total
  243. this.loading = false
  244. })
  245. },
  246. /** 查询通道管理列表 */
  247. getListt() {
  248. this.loading = true
  249. let snge={
  250. pageNum: 1,
  251. pageSize: 200,
  252. }
  253. listChannelNumber(snge).then(response => {
  254. this.channelNumberList = response.rows
  255. this.loading = false
  256. })
  257. },
  258. // 取消按钮
  259. cancel() {
  260. this.open = false
  261. this.reset()
  262. },
  263. // 表单重置
  264. reset() {
  265. this.form = {
  266. taskId: null,
  267. taskNum: null,
  268. taskDetails: null,
  269. channelId: null,
  270. videoAddress: null,
  271. reportAddress: null,
  272. algorithmSet: null,
  273. delFlag: null,
  274. createBy: null,
  275. createTime: null,
  276. updateBy: null,
  277. updateTime: null,
  278. remark: null
  279. }
  280. this.resetForm("form")
  281. },
  282. /** 搜索按钮操作 */
  283. handleQuery() {
  284. this.queryParams.pageNum = 1
  285. this.getList()
  286. },
  287. /** 重置按钮操作 */
  288. resetQuery() {
  289. this.resetForm("queryForm")
  290. this.handleQuery()
  291. },
  292. // 多选框选中数据
  293. handleSelectionChange(selection) {
  294. this.ids = selection.map(item => item.taskId)
  295. this.single = selection.length!==1
  296. this.multiple = !selection.length
  297. },
  298. /** 新增按钮操作 */
  299. handleAdd() {
  300. this.reset()
  301. this.open = true
  302. this.title = "添加任务管理"
  303. },
  304. /** 修改按钮操作 */
  305. handleUpdate(row) {
  306. this.reset()
  307. const taskId = row.taskId || this.ids
  308. getTaskManage(taskId).then(response => {
  309. this.form = response.data
  310. if(this.form.algorithmSet != null){
  311. if(this.form.algorithmSet.length !=0){
  312. this.form.algorithmSet = this.form.algorithmSet.split(',')
  313. }
  314. }
  315. this.open = true
  316. this.title = "修改任务管理"
  317. })
  318. },
  319. /** 提交按钮 */
  320. submitForm() {
  321. this.$refs["form"].validate(valid => {
  322. if (valid) {
  323. if(this.form.algorithmSet != null){
  324. if(this.form.algorithmSet.length !=0){
  325. this.form.algorithmSet = this.form.algorithmSet.join(',')
  326. }
  327. }
  328. if (this.form.taskId != null) {
  329. updateTaskManage(this.form).then(response => {
  330. this.$modal.msgSuccess("修改成功")
  331. this.open = false
  332. this.getList()
  333. })
  334. } else {
  335. addTaskManage(this.form).then(response => {
  336. this.$modal.msgSuccess("新增成功")
  337. this.open = false
  338. this.getList()
  339. })
  340. }
  341. }
  342. })
  343. },
  344. /** 删除按钮操作 */
  345. handleDelete(row) {
  346. const taskIds = row.taskId || this.ids
  347. this.$modal.confirm('是否确认删除任务管理编号为"' + taskIds + '"的数据项?').then(function() {
  348. return delTaskManage(taskIds)
  349. }).then(() => {
  350. this.getList()
  351. this.$modal.msgSuccess("删除成功")
  352. }).catch(() => {})
  353. },
  354. /** 导出按钮操作 */
  355. handleExport() {
  356. this.download('manage/taskManage/export', {
  357. ...this.queryParams
  358. }, `taskManage_${new Date().getTime()}.xlsx`)
  359. },
  360. // 获取屏幕高度
  361. showFilterForm () {
  362. this.filterActive = !this.filterActive
  363. this.changeTableMaxHeight()
  364. },
  365. changeTableMaxHeight () {
  366. let height = document.body.offsetHeight // 网页可视区域高度
  367. // if (this.filterActive) {
  368. // this.tableMaxHeight = height - 320
  369. // } else {
  370. this.tableMaxHeight = height - 250
  371. // }
  372. console.log(height)
  373. }
  374. }
  375. }
  376. </script>
  377. <style lang="scss">
  378. .el-table .el-table__header-wrapper th, .el-table .el-table__fixed-header-wrapper th{
  379. background-color:#F5F6F8;
  380. }
  381. .el-checkbox__input.is-checked .el-checkbox__inner{
  382. background-color: #03BF8A;
  383. border-color: #03BF8A;
  384. }
  385. .el-checkbox__input.is-indeterminate .el-checkbox__inner{
  386. background-color: #03BF8A;
  387. border-color: #03BF8A;
  388. }
  389. .qucheu{
  390. .el-form-item--small.el-form-item{
  391. border: 1px solid #E6E6E6;
  392. }
  393. .el-input__inner{
  394. border:0;
  395. }
  396. }
  397. </style>