@smart100/spu-web-plugin 0.0.25 → 0.0.26

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.
@@ -708,7 +708,7 @@ function _toPropertyKey$1(arg) {
708
708
  return typeof key === "symbol" ? key : String(key);
709
709
  }
710
710
 
711
- var version = "0.0.25";
711
+ var version = "0.0.26";
712
712
 
713
713
  /** Detect free variable `global` from Node.js. */
714
714
  var freeGlobal$2 = typeof global == 'object' && global && global.Object === Object && global;
@@ -12353,7 +12353,8 @@ var WxworksuiteTree = /*#__PURE__*/function (_LitElement) {
12353
12353
  // 判断是否开启企微通信录支持,默认不开启
12354
12354
  _this.iswwopendata = false;
12355
12355
  // 控制通信录转移类型
12356
- _this.wwopendatatype = ''; // userName | departmentName | express
12356
+ _this.wwopendatatype = ''; // userName | departmentName | expression
12357
+ _this.valuekey = 'id'; // 默认id 也可定义别的属性值比如 codepath(被定义的属性值必须唯一)
12357
12358
  _this.ismulselect = false;
12358
12359
  _this.displaytype = 'mobile'; // web | mobile
12359
12360
  _this.issearch = true;
@@ -12601,7 +12602,7 @@ var WxworksuiteTree = /*#__PURE__*/function (_LitElement) {
12601
12602
  query_type = 1;
12602
12603
  } else if (this.wwopendatatype === 'departmentName') {
12603
12604
  query_type = 2;
12604
- } else if (this.wwopendatatype === 'express') {
12605
+ } else if (this.wwopendatatype === 'expression') {
12605
12606
  query_type = 0;
12606
12607
  }
12607
12608
  return normalAxios$1.post('/api/wxwork/contact/search', {
@@ -12643,8 +12644,8 @@ var WxworksuiteTree = /*#__PURE__*/function (_LitElement) {
12643
12644
  }
12644
12645
  }, {
12645
12646
  key: "getValue",
12646
- value: function getValue() {
12647
- var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'id';
12647
+ value: function getValue(type) {
12648
+ var _this3 = this;
12648
12649
  if (this.ismulselect) {
12649
12650
  var arr = this._list.filter(function (item) {
12650
12651
  return item.checkstate === '1';
@@ -12670,63 +12671,99 @@ var WxworksuiteTree = /*#__PURE__*/function (_LitElement) {
12670
12671
  return !(item !== null && item !== void 0 && item.parent);
12671
12672
  });
12672
12673
  }
12673
- if (type === 'id') {
12674
+ if (!type) {
12674
12675
  var _arr;
12675
12676
  return (_arr = arr) !== null && _arr !== void 0 && _arr.length ? arr.map(function (item) {
12676
- return item.id;
12677
+ return item[_this3.valuekey];
12677
12678
  }) : [];
12678
12679
  } else if (type === 'name') {
12679
12680
  var _arr2;
12680
12681
  return (_arr2 = arr) !== null && _arr2 !== void 0 && _arr2.length ? arr.map(function (item) {
12681
12682
  return item.name;
12682
12683
  }) : [];
12683
- } else {
12684
+ } else if (type === 'fullvalue') {
12684
12685
  var _arr3;
12685
12686
  return (_arr3 = arr) !== null && _arr3 !== void 0 && _arr3.length ? cloneDeep(arr) : [];
12687
+ } else {
12688
+ var _arr4;
12689
+ return (_arr4 = arr) !== null && _arr4 !== void 0 && _arr4.length ? arr.map(function (item) {
12690
+ return item[type];
12691
+ }) : [];
12686
12692
  }
12687
12693
  } else {
12688
12694
  var obj = this._list.find(function (item) {
12689
12695
  return item.isselected;
12690
12696
  });
12691
- if (type === 'id') {
12692
- return obj ? obj.id : '';
12697
+ if (!type) {
12698
+ return obj ? obj[this.valuekey] : '';
12693
12699
  } else if (type === 'name') {
12694
12700
  return obj ? obj.name : '';
12695
- } else {
12701
+ } else if (type === 'fullvalue') {
12696
12702
  return obj ? cloneDeep(obj) : null;
12703
+ } else {
12704
+ return obj ? obj[type] : '';
12705
+ }
12706
+ }
12707
+ }
12708
+ }, {
12709
+ key: "_transValuekeyValueToIdValue",
12710
+ value: function _transValuekeyValueToIdValue(value) {
12711
+ var _this4 = this;
12712
+ if (this.valuekey === 'id') {
12713
+ return value;
12714
+ } else {
12715
+ if (Array.isArray(value)) {
12716
+ return value.map(function (item) {
12717
+ var a = _this4._list.find(function (item2) {
12718
+ return item2[_this4.valuekey] === item;
12719
+ });
12720
+ return (a === null || a === void 0 ? void 0 : a.id) || '';
12721
+ });
12722
+ } else {
12723
+ if (value) {
12724
+ var a = this._list.find(function (item2) {
12725
+ return item2[_this4.valuekey] === value;
12726
+ });
12727
+ return (a === null || a === void 0 ? void 0 : a.id) || '';
12728
+ } else {
12729
+ return value;
12730
+ }
12697
12731
  }
12698
12732
  }
12699
12733
  }
12700
12734
  }, {
12701
12735
  key: "setValue",
12702
12736
  value: function setValue(value) {
12703
- var _this3 = this;
12737
+ var _this5 = this;
12738
+ var idValue = this._transValuekeyValueToIdValue(value);
12704
12739
  // debugger
12705
12740
  if (this.ismulselect) {
12706
12741
  this._list.forEach(function (item) {
12707
12742
  item.checkstate = '0';
12708
12743
  });
12709
- (value === null || value === void 0 ? void 0 : value.length) && value.forEach(function (item) {
12710
- _this3._setCheck(item, '1');
12744
+ Array.isArray(idValue) && idValue.forEach(function (item) {
12745
+ _this5._setCheck(item, '1');
12711
12746
  });
12712
12747
  this._updateTemplate();
12713
12748
  } else {
12714
- this._setSelect(value, true);
12749
+ this._setSelect(idValue, true);
12715
12750
  this._updateTemplate();
12716
12751
  }
12717
12752
  }
12718
12753
  }, {
12719
12754
  key: "setCheck",
12720
- value: function setCheck(id) {
12721
- var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
12722
- this._setCheck(id, value ? '1' : '0');
12755
+ value: function setCheck(value) {
12756
+ var flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
12757
+ var idValue = this._transValuekeyValueToIdValue(value);
12758
+ this._setCheck(idValue, flag ? '1' : '0');
12723
12759
  this._updateTemplate();
12724
12760
  }
12725
12761
  }, {
12726
12762
  key: "setSelect",
12727
- value: function setSelect(id) {
12728
- var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
12729
- this._setSelect(id, value);
12763
+ value: function setSelect(value) {
12764
+ var flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
12765
+ var idValue = this._transValuekeyValueToIdValue(value);
12766
+ this._setSelect(idValue, flag);
12730
12767
  this._updateTemplate();
12731
12768
  }
12732
12769
  }, {
@@ -12735,7 +12772,7 @@ var WxworksuiteTree = /*#__PURE__*/function (_LitElement) {
12735
12772
  var _this$_data,
12736
12773
  _this$_data2,
12737
12774
  _this$_searchlist,
12738
- _this4 = this;
12775
+ _this6 = this;
12739
12776
  return x(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n <div class=", ">\n <!-- <button class=\"demo\" @click=\"", "\">\n _test\n ", "\n </button> -->\n\n ", "\n\n ", "\n </div>\n "])), e$5({
12740
12777
  'tree': true,
12741
12778
  'tree-web': this.displaytype === 'web',
@@ -12745,11 +12782,11 @@ var WxworksuiteTree = /*#__PURE__*/function (_LitElement) {
12745
12782
  }), this._searchvalue ? x(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteral(["\n ", "\n "])), this !== null && this !== void 0 && (_this$_searchlist = this._searchlist) !== null && _this$_searchlist !== void 0 && _this$_searchlist.length ? x(_templateObject5$1 || (_templateObject5$1 = _taggedTemplateLiteral(["\n ", "\n "])), c(this._searchlist, function (item) {
12746
12783
  return item.id;
12747
12784
  }, function (item, index) {
12748
- return x(_templateObject6$1 || (_templateObject6$1 = _taggedTemplateLiteral(["\n <wxworksuite-treenode\n displaytype=\"", "\"\n expandmode=\"", "\"\n expandicon=\"", "\"\n .node=\"", "\"\n .isonelevel=\"", "\"\n .isrenderchildren=\"", "\"\n .iswwopendata=\"", "\"\n wwopendatatype=\"", "\"\n .ismulselect=\"", "\"\n .updatepoint=\"", "\"\n @toggle=\"", "\"\n >\n </wxworksuite-treenode>\n "])), _this4.displaytype, _this4.expandmode, _this4.expandicon, item, true, false, _this4.iswwopendata, _this4.wwopendatatype, _this4.ismulselect, _this4._updatepoint, _this4._handleToggle);
12785
+ return x(_templateObject6$1 || (_templateObject6$1 = _taggedTemplateLiteral(["\n <wxworksuite-treenode\n displaytype=\"", "\"\n expandmode=\"", "\"\n expandicon=\"", "\"\n .node=\"", "\"\n .isonelevel=\"", "\"\n .isrenderchildren=\"", "\"\n .iswwopendata=\"", "\"\n wwopendatatype=\"", "\"\n .ismulselect=\"", "\"\n .updatepoint=\"", "\"\n @toggle=\"", "\"\n >\n </wxworksuite-treenode>\n "])), _this6.displaytype, _this6.expandmode, _this6.expandicon, item, true, false, _this6.iswwopendata, _this6.wwopendatatype, _this6.ismulselect, _this6._updatepoint, _this6._handleToggle);
12749
12786
  })) : x(_templateObject7$1 || (_templateObject7$1 = _taggedTemplateLiteral(["\n <div class=\"tree-none\">\u6682\u65E0\u641C\u7D22\u7ED3\u679C</div>\n "])))) : x(_templateObject8$1 || (_templateObject8$1 = _taggedTemplateLiteral(["\n ", "\n "])), c(this._data, function (item) {
12750
12787
  return item.id;
12751
12788
  }, function (item, index) {
12752
- return x(_templateObject9$1 || (_templateObject9$1 = _taggedTemplateLiteral(["\n <wxworksuite-treenode\n displaytype=\"", "\"\n expandmode=\"", "\"\n expandicon=\"", "\"\n .node=\"", "\"\n .isonelevel=\"", "\"\n .isrenderchildren=\"", "\"\n .iswwopendata=\"", "\"\n wwopendatatype=\"", "\"\n .ismulselect=\"", "\"\n .updatepoint=\"", "\"\n @toggle=\"", "\"\n >\n </wxworksuite-treenode>\n "])), _this4.displaytype, _this4.expandmode, _this4.expandicon, item, _this4._isonelevel, true, _this4.iswwopendata, _this4.wwopendatatype, _this4.ismulselect, _this4._updatepoint, _this4._handleToggle);
12789
+ return x(_templateObject9$1 || (_templateObject9$1 = _taggedTemplateLiteral(["\n <wxworksuite-treenode\n displaytype=\"", "\"\n expandmode=\"", "\"\n expandicon=\"", "\"\n .node=\"", "\"\n .isonelevel=\"", "\"\n .isrenderchildren=\"", "\"\n .iswwopendata=\"", "\"\n wwopendatatype=\"", "\"\n .ismulselect=\"", "\"\n .updatepoint=\"", "\"\n @toggle=\"", "\"\n >\n </wxworksuite-treenode>\n "])), _this6.displaytype, _this6.expandmode, _this6.expandicon, item, _this6._isonelevel, true, _this6.iswwopendata, _this6.wwopendatatype, _this6.ismulselect, _this6._updatepoint, _this6._handleToggle);
12753
12790
  }))) : x(_templateObject10$1 || (_templateObject10$1 = _taggedTemplateLiteral(["<div class=\"tree-none\">\u6682\u65E0\u6570\u636E</div>"]))));
12754
12791
  }
12755
12792
  }], [{
@@ -12774,6 +12811,9 @@ __decorate([n$1({
12774
12811
  __decorate([n$1({
12775
12812
  type: String
12776
12813
  })], WxworksuiteTree.prototype, "wwopendatatype", void 0);
12814
+ __decorate([n$1({
12815
+ type: String
12816
+ })], WxworksuiteTree.prototype, "valuekey", void 0);
12777
12817
  __decorate([n$1({
12778
12818
  type: Boolean
12779
12819
  })], WxworksuiteTree.prototype, "ismulselect", void 0);
@@ -13322,7 +13362,9 @@ var WxworksuitePluginInstall = function WxworksuitePluginInstall(options) {
13322
13362
  console.log('@smart100/wxworksuite-plugin install');
13323
13363
  console.log('@smart100/wxworksuite-plugin userOptions', options);
13324
13364
  console.log('@smart100/wxworksuite-plugin globalOptions', globalOptions$1);
13325
- // console.error('test')
13365
+ // setTimeout(() => {
13366
+ // console.error('@smart100/wxworksuite-plugin change')
13367
+ // }, 3000)
13326
13368
  initAxios$1(globalOptions$1);
13327
13369
  for (var x in components) {
13328
13370
  components[x].register();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smart100/spu-web-plugin",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "npm run build:types && rollup -c -w",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@amap/amap-jsapi-loader": "^1.0.1",
41
- "@smart100/wxworksuite-plugin": "^0.0.5",
41
+ "@smart100/wxworksuite-plugin": "^0.0.6",
42
42
  "axios": "^1.6.0",
43
43
  "co": "^4.6.0",
44
44
  "dayjs": "^1.11.10",