123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <template>
- <com-head :options="headList" >
- <el-form label-width="84px" inline="true">
- <el-form-item label="S/N码:">
- <el-input v-model="search.state.snCode" placeholder="请输入"></el-input>
- </el-form-item>
- <el-form-item label="所属架构:">
- <com-select v-model="search.state.deptId" />
- </el-form-item>
- <el-form-item class="searh-btns" style="grid-area: 1 / 3 / 2 / 4;">
- <el-button type="primary" @click="search.submit">查询</el-button>
- <el-button type="primary" plain @click="search.reset">重置</el-button>
- </el-form-item>
- </el-form>
- </com-head>
- <div class="body-layer">
- <div class="body-head">
- <h3 style="visibility: hidden;">相机列表</h3>
- <div class="table-ctrl-right">
- <!-- <el-input placeholder="关键词" suffix-icon="el-icon-search" class="search-scene" v-model="search.state.searchKey" style="width: auto" /> -->
- <el-button
- type="primary"
- @click="oper.readyInsert"
- v-if="auth.add"
- >绑定相机</el-button
- >
- </div>
- </div>
- <el-table
- ref="multipleTable"
- :data="dataList.state"
- tooltip-effect="dark"
- style="width: 100%"
- @row-click="dataList.selectRow"
- >
- <el-table-column label="序号" width="55" v-slot:default="{ $index }">
- <div style="text-align: center">{{ pag.state.size * (pag.state.currPage - 1) + $index + 1 }}</div>
- </el-table-column>usedSpace totalSpace
- <el-table-column label="S/N码" prop="snCode"></el-table-column>
- <el-table-column label="所属架构" prop="deptName"></el-table-column>
- <el-table-column label="云容量使用情况" v-slot:default="{ row }">
- {{row.usedSpaceStr}} / {{row.totalSpaceStr}}
- </el-table-column>
- <el-table-column label="操作" v-slot:default="{ row }" v-if="auth.unbind || auth.update">
- <!-- <span class="oper-span" @click="oper.readyUpdate(row)" v-if="auth.update">编辑</span> -->
- <span class="oper-span"
- @click="unbindCamrea(row)"
- v-if="auth.delete"
- style="color: var(--primaryColor)">
- 解绑
- </span>
- </el-table-column>
- </el-table>
- <com-pagination
- @size-change="pag.sizeChange"
- @current-change="pag.currentChange"
- :current-page="pag.state.currPage"
- :page-size="pag.state.size"
- layout="total, sizes, prev, pager, next, jumper"
- :total="pag.state.total"/>
- </div>
-
- <com-dialog
- :title="(oper.state.id ? '编辑' : '绑定') + '相机'"
- v-model:show="oper.state.show"
- enterText="确 定"
- @submit="submit"
- width="480"
- >
- <el-form ref="form" :model="form" label-width="68px" class="camera-from">
- <el-form-item label="SN码:" class="mandatory">
- <el-input :modelValue="oper.state.snCode" placeholder="请输入相机底部SN码,如214D5RE2G8" @update:modelValue="val => oper.state.snCode = val.trim()"></el-input>
- </el-form-item>
- </el-form>
- </com-dialog>
- </template>
- <script>
- import { ref, watch } from "vue";
- import getTableState from "@/state/tableRef";
- import auth from "@/state/viewAuth";
- import comDialog from "@/components/dialog";
- import comPagination from "@/components/pagination";
- import comSelect from "@/components/company-select";
- import comHead from "@/components/head";
- import { dateFormat } from '@/util'
- import {
- getCameraList,
- insertCamera,
- deleteCamera,
- unbindCamera,
- updateCamera
- } from '@/request/config'
- import axios from 'axios';
- export default {
- name: 'camera',
- setup() {
- const state = getTableState({
- insertUrl: insertCamera,
- updateUrl: updateCamera,
- getUrl: getCameraList,
- delUrl: deleteCamera,
- searchAttr: { deptId: '', snCode: '' },
- operAttr: { snCode: '', cameraSn: '' },
- delMsg: '解绑相机,该相机拍摄的场景也将一并解绑(场景在云端存储,不会删除)确定要解绑吗?'
- });
- const headList = ref([{ name: "相机管理", value: 2 }]);
- const time = ref(null)
- watch(state.oper.value.state, () => {
- state.oper.value.state.cameraSn = state.oper.value.state.snCode
- })
- watch(time, () => {
- if (time.value) {
- state.search.value.state.startTime = dateFormat(new Date(time.value[0]), 'yyyy-MM-dd hh:mm:ss')
- state.search.value.state.endTime = dateFormat(new Date(time.value[1]), 'yyyy-MM-dd 23:59:59')
- } else {
- state.search.value.state.startTime = state.search.value.state.endTime = ''
- }
- })
- watch(
- [() => state.search.value.state.startTime, () => state.search.value.state.endTime],
- () => {
- if (!state.search.value.state.startTime || !state.search.value.state.endTime) {
- time.value = null
- }
- }
- )
- return { ...state, headList, time, auth };
- },
- methods: {
- async unbindCamrea(data) {
- if (await this.$confirm('解绑相机,该相机拍摄的场景也将一并解绑(场景在云端存储,不会删除)确定要解绑吗?', '提示')) {
- await axios.post(unbindCamera, {cameraSn: data.snCode})
- this.dataList.refer()
-
- }
- },
- submit() {
- if (!this.oper.state.snCode.trim()) {
- return this.$message.error('S/N码不能为空!', '提示')
- }
- this.oper.state.id ? this.oper.update() : this.oper.insert()
- }
- },
- components: {
- "com-dialog": comDialog,
- "com-head": comHead,
- "com-pagination": comPagination,
- "com-select": comSelect
- },
- };
- </script>
- <style lang="scss" scoped>
- .table-ctrl-right {
- .search-scene {
- margin: 0 20px 0 26px;
- }
- i {
- margin-left: 20px;
- font-size: 1.7rem;
- vertical-align: middle;
- cursor: pointer;
- &.active {
- color: var(--primaryColor);
- }
- }
- }
- // .camera-from {
- // width: 420px;
- // margin: 0 auto;
- // }
- </style>
|