This commit is contained in:
@@ -59,7 +59,7 @@ export interface AssetVO {
|
||||
/**
|
||||
* 固定资产类型
|
||||
*/
|
||||
type: number;
|
||||
type: string;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
|
@@ -1,20 +1,25 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import {computed, ref} from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
import {useVbenModal} from '@vben/common-ui';
|
||||
import {$t} from '@vben/locales';
|
||||
import {cloneDeep} from '@vben/utils';
|
||||
|
||||
import { type FormSchemaGetter, useVbenForm } from "#/adapter/form";
|
||||
import { applicationAdd, applicationInfo, applicationUpdate } from '#/api/property/assetManage/application';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
import {type FormSchemaGetter, useVbenForm} from "#/adapter/form";
|
||||
import {
|
||||
applicationAdd,
|
||||
applicationInfo,
|
||||
applicationUpdate
|
||||
} from '#/api/property/assetManage/application';
|
||||
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data';
|
||||
import { assetTypeselect } from "#/api/property/assetType";
|
||||
import { depotList } from "#/api/property/assetManage/depot";
|
||||
import { suppliersList } from "#/api/property/assetManage/suppliers";
|
||||
import { assetList } from "#/api/property/assetManage/asset";
|
||||
import { userList } from "#/api/system/user";
|
||||
import {modalSchema} from './data';
|
||||
import {assetTypeselect} from "#/api/property/assetType";
|
||||
import {depotList} from "#/api/property/assetManage/depot";
|
||||
import {suppliersList} from "#/api/property/assetManage/suppliers";
|
||||
import {assetList} from "#/api/property/assetManage/asset";
|
||||
import {userList} from "#/api/system/user";
|
||||
import type {AssetVO} from "#/api/property/assetManage/asset/model";
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -39,7 +44,7 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
@@ -48,15 +53,15 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
|
||||
formApi.getValues().then(setupPackageSelect);
|
||||
|
||||
async function upSelectUser(nickName: string){
|
||||
const list=await userList({
|
||||
nickName:nickName,
|
||||
async function upSelectUser(nickName: string) {
|
||||
const list = await userList({
|
||||
nickName: nickName,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const options=list.map(item=>{
|
||||
item.label=item.userName;
|
||||
item.value=item.id;
|
||||
const options = list.map(item => {
|
||||
item.label = item.userName;
|
||||
item.value = item.id;
|
||||
})
|
||||
fromApi.updateSchema([
|
||||
{
|
||||
@@ -71,15 +76,15 @@ async function upSelectUser(nickName: string){
|
||||
]);
|
||||
}
|
||||
|
||||
async function upSelectAssets(assetsName: string){
|
||||
const list=await assetList({
|
||||
assetsName:assetsName,
|
||||
async function upSelectAssets(assetsName: string) {
|
||||
const list = await assetList({
|
||||
assetsName: assetsName,
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const options=list.map(item=>{
|
||||
item.label=item.assetsName;
|
||||
item.value=item.id;
|
||||
const options = list.map(item => {
|
||||
item.label = item.assetsName;
|
||||
item.value = item.id;
|
||||
})
|
||||
fromApi.updateSchema([
|
||||
{
|
||||
@@ -94,15 +99,18 @@ async function upSelectAssets(assetsName: string){
|
||||
]);
|
||||
}
|
||||
|
||||
const assetsData = ref<AssetVO[]>([])
|
||||
|
||||
async function setupPackageSelect() {
|
||||
const users = await userList({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 1000,
|
||||
});
|
||||
const assets = await assetList({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 1000,
|
||||
});
|
||||
assetsData.value = assets.rows
|
||||
const options = users.rows.map((item) => ({
|
||||
label: item.nickName,
|
||||
value: item.userId,
|
||||
@@ -121,7 +129,7 @@ async function setupPackageSelect() {
|
||||
},
|
||||
async select(userId) {
|
||||
await upSelectUser(userId);
|
||||
userId=""
|
||||
userId = ""
|
||||
},
|
||||
fieldName: 'userId',
|
||||
},
|
||||
@@ -131,18 +139,30 @@ async function setupPackageSelect() {
|
||||
optionLabelProp: 'label',
|
||||
options: assetOptions,
|
||||
showSearch: true,
|
||||
onChange: async (value: string) => {
|
||||
// 找到选中的服务数据
|
||||
const assetInfo = assetsData.value.find(item => item.id === value);
|
||||
if (assetInfo) {
|
||||
formApi.updateSchema([{
|
||||
componentProps: {
|
||||
max:assetInfo.stock
|
||||
},
|
||||
fieldName: 'number',
|
||||
}])
|
||||
}
|
||||
},
|
||||
},
|
||||
async select(assetsId) {
|
||||
await upSelectAssets(assetsId);
|
||||
assetsId=""
|
||||
assetsId = ""
|
||||
},
|
||||
fieldName: 'assetId',
|
||||
},
|
||||
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[550px]',
|
||||
@@ -156,7 +176,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
const {id} = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
@@ -172,7 +192,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
const {valid} = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
@@ -197,7 +217,7 @@ async function handleClosed() {
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm />
|
||||
<BasicForm/>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
@@ -2,65 +2,65 @@ import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import { renderDict } from "#/utils/render";
|
||||
import { DictEnum } from '@vben/constants';
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
|
||||
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'assetId',
|
||||
// label: '资产id',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'userId',
|
||||
// label: '领用人id',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'number',
|
||||
// label: '数量',
|
||||
// },
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'assetId',
|
||||
label: '资产id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'userId',
|
||||
label: '领用人id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'number',
|
||||
label: '数量',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
component: 'Select',
|
||||
componentProps:{
|
||||
options:getDictOptions(DictEnum.WY_ZCSHZT)
|
||||
},
|
||||
fieldName: 'state',
|
||||
label: '状态',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'acceptanceUserId',
|
||||
label: '审批人id',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
fieldName: 'acceptanceTime',
|
||||
label: '审批时间',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
fieldName: 'applicationTime',
|
||||
label: '申请时间',
|
||||
label: '领用状态',
|
||||
},
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'acceptanceUserId',
|
||||
// label: '审批人id',
|
||||
// },
|
||||
// {
|
||||
// component: 'DatePicker',
|
||||
// componentProps: {
|
||||
// showTime: true,
|
||||
// format: 'YYYY-MM-DD HH:mm:ss',
|
||||
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
// },
|
||||
// fieldName: 'acceptanceTime',
|
||||
// label: '审批时间',
|
||||
// },
|
||||
// {
|
||||
// component: 'DatePicker',
|
||||
// componentProps: {
|
||||
// showTime: true,
|
||||
// format: 'YYYY-MM-DD HH:mm:ss',
|
||||
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
// },
|
||||
// fieldName: 'applicationTime',
|
||||
// label: '申请时间',
|
||||
// },
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '主键',
|
||||
field: 'id',
|
||||
},
|
||||
{
|
||||
title: '资产',
|
||||
field: 'assetName',
|
||||
@@ -74,7 +74,11 @@ export const columns: VxeGridProps['columns'] = [
|
||||
field: 'number',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
title: '申请时间',
|
||||
field: 'applicationTime',
|
||||
},
|
||||
{
|
||||
title: '领用状态',
|
||||
field: 'state',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
@@ -90,14 +94,6 @@ export const columns: VxeGridProps['columns'] = [
|
||||
title: '审批时间',
|
||||
field: 'acceptanceTime',
|
||||
},
|
||||
{
|
||||
title: '申请时间',
|
||||
field: 'applicationTime',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
@@ -118,19 +114,25 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '资产id',
|
||||
label: '资产',
|
||||
fieldName: 'assetId',
|
||||
component: 'Select',
|
||||
rules:'selectRequired'
|
||||
},
|
||||
{
|
||||
label: '领用人id',
|
||||
label: '领用人',
|
||||
fieldName: 'userId',
|
||||
component: 'Select',
|
||||
rules:'selectRequired'
|
||||
},
|
||||
{
|
||||
label: '数量',
|
||||
fieldName: 'number',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps:{
|
||||
min:1,
|
||||
},
|
||||
rules:'required'
|
||||
},
|
||||
// {
|
||||
// label: '状态',
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
import {Page, useVbenModal, type VbenFormProps} from '@vben/common-ui';
|
||||
import {getVxePopupContainer} from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import {Modal, Popconfirm, Space} from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
@@ -14,14 +14,15 @@ import {
|
||||
import {
|
||||
applicationExport,
|
||||
applicationList,
|
||||
applicationRemove,
|
||||
applicationRemove, applicationUpdate,
|
||||
} from '#/api/property/assetManage/application';
|
||||
import type { ApplicationForm } from '#/api/property/assetManage/application/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
import type {ApplicationForm} from '#/api/property/assetManage/application/model';
|
||||
import {commonDownloadExcel} from '#/utils/file/download';
|
||||
|
||||
import applicationModal from './application-modal.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
|
||||
import {columns, querySchema} from './data';
|
||||
import {useUserStore} from "@vben/stores";
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
labelWidth: 80,
|
||||
@@ -50,7 +51,7 @@ const gridOptions: VxeGridProps = {
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
query: async ({page}, formValues = {}) => {
|
||||
return await applicationList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
@@ -81,7 +82,7 @@ function handleAdd() {
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<ApplicationForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.setData({id: row.id});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
@@ -90,6 +91,17 @@ async function handleDelete(row: Required<ApplicationForm>) {
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
async function handleAudit(row: Required<ApplicationForm>, status: number) {
|
||||
const info = cloneDeep(row)
|
||||
info.state = status
|
||||
info.acceptanceTime = new Date()
|
||||
info.acceptanceUserId = userStore.userInfo?.userId
|
||||
await applicationUpdate(info)
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: Required<ApplicationForm>) => row.id);
|
||||
@@ -141,12 +153,29 @@ function handleDownloadExcel() {
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['property:application:edit']"
|
||||
@click.stop="handleEdit(row)"
|
||||
<!-- <ghost-button-->
|
||||
<!-- v-access:code="['property:application:edit']"-->
|
||||
<!-- @click.stop="handleEdit(row)"-->
|
||||
<!-- >-->
|
||||
<!-- {{ $t('pages.common.edit') }}-->
|
||||
<!-- </ghost-button>-->
|
||||
<Popconfirm
|
||||
:get-popup-container="getVxePopupContainer"
|
||||
placement="left"
|
||||
title="资产领用审核"
|
||||
@confirm="handleAudit(row,1)"
|
||||
cancelText="不通过"
|
||||
okText="通过"
|
||||
@cancel="handleAudit(row,2)"
|
||||
>
|
||||
{{ $t('pages.common.edit') }}
|
||||
</ghost-button>
|
||||
<ghost-button
|
||||
v-access:code="['property:application:edit']"
|
||||
@click.stop=""
|
||||
:disabled="row.state!=0"
|
||||
>
|
||||
审核
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
<Popconfirm
|
||||
:get-popup-container="getVxePopupContainer"
|
||||
placement="left"
|
||||
@@ -164,6 +193,6 @@ function handleDownloadExcel() {
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<ApplicationModal @reload="tableApi.query()" />
|
||||
<ApplicationModal @reload="tableApi.query()"/>
|
||||
</Page>
|
||||
</template>
|
||||
|
@@ -10,8 +10,6 @@ import { assetAdd, assetInfo, assetUpdate } from '#/api/property/assetManage/ass
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data';
|
||||
import { packageSelectList } from "#/api/system/tenant-package";
|
||||
import { assetTypeselect } from "#/api/property/assetType";
|
||||
import { depotList } from "#/api/property/assetManage/depot";
|
||||
import { suppliersList } from "#/api/property/assetManage/suppliers";
|
||||
|
||||
@@ -25,9 +23,9 @@ const title = computed(() => {
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
// 默认占满两列
|
||||
formItemClass: 'col-span-2',
|
||||
formItemClass: 'col-span-1',
|
||||
// 默认label宽度 px
|
||||
labelWidth: 80,
|
||||
labelWidth: 100,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
@@ -45,14 +43,9 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
},
|
||||
);
|
||||
|
||||
async function setupPackageSelect() {
|
||||
const tenantPackageList = await assetTypeselect();
|
||||
async function setupPackageSelect(assetTypeOptions) {
|
||||
const depot = await depotList();
|
||||
const suppliers =await suppliersList();
|
||||
const options = tenantPackageList.rows.map((item) => ({
|
||||
label: item.assetTypeName,
|
||||
value: item.id,
|
||||
}));
|
||||
const depotoptions = depot.rows.map((item) => ({
|
||||
label: item.depotName,
|
||||
value: item.id,
|
||||
@@ -67,7 +60,7 @@ async function setupPackageSelect() {
|
||||
componentProps: {
|
||||
optionFilterProp: 'label',
|
||||
optionLabelProp: 'label',
|
||||
options,
|
||||
options:assetTypeOptions,
|
||||
showSearch: true,
|
||||
},
|
||||
fieldName: 'model',
|
||||
@@ -96,7 +89,7 @@ async function setupPackageSelect() {
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[550px]',
|
||||
class: 'w-[70%]',
|
||||
fullscreenButton: false,
|
||||
onBeforeClose,
|
||||
onClosed: handleClosed,
|
||||
@@ -108,15 +101,15 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
const { id,assetTypeOptions } = modalApi.getData() as { id?: number | string,assetTypeOptions:any[] };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await assetInfo(id);
|
||||
record.type=record.type.toString()
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
await setupPackageSelect();
|
||||
await setupPackageSelect(assetTypeOptions);
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
|
@@ -6,7 +6,7 @@ import { DictEnum } from '@vben/constants';
|
||||
|
||||
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
export const querySchema: FormSchemaGetter = (assetTypeOptions) => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'name',
|
||||
@@ -14,6 +14,9 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps:{
|
||||
options: assetTypeOptions
|
||||
},
|
||||
fieldName: 'model',
|
||||
label: '资产类型',
|
||||
},
|
||||
@@ -32,54 +35,50 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{type: 'checkbox', width: 60},
|
||||
{
|
||||
title: '序号',
|
||||
field: 'id',
|
||||
slots: {
|
||||
default: ({ rowIndex }) => {
|
||||
return (rowIndex + 1).toString();
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '资产名称',
|
||||
field: 'name',
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
title: '资产类型',
|
||||
field: 'modelName',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '规格',
|
||||
field: 'specs',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '价格',
|
||||
field: 'price',
|
||||
},
|
||||
{
|
||||
title: '库存',
|
||||
field: 'stock',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '计量单位',
|
||||
field: 'unit',
|
||||
},
|
||||
{
|
||||
title: '仓库',
|
||||
field: 'depotName',
|
||||
},
|
||||
{
|
||||
title: '描述信息',
|
||||
field: 'msg',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '供应商',
|
||||
field: 'suppliersName',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '仓库',
|
||||
field: 'depotName',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '库存',
|
||||
field: 'stock',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '入库时间',
|
||||
field: 'storageTime',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '固定资产',
|
||||
@@ -89,10 +88,12 @@ export const columns: VxeGridProps['columns'] = [
|
||||
return renderDict(row.type, DictEnum.WY_SF);
|
||||
},
|
||||
},
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
title: '描述信息',
|
||||
field: 'msg',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
@@ -117,46 +118,56 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
label: '资产名称',
|
||||
fieldName: 'name',
|
||||
component: 'Input',
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '类型',
|
||||
fieldName: 'model',
|
||||
component: 'Select',
|
||||
rules:'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '规格',
|
||||
fieldName: 'specs',
|
||||
component: 'Textarea',
|
||||
component: 'Input',
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '价格',
|
||||
fieldName: 'price',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps:{
|
||||
min:0,
|
||||
precision:2,
|
||||
},
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '库存',
|
||||
fieldName: 'stock',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps:{
|
||||
min:0,
|
||||
},
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '计量单位',
|
||||
fieldName: 'unit',
|
||||
component: 'Input',
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '仓库',
|
||||
fieldName: 'depotId',
|
||||
component: 'Select',
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '描述信息',
|
||||
fieldName: 'msg',
|
||||
component: 'Textarea',
|
||||
},
|
||||
{
|
||||
label: '供应商id',
|
||||
label: '供应商',
|
||||
fieldName: 'suppliersId',
|
||||
component: 'Select',
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '入库时间',
|
||||
@@ -167,13 +178,23 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '固定资产类型',
|
||||
label: '是否固定资产',
|
||||
fieldName: 'type',
|
||||
component: 'Select',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
buttonStyle: 'solid',
|
||||
options: getDictOptions('wy_sf'),
|
||||
},
|
||||
defaultValue:'0',
|
||||
rules:'required',
|
||||
},
|
||||
{
|
||||
label: '描述信息',
|
||||
fieldName: 'msg',
|
||||
component: 'Textarea',
|
||||
formItemClass:'col-span-2'
|
||||
},
|
||||
];
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
import {Page, useVbenModal, type VbenFormProps} from '@vben/common-ui';
|
||||
import {getVxePopupContainer} from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import {Modal, Popconfirm, Space} from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
@@ -16,22 +16,27 @@ import {
|
||||
assetList,
|
||||
assetRemove,
|
||||
} from '#/api/property/assetManage/asset';
|
||||
import type { AssetForm } from '#/api/property/assetManage/asset/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
import type {AssetForm} from '#/api/property/assetManage/asset/model';
|
||||
import {commonDownloadExcel} from '#/utils/file/download';
|
||||
|
||||
import assetModal from './asset-modal.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
import {columns, querySchema} from './data';
|
||||
import {assetTypeList} from "#/api/property/assetManage/assetType";
|
||||
import type {AssertType} from "vitest";
|
||||
import {computed, onMounted, ref} from "vue";
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
const assetTypeOptions=ref<AssertType[]>([])
|
||||
|
||||
const formOptions = computed(() => ({
|
||||
commonConfig: {
|
||||
labelWidth: 80,
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
schema: querySchema(),
|
||||
schema: querySchema(assetTypeOptions.value),
|
||||
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||
};
|
||||
}));
|
||||
|
||||
const gridOptions: VxeGridProps = {
|
||||
checkboxConfig: {
|
||||
@@ -47,7 +52,7 @@ const gridOptions: VxeGridProps = {
|
||||
pagerConfig: {},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
query: async ({page}, formValues = {}) => {
|
||||
return await assetList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
@@ -73,12 +78,12 @@ const [AssetModal, modalApi] = useVbenModal({
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.setData({assetTypeOptions:assetTypeOptions.value});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<AssetForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.setData({id: row.id,assetTypeOptions:assetTypeOptions.value});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
@@ -106,6 +111,24 @@ function handleDownloadExcel() {
|
||||
fieldMappingTime: formOptions.fieldMappingTime,
|
||||
});
|
||||
}
|
||||
|
||||
async function queryAssetType() {
|
||||
let params = {
|
||||
pageSize: 1000,
|
||||
pageNum: 1,
|
||||
}
|
||||
const res = await assetTypeList(params)
|
||||
assetTypeOptions.value = res.rows.map((item) => ({
|
||||
label: item.assetTypeName,
|
||||
value: item.id,
|
||||
}));
|
||||
return assetTypeOptions.value
|
||||
}
|
||||
|
||||
onMounted(()=>{
|
||||
queryAssetType()
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -161,6 +184,6 @@ function handleDownloadExcel() {
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<AssetModal @reload="tableApi.query()" />
|
||||
<AssetModal @reload="tableApi.query()"/>
|
||||
</Page>
|
||||
</template>
|
||||
|
@@ -1,130 +1,137 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'depotId',
|
||||
label: '仓库id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'assetId',
|
||||
label: '资产id',
|
||||
},
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'depotId',
|
||||
// label: '仓库id',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'assetId',
|
||||
// label: '资产id',
|
||||
// },
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options:getDictOptions('wy_cklzlx')
|
||||
},
|
||||
fieldName: 'type',
|
||||
label: '流转类型',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
fieldName: 'time',
|
||||
label: '流转时间',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'userId',
|
||||
label: '操作人id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'state',
|
||||
label: '状态',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'price',
|
||||
label: '价格',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'priceSum',
|
||||
label: '总价',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'number',
|
||||
label: '数量',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'supplierId',
|
||||
label: '供应商id',
|
||||
},
|
||||
// {
|
||||
// component: 'DatePicker',
|
||||
// componentProps: {
|
||||
// showTime: true,
|
||||
// format: 'YYYY-MM-DD HH:mm:ss',
|
||||
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
// },
|
||||
// fieldName: 'time',
|
||||
// label: '流转时间',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'userId',
|
||||
// label: '操作人id',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'state',
|
||||
// label: '状态',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'price',
|
||||
// label: '价格',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'priceSum',
|
||||
// label: '总价',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'number',
|
||||
// label: '数量',
|
||||
// },
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'supplierId',
|
||||
// label: '供应商id',
|
||||
// },
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '主键',
|
||||
field: 'id',
|
||||
},
|
||||
{
|
||||
title: '仓库id',
|
||||
field: 'depotId',
|
||||
minWidth:150,
|
||||
},
|
||||
{
|
||||
title: '资产id',
|
||||
field: 'assetId',
|
||||
width:180,
|
||||
},
|
||||
{
|
||||
title: '流转类型',
|
||||
field: 'type',
|
||||
width:120,
|
||||
},
|
||||
|
||||
{
|
||||
title: '数量',
|
||||
field: 'number',
|
||||
width:120,
|
||||
},
|
||||
{
|
||||
title: '流转时间',
|
||||
field: 'time',
|
||||
width:150,
|
||||
},
|
||||
{
|
||||
title: '操作人id',
|
||||
field: 'userId',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
field: 'state',
|
||||
width:150,
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
field: 'remark',
|
||||
width:180,
|
||||
},
|
||||
{
|
||||
title: '价格',
|
||||
field: 'price',
|
||||
},
|
||||
{
|
||||
title: '总价',
|
||||
field: 'priceSum',
|
||||
},
|
||||
{
|
||||
title: '数量',
|
||||
field: 'number',
|
||||
},
|
||||
{
|
||||
title: '供应商id',
|
||||
field: 'supplierId',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '操作',
|
||||
width: 180,
|
||||
},
|
||||
// {
|
||||
// title: '状态',
|
||||
// field: 'state',
|
||||
// width:150,
|
||||
// },
|
||||
// {
|
||||
// title: '价格',
|
||||
// field: 'price',
|
||||
// },
|
||||
// {
|
||||
// title: '总价',
|
||||
// field: 'priceSum',
|
||||
// },
|
||||
// {
|
||||
// title: '供应商id',
|
||||
// field: 'supplierId',
|
||||
// },
|
||||
// {
|
||||
// title: '创建时间',
|
||||
// field: 'createTime',
|
||||
// },
|
||||
// {
|
||||
// field: 'action',
|
||||
// fixed: 'right',
|
||||
// slots: { default: 'action' },
|
||||
// title: '操作',
|
||||
// width: 180,
|
||||
// },
|
||||
];
|
||||
|
||||
export const modalSchema: FormSchemaGetter = () => [
|
||||
|
@@ -135,47 +135,47 @@ function handleDownloadExcel() {
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:log:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['property:log:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['property:log:edit']"
|
||||
@click.stop="handleEdit(row)"
|
||||
>
|
||||
{{ $t('pages.common.edit') }}
|
||||
</ghost-button>
|
||||
<Popconfirm
|
||||
:get-popup-container="getVxePopupContainer"
|
||||
placement="left"
|
||||
title="确认删除?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<ghost-button
|
||||
danger
|
||||
v-access:code="['property:log:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
<!-- <a-button-->
|
||||
<!-- :disabled="!vxeCheckboxChecked(tableApi)"-->
|
||||
<!-- danger-->
|
||||
<!-- type="primary"-->
|
||||
<!-- v-access:code="['property:log:remove']"-->
|
||||
<!-- @click="handleMultiDelete">-->
|
||||
<!-- {{ $t('pages.common.delete') }}-->
|
||||
<!-- </a-button>-->
|
||||
<!-- <a-button-->
|
||||
<!-- type="primary"-->
|
||||
<!-- v-access:code="['property:log:add']"-->
|
||||
<!-- @click="handleAdd"-->
|
||||
<!-- >-->
|
||||
<!-- {{ $t('pages.common.add') }}-->
|
||||
<!-- </a-button>-->
|
||||
</Space>
|
||||
</template>
|
||||
<!-- <template #action="{ row }">-->
|
||||
<!-- <Space>-->
|
||||
<!-- <ghost-button-->
|
||||
<!-- v-access:code="['property:log:edit']"-->
|
||||
<!-- @click.stop="handleEdit(row)"-->
|
||||
<!-- >-->
|
||||
<!-- {{ $t('pages.common.edit') }}-->
|
||||
<!-- </ghost-button>-->
|
||||
<!-- <Popconfirm-->
|
||||
<!-- :get-popup-container="getVxePopupContainer"-->
|
||||
<!-- placement="left"-->
|
||||
<!-- title="确认删除?"-->
|
||||
<!-- @confirm="handleDelete(row)"-->
|
||||
<!-- >-->
|
||||
<!-- <ghost-button-->
|
||||
<!-- danger-->
|
||||
<!-- v-access:code="['property:log:remove']"-->
|
||||
<!-- @click.stop=""-->
|
||||
<!-- >-->
|
||||
<!-- {{ $t('pages.common.delete') }}-->
|
||||
<!-- </ghost-button>-->
|
||||
<!-- </Popconfirm>-->
|
||||
<!-- </Space>-->
|
||||
<!-- </template>-->
|
||||
</BasicTable>
|
||||
<LogModal @reload="tableApi.query()" />
|
||||
</Page>
|
||||
|
Reference in New Issue
Block a user