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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
| <template>
| <div class="box-a">
| <v-header
| title="人员标签"
| :bar="bar"
| search
| @on-search="onSearch"
| ></v-header>
| <div class="but">
| <el-button
| @click="add()"
| size="small"
| type="primary"
| >新增</el-button>
| </div>
| <div>
| <v-tool-table
| :trs="trs"
| :tds="tds"
| >
| <template v-slot:btn="{scope}">
| <span v-if="scope.sysFlag ===1">
| <el-button
| type="text"
| disabled
| >系统预设,无法操作</el-button>
| </span>
| <span v-else>
| <el-button
| @click="edit(scope)"
| type="text"
| >编辑</el-button>
| <el-button
| @click="clear(scope.id)"
| type="text"
| >删除</el-button>
| </span>
| </template>
| </v-tool-table>
| </div>
| <v-tool-page
| :item="paged"
| @on-page="onPage"
| ></v-tool-page>
| <el-dialog
| title="提示"
| :close-on-click-modal="true"
| :modal="false"
| :visible.sync="dialogVisible"
| width=""
| >
| <span>
| <el-form
| ref="form"
| label-width="80px"
| >
| <el-form-item label="标签名称">
| <el-input :maxlength="10" v-model="os.tagName"></el-input>
| </el-form-item>
| </el-form>
| </span>
| <span
| slot="footer"
| class="dialog-footer"
| >
| <el-button @click="dialogVisible = false">取 消</el-button>
| <el-button
| type="primary"
| @click="save"
| >确 定</el-button>
| </span>
| </el-dialog>
| </div>
| </template>
| <script>
| export default {
| props: [],
| components: {},
| data() {
| return {
| dialogVisible: false,
| bar: [{ title: "标签名", name: "tagName" }],
| tds: [],
| trs: [
| { text: "标签名", val: "tagName" },
| { text: "创建时间", val: "createAt" },
| { text: "操作", val: "btn" },
| ],
| search: {},
| os: {
| tagName: "",
| },
| options: [], //小区列表
| paged: { pageNum: 0, total: 10, r: 0, pageSize: 10 },
| };
| },
| created() {
| this.init();
| },
| mounted() {},
| methods: {
| edit(scope) {
| //编辑
| this.dialogVisible = true;
| this.os = scope;
| },
| save() {
| //新增/编辑标签
| if (this.os.tagName === "") {
| return demo.toast("请输入标签名字");
| }
| this.$api.post("common/data/special/tags/save", this.os, (e) => {
| this.dialogVisible = false;
| this.init();
| });
| },
| add() {
| this.os = {
| tagName: "",
| };
| this.dialogVisible = true;
| },
| clear(id) {
| this.$js.model("", "是否删除", (res) => {
| if (res) {
| this.$api.del("common/data/special/tags/delete?id=" + id, "", (e) => {
| demo.toast("删除成功");
| this.init();
| });
| }
| });
| },
| onSearch(e) {
| // console.log(e)
| this.search = e;
| this.init();
| },
| init() {
| Object.assign(this.paged, this.search);
| this.$api.post("common/data/special/tags/page", this.paged, (e) => {
| this.paged.total = e.total;
| this.tds = e.records;
| });
| },
| onPage(v) {
| //分页
| if (v.page === this.paged.pageNum && v.page && !v.reset) {
| return 0;
| }
| this.paged.pageNum = v.page;
| this.paged.pageSize = v.limit;
| this.init();
| },
| },
| watch: {},
| computed: {},
| };
| </script>
| <style scoped>
| .box-a {
| overflow: scroll;
| }
| .but {
| padding-bottom: 10px;
| }
| </style>
|
|