mirror of
https://github.com/1024-lab/smart-admin.git
synced 2026-06-27 08:04:24 +00:00
v3.9.0【优化】typescript版本;【优化】App端消息;【优化】弹出层z-index;
This commit is contained in:
+246
@@ -0,0 +1,246 @@
|
||||
<!--
|
||||
* 企业 银行列表
|
||||
*
|
||||
* @Author: 1024创新实验室-主任:卓大
|
||||
* @Date: 2022-08-15 20:15:49
|
||||
* @Wechat: zhuda1024
|
||||
* @Email: lab1024@163.com
|
||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||
-->
|
||||
<template>
|
||||
<a-form class="smart-query-form">
|
||||
<a-row class="smart-query-form-row">
|
||||
<a-form-item label="关键字" class="smart-query-form-item">
|
||||
<a-input style="width: 300px" v-model:value="queryForm.keywords" placeholder="开户银行/账户名称/账户/创建人" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="创建时间" class="smart-query-form-item">
|
||||
<a-space direction="vertical" :size="12">
|
||||
<a-range-picker v-model:value="searchDate" @change="dateChange" />
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item class="smart-query-form-item smart-margin-left10">
|
||||
<a-button-group>
|
||||
<a-button type="primary" @click="onSearch">
|
||||
<template #icon>
|
||||
<SearchOutlined />
|
||||
</template>
|
||||
查询
|
||||
</a-button>
|
||||
<a-button @click="resetQuery">
|
||||
<template #icon>
|
||||
<ReloadOutlined />
|
||||
</template>
|
||||
重置
|
||||
</a-button>
|
||||
</a-button-group>
|
||||
|
||||
<a-button @click="addOrUpdate()" type="primary" class="smart-margin-left20">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
新建账户
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
</a-row>
|
||||
</a-form>
|
||||
|
||||
<a-card size="small" :bordered="false" :hoverable="false">
|
||||
<a-row justify="end">
|
||||
<TableOperator class="smart-margin-bottom5" v-model="columns" :tableId="TABLE_ID_CONST.BUSINESS.OA.ENTERPRISE_BANK" :refresh="ajaxQuery" />
|
||||
</a-row>
|
||||
<a-table :scroll="{ x: 1300 }" size="small" :dataSource="tableData" bordered :columns="columns" rowKey="bankId" :pagination="false">
|
||||
<template #bodyCell="{ record, column }">
|
||||
<template v-if="column.dataIndex === 'disabledFlag'">
|
||||
{{ record.disabledFlag ? '禁用' : '启用' }}
|
||||
</template>
|
||||
<template v-else-if="column.dataIndex === 'businessFlag'">
|
||||
{{ record.businessFlag ? '是' : '否' }}
|
||||
</template>
|
||||
<template v-else-if="column.dataIndex === 'action'">
|
||||
<div class="smart-table-operate">
|
||||
<a-button @click="addOrUpdate(record)" type="link">编辑</a-button>
|
||||
<a-button @click="confirmDelete(record.bankId)" danger type="link">删除</a-button>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
<div class="smart-query-table-page">
|
||||
<a-pagination
|
||||
showSizeChanger
|
||||
showQuickJumper
|
||||
show-less-items
|
||||
:pageSizeOptions="PAGE_SIZE_OPTIONS"
|
||||
:defaultPageSize="queryForm.pageSize"
|
||||
v-model:current="queryForm.pageNum"
|
||||
v-model:pageSize="queryForm.pageSize"
|
||||
:total="total"
|
||||
@change="ajaxQuery"
|
||||
@showSizeChange="ajaxQuery"
|
||||
:show-total="(total) => `共${total}条`"
|
||||
/>
|
||||
</div>
|
||||
<!--新建编辑modal-->
|
||||
<BankOperateModal ref="operateModal" :enterpriseId="enterpriseId" @reloadList="ajaxQuery" />
|
||||
</a-card>
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import { bankApi } from '/@/api/business/oa/bank-api';
|
||||
import { PAGE_SIZE, PAGE_SIZE_OPTIONS } from '/@/constants/common-const';
|
||||
import BankOperateModal from './enterprise-bank-operate-modal.vue';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { smartSentry } from '/@/lib/smart-sentry';
|
||||
import TableOperator from '/@/components/support/table-operator/index.vue';
|
||||
import { TABLE_ID_CONST } from '/@/constants/support/table-id-const';
|
||||
|
||||
const props = defineProps({
|
||||
enterpriseId: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
title: '开户银行',
|
||||
dataIndex: 'bankName',
|
||||
},
|
||||
{
|
||||
title: '账户名称',
|
||||
dataIndex: 'accountName',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '账号',
|
||||
width: 100,
|
||||
dataIndex: 'accountNumber',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '是否对公',
|
||||
width: 120,
|
||||
dataIndex: 'businessFlag',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
width: 80,
|
||||
dataIndex: 'disabledFlag',
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
width: 100,
|
||||
dataIndex: 'remark',
|
||||
},
|
||||
{
|
||||
title: '创建人',
|
||||
width: 100,
|
||||
dataIndex: 'createUserName',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
fixed: 'right',
|
||||
width: 100,
|
||||
},
|
||||
]);
|
||||
|
||||
const queryFormState = {
|
||||
enterpriseId: props.enterpriseId,
|
||||
keywords: '',
|
||||
endTime: null,
|
||||
startTime: null,
|
||||
pageNum: 1,
|
||||
pageSize: PAGE_SIZE,
|
||||
searchCount: true,
|
||||
};
|
||||
const queryForm = reactive({ ...queryFormState });
|
||||
const tableLoading = ref(false);
|
||||
const tableData = ref([]);
|
||||
const total = ref(0);
|
||||
const operateModal = ref();
|
||||
|
||||
// 日期选择
|
||||
let searchDate = ref();
|
||||
|
||||
function dateChange(dates, dateStrings) {
|
||||
queryForm.startTime = dateStrings[0];
|
||||
queryForm.endTime = dateStrings[1];
|
||||
}
|
||||
|
||||
function resetQuery() {
|
||||
searchDate.value = [];
|
||||
Object.assign(queryForm, queryFormState, { enterpriseId: props.enterpriseId });
|
||||
ajaxQuery();
|
||||
}
|
||||
|
||||
function onSearch() {
|
||||
queryForm.pageNum = 1;
|
||||
ajaxQuery();
|
||||
}
|
||||
|
||||
async function ajaxQuery() {
|
||||
try {
|
||||
tableLoading.value = true;
|
||||
let responseModel = await bankApi.pageQuery(queryForm);
|
||||
const list = responseModel.data.list;
|
||||
total.value = responseModel.data.total;
|
||||
tableData.value = list;
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
tableLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function confirmDelete(bankId) {
|
||||
Modal.confirm({
|
||||
title: '确定要删除吗?',
|
||||
content: '删除后,该信息将不可恢复',
|
||||
okText: '删除',
|
||||
okType: 'danger',
|
||||
onOk() {
|
||||
del(bankId);
|
||||
},
|
||||
cancelText: '取消',
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
async function del(bankId) {
|
||||
try {
|
||||
SmartLoading.show();
|
||||
await bankApi.delete(bankId);
|
||||
message.success('删除成功');
|
||||
ajaxQuery();
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
|
||||
function addOrUpdate(rowData) {
|
||||
operateModal.value.showModal(rowData);
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.enterpriseId,
|
||||
(value) => {
|
||||
if (value) {
|
||||
queryForm.enterpriseId = value;
|
||||
ajaxQuery();
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
</script>
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
<!--
|
||||
* 企业 银行 表单
|
||||
*
|
||||
* @Author: 1024创新实验室-主任:卓大
|
||||
* @Date: 2022-08-15 20:15:49
|
||||
* @Wechat: zhuda1024
|
||||
* @Email: lab1024@163.com
|
||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||
-->
|
||||
<template>
|
||||
<a-modal :open="visible" :title="form.bankId ? '编辑' : '添加'" ok-text="确认" cancel-text="取消" @ok="onSubmit" @cancel="onClose">
|
||||
<a-form ref="formRef" :model="form" :rules="rules" :label-col="{ span: 5 }" :wrapper-col="{ span: 18 }">
|
||||
<a-form-item label="开户银行" name="bankName">
|
||||
<a-input v-model:value="form.bankName" placeholder="请输入开户银行" />
|
||||
</a-form-item>
|
||||
<a-form-item label="账户名称" name="accountName">
|
||||
<a-input v-model:value="form.accountName" placeholder="请输入账户名称" />
|
||||
</a-form-item>
|
||||
<a-form-item label="账号" name="accountNumber">
|
||||
<a-input v-model:value="form.accountNumber" placeholder="请输入账号" />
|
||||
</a-form-item>
|
||||
<a-form-item label="是否对公" name="businessFlag">
|
||||
<a-switch v-model:checked="businessFlagChecked" @change="businessFlagCheckedChange" />
|
||||
</a-form-item>
|
||||
<a-form-item label="启用状态" name="disabledFlag">
|
||||
<a-switch v-model:checked="enabledChecked" @change="enabledCheckedChange" />
|
||||
</a-form-item>
|
||||
<a-form-item label="备注" name="remark">
|
||||
<a-textarea v-model:value="form.remark" :rows="2" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
import { bankApi } from '/@/api/business/oa/bank-api';
|
||||
import { smartSentry } from '/@/lib/smart-sentry';
|
||||
|
||||
const props = defineProps({
|
||||
enterpriseId: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
// emit
|
||||
const emit = defineEmits(['reloadList']);
|
||||
|
||||
// ---------------------- 显示、隐藏 ----------------------
|
||||
// 是否展示
|
||||
const visible = ref(false);
|
||||
function showModal(rowData) {
|
||||
Object.assign(form, formDefault);
|
||||
if (rowData) {
|
||||
Object.assign(form, rowData);
|
||||
businessFlagChecked.value = rowData.businessFlag;
|
||||
enabledChecked.value = !rowData.disabledFlag;
|
||||
}
|
||||
form.enterpriseId = props.enterpriseId;
|
||||
visible.value = true;
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
Object.assign(form, formDefault);
|
||||
formRef.value.resetFields();
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
// ---------------------- 表单 ----------------------
|
||||
|
||||
// 组件
|
||||
const formRef = ref();
|
||||
|
||||
const formDefault = {
|
||||
bankId: undefined,
|
||||
enterpriseId: undefined,
|
||||
bankName: '',
|
||||
accountName: '',
|
||||
accountNumber: '',
|
||||
businessFlag: false,
|
||||
disabledFlag: false,
|
||||
remark: '',
|
||||
};
|
||||
let form = reactive({ ...formDefault });
|
||||
const rules = {
|
||||
bankName: [{ required: true, message: '请输入开户银行' }],
|
||||
accountName: [{ required: true, message: '请输入账户名称' }],
|
||||
accountNumber: [{ required: true, message: '请输入账号' }],
|
||||
};
|
||||
|
||||
const businessFlagChecked = ref(false);
|
||||
const enabledChecked = ref(true);
|
||||
|
||||
function businessFlagCheckedChange(checked) {
|
||||
form.businessFlag = checked;
|
||||
}
|
||||
function enabledCheckedChange(checked) {
|
||||
form.disabledFlag = !checked;
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(async () => {
|
||||
SmartLoading.show();
|
||||
try {
|
||||
if (form.bankId) {
|
||||
await bankApi.update(form);
|
||||
} else {
|
||||
await bankApi.create(form);
|
||||
}
|
||||
message.success(`${form.bankId ? '修改' : '添加'}成功`);
|
||||
emit('reloadList');
|
||||
onClose();
|
||||
} catch (error) {
|
||||
smartSentry.captureError(error);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error', error);
|
||||
message.error('参数验证错误,请仔细填写表单数据!');
|
||||
});
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
showModal,
|
||||
});
|
||||
</script>
|
||||
+280
@@ -0,0 +1,280 @@
|
||||
<!--
|
||||
* 企业 员工
|
||||
*
|
||||
* @Author: 1024创新实验室-主任:卓大
|
||||
* @Date: 2022-08-15 20:15:49
|
||||
* @Wechat: zhuda1024
|
||||
* @Email: lab1024@163.com
|
||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<div class="header">
|
||||
<div>
|
||||
关键字:
|
||||
<a-input style="width: 250px" v-model:value="queryForm.keyword" placeholder="姓名/手机号/登录账号" />
|
||||
<a-button class="button-style" type="primary" @click="onSearch">搜索</a-button>
|
||||
<a-button class="button-style" type="default" @click="resetQueryEmployee">重置</a-button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a-button class="button-style" type="primary" @click="addEmployee" v-privilege="'oa:enterprise:addEmployee'"> 添加员工 </a-button>
|
||||
<a-button class="button-style" type="primary" danger @click="batchDelete" v-privilege="'oa:enterprise:deleteEmployee'"> 批量移除 </a-button>
|
||||
</div>
|
||||
</div>
|
||||
<a-table
|
||||
:loading="tableLoading"
|
||||
:dataSource="tableData"
|
||||
:columns="columns"
|
||||
:pagination="false"
|
||||
rowKey="employeeId"
|
||||
:row-selection="{ selectedRowKeys: selectedRowKeyList, onChange: onSelectChange }"
|
||||
size="small"
|
||||
bordered
|
||||
>
|
||||
<template #bodyCell="{ text, record, index, column }">
|
||||
<template v-if="column.dataIndex === 'disabledFlag'">
|
||||
<a-tag :color="text ? 'error' : 'processing'">{{ text ? '禁用' : '启用' }}</a-tag>
|
||||
</template>
|
||||
<template v-else-if="column.dataIndex === 'gender'">
|
||||
<span>{{ $smartEnumPlugin.getDescByValue('GENDER_ENUM', text) }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'operate'">
|
||||
<a @click="deleteEmployee(record.employeeId)" v-privilege="'oa:enterprise:deleteEmployee'">移除</a>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
<div class="smart-query-table-page">
|
||||
<a-pagination
|
||||
showSizeChanger
|
||||
showQuickJumper
|
||||
show-less-items
|
||||
:pageSizeOptions="PAGE_SIZE_OPTIONS"
|
||||
:defaultPageSize="queryForm.pageSize"
|
||||
v-model:current="queryForm.pageNum"
|
||||
v-model:pageSize="queryForm.pageSize"
|
||||
:total="total"
|
||||
@change="queryEmployee"
|
||||
@showSizeChange="queryEmployee"
|
||||
:show-total="showTableTotal"
|
||||
/>
|
||||
</div>
|
||||
<EmployeeTableSelectModal ref="selectEmployeeModal" @selectData="selectData" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import EmployeeTableSelectModal from '/@/components/system/employee-table-select-modal/index.vue';
|
||||
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import _ from 'lodash';
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import { enterpriseApi } from '/@/api/business/oa/enterprise-api';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
import { PAGE_SIZE, PAGE_SIZE_OPTIONS, showTableTotal } from '/@/constants/common-const';
|
||||
import { smartSentry } from '/@/lib/smart-sentry';
|
||||
|
||||
const props = defineProps({
|
||||
enterpriseId: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const columns = reactive([
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'actualName',
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
dataIndex: 'phone',
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
title: '登录账号',
|
||||
dataIndex: 'loginName',
|
||||
},
|
||||
{
|
||||
title: '企业',
|
||||
dataIndex: 'enterpriseName',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '部门',
|
||||
dataIndex: 'departmentName',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'disabledFlag',
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'operate',
|
||||
width: 60,
|
||||
},
|
||||
]);
|
||||
|
||||
// --------------------------- 查询 ---------------------------
|
||||
|
||||
const defaultQueryForm = {
|
||||
pageNum: 1,
|
||||
pageSize: PAGE_SIZE,
|
||||
enterpriseId: undefined,
|
||||
keyword: undefined,
|
||||
};
|
||||
// 查询表单
|
||||
const queryForm = reactive({ ...defaultQueryForm });
|
||||
const total = ref(0);
|
||||
const tableData = ref([]);
|
||||
const tableLoading = ref(false);
|
||||
|
||||
function resetQueryEmployee() {
|
||||
queryForm.keyword = '';
|
||||
queryEmployee();
|
||||
}
|
||||
|
||||
function onSearch() {
|
||||
queryForm.pageNum = 1;
|
||||
queryEmployee();
|
||||
}
|
||||
|
||||
async function queryEmployee() {
|
||||
try {
|
||||
tableLoading.value = true;
|
||||
queryForm.enterpriseId = props.enterpriseId;
|
||||
let res = await enterpriseApi.queryPageEmployeeList(queryForm);
|
||||
tableData.value = res.data.list;
|
||||
total.value = res.data.total;
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
tableLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function selectData(list) {
|
||||
if (_.isEmpty(list)) {
|
||||
message.warning('请选择员工');
|
||||
return;
|
||||
}
|
||||
SmartLoading.show();
|
||||
try {
|
||||
let params = {
|
||||
employeeIdList: list,
|
||||
enterpriseId: props.enterpriseId,
|
||||
};
|
||||
await enterpriseApi.addEmployee(params);
|
||||
message.success('添加成功');
|
||||
await queryEmployee();
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------- 添加员工 ---------------------------
|
||||
|
||||
// 添加员工
|
||||
const selectEmployeeModal = ref();
|
||||
async function addEmployee() {
|
||||
let res = await enterpriseApi.employeeList([props.enterpriseId]);
|
||||
let selectedIdList = res.data.map((e) => e.employeeId) || [];
|
||||
selectEmployeeModal.value.showModal(selectedIdList);
|
||||
}
|
||||
|
||||
// --------------------------- 删除 ---------------------------
|
||||
|
||||
// 删除员工方法
|
||||
async function deleteEmployee(employeeId) {
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除该企业下的员工么?',
|
||||
okText: '确定',
|
||||
okType: 'danger',
|
||||
async onOk() {
|
||||
SmartLoading.show();
|
||||
try {
|
||||
let param = {
|
||||
employeeIdList: [employeeId],
|
||||
enterpriseId: props.enterpriseId,
|
||||
};
|
||||
await enterpriseApi.deleteEmployee(param);
|
||||
message.success('移除成功');
|
||||
await queryEmployee();
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
},
|
||||
cancelText: '取消',
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
|
||||
// 批量删除
|
||||
const selectedRowKeyList = ref([]);
|
||||
const hasSelected = computed(() => selectedRowKeyList.value.length > 0);
|
||||
function onSelectChange(selectedRowKeys) {
|
||||
selectedRowKeyList.value = selectedRowKeys;
|
||||
}
|
||||
|
||||
// 批量移除
|
||||
function batchDelete() {
|
||||
if (!hasSelected.value) {
|
||||
message.warning('请选择要删除的员工');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除该企业下的员工么?',
|
||||
okText: '确定',
|
||||
okType: 'danger',
|
||||
async onOk() {
|
||||
SmartLoading.show();
|
||||
try {
|
||||
let params = {
|
||||
employeeIdList: selectedRowKeyList.value,
|
||||
enterpriseId: props.enterpriseId,
|
||||
};
|
||||
await enterpriseApi.deleteEmployee(params);
|
||||
message.success('移除成功');
|
||||
selectedRowKeyList.value = [];
|
||||
await queryEmployee();
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
},
|
||||
cancelText: '取消',
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.enterpriseId,
|
||||
(e) => {
|
||||
if (e) {
|
||||
queryEmployee();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.button-style {
|
||||
margin: 0 10px;
|
||||
}
|
||||
</style>
|
||||
+250
@@ -0,0 +1,250 @@
|
||||
<!--
|
||||
* 企业 发票信息
|
||||
*
|
||||
* @Author: 1024创新实验室-主任:卓大
|
||||
* @Date: 2022-08-15 20:15:49
|
||||
* @Wechat: zhuda1024
|
||||
* @Email: lab1024@163.com
|
||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||
-->
|
||||
<template>
|
||||
<a-form class="smart-query-form">
|
||||
<a-row class="smart-query-form-row">
|
||||
<a-form-item label="关键字" class="smart-query-form-item">
|
||||
<a-input style="width: 300px" v-model:value="queryForm.keywords" placeholder="开票抬头/银行账户/创建人" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="创建时间" class="smart-query-form-item">
|
||||
<a-space direction="vertical" :size="12">
|
||||
<a-range-picker v-model:value="searchDate" @change="dateChange" />
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item class="smart-query-form-item smart-margin-left10">
|
||||
<a-button-group>
|
||||
<a-button type="primary" @click="onSearch">
|
||||
<template #icon>
|
||||
<SearchOutlined />
|
||||
</template>
|
||||
查询
|
||||
</a-button>
|
||||
<a-button @click="resetQuery">
|
||||
<template #icon>
|
||||
<ReloadOutlined />
|
||||
</template>
|
||||
重置
|
||||
</a-button>
|
||||
</a-button-group>
|
||||
|
||||
<a-button @click="addOrUpdate()" type="primary" class="smart-margin-left20">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
新建发票
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
</a-row>
|
||||
</a-form>
|
||||
|
||||
<a-card size="small" :bordered="false" :hoverable="false">
|
||||
<a-row justify="end">
|
||||
<TableOperator class="smart-margin-bottom5" v-model="columns" :tableId="TABLE_ID_CONST.BUSINESS.OA.ENTERPRISE_INVOICE" :refresh="ajaxQuery" />
|
||||
</a-row>
|
||||
<a-table :scroll="{ x: 1300 }" size="small" :dataSource="tableData" :columns="columns" rowKey="invoiceId" :pagination="false" bordered>
|
||||
<template #bodyCell="{ text, record, index, column }">
|
||||
<template v-if="column.dataIndex === 'disabledFlag'">
|
||||
{{ record.disabledFlag ? '禁用' : '启用' }}
|
||||
</template>
|
||||
<template v-else-if="column.dataIndex === 'action'">
|
||||
<div class="smart-table-operate">
|
||||
<a-button @click="addOrUpdate(record)" type="link">编辑</a-button>
|
||||
<a-button @click="confirmDelete(record.invoiceId)" type="link" danger>删除</a-button>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
<div class="smart-query-table-page">
|
||||
<a-pagination
|
||||
showSizeChanger
|
||||
showQuickJumper
|
||||
show-less-items
|
||||
:pageSizeOptions="PAGE_SIZE_OPTIONS"
|
||||
:defaultPageSize="queryForm.pageSize"
|
||||
v-model:current="queryForm.pageNum"
|
||||
v-model:pageSize="queryForm.pageSize"
|
||||
:total="total"
|
||||
@change="ajaxQuery"
|
||||
@showSizeChange="ajaxQuery"
|
||||
:show-total="(total) => `共${total}条`"
|
||||
/>
|
||||
</div>
|
||||
<!--新建编辑modal-->
|
||||
<InvoiceOperateModal ref="operateModal" :enterpriseId="enterpriseId" @reloadList="ajaxQuery" />
|
||||
</a-card>
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import { invoiceApi } from '/@/api/business/oa/invoice-api';
|
||||
import { PAGE_SIZE, PAGE_SIZE_OPTIONS } from '/@/constants/common-const';
|
||||
import InvoiceOperateModal from './enterprise-invoice-operate-modal.vue';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { smartSentry } from '/@/lib/smart-sentry';
|
||||
import TableOperator from '/@/components/support/table-operator/index.vue';
|
||||
import { TABLE_ID_CONST } from '/@/constants/support/table-id-const';
|
||||
|
||||
const props = defineProps({
|
||||
enterpriseId: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
title: 'ID',
|
||||
width: 50,
|
||||
dataIndex: 'invoiceId',
|
||||
},
|
||||
{
|
||||
title: '开票抬头',
|
||||
dataIndex: 'invoiceHeads',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '纳税人识别号',
|
||||
dataIndex: 'taxpayerIdentificationNumber',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '银行账号',
|
||||
width: 100,
|
||||
dataIndex: 'accountNumber',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '开户行',
|
||||
width: 120,
|
||||
dataIndex: 'bankName',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
width: 80,
|
||||
dataIndex: 'disabledFlag',
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
width: 100,
|
||||
dataIndex: 'remark',
|
||||
},
|
||||
{
|
||||
title: '创建人',
|
||||
width: 100,
|
||||
dataIndex: 'createUserName',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
fixed: 'right',
|
||||
width: 100,
|
||||
},
|
||||
]);
|
||||
|
||||
const queryFormState = {
|
||||
enterpriseId: props.enterpriseId,
|
||||
keywords: '',
|
||||
endTime: null,
|
||||
startTime: null,
|
||||
pageNum: 1,
|
||||
pageSize: PAGE_SIZE,
|
||||
searchCount: true,
|
||||
};
|
||||
const queryForm = reactive({ ...queryFormState });
|
||||
const tableLoading = ref(false);
|
||||
const tableData = ref([]);
|
||||
const total = ref(0);
|
||||
const operateModal = ref();
|
||||
|
||||
// 日期选择
|
||||
let searchDate = ref();
|
||||
|
||||
function dateChange(dates, dateStrings) {
|
||||
queryForm.startTime = dateStrings[0];
|
||||
queryForm.endTime = dateStrings[1];
|
||||
}
|
||||
|
||||
function resetQuery() {
|
||||
searchDate.value = [];
|
||||
Object.assign(queryForm, queryFormState);
|
||||
ajaxQuery();
|
||||
}
|
||||
|
||||
function onSearch() {
|
||||
queryForm.pageNum = 1;
|
||||
ajaxQuery();
|
||||
}
|
||||
|
||||
async function ajaxQuery() {
|
||||
try {
|
||||
tableLoading.value = true;
|
||||
let responseModel = await invoiceApi.pageQuery(queryForm);
|
||||
const list = responseModel.data.list;
|
||||
total.value = responseModel.data.total;
|
||||
tableData.value = list;
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
tableLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function confirmDelete(invoiceId) {
|
||||
Modal.confirm({
|
||||
title: '确定要删除吗?',
|
||||
content: '删除后,该信息将不可恢复',
|
||||
okText: '删除',
|
||||
okType: 'danger',
|
||||
onOk() {
|
||||
del(invoiceId);
|
||||
},
|
||||
cancelText: '取消',
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
|
||||
async function del(invoiceId) {
|
||||
try {
|
||||
SmartLoading.show();
|
||||
await invoiceApi.delete(invoiceId);
|
||||
message.success('删除成功');
|
||||
ajaxQuery();
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
|
||||
function addOrUpdate(rowData) {
|
||||
operateModal.value.showModal(rowData);
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.enterpriseId,
|
||||
(value) => {
|
||||
if (value) {
|
||||
queryForm.enterpriseId = value;
|
||||
ajaxQuery();
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
</script>
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
<!--
|
||||
* 企业 发票 表单
|
||||
*
|
||||
* @Author: 1024创新实验室-主任:卓大
|
||||
* @Date: 2022-08-15 20:15:49
|
||||
* @Wechat: zhuda1024
|
||||
* @Email: lab1024@163.com
|
||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||
-->
|
||||
<template>
|
||||
<a-modal :open="visible" :title="form.invoiceId ? '编辑' : '添加'" ok-text="确认" cancel-text="取消" @ok="onSubmit" @cancel="onClose">
|
||||
<a-form ref="formRef" :model="form" :rules="rules" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
|
||||
<a-form-item label="开票抬头" name="invoiceHeads">
|
||||
<a-input v-model:value="form.invoiceHeads" placeholder="请输入开票抬头" />
|
||||
</a-form-item>
|
||||
<a-form-item label="纳税人识别号" name="taxpayerIdentificationNumber">
|
||||
<a-input v-model:value="form.taxpayerIdentificationNumber" placeholder="请输入纳税人识别号" />
|
||||
</a-form-item>
|
||||
<a-form-item label="银行账号" name="accountNumber">
|
||||
<a-input v-model:value="form.accountNumber" placeholder="请输入银行账号" />
|
||||
</a-form-item>
|
||||
<a-form-item label="开户行" name="bankName">
|
||||
<a-input v-model:value="form.bankName" placeholder="请输入开户行" />
|
||||
</a-form-item>
|
||||
<a-form-item label="启用状态" name="disabledFlag">
|
||||
<a-switch v-model:checked="enabledChecked" @change="enabledCheckedChange" />
|
||||
</a-form-item>
|
||||
<a-form-item label="备注" name="remark">
|
||||
<a-textarea v-model:value="form.remark" :rows="2" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
import { invoiceApi } from '/@/api/business/oa/invoice-api';
|
||||
import { smartSentry } from '/@/lib/smart-sentry';
|
||||
|
||||
const props = defineProps({
|
||||
enterpriseId: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
// emit
|
||||
const emit = defineEmits(['reloadList']);
|
||||
|
||||
// --------------------- modal 显示与隐藏 ---------------------
|
||||
// 是否展示
|
||||
const visible = ref(false);
|
||||
const enabledChecked = ref(true);
|
||||
|
||||
function enabledCheckedChange(checked) {
|
||||
form.disabledFlag = !checked;
|
||||
}
|
||||
|
||||
function showModal(rowData) {
|
||||
Object.assign(form, formDefault);
|
||||
if (rowData) {
|
||||
Object.assign(form, rowData);
|
||||
enabledChecked.value = !rowData.disabledFlag;
|
||||
}
|
||||
form.enterpriseId = props.enterpriseId;
|
||||
visible.value = true;
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
formRef.value.resetFields();
|
||||
Object.assign(form, formDefault);
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
// --------------------- 表单 ---------------------
|
||||
|
||||
// 组件
|
||||
const formRef = ref();
|
||||
|
||||
const formDefault = {
|
||||
invoiceId: undefined,
|
||||
enterpriseId: undefined,
|
||||
bankName: '',
|
||||
accountNumber: '',
|
||||
invoiceHeads: '',
|
||||
taxpayerIdentificationNumber: '',
|
||||
disabledFlag: false,
|
||||
remark: '',
|
||||
};
|
||||
let form = reactive({ ...formDefault });
|
||||
const rules = {
|
||||
invoiceHeads: [{ required: true, message: '请输入开票抬头' }],
|
||||
taxpayerIdentificationNumber: [{ required: true, message: '请输入纳税人识别号' }],
|
||||
accountNumber: [{ required: true, message: '请输入银行账号' }],
|
||||
bankName: [{ required: true, message: '请输入开户行' }],
|
||||
};
|
||||
|
||||
function onSubmit() {
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(async () => {
|
||||
SmartLoading.show();
|
||||
try {
|
||||
if (form.invoiceId) {
|
||||
await invoiceApi.update(form);
|
||||
} else {
|
||||
await invoiceApi.create(form);
|
||||
}
|
||||
message.success(`${form.invoiceId ? '修改' : '添加'}成功`);
|
||||
emit('reloadList');
|
||||
onClose();
|
||||
} catch (error) {
|
||||
smartSentry.captureError(error);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error', error);
|
||||
message.error('参数验证错误,请仔细填写表单数据!');
|
||||
});
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
showModal,
|
||||
});
|
||||
</script>
|
||||
+243
@@ -0,0 +1,243 @@
|
||||
<template>
|
||||
<a-modal :open="visible" title="添加" :width="700" forceRender ok-text="确认" cancel-text="取消" @ok="onSubmit" @cancel="onClose">
|
||||
<a-form ref="formRef" :model="form" :rules="rules" :label-col="{ span: 6 }">
|
||||
<a-form-item label="企业名称" name="enterpriseName">
|
||||
<a-input v-model:value="form.enterpriseName" placeholder="请输入企业名称" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="企业logo" name="enterpriseLogo">
|
||||
<Upload
|
||||
accept=".jpg,.jpeg,.png,.gif"
|
||||
:maxUploadSize="1"
|
||||
buttonText="点击上传企业logo"
|
||||
:default-file-list="form.enterpriseLogo"
|
||||
@change="enterpriseLogoChange"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="统一社会信用代码" name="unifiedSocialCreditCode">
|
||||
<a-input v-model:value="form.unifiedSocialCreditCode" placeholder="请输入统一社会信用代码" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="类型" name="type">
|
||||
<SmartEnumSelect width="100%" v-model:value="form.type" placeholder="请选择类型" enum-name="ENTERPRISE_TYPE_ENUM" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="联系人" name="contact">
|
||||
<a-input v-model:value="form.contact" placeholder="请输入联系人" />
|
||||
</a-form-item>
|
||||
<a-form-item label="联系人电话" name="contactPhone">
|
||||
<a-input v-model:value="form.contactPhone" placeholder="请输入联系人电话" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="所在城市" name="provinceCityDistrict">
|
||||
<AreaCascader type="province_city_district" style="width: 100%" v-model:value="area" placeholder="请选择所在城市" @change="changeArea" />
|
||||
</a-form-item>
|
||||
<a-form-item label="详细地址" name="address">
|
||||
<a-input v-model:value="form.address" placeholder="请输入详细地址" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="邮箱" name="email">
|
||||
<a-input v-model:value="form.email" placeholder="请输入邮箱" />
|
||||
</a-form-item>
|
||||
<a-form-item label="启用状态" name="disabledFlag">
|
||||
<a-switch v-model:checked="enabledChecked" @change="enabledCheckedChange" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="营业执照" name="businessLicense">
|
||||
<Upload
|
||||
accept=".jpg,.jpeg,.png,.gif"
|
||||
:maxUploadSize="1"
|
||||
buttonText="点击上传营业执照"
|
||||
:default-file-list="form.businessLicense"
|
||||
@change="businessLicenseChange"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { message } from 'ant-design-vue';
|
||||
import _ from 'lodash';
|
||||
import { nextTick, reactive, ref } from 'vue';
|
||||
import { enterpriseApi } from '/@/api/business/oa/enterprise-api';
|
||||
import AreaCascader from '/@/components/framework/area-cascader/index.vue';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
import Upload from '/@/components/support/file-upload/index.vue';
|
||||
import { regular } from '/@/constants/regular-const';
|
||||
import { smartSentry } from '/@/lib/smart-sentry';
|
||||
import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';
|
||||
|
||||
defineExpose({
|
||||
showModal,
|
||||
});
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// --------------------- modal 显示与隐藏 ---------------------
|
||||
// 是否展示
|
||||
const visible = ref(false);
|
||||
|
||||
function showModal(enterpriseId) {
|
||||
Object.assign(form, formDefault);
|
||||
area.value = [];
|
||||
if (enterpriseId) {
|
||||
detail(enterpriseId);
|
||||
}
|
||||
visible.value = true;
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
visible.value = false;
|
||||
}
|
||||
|
||||
async function detail(enterpriseId) {
|
||||
try {
|
||||
let result = await enterpriseApi.detail(enterpriseId);
|
||||
let data = result.data;
|
||||
Object.assign(form, data);
|
||||
nextTick(() => {
|
||||
// 省市区不存在,不需要赋值
|
||||
if (!data.provinceName) {
|
||||
return;
|
||||
}
|
||||
area.value = [
|
||||
{
|
||||
value: data.province,
|
||||
label: data.provinceName,
|
||||
},
|
||||
{
|
||||
value: data.city,
|
||||
label: data.cityName,
|
||||
},
|
||||
{
|
||||
value: data.district,
|
||||
label: data.districtName,
|
||||
},
|
||||
];
|
||||
});
|
||||
} catch (error) {
|
||||
smartSentry.captureError(error);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------- 表单 ---------------------
|
||||
|
||||
// 组件
|
||||
const formRef = ref();
|
||||
|
||||
const formDefault = {
|
||||
enterpriseId: undefined,
|
||||
enterpriseName: undefined,
|
||||
unifiedSocialCreditCode: undefined,
|
||||
businessLicense: undefined,
|
||||
contact: undefined,
|
||||
enterpriseLogo: undefined,
|
||||
contactPhone: undefined,
|
||||
email: undefined,
|
||||
province: undefined,
|
||||
provinceName: undefined,
|
||||
city: undefined,
|
||||
cityName: undefined,
|
||||
district: undefined,
|
||||
districtName: undefined,
|
||||
address: undefined,
|
||||
disabledFlag: false,
|
||||
};
|
||||
let form = reactive({ ...formDefault });
|
||||
const rules = {
|
||||
enterpriseName: [{ required: true, message: '请输入企业名称' }],
|
||||
unifiedSocialCreditCode: [{ required: true, message: '请输入统一社会信用代码' }],
|
||||
contact: [{ required: true, message: '请输入联系人' }],
|
||||
contactPhone: [
|
||||
{ required: true, message: '请输入联系人电话' },
|
||||
{ pattern: regular.phone, message: '请输入正确的联系人电话', trigger: 'blur' },
|
||||
],
|
||||
type: [{ required: true, message: '请选择类型' }],
|
||||
};
|
||||
|
||||
function onSubmit() {
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(async () => {
|
||||
SmartLoading.show();
|
||||
try {
|
||||
if (form.enterpriseId) {
|
||||
await enterpriseApi.update(form);
|
||||
} else {
|
||||
await enterpriseApi.create(form);
|
||||
}
|
||||
message.success(`${form.enterpriseId ? '修改' : '添加'}成功`);
|
||||
emit('refresh');
|
||||
onClose();
|
||||
} catch (error) {
|
||||
smartSentry.captureError(error);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error', error);
|
||||
message.error('参数验证错误,请仔细填写表单数据!');
|
||||
});
|
||||
}
|
||||
|
||||
// 状态
|
||||
const enabledChecked = ref(true);
|
||||
|
||||
function enabledCheckedChange(checked) {
|
||||
form.disabledFlag = !checked;
|
||||
}
|
||||
|
||||
// 地区
|
||||
const area = ref([]);
|
||||
|
||||
function changeArea(value, selectedOptions) {
|
||||
Object.assign(form, {
|
||||
province: '',
|
||||
provinceName: '',
|
||||
city: '',
|
||||
cityName: '',
|
||||
district: '',
|
||||
districtName: '',
|
||||
});
|
||||
if (!_.isEmpty(selectedOptions)) {
|
||||
// 地区信息
|
||||
form.province = area.value[0].value;
|
||||
form.provinceName = area.value[0].label;
|
||||
|
||||
form.city = area.value[1].value;
|
||||
form.cityName = area.value[1].label;
|
||||
if (area.value[2]) {
|
||||
form.district = area.value[2].value;
|
||||
form.districtName = area.value[2].label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function enterpriseLogoChange(fileList) {
|
||||
form.enterpriseLogo = fileList;
|
||||
}
|
||||
|
||||
function businessLicenseChange(fileList) {
|
||||
form.businessLicense = fileList;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.form-width {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.footer {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
:deep(.ant-card-body) {
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,130 @@
|
||||
<!--
|
||||
* 公司 详情
|
||||
*
|
||||
* @Author: 1024创新实验室-主任:卓大
|
||||
* @Date: 2022-08-15 20:15:49
|
||||
* @Wechat: zhuda1024
|
||||
* @Email: lab1024@163.com
|
||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||
-->
|
||||
<template>
|
||||
<div class="detail-header">
|
||||
<a-page-header :title="detail.enterpriseName" :avatar="{ src: logo }">
|
||||
<template #extra>
|
||||
<a-button @click="showUpdate" type="primary">编辑</a-button>
|
||||
</template>
|
||||
<div>
|
||||
<a-descriptions size="small" :column="3">
|
||||
<a-descriptions-item label="统一社会信用代码">{{ detail.unifiedSocialCreditCode }}</a-descriptions-item>
|
||||
<a-descriptions-item label="联系人">{{ detail.contact }}</a-descriptions-item>
|
||||
<a-descriptions-item label="联系人电话">{{ detail.contactPhone }}</a-descriptions-item>
|
||||
<a-descriptions-item label="邮箱">{{ detail.email }}</a-descriptions-item>
|
||||
<a-descriptions-item label="所在城市">{{ area }}</a-descriptions-item>
|
||||
<a-descriptions-item label="详细地址">{{ detail.address }}</a-descriptions-item>
|
||||
<a-descriptions-item label="创建时间">{{ detail.createTime }}</a-descriptions-item>
|
||||
<a-descriptions-item label="创建人">{{ detail.createUserName }}</a-descriptions-item>
|
||||
<a-descriptions-item label="营业执照">
|
||||
<FilePreview :file-list="detail.businessLicense" />
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</div>
|
||||
</a-page-header>
|
||||
</div>
|
||||
<a-card class="smart-margin-top10" size="small">
|
||||
<a-tabs>
|
||||
<a-tab-pane key="employee" tab="员工信息">
|
||||
<EmployeeList :enterpriseId="enterpriseId" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="bank" tab="银行信息">
|
||||
<BankList :enterpriseId="enterpriseId" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="invoice" tab="发票信息">
|
||||
<InvoiceList :enterpriseId="enterpriseId" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="dataTracer" tab="变更记录">
|
||||
<DataTracer :dataId="enterpriseId" :type="DATA_TRACER_TYPE_ENUM.OA_ENTERPRISE.value" />
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
<EnterpriseOperate ref="operateRef" @refresh="getDetail" />
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import _ from 'lodash';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import BankList from './components/enterprise-bank-list.vue';
|
||||
import EmployeeList from './components/enterprise-employee-list.vue';
|
||||
import InvoiceList from './components/enterprise-invoice-list.vue';
|
||||
import EnterpriseOperate from './components/enterprise-operate-modal.vue';
|
||||
import { enterpriseApi } from '/@/api/business/oa/enterprise-api';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
import DataTracer from '/@/components/support/data-tracer/index.vue';
|
||||
import FilePreview from '/@/components/support/file-preview/index.vue';
|
||||
import { DATA_TRACER_TYPE_ENUM } from '/@/constants/support/data-tracer-const';
|
||||
import { smartSentry } from '/@/lib/smart-sentry';
|
||||
|
||||
const route = useRoute();
|
||||
let enterpriseId = ref();
|
||||
onMounted(() => {
|
||||
if (route.query.enterpriseId) {
|
||||
enterpriseId.value = Number(route.query.enterpriseId);
|
||||
getDetail();
|
||||
}
|
||||
});
|
||||
|
||||
//编辑
|
||||
const operateRef = ref();
|
||||
function showUpdate() {
|
||||
operateRef.value.showModal(enterpriseId.value);
|
||||
}
|
||||
|
||||
// 详情
|
||||
let detail = ref({});
|
||||
|
||||
async function getDetail() {
|
||||
try {
|
||||
let result = await enterpriseApi.detail(enterpriseId.value);
|
||||
detail.value = result.data;
|
||||
} catch (error) {
|
||||
smartSentry.captureError(error);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
|
||||
// 地区
|
||||
const area = computed(() => {
|
||||
let area = '';
|
||||
if (!detail.value) {
|
||||
return area;
|
||||
}
|
||||
if (detail.value.provinceName) {
|
||||
area = area + detail.value.provinceName;
|
||||
}
|
||||
if (detail.value.cityName) {
|
||||
area = area + detail.value.cityName;
|
||||
}
|
||||
if (detail.value.districtName) {
|
||||
area = area + detail.value.districtName;
|
||||
}
|
||||
return area;
|
||||
});
|
||||
|
||||
const logo = computed(() => {
|
||||
if (!detail.value) {
|
||||
return '';
|
||||
}
|
||||
if (!_.isEmpty(detail.value.enterpriseLogo)) {
|
||||
return detail.value.enterpriseLogo[0].fileUrl;
|
||||
}
|
||||
return '';
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.detail-header {
|
||||
background-color: #fff;
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,283 @@
|
||||
<!--
|
||||
* 公司列表
|
||||
*
|
||||
* @Author: 1024创新实验室-主任:卓大
|
||||
* @Date: 2022-08-15 20:15:49
|
||||
* @Wechat: zhuda1024
|
||||
* @Email: lab1024@163.com
|
||||
* @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
|
||||
-->
|
||||
<template>
|
||||
<a-form class="smart-query-form" v-privilege="'oa:enterprise:query'">
|
||||
<a-row class="smart-query-form-row">
|
||||
<a-form-item label="关键字" class="smart-query-form-item">
|
||||
<a-input style="width: 300px" v-model:value="queryForm.keywords" placeholder="企业名称/联系人/联系电话" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="创建时间" class="smart-query-form-item">
|
||||
<a-space direction="vertical" :size="12">
|
||||
<a-range-picker v-model:value="searchDate" :presets="defaultTimeRanges" @change="dateChange" />
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item class="smart-query-form-item smart-margin-left10">
|
||||
<a-button-group>
|
||||
<a-button type="primary" @click="onSearch">
|
||||
<template #icon>
|
||||
<SearchOutlined />
|
||||
</template>
|
||||
查询
|
||||
</a-button>
|
||||
<a-button @click="resetQuery">
|
||||
<template #icon>
|
||||
<ReloadOutlined />
|
||||
</template>
|
||||
重置
|
||||
</a-button>
|
||||
</a-button-group>
|
||||
</a-form-item>
|
||||
</a-row>
|
||||
</a-form>
|
||||
|
||||
<a-card size="small" :bordered="false" :hoverable="true">
|
||||
<a-row class="smart-table-btn-block">
|
||||
<div class="smart-table-operate-block">
|
||||
<a-button @click="add()" v-privilege="'oa:enterprise:add'" type="primary">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
新建企业
|
||||
</a-button>
|
||||
<a-button @click="exportExcel()" v-privilege="'oa:enterprise:exportExcel'" type="primary">
|
||||
<template #icon>
|
||||
<FileExcelOutlined />
|
||||
</template>
|
||||
导出数据(带水印)
|
||||
</a-button>
|
||||
</div>
|
||||
<div class="smart-table-setting-block">
|
||||
<TableOperator v-model="columns" :tableId="TABLE_ID_CONST.BUSINESS.OA.ENTERPRISE" :refresh="ajaxQuery" />
|
||||
</div>
|
||||
</a-row>
|
||||
|
||||
<a-table
|
||||
:scroll="{ x: 1300 }"
|
||||
size="small"
|
||||
:dataSource="tableData"
|
||||
:columns="columns"
|
||||
rowKey="enterpriseId"
|
||||
:pagination="false"
|
||||
:loading="tableLoading"
|
||||
bordered
|
||||
>
|
||||
<template #bodyCell="{ column, record, text }">
|
||||
<template v-if="column.dataIndex === 'disabledFlag'">
|
||||
{{ text ? '禁用' : '启用' }}
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'enterpriseName'">
|
||||
<a @click="detail(record.enterpriseId)">{{ record.enterpriseName }}</a>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'type'">
|
||||
<span>{{ $smartEnumPlugin.getDescByValue('ENTERPRISE_TYPE_ENUM', text) }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<div class="smart-table-operate">
|
||||
<a-button @click="update(record.enterpriseId)" size="small" v-privilege="'oa:enterprise:update'" type="link">编辑</a-button>
|
||||
<a-button @click="confirmDelete(record.enterpriseId)" size="small" danger v-privilege="'oa:enterprise:delete'" type="link">删除</a-button>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
<div class="smart-query-table-page">
|
||||
<a-pagination
|
||||
showSizeChanger
|
||||
showQuickJumper
|
||||
show-less-items
|
||||
:pageSizeOptions="PAGE_SIZE_OPTIONS"
|
||||
:defaultPageSize="queryForm.pageSize"
|
||||
v-model:current="queryForm.pageNum"
|
||||
v-model:pageSize="queryForm.pageSize"
|
||||
:total="total"
|
||||
@change="ajaxQuery"
|
||||
@showSizeChange="ajaxQuery"
|
||||
:show-total="(total) => `共${total}条`"
|
||||
/>
|
||||
</div>
|
||||
<EnterpriseOperate ref="operateRef" @refresh="ajaxQuery" />
|
||||
</a-card>
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
import { enterpriseApi } from '/@/api/business/oa/enterprise-api';
|
||||
import { PAGE_SIZE, PAGE_SIZE_OPTIONS } from '/@/constants/common-const';
|
||||
import { useRouter } from 'vue-router';
|
||||
import EnterpriseOperate from './components/enterprise-operate-modal.vue';
|
||||
import { smartSentry } from '/@/lib/smart-sentry';
|
||||
import { defaultTimeRanges } from '/@/lib/default-time-ranges';
|
||||
import TableOperator from '/@/components/support/table-operator/index.vue';
|
||||
import { TABLE_ID_CONST } from '/@/constants/support/table-id-const';
|
||||
|
||||
// --------------------------- 企业表格 列 ---------------------------
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
title: '企业名称',
|
||||
dataIndex: 'enterpriseName',
|
||||
minWidth: 180,
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '统一社会信用代码',
|
||||
dataIndex: 'unifiedSocialCreditCode',
|
||||
minWidth: 170,
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '企业类型',
|
||||
dataIndex: 'type',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '联系人',
|
||||
width: 100,
|
||||
dataIndex: 'contact',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '联系人电话',
|
||||
width: 120,
|
||||
dataIndex: 'contactPhone',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '邮箱',
|
||||
minWidth: 100,
|
||||
dataIndex: 'email',
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
width: 50,
|
||||
dataIndex: 'disabledFlag',
|
||||
},
|
||||
{
|
||||
title: '创建人',
|
||||
width: 60,
|
||||
dataIndex: 'createUserName',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
// fixed: 'right',
|
||||
width: 100,
|
||||
},
|
||||
]);
|
||||
|
||||
// --------------------------- 查询 ---------------------------
|
||||
|
||||
const queryFormState = {
|
||||
keywords: '',
|
||||
endTime: null,
|
||||
startTime: null,
|
||||
pageNum: 1,
|
||||
pageSize: PAGE_SIZE,
|
||||
searchCount: true,
|
||||
};
|
||||
const queryForm = reactive({ ...queryFormState });
|
||||
const tableLoading = ref(false);
|
||||
const tableData = ref([]);
|
||||
const total = ref(0);
|
||||
|
||||
// 日期选择
|
||||
let searchDate = ref();
|
||||
|
||||
function dateChange(dates, dateStrings) {
|
||||
queryForm.startTime = dateStrings[0];
|
||||
queryForm.endTime = dateStrings[1];
|
||||
}
|
||||
|
||||
function onSearch() {
|
||||
queryForm.pageNum = 1;
|
||||
ajaxQuery();
|
||||
}
|
||||
|
||||
function resetQuery() {
|
||||
searchDate.value = [];
|
||||
Object.assign(queryForm, queryFormState);
|
||||
ajaxQuery();
|
||||
}
|
||||
|
||||
async function ajaxQuery() {
|
||||
try {
|
||||
tableLoading.value = true;
|
||||
let responseModel = await enterpriseApi.pageQuery(queryForm);
|
||||
const list = responseModel.data.list;
|
||||
total.value = responseModel.data.total;
|
||||
tableData.value = list;
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
tableLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------- 导出 ---------------------------
|
||||
async function exportExcel() {
|
||||
await enterpriseApi.exportExcel(queryForm);
|
||||
}
|
||||
|
||||
// --------------------------- 删除 ---------------------------
|
||||
|
||||
function confirmDelete(enterpriseId) {
|
||||
Modal.confirm({
|
||||
title: '确定要删除吗?',
|
||||
content: '删除后,该信息将不可恢复',
|
||||
okText: '删除',
|
||||
okType: 'danger',
|
||||
onOk() {
|
||||
del(enterpriseId);
|
||||
},
|
||||
cancelText: '取消',
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
|
||||
async function del(enterpriseId) {
|
||||
try {
|
||||
SmartLoading.show();
|
||||
await enterpriseApi.delete(enterpriseId);
|
||||
message.success('删除成功');
|
||||
ajaxQuery();
|
||||
} catch (e) {
|
||||
smartSentry.captureError(e);
|
||||
} finally {
|
||||
SmartLoading.hide();
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------- 增加、修改、详情 ---------------------------
|
||||
|
||||
let router = useRouter();
|
||||
const operateRef = ref();
|
||||
function add() {
|
||||
operateRef.value.showModal();
|
||||
}
|
||||
|
||||
function update(enterpriseId) {
|
||||
operateRef.value.showModal(enterpriseId);
|
||||
}
|
||||
|
||||
function detail(enterpriseId) {
|
||||
router.push({ path: '/oa/enterprise/enterprise-detail', query: { enterpriseId: enterpriseId } });
|
||||
}
|
||||
|
||||
onMounted(ajaxQuery);
|
||||
</script>
|
||||
Reference in New Issue
Block a user