leisure-common 0.6.83 → 0.6.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -2,9 +2,46 @@ import LeComEmployee from "./le-com-employee/index.js";
2
2
  import LeComActivity from "./le-com-activity/index.js";
3
3
  import LeComCompany from "./le-com-company/index.js";
4
4
  import LeComMenu from "./le-com-menu/index.js";
5
+ import LeArea from "./le-area/index.js";
6
+ import LeBackUp from "./le-backup/index.js";
7
+ import LeMenu from "./le-menu/index.js";
8
+ import LeMpurl from "./le-mpurl/index.js";
9
+ import LeRichText from "./le-rich-text/index.js";
10
+ import LeRole from "./le-role/index.js";
11
+ import LeRoleUser from "./le-role-user/index.js";
5
12
 
13
+ import LeSelectUser from "./le-select-user/index.js";
14
+ import LeUser from "./le-user/index.js";
15
+ import LeButtonSelectMedia from "./le-button-select-media/index.js";
6
16
 
7
- const components = [LeComEmployee, LeComActivity, LeComCompany, LeComMenu];
17
+ // import LeMedia from "./le-media/index.js";
18
+ // import LeMediaUpload from "./le-media-upload/index.js";
19
+ // import LeMediaList from "./le-media-list/index.js";
20
+ import LeButtonUpload from "./le-button-upload/index.js";
21
+ import LeImageContainer from "./le-image-container/index.js";
22
+
23
+ const components = [
24
+ LeComEmployee,
25
+ LeComActivity,
26
+ LeComCompany,
27
+ LeComMenu,
28
+ LeArea,
29
+ LeBackUp,
30
+ LeMenu,
31
+ LeMpurl,
32
+
33
+ LeRichText,
34
+ LeRole,
35
+ LeRoleUser,
36
+ LeSelectUser,
37
+ LeButtonSelectMedia,
38
+ LeUser,
39
+ // LeMedia,
40
+ // LeMediaUpload,
41
+ // LeMediaList,
42
+ LeButtonUpload,
43
+ LeImageContainer,
44
+ ];
8
45
 
9
46
  const install = function (Vue) {
10
47
  if (install.installed) return;
@@ -20,4 +57,21 @@ export default {
20
57
  LeComActivity,
21
58
  LeComCompany,
22
59
  LeComMenu,
60
+ LeArea,
61
+ LeBackUp,
62
+ LeMenu,
63
+ LeMpurl,
64
+
65
+ LeRichText,
66
+ LeRole,
67
+ LeRoleUser,
68
+ LeSelectUser,
69
+ LeUser,
70
+ LeButtonSelectMedia,
71
+
72
+ // LeMedia,
73
+ // LeMediaUpload,
74
+ // LeMediaList,
75
+ LeButtonUpload,
76
+ LeImageContainer,
23
77
  };
@@ -0,0 +1,7 @@
1
+ import LeArea from "./src/main.vue";
2
+
3
+ LeArea.install = function (Vue) {
4
+ Vue.component(LeArea.name, LeArea);
5
+ };
6
+
7
+ export default LeArea;
@@ -0,0 +1,112 @@
1
+ <template>
2
+ <el-cascader
3
+ v-model="value"
4
+ v-bind="$attrs"
5
+ v-on="$listeners"
6
+ clearable
7
+ :ref="elcascader"
8
+ :props="props"
9
+ @change="handleChange"
10
+ ></el-cascader>
11
+ </template>
12
+ <script>
13
+ import { getAreas } from "@/api/system-area.js";
14
+ export default {
15
+ name: "le-area",
16
+ props: {
17
+ level: {
18
+ type: [String, Number],
19
+ default: "2",
20
+ },
21
+ initCode: {
22
+ type: [String, Number],
23
+ default: "0",
24
+ },
25
+ isAny: {
26
+ type: Boolean,
27
+ default: false,
28
+ },
29
+ initArea: {
30
+ type: Array,
31
+ default: () => [],
32
+ },
33
+ elcascader: {
34
+ type: String,
35
+ default: "",
36
+ },
37
+ },
38
+ data() {
39
+ return {
40
+ value: [],
41
+ props: {
42
+ label: "name",
43
+ value: "code",
44
+ checkStrictly: false,
45
+ lazy: true,
46
+ lazyLoad: this.LoadData,
47
+ },
48
+ };
49
+ },
50
+ watch: {
51
+ isAny: {
52
+ handler(val) {
53
+ this.props.checkStrictly = val;
54
+ },
55
+ immediate: true,
56
+ },
57
+ initArea: {
58
+ handler(val) {
59
+ this.value = val;
60
+ },
61
+ immediate: true,
62
+ deep: true,
63
+ },
64
+ },
65
+
66
+ mounted() {
67
+ if (this.initArea && this.initArea.length > 0) {
68
+ this.value = this.initArea;
69
+ }
70
+ },
71
+ methods: {
72
+ setInitArea(initArea) {
73
+ this.value = initArea;
74
+ },
75
+ clearInitArea() {
76
+ this.value = [];
77
+ },
78
+ LoadData(node, resolve) {
79
+ let nodes = [];
80
+ let { level } = node;
81
+ let param = {};
82
+ param.pcode = level == 0 ? this.initCode : node.value;
83
+ getAreas(param).then((res) => {
84
+ nodes = res.data.data;
85
+ nodes.forEach((item) => {
86
+ item.leaf = item.type == this.level ? true : false;
87
+ });
88
+ resolve(nodes);
89
+ });
90
+ },
91
+ handleChange(currentValue) {
92
+ let selectValue = {};
93
+ selectValue.code = currentValue;
94
+ if (!selectValue.code || selectValue.code.length <= 0) return;
95
+ let cascader = this.$refs[this.elcascader];
96
+ if (cascader) {
97
+ const nodes = cascader.getCheckedNodes();
98
+ if (nodes && nodes.length > 0) {
99
+ console.log(nodes[0].pathLabels);
100
+ const labels = nodes[0].pathLabels;
101
+ selectValue.name = labels.join("");
102
+ this.$emit("areaChange", selectValue);
103
+ } else {
104
+ console.log("area control node 不存:");
105
+ }
106
+ } else {
107
+ console.log("area control err:", "elcascader ref 不存在");
108
+ }
109
+ },
110
+ },
111
+ };
112
+ </script>
@@ -0,0 +1,7 @@
1
+ import LeBackUp from "./src/main.vue";
2
+
3
+ LeBackUp.install = function (Vue) {
4
+ Vue.component(LeBackUp.name, LeBackUp);
5
+ };
6
+
7
+ export default LeBackUp;
@@ -0,0 +1,160 @@
1
+ <template>
2
+ <div>
3
+ <el-form :inline="true">
4
+ <el-form-item>
5
+ <el-button type="primary" @click="backRecord">查看备份记录</el-button>
6
+ </el-form-item>
7
+ </el-form>
8
+ <el-table
9
+ :data="tableData"
10
+ border
11
+ row-key="id"
12
+ :header-cell-style="{ 'text-align': 'center' }"
13
+ stripe
14
+ style="width: 100%"
15
+ >
16
+ <el-table-column prop="back_dir" label="备份目录" width="180">
17
+ </el-table-column>
18
+ <el-table-column prop="mysqldump_dir" label="dump目录" width="180">
19
+ </el-table-column>
20
+ <el-table-column prop="back_formatter" label="文件名称格式" width="150">
21
+ </el-table-column>
22
+ <el-table-column prop="back_pre" label="文件前缀" width="80">
23
+ </el-table-column>
24
+ <el-table-column prop="back_suf" label="文件后缀" width="80">
25
+ </el-table-column>
26
+ <el-table-column
27
+ prop="is_enabled"
28
+ align="center"
29
+ label="是否启用"
30
+ width="80"
31
+ >
32
+ <template slot-scope="scope">
33
+ <span v-if="scope.row.is_enabled == 0">否</span>
34
+ <span v-if="scope.row.is_enabled == 1">是</span>
35
+ </template>
36
+ </el-table-column>
37
+ <el-table-column label="操作" align="center" row>
38
+ <template slot-scope="scope">
39
+ <el-button
40
+ id="btnEdit"
41
+ type="primary"
42
+ size="small"
43
+ v-permission="$route.params.btns"
44
+ @click="openEditWindow(scope.row)"
45
+ >编辑</el-button
46
+ >
47
+ <el-button
48
+ id="btnEnable"
49
+ type="primary"
50
+ size="small"
51
+ @click="statusChange(scope.row)"
52
+ >{{ btnEabelText(scope.row) }}</el-button
53
+ >
54
+ <el-button
55
+ id="btnEnable"
56
+ type="primary"
57
+ size="small"
58
+ v-if="scope.row.is_enabled == 1"
59
+ @click="backDb(scope.row)"
60
+ >备份</el-button
61
+ >
62
+ </template>
63
+ </el-table-column>
64
+ </el-table>
65
+ <el-dialog
66
+ width="80%"
67
+ v-el-drag-dialog
68
+ title="备份记录"
69
+ :visible.sync="showRecord"
70
+ :close-on-click-modal="false"
71
+ @close="closeRecordDialog"
72
+ >
73
+ <records @close="closeRecordDialog" v-if="showRecord"></records>
74
+ </el-dialog>
75
+ <el-dialog
76
+ width="60%"
77
+ v-el-drag-dialog
78
+ title="备份配置编辑"
79
+ :visible.sync="showUpdateConfig"
80
+ :close-on-click-modal="false"
81
+ @close="closeUpdateConfigDialog"
82
+ >
83
+ <le-backup-sub
84
+ @close="closeUpdateConfigDialog"
85
+ :rowData="detailDb"
86
+ v-if="showUpdateConfig"
87
+ ></le-backup-sub>
88
+ </el-dialog>
89
+ </div>
90
+ </template>
91
+ <script>
92
+ import { configList, configUpdate, backup } from "@/api/database";
93
+ import records from "./records.vue";
94
+ import LeBackupSub from "./sub.vue";
95
+ export default {
96
+ name: "le-backup",
97
+ components: {
98
+ records,
99
+ LeBackupSub,
100
+ },
101
+ data() {
102
+ return {
103
+ tableData: [],
104
+ detailDb: {},
105
+ showRecord: false,
106
+ showUpdateConfig: false,
107
+ };
108
+ },
109
+ computed: {},
110
+ mounted() {
111
+ this.list();
112
+ },
113
+ methods: {
114
+ list() {
115
+ configList().then((res) => {
116
+ this.tableData = res.data.data;
117
+ });
118
+ },
119
+ backDb() {
120
+ backup()
121
+ .then((res) => {
122
+ this.$message.success(res.data.info);
123
+ })
124
+ .catch(() => {
125
+ this.$message.success("备份失败");
126
+ });
127
+ },
128
+ backRecord() {
129
+ this.showRecord = true;
130
+ },
131
+ closeRecordDialog() {
132
+ this.showRecord = false;
133
+ },
134
+ closeUpdateConfigDialog() {
135
+ this.showUpdateConfig = false;
136
+ },
137
+ statusChange(item) {
138
+ item.is_enabled = !item.is_enabled;
139
+ if (item.is_enabled) {
140
+ item.is_enabled = 1;
141
+ } else {
142
+ item.is_enabled = 0;
143
+ }
144
+ configUpdate(item).then((res) => {
145
+ this.$message.success(res.data.info);
146
+ });
147
+ },
148
+ btnEabelText(item) {
149
+ if (item.is_enabled) {
150
+ return "停用";
151
+ }
152
+ return "启用";
153
+ },
154
+ openEditWindow(item) {
155
+ this.detailDb = item;
156
+ this.showUpdateConfig = true;
157
+ },
158
+ },
159
+ };
160
+ </script>
@@ -0,0 +1,79 @@
1
+ <template>
2
+ <div>
3
+ <el-table
4
+ :data="tableData"
5
+ border
6
+ row-key="id"
7
+ :header-cell-style="{ 'text-align': 'center' }"
8
+ :cell-style="{ 'text-align': 'center' }"
9
+ stripe
10
+ style="width: 100%"
11
+ >
12
+ <el-table-column prop="bdir" label="备份目录"> </el-table-column>
13
+ <el-table-column prop="bfile" label="备份文件"> </el-table-column>
14
+ <el-table-column prop="bsdate" label="备份开始时间">
15
+ <template slot-scope="scope">
16
+ <span>{{ dateFormat(scope.row.bsdate) }}</span>
17
+ </template>
18
+ </el-table-column>
19
+ <el-table-column prop="bedate" label="备份结束时间">
20
+ <template slot-scope="scope">
21
+ <span>{{ dateFormat(scope.row.bedate) }}</span>
22
+ </template>
23
+ </el-table-column>
24
+ <el-table-column prop="bstatus" label="备份状态">
25
+ <template slot-scope="scope">
26
+ <span v-if="scope.row.bstatus == 0">失败</span>
27
+ <span v-if="scope.row.bstatus == 1">成功</span>
28
+ </template>
29
+ </el-table-column>
30
+ <el-table-column label="操作" align="center" row>
31
+ <template slot-scope="scope">
32
+ <el-button
33
+ id="btndel"
34
+ type="primary"
35
+ size="small"
36
+ v-permission="$route.params.btns"
37
+ @click="btnBackupdel(scope.row)"
38
+ >删除</el-button
39
+ >
40
+ </template>
41
+ </el-table-column>
42
+ </el-table>
43
+ </div>
44
+ </template>
45
+ <script>
46
+ import { backupRecords, backupdel } from "@/api/database";
47
+ import moment from "moment";
48
+ export default {
49
+ data() {
50
+ return {
51
+ tableData: [],
52
+ };
53
+ },
54
+ computed: {},
55
+ mounted() {
56
+ this.list();
57
+ },
58
+ methods: {
59
+ dateFormat(data) {
60
+ if (data) {
61
+ return moment.unix(data).format("YYYY-MM-DD HH:mm:ss");
62
+ } else return "";
63
+ },
64
+ btnBackupdel(item) {
65
+ let params = [];
66
+ params.push(item.id);
67
+ backupdel(params).then((res) => {
68
+ this.list();
69
+ this.$message.success(res.data.info);
70
+ });
71
+ },
72
+ list() {
73
+ backupRecords().then((res) => {
74
+ this.tableData = res.data.data;
75
+ });
76
+ },
77
+ },
78
+ };
79
+ </script>
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <el-form ref="form" :model="rowData" :rules="rules" label-width="100px">
3
+ <el-form-item label="备份目录" prop="back_dir">
4
+ <el-input v-model="rowData.back_dir"></el-input>
5
+ </el-form-item>
6
+ <el-form-item label="dump目录" prop="mysqldump_dir">
7
+ <el-input v-model="rowData.mysqldump_dir"></el-input>
8
+ </el-form-item>
9
+ <el-form-item label="文件格式" prop="back_formatter">
10
+ <el-input v-model="rowData.back_formatter"></el-input>
11
+ </el-form-item>
12
+ <el-form-item label="文件前缀" prop="back_pre">
13
+ <el-input v-model="rowData.back_pre"></el-input>
14
+ </el-form-item>
15
+ <el-form-item label="文件后缀" prop="back_suf">
16
+ <el-input v-model="rowData.back_suf"></el-input>
17
+ </el-form-item>
18
+ <el-form-item>
19
+ <el-button type="primary" @click="onSubmit">保存</el-button>
20
+ </el-form-item>
21
+ </el-form>
22
+ </template>
23
+ <script>
24
+ import { configUpdate } from "@/api/database";
25
+
26
+ export default {
27
+ name: "le-backup-sub",
28
+ props: {
29
+ rowData: {
30
+ type: Object,
31
+ default: () => {},
32
+ },
33
+ },
34
+
35
+ data() {
36
+ return {
37
+ form: {
38
+ id: "",
39
+ back_dir: "",
40
+ mysqldump_dir: "",
41
+ back_pre: "",
42
+ back_suf: "",
43
+ back_formatter: "",
44
+ },
45
+ rules: {
46
+ back_dir: [
47
+ { required: true, message: "备份目录必须输入", trigger: "blur" },
48
+ {
49
+ min: 1,
50
+ max: 300,
51
+ message: "长度在 1 到 300 个字符",
52
+ trigger: "blur",
53
+ },
54
+ ],
55
+ mysqldump_dir: [
56
+ { required: true, message: "dump文件位置必须输入", trigger: "blur" },
57
+ {
58
+ min: 1,
59
+ max: 300,
60
+ message: "长度在 1 到 300 个字符",
61
+ trigger: "blur",
62
+ },
63
+ ],
64
+ back_formatter: [
65
+ { required: true, message: "备份文件格式必须输入", trigger: "blur" },
66
+ {
67
+ max: 20,
68
+ message: "长度在 0 到 20个字符",
69
+ trigger: "blur",
70
+ },
71
+ ],
72
+ },
73
+ };
74
+ },
75
+ mounted() {
76
+ // if (this.$route.params.status === 0 || this.$route.params.status === 0) {
77
+ // this.form.id = this.$route.params.id;
78
+ // this.form.name = this.$route.params.name;
79
+ // this.form.note = this.$route.params.note;
80
+ // this.form.phone = this.$route.params.phone;
81
+ // this.form.title = this.$route.params.title;
82
+ // }
83
+ console.log(this.rowData);
84
+ },
85
+ methods: {
86
+ onSubmit() {
87
+ this.$refs["form"].validate((valid) => {
88
+ if (valid) {
89
+ let param = {
90
+ id: this.rowData.id,
91
+ back_dir: this.rowData.back_dir,
92
+ mysqldump_dir: this.rowData.mysqldump_dir,
93
+ back_pre: this.rowData.back_pre,
94
+ back_suf: this.rowData.back_suf,
95
+ back_formatter: this.rowData.back_formatter,
96
+ };
97
+ configUpdate(param).then((res) => {
98
+ this.$message.success(res.data.info);
99
+ });
100
+ } else {
101
+ return false;
102
+ }
103
+ });
104
+ },
105
+ },
106
+ };
107
+ </script>
@@ -0,0 +1,7 @@
1
+ import LeButtonSelectMedia from "./src/main.vue";
2
+
3
+ LeButtonSelectMedia.install = function (Vue) {
4
+ Vue.component(LeButtonSelectMedia.name, LeButtonSelectMedia);
5
+ };
6
+
7
+ export default LeButtonSelectMedia;
@@ -0,0 +1,87 @@
1
+ <template>
2
+ <div class="le-button-select-media">
3
+ <le-button type="primary" id="btnSelectMedia" @click="onClick">{{
4
+ btnTitle
5
+ }}</le-button>
6
+ <le-dialog-container
7
+ :title="title"
8
+ :showDialog="showDialog"
9
+ :showFooter="showFooter"
10
+ :width="width"
11
+ :showCloseBtnTop="showCloseBtnTop"
12
+ @close="closeDialog"
13
+ >
14
+ <le-media-list
15
+ :multiple="multiple"
16
+ :systemMaterialListApi="systemMaterialListApi"
17
+ ref="selectMedias"
18
+ v-if="showDialog"
19
+ @selectContent="selectContent"
20
+ ></le-media-list>
21
+ </le-dialog-container>
22
+ </div>
23
+ </template>
24
+ <script>
25
+ import { systemMaterialList } from "@/api/media";
26
+ export default {
27
+ name: "le-button-select-media",
28
+ props: {
29
+ btnTitle: {
30
+ type: String,
31
+ default: "选择素材",
32
+ },
33
+ width: {
34
+ type: String,
35
+ default: "70%",
36
+ },
37
+ title: {
38
+ type: String,
39
+ default: "选择素材",
40
+ },
41
+ param: {
42
+ type: [Object, String, Number],
43
+ default: () => {},
44
+ },
45
+ multiple: {
46
+ type: Boolean,
47
+ default: true,
48
+ },
49
+ showFooter: {
50
+ type: Boolean,
51
+ default: false,
52
+ },
53
+ showCloseBtnTop: {
54
+ type: Boolean,
55
+ default: true,
56
+ },
57
+ },
58
+ data() {
59
+ return {
60
+ showDialog: false,
61
+ };
62
+ },
63
+ methods: {
64
+ systemMaterialListApi(params) {
65
+ return systemMaterialList(params);
66
+ },
67
+ onClick() {
68
+ this.showDialog = true;
69
+ },
70
+ closeDialog() {
71
+ this.showDialog = false;
72
+ },
73
+ selectContent(value) {
74
+ this.$emit("selectContent", value, this.param);
75
+ if (!this.multiple) {
76
+ this.closeDialog();
77
+ }
78
+ },
79
+ },
80
+ };
81
+ </script>
82
+ <style lang="scss" scoped>
83
+ .le-button-select-media {
84
+ margin-left: 8px;
85
+ margin-right: 8px;
86
+ }
87
+ </style>
@@ -0,0 +1,7 @@
1
+ import LeButtonUpload from "./src/main.vue";
2
+
3
+ LeButtonUpload.install = function (Vue) {
4
+ Vue.component(LeButtonUpload.name, LeButtonUpload);
5
+ };
6
+
7
+ export default LeButtonUpload;