ui-process-h5 0.1.14 → 0.1.20

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/README.md CHANGED
@@ -1,25 +1,18 @@
1
- # ui-process-h5
1
+ # Vue 3 + TypeScript + Vite
2
2
 
3
- ## Project setup
4
- ```
5
- yarn install
6
- ```
3
+ This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
7
4
 
8
- ### Compiles and hot-reloads for development
9
- ```
10
- yarn serve
11
- ```
5
+ ## Recommended IDE Setup
12
6
 
13
- ### Compiles and minifies for production
14
- ```
15
- yarn build
16
- ```
7
+ - [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
17
8
 
18
- ### Customize configuration
19
- See [Configuration Reference](https://cli.vuejs.org/config/).
9
+ ## Type Support For `.vue` Imports in TS
20
10
 
21
- ### packages
22
- 组件列表
11
+ TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
23
12
 
24
- ### examples
25
- 组件示例
13
+ If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
14
+
15
+ 1. Disable the built-in TypeScript Extension
16
+ 1. Run `Extensions: Show Built-in Extensions` from VSCode's command palette
17
+ 2. Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
18
+ 2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
package/lib/design.js ADDED
@@ -0,0 +1,163 @@
1
+ import { defineComponent as L, ref as p, watch as b, onMounted as $, openBlock as f, createElementBlock as r, createElementVNode as k, Fragment as _, renderList as m, normalizeClass as T, toDisplayString as g, createCommentVNode as d, withDirectives as W, renderSlot as y, vShow as C } from "vue";
2
+ const A = L({
3
+ name: "TopTab",
4
+ props: {
5
+ /**
6
+ * 根据参数插入自定义tab
7
+ * label:选项卡title
8
+ * key:选项卡ID 请勿重复defaultTabList内已拥有的默认key
9
+ * type:插槽类型 "slot" "default"
10
+ * sort:排序参数,无参数默认插入末尾
11
+ * slot:插槽name
12
+ */
13
+ tapList: {
14
+ type: Array,
15
+ default: () => []
16
+ },
17
+ // 自定义tab (传入后 默认tab,tapList,失效)
18
+ selfTapList: {
19
+ type: Array,
20
+ default: () => []
21
+ }
22
+ },
23
+ setup(e) {
24
+ const u = p(""), i = p([
25
+ {
26
+ label: "基本信息",
27
+ key: "a",
28
+ type: "default",
29
+ slot: "default"
30
+ },
31
+ {
32
+ label: "流程图",
33
+ key: "b",
34
+ type: "default",
35
+ slot: "tab2"
36
+ },
37
+ {
38
+ label: "审批记录",
39
+ key: "c",
40
+ type: "default",
41
+ slot: "tab3"
42
+ }
43
+ ]), o = p([
44
+ {
45
+ label: "基本信息",
46
+ key: "a",
47
+ type: "default",
48
+ slot: "default"
49
+ },
50
+ {
51
+ label: "流程图",
52
+ key: "b",
53
+ type: "default",
54
+ slot: "tab2"
55
+ },
56
+ {
57
+ label: "审批记录",
58
+ key: "c",
59
+ type: "default",
60
+ slot: "tab3"
61
+ }
62
+ ]), s = p(), h = (t, n) => {
63
+ t !== u.value && (u.value = t, a(n));
64
+ }, a = (t) => {
65
+ if (s.value.length) {
66
+ let n = document.getElementsByClassName("bottom-line")[0], l;
67
+ if (n.offsetWidth < s.value[t].offsetWidth - 10) {
68
+ let c = (s.value[t].offsetWidth - n.offsetWidth - 10) / 2;
69
+ l = `${s.value[t].offsetLeft + c}px`;
70
+ } else if (n.offsetWidth > s.value[t].offsetWidth - 10) {
71
+ let c = (n.offsetWidth - s.value[t].offsetWidth + 10) / 2;
72
+ l = `${s.value[t].offsetLeft - c}px`;
73
+ } else
74
+ l = `${s.value[t].offsetLeft}px`;
75
+ n.style.transition = ".3s", n.style.transform = `translateX(${l})`;
76
+ }
77
+ };
78
+ return b(
79
+ () => e.selfTapList,
80
+ (t, n) => {
81
+ t.length && (o.value = [].concat(t), u.value = o.value[0].key);
82
+ },
83
+ {
84
+ //如果加了这个参数,值为true的话,就消除了惰性,watch会在创建后立即执行一次
85
+ //那么首次执行,val为默认值,preVal为undefined
86
+ immediate: !0,
87
+ //这个参数代表监听对象时,可以监听深度嵌套的对象属性
88
+ deep: !0
89
+ }
90
+ ), b(
91
+ () => e.tapList,
92
+ (t, n) => {
93
+ e.selfTapList.length || (o.value = [].concat(i.value), t.length > 0 && t.forEach((l, c) => {
94
+ l.sort && l.sort > 1 ? o.value.splice(l.sort - 1, 0, l) : l.sort == 1 ? o.value.unshift(l) : o.value.push(l);
95
+ }), u.value = o.value[0].key);
96
+ },
97
+ {
98
+ //如果加了这个参数,值为true的话,就消除了惰性,watch会在创建后立即执行一次
99
+ //那么首次执行,val为默认值,preVal为undefined
100
+ immediate: !0,
101
+ //这个参数代表监听对象时,可以监听深度嵌套的对象属性
102
+ deep: !0
103
+ }
104
+ ), $(() => {
105
+ a(0);
106
+ }), {
107
+ isTapList: o,
108
+ active: u,
109
+ handleActive: h,
110
+ label: s
111
+ };
112
+ }
113
+ });
114
+ const E = (e, u) => {
115
+ const i = e.__vccOpts || e;
116
+ for (const [o, s] of u)
117
+ i[o] = s;
118
+ return i;
119
+ }, V = { class: "tops-tab" }, w = { class: "tops-tab-header" }, B = ["onClick"], N = {
120
+ key: 0,
121
+ class: "bottom-line"
122
+ }, S = { class: "tops-tab-body" };
123
+ function D(e, u, i, o, s, h) {
124
+ return f(), r("div", V, [
125
+ k("div", w, [
126
+ (f(!0), r(_, null, m(e.isTapList, (a, t) => (f(), r("div", {
127
+ class: T(["tops-tab-header-items", [a.key === e.active ? "active" : ""]]),
128
+ onClick: (n) => e.handleActive(a.key, t),
129
+ ref_for: !0,
130
+ ref: "label"
131
+ }, g(a.label), 11, B))), 256)),
132
+ e.isTapList.length ? (f(), r("div", N)) : d("", !0)
133
+ ]),
134
+ k("div", S, [
135
+ (f(!0), r(_, null, m(e.isTapList, (a) => W((f(), r("div", {
136
+ key: a.key,
137
+ style: { height: "100%" }
138
+ }, [
139
+ a.key === "a" && a.type === "default" ? y(e.$slots, "default", { key: 0 }, void 0, !0) : d("", !0),
140
+ a.key === "tab2" && a.type === "default" ? y(e.$slots, "default", { key: 1 }, void 0, !0) : d("", !0),
141
+ a.key === "tab3" && a.type === "default" ? y(e.$slots, "default", { key: 2 }, void 0, !0) : d("", !0),
142
+ a.type == "slot" ? y(e.$slots, a.slot, { key: 3 }, void 0, !0) : d("", !0)
143
+ ])), [
144
+ [C, e.active === a.key]
145
+ ])), 128))
146
+ ])
147
+ ]);
148
+ }
149
+ const v = /* @__PURE__ */ E(A, [["render", D], ["__scopeId", "data-v-a3457e59"]]);
150
+ v.install = function(e) {
151
+ return e.component(v.name, v), e;
152
+ };
153
+ const z = [v], F = function(e) {
154
+ z.forEach((u) => {
155
+ e.use(u);
156
+ });
157
+ }, M = {
158
+ install: F
159
+ };
160
+ export {
161
+ v as TopTab,
162
+ M as default
163
+ };
@@ -0,0 +1 @@
1
+ (function(d,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(d=typeof globalThis<"u"?globalThis:d||self,e(d.Design={},d.Vue))})(this,function(d,e){"use strict";const y=e.defineComponent({name:"TopTab",props:{tapList:{type:Array,default:()=>[]},selfTapList:{type:Array,default:()=>[]}},setup(t){const i=e.ref(""),c=e.ref([{label:"基本信息",key:"a",type:"default",slot:"default"},{label:"流程图",key:"b",type:"default",slot:"tab2"},{label:"审批记录",key:"c",type:"default",slot:"tab3"}]),n=e.ref([{label:"基本信息",key:"a",type:"default",slot:"default"},{label:"流程图",key:"b",type:"default",slot:"tab2"},{label:"审批记录",key:"c",type:"default",slot:"tab3"}]),a=e.ref(),u=(l,r)=>{l!==i.value&&(i.value=l,o(r))},o=l=>{if(a.value.length){let r=document.getElementsByClassName("bottom-line")[0],s;if(r.offsetWidth<a.value[l].offsetWidth-10){let p=(a.value[l].offsetWidth-r.offsetWidth-10)/2;s=`${a.value[l].offsetLeft+p}px`}else if(r.offsetWidth>a.value[l].offsetWidth-10){let p=(r.offsetWidth-a.value[l].offsetWidth+10)/2;s=`${a.value[l].offsetLeft-p}px`}else s=`${a.value[l].offsetLeft}px`;r.style.transition=".3s",r.style.transform=`translateX(${s})`}};return e.watch(()=>t.selfTapList,(l,r)=>{l.length&&(n.value=[].concat(l),i.value=n.value[0].key)},{immediate:!0,deep:!0}),e.watch(()=>t.tapList,(l,r)=>{t.selfTapList.length||(n.value=[].concat(c.value),l.length>0&&l.forEach((s,p)=>{s.sort&&s.sort>1?n.value.splice(s.sort-1,0,s):s.sort==1?n.value.unshift(s):n.value.push(s)}),i.value=n.value[0].key)},{immediate:!0,deep:!0}),e.onMounted(()=>{o(0)}),{isTapList:n,active:i,handleActive:u,label:a}}}),$="",h=(t,i)=>{const c=t.__vccOpts||t;for(const[n,a]of i)c[n]=a;return c},k={class:"tops-tab"},m={class:"tops-tab-header"},b=["onClick"],_={key:0,class:"bottom-line"},T={class:"tops-tab-body"};function L(t,i,c,n,a,u){return e.openBlock(),e.createElementBlock("div",k,[e.createElementVNode("div",m,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.isTapList,(o,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["tops-tab-header-items",[o.key===t.active?"active":""]]),onClick:r=>t.handleActive(o.key,l),ref_for:!0,ref:"label"},e.toDisplayString(o.label),11,b))),256)),t.isTapList.length?(e.openBlock(),e.createElementBlock("div",_)):e.createCommentVNode("",!0)]),e.createElementVNode("div",T,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.isTapList,o=>e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:o.key,style:{height:"100%"}},[o.key==="a"&&o.type==="default"?e.renderSlot(t.$slots,"default",{key:0},void 0,!0):e.createCommentVNode("",!0),o.key==="tab2"&&o.type==="default"?e.renderSlot(t.$slots,"default",{key:1},void 0,!0):e.createCommentVNode("",!0),o.key==="tab3"&&o.type==="default"?e.renderSlot(t.$slots,"default",{key:2},void 0,!0):e.createCommentVNode("",!0),o.type=="slot"?e.renderSlot(t.$slots,o.slot,{key:3},void 0,!0):e.createCommentVNode("",!0)])),[[e.vShow,t.active===o.key]])),128))])])}const f=h(y,[["render",L],["__scopeId","data-v-a3457e59"]]);f.install=function(t){return t.component(f.name,f),t};const g=[f],B={install:function(t){g.forEach(i=>{t.use(i)})}};d.TopTab=f,d.default=B,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -0,0 +1,5 @@
1
+ declare module "*.vue" {
2
+ import { DefineComponent } from "vue"
3
+ const component: DefineComponent<{}, {}, any>
4
+ export default component
5
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
package/lib/style.css ADDED
@@ -0,0 +1 @@
1
+ .tops-tab[data-v-a3457e59]{height:100%}.tops-tab-header[data-v-a3457e59]{display:flex;width:100%;height:45px;justify-content:space-between;font-size:14px;color:#333;padding:0 10px;font-weight:500;box-sizing:border-box;overflow-x:auto;white-space:nowrap;flex-wrap:nowrap;flex-shrink:0;-ms-overflow-style:none;position:relative}.tops-tab-header[data-v-a3457e59]:after{content:"";position:absolute;width:100%;height:1px;background-color:#f2f2f2;left:0;bottom:0}.tops-tab-header[data-v-a3457e59]::-webkit-scrollbar{display:none}.tops-tab-header-items[data-v-a3457e59]{white-space:nowrap;padding-right:10px;box-sizing:border-box;display:inline-block;height:100%;text-align:center;margin-right:32px;font-weight:400;font-size:15px;text-align:left;color:#333;display:flex;align-items:center}.tops-tab-header-items[data-v-a3457e59] :last-child{padding-right:0;margin-right:0}.tops-tab-header-items[data-v-a3457e59] :last-child:after{left:calc(50% - 17px)}.tops-tab-header .active[data-v-a3457e59]{position:relative;color:#1389ff;font-family:PingFang SC Bold;font-weight:700;font-size:15px;text-align:left}.tops-tab-header .bottom-line[data-v-a3457e59]{width:30px;height:3px;border-radius:1.5px;background-color:#1389ff;position:absolute;bottom:0;left:0}.tops-tab-body[data-v-a3457e59]{height:100%;padding:0 10px}
package/lib/vite.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
package/package.json CHANGED
@@ -1,37 +1,68 @@
1
1
  {
2
2
  "name": "ui-process-h5",
3
- "version": "0.1.14",
4
3
  "private": false,
5
4
  "description": "流程组件",
6
- "main": "lib/index.min.js",
7
- "module": "lib/index.esm.js",
8
- "typings": "lib/index.d.ts",
9
- "keyword": "vue3",
5
+ "version": "0.1.20",
6
+ "type": "module",
10
7
  "scripts": {
11
- "serve": "vue-cli-service serve",
12
- "build": "yarn build:clean && yarn build:lib && yarn build:esm-bundle && rimraf lib/demo.html",
13
- "build:clean": "rimraf lib",
14
- "build:lib": "vue-cli-service build --target lib --name index --dest lib packages/index.ts",
15
- "build:esm-bundle": "rollup --config ./build/rollup.config.js"
8
+ "dev": "vite",
9
+ "build": "vue-tsc && vite build",
10
+ "preview": "vite preview"
11
+ },
12
+ "files": [
13
+ "lib/*",
14
+ "packages/*",
15
+ "Readme.md",
16
+ "package.json"
17
+ ],
18
+ "publicConfig": {
19
+ "registry": "http://registry.npmjs.org/"
20
+ },
21
+ "main": "./lib/design.umd.js",
22
+ "module": "./lib/design.mjs",
23
+ "exports": {
24
+ ".": {
25
+ "import": "./lib/design.mjs",
26
+ "require": "./lib/design.umd.js"
27
+ },
28
+ "./lib/style.css": "./lib/style.css"
16
29
  },
17
30
  "dependencies": {
18
- "axios": "^1.3.5",
19
- "bpmn-moddle": "^8.0.1",
20
- "core-js": "^3.8.3",
21
- "vue": "^3.2.13"
31
+ "sass": "^1.62.0",
32
+ "vue": "^3.2.47",
33
+ "dayjs": "^1.11.7"
22
34
  },
23
35
  "devDependencies": {
24
- "@vue/cli-plugin-babel": "~5.0.0",
25
- "@vue/cli-plugin-typescript": "~5.0.0",
26
- "@vue/cli-service": "~5.0.0",
27
- "sass": "^1.32.7",
28
- "sass-loader": "^12.0.0",
29
- "typescript": "~4.5.5",
30
- "@rollup/plugin-node-resolve": "^13.0.5",
31
- "@vue/compiler-sfc": "^3.0.0",
32
- "rollup": "^2.58.0",
33
- "rollup-plugin-terser": "^7.0.2",
34
- "rollup-plugin-typescript2": "^0.30.0",
35
- "rollup-plugin-vue": "^6.0.0"
36
+ "@types/node": "^18.15.12",
37
+ "@vitejs/plugin-vue": "^4.1.0",
38
+ "typescript": "^4.9.3",
39
+ "vite": "^4.2.0",
40
+ "vue-tsc": "^1.2.0",
41
+ "@commitlint/cli": "^17.0.0",
42
+ "@commitlint/config-conventional": "^17.0.0",
43
+ "@types/sass": "^1.43.1",
44
+ "@typescript-eslint/eslint-plugin": "^5.27.0",
45
+ "@typescript-eslint/parser": "^5.27.0",
46
+ "@vitejs/plugin-vue-jsx": "^2.0.0",
47
+ "chalk": "^4.1.2",
48
+ "commitizen": "^4.2.4",
49
+ "cross-env": "^7.0.3",
50
+ "cz-conventional-changelog": "^3.3.0",
51
+ "eslint": "^8.17.0",
52
+ "eslint-config-prettier": "^8.5.0",
53
+ "eslint-define-config": "^1.5.0",
54
+ "eslint-plugin-prettier": "^4.0.0",
55
+ "eslint-plugin-vue": "^9.1.0",
56
+ "husky": "^8.0.1",
57
+ "prettier": "^2.6.2",
58
+ "rimraf": "^3.0.2",
59
+ "sass": "^1.49.7",
60
+ "standard-version": "^9.5.0",
61
+ "vite-plugin-dts": "^1.2.0",
62
+ "vite-plugin-md": "^0.15.0",
63
+ "vue": "^3.2.47"
64
+ },
65
+ "engines": {
66
+ "node": ">=16.0.0"
36
67
  }
37
- }
68
+ }
@@ -0,0 +1,5 @@
1
+ import TopTab from "./components/tab";
2
+
3
+ export default [TopTab];
4
+ export { TopTab };
5
+
@@ -0,0 +1,9 @@
1
+ import { App } from "vue";
2
+ import TopTab from "./src/index.vue";
3
+
4
+ TopTab.install = function (app: App) {
5
+ // 组件注册,按需引入
6
+ app.component(TopTab.name, TopTab);
7
+ return app;
8
+ };
9
+ export default TopTab;
@@ -0,0 +1,296 @@
1
+ <template>
2
+ <div class="tops-tab">
3
+ <div class="tops-tab-header">
4
+ <template v-for="(item, i) of isTapList">
5
+ <div
6
+ class="tops-tab-header-items"
7
+ :class="[item.key === active ? 'active' : '']"
8
+ @click="handleActive(item.key, i)"
9
+ ref="label"
10
+ >
11
+ {{ item.label }}
12
+ </div>
13
+ </template>
14
+ <div class="bottom-line" v-if="isTapList.length"></div>
15
+ </div>
16
+ <div class="tops-tab-body">
17
+ <div
18
+ v-for="item in isTapList"
19
+ :key="item.key"
20
+ v-show="active === item.key"
21
+ style="height: 100%;"
22
+ >
23
+ <!-- :taskNode="getTaskNode()" -->
24
+ <slot
25
+ v-if="item.key === 'a' && item.type === 'default'"
26
+ name="default"
27
+ ></slot>
28
+ <slot
29
+ v-if="item.key === 'tab2' && item.type === 'default'"
30
+ name="default"
31
+ ></slot>
32
+ <slot
33
+ v-if="item.key === 'tab3' && item.type === 'default'"
34
+ name="default"
35
+ ></slot>
36
+ <slot v-if="item.type == 'slot'" :name="item.slot"></slot>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ </template>
41
+
42
+ <script lang="ts">
43
+ import { defineComponent, ref, watch, onMounted } from "vue";
44
+ export default defineComponent({
45
+ name: "TopTab",
46
+ props: {
47
+ /**
48
+ * 根据参数插入自定义tab
49
+ * label:选项卡title
50
+ * key:选项卡ID 请勿重复defaultTabList内已拥有的默认key
51
+ * type:插槽类型 "slot" "default"
52
+ * sort:排序参数,无参数默认插入末尾
53
+ * slot:插槽name
54
+ */
55
+ tapList: {
56
+ type: Array,
57
+ default: () => [],
58
+ },
59
+ // 自定义tab (传入后 默认tab,tapList,失效)
60
+ selfTapList: {
61
+ type: Array,
62
+ default: () => [],
63
+ },
64
+ },
65
+ setup(props: any) {
66
+ // 选中
67
+ const active = ref<string>("");
68
+
69
+ // tab 渲染
70
+ const defaultTabList = ref<any>([
71
+ {
72
+ label: "基本信息",
73
+ key: "a",
74
+ type: "default",
75
+ slot: "default",
76
+ },
77
+ {
78
+ label: "流程图",
79
+ key: "b",
80
+ type: "default",
81
+ slot: "tab2",
82
+ },
83
+ {
84
+ label: "审批记录",
85
+ key: "c",
86
+ type: "default",
87
+ slot: "tab3",
88
+ },
89
+ ]);
90
+
91
+ const isTapList = ref<any>([
92
+ {
93
+ label: "基本信息",
94
+ key: "a",
95
+ type: "default",
96
+ slot: "default",
97
+ },
98
+ {
99
+ label: "流程图",
100
+ key: "b",
101
+ type: "default",
102
+ slot: "tab2",
103
+ },
104
+ {
105
+ label: "审批记录",
106
+ key: "c",
107
+ type: "default",
108
+ slot: "tab3",
109
+ },
110
+ ]);
111
+
112
+ const label = ref<any>();
113
+
114
+ // taskNode taskObj
115
+
116
+ // 选中方法
117
+ const handleActive = (e: string, i: number) => {
118
+ if (e === active.value) {
119
+ return;
120
+ }
121
+
122
+ active.value = e;
123
+ tabAnimation(i);
124
+ };
125
+
126
+ const tabAnimation = (i: number) => {
127
+ if (label.value.length) {
128
+ let doc = <any>(
129
+ document.getElementsByClassName("bottom-line")[0]
130
+ );
131
+ let left;
132
+ if (doc.offsetWidth < label.value[i].offsetWidth - 10) {
133
+ let num =
134
+ (label.value[i].offsetWidth - doc.offsetWidth - 10) / 2;
135
+ left = `${label.value[i].offsetLeft + num}px`;
136
+ } else if (doc.offsetWidth > label.value[i].offsetWidth - 10) {
137
+ let num =
138
+ (doc.offsetWidth - label.value[i].offsetWidth + 10) / 2;
139
+ left = `${label.value[i].offsetLeft - num}px`;
140
+ } else {
141
+ left = `${label.value[i].offsetLeft}px`;
142
+ }
143
+ doc.style.transition = ".3s";
144
+ doc.style.transform = `translateX(${left})`;
145
+ }
146
+ };
147
+
148
+ /* const getTaskNode = () => {
149
+ return taskNode.value.filter((o) => {
150
+ return o.nodeId == taskObj.value.id;
151
+ });
152
+ }; */
153
+ watch(
154
+ () => props.selfTapList,
155
+ (val, preVal) => {
156
+ if (val.length) {
157
+ isTapList.value = [].concat(val);
158
+ active.value = isTapList.value[0].key;
159
+ }
160
+ },
161
+ {
162
+ //如果加了这个参数,值为true的话,就消除了惰性,watch会在创建后立即执行一次
163
+ //那么首次执行,val为默认值,preVal为undefined
164
+ immediate: true,
165
+ //这个参数代表监听对象时,可以监听深度嵌套的对象属性
166
+ deep: true,
167
+ }
168
+ );
169
+
170
+ watch(
171
+ () => props.tapList,
172
+ (val, preVal) => {
173
+ if (!props.selfTapList.length) {
174
+ isTapList.value = [].concat(defaultTabList.value);
175
+ if (val.length > 0) {
176
+ /* return [] */
177
+ val.forEach((v: any, i: number) => {
178
+ if (v.sort && v.sort > 1) {
179
+ isTapList.value.splice(v.sort - 1, 0, v);
180
+ } else if (v.sort == 1) {
181
+ isTapList.value.unshift(v);
182
+ } else {
183
+ isTapList.value.push(v);
184
+ }
185
+ });
186
+ }
187
+ active.value = isTapList.value[0].key;
188
+ }
189
+ },
190
+ {
191
+ //如果加了这个参数,值为true的话,就消除了惰性,watch会在创建后立即执行一次
192
+ //那么首次执行,val为默认值,preVal为undefined
193
+ immediate: true,
194
+ //这个参数代表监听对象时,可以监听深度嵌套的对象属性
195
+ deep: true,
196
+ }
197
+ );
198
+
199
+ onMounted(() => {
200
+ // 渲染后初始化为第一个位置
201
+ tabAnimation(0);
202
+ });
203
+
204
+ return {
205
+ isTapList,
206
+ active,
207
+ handleActive,
208
+ label,
209
+ };
210
+ },
211
+ });
212
+ </script>
213
+
214
+ <style scoped>
215
+ .tops-tab {
216
+ height: 100%;
217
+ }
218
+ .tops-tab-header {
219
+ display: flex;
220
+ width: 100%;
221
+ height: 45px;
222
+ justify-content: space-between;
223
+ font-size: 14px;
224
+ color: #333;
225
+ padding: 0 10px;
226
+ font-weight: 500;
227
+ box-sizing: border-box;
228
+ overflow-x: auto;
229
+ white-space: nowrap;
230
+ flex-wrap: nowrap;
231
+ flex-shrink: 0;
232
+ -ms-overflow-style: none;
233
+ position: relative;
234
+ }
235
+
236
+ .tops-tab-header::after {
237
+ content: "";
238
+ position: absolute;
239
+ width: 100%;
240
+ height: 1px;
241
+ background-color: #f2f2f2;
242
+ left: 0;
243
+ bottom: 0;
244
+ }
245
+
246
+ .tops-tab-header::-webkit-scrollbar {
247
+ display: none;
248
+ }
249
+
250
+ .tops-tab-header-items {
251
+ white-space: nowrap;
252
+ padding-right: 10px;
253
+ box-sizing: border-box;
254
+ display: inline-block;
255
+ height: 100%;
256
+ text-align: center;
257
+ margin-right: 32px;
258
+ font-weight: 400;
259
+ font-size: 15px;
260
+ text-align: left;
261
+ color: #333;
262
+ display: flex;
263
+ align-items: center;
264
+ }
265
+
266
+ .tops-tab-header-items :last-child {
267
+ padding-right: 0;
268
+ margin-right: 0;
269
+ }
270
+ .tops-tab-header-items :last-child::after {
271
+ left: calc(50% - 17px);
272
+ }
273
+
274
+ .tops-tab-header .active {
275
+ position: relative;
276
+ color: #1389ff;
277
+ font-family: "PingFang SC Bold";
278
+ font-weight: 700;
279
+ font-size: 15px;
280
+ text-align: left;
281
+ }
282
+
283
+ .tops-tab-header .bottom-line {
284
+ width: 30px;
285
+ height: 3px;
286
+ border-radius: 1.5px;
287
+ background-color: #1389ff;
288
+ position: absolute;
289
+ bottom: 0;
290
+ left: 0;
291
+ }
292
+ .tops-tab-body {
293
+ height: 100%;
294
+ padding: 0 10px;
295
+ }
296
+ </style>
@@ -0,0 +1,13 @@
1
+ import request from "./request";
2
+
3
+ const proxyStr = "/aws";
4
+
5
+ function getProcessStatus(query: any) {
6
+ return request({
7
+ url: proxyStr + "/pis/getProcessStatus",
8
+ method: "get",
9
+ params: query,
10
+ });
11
+ }
12
+
13
+ export default { getProcessStatus };