|
@@ -0,0 +1,244 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div id="">
|
|
|
|
|
+ <el-dialog
|
|
|
|
|
+ :close-on-click-modal="false"
|
|
|
|
|
+ title="新增"
|
|
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
|
|
+ width="1200px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-form
|
|
|
|
|
+ :model="ruleForm"
|
|
|
|
|
+ :rules="rules"
|
|
|
|
|
+ ref="ruleForm"
|
|
|
|
|
+ label-width="100px"
|
|
|
|
|
+ class="demo-ruleForm"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-form-item label="分类:" prop="TypeId">
|
|
|
|
|
+ <el-radio-group v-model="ruleForm.TypeId">
|
|
|
|
|
+ <el-radio
|
|
|
|
|
+ v-for="(item, index) in TypeList"
|
|
|
|
|
+ :key="index"
|
|
|
|
|
+ :label="item.value"
|
|
|
|
|
+ >{{ item.text }}</el-radio
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-radio-group></el-form-item
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <Search
|
|
|
|
|
+ ref="search"
|
|
|
|
|
+ :formList="formList"
|
|
|
|
|
+ :formData="formData"
|
|
|
|
|
+ @onSubmit="search"
|
|
|
|
|
+ ></Search>
|
|
|
|
|
+ <Table
|
|
|
|
|
+ ref="table"
|
|
|
|
|
+ :tableData="tableData"
|
|
|
|
|
+ :tableList="tableList"
|
|
|
|
|
+ :rowKey="'NewsId'"
|
|
|
|
|
+ :check="true"
|
|
|
|
|
+ @selectionChange="selectionChange"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #right="scope"
|
|
|
|
|
+ ><el-button
|
|
|
|
|
+ v-if="scope.row.status === 1"
|
|
|
|
|
+ @click="del(scope.row, 0)"
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ >停用</el-button
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ v-if="scope.row.status === 0"
|
|
|
|
|
+ @click="del(scope.row, 1)"
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ >启用</el-button
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-button @click="del(scope.row, -1)" type="text" size="small"
|
|
|
|
|
+ >删除</el-button
|
|
|
|
|
+ >
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </Table>
|
|
|
|
|
+ <Pagination
|
|
|
|
|
+ :pageindex="formData.pageindex"
|
|
|
|
|
+ :pagesize="formData.pagesize"
|
|
|
|
|
+ :total="total"
|
|
|
|
|
+ @handleSizeChange="handleSizeChange"
|
|
|
|
|
+ @handleCurrentChange="handleCurrentChange"
|
|
|
|
|
+ ></Pagination>
|
|
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
|
|
+ <el-button size="small" @click="close">取 消</el-button>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ @click="submit('ruleForm')"
|
|
|
|
|
+ :loading="loading"
|
|
|
|
|
+ >确 定</el-button
|
|
|
|
|
+ >
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script>
|
|
|
|
|
+import Search from "@/components/search/index.vue";
|
|
|
|
|
+import Table from "@/components/table/index.vue";
|
|
|
|
|
+import Pagination from "@/components/pagination/index.vue";
|
|
|
|
|
+import { mapGetters } from "vuex";
|
|
|
|
|
+export default {
|
|
|
|
|
+ components: { Search, Table, Pagination },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ dialogVisible: false,
|
|
|
|
|
+ ruleForm: {
|
|
|
|
|
+ TypeId: "",
|
|
|
|
|
+ },
|
|
|
|
|
+ rules: {
|
|
|
|
|
+ TypeId: [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: "请选择分类",
|
|
|
|
|
+ trigger: "change",
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ formList: [
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "菜单:",
|
|
|
|
|
+ prop: "MenuId",
|
|
|
|
|
+ scope: "MenuList",
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ formData: { pageindex: 1, pagesize: 10 },
|
|
|
|
|
+ tableData: [],
|
|
|
|
|
+ tableList: [
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "编号",
|
|
|
|
|
+ prop: "NewsId",
|
|
|
|
|
+ width:"90"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "标题",
|
|
|
|
|
+ prop: "Title",
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "是否置顶",
|
|
|
|
|
+ prop: "IsTop",
|
|
|
|
|
+ scope: "options",
|
|
|
|
|
+ options: [
|
|
|
|
|
+ { label: "是", value: true },
|
|
|
|
|
+ { label: "否", value: false },
|
|
|
|
|
+ ],
|
|
|
|
|
+ width:"90"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "会员可见",
|
|
|
|
|
+ prop: "IsMemberRead",
|
|
|
|
|
+ scope: "options",
|
|
|
|
|
+ options: [
|
|
|
|
|
+ { label: "是", value: true },
|
|
|
|
|
+ { label: "否", value: false },
|
|
|
|
|
+ ],
|
|
|
|
|
+ width:"90"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "所属项目",
|
|
|
|
|
+ prop: "MenuName",
|
|
|
|
|
+ width:"90"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "创建时间",
|
|
|
|
|
+ prop: "CreateTime",
|
|
|
|
|
+ scope: "time",
|
|
|
|
|
+ width:"140"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "状态",
|
|
|
|
|
+ prop: "Status",
|
|
|
|
|
+ scope: "options",
|
|
|
|
|
+ options: [
|
|
|
|
|
+ { label: "停用", value: 0 },
|
|
|
|
|
+ { label: "正常", value: 1 },
|
|
|
|
|
+ ],
|
|
|
|
|
+ width:"90"
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ total: 0,
|
|
|
|
|
+ checkbox: [], //当前选中
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ computed: { ...mapGetters(["TypeList"]) },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ selectionChange(e) {
|
|
|
|
|
+ this.checkbox = e;
|
|
|
|
|
+ },
|
|
|
|
|
+ search(e) {
|
|
|
|
|
+ if (e === "init") {
|
|
|
|
|
+ this.formData = { pageindex: 1, pagesize: 10 };
|
|
|
|
|
+ this.clearCheck();
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$api.XfSysBussinessGetNewsList(this.formData).then((res) => {
|
|
|
|
|
+ this.tableData = res.Data.List || [];
|
|
|
|
|
+ this.total = res.Data.TotalCount;
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ clearCheck() {
|
|
|
|
|
+ this.checkbox = [];
|
|
|
|
|
+ this.$refs.table.$refs.table.clearSelection();
|
|
|
|
|
+ },
|
|
|
|
|
+ showInit() {
|
|
|
|
|
+ this.ruleForm = {
|
|
|
|
|
+ TypeId: "",
|
|
|
|
|
+ };
|
|
|
|
|
+ this.dialogVisible = true;
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.search("init");
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ close() {
|
|
|
|
|
+ this.loading = false;
|
|
|
|
|
+ this.dialogVisible = false;
|
|
|
|
|
+ },
|
|
|
|
|
+ submit(formName) {
|
|
|
|
|
+ this.$refs[formName].validate(async (valid) => {
|
|
|
|
|
+ if (valid) {
|
|
|
|
|
+ if (this.checkbox.length === 0) {
|
|
|
|
|
+ this.$message.error("请勾选数据");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ let array = this.checkbox.map((item) => {
|
|
|
|
|
+ return item.NewsId;
|
|
|
|
|
+ });
|
|
|
|
|
+ this.$api
|
|
|
|
|
+ .XfSysBussinessSaveSelectPosition({
|
|
|
|
|
+ idarr: array,
|
|
|
|
|
+ type: this.ruleForm.TypeId,
|
|
|
|
|
+ })
|
|
|
|
|
+ .then((res) => {
|
|
|
|
|
+ this.close();
|
|
|
|
|
+ this.$parent.search();
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.log("error submit!!");
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ handleCurrentChange(e) {
|
|
|
|
|
+ this.formData.pageindex = e;
|
|
|
|
|
+ this.search();
|
|
|
|
|
+ },
|
|
|
|
|
+ handleSizeChange(e) {
|
|
|
|
|
+ this.formData.pageindex = 1;
|
|
|
|
|
+ this.formData.pagesize = e;
|
|
|
|
|
+ this.search();
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+};
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
|
+::v-deep .el-dialog {
|
|
|
|
|
+ margin-top: 3vh !important;
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|