centaline-data-driven-v3 0.1.31 → 0.1.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "centaline-data-driven-v3",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
4
4
  "private": false,
5
5
  "description": "centaline-data-driven-v3",
6
6
  "main": "dist/centaline-data-driven-v3.umd.js",
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <ct-field :vmodel="model">
3
- <template #Control v-if="model.code1">
3
+ <template #Control>
4
4
  <template v-if="model.controlType == Enum.ControlType.HtmlLabel">
5
5
  <span class="ct-html" :class="{ 'cursor-pointer': model.onChanged }" @click="clickHandle"
6
6
  v-html="HtmlReplace(model.value)"></span>
@@ -51,6 +51,10 @@ const props = defineProps({
51
51
  Number,
52
52
  default: 500,
53
53
  },
54
+ apiParam: {
55
+ type: Object,
56
+ default: () => { },
57
+ }
54
58
  })
55
59
  const refTree = ref()
56
60
  const rootNode = ref();
@@ -64,7 +68,7 @@ const defaultProps = ref({
64
68
  id: 'code',
65
69
  })
66
70
  const searchStatus = ref([])
67
-
71
+ const screenPara = ref(props.apiParam);
68
72
  const menuVisible = ref(false)//右键菜单显示控制
69
73
  const currentData = ref({ code: "" })// 当前节点所对应的数据
70
74
  const currentNode = ref(null)//当前节点对应的 Node
@@ -91,33 +95,34 @@ onBeforeUnmount(() => {
91
95
 
92
96
  //搜索(查询条件调用)
93
97
  function search(m) {
98
+ screenPara.value = m;
94
99
  if (searchStatus.value.length == 0) {
95
100
  // 重置计数器
96
101
  retryCount.value = 0
97
102
  if (qrtimer.value) clearTimeout(qrtimer.value);
98
103
  searchStatus.value.push('a');
99
104
  rootNode.value.childNodes = []
100
- loadNode(rootNode.value, rootResolve.value, m)
105
+ loadNode(rootNode.value, rootResolve.value)
101
106
  }
102
107
  else {
103
108
  if (retryCount.value >= 50) {
104
- console.warn(`搜索繁忙,请稍后再试`);
109
+ console.warn(`搜索繁忙,请稍后再试`);
105
110
  return;
106
111
  }
107
112
  retryCount.value++
108
113
 
109
114
  qrtimer.value = setTimeout(() => {
110
- search(m);
115
+ search();
111
116
  }, 200);
112
117
  }
113
118
  }
114
119
  //加载节点(点击节点加号时调用)
115
- function loadNode(node, resolve, m) {
120
+ function loadNode(node, resolve) {
116
121
  if (node.level === 0) {
117
122
  loading.value = true;
118
123
  rootNode.value = node
119
124
  rootResolve.value = resolve;
120
- return SearchTree(m || undefined).then(data => {
125
+ return SearchTree(screenPara.value || undefined).then(data => {
121
126
  loading.value = false;
122
127
  resolve(data.rows);
123
128
  load(data, true)
@@ -126,7 +131,15 @@ function loadNode(node, resolve, m) {
126
131
  if (node.level >= 1) {
127
132
  let fields = model.value.searchData("code", node.data.code, 9, 3);
128
133
  let filter = {
129
- "searchData": fields
134
+ "searchData": {
135
+ // 先保留searchData的其他属性
136
+ ...(screenPara.value?.searchData || {}),
137
+ // 再合并fields数组(将两个数组合并,而不是覆盖)
138
+ fields: [
139
+ ...fields.fields,
140
+ ...(screenPara.value?.searchData?.fields || [])
141
+ ]
142
+ }
130
143
  };
131
144
  return SearchTree(filter).then(data => {
132
145
  loading.value = false;
@@ -204,7 +217,9 @@ function rightClick(event, object, Node) { // event、object该节点所对应
204
217
  }
205
218
  })
206
219
  }
207
- document.addEventListener('click', closeMenu) // 监听事件鼠标点击事件,若点击则隐藏菜单
220
+ if (menuVisible.value) {
221
+ document.addEventListener('click', closeMenu) // 监听事件鼠标点击事件,若点击则隐藏菜单
222
+ }
208
223
  }
209
224
  //关闭菜单
210
225
  function closeMenu() {
@@ -1,10 +1,11 @@
1
1
  <template>
2
2
  <div>
3
3
  <div ref="refscreenDiv" id="refscreenDiv">
4
- <ct-searchscreen ref="reftreescreen" :from="'tree'" style="padding-left: 11px;" :api="searchConditionApi" :screenPara="apiParam"
5
- @search="search" @loaded="screenload" ></ct-searchscreen>
4
+ <ct-searchscreen ref="reftreescreen" :from="'tree'" style="padding-left: 11px;" :api="searchConditionApi"
5
+ :screenPara="apiParam" @search="search" @loaded="screenload"></ct-searchscreen>
6
6
  </div>
7
- <tree v-if="loadTree" ref="reftree" :api="searchDataApi" @loaded="loaded" :treeHeight="treeHeight">
7
+ <tree v-if="loadTree" ref="reftree" :api="searchDataApi" @loaded="loaded" :treeHeight="treeHeight"
8
+ :apiParam="{ searchData:searchData }">
8
9
  </tree>
9
10
 
10
11
 
@@ -14,7 +15,7 @@
14
15
  import { ref, nextTick, watch, onMounted, onBeforeUnmount } from 'vue'
15
16
  import Tree from './Tree/Tree.vue';
16
17
  const emit = defineEmits(['loaded'])
17
- const loadTree=ref(false)
18
+ const loadTree = ref(false)
18
19
 
19
20
  const props = defineProps({
20
21
  searchConditionApi: String,
@@ -33,19 +34,19 @@ const refscreenDiv = ref()
33
34
  const reftreescreen = ref()
34
35
  const reftree = ref()
35
36
  const treeHeight = ref(0)
36
-
37
- const qrtimer=ref(null)
38
- onBeforeUnmount(()=>{
39
- if (qrtimer.value) {
40
- clearTimeout(qrtimer.value);
41
- qrtimer.value = null;
42
- }
37
+ const searchData = ref([])
38
+ const qrtimer = ref(null)
39
+ onBeforeUnmount(() => {
40
+ if (qrtimer.value) {
41
+ clearTimeout(qrtimer.value);
42
+ qrtimer.value = null;
43
+ }
43
44
  })
44
45
 
45
46
  function setTreeHeight() {
46
47
  nextTick(() => {
47
48
  if (refscreenDiv.value) {
48
- qrtimer.value = setTimeout(() => {
49
+ qrtimer.value = setTimeout(() => {
49
50
  let searchHeight = refscreenDiv.value.offsetHeight;
50
51
  treeHeight.value = props.searchtreeHeight - searchHeight;
51
52
  }, 200);
@@ -56,6 +57,7 @@ function setTreeHeight() {
56
57
 
57
58
  function search() {
58
59
  setTreeHeight();
60
+ searchData.value = reftreescreen.value?.model?.searchData;
59
61
  reftree.value.search(reftreescreen.value.model);
60
62
  }
61
63
  function loaded(data) {
@@ -64,15 +66,18 @@ function loaded(data) {
64
66
  } catch (e) { }
65
67
  }
66
68
  function screenload(data) {
67
- loadTree.value=true
68
- setTreeHeight();
69
+ nextTick(() => {
70
+ searchData.value = reftreescreen.value?.model?.searchData;
71
+ loadTree.value = true
72
+ setTreeHeight();
73
+ });
69
74
  }
70
75
  onMounted(() => {
71
76
 
72
77
  })
73
78
  watch(() => props.searchtreeHeight, () => {
74
79
  setTreeHeight();
75
- })
80
+ })
76
81
  // watch(() => reftreescreen.value?.model, // 监听子组件的someData属性
77
82
  // (newVal, oldVal) => {
78
83
  // if (newVal?.searchData != oldVal?.searchData) {
@@ -1,7 +1,7 @@
1
1
  import Enum from '../../utils/Enum';
2
2
  import base from '../index';
3
3
  function getFileNameVal(source) {
4
-
4
+
5
5
  let lst = [];
6
6
  for (var i = 1; i <= 5; i++) {
7
7
  let fieldVal = "";
@@ -23,28 +23,34 @@ const Label = function (source) {
23
23
  let rtn = {
24
24
  flagJson: false,
25
25
  get value() {
26
- if (source.code1) {
27
- try {
28
- let _value = []
29
- var obj = JSON.parse(source.code1)
30
- if (typeof obj == 'object' && obj) {
31
- obj.forEach((v) => {
32
- if (!v.flagDeleted) {
33
- _value.push(v.name);
34
- }
35
- });
36
- rtn.flagJson = true;
37
- return _value;
38
- }
26
+ if (source.name1) {
27
+ return source.name1;
28
+ }
29
+ else {
30
+ if (source.code1) {
31
+ try {
32
+ let _value = []
33
+ var obj = JSON.parse(source.code1)
34
+ if (typeof obj == 'object' && obj) {
35
+ obj.forEach((v) => {
36
+ if (!v.flagDeleted) {
37
+ _value.push(v.name);
38
+ }
39
+ });
40
+ rtn.flagJson = true;
41
+ return _value;
42
+ }
39
43
 
40
- } catch (e) {
44
+ } catch (e) {
41
45
 
46
+ }
42
47
  }
48
+ let _value = [];
49
+ var joinChar = source.joinChar == undefined ? '' : source.joinChar;
50
+ _value = getFileNameVal(source);
51
+ return _value.join(joinChar);
43
52
  }
44
- let _value = [];
45
- var joinChar = source.joinChar == undefined ? '' : source.joinChar;
46
- _value = getFileNameVal(source);
47
- return _value.join(joinChar);
53
+
48
54
  }
49
55
  };
50
56
  rtn = base.copy(source, rtn);
package/src/main.js CHANGED
@@ -65,7 +65,7 @@ app.use(centaline, {
65
65
  //获取请求头
66
66
  getRequestHeaders: function () {
67
67
  return {
68
- authobject: '{token:"wufw-1988477363054436352",platform:"WEB"}',
68
+ authobject: '{token:"wufw-1988759777316159488",platform:"WEB"}',
69
69
  //oldToken: 'd92d4a3b-2274-42e8-96f0-100ffb579b6e',
70
70
  //authObject: '{token:"jiangzf-1958445358178844672",platform:"WEB"}',
71
71
  //authObject: '{EmpID:"Token_4e09499b-4b76-46df-9ce5-5498d48ed062",MachineCode:"ae184643-f8e2-453c-a752-ba82612b592f",SSO_Token:"SSOToken_4e09499b-4b76-46df-9ce5-5498d48ed062",Platform:"WEB"}',
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div id="app-search" style="width:100%;height:100%;position: fixed;">
3
- <ct-searchlist :apiParam="apiParam" :searchConditionApi="'RoleList/getLayoutOfSearch'"
4
- :searchDataApi="'RoleList/getListOfSearchModel'"></ct-searchlist>
3
+ <ct-searchlist :apiParam="apiParam" :searchConditionApi="'PersonHoliday_GuangzhouList/getLayoutOfSearch'"
4
+ :searchDataApi="'PersonHoliday_GuangzhouList/getListOfSearchModel'"></ct-searchlist>
5
5
 
6
6
  <!-- <ct-searchlist :apiParam="apiParam" :searchConditionApi="'/EmployeeMaternityList/getLayoutOfSearch'"
7
7
  :searchDataApi="'/EmployeeMaternityList/getListOfSearchModel'"></ct-searchlist> -->