yxh
2023-03-21 76bd95ca79b03b84f6d011a81794aabcdeef169b
ruoyi-ui/src/views/smartor/svytitle/index.vue
@@ -1,347 +1,259 @@
<template>
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
            <el-form-item label=" 问卷类别 " prop="categoryid">
                <el-input v-model="queryParams.categoryid" placeholder="请输入 问卷类别 " clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label=" 问卷名称 " prop="svyname">
                <el-input v-model="queryParams.svyname" placeholder="请输入 问卷名称 " clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label=" 是否启用 " prop="isenable">
                <el-input v-model="queryParams.isenable" placeholder="请输入 是否启用 " clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label=" 归属机构 " prop="orgid">
                <el-input v-model="queryParams.orgid" placeholder="请输入 机构ID " clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
        </el-form>
        <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
                <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['smartor:svytitle:add']">新增</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['smartor:svytitle:edit']">修改</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['smartor:svytitle:remove']">删除</el-button>
            </el-col>
            <el-col :span="1.5">
                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['smartor:svytitle:export']">导出</el-button>
            </el-col>
            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
        </el-row>
        <el-table v-loading="loading" :data="svytitleList" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55" align="center" />
            <el-table-column label=" 问卷类别 " width="120" align="center" prop="categoryid" />
            <el-table-column label=" 问卷代码 " width="120" align="center" prop="svycode" />
            <el-table-column label=" 问卷名称 " width="200" align="center" prop="svyname" />
            <el-table-column label=" 描述 " width="300" align="center" prop="description" />
            <el-table-column label=" 采用模板 " width="120" align="center" prop="templateid" />
            <el-table-column label=" 版本 " width="120" align="center" prop="version" />
            <el-table-column label=" 是否启用 " width="120" align="center" prop="isenable" />
            <el-table-column label=" 归属机构 " width="200" align="center" prop="orgid" />
            <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                <template slot-scope="scope">
              <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
                v-hasPermi="['smartor:svytitle:edit']">修改</el-button>
              <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
                v-hasPermi="['smartor:svytitle:remove']">删除</el-button>
</template>
      </el-table-column>
    </el-table>
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />
    <!-- 添加或修改问卷对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-row>
          <el-col :span="8">
            <el-form-item label=" 问卷代码 " prop="svycode">
              <el-input v-model="form.svycode" placeholder="请输入 问卷代码 " />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label=" 问卷名称 " prop="svyname">
              <el-input v-model="form.svyname" placeholder="请输入 问卷名称 " />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label=" 问卷分类 " prop="categoryid">
              <el-input v-model="form.categoryid" placeholder="请输入 问卷分类ID " />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-form-item label=" 问卷描述 " prop="description">
            <el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
          </el-form-item>
        </el-row>
        <el-row>
          <el-form-item label=" 问卷介绍 " prop="introduce">
            <el-input v-model="form.introduce" type="textarea" placeholder="请输入内容" />
          </el-form-item>
        </el-row>
        <el-row>
          <el-form-item label=" 问卷提示 " prop="submitprompt">
            <el-input v-model="form.submitprompt" type="textarea" placeholder="请输入内容" />
          </el-form-item>
        </el-row>
        <el-row>
          <el-form-item label=" 归属机构 " prop="orgid">
            <el-input v-model="form.orgid" placeholder="请输入 机构ID " />
          </el-form-item>
        </el-row><el-row><el-col :span="8">
            <el-form-item label=" 版本 " prop="version">
              <el-input v-model="form.version" placeholder="请输入 版本 " />
            </el-form-item></el-col><el-col :span="8">
            <el-form-item label=" 是否启用 " prop="isenable">
              <el-input v-model="form.isenable" placeholder="请输入 是否启用 " />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label=" 采用模板 " prop="templateid">
              <el-input v-model="form.templateid" placeholder="请输入 模板ID " />
            </el-form-item></el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  <div>
    <div style="height:32pt" />
    <div style="padding-left:16pt;">
      <el-input placeholder="请输入内容" v-model="input3" class="input-with-select">
        <!--el-select v-model="select" slot="prepend" placeholder="请选择">
          <el-option label="餐厅名" value="1"></el-option>
          <el-option label="订单号" value="2"></el-option>
          <el-option label="用户电话" value="3"></el-option>
        </el-select-->
        <el-button slot="append" icon="el-icon-search" style="width:32pt"></el-button>
      </el-input>
      <!--el-button type="primary" icon="el-icon-search">搜索</el-button-->
      <el-button size="small" type1="primary" @click="handleQueryGrid">表检索</el-button>
      <el-button size="small" type1="primary" @click="handleQueryTree">树检索</el-button>
    </div>
    <div id="content">
      <div v-for="(item,i) in svytitleList" :key="i" style="margin-left:12pt;margin-top:12pt">
            <a style="color:#000080;font-size:11pt">{{item.svyname}}({{item.version}})</a>
            <div>{{item.description}}</div>
       </div>
    </div>
  </div>
</template>
<style>
  .input-with-select
  {
    width:50%;
    margin-right: 12pt;
  }
</style>
<script>
import { listSvytitle, getSvytitle, delSvytitle, addSvytitle, updateSvytitle } from "@/api/smartor/svytitle";
export default {
    name: "Svytitle",
    data() {
        return {
            // 遮罩层
            loading: true,
            // 选中数组
            ids: [],
            // 非单个禁用
            single: true,
            // 非多个禁用
            multiple: true,
            // 显示搜索条件
            showSearch: true,
            // 总条数
            total: 0,
            // 问卷表格数据
            svytitleList: [],
            // 弹出层标题
            title: "",
            // 是否显示弹出层
            open: false,
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                categoryid: null,
                svycode: null,
                svyname: null,
                description: null,
                introduce: null,
                submitprompt: null,
                templateid: null,
                version: null,
                centerlibrarycode: null,
                centerlibraryid: null,
                islocal: null,
                isenable: null,
                orgid: null,
                isupload: null,
                uploadTime: null
            },
            // 表单参数
            form: {},
            // 表单校验
            rules: {
                delFlag: [
                    { required: true, message: " 删除标记 不能为空", trigger: "blur" }
                ],
                isupload: [
                    { required: true, message: " 上传标记 不能为空", trigger: "blur" }
                ],
            }
        };
  name: "Svytitle",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 问卷表格数据
      svytitleList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        categoryid: null,
        svycode: null,
        svyname: null,
        description: null,
        introduce: null,
        submitprompt: null,
        templateid: null,
        version: null,
        centerlibrarycode: null,
        centerlibraryid: null,
        islocal: null,
        isenable: null,
        orgid: null,
        isupload: null,
        uploadTime: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        delFlag: [
          { required: true, message: " 删除标记 不能为空", trigger: "blur" }
        ],
        isupload: [
          { required: true, message: " 上传标记 不能为空", trigger: "blur" }
        ],
      },
      data: [{
        label: '一级 1',
        children: [{
          label: '二级 1-1',
          children: [{
            label: '三级 1-1-1'
          }]
        }]
      }, {
        label: '一级 2',
        children: [{
          label: '二级 2-1',
          children: [{
            label: '三级 2-1-1'
          }]
        }, {
          label: '二级 2-2',
          children: [{
            label: '三级 2-2-1'
          }]
        }]
      }, {
        label: '一级 3',
        children: [{
          label: '二级 3-1',
          children: [{
            label: '三级 3-1-1'
          }]
        }, {
          label: '二级 3-2',
          children: [{
            label: '三级 3-2-1'
          }]
        }]
      }],
      defaultProps: {
        children: 'children',
        label: 'label'
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询问卷列表 */
    getList() {
      this.loading = true;
      listSvytitle(this.queryParams).then(response => {
        this.svytitleList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    created() {
        this.getList();
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    methods: {
        /** 查询问卷列表 */
        getList() {
            this.loading = true;
            listSvytitle(this.queryParams).then(response => {
                this.svytitleList = response.rows;
                this.total = response.total;
                this.loading = false;
    // 表单重置
    reset() {
      this.form = {
        svyid: null,
        categoryid: null,
        svycode: null,
        svyname: null,
        description: null,
        introduce: null,
        submitprompt: null,
        templateid: null,
        version: null,
        centerlibrarycode: null,
        centerlibraryid: null,
        islocal: null,
        isenable: null,
        orgid: null,
        delFlag: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        isupload: null,
        uploadTime: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.svyid)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加问卷";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const svyid = row.svyid || this.ids
      getSvytitle(svyid).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改问卷";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.svyid != null) {
            updateSvytitle(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
        },
        // 取消按钮
        cancel() {
            this.open = false;
            this.reset();
        },
        // 表单重置
        reset() {
            this.form = {
                svyid: null,
                categoryid: null,
                svycode: null,
                svyname: null,
                description: null,
                introduce: null,
                submitprompt: null,
                templateid: null,
                version: null,
                centerlibrarycode: null,
                centerlibraryid: null,
                islocal: null,
                isenable: null,
                orgid: null,
                delFlag: null,
                createBy: null,
                createTime: null,
                updateBy: null,
                updateTime: null,
                isupload: null,
                uploadTime: null
            };
            this.resetForm("form");
        },
        /** 搜索按钮操作 */
        handleQuery() {
            this.queryParams.pageNum = 1;
            this.getList();
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.resetForm("queryForm");
            this.handleQuery();
        },
        // 多选框选中数据
        handleSelectionChange(selection) {
            this.ids = selection.map(item => item.svyid)
            this.single = selection.length !== 1
            this.multiple = !selection.length
        },
        /** 新增按钮操作 */
        handleAdd() {
            this.reset();
            this.open = true;
            this.title = "添加问卷";
        },
        /** 修改按钮操作 */
        handleUpdate(row) {
            this.reset();
            const svyid = row.svyid || this.ids
            getSvytitle(svyid).then(response => {
                this.form = response.data;
                this.open = true;
                this.title = "修改问卷";
          } else {
            addSvytitle(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
        },
        /** 提交按钮 */
        submitForm() {
            this.$refs["form"].validate(valid => {
                if (valid) {
                    if (this.form.svyid != null) {
                        updateSvytitle(this.form).then(response => {
                            this.$modal.msgSuccess("修改成功");
                            this.open = false;
                            this.getList();
                        });
                    } else {
                        addSvytitle(this.form).then(response => {
                            this.$modal.msgSuccess("新增成功");
                            this.open = false;
                            this.getList();
                        });
                    }
                }
            });
        },
        /** 删除按钮操作 */
        handleDelete(row) {
            const svyids = row.svyid || this.ids;
            this.$modal.confirm('是否确认删除问卷编号为"' + svyids + '"的数据项?').then(function() {
                return delSvytitle(svyids);
            }).then(() => {
                this.getList();
                this.$modal.msgSuccess("删除成功");
            }).catch(() => {});
        },
        /** 导出按钮操作 */
        handleExport() {
            this.download('smartor/svytitle/export', {
                ...this.queryParams
            }, `svytitle_${new Date().getTime()}.xlsx`)
          }
        }
    }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const svyids = row.svyid || this.ids;
      this.$modal.confirm('是否确认删除问卷编号为"' + svyids + '"的数据项?').then(function () {
        return delSvytitle(svyids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => { });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('smartor/svytitle/export', {
        ...this.queryParams
      }, `svytitle_${new Date().getTime()}.xlsx`)
    },
    handleNodeClick(data) {
      console.log(data);
    },
    handleQueryGrid() {
      const params = { };
      this.$tab.openPage("问卷查询1", '/surveysetting/svytitle1/', params);
    },
    handleQueryTree() {
      const params = { };
      this.$tab.openPage("问卷查询2", '/surveysetting/svytitle2/', params);
    },
  },
  components:
  {
    dw_topic: () => import("@/smartor/dataobject/dw_svytopic_view.vue")
  }
};
</script>