123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449 |
- <template>
- <div class="pageIndexClass">
- <div class="content">
- <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row :action-list="[
- {
- text: '添加',
- action: () => openModal('add'),
- },
- ]" @get-list="getList">
- </byTable>
- </div>
- <el-dialog :title="modalType == 'add' ? '添加' : '编辑'" v-if="dialogVisible" v-model="dialogVisible" width="60%">
- <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit" v-loading="loadingDialog">
- </byForm>
- <template #footer>
- <el-button @click="dialogVisible = false" size="default">取 消</el-button>
- <el-button type="primary" @click="submitForm()" size="default">确 定</el-button>
- </template>
- </el-dialog>
- <el-dialog title="配置月发生额" v-if="openSetDialog" v-model="openSetDialog" width="90%">
- <byForm :formConfig="formShortConfig" :formOption="formOption" v-model="setFormData.data" :rules="setRules" ref="setFormDom">
- <template #list>
- <div style="width:100%">
- <el-button type="primary" plain @click="handleAdd" style="margin-bottom: 16px">
- 添加
- </el-button>
- <el-table :data="setFormData.data.logisticsAmountList">
- <el-table-column label="年份" width="130" fixed="left">
- <template #default="{ row, $index }">
- <el-form-item :prop="'logisticsAmountList.' + $index + '.year'" :rules="setRules.year" :inline-message="true" class="margin-b-0">
- <el-date-picker v-model="row.year" type="year" placeholder="请选择" style="width: 100%" value-format="YYYY" :clearable="false"
- :disabled-date="disabledFn" />
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column v-for="key in 12" :key="key" :label="key+'月'" width="120">
- <template #default="{ row, $index }">
- <el-form-item :prop="'logisticsAmountList.' + $index + ('.month'+key+'Amount')" :rules="setRules.amount" :inline-message="true"
- class="margin-b-0">
- <el-input-number onmousewheel="return false;" v-model="row['month'+key+'Amount']" placeholder="请输入" style="width: 100%"
- :precision="2" :controls="false" :min="0" />
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="操作" width="60" align="center" fixed="right">
- <template #default="{ $index }">
- <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="openSetDialog=false" size="default">取 消</el-button>
- <el-button type="primary" @click="submitSearch()" size="default">确 定</el-button>
- </template>
- </el-dialog>
- </div>
- </template>
- <script setup>
- import { computed, ref } from "vue";
- import byTable from "@/components/byTable/index";
- import byForm from "@/components/byForm/index";
- import useUserStore from "@/store/modules/user";
- import { ElMessage, ElMessageBox } from "element-plus";
- import moment from "moment";
- const { proxy } = getCurrentInstance();
- const accountCurrency = ref([]);
- const typeData = ref([
- {
- label: "收入",
- value: "10",
- },
- {
- label: "支出",
- value: "20",
- },
- ]);
- const sourceList = ref({
- data: [],
- pagination: {
- total: 0,
- pageNum: 1,
- pageSize: 10,
- keyword: "",
- },
- });
- const loading = ref(false);
- const config = computed(() => {
- return [
- {
- attrs: {
- label: "公司名称",
- prop: "name",
- },
- },
- {
- attrs: {
- label: "税点",
- prop: "taxPoints",
- },
- },
- {
- attrs: {
- label: "开户行",
- prop: "accountBank",
- },
- },
- {
- attrs: {
- label: "开户名",
- prop: "accountName",
- },
- },
- {
- attrs: {
- label: "账号",
- prop: "accountNumber",
- },
- },
- {
- attrs: {
- label: "操作",
- width: "200",
- align: "center",
- },
- renderHTML(row) {
- return [
- {
- attrs: {
- label: "修改",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- update(row);
- },
- },
- {
- attrs: {
- label: "配置月发生额",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- handleSet(row);
- },
- },
- {
- attrs: {
- label: "删除",
- type: "danger",
- text: true,
- },
- el: "button",
- click() {
- proxy
- .msgConfirm()
- .then((res) => {
- proxy
- .post("/logisticsCompanyInfo/delete", {
- id: row.id,
- })
- .then((res) => {
- proxy.msgTip("操作成功", 1);
- getList();
- });
- })
- .catch((err) => {});
- },
- },
- ];
- },
- },
- ];
- });
- const corporationList = ref([]);
- const getList = async (req) => {
- sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
- loading.value = true;
- proxy
- .post("/logisticsCompanyInfo/page", sourceList.value.pagination)
- .then((res) => {
- sourceList.value.data = res.rows;
- sourceList.value.pagination.total = res.total;
- setTimeout(() => {
- loading.value = false;
- }, 200);
- });
- };
- getList();
- const modalType = ref("add");
- const dialogVisible = ref(false);
- const loadingDialog = ref(false);
- const submit = ref(null);
- const formOption = reactive({
- inline: true,
- labelWidth: 100,
- itemWidth: 100,
- rules: [],
- });
- const formConfig = computed(() => {
- return [
- {
- type: "title1",
- title: "基本信息",
- },
- {
- type: "input",
- prop: "name",
- label: "公司名称",
- required: true,
- itemWidth: 50,
- itemType: "text",
- },
- {
- type: "number",
- prop: "taxPoints",
- label: "税点",
- precision: 2,
- min: 0,
- max: 100,
- controls: false,
- itemWidth: 50,
- },
- {
- type: "input",
- prop: "accountBank",
- label: "开户行",
- itemWidth: 50,
- itemType: "text",
- },
- {
- type: "input",
- prop: "accountName",
- label: "开户名",
- itemWidth: 50,
- itemType: "text",
- },
- {
- type: "input",
- prop: "accountNumber",
- label: "账号",
- itemWidth: 50,
- itemType: "text",
- },
- {
- type: "input",
- prop: "jdSubjectCode",
- label: "金蝶核算项目编号",
- },
- {
- type: "input",
- prop: "jdSubjectName",
- label: "金蝶核算项目名称",
- },
- ];
- });
- const rules = ref({
- name: [{ required: true, message: "请输入公司名称", trigger: "blur" }],
- taxPoints: [{ required: true, message: "请输入税点", trigger: "blur" }],
- accountBank: [{ required: true, message: "请输入开户行", trigger: "blur" }],
- accountName: [{ required: true, message: "请输入开户名", trigger: "blur" }],
- accountNumber: [{ required: true, message: "请输入账号", trigger: "blur" }],
- });
- const formData = reactive({
- data: {
- accountRemainderList: [{ currency: "", remainder: undefined }],
- },
- });
- const openModal = (val) => {
- modalType.value = val;
- formData.data = {
- accountRemainderList: [{ currency: "", remainder: undefined }],
- };
- loadingDialog.value = false;
- dialogVisible.value = true;
- };
- const clickBalance = () => {
- if (
- formData.data.accountRemainderList &&
- formData.data.accountRemainderList.length > 0
- ) {
- formData.data.accountRemainderList.push({
- currency: "",
- remainder: undefined,
- });
- } else {
- formData.data.accountRemainderList = [
- { currency: "", remainder: undefined },
- ];
- }
- };
- const isRepeat = (arr) => {
- var hash = {};
- for (var i in arr) {
- if (hash[arr[i].currency]) return true;
- hash[arr[i].currency] = true;
- }
- return false;
- };
- const submitForm = () => {
- submit.value.handleSubmit(() => {
- loadingDialog.value = true;
- proxy.post("/logisticsCompanyInfo/" + modalType.value, formData.data).then(
- () => {
- proxy.msgTip("操作成功", 1);
- dialogVisible.value = false;
- getList();
- },
- (err) => {
- console.log(err);
- loadingDialog.value = false;
- }
- );
- // if (
- // formData.data.accountRemainderList &&
- // formData.data.accountRemainderList.length > 0
- // ) {
- // if (isRepeat(formData.data.accountRemainderList)) {
- // return ElMessage("请勿重复添加货币余额");
- // } else {
- // loadingDialog.value = true;
- // proxy.post("/accountManagement/" + modalType.value, formData.data).then(
- // () => {
- // ElMessage({
- // message: modalType.value == "add" ? "添加成功" : "编辑成功",
- // type: "success",
- // });
- // dialogVisible.value = false;
- // getList();
- // },
- // (err) => {
- // console.log(err);
- // loadingDialog.value = false;
- // }
- // );
- // }
- // } else {
- // return ElMessage("请添加至少一条类型余额");
- // }
- });
- };
- const update = (row) => {
- loadingDialog.value = false;
- modalType.value = "edit";
- formData.data = proxy.deepClone(row);
- dialogVisible.value = true;
- };
- const openSetDialog = ref(false);
- const setFormData = reactive({
- data: {},
- });
- const setFormDom = ref(null);
- const formShortConfig = computed(() => {
- return [
- {
- type: "title1",
- title: "发生额明细",
- },
- {
- type: "slot",
- slotName: "list",
- label: "",
- },
- ];
- });
- const setRules = ref({
- // amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
- year: [{ required: true, message: "请输入年份", trigger: "blur" }],
- });
- const rowData = ref({});
- const handleSet = (row) => {
- rowData.value = row;
- openSetDialog.value = true;
- proxy
- .post("/logisticsAmount/list", { logisticsCompanyId: row.id })
- .then((res) => {
- setFormData.data = {
- logisticsCompanyId: row.id,
- logisticsAmountList: res.map((x) => ({ ...x, year: x.year + "" })),
- };
- });
- };
- const handleAdd = () => {
- setFormData.data.logisticsAmountList.push({
- logisticsCompanyId: rowData.value.id,
- year: "",
- });
- };
- const handleRemove = (index) => {
- setFormData.data.logisticsAmountList.splice(index, 1);
- };
- const submitSearch = () => {
- setFormDom.value.handleSubmit(() => {
- if (
- !(
- setFormData.data.logisticsAmountList &&
- setFormData.data.logisticsAmountList.length > 0
- )
- ) {
- return proxy.msgTip("请添加发生额明细", 2);
- }
- proxy.post("/logisticsAmount/saveOrEditList", setFormData.data).then(
- () => {
- proxy.msgTip("操作成功");
- openSetDialog.value = false;
- // getList();
- },
- (err) => {
- console.log(err);
- }
- );
- });
- };
- const currentDate = computed(
- () => setFormData.data.logisticsAmountList.map((x) => x.year) || []
- );
- const disabledFn = (date) => {
- // 当前年份
- let current = moment(date).format("yyyy");
- // 禁用已选年份
- return currentDate.value.includes(current);
- };
- </script>
- <style lang="scss" scoped>
- .tenant {
- padding: 20px;
- }
- ::v-deep(.el-input-number .el-input__inner) {
- text-align: left;
- }
- </style>
|