| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917 |
- <template>
- <div class="content">
- <div class="tabs">
- <ul>
- <li v-for="(tab,i) in tabs" @click="goTab(tab.url)" :class="{'active':tabIndex == i}">
- {{tab.name}}
- </li>
- </ul>
- </div>
- <div class="panel">
- <div class="panel-body">
- <div class=" panel_control">
- <el-row :gutter="20">
- <el-col :span="6">
- <em>登记时间:</em>
- <el-date-picker
- v-model="panel.time1"
- type="daterange"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- </el-col>
- <el-col :span="4">
- <em>时限类型:</em>
- <el-select v-model="panel.timeLimit">
- <el-option
- v-for="item in panel.options"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-col>
- <el-col :span="4">
- <em>关键词:</em>
- <el-input v-model="panel.qrcodename" placeholder="请输入关键词"></el-input>
- </el-col>
- <el-col :span="4">
- <el-button size="small" type="primary" @click="query">查询</el-button>
- </el-col>
- </el-row>
- </div>
- </div>
- </div>
- <div class="contorl">
- <el-button size="small" type="primary" @click="addList">添加</el-button>
- <el-button size="small" type="primary" @click="changeList">修改</el-button>
- <el-button size="small" type="primary" @click="delList">删除</el-button>
- </div>
- <el-table
- :data="tableData"
- class=""
- stripe
- is-horizontal-resize
- v-loading="loading"
- element-loading-background="rgba(0, 0, 0, 0.8)"
- @selection-change="handleSelectionChange"
- >
- <el-table-column
- type="selection"
- width="55">
- </el-table-column>
- <el-table-column
- prop="QrId"
- label="二维码编号"
- >
- </el-table-column>
- <el-table-column
- prop="CreateTime"
- label="创建时间"
- width="180">
- <template slot-scope="scope">
- {{scope.row.CreateTime |fmtDate}}
- </template>
- </el-table-column>
- <el-table-column
- prop="Frequency"
- label="有效时长(分钟)"
- >
- </el-table-column>
- <el-table-column
- prop="DetIdStr"
- label="探测器"
- width="180">
- <!--探测器详细信息 todo-->
- </el-table-column>
- <el-table-column
- prop="QrName"
- label="二维码名字">
- </el-table-column>
- <el-table-column
- prop="Tel"
- label="联系电话">
- </el-table-column>
- <el-table-column
- prop="Memo"
- label="备注">
- </el-table-column>
- <el-table-column
- prop="QrId"
- label="操作">
- <template slot-scope="scope">
- <el-button class="control_btn" type="text" @click="goPoster(scope.row)">海报</el-button>
- <el-button class="control_btn" type="text" @click="goQrcode(scope.row)">二维码</el-button>
- <el-button class="control_btn red" type="text" @click="pauseQrcode(scope.row)">禁用</el-button>
- </template>
- </el-table-column>
- </el-table>
- <br>
- <el-pagination
- background
- :total="pageination.total"
- :page-size="pageination.pageItem"
- @current-change="pageChange"
- ></el-pagination>
- <dialog_referrer_list
- :show="dialog_state"
- :title="dialog_title"
- :large="true"
- @dialog_cancel="dialog_cancel"
- @dialog_ok="dialog_ok"
- >
- <div class="dialogContent">
- <el-row :gutter="20">
- <el-col :span="10">
- <label>
- 二维码名称 *
- </label>
- <el-input v-model="dialog.comname"></el-input>
- </el-col>
- <el-col :span="10">
- <label>
- 电话 *
- </label>
- <el-input v-model="dialog.tel"></el-input>
- </el-col>
- <el-col :span="10">
- <label>
- 房间号 *
- </label>
- <el-input v-model="dialog.qrname"></el-input>
- </el-col>
- <el-col :span="10">
- <label>
- 备注
- </label>
- <el-input v-model="dialog.memo"></el-input>
- </el-col>
- <el-col :span="10">
- <label>
- 房间所属探测器
- </label>
- <!--改成list todo -->
- <el-checkbox-group v-model="dialog.checkList">
- <el-checkbox :label="det.Id" v-for="det in dialog.detOptions">{{det.Name}}</el-checkbox>
- </el-checkbox-group>
- </el-col>
- <el-col :span="10">
- <label>
- 海报有效期 *
- </label>
- <el-radio v-model="dialog.timeType" label="1">无限期</el-radio>
- <el-radio v-model="dialog.timeType" label="2">有时限</el-radio>
- </el-col>
- <el-col :span="10" v-if="dialog.timeType == 2">
- <label>
- 有效期时长
- </label>
- <el-input class="short" v-model="dialog.frequency"></el-input>
- <el-select class="short shortRight" v-model="dialog.validType" placeholder="时间单位">
- <el-option
- v-for="item in dialog.timeOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </el-col>
- <el-col :span="10">
- <label>
- 单位形象图
- </label>
- <el-upload
- action="/api/v1/Detector/QrCodeUpload"
- ref="upload"
- list-type="picture-card"
- :data="dialog"
- :on-success="handleImgSuccess"
- :before-upload="handleImgbefore"
- :auto-upload="true">
- <i slot="default" class="el-icon-plus"></i>
- <div slot="file" slot-scope="{file}">
- <img
- class="el-upload-list__item-thumbnail"
- :src="file.url" alt=""
- >
- <span class="el-upload-list__item-actions">
- <span
- class="el-upload-list__item-preview"
- @click="handlePictureCardPreview(file)"
- >
- <i class="el-icon-zoom-in"></i>
- </span>
- <span
- v-if="!disabled"
- class="el-upload-list__item-delete"
- @click="handleDownload(file)"
- >
- <i class="el-icon-download"></i>
- </span>
- </span>
- </div>
- </el-upload>
- <img
- v-if="dialog.imgSrc"
- class="editImg"
- :src="dialog.imgSrc" alt=""
- >
- <el-dialog :visible.sync="dialogVisible">
- <img width="100%" :src="dialogImageUrl" alt="">
- </el-dialog>
- </el-col>
- </el-row>
- </div>
- </dialog_referrer_list>
- </div>
- </template>
- <script>
- import Global from '../Global.js'
- import dialog_referrer_list from '../components/dialog_referrer_list'
- import {
- GetRegionAndDectorSelect,
- GetQrcodeList,
- QrCodeAdd,
- QrCodeEdit,
- QrcodeEditStatus,
- } from '../api/getApiRes.js'
- let qs = require('qs');
- export default {
- data() {
- return {
- // dialog
- dialog_state: false,
- dialog_title: '添加二维码',
- dialog_type: '',//类型,1是添加,2是修改
- tabIndex: 0,
- tabs: [
- {name: '二维码管理', url: 'qrcodemanage'},
- ],
- // panel 配置项目
- panel: {
- qrcodename: '',
- timeLimit: 0,
- options: [
- {value: 0, label: '全部'},
- {value: 1, label: '无期限'},
- {value: 2, label: '有时限'},
- ],
- time1: globalBt2(),
- },
- dialog: {
- shopID: 1,//One and always is one
- comID: 1,//One and always is one
- qrcodeid: 0,//One and always is one
- token: localStorage.token,
- comname: '',
- tel: '',
- qrname: '',
- detId: '',
- detidstr: '',
- frequency: '',
- timeType: '1',
- memo: '',
- imagekey: '',
- imgSrc: '',
- validType: 0,
- detOptions: [],
- checkList: [],
- timeOptions: [
- {value: 0, label: '分钟'},
- {value: 1, label: '小时'},
- {value: 2, label: '天'},
- {value: 3, label: '月(30天)'},
- {value: 4, label: '年'},
- ],
- },
- pageination: {
- pageItem: 10,
- pageoptions: pageOptions(),
- total: 300,
- pageIndex: 1,
- },
- draw: 1,
- start: 0,
- recordsTotal: 0,
- tableData: [],
- allTableData: [],
- limit: '10',
- multipleSort: false,
- loading: true,
- fileList: [],
- dialogVisible: false,
- disabled: false,
- plateTitle: '',
- plateImg: false,
- loftListState: false,
- multipleSelection: [],
- detectedmac: '',
- plateImgSrc: '',
- dialogImageUrl: '',
- }
- },
- mounted() {
- this.getTableQuery();
- this.getDetList();
- },
- methods: {
- // 跳转tab页面
- goTab(url) {
- this.$router.push({path: url});
- },
- // 查询按钮
- query() {
- this.getTableQuery();
- this.$message.success('查询完毕');
- },
- handleImgbefore(file) {
- this.dialog.image = file;
- this.dialog.imgSrc = '';
- },
- handleImgSuccess(res, file) {
- let that = this;
- if (res.Code == 0) {
- that.dialog.imagekey = res.Key
- } else {
- that.$message.error(res.Memo);
- }
- },
- handleSelectionChange(val) {
- this.multipleSelection = val;
- console.log(val);
- },
- // 获取探测器列表
- getDetList() {
- let param = {
- 'token': localStorage.token,
- };
- let postdata = qs.stringify(param);
- GetRegionAndDectorSelect(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- this.dialog.detOptions = json.DectectorRs;
- }
- })
- },
- // 页面数据查询
- getTableQuery() {
- let that = this;
- that.loading = true;
- let param = {
- token: localStorage.token,
- comid: 0,
- qrcodename: that.panel.qrcodename,
- timeLimit: that.panel.timeLimit,
- cdtbt: globaltime2String(that.panel.time1[0]) + ' 00:00:01',//开始时间
- cdtet: globaltime2String(that.panel.time1[1]) + ' 23:59:59',//结束时间
- start: 1,//
- tableMax: 300,//
- };
- let postdata = qs.stringify(param);
- GetQrcodeList(postdata).then(res => {
- let json = res;
- that.loading = false;
- if (json.Code == 0) {
- if (json.Rs) {
- that.allTableData = json.Rs;
- that.recordsTotal = json.Rs.length;
- } else {
- that.allTableData = [];
- that.recordsTotal = 0;
- }
- // 设置分页数据
- that.setPaginations();
- } else {
- that.$message.error(json.Memo);
- }
- })
- },
- // 设置分页数据
- setPaginations() {
- // 分页属性
- let that = this;
- that.pageination.total = that.recordsTotal;
- // 默认分页
- that.tableData = that.allTableData.filter((item, index) => {
- return index < that.pageination.pageItem;
- });
- },
- // 每页显示数量
- handleSizeChange() {
- let that = this;
- that.tableData = that.allTableData.filter((item, index) => {
- return index < that.pageination.pageItem;
- });
- that.draw = that.pageination.pageItem;
- that.getTableQuery();
- },
- // 翻页
- pageChange(pageIndex) {
- let that = this;
- // 获取当前页
- let index = that.pageination.pageItem * (pageIndex - 1);
- // 数据总数
- let nums = that.pageination.pageItem * pageIndex;
- // 容器
- let tables = [];
- for (var i = index; i < nums; i++) {
- if (that.allTableData[i]) {
- tables.push(that.allTableData[i])
- }
- this.tableData = tables;
- }
- that.start = index * that.draw;
- that.getTableQuery();
- },
- // 自动排序
- sortChange(params) {
- console.log(params)
- },
- // 过滤时间
- filterFmtDate(value, row, column) {
- let that = this;
- return globalfmtDate(column, 11);
- },
- addList() {
- this.dialog_state = true;
- this.dialog_title = '添加二维码';
- this.dialog_type = 1;
- // clear
- this.dialog.detId = '';
- this.dialog.timeType = '1';
- this.dialog.memo = '';
- this.dialog.checkList = [];
- },
- delList() {
- let that = this;
- // checkNum
- if (!this.multipleSelection.length) {
- that.$message({
- showClose: true,
- message: '错了哦,需要先选中至少一条记录',
- type: 'error'
- });
- return false
- }
- let qrcodeid = that.multipleSelection[0].QrId;
- let param = {
- token: localStorage.token,
- qrcodeid: qrcodeid,
- status: 9,//0禁用1启用9删除
- };
- let postdata = qs.stringify(param);
- this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- QrcodeEditStatus(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: '选中的二维码已删除!',
- type: 'success'
- });
- // 重载列表
- that.getTableQuery();
- that.dialog_state = false;
- } else {
- that.$message.error(json.Memo);
- }
- });
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- changeList() {
- let that = this;
- // checkNum
- if (!this.multipleSelection.length) {
- this.$message({
- showClose: true,
- message: '错了哦,需要先选中一条记录',
- type: 'error'
- });
- return false
- }
- if (this.multipleSelection.length > 1) {
- this.$message({
- showClose: true,
- message: '错了哦,只能选中一条记录',
- type: 'error'
- });
- return false
- }
- this.dialog_state = true;
- this.dialog_title = '修改二维码';
- that.dialog_type = 2;
- let row = this.multipleSelection[0];
- this.dialog.comname = row.ComName;
- this.dialog.qrcodeid = row.QrId;
- this.dialog.tel = row.Tel;
- this.dialog.qrname = row.QrName;
- this.dialog.memo = row.Memo;
- this.dialog.checkList = row.DetIdStr.split(',').map(Number);
- // 为0时候表示无限期
- // 获取时限类型
- let timeType = parseInt(row.Frequency);
- if (timeType == 0) {
- that.dialog.timeType = "1";
- } else {
- that.dialog.timeType = "2";
- }
- },
- // 探测记录
- goRecord(row) {
- console.log(row);
- this.$router.push({path: '/record', query: {row: row}});
- },
- dialog_cancel() {
- let that = this;
- that.dialog_state = false;
- },
- dialog_ok() {
- console.log(this.dialog_type);
- if (this.dialog_type == 1) {
- this.confirmAddQrcode();
- } else {
- this.confirmEditQrcode();
- }
- },
- // 确认添加新的二维码
- confirmAddQrcode() {
- // checkVal
- let that = this;
- // checkVal
- if (!that.dialog.comname) {
- this.$message.error('错了哦,区域名称不能空');
- return false
- }
- if (that.dialog.comname.length > 20) {
- this.$message.error('错了哦,区域名称不能超过20个字符');
- return false
- }
- if (!that.dialog.qrname) {
- this.$message.error('错了哦,二维码名称不能空');
- return false
- }
- if (that.dialog.qrname.length > 20) {
- this.$message.error('错了哦,二维码名称不能超过20个字符');
- return false
- }
- if (!that.dialog.tel) {
- this.$message.error('错了哦,电话名称不能空');
- return false
- }
- let detidstr = that.dialog.checkList;
- if (!detidstr) {
- this.$message.error('错了哦,至少勾选一个探测器');
- return false
- }
- let extime = 0;
- if (that.dialog.timeType == 0) {
- extime = 0;//无限时
- } else {
- switch (parseInt(that.dialog.validType)) {
- case 0://分钟
- extime = that.dialog.frequency * 1;
- break;
- case 1://小时
- extime = that.dialog.frequency * 60;
- break;
- case 2://天
- extime = that.dialog.frequency * 60 * 24;
- break;
- case 3://月
- extime = that.dialog.frequency * 60 * 24 * 30;
- break;
- case 4://年
- extime = that.dialog.frequency * 60 * 24 * 30 * 12;
- break;
- }
- }
- let param = {
- token: localStorage.token,
- comname: that.dialog.comname,
- comid: 1,
- qrname: that.dialog.qrname,
- tel: that.dialog.tel,
- memo: that.dialog.memo,
- detidstr: detidstr.join(',') + ',',
- frequency: extime,
- imagekey: that.dialog.imagekey,
- };
- let postdata = qs.stringify(param);
- QrCodeAdd(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: '创建成功,前往二维码页面进行查看!',
- type: 'success'
- });
- // 二维码页面 页面跳转
- that.$router.push({
- path: '/createmeetingqrcode',
- query: {
- shopname: that.dialog.comname,
- qrname: that.dialog.qrname,
- qrcodeId: json.Id,
- }
- });
- // 重载列表
- that.getTableQuery()
- } else {
- that.$message.error(json.Memo);
- }
- });
- that.dialog_state = false;
- },
- // 确认修改旧的二维码
- confirmEditQrcode() {
- // checkVal
- let that = this;
- // checkVal
- if (!that.dialog.comname) {
- this.$message.error('错了哦,区域名称不能空');
- return false
- }
- if (that.dialog.comname.length > 20) {
- this.$message.error('错了哦,区域名称不能超过20个字符');
- return false
- }
- if (!that.dialog.qrname) {
- this.$message.error('错了哦,二维码名称不能空');
- return false
- }
- if (that.dialog.qrname.length > 20) {
- this.$message.error('错了哦,二维码名称不能超过20个字符');
- return false
- }
- if (!that.dialog.tel) {
- this.$message.error('错了哦,电话名称不能空');
- return false
- }
- let detidstr = that.dialog.checkList;
- if (!detidstr) {
- this.$message.error('错了哦,至少勾选一个探测器');
- return false
- }
- let extime = 0;
- if (that.dialog.timeType == 0) {
- extime = 0;//无限时
- } else {
- switch (parseInt(that.dialog.validType)) {
- case 0://分钟
- extime = that.dialog.frequency * 1;
- break;
- case 1://小时
- extime = that.dialog.frequency * 60;
- break;
- case 2://天
- extime = that.dialog.frequency * 60 * 24;
- break;
- case 3://月
- extime = that.dialog.frequency * 60 * 24 * 30;
- break;
- case 4://年
- extime = that.dialog.frequency * 60 * 24 * 30 * 12;
- break;
- }
- }
- let param = {
- token: localStorage.token,
- comname: that.dialog.comname,
- comid: 1,
- qrname: that.dialog.qrname,
- tel: that.dialog.tel,
- memo: that.dialog.memo,
- detidstr: detidstr.join(',') + ',',
- frequency: extime,
- imagekey: that.dialog.imagekey,
- qrcodeid: that.dialog.qrcodeid,
- };
- let postdata = qs.stringify(param);
- QrCodeEdit(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: '创建成功,前往二维码页面进行查看!',
- type: 'success'
- });
- // 二维码页面 页面跳转
- that.$router.push({
- path: '/createmeetingqrcode',
- query: {
- shopname: that.dialog.comname,
- qrname: that.dialog.qrname,
- qrcodeId: json.Id,
- }
- });
- // 重载列表
- that.getTableQuery()
- } else {
- that.$message.error(json.Memo);
- }
- });
- that.dialog_state = false;
- },
- // 禁用二维码
- pauseQrcode(row) {
- let that = this;
- let param = {
- token: localStorage.token,
- qrcodeid: row.QrId,
- status: 0//新状态0禁用1启用 9删除
- };
- let postdata = qs.stringify(param);
- this.$confirm('是否禁用' + row.QrName + '的二维码?', '禁用操作', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- // // ajax todo
- // RegionStatusEdit(postdata).then(res => {
- // let json = res;
- // if (json.Code == 0) {
- that.$message({
- type: 'success',
- message: `禁用成功`
- });
- that.getTableQuery();
- // } else {
- // that.$message.error(json.Memo);
- // }
- // })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消禁用'
- });
- });
- },
- // 查看海报
- goPoster(node) {
- this.$router.push({
- path: '/poster',
- query: {
- shopname: 1,
- ComName: node.ComName,
- qrname: node.QrName,
- qrcodeId: node.QrId,
- vfcode: node.Vfcode,
- }
- })
- },
- // 查看二维码
- goQrcode(node) {
- this.$router.push({
- path: '/createmeetingqrcode',
- query: {
- shopname: 1,
- ComName: node.ComName,
- qrname: node.QrName,
- qrcodeId: node.QrId,
- vfcode: node.Vfcode,
- }
- })
- },
- },
- filters: {
- fmtDate: function (value) {
- let res = '';
- if (!value) {
- return '---';
- } else {
- res = new Date(+new Date(value) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '');
- return res;
- }
- }
- }
- ,
- components: {
- dialog_referrer_list
- }
- }
- </script>
- <style scoped>
- @import "../assets/css/panel.css";
- @import "../assets/css/dialog.css";
- .tabs ul {
- width: 168px;
- }
- table span {
- cursor: pointer;
- }
- .control_btn {
- float: left;
- margin: 0 4px;
- }
- .content {
- width: 100%;
- height: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .modal-content .el-select {
- display: block;
- }
- /deep/ .modal-content .el-select .el-input .el-select__caret {
- position: relative;
- top: 10px;
- line-height: 0px !important;
- }
- /deep/ .el-radio {
- width: 45%;
- height: 35px;
- float: left;
- padding-top: 10px;
- }
- /deep/ .el-radio__input {
- float: left;
- }
- /deep/ .el-radio__inner {
- float: left;
- }
- /deep/ .el-radio__label {
- float: left;
- }
- .short {
- width: 40%;
- float: left;
- margin-right: 10px;
- }
- .red {
- color: red !important;
- }
- /deep/ .modal-body {
- width: 100%;
- height: 400px;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- margin-bottom: 40px;
- }
- /*upload*/
- /deep/ .el-upload--picture-card {
- float: left;
- background: none;
- border: 1px solid #005EA2;
- color: #005EA2;
- }
- /deep/ .el-upload--picture-card i {
- color: #005EA2;
- }
- .editImg {
- width: 140px;
- height: 140px;
- float: left;
- margin-left: 30px;
- }
- </style>
|