|
@@ -0,0 +1,273 @@
|
|
|
+<template>
|
|
|
+ <div class="cameraBrand">
|
|
|
+ <!-- 查询 -->
|
|
|
+ <query-conditions :formItems="searchList" @getQueryParams="handleQuery"></query-conditions>
|
|
|
+ <!-- 表格 -->
|
|
|
+ <new-table :title="title" :listData="brandLists" :tableItems="tableItems" :shows="tableShows">
|
|
|
+ <template #right>
|
|
|
+ <div>
|
|
|
+ <el-button size="mini" type="primary" v-if="hasPerm('brand:add')" @click="dialogVisible = true">添加品牌</el-button>
|
|
|
+
|
|
|
+ <el-button size="mini" type="danger" v-if="hasPerm('brand:del')" @click="delAll">批量删除</el-button>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #streamType="scope">
|
|
|
+ <div>
|
|
|
+ <span v-if="scope.row.streamType === 0">主码流</span>
|
|
|
+ <span v-else>辅码流</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #handler="scope">
|
|
|
+ <el-button size="mini" @click="edit(scope.row)" v-if="hasPerm('brand:edit')" style="margin-right: 10px">编辑</el-button>
|
|
|
+ <el-popconfirm
|
|
|
+ title=" 确定要删除这个区域吗?"
|
|
|
+ @confirm="del(scope.row)"
|
|
|
+ >
|
|
|
+ <el-button type="danger" v-if="hasPerm('brand:del')" size="mini" slot="reference">删除</el-button>
|
|
|
+ </el-popconfirm>
|
|
|
+ </template>
|
|
|
+ </new-table>
|
|
|
+
|
|
|
+ <!-- 新增编辑 -->
|
|
|
+ <el-dialog
|
|
|
+ :title="showType ? '编 辑' : '新 增'"
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
+ width="30%">
|
|
|
+ <div>
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="80px" size="mini">
|
|
|
+ <el-form-item label="品牌名称" prop="brandName">
|
|
|
+ <el-input v-model="form.brandName"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="主码流" prop="mainStream">
|
|
|
+ <el-input v-model="form.mainStream"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="副码流" prop="assistStream">
|
|
|
+ <el-input v-model="form.assistStream"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="所用码流" prop="streamType">
|
|
|
+ <el-select v-model="form.streamType">
|
|
|
+ <el-option v-for="item in options" :label="item.name" :value="item.id" :key="item.id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+<!-- <el-form-item label="主码流">-->
|
|
|
+<!-- <el-input v-model="form.mainStream"></el-input>-->
|
|
|
+<!-- </el-form-item>-->
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="reset">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="onSubmit('form')">{{showType ? '更 新' : '新 增'}}</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import QueryConditions from "@/components/bioSafety/QueryConditions";
|
|
|
+import NewTable from "@/components/newTable/NewTable";
|
|
|
+import { brandList, addBarand, delBarand, editBarand } from '../../utils/api.js';
|
|
|
+export default {
|
|
|
+ name: "CameraBrand",
|
|
|
+ components: {
|
|
|
+ QueryConditions,
|
|
|
+ NewTable
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ searchList: [
|
|
|
+ {
|
|
|
+ type: 'input',
|
|
|
+ label: '品牌搜索:',
|
|
|
+ placeholder: '请输入品牌',
|
|
|
+ field: 'keyWord'
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ brandLists: [],
|
|
|
+ title: '摄像头品牌列表',
|
|
|
+ tableItems: [
|
|
|
+ {
|
|
|
+ prop: 'brandName',
|
|
|
+ label: '品牌名称',
|
|
|
+ minWidth: '150',
|
|
|
+ slotName: 'brandName'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'mainStream',
|
|
|
+ label: '主码流',
|
|
|
+ minWidth: '150',
|
|
|
+ slotName: 'mainStream'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'assistStream',
|
|
|
+ label: '副码流',
|
|
|
+ minWidth: '150',
|
|
|
+ slotName: 'assistStream'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'streamType',
|
|
|
+ label: '所用码流',
|
|
|
+ minWidth: '150',
|
|
|
+ slotName: 'streamType'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '操作',
|
|
|
+ minWidth: '150',
|
|
|
+ slotName: 'handler'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ tableShows: {
|
|
|
+ showIndex: false,
|
|
|
+ showSelect: true
|
|
|
+ },
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 20,
|
|
|
+ total: 0,
|
|
|
+ keyWord: '',
|
|
|
+ form: {
|
|
|
+ brandName: '',
|
|
|
+ mainStream: '',
|
|
|
+ assistStream: '',
|
|
|
+ streamType: 0,
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ brandName: [
|
|
|
+ { required: true, message: '请输入品牌名称', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ mainStream: [
|
|
|
+ { required: true, message: '请输入主码流', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ assistStream: [
|
|
|
+ { required: true, message: '请输入副码流', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ streamType: [
|
|
|
+ { required: true, message: '请选择所用码流', trigger: 'change' }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ id: 0,
|
|
|
+ name: '主码流'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ name: '辅码流'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ dialogVisible: false,
|
|
|
+ showType: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleQuery(data) {
|
|
|
+ this.keyWord = data.keyWord;
|
|
|
+ },
|
|
|
+ init() {
|
|
|
+ let params = {
|
|
|
+ current: this.pageNum,
|
|
|
+ size: this.pageSize,
|
|
|
+ brandName: this.keyWord
|
|
|
+ }
|
|
|
+ brandList(params).then(res => {
|
|
|
+ if(res.code === 10000) {
|
|
|
+ this.brandLists = res.data.records;
|
|
|
+ this.total = res.data.total;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ edit(row) {
|
|
|
+ this.form = {
|
|
|
+ id: row.id,
|
|
|
+ brandName: row.brandName,
|
|
|
+ mainStream: row.mainStream,
|
|
|
+ assistStream: row.assistStream,
|
|
|
+ streamType: row.streamType,
|
|
|
+ }
|
|
|
+ this.dialogVisible = true;
|
|
|
+ this.showType = true;
|
|
|
+ },
|
|
|
+ // 批量删除
|
|
|
+ delAll() {},
|
|
|
+ onSubmit(formName) {
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.showType) {
|
|
|
+ // 编辑
|
|
|
+ let params = {
|
|
|
+ id: this.form.id,
|
|
|
+ brandName: this.form.brandName,
|
|
|
+ mainStream: this.form.mainStream,
|
|
|
+ assistStream: this.form.assistStream,
|
|
|
+ streamType: this.form.streamType,
|
|
|
+ }
|
|
|
+ editBarand(params).then(res => {
|
|
|
+ this.reset()
|
|
|
+ if(res.code === 10000) {
|
|
|
+ this.init();
|
|
|
+ this.$message.success(res.message)
|
|
|
+ } else {
|
|
|
+ this.$message.error('编辑失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ // 新增
|
|
|
+ let params = {
|
|
|
+ brandName: this.form.brandName,
|
|
|
+ mainStream: this.form.mainStream,
|
|
|
+ assistStream: this.form.assistStream,
|
|
|
+ streamType: this.form.streamType
|
|
|
+ }
|
|
|
+ addBarand(params).then(res => {
|
|
|
+ this.reset();
|
|
|
+ if(res.code === 10000) {
|
|
|
+ this.init();
|
|
|
+ this.$message.success(res.message);
|
|
|
+ } else {
|
|
|
+ this.$message.error('添加失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ reset() {
|
|
|
+ this.showType = false;
|
|
|
+ this.dialogVisible = false;
|
|
|
+ this.form = {
|
|
|
+ brandName: '',
|
|
|
+ mainStream: '',
|
|
|
+ assistStream: '',
|
|
|
+ streamType: 0,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ del(row) {
|
|
|
+ let params = {
|
|
|
+ ids: row.id
|
|
|
+ }
|
|
|
+ delBarand(params).then(res =>{
|
|
|
+ if(res.code === 10000) {
|
|
|
+ this.init()
|
|
|
+ this.$message.success(res.message)
|
|
|
+ } else {
|
|
|
+ this.$message.error('删除失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.init()
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+ .cameraBrand {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 20px;
|
|
|
+ }
|
|
|
+</style>
|