yxh
2023-03-21 acd7802beaa570c6811ed7227e441e39e8c5e37e
ruoyi-ui/src/smartor/dataobject/dw_svytopicoption_list.vue
@@ -41,87 +41,89 @@
  </div>
</template>
  
<script>
import { listSvytopicoption, getSvytopicoption, delSvytopicoption, addSvytopicoption, updateSvytopicoption } from "@/api/smartor/svytopicoption";
import maintdlg from "@/smartor/dataobject/dw_svytopicoption_maint.vue";
export default {
  name: "Svytopicoption",
  data() {
    return {
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      loading: false,
      showSearch: true,
      // 总条数
      total: 0,
      // 问卷问题选项表格数据
      svytopicoptionList: [],
      // 查询参数
      queryParams: {
        topicid: null
  <script>
  import { listSvytopicoption, getSvytopicoption, delSvytopicoption, addSvytopicoption, updateSvytopicoption } from "@/api/smartor/svytopicoption";
  import maintdlg from  "@/smartor/dataobject/dw_svytopicoption_maint.vue";
  export default {
    name: "Svytopicoption",
    data() {
      return {
        topicId: null,
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        loading : false,
        showSearch: true,
        // 总条数
        total: 0,
        // 问卷问题选项表格数据
        svytopicoptionList: [],
         // 查询参数
        queryParams: {
          topicid: null
        },
      };
    },
    components:
    {
      maintdlg: maintdlg //()=>import("@/smartor/dataobject/dw_svytopicoption_maint")
    },
    created() {
     },
    mounted() {
    },
    methods: {
      /** 查询问卷问题选项列表 */
      getList(topicId) {
        this.topicId = topicId;
        this.loading = true;
        this.queryParams.topicid = topicId;
        listSvytopicoption(this.queryParams).then(response => {
          this.svytopicoptionList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
    };
  },
  components:
  {
    maintdlg: maintdlg //()=>import("@/smartor/dataobject/dw_svytopicoption_maint")
  },
  created() {
  },
  mounted() {
  },
  methods: {
    /** 查询问卷问题选项列表 */
    getList(topicId) {
      this.loading = true;
      this.queryParams.topicid = topicId;
      listSvytopicoption(this.queryParams).then(response => {
        this.svytopicoptionList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.optionid)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.$refs["maint"].handleUpdate(null)
      return
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      const optionid = row.optionid || this.ids
      this.$refs["maint"].handleUpdate(optionid)
      return
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const optionids = row.optionid || this.ids;
      this.$modal.confirm('是否确认删除问卷问题选项编号为"' + optionids + '"的数据项?').then(function () {
        return delSvytopicoption(optionids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => { });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('smartor/svytopicoption/export', {
        ...this.queryParams
      }, `svytopicoption_${new Date().getTime()}.xlsx`)
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.optionid)
        this.single = selection.length !== 1
        this.multiple = !selection.length
      },
      /** 新增按钮操作 */
      handleAdd() {
        this.$refs["maint"].handleUpdate2(null,this.topicId)
        return
      },
      /** 修改按钮操作 */
      handleUpdate(row) {
        const optionid = row.optionid || this.ids
        this.$refs["maint"].handleUpdate2(optionid,this.topicId)
        return
      },
      /** 删除按钮操作 */
      handleDelete(row) {
        const optionids = row.optionid || this.ids;
        this.$modal.confirm('是否确认删除问卷问题选项编号为"' + optionids + '"的数据项?').then(function () {
          return delSvytopicoption(optionids);
        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        }).catch(() => { });
      },
      /** 导出按钮操作 */
      handleExport() {
        this.download('smartor/svytopicoption/export', {
          ...this.queryParams
        }, `svytopicoption_${new Date().getTime()}.xlsx`)
      }
    }
  }
};
</script>
  };
  </script>