fix add fail
This commit is contained in:
+11
-1
@@ -1,6 +1,7 @@
|
||||
import { axios } from "timi-web-api";
|
||||
import type { Page, PageResult } from "timi-web-api";
|
||||
import type { Tag, TagApply, TagBizType } from "@/types/Tag";
|
||||
import { getCurrentStoreId } from "@/utils/store";
|
||||
|
||||
const BASE_URI = "/gao/tag";
|
||||
|
||||
@@ -15,7 +16,16 @@ async function detail(id: string): Promise<Tag> {
|
||||
}
|
||||
|
||||
async function create(tag: Tag): Promise<Tag> {
|
||||
return await axios.post(`${BASE_URI}/create`, tag);
|
||||
const ownerId = tag.ownerId || getCurrentStoreId();
|
||||
if (!ownerId) {
|
||||
throw new Error("无法确定标签所属门店");
|
||||
}
|
||||
|
||||
return await axios.post(`${BASE_URI}/create`, {
|
||||
...tag,
|
||||
ownerType: tag.ownerType || "GAO_STORE",
|
||||
ownerId
|
||||
});
|
||||
}
|
||||
|
||||
async function update(tag: Tag): Promise<void> {
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
@right-button-click="confirmSelection"
|
||||
>
|
||||
<div class="tag-selector">
|
||||
<div class="search-row">
|
||||
<div class="filters glass">
|
||||
<t-input
|
||||
class="input"
|
||||
size="small"
|
||||
v-model.trim="keyword"
|
||||
v-model="keyword"
|
||||
borderless
|
||||
clearable
|
||||
placeholder="搜索标签"
|
||||
@@ -22,7 +22,7 @@
|
||||
<t-input
|
||||
class="input"
|
||||
size="small"
|
||||
v-model.trim="newTagName"
|
||||
v-model="newTagName"
|
||||
borderless
|
||||
clearable
|
||||
placeholder="新增标签名称"
|
||||
@@ -32,10 +32,12 @@
|
||||
size="small"
|
||||
:loading="isCreating"
|
||||
:disabled="isCreating"
|
||||
content="新增"
|
||||
@click="createTag"
|
||||
>新增</t-button>
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
<div class="list-wrap">
|
||||
<div class="list">
|
||||
<t-tag
|
||||
v-for="(item, index) in visibleTagList"
|
||||
@@ -52,6 +54,7 @@
|
||||
<div v-if="!visibleTagList.length" class="center-tips" v-text="emptyText" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</bottom-popup>
|
||||
</template>
|
||||
|
||||
@@ -202,15 +205,16 @@ watch(() => props.visible, async (value) => {
|
||||
|
||||
<style scoped lang="less">
|
||||
.tag-selector {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
min-height: 0;
|
||||
flex-direction: column;
|
||||
|
||||
.search-row {
|
||||
.filters {
|
||||
gap: .5rem;
|
||||
top: 0;
|
||||
display: flex;
|
||||
padding: 1rem;
|
||||
padding: .5rem 1rem;
|
||||
position: sticky;
|
||||
align-items: center;
|
||||
|
||||
.input {
|
||||
@@ -223,13 +227,10 @@ watch(() => props.visible, async (value) => {
|
||||
|
||||
.list {
|
||||
gap: .75rem;
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
padding: 0 1rem 1rem;
|
||||
flex-wrap: wrap;
|
||||
align-content: flex-start;
|
||||
padding: 0 1rem 1rem;
|
||||
|
||||
.item {
|
||||
flex: 1 1 auto;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div v-can="corePermissionCodes.tag.read" class="tag-list">
|
||||
<div class="header bg-white">
|
||||
<div class="filters glass">
|
||||
<t-input
|
||||
v-model.trim="keyword"
|
||||
class="search"
|
||||
@@ -274,12 +274,11 @@ onUnmounted(() => {
|
||||
.tag-list {
|
||||
padding: var(--app-nav-height) 0 2rem 0;
|
||||
|
||||
.header {
|
||||
.filters {
|
||||
top: var(--app-nav-height);
|
||||
z-index: 10;
|
||||
padding: .5rem;
|
||||
position: sticky;
|
||||
box-shadow: var(--td-shadow-1);
|
||||
|
||||
.search {
|
||||
border: 1px solid var(--td-component-border);
|
||||
|
||||
Reference in New Issue
Block a user