index.vue 6.93 KB
<template>
  <div class="timedTask from-clues">
    <div class="from-clues-header">
      <el-form ref="ruleForm" :model="form" label-width="100px">
        <el-row class="mb-5">
          <el-col :span="2" class="btnColRight">
            <btn nativeType="cx" @click="handleAdd">增加角色</btn>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div class="from-clues-content">
      <lb-table
        :page-size="pageData.size"
        :current-page.sync="pageData.current"
        :total="pageData.total"
        @size-change="handleSizeChange"
        @p-current-change="handleCurrentChange"
        :column="tableData.columns"
        :data="tableData.data"
      >
      </lb-table>
    </div>
    <EditDialog ref="addEditDialog" />
    <Roleslistdiglog ref="rolesForm" />
  </div>
</template>
<script>
// 定时任务
import data from "./data";
import sjsbTask from "@/api/sjsbTask.js";
import tableMixin from "@/mixins/tableMixin.js";
import EditDialog from "./edit-dialog.vue";
import Roleslistdiglog from "./roleslistdiglog.vue";
export default {
  name: "menus",
  mixins: [tableMixin],
  components: {
    EditDialog,
    Roleslistdiglog,
  },
  data() {
    return {
      taskData: null,
      form: {
        job_name: "",
        currentPage: 1,
      },
      // 当前所选角色id
      roleId: "",
      title: "",
      queryParam: {},
      selectType: "0",
      queryName: "",
      organizationId: "", // 组织机构ID
      departmentId: "", // 部门ID
      departmentList: [], // 部门列表
      levelList: [], // 职务级别
      tableData: [],
      sexList: [],
      typeOptions: [
        {
          value: "0",
          label: "姓名",
        },
        {
          value: "1",
          label: "工号",
        },
        {
          value: "2",
          label: "部门",
        },
        {
          value: "3",
          label: "机构",
        },
      ],

      selectionList: [],
      tableData: {
        columns: [
          {
            label: "序号",
            type: "index",
            width: "50",
            index: this.indexMethod,
          },
        ]
          .concat(data.columns())
          .concat([
            {
              label: "排序",
              width: 380,
              render: (h, scope) => {
                return (
                  <div>
                     <el-button
                      type="text"
                      size="mini"
                      icon="el-icon-video-pause"
                      onClick={() => {
                        this.personnel(scope.row);
                      }}
                    >
                      人员
                    </el-button>
                    <el-button
                      type="text"
                      size="mini"
                      icon="el-icon-edit"
                      onClick={() => {
                        this.handleEdit(scope.row);
                      }}
                    >
                      修改
                    </el-button>
                  </div>
                );
              },
            },
          ])
          .concat([
            {
              label: "操作",
              width: 380,
              render: (h, scope) => {
                return (
                  <div>
                    <el-button
                      type="text"
                      size="mini"
                      icon="el-icon-video-pause"
                      onClick={() => {
                        this.personnel(scope.row);
                      }}
                    >
                      人员
                    </el-button>
                    <el-button
                      type="text"
                      size="mini"
                      icon="el-icon-edit"
                      onClick={() => {
                        this.handleEdit(scope.row);
                      }}
                    >
                      修改
                    </el-button>
                    <el-button
                      type="text"
                      size="mini"
                      icon="el-icon-delete"
                      style="color:#F56C6C"
                      onClick={() => {
                        this.handleDel(scope.row);
                      }}
                    >
                      删除
                    </el-button>
                  </div>
                );
              },
            },
          ]),
        data: [],
      },
      pageData: {
        total: 5,
        pageSize: 15,
        current: 1,
      },
    };
  },
  created() {
    this.featchData();
  },
  methods: {
    // 新增角色
    handleAdd() {
      // this.$refs.addEditDialog.roleId = value.id
      // this.roleSort = value.sort ? value.sort : 0

      this.$refs.addEditDialog.showAddEditDialog = true;
      this.$refs.addEditDialog.dialogTitle = "新增";
    },
    //  修改角色
    handleEdit(row) {
      this.$refs.addEditDialog.roleId = row.id;
      this.roleSort = row.sort ? row.sort : 0;
      if (row.id) {
        this.$refs.addEditDialog.dialogForm.roleName = row.name;
        this.$refs.addEditDialog.dialogForm.roleType = row.type;
        this.$refs.addEditDialog.dialogForm.roleTextArea = row.description;
      }
      this.$refs.addEditDialog.showAddEditDialog = true;
      this.$refs.addEditDialog.dialogTitle = "修改";
    },
    featchData() {
      this.tableData.data = [
        {
          id: "2176e915-fdb4-414a-b8d6-6cf63171cffc",
          createdAt: "2022-10-31T07:08:29.293+0000",
          updatedAt: "2022-10-31T07:08:29.293+0000",
          createdBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
          updatedBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
          sort: 29,
          name: "人事部材料管理员",
          type: "材料管理员",
          category: 2,
          description: "管理内部材料",
          _X_ROW_KEY: "row_365",
        },
      ];
    },

    personnel() {
      this.$refs.rolesForm.adds();
      this.$refs.rolesForm.title = "人员配置";
    },
    handleDel(row) {
      this.$confirm("此操将进行删除操作, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          sjsbTask
            .sjsbTaskRemove(row.id)
            .then((res) => {
              if ((res.code = 200)) {
                this.$message({
                  type: "success",
                  message: res.message,
                });
                this.featchData();
              }
            })
            .catch((error) => {
              this.$alert(error, "提示", {
                confirmButtonText: "确定",
                type: "error",
              });
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
  },
};
</script>
<style scoped lang="scss">
@import "~@/styles/mixin.scss";
@import "~@/styles/public.scss";
</style>