fix: 移动端 formatUserName 挂载到 methods,修复流转树渲染报错
- Vue2 Options API 中 import 的函数不暴露给模板,需挂到 methods - FlowTree/TaskTreeNode 补 formatUserName 方法
This commit is contained in:
@ -35,7 +35,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { formatUserName } from "../../../utils/format";
|
import { formatUserName as fmtUserName } from "../../../utils/format";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "FlowTree",
|
name: "FlowTree",
|
||||||
@ -58,6 +58,10 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// Vue2 Options API 中 import 的函数需挂到 methods 才能被模板访问
|
||||||
|
formatUserName(userId) {
|
||||||
|
return fmtUserName(userId);
|
||||||
|
},
|
||||||
statusLabel(s) {
|
statusLabel(s) {
|
||||||
const map = { PENDING: "待接收", WIP: "进行中", COMPLETED: "已完成", REJECTED: "已驳回", ARCHIVED: "已入库", OUTBOUND: "已出库" };
|
const map = { PENDING: "待接收", WIP: "进行中", COMPLETED: "已完成", REJECTED: "已驳回", ARCHIVED: "已入库", OUTBOUND: "已出库" };
|
||||||
return map[s] || s;
|
return map[s] || s;
|
||||||
|
|||||||
@ -86,7 +86,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getBaseUrl } from "../../../utils/request";
|
import { getBaseUrl } from "../../../utils/request";
|
||||||
import { formatUserName } from "../../../utils/format";
|
import { formatUserName as fmtUserName } from "../../../utils/format";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TaskTreeNode",
|
name: "TaskTreeNode",
|
||||||
@ -147,6 +147,10 @@ export default {
|
|||||||
const map = { PENDING: "待接收", WIP: "进行中", COMPLETED: "已完成", REJECTED: "已驳回", ARCHIVED: "已入库" };
|
const map = { PENDING: "待接收", WIP: "进行中", COMPLETED: "已完成", REJECTED: "已驳回", ARCHIVED: "已入库" };
|
||||||
return map[s] || s;
|
return map[s] || s;
|
||||||
},
|
},
|
||||||
|
// Vue2 Options API 中 import 的函数需挂到 methods 才能被模板访问
|
||||||
|
formatUserName(userId) {
|
||||||
|
return fmtUserName(userId);
|
||||||
|
},
|
||||||
statusColor(s) {
|
statusColor(s) {
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case "PENDING": return "s-yellow";
|
case "PENDING": return "s-yellow";
|
||||||
|
|||||||
Reference in New Issue
Block a user