DepreciationDistribution.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <template>
  2. <div>
  3. <div class="flex-container">
  4. <div class="flex-header">
  5. <Navbar
  6. :title="
  7. $t('lang.DepreciationDistribution.distributionOfDismantlingTheOld')
  8. "
  9. is-go-back="true"
  10. />
  11. <div class="form-inline">
  12. <div class="form-group">
  13. <label for="projectItem">
  14. {{ $t("lang.DepreciationDistribution.modeOfDistribution") }}
  15. </label>
  16. <select v-model="type" class="form-control">
  17. <option value="1">
  18. {{
  19. $t("lang.DepreciationDistribution.distributionByDepartment")
  20. }}
  21. </option>
  22. <option value="2">
  23. {{ $t("lang.DepreciationDistribution.distributionByCategory") }}
  24. </option>
  25. </select>
  26. </div>
  27. <div v-if="type == 1" class="form-group">
  28. <label for="projectItem">
  29. {{ $t("lang.DepreciationDistribution.selectMonth") }}
  30. </label>
  31. <select
  32. v-model="selectedAccountDate"
  33. class="form-control"
  34. :value="currentAccountDate"
  35. @change="
  36. queryOrganizationDepreciationDistribution(selectedAccountDate)
  37. "
  38. >
  39. <option
  40. v-for="accountDateDto in accountDateDtos"
  41. :key="accountDateDto.id"
  42. :value="accountDateDto.periodDate"
  43. >
  44. {{ accountDateDto.periodDate
  45. }}{{
  46. currentAccountDate == accountDateDto.periodDate
  47. ? $t("lang.DepreciationDistribution.login")
  48. : ""
  49. }}
  50. </option>
  51. </select>
  52. </div>
  53. <div v-if="type == 2" class="form-group">
  54. <label for="projectItem">
  55. {{ $t("lang.DepreciationDistribution.selectMonth") }}
  56. </label>
  57. <select
  58. v-model="selectedAccountDate"
  59. class="form-control"
  60. :value="currentAccountDate"
  61. @change="
  62. queryCategoryDepreciationDistribution(selectedAccountDate)
  63. "
  64. >
  65. <option
  66. v-for="accountDateDto in accountDateDtos"
  67. :key="accountDateDto.id"
  68. :value="accountDateDto.periodDate"
  69. >
  70. {{ accountDateDto.periodDate
  71. }}{{
  72. currentAccountDate == accountDateDto.periodDate
  73. ? $t("lang.DepreciationDistribution.login")
  74. : ""
  75. }}
  76. </option>
  77. </select>
  78. </div>
  79. <div class="form-group">
  80. <button type="button" class="btn btn-info" @click="query">
  81. {{ $t("lang.DepreciationDistribution.query") }}
  82. </button>
  83. </div>
  84. </div>
  85. </div>
  86. <div class="flex-content">
  87. <table class="fixed-table table table-responsive table-bordered">
  88. <thead v-if="type == 1">
  89. <tr>
  90. <td style="width: 50px">
  91. {{ $t("lang.DepreciationDistribution.serialNumber") }}
  92. </td>
  93. <td style="width: 350px">
  94. {{ $t("lang.DepreciationDistribution.departmentNumber") }}
  95. </td>
  96. <td style="width: 150px">
  97. {{ $t("lang.DepreciationDistribution.departmentName") }}
  98. </td>
  99. <td style="width: 150px">
  100. {{ $t("lang.DepreciationDistribution.projectNumber") }}
  101. </td>
  102. <td style="width: 150px">
  103. {{ $t("lang.DepreciationDistribution.projectName") }}
  104. </td>
  105. <td style="width: 150px">
  106. {{ $t("lang.DepreciationDistribution.courseNumber") }}
  107. </td>
  108. <td style="width: 150px">
  109. {{ $t("lang.DepreciationDistribution.courseName") }}
  110. </td>
  111. <td style="width: 150px">
  112. {{ $t("lang.DepreciationDistribution.depreciation") }}
  113. </td>
  114. </tr>
  115. </thead>
  116. <tbody v-if="organizationDepreciationdatas.length > 0 && type == 1">
  117. <tr v-for="(item, index) in organizationDepreciationdatas" :key="item.id">
  118. <td>{{ index + 1 }}</td>
  119. <td>{{ item.orgnizaitonNo }}</td>
  120. <td>{{ item.organizationName }}</td>
  121. <td>{{ item.projectNo }}</td>
  122. <td>{{ item.projectName }}</td>
  123. <td>{{ item.subjectNo }}</td>
  124. <td>{{ item.subjectName }}</td>
  125. <td>{{ item.depreciationValue }}</td>
  126. </tr>
  127. </tbody>
  128. <thead v-if="type == 2">
  129. <tr>
  130. <td style="width: 50px">
  131. {{ $t("lang.DepreciationDistribution.serialNumber") }}
  132. </td>
  133. <td style="width: 350px">
  134. {{ $t("lang.DepreciationDistribution.categoryNumber") }}
  135. </td>
  136. <td style="width: 150px">
  137. {{ $t("lang.DepreciationDistribution.categoryName") }}
  138. </td>
  139. <td style="width: 150px">
  140. {{ $t("lang.DepreciationDistribution.projectNumber") }}
  141. </td>
  142. <td style="width: 150px">
  143. {{ $t("lang.DepreciationDistribution.projectName") }}
  144. </td>
  145. <td style="width: 150px">
  146. {{ $t("lang.DepreciationDistribution.courseNumber") }}
  147. </td>
  148. <td style="width: 150px">
  149. {{ $t("lang.DepreciationDistribution.courseName") }}
  150. </td>
  151. <td style="width: 150px">
  152. {{ $t("lang.DepreciationDistribution.depreciation") }}
  153. </td>
  154. </tr>
  155. </thead>
  156. <tbody v-if="categoryDepreciationdatas.length > 0 && type == 2">
  157. <tr v-for="(item, index) in categoryDepreciationdatas" :key="item.id">
  158. <td>{{ index + 1 }}</td>
  159. <td>{{ item.categoryNo }}</td>
  160. <td>{{ item.categoryName }}</td>
  161. <td>{{ item.projectNo }}</td>
  162. <td>{{ item.projectName }}</td>
  163. <td>{{ item.subjectNo }}</td>
  164. <td>{{ item.subjectName }}</td>
  165. <td>{{ item.depreciationValue }}</td>
  166. </tr>
  167. </tbody>
  168. </table>
  169. </div>
  170. </div>
  171. </div>
  172. </template>
  173. <script>
  174. import Common from '../../common/Common.js';
  175. import PeriodResource from '../../api/finance/PeriodResource.js';
  176. export default {
  177. components: {
  178. },
  179. data: function () {
  180. return {
  181. accountDateDtos: [], //账套登录时间dto
  182. currentAccountDate: '', //当前时间
  183. selectedAccountDate: '', //选中的时间
  184. organizationDepreciationdatas: [], //折旧数据(按照部门分配)
  185. categoryDepreciationdatas: [], //折旧数据(按照资产分类分配)
  186. type: '1',
  187. };
  188. },
  189. mounted: function () {
  190. this.queryLoginAccountDate();
  191. $('.fixed-table').tableFixer({ left: 3, head: true });
  192. $('.fixed-table').colResizable({
  193. resizeMode: 'overflow',
  194. partialRefresh: true,
  195. });
  196. },
  197. methods: {
  198. query: function () {
  199. var _self = this;
  200. if (_self.type == 1) {
  201. _self.queryOrganizationDepreciationDistribution(
  202. _self.selectedAccountDate,
  203. );
  204. } else {
  205. _self.queryCategoryDepreciationDistribution(_self.selectedAccountDate);
  206. }
  207. },
  208. /**
  209. * 获取账套登录时间
  210. * @return {void}
  211. */
  212. queryLoginAccountDate: function () {
  213. var _self = this;
  214. PeriodResource.listByAccountDate().then(
  215. successData => {
  216. if(successData.errorCode == 0) {
  217. if(successData.datas) {
  218. successData.datas.forEach(function (item) {
  219. item.periodDate = item.beginDate.substring(0, 7);
  220. if (item.isAccountDate) {
  221. _self.currentAccountDate = item.periodDate;
  222. _self.selectedAccountDate = item.periodDate;
  223. }
  224. });
  225. _self.accountDateDtos = successData.datas;
  226. console.log(successData.datas);
  227. _self.query();
  228. }
  229. }
  230. },
  231. errorData => {
  232. Common.processException(errorData);
  233. },
  234. );
  235. },
  236. /**
  237. * 查询折旧分配情况(按部门分配)
  238. * @return {void}
  239. */
  240. queryOrganizationDepreciationDistribution: function (selectedAccountDate) {
  241. var _self = this;
  242. $.ajax({
  243. url: Common.getApiURL(
  244. 'AssetDepreciationResource/queryOrganizationDepreciationDistribution',
  245. ),
  246. type: 'get',
  247. dataType: 'json',
  248. data: {
  249. selectedAccountDate: selectedAccountDate,
  250. },
  251. beforeSend: function (request) {
  252. Common.addTokenToRequest(request);
  253. },
  254. success: function (data) {
  255. _self.organizationDepreciationdatas = data;
  256. _self.fixedTableHeader();
  257. },
  258. error: function (XMLHttpRequest, textStatus, errorThrown) {
  259. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  260. },
  261. });
  262. },
  263. /**
  264. * 查询折旧分配情况(按类别分配)
  265. * @return {void}
  266. */
  267. queryCategoryDepreciationDistribution: function (selectedAccountDate) {
  268. var _self = this;
  269. $.ajax({
  270. url: Common.getApiURL(
  271. 'AssetInstanceResource/queryCategoryDepreciationDistribution',
  272. ),
  273. type: 'get',
  274. dataType: 'json',
  275. data: {
  276. selectedAccountDate: selectedAccountDate,
  277. },
  278. beforeSend: function (request) {
  279. Common.addTokenToRequest(request);
  280. },
  281. success: function (data) {
  282. _self.categoryDepreciationdatas = data;
  283. _self.fixedTableHeader();
  284. },
  285. error: function (XMLHttpRequest, textStatus, errorThrown) {
  286. Common.processException(XMLHttpRequest, textStatus, errorThrown);
  287. },
  288. });
  289. },
  290. /**
  291. * 冻结表头
  292. */
  293. fixedTableHeader: function () {
  294. let _self = this;
  295. _self.$nextTick(function () {
  296. $('.fixed-table').tableFixer({ left: 3, head: true });
  297. });
  298. },
  299. },
  300. };
  301. </script>
  302. <style scoped>
  303. .flex-container {
  304. display: flex;
  305. /* 垂直*/
  306. flex-direction: column;
  307. width: 100%;
  308. /*视口被均分为100单位的vh 占据整个窗口,扣掉顶部topNav的距离后,计算得到container的高度*/
  309. height: calc(100vh - 75px);
  310. }
  311. .flex-header {
  312. height: 200px;
  313. /*放大缩小比例为0 */
  314. flex: 0 0 100px;
  315. }
  316. .flex-footer {
  317. margin-top: 0.8em;
  318. height: 35px;
  319. /*放大缩小比例为0 */
  320. flex: 0 0 35px;
  321. }
  322. .flex-content {
  323. margin-top: 0.8em;
  324. flex: 1;
  325. overflow: scroll;
  326. width: 100%;
  327. height: 0;
  328. }
  329. </style>
  330. <style scoped>
  331. .fixed-table {
  332. table-layout: fixed;
  333. width: 800px !important;
  334. min-width: 800px !important;
  335. }
  336. table.fixed-table tr {
  337. height: 40px;
  338. }
  339. table.fixed-table th,
  340. table.fixed-table td {
  341. overflow: hidden;
  342. white-space: nowrap;
  343. text-overflow: ellipsis;
  344. }
  345. .form-inline .form-group label {
  346. width: 80px;
  347. text-align: right;
  348. padding-right: 5px;
  349. }
  350. .form-inline .form-group input,
  351. .form-inline .form-group select {
  352. width: 200px;
  353. }
  354. </style>