移动端
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 

623 řádky
22 KiB

  1. <template>
  2. <div class="home_wrapper">
  3. <div class="header_main">
  4. 固定资产
  5. <div class="return_btn" @click="onClickLeft"></div>
  6. </div>
  7. <van-form @submit="onSubmit">
  8. <div class="list_main">
  9. <div class="titBox">
  10. <img src="../../assets/images/sunVillage_info/add_icon_1.png" style="width:22PX;height:22PX;margin-right: 10px;"/>
  11. <p class="tit">基本信息</p>
  12. </div>
  13. <van-field v-model="form.code" label="资产编码" placeholder="不输入时系统自动分配" input-align="right" :border="false" />
  14. <van-field required :rules="[{ required: true, message: '请填写资产名称' }]" v-model="form.name" label="资产名称" placeholder="资产名称" input-align="right" :border="false" />
  15. <van-field
  16. readonly
  17. clickable
  18. label="资产类别"
  19. placeholder="请选择"
  20. v-model="assetType"
  21. @click="showAssetType = true"
  22. input-align="right"
  23. right-icon="arrow-down"
  24. label-width="auto"
  25. required
  26. :border="false"
  27. :rules="[{ required: true , message:'请选择资产类别' }]"
  28. />
  29. <van-popup v-model="showAssetType" position="bottom">
  30. <van-picker
  31. show-toolbar
  32. :columns="assetTypeOptions"
  33. @confirm="onConfirmAssetType"
  34. @cancel="showAssetType = false"
  35. />
  36. </van-popup>
  37. <van-field
  38. readonly
  39. clickable
  40. label="经营属性"
  41. placeholder="请选择"
  42. v-model="operationType"
  43. @click="showOperationType = true"
  44. input-align="right"
  45. right-icon="arrow-down"
  46. label-width="auto"
  47. required
  48. :border="false"
  49. :rules="[{ required: true , message:'请选择经营属性' }]"
  50. />
  51. <van-popup v-model="showOperationType" position="bottom">
  52. <van-picker
  53. show-toolbar
  54. :columns="operationTypeOptions"
  55. @confirm="onConfirmOperationType"
  56. @cancel="showOperationType = false"
  57. />
  58. </van-popup>
  59. <van-field
  60. readonly
  61. clickable
  62. label="增加方式"
  63. placeholder="请选择"
  64. v-model="addType"
  65. @click="showAddType = true"
  66. input-align="right"
  67. right-icon="arrow-down"
  68. label-width="auto"
  69. required
  70. :border="false"
  71. :rules="[{ required: true , message:'请选择增加方式' }]"
  72. />
  73. <van-popup v-model="showAddType" position="bottom">
  74. <van-picker
  75. show-toolbar
  76. :columns="addTypeOptions"
  77. @confirm="onConfirmAddType"
  78. @cancel="showAddType = false"
  79. />
  80. </van-popup>
  81. <van-field
  82. readonly
  83. clickable
  84. label="购建时间"
  85. placeholder="请选择"
  86. v-model="form.buildTime"
  87. @click="showBuildTime = true"
  88. input-align="right"
  89. right-icon="arrow-down"
  90. label-width="auto"
  91. required
  92. :border="false"
  93. :rules="[{ required: true , message:'请选择购建时间' }]"
  94. />
  95. <van-popup v-model="showBuildTime" position="bottom">
  96. <van-datetime-picker
  97. type="date"
  98. title="选择年月日"
  99. :min-date="minDate"
  100. v-model="buildTime"
  101. @confirm="onConfirmBuildTime"
  102. @cancel="showBuildTime = false"
  103. />
  104. </van-popup>
  105. <van-field v-model="form.location" label="坐落位置" placeholder="坐落位置" input-align="right" :border="false" />
  106. <van-field v-model="form.specification" label="规格型号" placeholder="规格型号" input-align="right" :border="false" />
  107. <van-field v-model="form.supplier" label="供应商" placeholder="供应商" input-align="right" :border="false" />
  108. <van-field
  109. readonly
  110. clickable
  111. label="使用情况"
  112. placeholder="请选择"
  113. v-model="useType"
  114. @click="showUseType = true"
  115. input-align="right"
  116. right-icon="arrow-down"
  117. label-width="auto"
  118. required
  119. :border="false"
  120. :rules="[{ required: true , message:'请选择使用情况' }]"
  121. />
  122. <van-popup v-model="showUseType" position="bottom">
  123. <van-picker
  124. show-toolbar
  125. :columns="useTypeOptions"
  126. @confirm="onConfirmUseType"
  127. @cancel="showUseType = false"
  128. />
  129. </van-popup>
  130. <van-field
  131. readonly
  132. clickable
  133. label="资产状态"
  134. placeholder="请选择"
  135. v-model="assetStatus"
  136. @click="showAssetStatus = true"
  137. input-align="right"
  138. right-icon="arrow-down"
  139. label-width="auto"
  140. required
  141. :border="false"
  142. :rules="[{ required: true , message:'请选择资产状态' }]"
  143. />
  144. <van-popup v-model="showAssetStatus" position="bottom">
  145. <van-picker
  146. show-toolbar
  147. :columns="assetStatusOptions"
  148. @confirm="onConfirmAssetStatus"
  149. @cancel="showAssetStatus = false"
  150. />
  151. </van-popup>
  152. <van-field name="radio" label="单元资产" input-align="right" :border="false">
  153. <template #input>
  154. <van-radio-group v-model="form.isMin" direction="horizontal">
  155. <van-radio name="Y">是</van-radio>
  156. <van-radio name="N">否</van-radio>
  157. </van-radio-group>
  158. </template>
  159. </van-field>
  160. <van-field name="radio" label="扶贫资产" input-align="right" :border="false">
  161. <template #input>
  162. <van-radio-group v-model="form.isFormAsset" direction="horizontal">
  163. <van-radio name="Y">是</van-radio>
  164. <van-radio name="N">否</van-radio>
  165. </van-radio-group>
  166. </template>
  167. </van-field>
  168. </div>
  169. <div class="list_main">
  170. <div class="titBox">
  171. <img src="../../assets/images/sunVillage_info/add_icon_1.png" style="width:22PX;height:22PX;margin-right: 10px;"/>
  172. <p class="tit">资产数据</p>
  173. </div>
  174. <van-field required label="数量/面积" input-align="right" :border="false">
  175. <template #input>
  176. <van-stepper v-model="form.quantity" input-width="100" :decimal-length="2" />
  177. </template>
  178. </van-field>
  179. <van-field required :rules="[{ required: true, message: '请填写计量单位' }]" v-model="form.unit" label="计量单位" placeholder="计量单位" input-align="right" :border="false" />
  180. <van-field required label="原值(元)" input-align="right" :border="false">
  181. <template #input>
  182. <van-stepper v-model="form.originalValue" input-width="100" min="0.00" :decimal-length="2" @change="changeOriginalValue"/>
  183. </template>
  184. </van-field>
  185. <van-field label="净值(元)" input-align="right" :border="false">
  186. <template #input>
  187. <van-stepper v-model="form.netValue" disabled input-width="100" min="0.00" :decimal-length="2" />
  188. </template>
  189. </van-field>
  190. <van-field label="残值率N%" input-align="right" :border="false">
  191. <template #input>
  192. <van-stepper v-model="form.residualsRate" input-width="100" @change="changeResidualsRate"/>
  193. </template>
  194. </van-field>
  195. <van-field label="净残值(元)" input-align="right" :border="false">
  196. <template #input>
  197. <van-stepper v-model="form.netSalvage" input-width="100" min="0.00" :decimal-length="2" @changexxx="changeNetSalvage" />
  198. </template>
  199. </van-field>
  200. <van-field readonly v-model="form.fixedValue" label="资产清理(元)" placeholder="无需输入" input-align="right" :border="false" />
  201. <van-field readonly v-model="form.fixedSubject" label="资产清理科目" placeholder="资产清理科目" input-align="right" :border="false" />
  202. <van-field readonly v-model="form.depreciationSubject" label="折旧科目" placeholder="折旧科目" input-align="right" :border="false" />
  203. <van-field readonly v-model="form.depreciationFeeSubject" label="折旧费用科目" placeholder="折旧费用科目" input-align="right" :border="false" />
  204. <van-field v-model="form.remark" label="备注" placeholder="备注" input-align="right" :border="false" />
  205. </div>
  206. <div class="list_main">
  207. <div class="titBox">
  208. <img src="../../assets/images/sunVillage_info/add_icon_1.png" style="width:22PX;height:22PX;margin-right: 10px;"/>
  209. <p class="tit">折旧方式</p>
  210. </div>
  211. <van-field
  212. readonly
  213. clickable
  214. label="折旧方式"
  215. placeholder="请选择"
  216. v-model="depreciationType"
  217. @click="showDepreciationType = true"
  218. input-align="right"
  219. right-icon="arrow-down"
  220. label-width="auto"
  221. required
  222. :border="false"
  223. :rules="[{ required: true , message:'请选择折旧方式' }]"
  224. />
  225. <van-popup v-model="showDepreciationType" position="bottom">
  226. <van-picker
  227. show-toolbar
  228. :columns="depreciationTypeOptions"
  229. @confirm="onConfirmDepreciationType"
  230. @cancel="showDepreciationType = false"
  231. />
  232. </van-popup>
  233. <van-field label="预计使用期数" input-align="right" :border="false">
  234. <template #input>
  235. <van-stepper v-model="form.expectedYears" input-width="100" @change="changeExpectedYears" />
  236. </template>
  237. </van-field>
  238. <van-field readonly v-model="form.perYearDepreciationValue" label="每期折旧额" placeholder="(原值-净残值)/预计使用期数" input-align="right" :border="false" />
  239. <van-field label="已折旧期数" input-align="right" :border="false">
  240. <template #input>
  241. <van-stepper v-model="form.depreciationYears" input-width="100" min="0" @change="changeDepreciationYears" />
  242. </template>
  243. </van-field>
  244. <van-field v-model="form.depreciationValue" label="累计折旧(元)" placeholder="0" input-align="right" :border="false" @change="changeDepreciationValue"
  245. >
  246. <template #button>
  247. <van-button size="small" type="primary" round @click="calcDepreciationValue" native-type="button">重新计算</van-button>
  248. </template>
  249. </van-field>
  250. </div>
  251. <div style="margin: 16px auto;width: 50%;">
  252. <van-button round block type="primary" native-type="submit">
  253. 保存
  254. </van-button>
  255. </div>
  256. </van-form>
  257. </div>
  258. </template>
  259. <script>
  260. import { addPermanent } from "@/api/sunVillage_info/fixedAssets";
  261. export default {
  262. name: "certificateList",
  263. data() {
  264. return {
  265. minDate:new Date(1900,1,1),
  266. applicationList:[],
  267. applicationListSecond:[],
  268. form:{
  269. assetType:'151001',
  270. operationType:'1',
  271. addType:'1',
  272. buildTime:this.format(new Date(),'yyyy-MM-dd'),
  273. useType:'1',
  274. assetStatus:'1',
  275. isMin:'Y',
  276. isFormAsset:'N',
  277. quantity:1.00,
  278. depreciationSubject:"152:累计折旧",
  279. fixedSubject:"153:固定资产清理",
  280. depreciationFeeSubject:"541005:管理费用-折旧及修理费",
  281. depreciationType:'3',
  282. expectedYears:1,
  283. depreciationYears:0,
  284. netValue:0.00,
  285. originalValue:0.00,
  286. residualsRate:1,
  287. netSalvage:0.00,
  288. fixedValue:null,
  289. perYearDepreciationValue:null,
  290. depreciationValue:0
  291. },
  292. //资产类别
  293. assetType:'房屋及建筑物',
  294. showAssetType:false,
  295. assetTypeOptions:[],
  296. //经营属性
  297. operationType:'经营性',
  298. showOperationType:false,
  299. operationTypeOptions:[],
  300. //增加方式
  301. addTypeOptions:[],
  302. showAddType:false,
  303. addType:'购入',
  304. //使用情况
  305. useTypeOptions:[],
  306. showUseType:false,
  307. useType:'自用',
  308. //资产状态
  309. assetStatusOptions:[],
  310. showAssetStatus:false,
  311. assetStatus:'正常',
  312. //资产状态
  313. depreciationTypeOptions:[],
  314. showDepreciationType:false,
  315. depreciationType:'不折旧',
  316. showBuildTime:false,
  317. auditStatus:[],
  318. loading: false,
  319. finished: false,
  320. listLength:'0',
  321. searchInput:'',
  322. queryParams:{
  323. pageNum:1,
  324. pageSize:10,
  325. orderByColumn:'createTime',
  326. isAsc:'desc',
  327. name:'',
  328. },
  329. buildTime:new Date()
  330. };
  331. },
  332. created() {
  333. this.houseGetDicts("asset_type").then((response) => {
  334. for(var i = 0 ; i < response.data.length ; i++){
  335. this.assetTypeOptions.push({text:response.data[i].dictLabel,value:response.data[i].dictValue});
  336. }
  337. });
  338. this.houseGetDicts("operation_type").then((response) => {
  339. for(var i = 0 ; i < response.data.length ; i++){
  340. this.operationTypeOptions.push({text:response.data[i].dictLabel,value:response.data[i].dictValue});
  341. }
  342. });
  343. this.houseGetDicts("add_type").then((response) => {
  344. for(var i = 0 ; i < response.data.length ; i++){
  345. this.addTypeOptions.push({text:response.data[i].dictLabel,value:response.data[i].dictValue});
  346. }
  347. });
  348. this.houseGetDicts("use_type").then((response) => {
  349. for(var i = 0 ; i < response.data.length ; i++){
  350. this.useTypeOptions.push({text:response.data[i].dictLabel,value:response.data[i].dictValue});
  351. }
  352. });
  353. this.houseGetDicts("asset_status").then((response) => {
  354. for(var i = 0 ; i < response.data.length ; i++){
  355. this.assetStatusOptions.push({text:response.data[i].dictLabel,value:response.data[i].dictValue});
  356. }
  357. });
  358. this.houseGetDicts("depreciation_type").then((response) => {
  359. for(var i = 0 ; i < response.data.length ; i++){
  360. this.depreciationTypeOptions.push({text:response.data[i].dictLabel,value:response.data[i].dictValue});
  361. }
  362. });
  363. },
  364. methods: {
  365. onConfirmAssetType(data){
  366. this.assetType = data.text;
  367. this.form.assetType = data.value;
  368. this.showAssetType = false;
  369. },
  370. onConfirmOperationType(data){
  371. this.operationType = data.text;
  372. this.form.operationType = data.value;
  373. this.showOperationType = false;
  374. },
  375. onConfirmAddType(data){
  376. this.addType = data.text;
  377. this.form.addType = data.value;
  378. this.showAddType = false;
  379. },
  380. onConfirmUseType(data){
  381. this.useType = data.text;
  382. this.form.useType = data.value;
  383. this.showUseType = false;
  384. },
  385. onConfirmAssetStatus(data){
  386. this.assetStatus = data.text;
  387. this.form.assetStatus = data.value;
  388. this.showAssetStatus = false;
  389. },
  390. onConfirmDepreciationType(data){
  391. this.depreciationType = data.text;
  392. this.form.depreciationType = data.value;
  393. this.showDepreciationType = false;
  394. },
  395. onConfirmBuildTime(data){
  396. this.form.buildTime = this.format(data,'yyyy-MM-dd');
  397. this.showBuildTime = false;
  398. },
  399. // 原值变动监听
  400. changeOriginalValue(val) {
  401. if (this.form.depreciationValue != null) {
  402. // 净值 = 原值-累计折旧
  403. this.form.netValue = val - this.form.depreciationValue;
  404. }
  405. if (this.form.residualsRate != null) {
  406. // 净残值 = 原值*残值率
  407. this.form.netSalvage = (val * this.form.residualsRate) / 100;
  408. }
  409. if (this.form.netSalvage != null && this.form.expectedYears != null) {
  410. // 每年折旧额 = (原值-净残值)/ 预计使用年数
  411. this.form.perYearDepreciationValue =
  412. (val - this.form.netSalvage) / this.form.expectedYears;
  413. }
  414. },
  415. // 累计折旧变动监听
  416. changeDepreciationValue(val) {
  417. if (val == null)
  418. return;
  419. // 每期折旧额 = (原值-净残值)/ 预计使用期数
  420. let depreciation = this.form.originalValue - this.form.netSalvage;
  421. depreciation -= val;
  422. let periods = this.form.expectedYears - (this.form.depreciationYears || 0);
  423. if(periods > 0 && depreciation > 0)
  424. this.form.perYearDepreciationValue = (depreciation / periods).toFixed(2);
  425. else
  426. this.form.perYearDepreciationValue = 0;
  427. // 净值 = 原值-累计折旧
  428. this.form.netValue = (this.form.originalValue || 0) - val;
  429. },
  430. // 残值率变动监听
  431. changeResidualsRate(val) {
  432. if (val == null)
  433. return;
  434. // 净残值 = 原值*残值率
  435. this.form.netSalvage = val > 0 ? ((this.form.originalValue * val) / 100).toFixed(2) : 0;
  436. if (this.form.expectedYears > 0) {
  437. // 每期折旧额 = (原值-净残值)/ 预计使用期数
  438. let depreciation = this.form.originalValue - (this.form.netSalvage || 0);
  439. depreciation -= (this.form.depreciationValue || 0);
  440. let periods = this.form.expectedYears - (this.form.depreciationYears || 0);
  441. if(periods > 0 && depreciation > 0)
  442. this.form.perYearDepreciationValue = (depreciation / periods).toFixed(2);
  443. else
  444. this.form.perYearDepreciationValue = 0;
  445. }
  446. else
  447. this.form.perYearDepreciationValue = 0;
  448. },
  449. // 净残值变动监听
  450. changeNetSalvage(val) {
  451. if (this.form.originalValue != null && this.form.expectedYears != null) {
  452. // 每年折旧额 = (原值-净残值)/ 预计使用年数
  453. this.form.perYearDepreciationValue =
  454. (this.form.originalValue - val) / this.form.expectedYears;
  455. }
  456. },
  457. // 预计使用年数变动监听
  458. changeExpectedYears(val) {
  459. if (val == null)
  460. return;
  461. // 每期折旧额 = (原值-净残值)/ 预计使用期数
  462. let depreciation = this.form.originalValue - this.form.netSalvage;
  463. depreciation -= this.form.depreciationValue;
  464. let periods = val - (this.form.depreciationYears || 0);
  465. if(periods > 0 && depreciation > 0)
  466. this.form.perYearDepreciationValue = (depreciation / periods).toFixed(2);
  467. else
  468. this.form.perYearDepreciationValue = 0;
  469. },
  470. // 已折旧年数变动监听
  471. changeDepreciationYears(val) {
  472. if (val == null)
  473. return;
  474. //if(!this.form.depreciationValueManual)
  475. {
  476. if (this.form.perYearDepreciationValue > 0) {
  477. // 累计折旧 = 已折旧期数 * 每期折旧额
  478. this.form.depreciationValue = val * this.form.perYearDepreciationValue;
  479. }
  480. else
  481. this.form.depreciationValue = 0;
  482. }
  483. // 净值 = 原值-累计折旧
  484. this.form.netValue = (this.form.originalValue || 0) - (this.form.depreciationValue || 0);
  485. },
  486. onSubmit(){
  487. addPermanent(this.form).then((response) => {
  488. if (response.code == 200){
  489. this.$notify({ type: 'success', message: '新增成功' });
  490. setTimeout(function(){
  491. history.back(-1);
  492. },2000)
  493. }
  494. });
  495. },
  496. calcDepreciationValue() {
  497. this.form.depreciationValue = 0;
  498. const depreciationYears = this.form.depreciationYears;
  499. this.form.depreciationYears = 0;
  500. this.changeOriginalValue(this.form.originalValue);
  501. this.form.depreciationYears = depreciationYears;
  502. this.changeDepreciationYears(depreciationYears);
  503. },
  504. },
  505. }
  506. </script>
  507. <style scoped lang="scss">
  508. /deep/ .van-button--primary{
  509. background: url("../../assets/images/sunVillage_info/btn_bg.png") no-repeat;
  510. background-size: 100% 100%;
  511. border: none;
  512. }
  513. .home_wrapper{
  514. background: #e9e9e9;
  515. min-height: 100vh;
  516. width: 100vw;
  517. .header_main {
  518. height: 116px;
  519. background: url('../../assets/images/sunVillage_info/list_head.png') no-repeat;
  520. background-size: 100% 100%;
  521. position: fixed;
  522. top: 0;
  523. left: 0;
  524. width: 100%;
  525. font-size: 36px;
  526. line-height: 116px;
  527. text-align: center;
  528. color: #fff;
  529. position: relative;
  530. .return_btn {
  531. width: 24px;
  532. height: 43.2px;
  533. background: url('../../assets/images/sunVillage_info/list_icon_5.png') center center no-repeat;
  534. background-size: 20px 36px;
  535. position: absolute;
  536. left: 38px;
  537. top: 36px;
  538. }
  539. .add_btn {
  540. width: 56.4px;
  541. height: 40.8px;
  542. background: url('../../assets/images/sunVillage_info/list_icon_9.png') center center no-repeat;
  543. background-size: 47px 34px;
  544. position: absolute;
  545. right: 38px;
  546. top: 36px;
  547. }
  548. }
  549. .list_main{
  550. padding:25px;
  551. background: #ffffff;
  552. width: 94%;
  553. margin: 25px auto 0;
  554. border-radius: 15PX;
  555. box-shadow: 4px 6px 5px rgba(63, 68, 75, 0.1);
  556. }
  557. .titBox{
  558. display: flex;
  559. align-items: center;
  560. }
  561. .tit{
  562. font-size: 36px;
  563. font-weight: bold;
  564. }
  565. /deep/ .van-cell{
  566. padding-left: 0!important;
  567. padding-right: 0!important;
  568. padding-bottom: 0!important;
  569. }
  570. /deep/ .van-field__label{
  571. padding-left: 10PX;
  572. width: 8.2em;
  573. }
  574. /deep/ .van-cell--required::before{
  575. left: 0;
  576. }
  577. }
  578. </style>