algo_template.vue 5.17 KB
<template>
    <div class="innnerBox">
    <el-col :span="22">
      <el-form ref="form" label-width="80px" inline>
         <el-form-item label="模板名称">
          <span class="selectBox">
          <el-input v-model="algoname" placeholder="模板名称" class="algo-header-left"></el-input>
          </span>
        </el-form-item>
				 <el-form-item label="业务类型">
          <span class="selectBox">
          <el-select v-model="algoSet" placeholder="业务类型" class="algo-header-left">
            <el-option value="jiaotong" label="交通算法"></el-option>
            <el-option value="zongzhi" label="城市综合治理算法"></el-option>
            <el-option value="shequ" label="社区管理算法"></el-option>
            <el-option value="renlian" label="人脸识别算法"></el-option>
            <el-option value="yuyi" label="语义分析算法"></el-option>
            <el-option value="wenben" label="文本识别算法"></el-option>
          </el-select>
          </span>
        </el-form-item>
      </el-form>
    </el-col>
		 <el-col :span="2">
				<el-button class="" type="primary" @click="createTpl">添加</el-button>
        <el-button class="mt10" @click="refreshAlgo">查询</el-button>
    </el-col>
    <div class="table-box mt10" >
      <el-table :data="tableData" tooltip-effect="dark" ref="multipleTable" height="700" style="width: 100%"  @selection-change="handleSelectionChange">
        <el-table-column type="index" width="55">
        </el-table-column>
        <el-table-column prop="tid" align="center" label="模板编号">
        </el-table-column>
        <el-table-column prop="tplname" align="center" label="模板名称">
        </el-table-column>
        <el-table-column align="center" label="创建时间">
          <template slot-scope="scope">
            <div>
              {{scope.row.create_dt ? scope.row.create_dt : '无'}}
            </div>
          </template>
        </el-table-column>
        <el-table-column align="center" label="操作">
          <template slot-scope="scope">
            <div>
              <span class="det-btn" @click="tpdetail(scope.row)">详情</span>
              <span class="del-btn"  @click="deltem(scope.$index, tableData)">删除</span>
            </div>
          </template>
        </el-table-column>
      </el-table>
      <div>
          <el-pagination   style="float: right;" class="mt10" @size-change="handleSizeChange" @current-change="handleCurrentChange"
          :current-page="search.currentPage" :page-sizes="[20,100, 200, 300, 400]" :page-size="search.size"
          layout="total, sizes, prev, pager, next, jumper" :total="search.total">
        </el-pagination>
      </div>
    </div>
    <div>
      <addTemplate ref="addtpl" @refresh="getData"></addTemplate>
    </div>
    <div>
      <tplDetails :tplData="tplData" ref="tpldetail"></tplDetails>
    </div>
  </div>
</template>
<script>
import tplDetails from "./temDetail";
import addTemplate from "./addTpl";
  export default {
    data() {
      return {
        algoSet: '',
        addalgoSet:'video',
        tableData: [],
        algoname:'',
        isShow: false,
        details: [],
        fileList:[],
        tplData:[],
        search:{
          size:20,
          limit:20,
          offset:0,
          currentPage:0,
          total:0
        }
      }
    },
    components: {
        tplDetails,
        addTemplate,
    },
    methods: {
      handlePreview(){},
      submitUpload() {
        this.$refs.upload.submit();
      },
      addalgomanage(){
        this.isShow = true;
      },
      handleSelectionChange(){
        this.refreshAlgo();
      },
      refreshAlgo() {
        this.getData();
        this.search.offset = 0;
        this.search.currentPage = 1;
      },
      getData() {
        let LtableData =  localStorage.getItem("tplData");
        if(LtableData) {
          this.tableData =  JSON.parse(LtableData)
        } else {
          this.tableData = [];
          //  localStorage.setItem("tplData", JSON.stringify( this.tableData));
        }
      },
      handleSizeChange(val){
        this.search.limit = val
        this.getData()
      },
      handleCurrentChange(val){
        this.search.currentPage = val;
        this.search.offset = (val-1)*this.search.size
        this.getData()
      },
      filterAlgoName: function (str) {
				var zhType = '';
				switch (str) {
					case 'traffic':
						zhType ='交通';
						break;
					case 'Safety':
						zhType ='安防';
						break;
					case 'FlowCount':
						zhType ='客流';
						break;
					default:
						break;
				}
				return zhType;
      },
      createTpl: function () {
            this.$refs.addtpl.tplInit(this.templateType);
      },
      tpdetail(data){
          setTimeout(()=>{
            this.$refs.addtpl.editInit(data);
          },0)
      },
      deltem(index, rows){
        rows.splice(index, 1);
        localStorage.setItem("tplData", JSON.stringify( this.tableData))
      }
    },
    created() {
      this.getData()
    },
  }

</script>
<style lang="stylus" scoped>
.search-item{
  overflow hidden
}
.det-btn{
  padding 0 10px
  color #409EFF
  cursor pointer
}
.del-btn{
  padding 0 10px
  color #F56C6C
  cursor pointer
}
</style>