RecordPLan.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <div id="recordPLan" style="width: 100%">
  3. <div class="page-header">
  4. <div class="page-title">
  5. <div >录像计划</div>
  6. </div>
  7. <div class="page-header-btn">
  8. <div style="display: inline;">
  9. 搜索:
  10. <el-input @input="search" style="margin-right: 1rem; width: auto;" size="mini" placeholder="关键字"
  11. prefix-icon="el-icon-search" v-model="searchSrt" clearable></el-input>
  12. <el-button size="mini" type="primary" @click="add()">
  13. 添加
  14. </el-button>
  15. <el-button icon="el-icon-refresh-right" circle size="mini" @click="getRecordPlanList()"></el-button>
  16. </div>
  17. </div>
  18. </div>
  19. <el-table size="medium" ref="recordPlanListTable" :data="recordPlanList" :height="winHeight" style="width: 100%"
  20. header-row-class-name="table-header" >
  21. <el-table-column type="selection" width="55" >
  22. </el-table-column>
  23. <el-table-column prop="name" label="名称" >
  24. </el-table-column>
  25. <el-table-column prop="channelCount" label="关联通道" >
  26. </el-table-column>
  27. <el-table-column prop="updateTime" label="更新时间">
  28. </el-table-column>
  29. <el-table-column prop="createTime" label="创建时间">
  30. </el-table-column>
  31. <el-table-column label="操作" width="300" fixed="right">
  32. <template v-slot:default="scope">
  33. <el-button size="medium" icon="el-icon-link" type="text" @click="link(scope.row)">关联通道</el-button>
  34. <el-button size="medium" icon="el-icon-edit" type="text" @click="edit(scope.row)">编辑</el-button>
  35. <el-button size="medium" icon="el-icon-delete" style="color: #f56c6c" type="text" @click="deletePlan(scope.row)">删除</el-button>
  36. </template>
  37. </el-table-column>
  38. </el-table>
  39. <el-pagination
  40. style="text-align: right"
  41. @size-change="handleSizeChange"
  42. @current-change="currentChange"
  43. :current-page="currentPage"
  44. :page-size="count"
  45. :page-sizes="[15, 25, 35, 50]"
  46. layout="total, sizes, prev, pager, next"
  47. :total="total">
  48. </el-pagination>
  49. <editRecordPlan ref="editRecordPlan"></editRecordPlan>
  50. <LinkChannelRecord ref="linkChannelRecord"></LinkChannelRecord>
  51. </div>
  52. </template>
  53. <script>
  54. import uiHeader from '../layout/UiHeader.vue'
  55. import EditRecordPlan from "./dialog/editRecordPlan.vue";
  56. import LinkChannelRecord from "./dialog/linkChannelRecord.vue";
  57. export default {
  58. name: 'recordPLan',
  59. components: {
  60. EditRecordPlan,
  61. LinkChannelRecord,
  62. uiHeader,
  63. },
  64. data() {
  65. return {
  66. recordPlanList: [],
  67. searchSrt: "",
  68. winHeight: window.innerHeight - 180,
  69. currentPage: 1,
  70. count: 15,
  71. total: 0,
  72. loading: false,
  73. };
  74. },
  75. created() {
  76. this.initData();
  77. },
  78. destroyed() {
  79. },
  80. methods: {
  81. initData: function () {
  82. this.getRecordPlanList();
  83. },
  84. currentChange: function (val) {
  85. this.currentPage = val;
  86. this.initData();
  87. },
  88. handleSizeChange: function (val) {
  89. this.count = val;
  90. this.getRecordPlanList();
  91. },
  92. getRecordPlanList: function () {
  93. this.$axios({
  94. method: 'get',
  95. url: `/api/record/plan/query`,
  96. params: {
  97. page: this.currentPage,
  98. count: this.count,
  99. query: this.searchSrt,
  100. }
  101. }).then((res) => {
  102. if (res.data.code === 0) {
  103. this.total = res.data.data.total;
  104. this.recordPlanList = res.data.data.list;
  105. // 防止出现表格错位
  106. this.$nextTick(() => {
  107. this.$refs.recordPlanListTable.doLayout();
  108. })
  109. }
  110. }).catch((error) => {
  111. console.log(error);
  112. });
  113. },
  114. getSnap: function (row) {
  115. let baseUrl = window.baseUrl ? window.baseUrl : "";
  116. return ((process.env.NODE_ENV === 'development') ? process.env.BASE_API : baseUrl) + '/api/device/query/snap/' + this.deviceId + '/' + row.deviceId;
  117. },
  118. search: function () {
  119. this.currentPage = 1;
  120. this.total = 0;
  121. this.initData();
  122. },
  123. refresh: function () {
  124. this.initData();
  125. },
  126. add: function () {
  127. this.$refs.editRecordPlan.openDialog(null, ()=>{
  128. this.initData()
  129. })
  130. },
  131. edit: function (plan) {
  132. this.$refs.editRecordPlan.openDialog(plan, ()=>{
  133. this.initData()
  134. })
  135. },
  136. link: function (plan) {
  137. this.$refs.linkChannelRecord.openDialog(plan.id, ()=>{
  138. this.initData()
  139. })
  140. },
  141. deletePlan: function (plan) {
  142. this.$confirm('确定删除?', '提示', {
  143. confirmButtonText: '确定',
  144. cancelButtonText: '取消',
  145. type: 'warning'
  146. }).then(() => {
  147. this.$axios({
  148. method: 'delete',
  149. url: "/api/record/plan/delete",
  150. params: {
  151. planId: plan.id,
  152. }
  153. }).then((res) => {
  154. if (res.data.code === 0) {
  155. this.$message({
  156. showClose: true,
  157. message: '删除成功',
  158. type: 'success',
  159. });
  160. this.initData();
  161. } else {
  162. this.$message({
  163. showClose: true,
  164. message: res.data.msg,
  165. type: 'error'
  166. });
  167. }
  168. }).catch((error) => {
  169. console.error(error)
  170. });
  171. }).catch(() => {
  172. });
  173. },
  174. }
  175. };
  176. </script>
  177. <style>
  178. .videoList {
  179. display: flex;
  180. flex-wrap: wrap;
  181. align-content: flex-start;
  182. }
  183. .video-item {
  184. position: relative;
  185. width: 15rem;
  186. height: 10rem;
  187. margin-right: 1rem;
  188. background-color: #000000;
  189. }
  190. .video-item-img {
  191. position: absolute;
  192. top: 0;
  193. bottom: 0;
  194. left: 0;
  195. right: 0;
  196. margin: auto;
  197. width: 100%;
  198. height: 100%;
  199. }
  200. .video-item-img:after {
  201. content: "";
  202. display: inline-block;
  203. position: absolute;
  204. z-index: 2;
  205. top: 0;
  206. bottom: 0;
  207. left: 0;
  208. right: 0;
  209. margin: auto;
  210. width: 3rem;
  211. height: 3rem;
  212. background-image: url("../assets/loading.png");
  213. background-size: cover;
  214. background-color: #000000;
  215. }
  216. .video-item-title {
  217. position: absolute;
  218. bottom: 0;
  219. color: #000000;
  220. background-color: #ffffff;
  221. line-height: 1.5rem;
  222. padding: 0.3rem;
  223. width: 14.4rem;
  224. }
  225. </style>