Преглед изворни кода

3.0.91 修改折旧,增加会计科目设置

liuyanpeng пре 1 година
родитељ
комит
60328d05e2

+ 2 - 2
package.json

@@ -1,7 +1,7 @@
 {
   "name": "client-eam-v3",
   "description": "Leanwo Prodog Client",
-  "version": "3.0.90",
+  "version": "3.0.91",
   "author": "yangzhijie1488 <yangzhijie1488@163.com>",
   "scripts": {
     "ins": "npm install --registry=http://wuzhixin.vip:4873",
@@ -16,7 +16,7 @@
   ],
   "peerDependencies": {
     "ant-design-vue": "^4.2.5",
-    "pc-component-v3": "^1.0.97",
+    "pc-component-v3": "^1.0.99",
     "v-tooltip": "^4.0.0-beta.17",
     "vue-select": "^4.0.0-beta.6"
   },

+ 124 - 3
src/api/assetPeriodDepreciate/index.js

@@ -49,9 +49,9 @@ export const queryByNameApi = params => {
   });
 };
 
-// 根据资产分类id查询资产分类信息
-export const queryByIdApi = id => {
-  const requestUrl = `AssetCategoryResource/getAssetCategorysByAssetCategoryId?assetCategoryId=${id}`;
+// 根据organizationId查询部门会计科目
+export const querySubjectApi = id => {
+  const requestUrl = `OrganizationAccountSubjectResource/queryOrganizationAccountSubjectByOrganizationId?organizationId=${id}`;
 
   return new Promise((resolve, reject) => {
     $.ajax({
@@ -195,6 +195,31 @@ export const updateReservedRateApi = params => {
   });
 };
 
+// 设置累计折旧科目 
+export const updateSubjectApi = params => {
+  const requestUrl = 'AssetCategoryResource/updateAssetCategoryAccountSubject';
+
+  return new Promise((resolve, reject) => {
+    $.ajax({
+      url: Common.getApiURL(requestUrl),
+      type: 'post',
+      contentType: 'application/json',
+      dataType: 'json',
+      data: JSON.stringify(params),
+
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+};
+
 // 获取初始化年月
 export const queryAssetConfig = () => {
   const requestUrl = 'assetConfigResource/queryAssetConfig';
@@ -317,6 +342,102 @@ export const updateAccountApi = params => {
 export const queryAssetPeriodApi = (start, end) => {
   const requestUrl = `AssetPeriodDepreciateResource/queryAssetPeriodByYearMonth?startYearMonth=${start}&endYearMonth=${end}`;
 
+  return new Promise((resolve, reject) => {
+    $.ajax({
+      url: Common.getApiURL(requestUrl),
+      type: 'get',
+      dataType: 'json',
+
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+};
+
+// 保存部门-会计科目 
+export const saveSubjectApi = params => {
+  const requestUrl = 'OrganizationAccountSubjectResource/saveOrganizationAccountSubject';
+
+  return new Promise((resolve, reject) => {
+    $.ajax({
+      url: Common.getApiURL(requestUrl),
+      type: 'post',
+      contentType: 'application/json',
+      dataType: 'json',
+      data: JSON.stringify(params),
+
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+};
+
+// 根据凭证记录id删除凭证
+export const deleteByIdApi = id => {
+  const requestUrl = `AssetPeriodDepreciateResource/deleteAccountVoucherById?id=${id}`;
+
+  return new Promise((resolve, reject) => {
+    $.ajax({
+      url: Common.getApiURL(requestUrl),
+      type: 'post',
+      contentType: 'application/json',
+
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+};
+
+// 反结账:清空计提折旧登账时间
+export const updateNotApi = params => {
+  const requestUrl = 'AssetPeriodDepreciateResource/updateAccountVoucherNot';
+
+  return new Promise((resolve, reject) => {
+    $.ajax({
+      url: Common.getApiURL(requestUrl),
+      type: 'post',
+      contentType: 'application/json',
+      dataType: 'json',
+      data: JSON.stringify(params),
+
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+};
+
+// 根据开始年月和结束年月、资产大类id查询明细数据
+export const queryDetailApi = (start, end, id) => {
+  const requestUrl = `AssetPeriodDepreciateResource/queryAssetPeriodByYearMonthAndAssetClassificationId?startYearMonth=${start}&endYearMonth=${end}&assetClassificationId=${id}`;
+
   return new Promise((resolve, reject) => {
     $.ajax({
       url: Common.getApiURL(requestUrl),

+ 250 - 0
src/components/assetPeriodDepreciate/AccountingSubject.vue

@@ -0,0 +1,250 @@
+<template>
+  <header>
+    <h3 style="margin: 0px; padding: 5px 0px 9px 0px">
+      部门管理-会计科目
+    </h3>
+    <a-divider style="margin: 0px" />
+  </header>
+  <div style="margin-top: 8px">
+    <a-button type="dashed" style="margin-left: 8px" @click="refreshData">
+      刷新
+    </a-button>
+    <a-select
+      v-model:value="clientIdStr" show-search option-filter-prop="label" style="width: 50%; margin-left: 16px"
+      placeholder="请选择公司" :options="companies.map((item) => ({ value: item.id, label: item.name }))"
+      @change="getClientId"
+    />
+  </div>
+
+  <a-table
+    style="margin-top: 6px" :columns="columns" :data-source="dataSource" :pagination="false" :scroll="{ y: 616 }"
+    filter-search
+  >
+    <template #bodyCell="{ column, record }">
+      <template v-if="column.dataIndex === 'operation'">
+        <div class="editable-row-operations">
+          <span>
+            <a @click="editOrganization(record.key)">编辑</a>
+          </span>
+        </div>
+      </template>
+    </template>
+  </a-table>
+
+  <a-drawer v-model:open="editVisible" :title="drawerTitle" :width="500" placement="right">
+    <div class="form-group">
+      <label>部门编号</label>
+      <a-input v-model:value="organization.responseOrganizationNo" disabled />
+    </div>
+    <div class="form-group">
+      <label>部门名称</label>
+      <a-input v-model:value="organization.responseOrganizationName" disabled />
+    </div>
+    <div class="form-group">
+      <label>会计科目</label>
+      <div>
+        <a-select
+          v-model:value="organization.accountSubjectId" style="width: 100%" allow-clear
+          option-filter-prop="label" show-search :options="subjects"
+        />
+      </div>
+    </div>
+    <template #footer>
+      <a-button type="primary" @click="saveSubject(organization)">
+        保存
+      </a-button>
+    </template>
+  </a-drawer>
+
+  <Loading v-if="loading" />
+</template>
+
+<script setup>
+import { ref, onMounted } from 'vue';
+import { SqlApi } from 'pc-component-v3';
+import { message } from 'ant-design-vue';
+import Common from '../../common/Common.js';
+import { columns, getCompony, getAllOrganization } from './department/index.js';
+import { querySubjectApi, saveSubjectApi } from '../../api/assetPeriodDepreciate/index.js';
+
+const clientId = ref(''); //公司id
+const companies = ref([]); //所有公司
+const clientIdStr = ref(undefined);
+const dataSource = ref([]); // 表格部门
+const drawerTitle = ref(''); //抽屉标题
+const organization = ref({}); // 部门详情
+const editVisible = ref(false); // 抽屉开关
+const loading = ref(false);
+const subjects = ref([]);
+
+onMounted(() => {
+  getComponyInfo();
+  getSubjects();
+});
+
+// 获取公司名称id
+const getComponyInfo = () => {
+  companies.value = [];
+  getCompony().then(
+    success => {
+      if (success.errorCode == 0) {
+        if (success.datas && success.datas.length > 0) {
+          getALLClient(success.datas);
+        }
+      } else {
+        message.error(success.errorMessage);
+      }
+    },
+    err => {
+      Common.processException(err);
+    },
+  );
+};
+// 展示子公司数据
+const getALLClient = datas => {
+  datas.forEach(item => {
+    companies.value.push({ id: item.id, name: item.name });
+    if (item.childrenClients && item.childrenClients.length > 0) {
+      getALLClient(item.childrenClients);
+    }
+  });
+};
+
+// 获取所选公司id 名字
+const getClientId = value => {
+  clientId.value = value;
+  getOrganization();
+};
+
+//刷新数据
+const refreshData = () => {
+  getComponyInfo();
+  getOrganization();
+};
+// 获取所有部门
+const getOrganization = () => {
+  loading.value = true;
+  dataSource.value = [];
+  const datas = [];
+  const id = clientId.value;
+  getAllOrganization(id).then(
+    success => {
+      if (success.errorCode == 0) {
+        success.datas.forEach(item => {
+          datas.push(item.childrenOrganizations);
+        });
+        traversalTree(datas.flat(1), dataSource.value);
+      }
+      loading.value = false;
+    },
+    err => {
+      loading.value = false;
+      Common.processException(err);
+    },
+  );
+};
+
+// 编辑部门(获取部门信息)
+const editOrganization = id => {
+  editVisible.value = true;
+  drawerTitle.value = '编辑会计科目';
+  querySubject(id);
+};
+
+// 保存事件
+const saveSubject = info => {
+  loading.value = true;
+  const params = {
+    accountSubjectId: info.accountSubjectId,
+    responseOrganizationId: info.responseOrganizationId,
+  };
+  saveSubjectApi(params).then(
+    success => {
+      if (success.errorCode == 0) {
+        refreshData();
+        message.success('保存成功');
+        editVisible.value = false;
+      } else {
+        message.warning(success.errorMessage);
+      }
+      loading.value = false;
+    },
+    error => {
+      loading.value = false;
+      Common.processException(error);
+    },
+  );
+
+};
+
+// 获取所有会计科目
+const getSubjects = () => {
+  SqlApi.execute('20241120_143101').then(
+    success => {
+      if (success.errorCode == 0) {
+        if (success.results) {
+          success.results.forEach(item => {
+            item.label = `${item.name}-${item.no}`;
+            item.value = item.id;
+          });
+          subjects.value = success.results;
+        }
+      } else {
+        message.warning(success.errorMessage);
+      }
+    },
+    error => {
+      Common.processException(error);
+    },
+  );
+};
+
+// 根据部门id查会计科目
+const querySubject = id => {
+  loading.value = true;
+  querySubjectApi(id).then(
+    success => {
+      if (success.errorCode == 0) {
+
+        organization.value = success.data;
+      } else {
+        message.error(success.errorMessage);
+      }
+      loading.value = false;
+    },
+    err => {
+      loading.value = false;
+      Common.processException(err);
+    },
+  );
+};
+
+// 递归将childrenOrganizations赋值给children
+const traversalTree = (array, target) => {
+  array.map((item, index) => {
+    target.push({
+      id: item.id,
+      no: item.no,
+      key: item.id,
+      children: [],
+      type: item.type,
+      name: item.name,
+      description: item.description,
+    });
+    if (
+      item.childrenOrganizations !== null &&
+      item.childrenOrganizations.length !== 0
+    ) {
+      traversalTree(item.childrenOrganizations, target[index].children);
+    } else {
+      delete target[index].children;
+    }
+  });
+};
+</script>
+
+<style scoped>
+.editable-row-operations a {
+  margin-right: 8px;
+}
+</style>

+ 148 - 79
src/components/assetPeriodDepreciate/DepreciationInformation.vue

@@ -11,12 +11,13 @@
       <a-col flex="auto" class="table_box" style="width: 0;">
         <div class="operation_box">
           <a-input-search
-            v-model:value="searchParams.name" size="small"
-            style="width: 300px;margin:0 0 8px 0;" enter-button @search="searchChange"
+            v-model:value="searchParams.name" size="small" style="width: 300px;margin:0 0 8px 0;"
+            enter-button @search="searchChange(true)"
           />
           <a-pagination
-            v-model:current="current" simple size="small" :total="infoTotal"
-            :default-page-size="20" @change="getPageParams"
+            v-model:current="current" size="small" :total="infoTotal" show-quick-jumper
+            :show-size-changer="true" :page-size-options="pageSizeOptions" :default-page-size="20"
+            @change="getPageParams" @show-size-change="showSizeChange"
           />
         </div>
 
@@ -37,6 +38,9 @@
             <a-button size="small" :icon="h(PercentageOutlined)" @click="operation('设置残值率')">
               设置残值率
             </a-button>
+            <a-button size="small" :icon="h(FileProtectOutlined)" @click="operation('设置累计折旧')">
+              设置累计折旧
+            </a-button>
           </a-space>
           <a-space>
             <!-- <a-button size="small" :icon="h(DownloadOutlined)">导出</a-button> -->
@@ -70,6 +74,12 @@
         :field-names="{ label: 'text', value: 'id' }"
       />
     </a-form-item>
+    <a-form-item v-if="modalTitle === '设置累计折旧'" label="请选择" style="margin-top: 24px;">
+      <a-select
+        v-model:value="subject" style="width: 90%" allow-clear option-filter-prop="label" show-search
+        :options="subjects"
+      />
+    </a-form-item>
     <a-form-item v-if="modalTitle === '设置残值率'" label="请输入" style="margin-top: 24px;">
       <a-input-number
         v-model:value="reservedRate" :controls="false" :step="0.01" :min="0" :max="100"
@@ -80,16 +90,17 @@
 </template>
 
 <script setup>
-import { ref, reactive, h } from 'vue';
+import { ref, reactive, onMounted, h } from 'vue';
 import Common from '../../common/Common';
 import CommonTable from '../../common/CommonTable.vue';
-import { FieldTimeOutlined, MoneyCollectOutlined, PayCircleOutlined, DownloadOutlined, ProfileOutlined, PercentageOutlined } from '@ant-design/icons-vue';
+import { FieldTimeOutlined, MoneyCollectOutlined, PayCircleOutlined, DownloadOutlined, ProfileOutlined, PercentageOutlined, FileProtectOutlined } from '@ant-design/icons-vue';
 import {
-  queryCategoriesApi, queryByNameApi, queryByIdApi, updateYearApi, updateExtractApi, getMethodsApi, updateMethodApi,
-  updateReservedRateApi,
+  queryCategoriesApi, queryByNameApi, updateYearApi, updateExtractApi, getMethodsApi, updateMethodApi,
+  updateReservedRateApi, updateSubjectApi,
 } from '../../api/assetPeriodDepreciate';
 import { infoColumns, debounce } from './util.js';
 import { message, Modal } from 'ant-design-vue';
+import { SqlApi } from 'pc-component-v3';
 
 // 表格配置
 const commonTable = ref();
@@ -110,13 +121,15 @@ const visible = ref(false);
 const modalTitle = ref('');
 const yearLimit = ref(null); // 折旧年限
 const reservedRate = ref(null); // 残值率
+const subject = ref(undefined); // 会计科目
+const subjects = ref([]); // 会计科目
 const isLoading = ref(false);
 const isAllSearch = ref(true);
-const selectCategory = ref(null);
-const selectCategoryId = ref([]);
+const pageSizeOptions = ref(['20', '50', '100', '200', '500']);
 
 // 查询参数
 const searchParams = reactive({
+  id: null,
   name: '',
   range: {
     start: 0,
@@ -124,6 +137,10 @@ const searchParams = reactive({
   },
 });
 
+onMounted(() => {
+  getSubjects();
+});
+
 const clearDatas = () => {
   modalTitle.value = '';
   yearLimit.value = null;
@@ -158,6 +175,12 @@ const setDepreciationInfo = () => {
       assetCategoryIds: selectedIds.value,
     };
     setMethod(params);
+  } else if (modalTitle.value === '设置累计折旧') {
+    const params = {
+      accountSubjectId: subject.value,
+      assetCategoryIds: selectedIds.value,
+    };
+    updateSubject(params);
   } else {
     const params = {
       reservedRate: reservedRate.value,
@@ -172,16 +195,16 @@ const setYearLimit = params => {
   updateYearApi(params).then(
     success => {
       if (success.errorCode === 0) {
+        clearDatas();
+        if (!searchParams.id) {
+          searchChange(true);
+        } else {
+          searchChange(false);
+        }
         message.success('设置折旧年限成功。');
       } else {
         message.warning(success.errorMessage);
       }
-      clearDatas();
-      if (isAllSearch.value) {
-        searchChange();
-      } else {
-        categoriesSelected();
-      }
     },
     error => {
       Common.processException(error);
@@ -194,16 +217,16 @@ const setMethod = params => {
   updateMethodApi(params).then(
     success => {
       if (success.errorCode === 0) {
+        clearDatas();
+        if (!searchParams.id) {
+          searchChange(true);
+        } else {
+          searchChange(false);
+        }
         message.success('设置折旧方法成功。');
       } else {
         message.warning(success.errorMessage);
       }
-      clearDatas();
-      if (isAllSearch.value) {
-        searchChange();
-      } else {
-        categoriesSelected();
-      }
     },
     error => {
       Common.processException(error);
@@ -216,15 +239,37 @@ const setReservedRate = params => {
   updateReservedRateApi(params).then(
     success => {
       if (success.errorCode === 0) {
+        clearDatas();
+        if (!searchParams.id) {
+          searchChange(true);
+        } else {
+          searchChange(false);
+        }
         message.success('设置残值率成功。');
       } else {
         message.warning(success.errorMessage);
       }
-      clearDatas();
-      if (isAllSearch.value) {
-        searchChange();
+    },
+    error => {
+      Common.processException(error);
+    },
+  );
+};
+
+// 设置累计折旧科目
+const updateSubject = params => {
+  updateSubjectApi(params).then(
+    success => {
+      if (success.errorCode === 0) {
+        clearDatas();
+        if (!searchParams.id) {
+          searchChange(true);
+        } else {
+          searchChange(false);
+        }
+        message.success(success.errorMessage);
       } else {
-        categoriesSelected();
+        message.warning(success.errorMessage);
       }
     },
     error => {
@@ -262,36 +307,10 @@ const cancelDepreciation = () => {
   });
 };
 
-// 根据分类ID查询折旧信息(处理刷新情况,避免点击父类资产时刷新无效)
-const categoriesSelected = (key, selected) => {
-  let nowKey;
-  let nowCategory;
-  if (selected) {
-    if (!selected.node.dataRef.children) {
-      selectCategoryId.value = nowKey = key;
-      selectCategory.value = nowCategory = selected;
-    }
-  } else {
-    nowKey = [...selectCategoryId.value];
-    nowCategory = { ...selectCategory.value };
-  }
-  if (nowKey && nowKey.length) {
-    if (!nowCategory.node.dataRef.children) {
-      queryByIdApi(nowKey[0]).then(
-        success => {
-          if (success.name) {
-            dataSource.value = [{ ...success }];
-            infoTotal.value = 1;
-          }
-          isAllSearch.value = false;
-        },
-        error => {
-          Common.processException(error);
-        },
-      );
-    }
-  }
-
+// 根据分类ID查询折旧信息
+const categoriesSelected = key => {
+  searchParams.id = key[0];
+  searchChange(false);
 };
 
 // 获取的分页参数并查询
@@ -302,9 +321,24 @@ const getPageParams = (start, length) => {
   getInfo();
 };
 
+// 分页每页条数变化查询
+const showSizeChange = (_, size) => {
+  setTimeout(() => {
+    current.value = 1;
+    searchParams.range.start = 0;
+    searchParams.range.length = size;
+    getInfo();
+  });
+};
+
 // 查询回到第一页
-const searchChange = debounce(() => {
-  getPageParams(1, 20);
+const searchChange = debounce(isAll => {
+  if (isAll[0]) {
+    isAllSearch.value = true;
+  } else {
+    isAllSearch.value = false;
+  }
+  getPageParams(1, searchParams.range.length);
 }, 500);
 
 // 获取所选项的数据
@@ -329,16 +363,22 @@ const getCategories = () => {
 
 // 根据分类名字查询信息
 const getInfo = () => {
+  if (isAllSearch.value) {
+    searchParams.id = null;
+  } else {
+    searchParams.name = '';
+  }
   isLoading.value = true;
   const params = JSON.parse(JSON.stringify(searchParams));
   queryByNameApi(params).then(
     success => {
-      if (success.dataList && success.dataList.length) {
+      if (success.dataList) {
         dataSource.value = success.dataList;
+      } else {
+        dataSource.value = [];
       }
       infoTotal.value = success.totalSize;
       isLoading.value = false;
-      isAllSearch.value = true;
     },
     error => {
       isLoading.value = false;
@@ -379,10 +419,33 @@ const updateExtractDepreciation = flag => {
           message.success('设置不提折旧成功。');
         }
         clearDatas();
-        if (isAllSearch.value) {
-          searchChange();
+        if (!searchParams.id) {
+          searchChange(true);
         } else {
-          categoriesSelected();
+          searchChange(false);
+        }
+      } else {
+        message.warning(success.errorMessage);
+      }
+    },
+    error => {
+      Common.processException(error);
+    },
+  );
+};
+
+// 获取所有累计折旧会计科目
+const getSubjects = () => {
+  SqlApi.execute('20241120_175411').then(
+    success => {
+      if (success.errorCode == 0) {
+        if (success.results) {
+          success.results.forEach(item => {
+            item.label = `${item.name}-${item.no}`;
+            item.value = item.id;
+          });
+          subjects.value = success.results;
+          subject.value = success.results[0].id;
         }
       } else {
         message.warning(success.errorMessage);
@@ -402,34 +465,40 @@ getCategories();
 
 <style scoped>
 .tree_box {
-    height: 86vh;
-    overflow: auto;
-    border: 1px solid #dddddd;
-    margin-right: 4px;
-    border-bottom: none;
+  height: 86vh;
+  overflow: auto;
+  border: 1px solid #dddddd;
+  margin-right: 4px;
+  border-bottom: none;
 }
 
 .table_box {
-    padding: 6px;
-    border: 1px solid #dddddd;
-    border-bottom: none;
+  padding: 6px;
+  border: 1px solid #dddddd;
+  border-bottom: none;
 }
 
 .operation_box {
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
 }
 
 .ant-btn>span {
-    color: #267fcf;
+  color: #267fcf;
 }
 
 .footer_box {
-    background-color: #fafafa;
+  background-color: #fafafa;
 }
-p{
-    margin: 0 !important;
-    padding: 0 !important;
+
+p {
+  margin: 0 !important;
+  padding: 0 !important;
+}
+
+:deep(.ant-form-item-label > label) {
+  font-size: 14px !important;
+  font-weight: 500 !important;
 }
 </style>

+ 74 - 5
src/components/assetPeriodDepreciate/InquiryStatistics.vue

@@ -7,12 +7,27 @@
     :columns="statisticColumns" :data-source="statisticDatas" :loading="isLoading" :pagination="false"
     :scroll="{ y: 720 }" size="small" bordered
   >
-    <!-- <template #bodyCell="{ column }">
+    <template #bodyCell="{ column, record }">
       <template v-if="column.dataIndex === 'operation'">
-        <a-button type="link">查看明细</a-button>
+        <a-button type="link" @click="viewDetail(record)">查看明细</a-button>
       </template>
-</template> -->
+    </template>
   </a-table>
+
+  <a-modal v-model:open="detailModal" title="查看明细" width="80%" @ok="detailModal = false">
+    <!-- <a-space>
+      <a-input-search
+        v-model:value="searchValue" size="small" style="width: 300px;margin:0 0 8px 0;" enter-button
+        @search="searchDetail"
+      />
+    </a-space> -->
+    <div class="table-container">
+      <a-table
+        :columns="detailColumns" :data-source="detailDatas" :loading="isLoading" :pagination="false"
+        :scroll="{ y: 280 }" size="small" bordered
+      />
+    </div>
+  </a-modal>
 </template>
 
 <script setup>
@@ -22,7 +37,8 @@ import { message } from 'ant-design-vue';
 import Common from '../../common/Common.js';
 import { statisticColumn, getMonths } from './util.js';
 import { SearchOutlined } from '@ant-design/icons-vue';
-import { queryAssetPeriodApi } from '../../api/assetPeriodDepreciate/index.js';
+import { queryAssetPeriodApi, queryDetailApi } from '../../api/assetPeriodDepreciate/index.js';
+import { computed } from 'vue';
 
 
 const timeHorizon = ref([dayjs(getMonths().current, 'YYYY-MM'), dayjs(getMonths().last, 'YYYY-MM')]);
@@ -30,12 +46,36 @@ const startDate = ref(getMonths().last);
 const endDate = ref(getMonths().current);
 const statisticDatas = ref([]);
 const statisticColumns = ref(statisticColumn);
+const detailModal = ref(false);
+const detailDatas = ref([]);
 const isLoading = ref(false);
+const searchValue = ref('');
 
 onMounted(() => {
   queryByTime();
 });
 
+const detailColumns = computed(() => {
+  const columns = statisticColumn.slice(1, -1);
+  columns.unshift(
+    {
+      title: '名称',
+      key: 'assetName',
+      dataIndex: 'assetName',
+      width: 100,
+      align: 'center',
+    },
+    {
+      title: '编号',
+      key: 'assetNo',
+      dataIndex: 'assetNo',
+      width: 100,
+      align: 'center',
+    },
+  );
+  return columns;
+});
+
 // 获取查询时间范围
 const timeChanged = (_, dateStr) => {
   startDate.value = dateStr[0];
@@ -68,6 +108,35 @@ const queryByTime = () => {
     },
   );
 };
+
+// 查看明细
+const viewDetail = record => {
+  detailModal.value = true;
+  queryDetail(record.assetClassificationId);
+};
+
+const queryDetail = id => {
+  isLoading.value = true;
+  queryDetailApi(startDate.value, endDate.value, id).then(
+    success => {
+      if (success.errorCode === 0) {
+        success.datas ? detailDatas.value = success.datas : detailDatas.value = [];
+      } else {
+        message.warning(success.errorMessage);
+      }
+      isLoading.value = false;
+    },
+    error => {
+      isLoading.value = false;
+      Common.processException(error);
+    },
+  );
+};
 </script>
 
-<style scoped></style>
+<style scoped>
+.table-container {
+  height: 320px;
+  overflow-y: auto;
+}
+</style>

+ 68 - 13
src/components/assetPeriodDepreciate/WithdrawDepreciation.vue

@@ -12,12 +12,15 @@
   >
     <template #bodyCell="{ column, record }">
       <template v-if="column.dataIndex === 'registerAccountDate'">
-        <span v-if="!record.registerAccountDate">未入账</span>
+        <span v-if="!record.closed">未入账</span>
         <span v-else>已登账,入账日期:{{ record.registerAccountDate }}</span>
       </template>
       <template v-if="column.dataIndex === 'operation'">
-        <a-button v-if="!record.registerAccountDate" type="link" @click="entryAccount(record)">登账</a-button>
-        <span v-else>已登账</span>
+        <a-button v-if="!record.closed" type="link" @click="entryAccount(record, true)">登账</a-button>
+        <a-button v-else type="link" @click="entryAccount(record, false)">凭证</a-button>
+        <a-popconfirm v-if="accountDatas.length && !record.closed" title="确认要删除码?" @confirm="deleteVoucher(record.id)">
+          <a style="color: red;">删除</a>
+        </a-popconfirm>
       </template>
     </template>
   </a-table>
@@ -25,7 +28,7 @@
   <a-modal v-model:open="extractModal" title="提取折旧(摊销)" width="300px" @ok="saveExtract">
     选择折旧年月 <a-date-picker v-model:value="depreciationYear" picker="month" :allow-clear="false" />
   </a-modal>
-  <a-modal v-model:open="voucherModal" title="折旧原始凭证" width="680px" @ok="updateAccount">
+  <a-modal v-model:open="voucherModal" title="折旧原始凭证" width="680px">
     <h4 class="title">
       计提折旧(摊销)凭证
     </h4>
@@ -38,12 +41,12 @@
           <span>登账日期 : </span>
           <a-date-picker
             v-model:value="registerAccountDate" size="small" value-format="YYYY-MM-DD"
-            @change="accountDateChange"
+            :disabled="voucherDatas ? voucherDatas.closed : false" @change="accountDateChange"
           />
         </div>
       </a-flex>
       <div style="text-align: right;">
-        第 <a-input v-model:value="accountVoucherNo" size="small" style="width: 60%;" />
+        第 {{ voucherDatas ? voucherDatas.accountVoucherNo : '' }}
       </div>
     </a-flex>
     <div class="table-container">
@@ -57,6 +60,11 @@
       <span>计提人 : {{ voucherDatas ? voucherDatas.operationName : '' }}</span>
       <!-- <span>上海联物</span> -->
     </a-flex>
+    <template #footer>
+      <a-button @click="voucherModal = false">取消</a-button>
+      <a-button v-if="isEntry" type="primary" @click="updateAccount">登账</a-button>
+      <a-button v-if="!isEntry" type="primary" @click="cancelEntry">取消登账</a-button>
+    </template>
   </a-modal>
 </template>
 
@@ -67,7 +75,7 @@ import { message } from 'ant-design-vue';
 import Common from '../../common/Common.js';
 import { accountColumn, getCurrentDate, getTime } from './util.js';
 import { SearchOutlined, PayCircleOutlined } from '@ant-design/icons-vue';
-import { queryByYearApi, generateVouchApi, queryLineApi, updateAccountApi } from '../../api/assetPeriodDepreciate/index.js';
+import { queryByYearApi, generateVouchApi, queryLineApi, updateAccountApi, deleteByIdApi, updateNotApi } from '../../api/assetPeriodDepreciate/index.js';
 
 const yearStr = ref(new Date().getFullYear());
 const yearValue = ref(dayjs(getCurrentDate(), 'YYYY'));
@@ -78,7 +86,7 @@ const accountDatas = ref([]);
 const voucherDatas = ref(null);
 const extractModal = ref(false);
 const voucherModal = ref(false);
-const accountVoucherNo = ref('');
+const isEntry = ref(true);
 const accountId = ref(null);
 const registerAccountDate = ref(undefined);
 const accountColumns = ref(accountColumn);
@@ -100,12 +108,33 @@ const accountDateChange = dateStr => {
 };
 
 // 打开提取折旧登账
-const entryAccount = record => {
+const entryAccount = (record, flag) => {
   voucherModal.value = true;
   accountId.value = record.id;
+  isEntry.value = flag;
   queryLine(record.id);
 };
 
+// 根据凭证记录id删除凭证
+const deleteVoucher = id => {
+  isLoading.value = true;
+  deleteByIdApi(id).then(
+    success => {
+      if (success.errorCode === 0) {
+        message.success('删除成功。');
+        queryByYear();
+      } else {
+        message.warning(success.errorMessage);
+      }
+      isLoading.value = false;
+    },
+    error => {
+      Common.processException(error);
+      isLoading.value = false;
+    },
+  );
+};
+
 // 根据年份查询记账凭证数据
 const queryByYear = () => {
   isLoading.value = true;
@@ -149,8 +178,11 @@ const queryLine = id => {
   queryLineApi(id).then(
     success => {
       if (success.errorCode === 0) {
-        voucherDatas.value = success.data;
-        dataSource.value = success.data.accountVoucherLineDtos;
+        if (success.data) {
+          voucherDatas.value = success.data;
+          registerAccountDate.value = success.data.registerAccountDate;
+          dataSource.value = success.data.accountVoucherLineDtos;
+        }
       } else {
         message.warning(success.errorMessage);
       }
@@ -162,17 +194,40 @@ const queryLine = id => {
 };
 
 // 设置计提折旧登账时间和字号
-const updateAccount = id => {
+const updateAccount = () => {
   const params = {
     id: accountId.value,
     registerAccountDate: registerAccountDate.value,
-    accountVoucherNo: accountVoucherNo.value,
+    accountVoucherNo: voucherDatas.value.accountVoucherNo,
   };
   updateAccountApi(params).then(
     success => {
       if (success.errorCode === 0) {
         message.success('保存成功');
         voucherModal.value = false;
+        queryByYear();
+      } else {
+        message.warning(success.errorMessage);
+      }
+    },
+    error => {
+      Common.processException(error);
+    },
+  );
+};
+
+// 反结账:清空计提折旧登账时间
+const cancelEntry = () => {
+  const params = {
+    id: accountId.value,
+    registerAccountDate: registerAccountDate.value,
+  };
+  updateNotApi(params).then(
+    success => {
+      if (success.errorCode === 0) {
+        message.success('取消成功');
+        voucherModal.value = false;
+        queryByYear();
       } else {
         message.warning(success.errorMessage);
       }

+ 239 - 0
src/components/assetPeriodDepreciate/department/index.js

@@ -0,0 +1,239 @@
+import { Common } from 'pc-component-v3';
+
+export const columns = [
+  {
+    title: '部门名称',
+    dataIndex: 'name',
+    key: 'name',
+    width:200,
+  },
+  {
+    title: '部门编号',
+    dataIndex: 'no',
+    key: 'no',
+    width:200,
+  },
+
+  {
+    title: '操作',
+    dataIndex: 'operation',
+    fixed: 'right',
+    width:200,
+  },
+];
+
+// 创建部门
+export const create = organization => {
+  var requestUrl = 'organizationResourceV2/create';
+  return new Promise((resolve, reject) => {
+    $.ajax({
+      url: Common.getApiURL(requestUrl),
+      type: 'post',
+      data: JSON.stringify(organization),
+      contentType: 'application/json; charset=utf-8',
+      processData: false,
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+};
+
+// 保存更新部门
+export const update = organization => {
+  var requestUrl = 'organizationResourceV2/update';
+  return new Promise((resolve, reject) => {
+    $.ajax({
+      url: Common.getApiURL(requestUrl),
+      type: 'post',
+      contentType: 'application/json',
+      data: JSON.stringify(organization),
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+};
+// 删除部门
+export const deleteDepartment = organization => {
+  var requestUrl = 'organizationResourceV2/delete';
+  return new Promise((resolve, reject) => {
+    $.ajax({
+      url: Common.getApiURL(requestUrl),
+      type: 'post',
+      dataType: 'json',
+      data: JSON.stringify(organization),
+      contentType: 'application/json; charset=utf-8',
+      processData: false,
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+};
+
+// 获取总公司及下属所有子公司和部门(刷新)
+export const getAllOrganization = id => {
+  var requestUrl = 'organizationResourceV2/listClientOrganizations?clientId=' + id;
+  return new Promise((resolve, reject) => {
+    $.ajax({
+      url: Common.getApiURL(requestUrl),
+      type: 'get',
+      dataType: 'json',
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+};
+// 获取公司
+export const getCompony = () => {
+  var requestUrl = 'clientResourceV2/listClients';
+  return new Promise((resolve, reject) => {
+    $.ajax({
+      url: Common.getApiURL(requestUrl),
+      type: 'get',
+      dataType: 'json',
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+};
+
+// 根据公司id查询公司下所有部门,不包括子公司的部门
+export const loadSubClients = id => {
+  var requestUrl = 'organizationResourceV2/queryOrganizationByClientId';
+  return new Promise((resolve, reject) => {
+    $.ajax({
+      url: Common.getApiURL(requestUrl),
+      type: 'get',
+      dataType: 'json',
+      data: { rootClientId: id },
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+};
+// 根据部门id获取部门的信息
+export const loadOrganization = id => {
+  var requestUrl = 'organizationResourceV2/unique?organizationId=' + id;
+  return new Promise((resolve, reject) => {
+    $.ajax({
+      url: Common.getApiURL(requestUrl),
+      type: 'get',
+      dataType: 'json',
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      processData: false,
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+};
+
+export const getUsersByName = searchQueryParam => {
+  var requestUrl = 'api/userResource/getUsersByName';
+  return new Promise((resolve, reject) => {
+    $.ajax({
+      url: Common.getApiUrl2(requestUrl),
+      type: 'post',
+      contentType: 'application/json',
+      data: JSON.stringify(searchQueryParam),
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+};
+// 根据公司id获取公司的信息
+export const getClientInfo  = id => {
+  var requestUrl = 'clientResourceV2/uniqueByClientId?clientId=' + id;
+  return new Promise((resolve, reject) => {
+    $.ajax({
+      url: Common.getApiURL(requestUrl),
+      type: 'get',
+      dataType: 'json',
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      processData: false,
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+};
+
+// 更新公司信息
+export const updateClientInfo = client => {
+  var requestUrl = 'clientResourceV2/update';
+  return new Promise((resolve, reject) => {
+    $.ajax({
+      url: Common.getApiURL(requestUrl),
+      type: 'post',
+      contentType: 'application/json',
+      data: JSON.stringify(client),
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+};

+ 6 - 6
src/components/assetPeriodDepreciate/util.js

@@ -158,12 +158,12 @@ export const statisticColumn = [
     dataIndex: 'endNetValue',
     width: 100,
   },
-  // {
-  //   title: '业务操作',
-  //   key: 'operation',
-  //   dataIndex: 'operation',
-  //   width: 70,
-  // },
+  {
+    title: '业务操作',
+    key: 'operation',
+    dataIndex: 'operation',
+    width: 70,
+  },
 ].map(item => ({ ...item, align: 'center', ellipsis: true, resizable: true, maxWidth: 200, minWidth: 75 }));
 
 

+ 13 - 8
src/components/executeAssetDisposal/SelectAcceptor.vue

@@ -1,6 +1,6 @@
 <template>
   <a-modal
-    :open="open" :mask-closable="false" ok-text="确认" cancel-text="取消" title="选择买受方" width="60%"
+    :open="open" :mask-closable="false" ok-text="确认" cancel-text="取消" title="选择买受方" width="980px"
     @update:open="$emit('update:open', $event)" @cancel="cancelSelect" @ok="confirmEdit"
   >
     <a-card>
@@ -144,8 +144,14 @@ const handleSaveRow = record => {
 
 // 取消编辑,并删除该行  
 const handleCancelRow = (record, index, isDelete) => {
-  acceptorDatas.value.splice(index, 1);
-  if (isDelete) deleteAcceptor(record.id);
+  if (!isDelete) {
+    if (!record.id) {
+      acceptorDatas.value.splice(index, 1);
+    }
+    record.isEditing = false;
+  } else {
+    deleteAcceptor(record.id);
+  }
 };
 
 onMounted(() => {
@@ -196,12 +202,11 @@ const addAcceptor = record => {
 // 删除买受方
 const deleteAcceptor = id => {
   $.ajax({
-    url: Common.getApiURL('AcceptorResource/deleteAcceptor'),
-    type: 'post',
-    data: {
-      AcceptorId: id,
-    },
+    url: Common.getApiURL(`buyerResource/deleteBuyer?id=${id}`),
+    type: 'delete',
+    contentType: 'application/json',
 
+    dataType: 'json',
     beforeSend: function (request) {
       Common.addTokenToRequest(request);
     },

+ 14 - 9
src/components/executeAssetDisposal/assetConfig.js

@@ -95,22 +95,27 @@ export const acceptorAddColumn = [
   {
     title: '买受方名称',
     dataIndex: 'buyerName',
+    ellipsis: true,
   },
   {
     title: '联系电话',
     dataIndex: 'phone',
+    ellipsis: true,
   },
   {
     title: '联系人',
     dataIndex: 'contactPerson',
+    ellipsis: true,
   },
   {
     title: '主营业务',
     dataIndex: 'mainBusiness',
+    ellipsis: true,
   },
   {
     title: '地址',
     dataIndex: 'address',
+    ellipsis: true,
   },
   {
     title: '操作',
@@ -118,7 +123,7 @@ export const acceptorAddColumn = [
     key: 'operation',
   },
 
-].map(item => ({ ...item, width: 100, align: 'center', ellipsis: true, resizable: true, maxWidth: 300, minWidth: 75 }));
+].map(item => ({ ...item, width: 100, align: 'center', resizable: true, maxWidth: 300, minWidth: 75 }));
 
 // 评价列名
 export const evaluateColumn = [
@@ -221,41 +226,41 @@ export const earningsColumn = [
   {
     title: '合同编号',
     dataIndex: 'contractNumber',
-    isInput:true,
+    isInput: true,
   },
   {
     title: '预计收益',
     dataIndex: 'expectedRevenue',
-    isInput:false,
+    isInput: false,
   },
   {
     title: '实收金额',
     dataIndex: 'actualRevenue',
-    isInput:false,
+    isInput: false,
   },
   {
     title: '评估鉴证费用',
     dataIndex: 'appraisalFee',
-    isInput:false,
+    isInput: false,
   },
   {
     title: '税金',
     dataIndex: 'taxAmount',
-    isInput:false,
+    isInput: false,
   },
   {
     title: '拍卖佣金',
     dataIndex: 'auctionCommission',
-    isInput:false,
+    isInput: false,
   },
   {
     title: '其他费用',
     dataIndex: 'otherExpenses',
-    isInput:false,
+    isInput: false,
   },
   {
     title: '备注',
     dataIndex: 'description',
-    isInput:true,
+    isInput: true,
   },
 ].map(item => ({ ...item, width: 100, align: 'center', ellipsis: true, resizable: true, maxWidth: 300, minWidth: 75 }));

+ 2 - 0
src/index.js

@@ -50,6 +50,7 @@ import AssetManagerDepreciation from './components/assetManagerDepreciation/Depr
 import InventoryGlobalView from './components/inventory1/InventoryGlobalView.vue';
 import AssetsDisposal from './components/assetsDisposal/AssetsDisposal.vue';
 import ExecuteAssetDisposal from './components/executeAssetDisposal/AssetsDisposal.vue';
+import AccountingSubject from './components/assetPeriodDepreciate/AccountingSubject.vue';
 
 export {
   langZhCn,
@@ -101,4 +102,5 @@ export {
   InventoryGlobalView,
   AssetsDisposal,
   ExecuteAssetDisposal,
+  AccountingSubject,
 };

+ 3 - 0
src/router/index.js

@@ -45,6 +45,8 @@ const DepreciationIndex = () => import('../components/assetPeriodDepreciate/Depr
 const AssetManagerDepreciation = () => import('../components/assetManagerDepreciation/DepreciationIndex.vue');
 const AssetsDisposal = () => import('../components/assetsDisposal/AssetsDisposal.vue');
 const ExecuteAssetDisposal = () => import('../components/executeAssetDisposal/AssetsDisposal.vue');
+const AccountingSubject = ()=> import('../components/assetPeriodDepreciate/AccountingSubject.vue');
+
 const routes = [
 
   { path: '/eam/hello-world', component: HelloWorld },
@@ -324,6 +326,7 @@ const routes = [
   { path: '/eam/assetManagerDepreciation', component: AssetManagerDepreciation },  // 资产折旧-单位资产管理员
   { path: '/eam/disposalApplication', component: AssetsDisposal }, // 处置申请单
   { path: '/eam/executeAssetDisposal', component: ExecuteAssetDisposal }, // 执行处置
+  { path: '/eam/accountingSubject', component: AccountingSubject }, // 会计科目
 ];