基础资料模块 表格添加 switch 触发是否启用。美化界面

main
HUOJIN\92525 2025-04-14 17:45:07 +08:00
parent 381c4b7f31
commit 3c7f2eb212
11 changed files with 314 additions and 111 deletions

View File

@ -14,6 +14,7 @@
:theme="{
algorithm: compactFlag ? theme.compactAlgorithm : theme.defaultAlgorithm,
token: {
fontFamily: '微软雅黑, Arial, sans-serif',
colorPrimary: themeColors[colorIndex].primaryColor,
colorLink: themeColors[colorIndex].primaryColor,
colorLinkActive: themeColors[colorIndex].activeColor,

View File

@ -25,7 +25,7 @@ export const appDefaultConfig: AppConfig = {
// 菜单主题
sideMenuTheme: 'dark',
// 主题颜色索引
colorIndex: 0,
colorIndex: 1,
// 顶部菜单页面宽度
pageWidth: '99%',
// 圆角
@ -41,13 +41,13 @@ export const appDefaultConfig: AppConfig = {
// 页脚
footerFlag: true,
// 帮助文档
helpDocFlag: true,
helpDocFlag: false,
// 帮助文档默认展开
helpDocExpandFlag: true,
helpDocExpandFlag: false,
// 水印
watermarkFlag: true,
watermarkFlag: false,
// 网站名称
websiteName: 'SmartAdmin 3.X',
websiteName: 'wms',
// 主题颜色
primaryColor: '#1677ff',
// 紧凑

View File

@ -96,18 +96,18 @@
<template v-if="column.dataIndex === 'action'">
<div class="smart-table-operate">
<a-button @click="showForm(record)" type="link" v-privilege="'address:update'">
<template #icon>
<EditOutlined/>
</template>
<a-space>
<a-button @click="showForm(record)" type="primary" ghost style="width:60px;height: 32px"
v-privilege="'address:update'">
编辑
</a-button>
<a-button @click="onDelete(record)" danger type="link" v-privilege="'address:delete'">
<template #icon>
<DeleteOutlined/>
</template>
<a-button @click="onDelete(record)" type="primary" danger ghost style="width:60px;height: 32px"
v-privilege="'address:delete'">
删除
</a-button>
</a-space>
</div>
</template>
@ -218,7 +218,8 @@ const columns = ref([
title: '操作',
dataIndex: 'action',
fixed: 'right',
width: 140,
align: 'center',
width: 150,
},
]);
@ -279,7 +280,7 @@ onMounted(queryData);
// ---------------------------- / ----------------------------
const formRef = ref();
function showForm(data:object) {
function showForm(data: object) {
formRef.value.show(data);
}
@ -319,7 +320,7 @@ async function requestDelete(data: any) {
//
const selectedRowKeyList = ref([]);
function onSelectChange(selectedRowKeys:any) {
function onSelectChange(selectedRowKeys: any) {
selectedRowKeyList.value = selectedRowKeys;
}

View File

@ -79,7 +79,12 @@
</template> -->
<template v-if="column.dataIndex === 'disabledFlag'">
<a-tag :color="text ? 'processing' : 'error'">{{ text ? '启用' : '禁用' }}</a-tag>
<a-switch
@change="(checked: boolean) => handleChangeDisabled(checked, record)"
:checked="record.disabledFlag"
checked-children="启用"
un-checked-children="禁用"
/>
</template>
@ -93,18 +98,19 @@
<template v-if="column.dataIndex === 'action'">
<div class="smart-table-operate">
<a-button @click="showForm(record)" type="link" v-privilege="'area:update'">
<template #icon>
<EditOutlined/>
</template>
<a-space>
<a-button @click="showForm(record)" type="primary" ghost style="width:60px;height: 32px"
v-privilege="'area:update'">
<!-- <template #icon>
<IconFontComponent style="font-size: 18px" type="icon-edit"/>
</template>-->
编辑
</a-button>
<a-button @click="onDelete(record)" danger type="link" v-privilege="'area:delete'">
<template #icon>
<DeleteOutlined/>
</template>
<a-button @click="onDelete(record)" type="primary" danger ghost style="width:60px;height: 32px"
v-privilege="'area:delete'">
删除
</a-button>
</a-space>
</div>
</template>
</template>
@ -142,7 +148,6 @@ import TableOperator from '/@/components/support/table-operator/index.vue';
import AreaForm from '/@/views/business/wms/base/area/area-form.vue';
import {TABLE_ID_CONST} from "/@/constants/support/table-id-const";
import AreaSelect from "/@/views/business/wms/base/area/area-select.vue";
// ---------------------------- ----------------------------
const columns = ref([
@ -180,7 +185,8 @@ const columns = ref([
title: '操作',
dataIndex: 'action',
fixed: 'right',
width: 140,
align: 'center',
width: 150,
},
]);
@ -217,7 +223,7 @@ function onSearch() {
//
function changeAreaSelect(selectValue: any) {
if(selectValue){
if (selectValue) {
queryForm.areaId = selectValue.areaId;
}
}
@ -236,8 +242,37 @@ async function queryData() {
}
}
// ----------------------- / ------------------------
function handleChangeDisabled(disabledFlag:boolean, record:object) {
const content = disabledFlag ? '"启用"' + record.areaName : '"禁用"' + record.areaName + ",确认是否继续?";
Modal.confirm({
title: '提示',
content: '此操作将' + content,
okText: '确认',
okType: 'danger',
onOk() {
requestChangeDisabled(disabledFlag, record);
},
cancelText: '取消',
onCancel() {
},
});
}
async function requestChangeDisabled(disabledFlag:boolean, record:object) {
SmartLoading.show();
try {
record.disabledFlag = disabledFlag;
await areaApi.update(record);
message.success('操作成功');
onSearch();
} catch (e) {
smartSentry.captureError(e);
} finally {
SmartLoading.hide();
}
}
onMounted(queryData);
// ---------------------------- / ----------------------------
const formRef = ref();
@ -321,4 +356,6 @@ async function requestBatchDelete() {
SmartLoading.hide();
}
}
onMounted(queryData);
</script>

View File

@ -74,24 +74,29 @@
<template #bodyCell="{ text, record, column }">
<template v-if="column.dataIndex === 'disabledFlag'">
<a-tag :color="text ? 'processing' : 'error'">{{ text ? '启用' : '禁用' }}</a-tag>
<a-switch
@change="(checked: boolean) => handleChangeDisabled(checked, record)"
:checked="record.disabledFlag"
checked-children="启用"
un-checked-children="禁用"
/>
</template>
<template v-if="column.dataIndex === 'action'">
<div class="smart-table-operate">
<a-button @click="showForm(record)" type="link" v-privilege="'customer:update'">
<template #icon>
<EditOutlined/>
</template>
<a-space>
<a-button @click="showForm(record)" type="primary" ghost style="width:60px;height: 32px"
v-privilege="'customer:update'">
编辑
</a-button>
<a-button @click="onDelete(record)" danger type="link" v-privilege="'customer:delete'">
<template #icon>
<DeleteOutlined/>
</template>
<a-button @click="onDelete(record)" type="primary" danger ghost style="width:60px;height: 32px"
v-privilege="'customer:delete'">
删除
</a-button>
</a-space>
</div>
</template>
</template>
@ -177,7 +182,8 @@ const columns = ref([
title: '操作',
dataIndex: 'action',
fixed: 'right',
width: 140,
align: 'center',
width: 150,
},
]);
@ -233,8 +239,36 @@ async function queryData() {
}
}
// ----------------------- / ------------------------
function handleChangeDisabled(disabledFlag: boolean, record: object) {
const content = disabledFlag ? '"启用"' + record.customerName : '"禁用"' + record.customerName + ",确认是否继续?";
Modal.confirm({
title: '提示',
content: '此操作将' + content,
okText: '确认',
okType: 'danger',
onOk() {
requestChangeDisabled(disabledFlag, record);
},
cancelText: '取消',
onCancel() {
},
});
}
onMounted(queryData);
async function requestChangeDisabled(disabledFlag: boolean, record: object) {
SmartLoading.show();
try {
record.disabledFlag = disabledFlag;
await customerApi.update(record);
message.success('操作成功');
onSearch();
} catch (e) {
smartSentry.captureError(e);
} finally {
SmartLoading.hide();
}
}
// ---------------------------- / ----------------------------
const formRef = ref();
@ -305,11 +339,13 @@ async function requestBatchDelete() {
SmartLoading.show();
await customerApi.batchDelete(selectedRowKeyList.value);
message.success('删除成功');
queryData();
await queryData();
} catch (e) {
smartSentry.captureError(e);
} finally {
SmartLoading.hide();
}
}
onMounted(queryData);
</script>

View File

@ -87,7 +87,12 @@
<template #bodyCell="{ text, record, column }">
<template v-if="column.dataIndex === 'disabledFlag'">
<a-tag :color="text ? 'processing' : 'error'">{{ text ? '启用' : '禁用' }}</a-tag>
<a-switch
@change="(checked: boolean) => handleChangeDisabled(checked, record)"
:checked="record.disabledFlag"
checked-children="启用"
un-checked-children="禁用"
/>
</template>
<template v-if="column.dataIndex === 'unit'">
@ -100,18 +105,16 @@
<template v-if="column.dataIndex === 'action'">
<div class="smart-table-operate">
<a-button @click="showForm(record)" type="link" v-privilege="'item:update'">
<template #icon>
<EditOutlined/>
</template>
<a-space>
<a-button @click="showForm(record)" type="primary" ghost style="width:60px;height: 32px"
v-privilege="'item:update'">
编辑
</a-button>
<a-button @click="onDelete(record)" danger type="link" v-privilege="'item:delete'">
<template #icon>
<DeleteOutlined/>
</template>
<a-button @click="onDelete(record)" type="primary" danger ghost style="width:60px;height: 32px"
v-privilege="'item:delete'">
删除
</a-button>
</a-space>
</div>
</template>
</template>
@ -232,7 +235,8 @@ const columns = ref([
title: '操作',
dataIndex: 'action',
fixed: 'right',
width: 140,
align: 'center',
width: 150,
},
]);
@ -288,8 +292,36 @@ async function queryData() {
}
}
// ----------------------- / ------------------------
function handleChangeDisabled(disabledFlag: boolean, record: object) {
const content = disabledFlag ? '"启用"' + record.itemCode : '"禁用"' + record.itemCode + ",确认是否继续?";
Modal.confirm({
title: '提示',
content: '此操作将' + content,
okText: '确认',
okType: 'danger',
onOk() {
requestChangeDisabled(disabledFlag, record);
},
cancelText: '取消',
onCancel() {
},
});
}
onMounted(queryData);
async function requestChangeDisabled(disabledFlag: boolean, record: object) {
SmartLoading.show();
try {
record.disabledFlag = disabledFlag;
await itemApi.update(record);
message.success('操作成功');
onSearch();
} catch (e) {
smartSentry.captureError(e);
} finally {
SmartLoading.hide();
}
}
// ---------------------------- / ----------------------------
const formRef = ref();
@ -435,4 +467,6 @@ async function onImportItems() {
function onExportItems() {
itemApi.exportItems();
}
onMounted(queryData);
</script>

View File

@ -122,7 +122,12 @@
</template> -->
<template v-if="column.dataIndex === 'disabledFlag'">
<a-tag :color="text ? 'processing' : 'error'">{{ text ? '启用' : '禁用' }}</a-tag>
<a-switch
@change="(checked: boolean) => handleChangeDisabled(checked, record)"
:checked="record.disabledFlag"
checked-children="启用"
un-checked-children="禁用"
/>
</template>
<template v-if="column.dataIndex === 'status'">
@ -137,18 +142,16 @@
<template v-if="column.dataIndex === 'action'">
<div class="smart-table-operate">
<a-button @click="showForm(record)" type="link" v-privilege="'location:update'">
<template #icon>
<EditOutlined/>
</template>
<a-space>
<a-button @click="showForm(record)" type="primary" ghost style="width:60px;height: 32px"
v-privilege="'location:update'">
编辑
</a-button>
<a-button @click="onDelete(record)" danger type="link" v-privilege="'location:delete'">
<template #icon>
<DeleteOutlined/>
</template>
<a-button @click="onDelete(record)" type="primary" danger ghost style="width:60px;height: 32px"
v-privilege="'location:delete'">
删除
</a-button>
</a-space>
</div>
</template>
</template>
@ -289,7 +292,8 @@ const columns = ref([
title: '操作',
dataIndex: 'action',
fixed: 'right',
width: 140,
align: 'center',
width: 150,
},
]);
@ -357,8 +361,37 @@ async function queryData() {
}
}
// ----------------------- / ------------------------
function handleChangeDisabled(disabledFlag: boolean, record: object) {
const content = disabledFlag ? '"启用"' + record.locationCode : '"禁用"' + record.locationCode + ",确认是否继续?";
Modal.confirm({
title: '提示',
content: '此操作将' + content,
okText: '确认',
okType: 'danger',
onOk() {
requestChangeDisabled(disabledFlag, record);
},
cancelText: '取消',
onCancel() {
},
});
}
async function requestChangeDisabled(disabledFlag: boolean, record: object) {
SmartLoading.show();
try {
record.disabledFlag = disabledFlag;
await locationApi.update(record);
message.success('操作成功');
onSearch();
} catch (e) {
smartSentry.captureError(e);
} finally {
SmartLoading.hide();
}
}
onMounted(queryData);
// ---------------------------- / ----------------------------
const formRef = ref();
@ -519,6 +552,7 @@ function onExportLocations() {
locationApi.exportLocations();
}
onMounted(queryData);
</script>
<style scoped>

View File

@ -93,7 +93,7 @@
<template #bodyCell="{ text, record, column }">
<template v-if="column.dataIndex === 'stockType'">
<DictLabel :dict-code="'STOCK_TYPE'" :data-value="text" />
<DictLabel :dict-code="'STOCK_TYPE'" :data-value="text"/>
</template>
<template v-if="column.dataIndex === 'status'">
@ -103,23 +103,26 @@
</template>
<template v-if="column.dataIndex === 'disabledFlag'">
<a-tag :color="text ? 'processing' : 'error'">{{ text ? '启用' : '禁用' }}</a-tag>
<a-switch
@change="(checked: boolean) => handleChangeDisabled(checked, record)"
:checked="record.disabledFlag"
checked-children="启用"
un-checked-children="禁用"
/>
</template>
<template v-if="column.dataIndex === 'action'">
<div class="smart-table-operate">
<a-button @click="showForm(record)" type="link" v-privilege="'stock:update'">
<template #icon>
<EditOutlined/>
</template>
<a-space>
<a-button @click="showForm(record)" type="primary" ghost style="width:60px;height: 32px"
v-privilege="'stock:update'">
编辑
</a-button>
<a-button @click="onDelete(record)" danger type="link" v-privilege="'stock:delete'">
<template #icon>
<DeleteOutlined/>
</template>
<a-button @click="onDelete(record)" type="primary" danger ghost style="width:60px;height: 32px"
v-privilege="'stock:delete'">
删除
</a-button>
</a-space>
</div>
</template>
</template>
@ -238,7 +241,8 @@ const columns = ref([
title: '操作',
dataIndex: 'action',
fixed: 'right',
width: 140,
align: 'center',
width: 150,
},
]);
@ -303,8 +307,36 @@ async function queryData() {
}
}
// ----------------------- / ------------------------
function handleChangeDisabled(disabledFlag: boolean, record: object) {
const content = disabledFlag ? '"启用"' + record.stockCode : '"禁用"' + record.stockCode + ",确认是否继续?";
Modal.confirm({
title: '提示',
content: '此操作将' + content,
okText: '确认',
okType: 'danger',
onOk() {
requestChangeDisabled(disabledFlag, record);
},
cancelText: '取消',
onCancel() {
},
});
}
onMounted(queryData);
async function requestChangeDisabled(disabledFlag: boolean, record: object) {
SmartLoading.show();
try {
record.disabledFlag = disabledFlag;
await stockApi.update(record);
message.success('操作成功');
onSearch();
} catch (e) {
smartSentry.captureError(e);
} finally {
SmartLoading.hide();
}
}
// ---------------------------- / ----------------------------
const formRef = ref();
@ -450,4 +482,6 @@ async function onImportStocks() {
function onExportStocks() {
stockApi.exportStocks();
}
onMounted(queryData);
</script>

View File

@ -0,0 +1,28 @@
<template>
<a-space>
<icon-font :type="type" />
</a-space>
</template>
<script lang="ts" setup>
import { defineProps } from 'vue';
import { createFromIconfontCN } from '@ant-design/icons-vue';
const props = defineProps({
type: {
type: String,
required: true
},
scriptUrl: {
type: String,
default: '//at.alicdn.com/t/c/font_4892234_j6gzjo4uhqa.js'
}
});
const IconFont = createFromIconfontCN({
scriptUrl: props.scriptUrl
});
</script>
<style scoped>
</style>

View File

@ -54,13 +54,11 @@
</a-modal>
</template>
<script setup>
<script setup lang="ts">
import { reactive, ref } from 'vue';
import { message, Modal } from 'ant-design-vue';
import { PAGE_SIZE, PAGE_SIZE_OPTIONS } from '/@/constants/common-const';
import { smartSentry } from '/src/lib/smart-sentry';
import { SmartLoading } from '/src/components/framework/smart-loading';
import SmartEnumSelect from '/src/components/framework/smart-enum-select/index.vue';
import {SmartLoading} from '/@/components/framework/smart-loading';
import {smartSentry} from '/@/lib/smart-sentry';
import { employeeApi } from '/@/api/system/employee-api';
// -------------------------------
const queryParamState = {

View File

@ -24,15 +24,15 @@
</a-modal>
<MessageReceiverModal ref="receiverModalRef" @reloadList="addReceiverIdList" />
</template>
<script setup>
<script setup lang="ts">
import { nextTick, reactive, ref } from 'vue';
import { message } from 'ant-design-vue';
import { SmartLoading } from '/src/components/framework/smart-loading';
import { smartSentry } from '/src/lib/smart-sentry';
import SmartEnumSelect from '/src/components/framework/smart-enum-select/index.vue';
import MessageReceiverModal from './message-receiver-modal.vue';
import { USER_TYPE_ENUM } from '/src/constants/common-const.js';
import { messageApi } from '/@/api/support/message-api.js';
import {SmartLoading} from '/@/components/framework/smart-loading';
import {smartSentry} from '/@/lib/smart-sentry';
import SmartEnumSelect from "/@/components/framework/smart-enum-select/index.vue";
import MessageReceiverModal from '/@/views/support/message/components/message-receiver-modal.vue';
import { USER_TYPE_ENUM } from '/@/constants/common-const';
import { messageApi } from '/@/api/support/message-api';
// ------------------------ ------------------------
const emits = defineEmits(['reloadList']);