|
@@ -1,173 +1,48 @@
|
|
|
<template>
|
|
|
- <!--定义表格-->
|
|
|
- <BasicTable @register="registerTable" :rowSelection="rowSelection">
|
|
|
- <template #tableTitle>
|
|
|
- <a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleCreate" v-auth="'baseCode:base_product_class:add'">
|
|
|
- 新增(add)</a-button
|
|
|
- >
|
|
|
- <a-dropdown v-if="selectedRowKeys.length > 0">
|
|
|
- <template #overlay>
|
|
|
- <a-menu>
|
|
|
- <a-menu-item key="1" @click="batchHandleDelete">
|
|
|
- <Icon icon="ant-design:delete-outlined" />
|
|
|
- 删除(delete)
|
|
|
- </a-menu-item>
|
|
|
- </a-menu>
|
|
|
- </template>
|
|
|
- <a-button v-auth="'baseCode:base_product_class:deleteBatch'"
|
|
|
- >批量操作
|
|
|
- <Icon icon="mdi:chevron-down" />
|
|
|
- </a-button>
|
|
|
- </a-dropdown>
|
|
|
- <!-- <div style="margin-left: 10px;margin-top: 5px">当前登录租户: <span class="tenant-name">{{loginTenantName}}</span> </div> -->
|
|
|
- </template>
|
|
|
- <!--操作栏-->
|
|
|
- <template #action="{ record }">
|
|
|
- <TableAction :actions="getTableAction(record)" />
|
|
|
- </template>
|
|
|
- </BasicTable>
|
|
|
- <productCassificationModel @register="registerModal" @success="handleSuccess" />
|
|
|
+ <a-row :class="['p-4', `${prefixCls}--box`]" :gutter="10">
|
|
|
+ <a-col :xl="6" :lg="8" :md="10" :sm="24" style="flex: 1">
|
|
|
+ <a-card :bordered="false" style="height: 100%">
|
|
|
+ <a-tabs defaultActiveKey="user-info">
|
|
|
+ <a-tab-pane tab="产品分类(Product Classification)" key="base-info" forceRender>
|
|
|
+ <productCassificationTree @select="selectId" ref="treeListRef"/>
|
|
|
+ </a-tab-pane>
|
|
|
+ </a-tabs>
|
|
|
+ </a-card>
|
|
|
+ </a-col>
|
|
|
+ <a-col :xl="18" :lg="16" :md="14" :sm="24" style="flex: 1">
|
|
|
+ <a-card :bordered="false" style="height: 100%">
|
|
|
+ <a-tabs defaultActiveKey="user-info">
|
|
|
+ <a-tab-pane tab="分类列表(Classification List)" key="base-info" forceRender>
|
|
|
+ <productCassification2 ref="classListRef" @success="addListSuccess"/>
|
|
|
+ </a-tab-pane>
|
|
|
+ </a-tabs>
|
|
|
+ </a-card>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
</template>
|
|
|
|
|
|
-<script lang="ts" name="basic-table-demo" setup>
|
|
|
- import { onMounted, ref } from 'vue';
|
|
|
- import { useModal } from '/@/components/Modal';
|
|
|
- import { ActionItem, BasicColumn, BasicTable, TableAction, FormSchema } from '/@/components/Table';
|
|
|
- import productCassificationModel from './components/productCassificationModel.vue';
|
|
|
- import { useListPage } from '/@/hooks/system/useListPage';
|
|
|
- import { list, deleteDict, batchDelete } from './api/productCassification.api';
|
|
|
- const showFooter = ref(true);
|
|
|
- const [registerModal, { openModal }] = useModal();
|
|
|
- //定义表格列字段
|
|
|
- const columns: BasicColumn[] = [
|
|
|
- {
|
|
|
- title: '编码(code)',
|
|
|
- dataIndex: 'code',
|
|
|
- key: 'code',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '名称(name)',
|
|
|
- dataIndex: 'name',
|
|
|
- key: 'name',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '上级分类(parent)',
|
|
|
- dataIndex: 'parentId_dictText',
|
|
|
- key: 'parentId',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '毛利率(gross margin)',
|
|
|
- dataIndex: 'grossMargin',
|
|
|
- key: 'grossMargin',
|
|
|
- customRender: function (t, r, index) {
|
|
|
- if (t.text && t.text !== '') {
|
|
|
- return t.text + '%';
|
|
|
- } else {
|
|
|
- return '';
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- title: '税率(tax rate)',
|
|
|
- dataIndex: 'taxRate',
|
|
|
- key: 'taxRate',
|
|
|
- customRender: function (t, r, index) {
|
|
|
- if (t.text && t.text !== '') {
|
|
|
- return t.text + '%';
|
|
|
- } else {
|
|
|
- return '';
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- ];
|
|
|
- //表单搜索字段
|
|
|
- const searchFormSchema: FormSchema[] = [
|
|
|
- {
|
|
|
- label: '编码(code)', //显示label
|
|
|
- field: 'code', //查询字段
|
|
|
- component: 'JInput', //渲染的组件
|
|
|
- defaultValue: '', //设置默认值
|
|
|
- },
|
|
|
- {
|
|
|
- label: '名称(name)', //显示label
|
|
|
- field: 'name', //查询字段
|
|
|
- component: 'JInput', //渲染的组件
|
|
|
- defaultValue: '', //设置默认值、
|
|
|
- componentProps: {
|
|
|
- AutoComplete: 'off',
|
|
|
- },
|
|
|
- },
|
|
|
- ];
|
|
|
- /** useListPage 是整个框架的核心用于表格渲染,里边封装了很多公共方法;
|
|
|
- * 平台通过此封装,简化了代码,支持自定义扩展*/
|
|
|
- // 通过hook useListPage渲染表格(设置dataSource、columns、actionColumn等参数)
|
|
|
- const { tableContext } = useListPage({
|
|
|
- designScope: 'basic-table-demo',
|
|
|
- tableProps: {
|
|
|
- title: '',
|
|
|
- api: list,
|
|
|
- columns: columns,
|
|
|
- size: 'small',
|
|
|
- rowkey: 'id',
|
|
|
- actionColumn: {
|
|
|
- width: 120,
|
|
|
- },
|
|
|
- formConfig: {
|
|
|
- schemas: searchFormSchema,
|
|
|
- },
|
|
|
- },
|
|
|
- });
|
|
|
- const [registerTable, { reload, updateTableDataRecord }, { rowSelection, selectedRows, selectedRowKeys }] = tableContext;
|
|
|
- /**
|
|
|
- * 操作栏
|
|
|
- */
|
|
|
- function getTableAction(record): ActionItem[] {
|
|
|
- return [
|
|
|
- {
|
|
|
- label: '编辑',
|
|
|
- onClick: handleEdit.bind(null, record),
|
|
|
- auth: 'baseCode:base_product_class:edit',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '删除',
|
|
|
- popConfirm: {
|
|
|
- title: '确定删除吗?',
|
|
|
- confirm: handleDelete.bind(null, record),
|
|
|
- },
|
|
|
- auth: 'baseCode:base_product_class:delete',
|
|
|
- },
|
|
|
- ];
|
|
|
- }
|
|
|
+<script lang="ts" setup name="system-depart-user">
|
|
|
+ import { provide, ref } from 'vue';
|
|
|
+ import { useDesign } from '/@/hooks/web/useDesign';
|
|
|
|
|
|
- function handleEdit(record) {
|
|
|
- openModal(true, {
|
|
|
- record,
|
|
|
- isUpdate: true,
|
|
|
- });
|
|
|
- }
|
|
|
+ import productCassificationTree from './productCassificationTree.vue';
|
|
|
+ import productCassification2 from './productCassification1.vue';
|
|
|
+ // import DepartUserInfoTab from './components/DepartUserInfoTab.vue';
|
|
|
+ // import DepartRoleInfoTab from './components/DepartRoleInfoTab.vue';
|
|
|
|
|
|
- async function handleDelete(record) {
|
|
|
- await deleteDict({ id: record.id }, reload);
|
|
|
- }
|
|
|
- function handleCreate() {
|
|
|
- openModal(true, {
|
|
|
- isUpdate: false,
|
|
|
- });
|
|
|
+ const { prefixCls } = useDesign('depart-user');
|
|
|
+ provide('prefixCls', prefixCls);
|
|
|
+ const classListRef = ref();
|
|
|
+ const treeListRef = ref();
|
|
|
+ // 左侧树选择后触发
|
|
|
+ async function selectId(data) {
|
|
|
+ await classListRef.value.getAppointRow(data)
|
|
|
}
|
|
|
- /**
|
|
|
- * 成功回调
|
|
|
- */
|
|
|
- function handleSuccess({ isUpdate, values }) {
|
|
|
- if (isUpdate) {
|
|
|
- updateTableDataRecord(values.id, values);
|
|
|
- } else {
|
|
|
- reload();
|
|
|
- }
|
|
|
- }
|
|
|
- /**
|
|
|
- * 批量删除事件
|
|
|
- */
|
|
|
- async function batchHandleDelete() {
|
|
|
- await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
|
|
+ function addListSuccess(){
|
|
|
+ treeListRef.value.loadDepartTreeData()
|
|
|
}
|
|
|
</script>
|
|
|
+
|
|
|
+<style lang="less">
|
|
|
+ // @import './index.less';
|
|
|
+</style>
|