AssetBasicSetting.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893
  1. <template>
  2. <div class="container-fluid">
  3. <Navbar
  4. :title="$t('lang.assetBasicSetting.assetConfig')"
  5. :is-go-back="false"
  6. />
  7. <div class="row" style="margin-bottom: 15px">
  8. <div class="col-md-12">
  9. <ul class="nav nav-tabs">
  10. <li
  11. role="presentation"
  12. :class="{ active: functionType == 1 }"
  13. @click="selectPage(1)"
  14. >
  15. <a href="javascript:void(0)">{{
  16. $t("lang.assetBasicSetting.baseInformation")
  17. }}</a>
  18. </li>
  19. <li
  20. role="presentation"
  21. :class="{ active: functionType == 2 }"
  22. @click="selectPage(2)"
  23. >
  24. <a href="javascript:void(0)">{{
  25. $t("lang.assetBasicSetting.depreciationInformation")
  26. }}</a>
  27. </li>
  28. <li
  29. role="presentation"
  30. :class="{ active: functionType == 3 }"
  31. @click="selectPage(3)"
  32. >
  33. <a href="javascript:void(0)">{{
  34. $t("lang.assetBasicSetting.encodingMethod")
  35. }}</a>
  36. </li>
  37. <li
  38. role="presentation"
  39. :class="{ active: functionType == 4 }"
  40. @click="selectPage(4)"
  41. >
  42. <a href="javascript:void(0)">{{
  43. $t("lang.assetBasicSetting.systemIntegration")
  44. }}</a>
  45. </li>
  46. <li
  47. role="presentation"
  48. :class="{ active: functionType == 5 }"
  49. @click="selectPage(5)"
  50. >
  51. <a href="javascript:void(0)">{{
  52. $t("lang.assetBasicSetting.picture")
  53. }}</a>
  54. </li>
  55. </ul>
  56. </div>
  57. </div>
  58. <div v-show="functionType == 1">
  59. <div>
  60. <div class="form-group">
  61. <label>{{ $t("lang.assetBasicSetting.setNo") }}</label>
  62. <input
  63. autocomplete="off"
  64. type="text"
  65. :value="loginContextDto.accountId"
  66. disabled="true"
  67. class="form-control"
  68. />
  69. </div>
  70. <div class="form-group">
  71. <label>{{ $t("lang.assetBasicSetting.setName") }}</label>
  72. <input
  73. autocomplete="off"
  74. type="text"
  75. :value="loginContextDto.accountName"
  76. disabled="true"
  77. class="form-control"
  78. />
  79. </div>
  80. <div class="form-group">
  81. <label>{{ $t("lang.assetBasicSetting.userClient") }}</label>
  82. <input
  83. autocomplete="off"
  84. type="text"
  85. :value="loginContextDto.clientName"
  86. disabled="true"
  87. class="form-control"
  88. />
  89. </div>
  90. <div
  91. v-if="assetConfigDto != null && assetConfigDto.id != null"
  92. class="form-group"
  93. >
  94. <label>{{
  95. $t("lang.assetBasicSetting.printPictureOfAssetCard")
  96. }}</label>
  97. <div class="input-group">
  98. <ImageEditor
  99. :class-name="'com.leanwo.prodog.asset.model.AssetConfig'"
  100. :record-id="assetConfigDto.id"
  101. :field-name="'imageName'"
  102. :readonly="isdisable"
  103. :image-name="imageName"
  104. />
  105. </div>
  106. </div>
  107. <div class="checkbox">
  108. <label>
  109. <input
  110. v-model="assetConfigDto.enableDepreciation"
  111. autocomplete="off"
  112. type="checkbox"
  113. :disabled="isdisable"
  114. />{{ $t("lang.assetBasicSetting.depreciationOfThisSet") }}
  115. </label>
  116. </div>
  117. <div class="form-group">
  118. <label>{{ $t("lang.assetBasicSetting.companyPrefix") }}</label>
  119. <input
  120. v-model="assetConfigDto.clientPrefix"
  121. autocomplete="off"
  122. type="text"
  123. :disabled="isdisable"
  124. class="form-control"
  125. />
  126. </div>
  127. <div class="checkbox">
  128. <label>
  129. <input
  130. v-model="assetConfigDto.enableAssetCheck"
  131. autocomplete="off"
  132. type="checkbox"
  133. :disabled="isdisable"
  134. />{{
  135. $t("lang.assetBasicSetting.enableAssetAcceptanceAndWarehousing")
  136. }}
  137. </label>
  138. </div>
  139. <div class="checkbox">
  140. <label>
  141. <input
  142. v-model="assetConfigDto.showUnrecognizedAssets"
  143. autocomplete="off"
  144. type="checkbox"
  145. :disabled="isdisable"
  146. />{{
  147. $t("lang.assetBasicSetting.assetCountShowsUnrecognizedAsset")
  148. }}
  149. </label>
  150. </div>
  151. <div class="form-group">
  152. <label>{{
  153. $t("lang.assetBasicSetting.minimumTimeForAssetCollectionAndReturn")
  154. }}</label>
  155. <input
  156. v-model="assetConfigDto.assetInstanceStockInAndStockOutMinTime"
  157. autocomplete="off"
  158. type="number"
  159. :disabled="isdisable"
  160. class="form-control"
  161. />
  162. </div>
  163. <div class="checkbox">
  164. <label>
  165. <input
  166. v-model="assetConfigDto.allowOrganizationBatchChange"
  167. autocomplete="off"
  168. type="checkbox"
  169. :disabled="isdisable"
  170. />{{
  171. $t(
  172. "lang.assetBasicSetting.batchGenerationOfDepartmentChangeDocuments"
  173. )
  174. }}
  175. </label>
  176. </div>
  177. </div>
  178. </div>
  179. <div v-show="functionType == 2">
  180. <div>
  181. <div class="form-group">
  182. <label>{{
  183. $t("lang.assetBasicSetting.mainDepreciationMethods")
  184. }}</label>
  185. <select
  186. v-model="assetConfigDto.depreciationMethod"
  187. class="form-control"
  188. :disabled="isdisable"
  189. >
  190. <option v-for="depreciationMethodDto in depreciationMethodDtos" :key="depreciationMethodDto.id">
  191. {{ depreciationMethodDto.text }}
  192. </option>
  193. </select>
  194. </div>
  195. <div class="form-group">
  196. <label>{{
  197. $t("lang.assetBasicSetting.depreciationSummaryAllocationPeriod")
  198. }}</label>
  199. <select
  200. v-model="assetConfigDto.depreciationDistributionPeriod"
  201. :disabled="isdisable"
  202. class="form-control"
  203. >
  204. <option>{{ $t("lang.assetBasicSetting.one") }}</option>
  205. <option>{{ $t("lang.assetBasicSetting.two") }}</option>
  206. <option>{{ $t("lang.assetBasicSetting.three") }}</option>
  207. <option>{{ $t("lang.assetBasicSetting.four") }}</option>
  208. <option>{{ $t("lang.assetBasicSetting.six") }}</option>
  209. <option>{{ $t("lang.assetBasicSetting.twelve") }}</option>
  210. </select>
  211. </div>
  212. <div class="form-group">
  213. <label>{{
  214. $t("lang.assetBasicSetting.nextDepreciationAllocationMonth")
  215. }}</label>
  216. <Date
  217. v-model="assetConfigDto.nextDeprecitonDistributionDate"
  218. :readonly="isdisable"
  219. />
  220. </div>
  221. <div class="form-group">
  222. <label>{{ $t("lang.assetBasicSetting.monthOfOpeningASet") }}</label>
  223. <Date
  224. v-model="assetConfigDto.depreciationStartDate"
  225. :readonly="isdisable"
  226. />
  227. </div>
  228. <div class="checkbox">
  229. <label>
  230. <input
  231. v-model="assetConfigDto.orginalValueChangeActiveCurrentMonth"
  232. autocomplete="off"
  233. type="checkbox"
  234. :disabled="isdisable"
  235. />
  236. {{
  237. $t(
  238. "lang.assetBasicSetting.changesInOriginalValueTakeEffectInTheCurrentPeriod"
  239. )
  240. }}
  241. </label>
  242. </div>
  243. <div class="checkbox">
  244. <label>
  245. <input
  246. v-model="assetConfigDto.netSalvageChangeActiveCurrentMonth"
  247. autocomplete="off"
  248. type="checkbox"
  249. :disabled="isdisable"
  250. />
  251. {{ $t("lang.assetBasicSetting.theAdjustment") }}
  252. </label>
  253. </div>
  254. <div class="checkbox">
  255. <label>
  256. <input
  257. v-model="
  258. assetConfigDto.accumulateDepreciationChangeActiveCurrentMonth
  259. "
  260. autocomplete="off"
  261. type="checkbox"
  262. :disabled="isdisable"
  263. />
  264. {{ $t("lang.assetBasicSetting.depreciationEffectiveAdjustment") }}
  265. </label>
  266. </div>
  267. <div class="checkbox">
  268. <label>
  269. <input
  270. v-model="assetConfigDto.reservedValueDepreciateInLastMonth"
  271. autocomplete="off"
  272. type="checkbox"
  273. :disabled="isdisable"
  274. />{{ $t("lang.assetBasicSetting.When") }}
  275. </label>
  276. </div>
  277. </div>
  278. </div>
  279. <div v-show="functionType == 3">
  280. <div>
  281. <div class="form-group">
  282. <label>{{ $t("lang.assetBasicSetting.assetCategoryCodingMethod") }}({{
  283. $t("lang.assetBasicSetting.totalLength")
  284. }}:{{ getTotalNum(assetConfigDto.assetCategoryNoEncode) }})</label>
  285. <input
  286. v-model="assetConfigDto.assetCategoryNoEncode"
  287. autocomplete="off"
  288. type="text"
  289. class="form-control"
  290. :disabled="isdisable"
  291. />
  292. </div>
  293. <div class="form-group">
  294. <label>{{
  295. $t("lang.assetBasicSetting.assetNumberCodingMethod")
  296. }}</label>
  297. <div class="radio">
  298. <label>
  299. <input
  300. v-model="assetConfigDto.assetNoAutoEncode"
  301. autocomplete="off"
  302. type="radio"
  303. name="codeType"
  304. value="false"
  305. :checked="!assetConfigDto.assetNoAutoEncode"
  306. :disabled="isdisable"
  307. />{{ $t("lang.assetBasicSetting.manualEncoding") }}
  308. </label>
  309. </div>
  310. <div class="radio">
  311. <label>
  312. <input
  313. v-model="assetConfigDto.assetNoAutoEncode"
  314. autocomplete="off"
  315. type="radio"
  316. name="codeType"
  317. value="true"
  318. :checked="assetConfigDto.assetNoAutoEncode"
  319. :disabled="isdisable"
  320. />{{ $t("lang.assetBasicSetting.automaticCoding") }}
  321. </label>
  322. </div>
  323. </div>
  324. <div class="form-group">
  325. <label>{{ $t("lang.assetBasicSetting.assetCodeCategory") }}</label>
  326. <select
  327. v-model="assetConfigDto.assetCodeType"
  328. class="form-control"
  329. :disabled="isdisable"
  330. >
  331. <option value="CATEGORYNO_SERIALNO">
  332. {{ $t("lang.assetBasicSetting.categoryNumberAndSerialNumber") }}
  333. </option>
  334. <option value="ORGNIZATIONNO_SERIALNO">
  335. {{ $t("lang.assetBasicSetting.departmentNumberAndSerialNumber") }}
  336. </option>
  337. <option value="CLIENTNO_MANUAL">
  338. {{ $t("lang.assetBasicSetting.companyNumberAndManualInput") }}
  339. </option>
  340. </select>
  341. </div>
  342. <div class="form-group">
  343. <label>{{ $t("lang.assetBasicSetting.assetCodeLength") }}</label>
  344. <input
  345. v-model="assetConfigDto.assetNoLength"
  346. autocomplete="off"
  347. type="text"
  348. class="form-control"
  349. :disabled="isdisable"
  350. />
  351. </div>
  352. <div class="form-group">
  353. <label>{{ $t("lang.assetBasicSetting.assetSerialNumber") }}</label>
  354. <input
  355. v-model="assetConfigDto.assetNoSerialNo"
  356. autocomplete="off"
  357. type="text"
  358. class="form-control"
  359. :disabled="isdisable"
  360. />
  361. </div>
  362. <div class="form-group">
  363. <label>{{ $t("lang.assetBasicSetting.assetGroupCodingMethod") }}({{
  364. $t("lang.assetBasicSetting.totalLength")
  365. }}:{{ getTotalNum(assetConfigDto.assetGroupNoEncode) }})</label>
  366. <input
  367. v-model="assetConfigDto.assetGroupNoEncode"
  368. autocomplete="off"
  369. type="text"
  370. class="form-control"
  371. :disabled="isdisable"
  372. />
  373. </div>
  374. <div class="form-group">
  375. <label>{{
  376. $t("lang.assetBasicSetting.assetCardNumberCodingMethod")
  377. }}</label>
  378. <div class="radio">
  379. <label>
  380. <input
  381. v-model="assetConfigDto.assetInstanceBarCodeAutoEncode"
  382. autocomplete="off"
  383. type="radio"
  384. name="assetInstanceBarCodeAutoEncode"
  385. value="false"
  386. :checked="!assetConfigDto.assetInstanceBarCodeAutoEncode"
  387. :disabled="isdisable"
  388. />{{ $t("lang.assetBasicSetting.manualEncoding") }}
  389. </label>
  390. </div>
  391. <div class="radio">
  392. <label>
  393. <input
  394. v-model="assetConfigDto.assetInstanceBarCodeAutoEncode"
  395. autocomplete="off"
  396. type="radio"
  397. name="assetInstanceBarCodeAutoEncode"
  398. value="true"
  399. :checked="assetConfigDto.assetInstanceBarCodeAutoEncode"
  400. :disabled="isdisable"
  401. />{{ $t("lang.assetBasicSetting.automaticCoding") }}
  402. </label>
  403. </div>
  404. </div>
  405. <div class="form-group">
  406. <label>{{
  407. $t("lang.assetBasicSetting.assetCardCodingMethod")
  408. }}</label>
  409. <select
  410. v-model="assetConfigDto.assetInstanceCodeType"
  411. class="form-control"
  412. :disabled="isdisable"
  413. >
  414. <option value="ASSET_NO_SERIALNO">
  415. {{ $t("lang.assetBasicSetting.assetNumberAndSequenceNumber") }}
  416. </option>
  417. <option value="CLIENT_ASSET_NO_SERIALNO">
  418. {{
  419. $t(
  420. "lang.assetBasicSetting.companyPrefixAndAssetNumberAndSequenceNumber"
  421. )
  422. }}
  423. </option>
  424. <option value="CODE_DEFINITION">
  425. {{
  426. $t("lang.assetBasicSetting.calculateAccordingToCodeDefinition")
  427. }}
  428. </option>
  429. </select>
  430. </div>
  431. </div>
  432. </div>
  433. <div v-show="functionType == 4">
  434. <div>
  435. <div class="form-group">
  436. <label>{{
  437. $t("lang.assetBasicSetting.u8DatabaseLinkString")
  438. }}(jdbc:sqlserver://ip:port;databaseName=db_name;user=name;password=password)</label>
  439. <input
  440. v-model="assetConfigDto.u8DbUrl"
  441. autocomplete="off"
  442. type="text"
  443. class="form-control"
  444. :disabled="isdisable"
  445. />
  446. </div>
  447. <div class="form-group">
  448. <label>{{
  449. $t("lang.assetBasicSetting.imageDatabaseLinkString")
  450. }}(jdbc:sqlserver://ip:port;databaseName=db_name;user=name;password=password)</label>
  451. <input
  452. v-model="assetConfigDto.imageJdbc"
  453. autocomplete="off"
  454. type="text"
  455. class="form-control"
  456. :disabled="isdisable"
  457. />
  458. </div>
  459. <div class="form-group">
  460. <label>{{
  461. $t("lang.assetBasicSetting.imageServerRootDirectory")
  462. }}</label>
  463. <input
  464. v-model="assetConfigDto.imageServerBaseUrl"
  465. autocomplete="off"
  466. type="text"
  467. class="form-control"
  468. :disabled="isdisable"
  469. />
  470. </div>
  471. </div>
  472. </div>
  473. <!-- 新增图片页签 -->
  474. <div v-show="functionType == 5">
  475. <div
  476. v-if="assetConfigDto != null && assetConfigDto.id != null"
  477. class="form-group"
  478. >
  479. <label>{{
  480. $t("lang.assetBasicSetting.printPictureOfAssetCard")
  481. }}</label>
  482. <div class="input-group">
  483. <ImageEditor
  484. :class-name="'com.leanwo.prodog.asset.model.AssetConfig'"
  485. :record-id="assetConfigDto.id"
  486. :field-name="'imageName'"
  487. :readonly="isdisable"
  488. :image-name="imageName"
  489. />
  490. </div>
  491. </div>
  492. <!-- 资产卡片打印图片2 -->
  493. <div
  494. v-if="assetConfigDto != null && assetConfigDto.id != null"
  495. class="form-group"
  496. >
  497. <label>{{
  498. $t("lang.assetBasicSetting.printPictureOfAssetCard2")
  499. }}</label>
  500. <div class="input-group">
  501. <ImageEditor
  502. :class-name="'com.leanwo.prodog.asset.model.AssetConfig'"
  503. :record-id="assetConfigDto.id"
  504. :field-name="'imageName2'"
  505. :readonly="isdisable"
  506. :image-name="imageName2"
  507. />
  508. </div>
  509. </div>
  510. <!-- 资产卡片打印图片3 -->
  511. <div
  512. v-if="assetConfigDto != null && assetConfigDto.id != null"
  513. class="form-group"
  514. >
  515. <label>{{
  516. $t("lang.assetBasicSetting.printPictureOfAssetCard3")
  517. }}</label>
  518. <div class="input-group">
  519. <ImageEditor
  520. :class-name="'com.leanwo.prodog.asset.model.AssetConfig'"
  521. :record-id="assetConfigDto.id"
  522. :field-name="'imageName3'"
  523. :readonly="isdisable"
  524. :image-name="imageName3"
  525. />
  526. </div>
  527. </div>
  528. <!-- 资产卡片打印图片4 -->
  529. <div
  530. v-if="assetConfigDto != null && assetConfigDto.id != null"
  531. class="form-group"
  532. >
  533. <label>{{
  534. $t("lang.assetBasicSetting.printPictureOfAssetCard4")
  535. }}</label>
  536. <div class="input-group">
  537. <ImageEditor
  538. :class-name="'com.leanwo.prodog.asset.model.AssetConfig'"
  539. :record-id="assetConfigDto.id"
  540. :field-name="'imageName4'"
  541. :readonly="isdisable"
  542. :image-name="imageName4"
  543. />
  544. </div>
  545. </div>
  546. <!-- 资产卡片打印图片5 -->
  547. <div
  548. v-if="assetConfigDto != null && assetConfigDto.id != null"
  549. class="form-group"
  550. >
  551. <label>{{
  552. $t("lang.assetBasicSetting.printPictureOfAssetCard5")
  553. }}</label>
  554. <div class="input-group">
  555. <ImageEditor
  556. :class-name="'com.leanwo.prodog.asset.model.AssetConfig'"
  557. :record-id="assetConfigDto.id"
  558. :field-name="'imageName5'"
  559. :readonly="isdisable"
  560. :image-name="imageName5"
  561. />
  562. </div>
  563. </div>
  564. </div>
  565. <div class="row">
  566. <div class="col-md-12">
  567. <button class="btn btn-default" @click="changeIsdisabled()">
  568. {{
  569. isdisable
  570. ? $t("lang.assetBasicSetting.edit")
  571. : $t("lang.assetBasicSetting.cancelEdit")
  572. }}
  573. </button>
  574. <button
  575. :disabled="isdisable"
  576. class="btn btn-default"
  577. @click="saveAssetConfig()"
  578. >
  579. {{ $t("lang.assetBasicSetting.determine") }}
  580. </button>
  581. <button
  582. v-show="functionType == 1"
  583. class="btn btn-default"
  584. @click="regenerateThumbnails()"
  585. >
  586. {{ $t("lang.assetBasicSetting.regenerateThumbnail") }}
  587. </button>
  588. <button
  589. v-show="functionType == 1"
  590. class="btn btn-default"
  591. @click="generateAsset()"
  592. >
  593. {{ $t("lang.assetBasicSetting.generateAsset") }}
  594. </button>
  595. </div>
  596. </div>
  597. <Loading v-if="loading" />
  598. </div>
  599. </template>
  600. <script>
  601. import Common from '../common/Common.js';
  602. import ImageEditor from '../widget/ImageEditor.vue';
  603. import LoginContextResource from '../api/base/LoginContextResource.js';
  604. import AssetConfigResource from '../api/asset/AssetConfigResource.js';
  605. import AssetInstanceResource from '../api/asset/AssetInstanceResource.js';
  606. import DepreciationMethodResource from '../api/asset/DepreciationMethodResource.js';
  607. import { Notify } from 'pc-component-v3';
  608. export default {
  609. components: {
  610. ImageEditor,
  611. },
  612. data: function () {
  613. return {
  614. pageNo: '1',
  615. functionType: 1,
  616. loginContextDto: {}, //登录账套dto
  617. depreciationMethodDtos: [], //所有的折旧方法dto
  618. isdisable: true, //是否禁止更改
  619. CATEGORYNO_SERIALNO: '', //编码类型
  620. assetConfigDto: {}, //固定资产系统设置dto
  621. imageName: undefined,
  622. imageName2: undefined,
  623. imageName3: undefined,
  624. imageName4: undefined,
  625. imageName5: undefined,
  626. loading: false,
  627. };
  628. },
  629. mounted: function () {
  630. this.queryLoginContext();
  631. this.getDepreciationMethods();
  632. this.queryAssetConfig();
  633. },
  634. methods: {
  635. /**
  636. * @param {选择页面事件}
  637. * @return {[type]}
  638. */
  639. selectPage: function (pageNo) {
  640. var _self = this;
  641. _self.pageNo = pageNo;
  642. _self.functionType = pageNo;
  643. },
  644. /**
  645. * 查找账套相关信息
  646. * @return {[type]} [description]
  647. */
  648. queryLoginContext: function () {
  649. var _self = this;
  650. LoginContextResource.queryLoginContext().then(
  651. successData => {
  652. if(successData.errorCode == 0) {
  653. _self.loginContextDto = successData.data;
  654. } else {
  655. Notify.error('提示',successData.errorMessage, false);
  656. }
  657. },
  658. errorData => {
  659. Common.processException(errorData);
  660. },
  661. );
  662. // $.ajax({
  663. // url: Common.getApiURL('loginContextResource/queryLoginContext'),
  664. // type: "get",
  665. // dataType: "json",
  666. // beforeSend: function (request) {
  667. // Common.addTokenToRequest(request);
  668. // },
  669. // success: function (data) {
  670. // _self.loginContextDto = data;
  671. // },
  672. // error: function (XMLHttpRequest, textStatus, errorThrown) {
  673. // Common.processException(XMLHttpRequest, textStatus, errorThrown);
  674. // }
  675. // });
  676. },
  677. /**
  678. * 查询AssetConfigDto
  679. * @return {[type]} [description]
  680. */
  681. queryAssetConfig: function () {
  682. var _self = this;
  683. AssetConfigResource.queryAssetConfig().then(
  684. successData => {
  685. if(successData.errorCode == 0) {
  686. _self.assetConfigDto = successData.data;
  687. } else {
  688. Notify.error('提示',successData.errorMessage, false);
  689. }
  690. },
  691. errorData => {
  692. Common.processException(errorData);
  693. },
  694. );
  695. // $.ajax({
  696. // url: Common.getApiURL("assetConfigResource/queryAssetConfig"),
  697. // type: "get",
  698. // dataType: "json",
  699. // beforeSend: function (request) {
  700. // Common.addTokenToRequest(request);
  701. // },
  702. // success: function (data) {
  703. // _self.assetConfigDto = data;
  704. // },
  705. // error: function (XMLHttpRequest, textStatus, errorThrown) {
  706. // Common.processException(XMLHttpRequest, textStatus, errorThrown);
  707. // },
  708. // });
  709. },
  710. /**
  711. * 查找所有的折旧方法名称
  712. * @return {[type]} [description]
  713. */
  714. getDepreciationMethods: function () {
  715. var _self = this;
  716. DepreciationMethodResource.getDepreciationMethods().then(
  717. successData => {
  718. _self.depreciationMethodDtos = successData.datas;
  719. },
  720. errorData => {
  721. Common.processException(errorData);
  722. },
  723. );
  724. // $.ajax({
  725. // url: Common.getApiURL(
  726. // "depreciationMethodResource/getDepreciationMethods"
  727. // ),
  728. // type: "get",
  729. // dataType: "json",
  730. // beforeSend: function (request) {
  731. // Common.addTokenToRequest(request);
  732. // },
  733. // success: function (data) {
  734. // _self.depreciationMethodDtos = data;
  735. // },
  736. // error: function (XMLHttpRequest, textStatus, errorThrown) {
  737. // Common.processException(XMLHttpRequest, textStatus, errorThrown);
  738. // },
  739. // });
  740. },
  741. /**
  742. * 点击保存资产设置事件
  743. * @return {[type]} [description]
  744. */
  745. saveAssetConfig: function () {
  746. var _self = this;
  747. AssetConfigResource.saveAssetConfig(_self.assetConfigDto).then(
  748. successData => {
  749. if(successData.errorCode != 0) {
  750. Notify.error('提示','更新资产配置失败。', false);
  751. return;
  752. }
  753. Notify.success('提示', '更新资产配置成功!', 1500);
  754. },
  755. errorData => {
  756. Common.processException(errorData);
  757. },
  758. );
  759. // $.ajax({
  760. // url: Common.getApiURL("assetConfigResource/saveAssetConfig"),
  761. // type: "post",
  762. // contentType: "application/json",
  763. // data: JSON.stringify(_self.assetConfigDto),
  764. // beforeSend: function (request) {
  765. // Common.addTokenToRequest(request);
  766. // },
  767. // success: function (data) {
  768. // Notify.success("提示", "更新资产配置成功!", 1500);
  769. // },
  770. // error: function (XMLHttpRequest, textStatus, errorThrown) {
  771. // Common.processException(XMLHttpRequest, textStatus, errorThrown);
  772. // },
  773. // });
  774. },
  775. /**
  776. * 点击重新生成缩略图
  777. *
  778. */
  779. regenerateThumbnails: function () {
  780. var _self = this;
  781. _self.loading=true;
  782. AssetConfigResource.regenerateThumbnails(_self.assetConfigDto).then(
  783. successData => {
  784. if(successData.errorCode != 0) {
  785. Notify.error('提示','重新更新缩略图失败。', false);
  786. return;
  787. }
  788. Notify.success('提示', '重新生成缩略图成功。', false);
  789. _self.loading=false;
  790. },
  791. errorData => {
  792. Common.processException(errorData);
  793. _self.loading=false;
  794. },
  795. );
  796. },
  797. /**
  798. * 生成资产
  799. */
  800. generateAsset: function () {
  801. var _self = this;
  802. _self.loading=true;
  803. AssetInstanceResource.generateAssetByAssetInstance().then(
  804. successData => {
  805. if(successData.errorCode == 0) {
  806. Notify.success('提示', '共计生成' + successData.data + '个资产', false);
  807. _self.loading=false;
  808. } else {
  809. Notify.error('提示',successData.errorMessage, false);
  810. }
  811. },
  812. errorData => {
  813. Common.processException(errorData);
  814. _self.loading=false;
  815. },
  816. );
  817. },
  818. changeIsdisabled: function () {
  819. this.isdisable = !this.isdisable;
  820. },
  821. getTotalNum: function (str) {
  822. if (str == undefined || str == '') {
  823. return;
  824. }
  825. var arr = str.split('-');
  826. var len = arr.length;
  827. if (len == 0) {
  828. return;
  829. }
  830. var totalNum = 0;
  831. for (var i = 0; i < len; i++) {
  832. totalNum += Number(arr[i]);
  833. }
  834. return totalNum;
  835. },
  836. },
  837. };
  838. </script>
  839. <style scoped>
  840. </style>