lzq 2026-02-25 17:42:56 +08:00
parent 9d90a7682e
commit d29a165423
38 changed files with 257 additions and 139 deletions

View File

@ -17,6 +17,9 @@ export const useAppUserStore = defineStore('AppUser', () => {
const tenantName = ref<string | null>(null)
const isAuthenticated = computed(() => !Strings.isEmpty(token.value))
const isXiaoNa = computed(() => {
return false
})
const isAdmin = computed(() => {
return true
})
@ -44,6 +47,7 @@ export const useAppUserStore = defineStore('AppUser', () => {
isAuthenticated,
roles,
isXiaoNa,
isAdmin,
$reset,
}
}, {

View File

@ -15,6 +15,7 @@ import {
getRoutes,
} from '@/common/router/route-config.ts'
import { SpecialPage } from '@/common/router/constants.ts'
import { reloadUserInfo } from '@/common/app'
function addRoutes(routNames: string[]) {
if (Colls.isEmpty(routNames)) return
@ -64,26 +65,48 @@ router.beforeEach((to, from) => {
// 已登录
if (appUserStore.isAuthenticated) {
if (from.path === '/' && router.getRoutes().length <= 4) {// 浏览器刷新
const succ = reloadRouter()
if (!succ
&& SpecialPage.Login !== name
&& SpecialPage.Home !== name
&& SpecialPage.Main !== name
&& SpecialPage.NotFound !== name) {
return {
replace: true,
name: SpecialPage.Home,
}
} else {
let routeName = router.getRoutes().find((it) => it.path === to.path)?.name as string
if (Strings.isBlank(routeName)) {
routeName = SpecialPage.Home
}
setTimeout(() => {
Evt.emit('browserReflash', routeName)
return reloadRouter()
.then(succ => {
if (!succ
&& SpecialPage.Login !== name
&& SpecialPage.Home !== name
&& SpecialPage.Main !== name
&& SpecialPage.NotFound !== name) {
return {
replace: true,
name: SpecialPage.Home,
}
} else {
let routeName = router.getRoutes().find((it) => it.path === to.path)?.name as string
if (Strings.isBlank(routeName)) {
routeName = SpecialPage.Home
}
setTimeout(() => {
Evt.emit('browserReflash', routeName)
})
return false
}
})
return false
}
/* const succ = reloadRouter()
if (!succ
&& SpecialPage.Login !== name
&& SpecialPage.Home !== name
&& SpecialPage.Main !== name
&& SpecialPage.NotFound !== name) {
return {
replace: true,
name: SpecialPage.Home,
}
} else {
let routeName = router.getRoutes().find((it) => it.path === to.path)?.name as string
if (Strings.isBlank(routeName)) {
routeName = SpecialPage.Home
}
setTimeout(() => {
Evt.emit('browserReflash', routeName)
})
return false
} */
}
return true
}
@ -107,14 +130,17 @@ export function reloadRouter() {
.filter((it) => it.name !== SpecialPage.Main && it.name !== SpecialPage.Login && it.name !== SpecialPage.NotFound && it.name !== SpecialPage.Home)
.map((it) => it.name as string)
removeRoutes(routes)
const routNames = useAppSettingStore()
.menus.filter((it) => it.menuCategory === MenuCategory.Page || it.menuCategory === MenuCategory.SubPage)
.map((it) => it.routeName)
if (Colls.isEmpty(routNames)) {
return false
}
addRoutes(routNames)
return true
return reloadUserInfo()
.then(() => {
const routNames = useAppSettingStore()
.menus.filter((it) => it.menuCategory === MenuCategory.Page || it.menuCategory === MenuCategory.SubPage)
.map((it) => it.routeName)
if (Colls.isEmpty(routNames)) {
return false
}
addRoutes(routNames)
return true
})
}
export default router

View File

@ -5,7 +5,6 @@ import router, {
import Evt from '@/common/utils/evt.ts'
import { useAppSettingStore } from '@/common/app/app-setting-store.ts'
import { useAppPageStore } from '@/common/app/app-page-store.ts'
import { reloadUserInfo } from '@/common/app'
import { ElMessage } from 'element-plus'
import type { App } from 'vue'
import { SpecialPage } from '@/common/router/constants.ts'
@ -26,8 +25,7 @@ function checkRoute(option: string | Option) {
if (menu == null
|| !router.hasRoute(opt.routeName)) {
return reloadUserInfo()
.then(reloadRouter)
return reloadRouter()
.then(() => {
const menu_ = appSettingStore.menus.find(it => it.routeName === opt.routeName)
if (menu_ == null || !router.hasRoute(opt.routeName)) {

View File

@ -5,8 +5,10 @@ const props = withDefaults(
defineProps<{
changeHandler?: () => void
modelValue: [ string | undefined, string | undefined ] | undefined | null
type?: 'year' | 'years' | 'month' | 'months' | 'date' | 'dates' | 'week' | 'datetime' | 'datetimerange' | 'daterange' | 'monthrange' | 'yearrange'
}>(),
{
type: 'datetimerange',
changeHandler: () => {
},
},
@ -66,7 +68,7 @@ const shortcuts = [
clearable
end-placeholder="结束时间"
start-placeholder="开始时间"
type="datetimerange"
:type="type"
@change="changeHandler"
/>
</template>

View File

@ -21,6 +21,7 @@ const key = '3TGBZ-ZK7K5-CMNIK-ICIGZ-K6TYQ-HTBTZ'
interface AMapPropsType {
width?: string
height?: string
mapConfig: {
lat: number
lng: number
@ -43,6 +44,7 @@ const props = withDefaults(
defineProps<AMapPropsType>(),
{
width: '500px',
height: '100%',
},
)
@ -207,7 +209,7 @@ defineExpose({init, destroy})
<style lang="stylus" scoped>
.a-map {
width v-bind('props.width');
height 100%;
height v-bind('props.height');
display flex;
flex-direction column;
gap 10px

View File

@ -17,6 +17,7 @@ const props = withDefaults(defineProps<{
height?: string
width?: string
limit?: number
disabled?: boolean
uploadProps?: Partial<Omit<UploadProps, 'httpRequest' | 'crossorigin' | 'multiple'
| 'data' | 'action' | 'headers' | 'limit' | 'onError'
| 'onRemove' | 'onSuccess' | 'onPreview' | 'fileList' | 'beforeUpload' | 'beforeRemove' | 'onChange' | 'onProgress' | 'name' | 'drag'>>
@ -24,6 +25,7 @@ const props = withDefaults(defineProps<{
limit: 1,
height: '100px',
width: '100px',
disabled: false,
// @ts-ignore
uploadProps: {
// @ts-ignore
@ -113,6 +115,7 @@ defineExpose({
:on-success="uploadSuccHandler"
class="a-uploader"
drag
:disabled="disabled"
v-bind="uploadProps">
<slot>
<ElIcon class="default-icon">
@ -133,8 +136,8 @@ defineExpose({
<style lang="stylus" scoped>
.a-uploader {
width: v-bind(height);
height: v-bind(width);
width: v-bind(width);
height: v-bind(height);
:deep(.el-upload) {
background-color white

View File

@ -135,6 +135,7 @@ const actionColumn = reactive<ActionColumnType<CustomerTypes.TableData>>({
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
customerFormIns.value?.open(row)
},

View File

@ -2,6 +2,9 @@
import ADropTable from '@/components/a-drop-table/ADropTable.vue'
import CustomerApi from '@/pages/cst/customer/customer-api.ts'
const props = defineProps<{
identityCategory?: string,
}>()
const model = defineModel<string | undefined | null>()
const dropTableColumns = [
{
@ -22,7 +25,10 @@ const dropTableColumns = [
},
]
const dropTableLoader = (param: CustomerTypes.SearchCustomerParam) => {
return CustomerApi.paging(param).then(res => res.data)
return CustomerApi.paging({
...param,
identityCategory: props.identityCategory,
}).then(res => res.data)
}
</script>

View File

@ -131,6 +131,7 @@ const tablePageProps = buildTablePageProps<CustomerTypes.SearchCustomerParam, Cu
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
customerFormIns.value?.open(row)
},

View File

@ -131,6 +131,7 @@ const tablePageProps = buildTablePageProps<CustomerTypes.SearchCustomerParam, Cu
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
customerFormIns.value?.open(row)
},

View File

@ -131,6 +131,7 @@ const tablePageProps = buildTablePageProps<CustomerTypes.SearchCustomerParam, Cu
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
customerFormIns.value?.open(row)
},

View File

@ -26,9 +26,9 @@
<ElFormItem>
<ElInput v-model="formData.driverName" placeholder="司机姓名"/>
</ElFormItem>
<ElFormItem>
<!-- <ElFormItem>
<ElInput v-model="formData.phone" placeholder="手机号"/>
</ElFormItem>
</ElFormItem> -->
</template>
<template #columns>
<ElTableColumn label="司机名称" prop="driverName"/>
@ -37,7 +37,7 @@
<ElTableColumn label="手机号" prop="phone"/>
<ElTableColumn label="驾驶证有效期" prop="licenceStartTime">
<template #default="{ row }">
{{ row.licenceStartTime + ' 至 ' + (row.licenceEndTime ?? '永久') }}
{{ Strings.isBlank(row.licenceStartTime) ? '' : row.licenceStartTime + ' 至 ' + (row.licenceEndTime ?? '永久') }}
</template>
</ElTableColumn>
<ElTableColumn label="状态" prop="busy" width="100">
@ -57,6 +57,7 @@ import ATablePage, {
type ATablePageInstance,
buildTablePageProps,
} from '@/components/a-page/a-table-page/ATablePage.tsx'
import Strings from '@/common/utils/strings.ts'
const driverFormIns = useTemplateRef<InstanceType<typeof DriverForm>>('driverForm')
@ -74,14 +75,14 @@ const tablePageProps = buildTablePageProps<CustomerTypes.SearchCustomerParam, Cu
table: {
actionColumn: {
tableActions: [
{
tooltip: '编辑',
icon: 'Edit',
type: 'primary',
action({row}) {
driverFormIns.value?.open(row)
},
},
/* {
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
driverFormIns.value?.open(row)
},
}, */
],
},
},

View File

@ -31,41 +31,40 @@
v-model="formData.projectName"
placeholder="项目名称"/>
</ElFormItem>
<ElFormItem>
<!-- <ElFormItem>
<ElInput
v-model="formData.fringeName"
placeholder="客户"/>
placeholder="客户名"/>
</ElFormItem>
<ElFormItem>
<ElInput
v-model="formData.transName"
placeholder="运输方名称"/>
</ElFormItem>
</ElFormItem> -->
</template>
<template #columns>
<ElTableColumn label="项目名称" prop="projectName"/>
<ElTableColumn label="运输方联系人" prop="transCustomerName" width="140px"/>
<ElTableColumn label="运输方联系电话" prop="transCustomerPhone" width="140px"/>
<ElTableColumn label="运输企业名称" prop="transOrgName" width="140px"/>
<ElTableColumn label="客户" prop="fringeCustomerName" width="140px"/>
<ElTableColumn label="客户联系电话" prop="fringeCustomerPhone" width="140px"/>
<ElTableColumn label="客户企业名称" prop="fringeOrgName" width="140px"/>
<ElTableColumn label="运输方联系人" prop="transCustomerInfo.customerName" width="140px"/>
<ElTableColumn label="运输方联系电话" prop="transCustomerInfo.phone" width="140px"/>
<ElTableColumn label="运输企业名称" prop="transOrgInfo.orgName" width="140px"/>
<ElTableColumn label="客户名" prop="fringeCustomerInfo.customerName" width="140px"/>
<ElTableColumn label="客户联系电话" prop="fringeCustomerInfo.phone" width="140px"/>
<ElTableColumn label="客户企业名称" prop="fringeOrgInfo.orgName" width="140px"/>
<!-- <ElTableColumn label="详细地址" prop="address" width="240" show-overflow-tooltip/> -->
<ElTableColumn label="合同有效期" prop="contractStartDate" width="210">
<ElTableColumn label="合同有效期" prop="contractStartDate" width="220">
<template #default="{ row }">
{{ row.contractStartDate + ' 至 ' + (row.contractEndDate ?? '--') }}
</template>
</ElTableColumn>
<ElTableColumn label="创建时间" prop="createTime" width="170"/>
<ElTableColumn label="创建时间" prop="createTime" width="190"/>
</template>
<ProjectForm ref="projectForm" :research="research"/>
<ProjectDetail ref="projectDetail" @edit-succ="research"/>
<!-- <ProjectDetail ref="projectDetail" @edit-succ="research"/> -->
</ATablePage>
</template>
<script lang="ts" setup>
import ProjectApi from '@/pages/cst/project/project-api.ts'
import ProjectDetail from '@/pages/cst/project/ProjectDetail.vue'
import ProjectForm from '@/pages/cst/project/ProjectForm.vue'
import ADtPicker from '@/components/a-dt-picker/ADtPicker.vue'
import ATablePage, {
@ -74,7 +73,7 @@ import ATablePage, {
} from '@/components/a-page/a-table-page/ATablePage.tsx'
const tablePageIns = useTemplateRef<ATablePageInstance>('tablePage')
const projectDetailIns = useTemplateRef<InstanceType<typeof ProjectDetail>>('projectDetail')
// const projectDetailIns = useTemplateRef<InstanceType<typeof ProjectDetail>>('projectDetail')
const projectFormIns = useTemplateRef<InstanceType<typeof ProjectForm>>('projectForm')
function research() {
@ -84,6 +83,7 @@ function research() {
const tablePageProps = buildTablePageProps<ProjectTypes.SearchProjectParam, ProjectTypes.SearchProjectResult>({
pageLayout: {
dataListHeight: 3,
enableHighForm: false,
},
toolBar: {
leftTools: [
@ -99,15 +99,15 @@ const tablePageProps = buildTablePageProps<ProjectTypes.SearchProjectParam, Proj
table: {
actionColumn: {
tableActions: [
/* {
tooltip: '详情',
icon: 'Postcard',
action({row}) {
projectDetailIns.value?.open(row)
},
}, */
{
tooltip: '详情',
icon: 'Postcard',
action({row}) {
projectDetailIns.value?.open(row)
},
},
{
tooltip: '修改',
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {

View File

@ -9,52 +9,39 @@
v-model="formData.projectName"
placeholder="项目名称"/>
</ElFormItem>
<ElFormItem label="合同图片" prop="contractPicture">
<ElInput
v-model="formData.contractPicture"
placeholder="合同图片"/>
</ElFormItem>
<ElFormItem label="运输方" prop="transCustomerId">
<ElInput
<CustomerDropTable
v-model="formData.transCustomerId"
placeholder="运输方"/>
:placeholder="formData.transCustomerInfo?.customerName" identity-category="YunShu"/>
</ElFormItem>
<ElFormItem label="产废方/购买方" prop="fringeCustomerId">
<ElInput
<ElFormItem label="客户" prop="fringeCustomerId">
<CustomerDropTable
v-model="formData.fringeCustomerId"
placeholder="产废方/购买方"/>
:placeholder="formData.fringeCustomerInfo?.customerName" identity-category="ChanFei"/>
</ElFormItem>
<ElFormItem label="合同图片" prop="picture">
<Uploader
ref="uploader"
v-model:file="formData.contractPicture"
/>
</ElFormItem>
<ElFormItem label="有效期">
<ADtPicker v-model="formData.contractDate" type="daterange"/>
</ElFormItem>
<ElFormItem label="区/县;名称" prop="areaName">
<ElInput
v-model="formData.areaName"
placeholder="区县;名称"/>
</ElFormItem>
<ElFormItem label="详细地址" prop="address">
<ElInput
v-model="formData.address"
placeholder="详细地址"/>
</ElFormItem>
<ElFormItem label="经度" prop="lng">
<ElInput
v-model="formData.lng"
placeholder="经度"/>
</ElFormItem>
<ElFormItem label="纬度" prop="lat">
<ElInput
v-model="formData.lat"
placeholder="纬度"/>
</ElFormItem>
<ElFormItem label="合同有效期" prop="contractStartDate">
<ElInput
v-model="formData.contractStartDate"
placeholder="合同有效期"/>
</ElFormItem>
<ElFormItem label="合同有效期" prop="contractEndDate">
<ElInput
v-model="formData.contractEndDate"
placeholder="合同有效期"/>
<ElFormItem label="地址" prop="address">
<AMap
ref="amap"
v-model:address="formData.address"
v-model:area="formData.area"
v-model:areaName="formData.areaName"
v-model:lat="formData.lat"
v-model:lng="formData.lng"
:map-config="{
lat:appSettingStore.defaultAddress.lat,
lng:appSettingStore.defaultAddress.lng,
}"
class="amap" height="250px" width="547px"/>
</ElFormItem>
</div>
</template>
@ -68,6 +55,12 @@ import AFormPanel, {
type AFormPanelInstance,
buildFormPanelProps,
} from '@/components/a-form-panel/AFormPanel.tsx'
import Uploader from '@/components/uploader/Uploader.vue'
import ADtPicker from '@/components/a-dt-picker/ADtPicker.vue'
import AMap from '@/components/a-map/AMap.vue'
import { useAppSettingStore } from '@/common/app/app-setting-store.ts'
import CustomerDropTable from '@/pages/cst/customer/CustomerDropTable.vue'
import Times, { FMT } from '@/common/utils/times.ts'
const props = withDefaults(defineProps<{
research?: () => void
@ -75,11 +68,13 @@ const props = withDefaults(defineProps<{
research: () => {
},
})
const appSettingStore = useAppSettingStore()
const uploaderIns = useTemplateRef<InstanceType<typeof Uploader>>('uploader')
const formPanelIns = useTemplateRef<AFormPanelInstance>('formPanel')
const status = ref<'add' | 'modify'>('add')
const formPanelProps = buildFormPanelProps<ProjectTypes.SearchProjectResult>({
title: status.value === 'add' ? '新建项目' : '修改项目',
title: '',
detailsLoader(id?: string) {
if (Strings.isBlank(id)) {
status.value = 'add'
@ -88,7 +83,14 @@ const formPanelProps = buildFormPanelProps<ProjectTypes.SearchProjectResult>({
status.value = 'modify'
return ProjectApi
.detail(id!)
.then(res => res.data)
.then(res => {
console.log(res.data.contractStartDate, res.data.contractEndDate, [ Times.toDate(Times.parse(res.data.contractStartDate ?? '', FMT.date)), Times.toDate(Times.parse(res.data.contractEndDate ?? '', FMT.date)) ])
if (res.data.contractPicture != null) uploaderIns.value?.setDefaultFiles([ res.data.contractPicture ])
return {
...res.data,
contractDate: [ Times.toDate(Times.parse(res.data.contractStartDate ?? '', FMT.date)), Times.toDate(Times.parse(res.data.contractEndDate ?? '', FMT.date)) ],
}
})
}
},
doSubmit(data) {
@ -118,7 +120,9 @@ const formPanelProps = buildFormPanelProps<ProjectTypes.SearchProjectResult>({
contractEndDate: [ {required: true, message: '请填写合同有效期', trigger: 'blur'} ],
},
})
watchEffect(() => {
formPanelProps.title = status.value === 'add' ? '新建项目' : '修改项目'
})
defineExpose({
open(data?: ProjectTypes.SearchProjectResult) {
formPanelIns.value?.open(data?.id)
@ -128,9 +132,37 @@ defineExpose({
<style lang="stylus" scoped>
.form-items {
grid-template-columns: 1fr 1fr;
grid-template-areas: "a2 a1" \
"a2 a3" \
"a4 a5" \
"a6 a6";
:deep(.el-form-item) {
&:nth-child(1) {
grid-area a5
}
&:nth-child(2) {
grid-area a3
}
&:nth-child(3) {
grid-area a1
}
&:nth-child(4) {
grid-area a2
}
&:nth-child(5) {
grid-area a4
width 340px;
}
&:nth-child(6) {
grid-area a6
}
}
}
</style>

View File

@ -26,11 +26,17 @@ declare global {
transCustomerId?: string
transCustomerName?: string
transCustomerPhone?: string
transCustomerInfo?: {
customerName?: string
}
// 运输方企业 Id
transOrgId?: string
transOrgName?: string
// 产废方/购买方客户 Id
fringeCustomerId?: string
fringeCustomerInfo?: {
customerName?: string
}
fringeCustomerName?: string
fringeCustomerPhone?: string
// 产废方/购买方企业 Id
@ -62,6 +68,7 @@ declare global {
contractStartDate?: string
// 合同有效期
contractEndDate?: string
contractDate?: Date[]
// 创建时间
createTime?: string
}

View File

@ -58,6 +58,7 @@ const tablePageProps = buildTablePageProps<StationTypes.SearchStationParam, Stat
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
stationFormIns.value?.open(row)
},

View File

@ -101,7 +101,6 @@ interface StationFormType {
const formPanelIns = useTemplateRef<AFormPanelInstance>('formPanel')
const status = ref<'add' | 'modify'>('add')
const formPanelProps = buildFormPanelProps<StationFormType>({
title: status.value === 'add' ? '新建站点' : '修改站点',
labelWidth: '100px',
detailsLoader(id?: string) {
if (Strings.isBlank(id)) {
@ -185,7 +184,9 @@ const formPanelProps = buildFormPanelProps<StationFormType>({
},
})
watchEffect(() => {
formPanelProps.title = status.value === 'add' ? '新建站点' : '修改站点'
})
defineExpose({
open(data?: ProjectTypes.SearchProjectResult) {
formPanelIns.value?.open(data?.id)

View File

@ -75,14 +75,14 @@ const tablePageProps = buildTablePageProps<CustomerTypes.SearchCustomerParam, Cu
table: {
actionColumn: {
tableActions: [
{
/* {
tooltip: '编辑',
icon: 'Edit',
type: 'primary',
type: 'success',
action({row}) {
truckFormIns.value?.open(row)
},
},
}, */
],
},
},

View File

@ -75,7 +75,6 @@ const tablePageProps = buildTablePageProps<ExpenseItemTypes.SearchExpenseItemPar
{
tooltip: '详情',
icon: 'Postcard',
type: 'info',
action({row}) {
expenseItemDetailIns.value?.open(row)
},
@ -83,7 +82,7 @@ const tablePageProps = buildTablePageProps<ExpenseItemTypes.SearchExpenseItemPar
{
tooltip: '编辑',
icon: 'Edit',
type: 'primary',
type: 'success',
action({row}) {
expenseItemFormIns.value?.open(row)
},

View File

@ -77,6 +77,7 @@ const tablePageProps = buildTablePageProps<GoodsCategoryTypes.SearchGoodsCategor
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
goodsCategoryFormIns.value?.open(row)
},

View File

@ -54,13 +54,11 @@ const formPanelProps = buildFormPanelProps<GoodsCategoryTypes.SearchGoodsCategor
detailsLoader(id?: string) {
if (Strings.isBlank(id)) {
status.value = 'add'
formPanelProps.title = '新建产品分类'
return Promise.resolve({
bizType: props.defaultBizType,
sort: 0,
} as GoodsCategoryTypes.SearchGoodsCategoryResult)
} else {
formPanelProps.title = '修改产品分类'
status.value = 'modify'
return GoodsCategoryApi.detail(id!)
.then((res) => {
@ -101,7 +99,9 @@ const formPanelProps = buildFormPanelProps<GoodsCategoryTypes.SearchGoodsCategor
}
},
})
watchEffect(() => {
formPanelProps.title = status.value === 'add' ? '新建产品分类' : '修改产品分类'
})
defineExpose({
open(data?: GoodsCategoryTypes.SearchGoodsCategoryResult) {
formPanelIns.value?.open(data?.id)

View File

@ -4,13 +4,19 @@ import GoodsCategoryApi from '@/pages/gds/goods-category/goods-category-api.ts'
import { bizType } from '@/pages/gds/goods-category/constants.ts'
import Strings from '@/common/utils/strings.ts'
const props = defineProps<{
defaultBizType: typeof bizType[number]['val']
defaultValue: {
id?: string
categoryName?: string
}
}>()
const props = withDefaults(
defineProps<{
defaultBizType: typeof bizType[number]['val']
disabled?: boolean
defaultValue: {
id?: string
categoryName?: string
}
}>(),
{
disabled: false,
},
)
const dataList = Utils.resetAble(reactive<GoodsCategoryTypes.SearchGoodsCategoryResult[]>([]))
const loading = ref(false)
const model = defineModel<string>()
@ -59,6 +65,7 @@ function changeHandle(value: string) {
placeholder="请输入文字搜索"
remote
remote-show-suffix
:disabled="disabled"
@change="changeHandle"
>
<ElOption v-for="it in dataList" :key="it.id" :label="it.categoryName" :value="it.id"/>

View File

@ -32,6 +32,7 @@ declare global {
bizType?: string
// 分类名称
categoryName?: string
sn?: string
// 图片
picture?: string
// 排序

View File

@ -19,7 +19,7 @@
<ElTableColumn label="是否可用" prop="canuse" width="100">
<template #default="{row}">
<ElSwitch v-model="row.canuse" @change="enableGoodsHandler($event as boolean,row.id)"/>
<ElSwitch v-model="row.canuse" :disabled="appUserStore.isXiaoNa" @change="enableGoodsHandler($event as boolean,row.id)"/>
</template>
</ElTableColumn>
<ElTableColumn label="备注" prop="memo" show-overflow-tooltip width="180"/>
@ -38,10 +38,12 @@ import ATablePage, {
buildTablePageProps,
} from '@/components/a-page/a-table-page/ATablePage.tsx'
import { bizType } from '@/pages/gds/goods-category/constants.ts'
import { useAppUserStore } from '@/common/app/app-user-store.ts'
const props = defineProps<{
defaultBizType: typeof bizType[number]['val']
}>()
const appUserStore = useAppUserStore()
const goodsFormIns = useTemplateRef<InstanceType<typeof GoodsForm>>('goodsForm')
@ -81,11 +83,15 @@ const tablePageProps = buildTablePageProps({
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
goodsFormIns.value?.open(row)
},
},
{
show() {
return !appUserStore.isXiaoNa
},
icon: 'Delete',
loading: false,
type: 'danger',

View File

@ -7,13 +7,15 @@
<ElFormItem label="图片" prop="picture">
<Uploader
ref="uploader"
:disabled="appUserStore.isXiaoNa"
v-model:file="formData.picture"/>
</ElFormItem>
<ElFormItem v-if="status === 'modify'" label="产品编码" prop="sn">
<ElInput v-model="formData.sn" placeholder="产品编码" readonly/>
<ElInput v-model="formData.sn" :disabled="appUserStore.isXiaoNa" placeholder="产品编码" readonly/>
</ElFormItem>
<ElFormItem label="产品分类" prop="goodsCategoryId">
<GoodsCategorySelect
:disabled="appUserStore.isXiaoNa"
v-model="formData.goodsCategoryId"
:default-biz-type="defaultBizType"
:default-value="{
@ -22,7 +24,7 @@
}"/>
</ElFormItem>
<ElFormItem label="产品名称" prop="goodsName">
<ElInput v-model="formData.goodsName" placeholder="产品名称"/>
<ElInput v-model="formData.goodsName" :disabled="appUserStore.isXiaoNa" placeholder="产品名称"/>
</ElFormItem>
<ElFormItem v-if="appUserStore.isXiaoNa" label="计费策略" prop="expenseStrategy">
<ElRadioGroup v-model="formData.expenseStrategy">
@ -31,10 +33,10 @@
</ElFormItem>
<ElFormItem label="规格" prop="specParams">
<ElInput v-model="formData.specParams" placeholder="规格"/>
<ElInput v-model="formData.specParams" :disabled="appUserStore.isXiaoNa" placeholder="规格"/>
</ElFormItem>
<ElFormItem label="计量单位" prop="unit">
<ElSelect v-model="formData.unit">
<ElSelect v-model="formData.unit" :disabled="appUserStore.isXiaoNa">
<ElOption
v-for="item in unit"
:key="'unit'+item.val"
@ -72,13 +74,13 @@
</ElInputNumber>
</ElFormItem>
<ElFormItem label="排序" prop="sort">
<ElInputNumber v-model="formData.sort" controls-position="right" placeholder="请输入排序"/>
<ElInputNumber v-model="formData.sort" :disabled="appUserStore.isXiaoNa" controls-position="right" placeholder="请输入排序"/>
</ElFormItem>
<ElFormItem label="是否可用" prop="canuse">
<el-switch v-model="formData.canuse"/>
<el-switch v-model="formData.canuse" :disabled="appUserStore.isXiaoNa"/>
</ElFormItem>
<ElFormItem label="备注" prop="memo">
<ElInput v-model="formData.memo" placeholder="请输入备注"/>
<ElInput v-model="formData.memo" :disabled="appUserStore.isXiaoNa" placeholder="请输入备注"/>
</ElFormItem>
</div>
</template>
@ -113,7 +115,7 @@ const formPanelIns = useTemplateRef<AFormPanelInstance>('formPanel')
const uploaderIns = useTemplateRef<InstanceType<typeof Uploader>>('uploader')
const status = ref<'add' | 'modify'>('add')
const formPanelProps = buildFormPanelProps<GoodsTypes.GoodsForm>({
title: status.value === 'add' ? '新建产品' : '修改产品',
// title: status.value === 'add' ? '' : '',
detailsLoader(id?: string) {
if (Strings.isBlank(id)) {
status.value = 'add'
@ -237,7 +239,9 @@ const formPanelProps = buildFormPanelProps<GoodsTypes.GoodsForm>({
}
},
})
watchEffect(() => {
formPanelProps.title = status.value === 'add' ? '新建产品' : '修改产品'
})
defineExpose({
open(data?: GoodsTypes.SearchGoodsResult) {
formPanelIns.value?.open(data?.id)

View File

@ -53,6 +53,7 @@ const actionColumn = reactive<ActionColumnType<EndpointTypes.SearchEndpointResul
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
endpointFormIns.value?.open(row)
},

View File

@ -74,6 +74,7 @@ const actionColumn = reactive<ActionColumnType<TplTypes.SearchTplResult>>({
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
tplFormIns.value?.open(row)
},

View File

@ -76,6 +76,7 @@ const actionColumn = reactive<ActionColumnType<MenuTypes.SysMenu>>({
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
menuFormIns.value?.open(row as MenuTypes.MenuForm)
},

View File

@ -58,6 +58,7 @@ const actionColumn = reactive<ActionColumnType<RoleTypes.SearchRoleResult>>({
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
show({row}) {
return row.id != '1'
},

View File

@ -54,6 +54,7 @@ const actionColumn = reactive<ActionColumnType<SnConfigTypes.SnConfigDetail>>({
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
snConfigFormIns.value?.open(row)
},

View File

@ -100,6 +100,7 @@ const actionColumn = reactive<ActionColumnType<TaskTypes.SearchTaskResult>>({
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
show({row}) {
return !row.builtin
},

View File

@ -103,6 +103,7 @@ const actionColumn = reactive<ActionColumnType<UserTypes.SearchUserResult>>({
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
userFormIns.value?.open(row)
},

View File

@ -86,6 +86,7 @@ const actionColumn = reactive<ActionColumnType<InOrderTypes.SearchInOrderResult>
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
inOrderFormIns.value?.open(row)
},

View File

@ -96,6 +96,7 @@ const actionColumn = reactive<ActionColumnType<InventoryTypes.SearchInventoryRes
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
inventoryFormIns.value?.open(row)
},

View File

@ -114,6 +114,7 @@ const actionColumn = reactive<ActionColumnType<OutOrderTypes.SearchOutOrderResul
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
outOrderFormIns.value?.open(row)
},

View File

@ -83,6 +83,7 @@ const actionColumn = reactive<ActionColumnType<PurchaseOrderTypes.SearchPurchase
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}: { row: PurchaseOrderTypes.SearchPurchaseOrderResult }) {
purchaseOrderFormIns.value?.open(row)
},

View File

@ -120,6 +120,7 @@ const actionColumn = reactive<ActionColumnType<SalesOrderTypes.SearchSalesOrderR
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
salesOrderFormIns.value?.open(row)
},

View File

@ -80,6 +80,7 @@ const actionColumn = reactive<ActionColumnType<WarehouseTypes.SearchWarehouseRes
{
tooltip: '编辑',
icon: 'Edit',
type: 'success',
action({row}) {
warehouseFormIns.value?.open(row)
},