@zscreate/zhxy-app-component 1.0.0

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.
Files changed (70) hide show
  1. package/components/dying318-picker/Demo.vue +342 -0
  2. package/components/dying318-picker/Picker.nvue +441 -0
  3. package/components/dying318-picker/Picker.vue +442 -0
  4. package/components/dying318-picker/Pickers.vue +321 -0
  5. package/components/dying318-picker/README.md +479 -0
  6. package/components/easydrag-sort/easydrag-sort.vue +248 -0
  7. package/components/evan-form/evan-form.vue +102 -0
  8. package/components/evan-form/utils.js +125 -0
  9. package/components/evan-form-item/evan-form-item.vue +1457 -0
  10. package/components/evan-form-item/mixins/computedMixin.js +44 -0
  11. package/components/evan-form-item/mixins/pubSubMixin.js +104 -0
  12. package/components/evan-form-item/mixins/validateByApiMinxins.js +21 -0
  13. package/components/evan-form-item/mixins/validateFormMixin.js +71 -0
  14. package/components/evan-form-item/mixins/valueChangeMixin.js +64 -0
  15. package/components/evan-form-item/modules/edit.png +0 -0
  16. package/components/evan-form-item/utilForForm.js +35 -0
  17. package/components/evan-form-item/utils.js +51 -0
  18. package/components/form-container/data.js +709 -0
  19. package/components/form-container/form-container.vue +897 -0
  20. package/components/jin-edit/jin-edit.vue +327 -0
  21. package/components/jin-edit/jin-icons.vue +48 -0
  22. package/components/jin-edit/readme.md +65 -0
  23. package/components/l-file/l-file.vue +260 -0
  24. package/components/lb-picker/index.vue +286 -0
  25. package/components/signatrue-write/signatrue-write.vue +220 -0
  26. package/components/t-color-picker/t-color-picker.vue +784 -0
  27. package/components/uni-datetime-picker/changelog.md +76 -0
  28. package/components/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue +182 -0
  29. package/components/uni-datetime-picker/components/uni-datetime-picker/calendar.js +546 -0
  30. package/components/uni-datetime-picker/components/uni-datetime-picker/calendar.vue +1024 -0
  31. package/components/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json +19 -0
  32. package/components/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js +8 -0
  33. package/components/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json +19 -0
  34. package/components/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json +19 -0
  35. package/components/uni-datetime-picker/components/uni-datetime-picker/keypress.js +45 -0
  36. package/components/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue +927 -0
  37. package/components/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue +966 -0
  38. package/components/uni-datetime-picker/components/uni-datetime-picker/util.js +437 -0
  39. package/components/uni-datetime-picker/components/uni-datetime-picker/year-mont-picker.vue +901 -0
  40. package/components/uni-datetime-picker/components/uni-datetime-picker/year-picker.vue +271 -0
  41. package/components/uni-datetime-picker/package.json +89 -0
  42. package/components/uni-datetime-picker/readme.md +159 -0
  43. package/components/uni-icons/icons.js +96 -0
  44. package/components/uni-icons/uni-icons.vue +57 -0
  45. package/components/uni-popup/message.js +29 -0
  46. package/components/uni-popup/popup.js +25 -0
  47. package/components/uni-popup/uni-popup-dialog.vue +243 -0
  48. package/components/uni-popup/uni-popup-message.vue +116 -0
  49. package/components/uni-popup/uni-popup-share.vue +165 -0
  50. package/components/uni-popup/uni-popup.vue +297 -0
  51. package/components/uni-rate/uni-rate.vue +140 -0
  52. package/components/uni-transition/uni-transition.vue +279 -0
  53. package/components/uploadFile/uploadFile.vue +124 -0
  54. package/components/viewcomponents/applicateGrid.vue +96 -0
  55. package/components/viewcomponents/card.vue +166 -0
  56. package/components/viewcomponents/formCard.vue +82 -0
  57. package/components/viewcomponents/infocell.vue +122 -0
  58. package/components/viewcomponents/navsearch.vue +59 -0
  59. package/components/viewcomponents/newscontent.vue +85 -0
  60. package/components/xp-picker/util.js +105 -0
  61. package/components/xp-picker/xp-picker.vue +330 -0
  62. package/index.js +9 -0
  63. package/package.json +29 -0
  64. package/static/iconfont.css +32 -0
  65. package/static/mttf.ttf +0 -0
  66. package/static/uni.ttf +0 -0
  67. package/utils/js-interp.js +6501 -0
  68. package/utils/js-interp.md +10 -0
  69. package/utils/moment.js +4601 -0
  70. package/utils/util.js +106 -0
@@ -0,0 +1,44 @@
1
+ export const computedMixin = {
2
+ computed: {
3
+ mLabelStyle() {
4
+ const parent = this.getParent()
5
+ let labelStyle = Object.assign({}, (parent.labelStyle || {}), (this.labelStyle || {}))
6
+ let arr = Object.keys(labelStyle).map((key) => `${key}:${labelStyle[key]}`)
7
+ return arr.join(';')
8
+ },
9
+ mContentStyle() {
10
+ let contentStyle = Object.assign({}, this.contentStyle || {})
11
+ let arr = Object.keys(contentStyle).map((key) => `${key}:${contentStyle[key]}`)
12
+ return arr.join(';')
13
+ },
14
+ mLabelPosition() {
15
+ if (this.labelPosition) {
16
+ return this.labelPosition
17
+ }
18
+ const parent = this.getParent()
19
+ if (parent) {
20
+ return parent.labelPosition
21
+ }
22
+ return 'left'
23
+ },
24
+ // 整个表单是否有*号
25
+ hasRequiredAsterisk() {
26
+ const parent = this.getParent()
27
+ if (parent) {
28
+ return parent.hasRequiredAsterisk
29
+ }
30
+ return false
31
+ },
32
+ showRequiredAsterisk() {
33
+ /**子表单必选要深入下一层rules**/
34
+ const rules = this.tableKey ? this.rules[this.tableKey][this.widget.model] : this.rules[this.widget
35
+ .model];
36
+ if (rules && rules.length > 0) {
37
+ if (rules.find((rule) => rule.required === true)) {
38
+ return true
39
+ }
40
+ }
41
+ return false
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,104 @@
1
+ import Pubsub from 'pubsub-js'
2
+
3
+ import validateByApiMinxins from './validateByApiMinxins'
4
+ import { run } from "../../../utils/js-interp"
5
+
6
+ export const pubSubMixin = {
7
+ mixins: [validateByApiMinxins],
8
+ methods: {
9
+ publish: Pubsub.publish, // 发布方法
10
+ parseInt: parseInt, // 取整
11
+ toFixed(num, length = 2, type = 1) { // 保留几位小数 默认number类型,为了部分校验
12
+ var num = Number(num).toFixed(length);
13
+ return type ? Number(num) : num;
14
+ },
15
+ //关联组件
16
+ /**
17
+ * @description 订阅消息
18
+ * @return void
19
+ */
20
+ pubsubScribe() {
21
+ let subscribeKey = this.widget.options.subscribeOptions ?
22
+ this.widget.options.subscribeOptions.subscribeKey :
23
+ '';
24
+ if (subscribeKey) {
25
+ // console.log('订阅');
26
+ let tableIndex = this.tableIndex; //子表单联动
27
+ subscribeKey = this.tableKey ? tableIndex + '_' + subscribeKey : subscribeKey;
28
+ this.pubsubSign = Pubsub.subscribe(subscribeKey, (msg, data) => {
29
+ console.log('接受消息', data);
30
+ // console.log(msg, data);
31
+ if (data.hasOwnProperty('updateModel') && data.updateModel) { // 用于脚本里面精准更新model 避免通过监听models值来更新 model
32
+ this.updateModelByPulish(data.value)
33
+ return false;
34
+ }
35
+
36
+ // 订阅者接受指定 当data对象具有method属性时候 通过策略模式处理相关方法
37
+ if (data.hasOwnProperty("method")) {
38
+ console.log("method==")
39
+ try {
40
+ this[data.method](data.args);
41
+ } catch (error) {
42
+
43
+ }
44
+ return false
45
+ }
46
+
47
+ this.updateModelByScript(data, data.msg)
48
+ });
49
+ }
50
+ },
51
+ updateModelByScript(data, list) {
52
+ this.isClickByUser = data.isClickByUser;
53
+ console.log(run(data.operateValue, {
54
+ that: this,
55
+ global: globalThis,
56
+ list,
57
+ isWx: true,
58
+ uni
59
+ }))
60
+ },
61
+ /**
62
+ * @description 发布消息
63
+ * @params { string/number/object } val 发布的内容
64
+ * @return void
65
+ */
66
+ pulishMsg(val, isClickByUser = false) {
67
+ let relateOptions = this.widget.options.relateOptions;
68
+ if (relateOptions && relateOptions.length > 0) {
69
+ relateOptions.forEach(item => {
70
+ let publishKey = this.tableKey ? this.tableIndex + '_' + item.publishKey : item
71
+ .publishKey; //子表单联动
72
+ if (item.isTableChild === false) publishKey = item.publishKey // 非子表单; false 兼容之前的逻辑; 之前为 ""
73
+ Pubsub.publish(publishKey, {
74
+ ...item,
75
+ msg: val,
76
+ isClickByUser
77
+ });
78
+ });
79
+ }
80
+ },
81
+
82
+ resetByflag(flag) {
83
+ if (flag) {
84
+ this.resetDataModel();
85
+ }
86
+ },
87
+ resetDataModel() {
88
+ //部分组件重置dataModel 需要重写
89
+ if (this.widget.type == "userSelector" || this.widget.type == "deptSelector") {
90
+ this.dataModel = []
91
+ } else {
92
+ this.dataModel = '';
93
+ }
94
+ },
95
+ // 通过消息发布 改变dataModel
96
+ updateModelByPulish(value) {
97
+ if (value == undefined || value == null) {
98
+ return false
99
+ }
100
+ this.dataModel = value
101
+ },
102
+
103
+ }
104
+ }
@@ -0,0 +1,21 @@
1
+ const API = '/form/formdesiger/countLeaveDays'
2
+ export default {
3
+ methods: {
4
+ validateByApiMinxins(args) {
5
+ let api = args.api || API,
6
+ kssj = args.fnArgs[0],
7
+ jssj = args.fnArgs[1];
8
+ if (kssj && jssj) {
9
+ let params = {
10
+ kssj,
11
+ jssj
12
+ }
13
+ this.$u.get(api, params).then(res => {
14
+ res.success && this.updateModelByPulish(res.result)
15
+ })
16
+ } else {
17
+ this.updateModelByPulish('0')
18
+ }
19
+ }
20
+ },
21
+ }
@@ -0,0 +1,71 @@
1
+ import utils from '../utils.js'
2
+ export const validateFormMixin = {
3
+ methods: {
4
+ /****表单校验***/
5
+ validateInit() {
6
+ // this.firstValidateField = false;
7
+ return new Promise((resolve, reject) => {
8
+ this.validateFieldDIY(this.prop, res => {
9
+ // console.log('res', res)
10
+ /*******
11
+ *res
12
+ *null代表验证通过
13
+ * []代表验证不通过的规则
14
+ *******/
15
+ this.showFalse = !res ? false : true;
16
+ this.showFalseMsg = res ? res[0].message : ''; //获取错误信息
17
+ if (!res) {
18
+ resolve(true)
19
+ } else {
20
+ reject(false)
21
+ }
22
+ });
23
+ })
24
+ },
25
+ scrollToTop(top) {
26
+ this.$nextTick(function() {
27
+ console.log("校验top",top)
28
+ // console.log('toscrolltotop', top)
29
+ uni.createSelectorQuery()
30
+ .in(this)
31
+ .select('.showFalse').boundingClientRect(data => {
32
+ console.log("校验 data.top", data.top)
33
+ uni.pageScrollTo({
34
+ scrollTop: data.top - top,
35
+ duration: 0
36
+ });
37
+ }).exec()
38
+ })
39
+ },
40
+ validateFieldDIY(props, callback) {
41
+ var tempModel = {};
42
+ var rules = []
43
+ if (this.tableKey) {
44
+ tempModel = this.models[this.tableKey][this.tableIndex];
45
+ rules = this.rules[this.tableKey];
46
+ } else {
47
+ tempModel = this.models;
48
+ rules = this.rules
49
+ }
50
+ if (['rate', 'number'].includes(this.widget.type) && rules[this.widget.model].length > 0) {
51
+ rules[this.widget.model][0]['type'] = "number"
52
+ }
53
+
54
+ if (this.widget.type == 'rate') {
55
+ console.log(rules, props, tempModel[this.widget.model])
56
+ }
57
+ utils.validateItem(rules, props, tempModel[this.widget.model], callback)
58
+ },
59
+ // 当前formItem是否显示*号
60
+ showRequiredAsteriskFun() {
61
+ const rules = this.rules[this.widget.model];
62
+ // console.log('rules', rules)
63
+ if (rules && rules.length > 0) {
64
+ if (rules.find((rule) => rule.required === true)) {
65
+ return true
66
+ }
67
+ }
68
+ return false
69
+ },
70
+ }
71
+ }
@@ -0,0 +1,64 @@
1
+ export const valueChangeMixin = {
2
+ methods: {
3
+ /**文件dataModal**/
4
+ filePost(val) {
5
+ this.dataModel.push(val)
6
+ },
7
+ /**imgdataModal**/
8
+ imgUrlPost(val) {
9
+ this.dataModel = [...val];
10
+ },
11
+ cityChecked(val) {
12
+ this.dataModel = val;
13
+ // console.log('submitCity', val)
14
+ },
15
+ /***numberbox修改赋值***/
16
+ numberBoxClick() { // 确实是用户手动修改值
17
+ this.isClickByUser = true;
18
+ // this.dataModel = num.value
19
+ },
20
+ //开关
21
+ switch1Change: function(e) {
22
+ this.dataModel = e.target.value
23
+ },
24
+ //滑块
25
+ sliderChange(e) {
26
+ this.dataModel = e.detail.value
27
+ },
28
+ //单选
29
+ radioChange(evt) {
30
+ this.dataModel = evt.detail.value
31
+ // console.log(evt.detail.value)
32
+ },
33
+ //多选
34
+ checkboxChange: function(e) {
35
+ var items = this.checkboxAndRadioOptions,
36
+ values = e.detail.value;
37
+ for (var i = 0, lenI = items.length; i < lenI; ++i) {
38
+ const item = items[i]
39
+ if (values.includes(item.value)) {
40
+ this.$set(item, 'checked', true)
41
+ } else {
42
+ this.$set(item, 'checked', false)
43
+ }
44
+ }
45
+ this.dataModel = values
46
+ },
47
+ changeTime(e, index) {
48
+ if (this.widget.options.isRange) {
49
+ this.$set(this.dataModel, index, e.value)
50
+ } else {
51
+ this.dataModel = e.value
52
+ }
53
+ },
54
+ changedate(e) {
55
+ this.dataModel = e.detail.value
56
+ },
57
+ //rate value chage
58
+ changeRate(value) {
59
+ if (value.value) {
60
+ this.dataModel = value.value
61
+ }
62
+ },
63
+ }
64
+ }
@@ -0,0 +1,35 @@
1
+ export const getMode = (format) => {
2
+ if (!format) return "his"
3
+ format = format.toLowerCase();
4
+ switch (format) {
5
+ case 'yyyy-mm-dd':
6
+ return "ymd"
7
+ break;
8
+ case 'yyyy-mm-dd hh:mm:ss':
9
+ return "ymdhis"
10
+ break;
11
+ case 'yyyy-mm-dd hh:mm':
12
+ return "ymdhi"
13
+ break;
14
+ case 'yyyy-mm-dd hh':
15
+ return "ymdh"
16
+ break;
17
+ case 'hh:mm':
18
+ return "hi"
19
+ break;
20
+ case 'mm:ss':
21
+ return "is"
22
+ break;
23
+ case 'hh':
24
+ return "h"
25
+ break;
26
+ case 'mm':
27
+ return "i"
28
+ break;
29
+ case 'ss':
30
+ return "s"
31
+ break;
32
+ default:
33
+ return "his"
34
+ }
35
+ }
@@ -0,0 +1,51 @@
1
+ import AsyncValidator from 'async-validator'
2
+ const utils = {
3
+ validateItem(rules, prop, value, callback) {
4
+ if (!rules || JSON.stringify(rules) === '{}') {
5
+ if (callback instanceof Function) {
6
+ callback();
7
+ }
8
+ return true;
9
+ }
10
+ const propRules = [].concat(rules[prop] || []);
11
+ propRules.forEach((rule) => {
12
+ if (rule.pattern) {
13
+ rule.pattern = new RegExp(rule.pattern)
14
+ }
15
+ })
16
+ const descriptor = {
17
+ [prop]: propRules
18
+ };
19
+
20
+ /**
21
+ * 拓展 数组类的value 校验;只需满足非空数组即可
22
+ * **/
23
+ if(typeof value == "object" && value.constructor == Array ){
24
+ console.log('===',descriptor)
25
+ }
26
+ if(typeof value == "object" && value.constructor == Array && value.length > 0){
27
+ callback(null);
28
+ return false;
29
+ }else if(typeof value == 'boolean'){
30
+ callback(null);
31
+ return false;
32
+ }
33
+
34
+ /**
35
+ * 拓展 数组类的value 校验;
36
+ * **/
37
+ const validator = new AsyncValidator(descriptor);
38
+ const model = {
39
+ [prop]: value
40
+ };
41
+
42
+ validator.validate(model, {
43
+ firstFields: true,
44
+ first:true,
45
+ }, (errors) => {
46
+ callback(errors);
47
+ });
48
+ },
49
+ }
50
+
51
+ export default utils