|
@@ -0,0 +1,282 @@
|
|
|
+ <template>
|
|
|
+ <div class="video-setting">
|
|
|
+ <el-row :gutter="8">
|
|
|
+ <el-col :span="6">
|
|
|
+ <tree @treeClick="reload"></tree>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="18">
|
|
|
+ <el-card class="box-card">
|
|
|
+ <test ref="req" v-model="req" :form-config="queryForm"></test>
|
|
|
+ <el-table :data="tableList" v-loading="loading">
|
|
|
+ <!-- <el-table-column :label="$t('management.video_setting.videoUrl')" align="center" prop="videoUrl" /> -->
|
|
|
+ <el-table-column :label="$t('management.video_setting.title')" align="center" prop="title" />
|
|
|
+ <el-table-column :label="$t('management.video_setting.status')" align="center" prop="status" />
|
|
|
+ <el-table-column :label="$t('management.video_setting.duration')" align="center" prop="duration" width="120" />
|
|
|
+ <el-table-column :label="$t('management.video_setting.size')" align="center" prop="size" width="120" />
|
|
|
+ <el-table-column :label="$t('create_time')" align="center" prop="createTime" />
|
|
|
+ <el-table-column :label="$t('update_time')" align="center" prop="updateTime" width="120" />
|
|
|
+ <el-table-column :label="$t('operation')" align="center" width="200">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <!-- <el-button type="text" @click="toView(scope.row)">{{ $t('toView') }} </el-button> -->
|
|
|
+ <el-button type="text" @click="handleUpdate(scope.row)">{{ $t('edit') }} </el-button>
|
|
|
+ <el-button type="text" @click="handleDelete(scope.row)">{{ $t('delete') }} </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <pagination v-show="total > 0" :total="total" :page.sync="req.pageNum" :limit.sync="req.pageSize" @pagination="getList" />
|
|
|
+ <el-dialog title="添加设备" :visible.sync="open" width="30%">
|
|
|
+ <test ref="form" v-model="dialogParams" :form-config="dialogForm" :insideRules="dialogRules"></test>
|
|
|
+ </el-dialog>
|
|
|
+ <el-dialog title="预览" :visible.sync="viewModal" width="500px">
|
|
|
+
|
|
|
+ </el-dialog>
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <script>
|
|
|
+ import * as API from '@/api/management/video-setting.js'
|
|
|
+ import * as APISelect from '@/api/Internet-of-things/select.js'
|
|
|
+ import test from '@/components/form-test/index.vue'
|
|
|
+ import tree from './tree.vue'
|
|
|
+ export default {
|
|
|
+ name: 'equipment-management',
|
|
|
+ components: { test,tree },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ viewModal:false,
|
|
|
+ req: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ keyword: '',
|
|
|
+ tdaApplicationId: '',
|
|
|
+ tdaProductId: '',
|
|
|
+ },
|
|
|
+
|
|
|
+ queryForm: {
|
|
|
+ keyword: {
|
|
|
+ label: this.$t('management.video_setting.keyword'),
|
|
|
+ span: 4,
|
|
|
+ },
|
|
|
+ operation: {
|
|
|
+ // 搜索按钮操作
|
|
|
+ query: () => {
|
|
|
+ this.req.pageNum = 1
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ // 重置按钮操作
|
|
|
+ reset: () => {
|
|
|
+ this.$refs.req.reset()
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ },
|
|
|
+ otherButton: {
|
|
|
+ list: [
|
|
|
+ {
|
|
|
+ name: this.$t('management.video_setting.addModal'),
|
|
|
+ methodsText: 'add',
|
|
|
+ type: 'primary',
|
|
|
+ add: () => {
|
|
|
+ this.open = true
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ tableList: [],
|
|
|
+ total: 0,
|
|
|
+ loading: false,
|
|
|
+ open: false,
|
|
|
+ title: '',
|
|
|
+ dialogParams: {
|
|
|
+ fileInfoList: '',
|
|
|
+ videoClassifyId: '',
|
|
|
+ title: '',
|
|
|
+ richText: '',
|
|
|
+ },
|
|
|
+ dialogForm: {
|
|
|
+ loadingStatus: false,
|
|
|
+ title: {
|
|
|
+ label: '标题',
|
|
|
+ span: 1
|
|
|
+ },
|
|
|
+ fileInfoList: {
|
|
|
+ label: this.$t('分组名称'),
|
|
|
+ type: 'uploads',
|
|
|
+ data: [],
|
|
|
+ tip:"最多选择6个视频文件",
|
|
|
+ accept:".avi,.wmv,.mkv,.mp4,.mov",
|
|
|
+ fileList:[],
|
|
|
+ },
|
|
|
+ videoClassifyId: {
|
|
|
+ label: this.$t('分组名称'),
|
|
|
+ type: 'cascader',
|
|
|
+ props:{
|
|
|
+ label:"name",
|
|
|
+ value: 'id',
|
|
|
+ },
|
|
|
+ data: [],
|
|
|
+ },
|
|
|
+ richText:{
|
|
|
+ label: this.$t('图文说明书'),
|
|
|
+ type: 'editor',
|
|
|
+ },
|
|
|
+
|
|
|
+ otherButton: {
|
|
|
+ align: 'center',
|
|
|
+ list: [
|
|
|
+ {
|
|
|
+ name: this.$t('cancelText'),
|
|
|
+ methodsText: 'cancel',
|
|
|
+ cancel: () => {
|
|
|
+ this.$refs.form.reset()
|
|
|
+ this.open = false
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: this.$t('submitText'),
|
|
|
+ methodsText: 'submit',
|
|
|
+ type: 'primary',
|
|
|
+ submit: () => {
|
|
|
+ console.log(this.dialogParams)
|
|
|
+ this.handleSubmit()
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ dialogRules: {
|
|
|
+ title: [{ required: true, message: this.$t('management.video_setting.deviceNameRules'), trigger: 'blur' }],
|
|
|
+ fileInfoList: [{ required: true, message: this.$t('management.video_setting.tdaApplicationIdRules'), trigger: 'change' }],
|
|
|
+ videoClassifyId: [{ required: true, message: this.$t('management.video_setting.tdaProductIdRules'), trigger: 'change' }],
|
|
|
+ richText: [{ required: true, message: this.$t('management.video_setting.deviceNameRules'), trigger: 'blur' }],
|
|
|
+ },
|
|
|
+ modalType:'Add',
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ //this.getSelectList()
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.getList()
|
|
|
+ this.getTree()
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ toView(e){
|
|
|
+ console.log(e)
|
|
|
+ const v = this
|
|
|
+ },
|
|
|
+ handleUpdate(row){
|
|
|
+ const v = this
|
|
|
+ API.videoInfoDetails({id:row.id}).then(
|
|
|
+ (res) => {
|
|
|
+ for (let i = 0; i < res.data.data.fileInfoList.length; i++) {
|
|
|
+ const element = res.data.data.fileInfoList[i];
|
|
|
+ element.name = element.fileName
|
|
|
+ }
|
|
|
+ this.dialogParams = res.data.data
|
|
|
+ v.modalType = 'Edit'
|
|
|
+ this.open = true
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.log('tdaDevicePage: ' + err)
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
+ getTree() {
|
|
|
+ this.loading = true
|
|
|
+ API.videoClassifyTree(this.treeQuery).then(
|
|
|
+ (res) => {
|
|
|
+ //this.dataInit(res.data.data)
|
|
|
+ this.dialogForm.videoClassifyId.data = res.data.data
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.log('tdaDevicePage: ' + err)
|
|
|
+ }
|
|
|
+ )
|
|
|
+ },
|
|
|
+ dataInit(_data){
|
|
|
+ for (let i = 0; i < _data.length; i++) {
|
|
|
+ const element = _data[i];
|
|
|
+ element.label = element.name
|
|
|
+ element.value = element.id
|
|
|
+ if(element.children && element.children.length != 0){
|
|
|
+ this.dataInit(element.children)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ reload(row){
|
|
|
+ console.log(row)
|
|
|
+ this.req.pageNum = 1
|
|
|
+ this.req.classifyId = row.id
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ getList() {
|
|
|
+ this.loading = true
|
|
|
+ API.videoInfoPage(this.req).then(
|
|
|
+ (res) => {
|
|
|
+ this.total = res.data.data.total
|
|
|
+ this.tableList = res.data.data.records
|
|
|
+ this.loading = false
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.log('tdaDevicePage: ' + err)
|
|
|
+ this.loading = false
|
|
|
+ },
|
|
|
+ )
|
|
|
+ },
|
|
|
+ handleSubmit() {
|
|
|
+ const v = this
|
|
|
+ this.$refs.form.$refs['form'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.dialogForm.loadingStatus = true
|
|
|
+ API['videoInfo' + v.modalType](this.dialogParams).then(
|
|
|
+ () => {
|
|
|
+ this.msgSuccess(this.$t(v.modalType == 'Add' ? 'addSuccess' : 'editSuccess'))
|
|
|
+ this.$refs.form.reset()
|
|
|
+ this.open = false
|
|
|
+ this.dialogForm.loadingStatus = false
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.log('tdaDeviceAdd: ' + err)
|
|
|
+ this.dialogForm.loadingStatus = false
|
|
|
+ },
|
|
|
+ )
|
|
|
+ // } else {
|
|
|
+ // setTimeout(() => {
|
|
|
+ // const errorDiv = document.getElementsByClassName('is-error')
|
|
|
+ // errorDiv[0].scrollIntoView()
|
|
|
+ // }, 0)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleDelete(row) {
|
|
|
+ this.$confirm(this.$t('askDeleteData'), {
|
|
|
+ confirmButtonText: this.$t('submitText'),
|
|
|
+ cancelButtonText: this.$t('cancelText'),
|
|
|
+ type: 'warning',
|
|
|
+ }).then(() => {
|
|
|
+ API.videoInfoDelete({ id: row.id }).then(() => {
|
|
|
+ this.msgSuccess(this.$t('deleteSuccess'))
|
|
|
+ this.getList()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ },
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+
|
|
|
+ <style lang="scss" scoped>
|
|
|
+
|
|
|
+ .box-card {
|
|
|
+ height: calc(100vh - 110px);
|
|
|
+ overflow-y: auto;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+
|