schangxiang@126.com
2025-09-19 9be9c3784b2881a3fa25e93ae2033dc2803c0ed0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<template>
  <div class="page-list-container">
    <!--数据Table-->
    <yrt-data-list :ref="dataListRef" :editor-ref="editorRef" :data-options="dataOptions" :fields.sync="dataListOptions.fields" :buttons="dataListOptions.buttons" :button-click="buttonClick" :data-list-selections.sync="dataListSelections" :auth-nodes="authNodes" :action-field="actionField">
      <template slot="common-column-slot" slot-scope="{row, col}">
        <template v-if="['enable', 'isAdministrator','loginState','loginStateForPda'].indexOf(col.prop)>=0">
          <template v-if="row[col.prop]==1">
            <el-tag color="#7aaffe" style="color:white;border:0">
              {{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }}
            </el-tag>
          </template>
          <template v-else>
            <el-tag color="#ffcc33" style="color:white;border:0">
              {{ $refs[dataListRef].translateText(col.prop, row[col.prop]||0, col.dropdown_Id) }}
            </el-tag>
          </template>
        </template>
        <template v-else-if="['sex'].indexOf(col.prop)>=0">
          {{ $refs[dataListRef].translateText(col.prop, row[col.prop]||0, col.dropdown_Id) }}
        </template>
        <template v-else-if="col.prop==dataOptions.linkColumn">
          <el-link type="primary" @click.native="()=>{linkEditor(row[dataOptions.idField]);}">{{ row[col.prop] }}</el-link>
        </template>
        <template v-else>
          {{ row[col.prop] }}
        </template>
      </template>
    </yrt-data-list>
 
    <!--数据编辑器Editor-->
    <yrt-editor :ref="editorRef" :data-list-ref="dataListRef" v-bind="editorOptions" :data-options="dataOptions" :action.sync="editorOptions.action" :top.sync="editorOptions.top" :visible.sync="editorOptions.config.visible" :auth-nodes="authNodes" :rules="rules">
      <!--自定义按钮插槽-->
      <template slot="footer-button-region" slot-scope="{ formData, details }">
        <!--修改密码按钮-->
        <el-button type="success" icon="el-icon-yrt-ai-password" @click.native="modifypwd(formData, details)">修改密码</el-button>
      </template>
    </yrt-editor>
 
    <!--修改密码弹出页面-->
    <modify-pwd ref="modifypwd-dialog" :visible.sync="modifyPwdVisible"></modify-pwd>
 
    <!--数据权限设置-->
    <data-auth-dialog ref="data-auth-dialog" :visible.sync="dataAuthVisible" :user-id="currentUserId"></data-auth-dialog>
  </div>
</template>
 
<script>
import baseLayout from "@/components/common/base-layout.vue";
import ModifyPwd from "./components/modify-pwd.vue";
import DataAuthDialog from "./components/data-auth-dialog.vue";
 
export default {
  name: "sys-permission-user",
  components: {
    ModifyPwd,
    DataAuthDialog
  },
  mixins: [baseLayout],
  data() {
    return {
      // 修改密码页面默认不显示
      modifyPwdVisible: false,
      // 自定义操作列
      actionField: {
        prop: "_action",
        label: "操作",
        width: "150",
        headerAlign: "center",
        align: "center",
        action: [
          {
            type: "button",
            action: "dataAuth",
            label: "数据权限",
            onClick(btnInfo, rowData, colInfo, the) {
              the.dataAuthVisible = true;
              the.currentUserId = rowData.user_Id;
              return true;
            }
          },
          {
            type: "button",
            action: "edit",
            label: "编辑"
          },
          {
            type: "button",
            action: "delete",
            label: "删除"
          }
        ],
        hidden: false
      },
      // 显示数据权限对话框
      dataAuthVisible: false,
      // 当前选中用户ID
      currentUserId: 0,
      // 编辑规则验证
      rules: {
        // Mobile: [
        //   {
        //     type: "string",
        //     pattern: /^1[3456789]\d{9}$/,
        //     message: "手机号格式不正确"
        //   },
        //   {
        //     type: "string",
        //     required: true,
        //     message: "手机号必填"
        //   }
        // ]
      }
    };
  },
  methods: {
    modifypwd(formData, details) {
      this.modifyPwdVisible = true;
      this.$nextTick(() => {
        this.$refs["modifypwd-dialog"].setUser_Id(formData.user_Id);
      });
    }
  }
};
</script>