<template>
|
<div class="app-container">
|
<!-- 添加或修改问卷题目对话框 -->
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form-item label=" 老版本ID " prop="oldid">
|
<el-input v-model="form.oldid" placeholder="请输入 老版本ID " />
|
</el-form-item>
|
<el-form-item label=" 问卷ID " prop="svyid">
|
<el-input v-model="form.svyid" placeholder="请输入 问卷ID " />
|
</el-form-item>
|
<el-form-item label=" 题目Code " prop="topiccode">
|
<el-input v-model="form.topiccode" placeholder="请输入 题目Code " />
|
</el-form-item>
|
<el-form-item label=" 题目 " prop="topic">
|
<el-input v-model="form.topic" type="textarea" placeholder="请输入内容" />
|
</el-form-item>
|
<el-form-item label=" 排序 " prop="sort">
|
<el-input v-model="form.sort" placeholder="请输入 排序 " />
|
</el-form-item>
|
<el-form-item label=" 是否必填 " prop="ismandatory">
|
<el-select v-model="form.ismandatory" placeholder="请选择 是否必填 ">
|
<el-option
|
v-for="dict in dict.type.sys_yes_no"
|
:key="dict.value"
|
:label="dict.label"
|
:value="parseInt(dict.value)"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label=" 是否隐藏 " prop="ishide">
|
<el-select v-model="form.ishide" placeholder="请选择 是否隐藏 ">
|
<el-option
|
v-for="dict in dict.type.sys_yes_no"
|
:key="dict.value"
|
:label="dict.label"
|
:value="parseInt(dict.value)"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label=" 删除标记 " prop="delFlag">
|
<el-select v-model="form.delFlag" placeholder="请选择 删除标记 ">
|
<el-option
|
v-for="dict in dict.type.sys_yes_no"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label=" 机构ID " prop="orgid">
|
<el-input v-model="form.orgid" placeholder="请输入 机构ID " />
|
</el-form-item>
|
<el-form-item label=" 上传标记 " prop="isupload">
|
<el-select v-model="form.isupload" placeholder="请选择 上传标记 ">
|
<el-option
|
v-for="dict in dict.type.sys_yes_no"
|
:key="dict.value"
|
:label="dict.label"
|
:value="parseInt(dict.value)"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label=" 上传时间 " prop="uploadTime">
|
<el-date-picker clearable
|
v-model="form.uploadTime"
|
type="date"
|
value-format="yyyy-MM-dd"
|
placeholder="请选择 上传时间 ">
|
</el-date-picker>
|
</el-form-item>
|
</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>
|
</template>
|
|
<script>
|
import { listSvytopic, getSvytopic, delSvytopic, addSvytopic, updateSvytopic } from "@/api/smartor/svytopic";
|
|
export default {
|
name: "Svytopic",
|
dicts: ['sys_yes_no'],
|
data() {
|
return {
|
title: "修改选项",
|
// 是否显示弹出层
|
open: false,
|
// 查询参数
|
// 表单参数
|
form: {},
|
// 表单校验
|
rules: {
|
delFlag: [
|
{ required: true, message: " 删除标记 不能为空", trigger: "change" }
|
],
|
isupload: [
|
{ required: true, message: " 上传标记 不能为空", trigger: "change" }
|
],
|
}
|
};
|
},
|
created() {
|
this.getList();
|
},
|
methods: {
|
/** 查询问卷题目列表 */
|
getList() {
|
this.loading = true;
|
listSvytopic(this.queryParams).then(response => {
|
this.svytopicList = response.rows;
|
this.total = response.total;
|
this.loading = false;
|
});
|
},
|
// 取消按钮
|
cancel() {
|
this.open = false;
|
this.reset();
|
},
|
// 表单重置
|
reset() {
|
this.form = {
|
topicid: null,
|
oldid: null,
|
svyid: null,
|
topictype: null,
|
topiccode: null,
|
topic: null,
|
sort: null,
|
ismandatory: null,
|
ishide: null,
|
delFlag: null,
|
orgid: 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.topicid)
|
this.single = selection.length!==1
|
this.multiple = !selection.length
|
},
|
/** 新增按钮操作 */
|
handleAdd() {
|
this.reset();
|
this.open = true;
|
this.title = "添加问卷题目";
|
},
|
/** 修改按钮操作 */
|
handleUpdate(row) {
|
this.reset();
|
const topicid = row.topicid || this.ids
|
getSvytopic(topicid).then(response => {
|
this.form = response.data;
|
this.open = true;
|
this.title = "修改问卷题目";
|
});
|
},
|
/** 提交按钮 */
|
submitForm() {
|
this.$refs["form"].validate(valid => {
|
if (valid) {
|
if (this.form.topicid != null) {
|
updateSvytopic(this.form).then(response => {
|
this.$modal.msgSuccess("修改成功");
|
this.open = false;
|
this.getList();
|
});
|
} else {
|
addSvytopic(this.form).then(response => {
|
this.$modal.msgSuccess("新增成功");
|
this.open = false;
|
this.getList();
|
});
|
}
|
}
|
});
|
},
|
/** 删除按钮操作 */
|
handleDelete(row) {
|
const topicids = row.topicid || this.ids;
|
this.$modal.confirm('是否确认删除问卷题目编号为"' + topicids + '"的数据项?').then(function() {
|
return delSvytopic(topicids);
|
}).then(() => {
|
this.getList();
|
this.$modal.msgSuccess("删除成功");
|
}).catch(() => {});
|
},
|
/** 导出按钮操作 */
|
handleExport() {
|
this.download('smartor/svytopic/export', {
|
...this.queryParams
|
}, `svytopic_${new Date().getTime()}.xlsx`)
|
}
|
}
|
};
|
</script>
|
|