基于廊坊系统为基础,国防科技大学系统演示Demo
surprise
2024-04-29 8a90585f32ff7f0ceb807581db2d7b59e9820874
src/views/userManage/templateManage.vue
@@ -1,18 +1,25 @@
<template>
  <div class="authorityManagement_box">
    <My-bread :list="[
      `${$t('dataManage.dataManage')}`,
      `${$t('dataManage.templateManage')}`,
      `数据资源管理`,
      `通用模板管理`,
    ]"></My-bread>
    <el-divider />
    <div class="searchComp subpage_Div" ref="container">
      <el-form ref="ruleForm" :model="ruleForm" :inline="true">
    <div class="searchComp subpage_Div"
         ref="container">
      <el-form ref="ruleForm"
               :model="ruleForm"
               :inline="true">
        <div class="flex_box">
          <div style="margin-right: auto">
            <el-form-item :label="$t('userManage.authorityM.name')">
              <el-input style="width:200px" size="small" v-model="ruleForm.name"
              <el-input style="width:200px"
                        size="small"
                        v-model="ruleForm.name"
                :placeholder="$t('userManage.authorityM.nameHolder')">
                <i slot="suffix" class="el-icon-search" @click="setRefreshTable"></i>
                <i slot="suffix"
                   class="el-icon-search"
                   @click="setRefreshTable"></i>
              </el-input>
            </el-form-item>
          </div>
@@ -27,16 +34,25 @@
            <!--              >{{ $t('common.iquery') }}</el-button>-->
            <!--            </el-form-item>-->
            <el-form-item>
              <el-button v-if="btnStatus.insert" @click="setTableInsert" icon="el-icon-edit" type="success"
              <el-button v-if="btnStatus.insert"
                         @click="setTableInsert"
                         icon="el-icon-edit"
                         type="success"
                size="small">{{ $t('common.append') }}</el-button>
            </el-form-item>
            <el-form-item>
              <el-button v-if="btnStatus.delete" icon="el-icon-delete" @click="delTableData" type="danger"
              <el-button v-if="btnStatus.delete"
                         icon="el-icon-delete"
                         @click="delTableData"
                         type="danger"
                size="small">{{
      $t('common.delete') }}</el-button>
            </el-form-item>
            <el-form-item>
              <el-button icon="el-icon-refresh" @click="restRefreshTable" type="info" size="small">{{ $t('common.empty')
              <el-button icon="el-icon-refresh"
                         @click="restRefreshTable"
                         type="info"
                         size="small">{{ $t('common.empty')
                }}</el-button>
            </el-form-item>
          </div>
@@ -45,20 +61,35 @@
      </el-form>
    </div>
    <div class="dividing-line"></div>
    <div class="table_box" :style="styleVar">
      <el-table :data="tableData" style="width: 100%" border @selection-change="handleSelectionChange"
        height="calc(100% - 45px)">
        <el-table-column type="selection" width="55" />
        <el-table-column align="center" type="index" :label="$t('dataManage.styleObj.index')" width="70px" />
        <el-table-column align="center" prop="name" :label="$t('dataManage.styleObj.name')" />
        <el-table-column align="center" prop="type" :label="$t('common.fileType')">
    <div class="table_box"
         :style="styleVar">
      <el-table :data="tableData"
                style="width: 100%"
                border
                @selection-change="handleSelectionChange"
                height="calc(100% - 65px)">
        <el-table-column type="selection"
                         width="55" />
        <el-table-column align="center"
                         type="index"
                         :label="$t('dataManage.styleObj.index')"
                         width="70px" />
        <el-table-column align="center"
                         prop="name"
                         :label="$t('dataManage.styleObj.name')" />
        <el-table-column align="center"
                         prop="type"
                         :label="$t('common.fileType')">
          <template slot-scope="scope">
            <span v-if="scope.row.type == 1">World模板 </span>
            <span v-else-if="scope.row.type == 2">Excel模板</span>
            <span v-else-if="scope.row.type == 3">Zip模板</span>
          </template>
        </el-table-column>
        <el-table-column align="center" prop="code" :label="$t('common.templateType')" :formatter="codeData" />
        <el-table-column align="center"
                         prop="code"
                         :label="$t('common.templateType')"
                         :formatter="codeData" />
        <!-- <el-table-column
          align="center"
          prop="fname"
@@ -69,25 +100,43 @@
          prop="bak"
          :label="$t('common.bak')"
        /> -->
        <el-table-column align="center" prop="createName" :label="$t('dataManage.vmobj.createonuser')" />
        <el-table-column align="center" prop="createTime" :label="$t('dataManage.vmobj.createontime')"
        <el-table-column align="center"
                         prop="createName"
                         :label="$t('dataManage.vmobj.createonuser')" />
        <el-table-column align="center"
                         prop="createTime"
                         :label="$t('dataManage.vmobj.createontime')"
          :formatter="formatData" />
        <el-table-column min-width="100" :label="$t('dataManage.dictionaryManageObj.operation')">
        <el-table-column min-width="100"
                         :label="$t('dataManage.dictionaryManageObj.operation')">
          <template slot-scope="scope">
            <el-button v-if="btnStatus.select" @click="showDetail(scope.$index, scope.row)" type="primary" plain
            <el-button v-if="btnStatus.select"
                       @click="showDetail(scope.$index, scope.row)"
                       type="primary"
                       plain
              size="small">{{ $t('dataManage.dictionaryManageObj.lookOver') }}</el-button>
            <el-button v-if="btnStatus.update" @click="handleEdit(scope.$index, scope.row)" type="warning" plain
            <el-button v-if="btnStatus.update"
                       @click="handleEdit(scope.$index, scope.row)"
                       type="warning"
                       plain
              size="small">{{ $t('dataManage.dictionaryManageObj.revamp') }}</el-button>
            <el-button v-if="btnStatus.download" plain @click="handleDownload(scope.$index, scope.row)" type="info"
            <el-button v-if="btnStatus.download"
                       plain
                       @click="handleDownload(scope.$index, scope.row)"
                       type="info"
              size="small">{{ $t('common.download') }}</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div style="margin-top:10px">
        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
          :current-page="listData.pageIndex" :page-sizes="[10, 20, 50, 100]" :page-size="listData.pageSize"
          layout="total, sizes, prev, pager, next, jumper" :total="listData.count">
        <el-pagination @size-change="handleSizeChange"
                       @current-change="handleCurrentChange"
                       :current-page="listData.pageIndex"
                       :page-sizes="[10, 20, 50, 100]"
                       :page-size="listData.pageSize"
                       layout="total, sizes, prev, pager, next, jumper"
                       :total="listData.count">
        </el-pagination>
      </div>
    </div>
@@ -95,11 +144,17 @@
    <el-dialog :title="behavior == '新增'
      ? `${$t('common.append')}`
      : `${$t('common.update')}`
      " :visible.sync="dialogVisible" :before-close="handleClose">
      "
               :visible.sync="dialogVisible"
               :before-close="handleClose">
      <div style="height: 500px; overflow: auto">
        <el-form ref="form" :model="editForm" label-width="100px" label-position="top">
        <el-form ref="form"
                 :model="editForm"
                 label-width="100px"
                 label-position="top">
          <el-form-item :label="$t('dataManage.styleObj.name')">
            <el-input style="width:85%" v-model="editForm.name"
            <el-input style="width:85%"
                      v-model="editForm.name"
              :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuetwo') + $t('dataManage.styleObj.name')"></el-input>
          </el-form-item>
          <el-form-item :label="$t('common.templateType')">
@@ -107,17 +162,30 @@
              style="width:100%"
              v-model=" editForm.code"
            ></el-input> -->
            <el-select :popper-append-to-body="false" style="width:85%" @change="selFileCodeChange"
            <el-select :popper-append-to-body="false"
                       style="width:85%"
                       @change="selFileCodeChange"
              v-model="editForm.code"
                       disabled
              :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuetree') + $t('dataManage.common.templateType')">
              <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
              <el-option v-for="item in options"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item :label="$t('common.fileType')">
            <el-select :popper-append-to-body="false" v-model="editForm.type" @change="selFileTypeChange"
              :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuetree') + $t('common.fileType')" style="width:85%">
              <el-option v-for="item in typeOption" :key="item.value" :label="item.label" :value="item.value">
            <el-select :popper-append-to-body="false"
                       v-model="editForm.type"
                       @change="selFileTypeChange"
                       disabled
                       :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuetree') + $t('common.fileType')"
                       style="width:85%">
              <el-option v-for="item in typeOption"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value">
              </el-option>
              <!-- <el-option
                label="World模板"
@@ -137,38 +205,66 @@
          <el-form-item :label="$t('common.filePath')">
            <div class="BoxFlex">
              <div class="BoxFlexinput">
                <el-input v-model="editForm.fname" disabled autocomplete="off" style="width:100%"></el-input>
                <el-input v-model="editForm.fname"
                          disabled
                          autocomplete="off"
                          style="width:100%"></el-input>
              </div>
              <div class="BoxFlexbutton">
                <input name="file1" type="file" id="editFile" multiple="multiple" :accept="selectFileType"
                  style="display: none" @change="geteditFile(1)" />
                <el-button style="margin-left: 6px;" type="primary" size="small" :underline="false"
                <input name="file1"
                       type="file"
                       id="editFile"
                       multiple="multiple"
                       :accept="selectFileType"
                       style="display: none"
                       @change="geteditFile(1)" />
                <el-button style="margin-left: 6px;"
                           type="primary"
                           size="small"
                           :underline="false"
                  @click="geteditFile(0)">选择</el-button>
                <el-button type="primary" size="small" :underline="false" @click="geteditFile(2)">上传</el-button>
                <el-button type="primary"
                           size="small"
                           :underline="false"
                           @click="geteditFile(2)">上传</el-button>
              </div>
            </div>
          </el-form-item>
          <el-form-item :label="$t('common.bak')">
            <el-input style="width:85%" v-model="editForm.bak"
            <el-input style="width:85%"
                      v-model="editForm.bak"
              :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuetwo') + $t('common.bak')"></el-input>
          </el-form-item>
        </el-form>
      </div>
      <div v-if="behavior == '新增'" slot="footer" class="dialog-footer">
        <el-button size="small" @click="closeInsertData">取 消</el-button>
        <el-button type="primary" size="small" @click="addInsertData">确 定</el-button>
      <div v-if="behavior == '新增'"
           slot="footer"
           class="dialog-footer">
        <el-button size="small"
                   @click="closeInsertData">取 消</el-button>
        <el-button type="primary"
                   size="small"
                   @click="addInsertData">确 定</el-button>
      </div>
      <div v-if="behavior != '新增'" slot="footer" class="dialog-footer">
        <el-button size="small" @click="closeEditData">取 消</el-button>
        <el-button type="primary" size="small" @click="addEditData">确 定</el-button>
      <div v-if="behavior != '新增'"
           slot="footer"
           class="dialog-footer">
        <el-button size="small"
                   @click="closeEditData">取 消</el-button>
        <el-button type="primary"
                   size="small"
                   @click="addEditData">确 定</el-button>
      </div>
    </el-dialog>
    <div class="infoBox_box" v-show="showinfoBox">
    <div class="infoBox_box"
         v-show="showinfoBox">
      <div class="infoBox subpage_Div box_div">
        <div slot="header" class="clearfix">
        <div slot="header"
             class="clearfix">
          <span>{{ $t('dataManage.styleObj.deInformation') }}</span>
          <div style="float: right; cursor: pointer" @click="closeDetial">
          <div style="float: right; cursor: pointer"
               @click="closeDetial">
            <i class="el-icon-close"></i>
          </div>
        </div>
@@ -225,7 +321,9 @@
      </div>
    </div>
    <iframe id="downFrame" src="" style="display: none; border: 0; padding: 0; height: 0; width: 0"></iframe>
    <iframe id="downFrame"
            src=""
            style="display: none; border: 0; padding: 0; height: 0; width: 0"></iframe>
  </div>
</template>
@@ -439,23 +537,14 @@
      console.log(name)
      if (name.indexOf('统计') > -1) {
        this.typeOption = [{
          label: "World模板",
          value: "1"
        }, {
          label: "Excel模板",
          value: "2"
        }]
      } else {
        this.typeOption = [{
          label: "World模板",
          value: "1"
        }, {
          label: "Excel模板",
          value: "2"
        }, {
          label: "Zip模板",
          value: "3"
        }]
      }
      this.editForm.type = this.typeOption[0].value
@@ -590,11 +679,12 @@
    //文件上传
    async geteditFile(res) {
      if (parseInt(this.editForm.type) == 1) {
        this.selectFileType = ".docx";
      } else if (parseInt(this.editForm.type) == 2) {
      // if(parseInt(this.editForm.type)==1) {
      //   this.selectFileType=".docx";
      // } else if(parseInt(this.editForm.type)==2) {
      //   this.selectFileType=".xlsx";
      // }
        this.selectFileType = ".xlsx";
      }
      this.$nextTick(() => {
        this.setEditFile(res)
      })
@@ -677,23 +767,14 @@
      if (name.indexOf('统计') > -1) {
        this.typeOption = [{
          label: "World模板",
          value: "1"
        }, {
          label: "Excel模板",
          value: "2"
        }]
      } else {
        this.typeOption = [{
          label: "World模板",
          value: "1"
        }, {
          label: "Excel模板",
          value: "2"
        }, {
          label: "Zip模板",
          value: "3"
        }]
      }
      this.editForm.type = this.typeOption[0].value
@@ -742,10 +823,11 @@
<style lang="less" scoped>
//@import url(); 引入公共css类
.authorityManagement_box {
  height: 98%;
  width: 98%;
  height: calc(97.5% - 20px);
  width: calc(99% - 20px);
  padding: 0.5%;
  background: #f4f8ff;
  margin: 10px;
  .el-input {
    width: 730px;
  }