cloud-web-corejs 1.0.54-dev.791 → 1.0.54-dev.793

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,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.791",
4
+ "version": "1.0.54-dev.793",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "dev:micro": "vue-cli-service serve --port 17527",
@@ -137,7 +137,10 @@ async function initVxeTable(option) {
137
137
  option.isQueryAllPage = isQueryAllPage;
138
138
  let nOption = initOption(option);
139
139
 
140
- // $grid.isQueryAllPage = isQueryAllPage;
140
+ // isQueryAllPage 的唯一事实源是表格实例(checkQueryTotal 也写这里),
141
+ // pager 插槽与代理 ajax.query 均读 $grid.isQueryAllPage,初始化必须回写,
142
+ // 否则首屏恒为 undefined:既丢用户存的偏好,也让页面配置的 false 不生效。
143
+ $grid.isQueryAllPage = isQueryAllPage;
141
144
 
142
145
  if (tableName) {
143
146
  nOption.tableName = tableName;
@@ -153,13 +156,12 @@ async function initVxeTable(option) {
153
156
  // nOption.originOption = originOption;
154
157
  // nOption.getCellValue = getCellValue;
155
158
  // nOption.createParams = createParams;
156
- // nOption.isQueryAllPage = isQueryAllPage;
157
159
  // nOption.searchColumns = searchColumns;
160
+ // 注意:isQueryAllPage 不放 params——它是运行时可变状态,事实源在 $grid 上(见上方回写)
158
161
  let params = {
159
162
  originOption,
160
163
  getCellValue,
161
164
  createParams,
162
- isQueryAllPage,
163
165
  searchColumns,
164
166
  };
165
167
  if (!nOption.params) nOption.params = {};
@@ -490,7 +492,6 @@ function initOption(opts) {
490
492
  let path = opts.path || "";
491
493
  // let columns = JSON.parse(JSON.stringify(opts.columns || []));
492
494
  let columns = opts.columns || [];
493
- let isQueryAllPage = opts.isQueryAllPage;
494
495
  let pagerLayouts = getPagerConfigLayouts(opts);
495
496
 
496
497
  let config = opts.config || {};
@@ -46,7 +46,8 @@
46
46
  :disabled="form1Field.disabled===true"></base-input-numbuer>
47
47
  </template>
48
48
  <template v-else-if="form1Field.type =='select'">
49
- <el-select :key="form1Field.field" v-model="formData[form1Field.field]" size="mini" clearable
49
+ <el-select :key="form1Field.field" v-model="formData[form1Field.field]" size="mini"
50
+ :clearable="form1Field.clearable !== false"
50
51
  :multiple="!!form1Field.multiple"
51
52
  :collapse-tags="!!form1Field.multiple" :disabled="form1Field.disabled===true">
52
53
  <el-option v-for="(item,index1) in form1Field.itemOption" :value="item.value" :label="item.label"
@@ -137,7 +138,8 @@
137
138
  :disabled="form1Field.disabled===true"></base-input-numbuer>
138
139
  </template>
139
140
  <template v-else-if="form1Field.type =='select'">
140
- <el-select v-model="advancedFormData[form1Field.field]" size="mini" clearable
141
+ <el-select v-model="advancedFormData[form1Field.field]" size="mini"
142
+ :clearable="form1Field.clearable !== false"
141
143
  :multiple="!!form1Field.multiple"
142
144
  :collapse-tags="!!form1Field.multiple" :disabled="form1Field.disabled===true">
143
145
  <el-option v-for="(item,index1) in form1Field.itemOption" :value="item.value" :label="item.label"
@@ -58,7 +58,7 @@
58
58
  type="primary"
59
59
  class="button-sty"
60
60
  @click="openAddIncreaseSign"
61
- v-show="wfInfo.toAddIncreaseSign"
61
+ v-show="increaseSignEnabled && wfInfo.toAddIncreaseSign"
62
62
  icon="el-icon-plus"
63
63
  >{{ $t2("加签", "components.wf.addIncreaseSign") }}
64
64
  </el-button>
@@ -66,7 +66,7 @@
66
66
  type="primary"
67
67
  class="button-sty"
68
68
  @click="openDeleteTaskUserDialog"
69
- v-show="wfInfo.toDeleteIncreaseSign"
69
+ v-show="increaseSignEnabled && wfInfo.toDeleteIncreaseSign"
70
70
  icon="el-icon-delete"
71
71
  >{{ $t2("减签", "components.wf.deleteIncreaseSign") }}
72
72
  </el-button>
@@ -38,10 +38,12 @@
38
38
  @click="openUrgingDialog(null)" v-show="wfInfo.toInterrupt">催办
39
39
  </el-button>
40
40
  <el-button type="primary" class="btn" :class="{on:operateType == 'addIncreaseSign'}"
41
- @click="openAddIncreaseSign('addIncreaseSign')" v-show="wfInfo.toAddIncreaseSign">加签
41
+ @click="openAddIncreaseSign('addIncreaseSign')"
42
+ v-show="increaseSignEnabled && wfInfo.toAddIncreaseSign">加签
42
43
  </el-button>
43
44
  <el-button type="primary" class="btn" :class="{on:operateType == 'deleteIncreaseSign'}"
44
- @click="openDeleteTaskUserDialog(null)" v-show="wfInfo.toDeleteIncreaseSign">
45
+ @click="openDeleteTaskUserDialog(null)"
46
+ v-show="increaseSignEnabled && wfInfo.toDeleteIncreaseSign">
45
47
  减签
46
48
  </el-button>
47
49
  <el-button type="primary" class="btn" :class="{on:operateType == 'setCandidate'}"
@@ -387,6 +387,8 @@ wfContentMixin = {
387
387
 
388
388
  addOpinionEnabled: false,
389
389
  modifyCurrentCandidateEnabled: false,
390
+ //加签、减签,默认开启
391
+ increaseSignEnabled: true,
390
392
 
391
393
  //修改脚本
392
394
  showWfFlowEleScriptDialog: false
@@ -442,6 +444,19 @@ wfContentMixin = {
442
444
  },
443
445
  });
444
446
  },
447
+
448
+ initWfParam17(){
449
+ //初始化加签、减签权限,未配置时默认开启
450
+ let that = getTarget(this);
451
+ return that.$http({
452
+ url: USER_PREFIX + "/wf_diy_attribute/getValue",
453
+ method: `post`,
454
+ data: {attributeKey: "param17"},
455
+ success: (res) => {
456
+ this.increaseSignEnabled = res?.objx !== false;
457
+ },
458
+ });
459
+ },
445
460
  getViewParam(key){
446
461
  let that = this.viewTarget;
447
462
  let value = that[key] || that.$attrs[key];
@@ -554,6 +569,9 @@ wfContentMixin = {
554
569
  //初始化修改当前候选人权限
555
570
  this.initWfParam14();
556
571
 
572
+ //初始化加签、减签权限
573
+ this.initWfParam17();
574
+
557
575
  }
558
576
  });
559
577
  },
@@ -102,7 +102,6 @@ const bdProjectMenus = [
102
102
  hasChild: false,
103
103
  grade: 2,
104
104
  type: 0,
105
- repeatOpen: true,
106
105
  children: [],
107
106
  },
108
107
  {
@@ -1,22 +1,31 @@
1
1
  <template>
2
+ <!-- 分支说明与「打开新分支」放在左侧树区域顶部,不再占用内容区工具条 -->
2
3
  <branchPageWrap
3
4
  :branchCode.sync="branchCode"
4
5
  :branchLabel="branchLabel"
6
+ :show-bar="false"
5
7
  @branch-change="onBranchChange"
6
- @open-new="openNewBranch"
7
8
  >
8
- <baseList :key="branchCode"></baseList>
9
+ <baseList :key="branchCode">
10
+ <template #treeTop>
11
+ <branchTreeBar
12
+ :branchLabel="branchLabel"
13
+ @open-new="openNewBranch"
14
+ ></branchTreeBar>
15
+ </template>
16
+ </baseList>
9
17
  </branchPageWrap>
10
18
  </template>
11
19
 
12
20
  <script>
13
21
  import branchPage from "../../core/branchPage";
22
+ import branchTreeBar from "../../core/branchTreeBar.vue";
14
23
  // 逻辑脚本对应 scriptType=1 的 list1
15
24
  import baseList from "@base/views/bd/setting/form_script/list1.vue";
16
25
 
17
26
  export default {
18
27
  name: "branch_form_script:list",
19
- components: { baseList },
28
+ components: { baseList, branchTreeBar },
20
29
  mixins: [branchPage],
21
30
  };
22
31
  </script>
@@ -1,21 +1,30 @@
1
1
  <template>
2
+ <!-- 分支说明与「打开新分支」放在左侧树区域顶部,不再占用内容区工具条 -->
2
3
  <branchPageWrap
3
4
  :branchCode.sync="branchCode"
4
5
  :branchLabel="branchLabel"
6
+ :show-bar="false"
5
7
  @branch-change="onBranchChange"
6
- @open-new="openNewBranch"
7
8
  >
8
- <baseList :key="branchCode"></baseList>
9
+ <baseList :key="branchCode">
10
+ <template #treeTop>
11
+ <branchTreeBar
12
+ :branchLabel="branchLabel"
13
+ @open-new="openNewBranch"
14
+ ></branchTreeBar>
15
+ </template>
16
+ </baseList>
9
17
  </branchPageWrap>
10
18
  </template>
11
19
 
12
20
  <script>
13
21
  import branchPage from "../../core/branchPage";
22
+ import branchTreeBar from "../../core/branchTreeBar.vue";
14
23
  import baseList from "@base/views/bd/setting/form_template/list.vue";
15
24
 
16
25
  export default {
17
26
  name: "branch_form_template:list",
18
- components: { baseList },
27
+ components: { baseList, branchTreeBar },
19
28
  mixins: [branchPage],
20
29
  };
21
30
  </script>
@@ -1,21 +1,31 @@
1
1
  <template>
2
+ <!-- 先选分支再进入,进入后分支作为第一个查询条件可继续切换;不提供「打开新分支」 -->
2
3
  <branchPageWrap
3
4
  :branchCode.sync="branchCode"
4
5
  :branchLabel="branchLabel"
6
+ :show-bar="false"
7
+ :show-open-new="false"
5
8
  @branch-change="onBranchChange"
6
- @open-new="openNewBranch"
7
9
  >
8
- <baseList :key="branchCode"></baseList>
10
+ <branchList :initBranchCode="branchCode" @branch-change="onBranchChange"></branchList>
9
11
  </branchPageWrap>
10
12
  </template>
11
13
 
12
14
  <script>
13
15
  import branchPage from "../../core/branchPage";
16
+ import branchSearchPage from "../../core/branchSearchPage";
14
17
  import baseList from "@base/views/bd/setting/menu_kind/list.vue";
15
18
 
19
+ // 复用原分类列表,只把分支塞进查询条件
20
+ const branchList = {
21
+ name: "branch_menu_kind_list",
22
+ extends: baseList,
23
+ mixins: [branchSearchPage],
24
+ };
25
+
16
26
  export default {
17
27
  name: "branch_menu_kind:list",
18
- components: { baseList },
28
+ components: { branchList },
19
29
  mixins: [branchPage],
20
30
  };
21
31
  </script>
@@ -59,11 +59,11 @@ modules = {
59
59
  },
60
60
  updateTabTitle() {
61
61
  let base = this.baseTabTitle || this.resolveBaseTabTitle();
62
- let title = this.branchName
63
- ? `${base}-${this.branchName}`
64
- : this.branchCode
65
- ? `${base}-${this.branchCode}`
66
- : base;
62
+ let suffix = this.branchName || this.branchCode;
63
+ // 菜单名形如「表单模板-分支」,选中分支后把末尾的「分支」换成分支名
64
+ let title = suffix
65
+ ? `${base.replace(/[--—]?\s*分支$/, "")}-${suffix}`
66
+ : base;
67
67
  this.$store.dispatch("tagsView/updateVisitedView2", {
68
68
  view: this.$route,
69
69
  title,
@@ -1,12 +1,13 @@
1
1
  <template>
2
2
  <div class="bd-branch-page" :class="{ 'has-branch': !!branchCode }">
3
3
  <!-- 已选分支:内容区顶部工具条,不可改;提供打开新分支 -->
4
- <div class="branch-bar" v-if="branchCode">
4
+ <div class="branch-bar" v-if="branchCode && showBar">
5
5
  <span class="branch-locked">
6
6
  <span class="label">{{ $t1("分支") }}:</span>
7
7
  <span class="value">{{ branchLabel || branchCode }}</span>
8
8
  </span>
9
9
  <el-button
10
+ v-if="showOpenNew"
10
11
  size="mini"
11
12
  type="primary"
12
13
  plain
@@ -25,7 +26,6 @@
25
26
  <p class="tip">{{ $t1("请先选择分支") }}</p>
26
27
  <branchSelect
27
28
  :value="branchCode"
28
- :auto-restore="false"
29
29
  @input="$emit('update:branchCode', $event)"
30
30
  @change="$emit('branch-change', $event)"
31
31
  ></branchSelect>
@@ -44,6 +44,15 @@ export default {
44
44
  props: {
45
45
  branchCode: String,
46
46
  branchLabel: String,
47
+ // 页面自己在查询条件里展示/切换分支时,顶部工具条就是多余的
48
+ showBar: {
49
+ type: Boolean,
50
+ default: true,
51
+ },
52
+ showOpenNew: {
53
+ type: Boolean,
54
+ default: true,
55
+ },
47
56
  },
48
57
  watch: {
49
58
  branchCode() {
@@ -205,11 +214,11 @@ export default {
205
214
  display: inline-block;
206
215
  margin-left: 12px;
207
216
  padding: 2px 8px;
208
- font-size: 12px;
209
- font-weight: 400;
210
- line-height: 18px;
211
- color: #6386fa;
212
- background: #f0f3ff;
217
+ font-size: 14px;
218
+ font-weight: 600;
219
+ line-height: 20px;
220
+ color: #ff731c;
221
+ background: #fff3ea;
213
222
  border-radius: 2px;
214
223
  vertical-align: middle;
215
224
  }
@@ -0,0 +1,285 @@
1
+ import branchScope from "./branchScope";
2
+ import { BRANCH_FLAG, needInject } from "./branchContext";
3
+
4
+ const BRANCH_FIELD = "branchCode";
5
+
6
+ /** 只读接口:分支未就绪时直接返回空结果,避免表格一直转圈 */
7
+ const READ_SUFFIXES = [
8
+ "/getAllList",
9
+ "/getChildren",
10
+ "/listPage",
11
+ "/listOtherPage",
12
+ "/listPageWf",
13
+ ];
14
+
15
+ function isReadUrl(url) {
16
+ if (!url) {
17
+ return false;
18
+ }
19
+ let path = url;
20
+ let qIndex = path.indexOf("?");
21
+ if (qIndex >= 0) {
22
+ path = path.substring(0, qIndex);
23
+ }
24
+ return READ_SUFFIXES.some((item) => path.endsWith(item));
25
+ }
26
+
27
+ /**
28
+ * 分支工程页面(分支收敛到查询条件)通用逻辑:
29
+ * 1. 不做进入前的分支门禁,也不提供「打开新分支」,分支就是查询条件里的第一个下拉框
30
+ * 2. 没选到有效分支时整页不可操作:不查询、不保存、不导入导出
31
+ * 3. 切换分支即清空其余查询条件并重新查询;分支不做记忆,每次进来都要重新选
32
+ * 4. 页面用 extends 复用 bd/setting 下的原组件,这里全部改在实例级的 $vxeTableUtil /
33
+ * $http / $jsonImport / $jsonExport 上做,不必重写原组件的任何方法
34
+ */
35
+ let modules = {};
36
+ modules = {
37
+ mixins: [branchScope(BRANCH_FLAG.BRANCH)],
38
+ props: {
39
+ // 由外层前置选择页带进来的分支,组件挂载时就已经确定
40
+ initBranchCode: String,
41
+ },
42
+ data() {
43
+ return {
44
+ branchCode: this.initBranchCode || "",
45
+ branchName: "",
46
+ branches: [],
47
+ branchesLoaded: false,
48
+ };
49
+ },
50
+ computed: {
51
+ /** 后台匹配得到分支才算就绪;分支列表未回来前,先按已选分支放行 */
52
+ branchReady() {
53
+ if (!this.branchCode) {
54
+ return false;
55
+ }
56
+ if (!this.branchesLoaded) {
57
+ return true;
58
+ }
59
+ return this.branches.some((item) => item.branchCode === this.branchCode);
60
+ },
61
+ },
62
+ created() {
63
+ this.patchVxeTableUtil();
64
+ this.patchBranchGuard();
65
+ },
66
+ watch: {
67
+ "formData.branchCode"(val) {
68
+ this.applyBranch(val);
69
+ },
70
+ },
71
+ methods: {
72
+ /** 实例级覆盖 $vxeTableUtil.initVxeTable,给原页面的查询条件补一列分支 */
73
+ patchVxeTableUtil() {
74
+ let origin = this.$vxeTableUtil;
75
+ if (!origin || this._branchVxePatched) {
76
+ return;
77
+ }
78
+ this._branchVxePatched = true;
79
+ let that = this;
80
+ // $vxeTableUtil 上都是无 this 依赖的普通函数,原型继承 + 覆盖单个方法即可
81
+ this.$vxeTableUtil = Object.assign(Object.create(origin), {
82
+ initVxeTable(option) {
83
+ that.injectBranchSearchColumn(option);
84
+ return origin.initVxeTable(option);
85
+ },
86
+ });
87
+ },
88
+ /** 分支未就绪时拦掉本页所有分支相关请求与导入导出 */
89
+ patchBranchGuard() {
90
+ if (this._branchGuardPatched) {
91
+ return;
92
+ }
93
+ this._branchGuardPatched = true;
94
+ let that = this;
95
+
96
+ // $commonHttp 内部转调 this.$http,表格查询/树懒加载/行保存都会走到这里
97
+ let originHttp = this.$http;
98
+ let wrapped = function (option) {
99
+ if (option && needInject(option.url) && !that.branchReady) {
100
+ return that.refuseBranchRequest(option);
101
+ }
102
+ return originHttp.apply(this, arguments);
103
+ };
104
+ Object.assign(wrapped, originHttp);
105
+ wrapped.prototype = originHttp.prototype;
106
+ this.$http = wrapped;
107
+
108
+ let originImport = this.$jsonImport;
109
+ if (typeof originImport === "function") {
110
+ this.$jsonImport = function () {
111
+ if (!that.checkBranchReady()) {
112
+ return;
113
+ }
114
+ return originImport.apply(this, arguments);
115
+ };
116
+ }
117
+ let originExport = this.$jsonExport;
118
+ if (typeof originExport === "function") {
119
+ this.$jsonExport = function () {
120
+ if (!that.checkBranchReady()) {
121
+ return;
122
+ }
123
+ return originExport.apply(this, arguments);
124
+ };
125
+ }
126
+ },
127
+ refuseBranchRequest(option) {
128
+ if (isReadUrl(option.url)) {
129
+ let res = { type: "success", objx: { records: [], total: 0 } };
130
+ if (option.callback) {
131
+ option.callback(res);
132
+ }
133
+ if (option.success) {
134
+ option.success(res);
135
+ }
136
+ return Promise.resolve(res);
137
+ }
138
+ this.warnBranchRequired();
139
+ if (option.error) {
140
+ option.error(null);
141
+ }
142
+ return Promise.resolve(null);
143
+ },
144
+ checkBranchReady() {
145
+ if (this.branchReady) {
146
+ return true;
147
+ }
148
+ this.warnBranchRequired();
149
+ return false;
150
+ },
151
+ warnBranchRequired() {
152
+ // 同一批操作只提示一次,避免树表并发请求刷屏
153
+ if (this._branchWarning) {
154
+ return;
155
+ }
156
+ this._branchWarning = true;
157
+ setTimeout(() => {
158
+ this._branchWarning = false;
159
+ }, 1000);
160
+ this.$message({
161
+ type: "warning",
162
+ message: this.$t1("请先选择分支"),
163
+ });
164
+ },
165
+ injectBranchSearchColumn(option) {
166
+ if (!option) {
167
+ return;
168
+ }
169
+ this._branchTableRef = option.tableRef || this._branchTableRef;
170
+ let columns = option.searchColumns || [];
171
+ if (columns.some((item) => item.field === BRANCH_FIELD)) {
172
+ return;
173
+ }
174
+ option.searchColumns = [this.buildBranchSearchColumn(), ...columns];
175
+ },
176
+ buildBranchSearchColumn() {
177
+ return {
178
+ title: this.$t1("分支"),
179
+ field: BRANCH_FIELD,
180
+ type: "select",
181
+ common: true,
182
+ // fixed 让「查询条件设置」的保存结果无法把它挪位置或收进高级筛选
183
+ fixed: true,
184
+ // 分支不允许清空,页面必须始终处在某个分支下
185
+ clearable: false,
186
+ itemOption: [],
187
+ // 不做记忆,只回填前置页刚选的分支
188
+ defaultValue: this.branchCode || null,
189
+ syncHandle: () => {
190
+ return this.loadBranches();
191
+ },
192
+ };
193
+ },
194
+ loadBranches() {
195
+ return new Promise((resolve) => {
196
+ this.$http({
197
+ url: USER_PREFIX + "/bd_branch/listPage",
198
+ method: "post",
199
+ data: {
200
+ enabled: true,
201
+ current: 1,
202
+ size: 500,
203
+ },
204
+ success: (res) => {
205
+ let records = res?.objx?.records || [];
206
+ this.branches = records;
207
+ this.branchesLoaded = true;
208
+ this.dropInvalidBranch();
209
+ this.syncBranchName();
210
+ resolve(
211
+ records.map((item) => {
212
+ return {
213
+ label: item.branchName + "(" + item.branchCode + ")",
214
+ value: item.branchCode,
215
+ };
216
+ })
217
+ );
218
+ },
219
+ error: () => {
220
+ this.branchesLoaded = true;
221
+ resolve([]);
222
+ },
223
+ });
224
+ });
225
+ },
226
+ /** 已选分支后台查不到(停用/删除)时清掉,页面回到不可操作状态 */
227
+ dropInvalidBranch() {
228
+ if (!this.branchCode || this.branchReady) {
229
+ return;
230
+ }
231
+ this.branchCode = "";
232
+ if (this.formData) {
233
+ this.$set(this.formData, BRANCH_FIELD, null);
234
+ }
235
+ this.$message({
236
+ type: "warning",
237
+ message: this.$t1("原分支已不可用,请重新选择分支"),
238
+ });
239
+ // 清掉可能已经查回来的旧分支数据
240
+ this.reloadBranchTable();
241
+ },
242
+ syncBranchName() {
243
+ let current = this.branches.find(
244
+ (item) => item.branchCode === this.branchCode
245
+ );
246
+ this.branchName = current ? current.branchName || "" : "";
247
+ },
248
+ applyBranch(val) {
249
+ let branchCode = val || "";
250
+ // 值没变就不要再触发一次查询
251
+ if (branchCode === this.branchCode) {
252
+ return;
253
+ }
254
+ this.branchCode = branchCode;
255
+ this.syncBranchName();
256
+ // 换分支等于换了一套数据,其余查询条件全部清空
257
+ this.formData = { [BRANCH_FIELD]: branchCode || null };
258
+ this.reloadBranchTable();
259
+ // 通知外层同步标签页名等分支信息
260
+ this.$emit("branch-change", {
261
+ branchCode: this.branchCode,
262
+ branchName: this.branchName,
263
+ });
264
+ },
265
+ reloadBranchTable() {
266
+ let grid = this.$refs[this._branchTableRef || "table-m1"];
267
+ if (grid) {
268
+ grid.commitProxy("reload");
269
+ }
270
+ },
271
+ searchEvent() {
272
+ if (!this.checkBranchReady()) {
273
+ return;
274
+ }
275
+ this.reloadBranchTable();
276
+ },
277
+ /** 重置查询条件时保留已选分支 */
278
+ resetEvent() {
279
+ let branchCode = this.formData ? this.formData.branchCode : "";
280
+ this.formData = { [BRANCH_FIELD]: branchCode || null };
281
+ this.reloadBranchTable();
282
+ },
283
+ },
284
+ };
285
+ export default modules;
@@ -19,17 +19,10 @@
19
19
  </template>
20
20
 
21
21
  <script>
22
- const STORAGE_KEY = "bdProjectBranchCode";
23
-
24
22
  export default {
25
23
  name: "bdBranchSelect",
26
24
  props: {
27
25
  value: String,
28
- // 首次进入时是否自动回填上次选择的分支
29
- autoRestore: {
30
- type: Boolean,
31
- default: true,
32
- },
33
26
  },
34
27
  data() {
35
28
  return {
@@ -51,26 +44,12 @@ export default {
51
44
  },
52
45
  success: (res) => {
53
46
  this.branches = res?.objx?.records || [];
54
- this.restore();
55
47
  },
56
48
  });
57
49
  },
58
- restore() {
59
- if (!this.autoRestore || this.value) {
60
- return;
61
- }
62
- let last = localStorage.getItem(STORAGE_KEY);
63
- if (last && this.branches.some((item) => item.branchCode === last)) {
64
- this.handleChange(last);
65
- }
66
- },
50
+ // 分支不做记忆,每次进页面都要重新选
67
51
  handleChange(val) {
68
52
  let branchCode = val || "";
69
- if (branchCode) {
70
- localStorage.setItem(STORAGE_KEY, branchCode);
71
- } else {
72
- localStorage.removeItem(STORAGE_KEY);
73
- }
74
53
  this.$emit("input", branchCode);
75
54
  this.$emit(
76
55
  "change",
@@ -0,0 +1,81 @@
1
+ <template>
2
+ <!-- 分支模块:挂在左侧树顶部、「表单分类」之上 -->
3
+ <div class="bd-branch-tree-bar">
4
+ <div class="branch-info">
5
+ <span class="value" :title="branchLabel">{{ branchLabel }}</span>
6
+ </div>
7
+ <el-tooltip
8
+ :enterable="false"
9
+ effect="dark"
10
+ :content="$t1('打开新分支')"
11
+ placement="top"
12
+ popper-class="tooltip-skin"
13
+ >
14
+ <el-button
15
+ class="open-new"
16
+ icon="el-icon-plus"
17
+ @click="$emit('open-new')"
18
+ ></el-button>
19
+ </el-tooltip>
20
+ </div>
21
+ </template>
22
+
23
+ <script>
24
+ export default {
25
+ name: "bdBranchTreeBar",
26
+ props: {
27
+ branchLabel: String,
28
+ },
29
+ };
30
+ </script>
31
+
32
+ <style lang="scss" scoped>
33
+ /* 与树上方的 .tree-userChange 保持同一套模块样式 */
34
+ .bd-branch-tree-bar {
35
+ flex: none;
36
+ display: flex;
37
+ align-items: center;
38
+ margin: 9px 10px 0;
39
+ padding: 7px 7px 7px 10px;
40
+ background: #f4f6fa;
41
+ border-radius: 5px;
42
+
43
+ .branch-info {
44
+ flex: 1;
45
+ min-width: 0;
46
+ display: flex;
47
+ align-items: flex-start;
48
+ font-size: 14px;
49
+ line-height: 20px;
50
+
51
+ .value {
52
+ flex: 1;
53
+ min-width: 0;
54
+ /* 长分支名换行显示,最多两行,超出再省略 */
55
+ display: -webkit-box;
56
+ -webkit-line-clamp: 2;
57
+ -webkit-box-orient: vertical;
58
+ overflow: hidden;
59
+ text-overflow: ellipsis;
60
+ word-break: break-all;
61
+ font-weight: 600;
62
+ /* 与详情页标题栏的分支标记同色 */
63
+ color: #ff731c;
64
+ }
65
+ }
66
+
67
+ .open-new {
68
+ flex: none;
69
+ width: 26.5px;
70
+ height: 26.5px;
71
+ margin-left: 8px;
72
+ padding: 0;
73
+ line-height: 26.5px;
74
+ text-align: center;
75
+ background: #fff;
76
+ border: solid 1px rgba(99, 134, 250, 0.15);
77
+ border-radius: 5px;
78
+ color: #6386fa;
79
+ }
80
+ }
81
+ </style>
@@ -14,6 +14,7 @@
14
14
  </el-tab-pane>
15
15
  <el-tab-pane :label="$t1('列表')" name="second">
16
16
  <div class="tree-box fl">
17
+ <slot name="treeTop"></slot>
17
18
  <div class="tit">
18
19
  <b>{{ $t1("表单分类") }}</b>
19
20
  </div>
@@ -15,6 +15,7 @@
15
15
  </el-tab-pane>
16
16
  <el-tab-pane :label="$t1('列表')" name="second">
17
17
  <div class="tree-box fl">
18
+ <slot name="treeTop"></slot>
18
19
  <div class="tit">
19
20
  <b>{{ $t1("表单分类") }}</b>
20
21
  </div>