FixedAssetsTable.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  1. <template>
  2. <div class="fixed-assets-table-container">
  3. <el-table
  4. :data="flattenedTableData"
  5. border
  6. style="width: 100%"
  7. size="small"
  8. :row-class-name="getRowClassName"
  9. >
  10. <!-- 序号列 -->
  11. <el-table-column prop="seq" label="序号" width="80" align="center">
  12. <template slot-scope="scope">
  13. <span v-if="scope.row.isCategory" class="category-seq">
  14. {{ scope.row.categorySeq }}
  15. </span>
  16. <span v-else>{{ scope.row.seq }}</span>
  17. </template>
  18. </el-table-column>
  19. <!-- 项目列 -->
  20. <el-table-column
  21. prop="itemName"
  22. label="项目"
  23. min-width="200"
  24. align="left"
  25. >
  26. <template slot-scope="scope">
  27. <span v-if="scope.row.isCategory" class="category-name">
  28. {{ scope.row.itemName }}
  29. </span>
  30. <el-input
  31. v-else
  32. v-model="scope.row.itemName"
  33. placeholder="请输入项目名称"
  34. size="mini"
  35. :disabled="isViewMode"
  36. />
  37. </template>
  38. </el-table-column>
  39. <!-- 计量单位列 -->
  40. <el-table-column prop="unit" label="计量单位" width="120" align="center">
  41. <template slot-scope="scope">
  42. <el-input
  43. v-if="!scope.row.isCategory"
  44. v-model="scope.row.unit"
  45. placeholder="单位"
  46. size="mini"
  47. :disabled="isViewMode"
  48. />
  49. </template>
  50. </el-table-column>
  51. <!-- 固定资产原值列 -->
  52. <el-table-column
  53. prop="originalValue"
  54. label="固定资产原值"
  55. width="150"
  56. align="center"
  57. >
  58. <template slot-scope="scope">
  59. <el-input
  60. v-if="!scope.row.isCategory"
  61. v-model="scope.row.originalValue"
  62. placeholder="原值"
  63. size="mini"
  64. :disabled="isViewMode"
  65. @blur="handleCellBlur(scope.row, 'originalValue')"
  66. />
  67. </template>
  68. </el-table-column>
  69. <!-- 入帐或竣工验收日期列 -->
  70. <el-table-column
  71. prop="entryDate"
  72. label="入帐或竣工验收日期"
  73. width="180"
  74. align="center"
  75. >
  76. <template slot-scope="scope">
  77. <el-date-picker
  78. v-if="!scope.row.isCategory"
  79. v-model="scope.row.entryDate"
  80. type="date"
  81. placeholder="选择日期"
  82. size="mini"
  83. format="yyyy-MM-dd"
  84. value-format="yyyy-MM-dd"
  85. :disabled="isViewMode"
  86. style="width: 100%"
  87. />
  88. </template>
  89. </el-table-column>
  90. <!-- 折旧年限列 -->
  91. <el-table-column
  92. prop="depreciationPeriod"
  93. label="折旧年限"
  94. width="120"
  95. align="center"
  96. >
  97. <template slot-scope="scope">
  98. <el-input
  99. v-if="!scope.row.isCategory"
  100. v-model="scope.row.depreciationPeriod"
  101. placeholder="年限"
  102. size="mini"
  103. :disabled="isViewMode"
  104. @blur="handleCellBlur(scope.row, 'depreciationPeriod')"
  105. />
  106. </template>
  107. </el-table-column>
  108. <!-- 折旧费列 -->
  109. <el-table-column
  110. prop="depreciationExpense"
  111. label="折旧费"
  112. width="120"
  113. align="center"
  114. >
  115. <template slot-scope="scope">
  116. <el-input
  117. v-if="!scope.row.isCategory"
  118. v-model="scope.row.depreciationExpense"
  119. placeholder="费用"
  120. size="mini"
  121. :disabled="isViewMode"
  122. @blur="handleCellBlur(scope.row, 'depreciationExpense')"
  123. />
  124. </template>
  125. </el-table-column>
  126. <!-- 资金来源列 -->
  127. <el-table-column
  128. prop="fundSource"
  129. label="资金来源"
  130. width="120"
  131. align="center"
  132. >
  133. <template slot-scope="scope">
  134. <el-input
  135. v-if="!scope.row.isCategory"
  136. v-model="scope.row.fundSource"
  137. placeholder="来源"
  138. size="mini"
  139. :disabled="isViewMode"
  140. />
  141. </template>
  142. </el-table-column>
  143. <!-- 备注列 -->
  144. <el-table-column prop="remark" label="备注" min-width="150">
  145. <template slot-scope="scope">
  146. <el-input
  147. v-if="!scope.row.isCategory"
  148. v-model="scope.row.remark"
  149. placeholder="备注"
  150. size="mini"
  151. :disabled="isViewMode"
  152. />
  153. </template>
  154. </el-table-column>
  155. <!-- 操作列 -->
  156. <el-table-column label="操作" width="100" align="center" fixed="right">
  157. <template slot-scope="scope">
  158. <div v-if="scope.row.isCategory" class="operation-buttons">
  159. <el-button
  160. type="text"
  161. size="mini"
  162. icon="el-icon-plus"
  163. :disabled="isViewMode"
  164. @click="handleAddRow(scope.row)"
  165. />
  166. <el-button
  167. type="text"
  168. size="mini"
  169. icon="el-icon-minus"
  170. :disabled="isViewMode"
  171. @click="handleDeleteRow(scope.row)"
  172. />
  173. </div>
  174. </template>
  175. </el-table-column>
  176. </el-table>
  177. </div>
  178. </template>
  179. <script>
  180. import { Message } from 'element-ui'
  181. export default {
  182. name: 'FixedAssetsTable',
  183. props: {
  184. // 表格数据配置(嵌套结构)
  185. tableItems: {
  186. type: Array,
  187. default: () => [],
  188. },
  189. // 是否有保存的数据
  190. savedData: {
  191. type: Object,
  192. default: () => ({}),
  193. },
  194. // 是否查看模式
  195. isViewMode: {
  196. type: Boolean,
  197. default: false,
  198. },
  199. },
  200. data() {
  201. return {
  202. // 嵌套的表格数据
  203. fixedAssetsData: [],
  204. // 验证错误
  205. validationErrors: [],
  206. // 扁平化的表格数据(响应式)
  207. flattenedData: [],
  208. }
  209. },
  210. computed: {
  211. // 扁平化的表格数据(从嵌套结构生成)
  212. flattenedTableData() {
  213. return this.flattenedData
  214. },
  215. },
  216. watch: {
  217. tableItems: {
  218. handler(newVal) {
  219. if (newVal && newVal.length > 0) {
  220. this.fixedAssetsData = this.deepClone(newVal)
  221. } else {
  222. this.fixedAssetsData = this.getDefaultTableData()
  223. }
  224. // 重新生成扁平数据
  225. this.generateFlattenedData()
  226. },
  227. immediate: true,
  228. deep: true,
  229. },
  230. savedData: {
  231. handler() {
  232. // 数据变化时重新生成扁平数据
  233. this.generateFlattenedData()
  234. },
  235. deep: true,
  236. },
  237. },
  238. methods: {
  239. // 生成扁平数据
  240. generateFlattenedData() {
  241. const result = []
  242. let seq = 1
  243. const processItem = (item, parentCategory = null) => {
  244. if (item.isCategory) {
  245. // 分类行
  246. result.push({
  247. ...item,
  248. seq: item.categorySeq || item.id,
  249. isCategory: true,
  250. categorySeq: item.categorySeq || item.id,
  251. })
  252. // 处理分类下的子项
  253. if (item.children && Array.isArray(item.children)) {
  254. item.children.forEach((child) => {
  255. processItem(child, item)
  256. })
  257. }
  258. } else {
  259. // 普通行
  260. const rowData = {
  261. ...item,
  262. seq: seq++,
  263. isCategory: false,
  264. }
  265. // 如果有父分类,设置分类信息
  266. if (parentCategory) {
  267. rowData.categoryId = parentCategory.id
  268. rowData.categorySeq =
  269. parentCategory.categorySeq || parentCategory.id
  270. }
  271. // 初始化字段
  272. if (rowData.itemName === undefined) rowData.itemName = ''
  273. if (rowData.unit === undefined) rowData.unit = ''
  274. if (rowData.originalValue === undefined) rowData.originalValue = ''
  275. if (rowData.entryDate === undefined) rowData.entryDate = ''
  276. if (rowData.depreciationPeriod === undefined)
  277. rowData.depreciationPeriod = ''
  278. if (rowData.depreciationExpense === undefined)
  279. rowData.depreciationExpense = ''
  280. if (rowData.fundSource === undefined) rowData.fundSource = ''
  281. if (rowData.remark === undefined) rowData.remark = ''
  282. // 如果有保存的数据,填充值
  283. if (this.savedData) {
  284. // 从保存的数据中查找对应的值
  285. const savedItem = this.findSavedItemById(item.id)
  286. if (savedItem) {
  287. Object.keys(savedItem).forEach((key) => {
  288. if (savedItem[key] !== undefined && key !== 'id') {
  289. rowData[key] = savedItem[key]
  290. }
  291. })
  292. }
  293. }
  294. result.push(rowData)
  295. // 如果有子项,递归处理
  296. if (item.children && Array.isArray(item.children)) {
  297. item.children.forEach((child) => {
  298. processItem(child, item)
  299. })
  300. }
  301. }
  302. }
  303. // 处理所有项
  304. this.fixedAssetsData.forEach((item) => {
  305. processItem(item)
  306. })
  307. // 使用 Vue.set 确保响应式
  308. this.$set(this, 'flattenedData', result)
  309. },
  310. // 深拷贝
  311. deepClone(obj) {
  312. if (obj === null || typeof obj !== 'object') return obj
  313. if (obj instanceof Date) return new Date(obj.getTime())
  314. if (obj instanceof Array) return obj.map((item) => this.deepClone(item))
  315. if (typeof obj === 'object') {
  316. const clonedObj = {}
  317. for (const key in obj) {
  318. if (obj.hasOwnProperty(key)) {
  319. clonedObj[key] = this.deepClone(obj[key])
  320. }
  321. }
  322. return clonedObj
  323. }
  324. },
  325. // 获取默认表格数据
  326. getDefaultTableData() {
  327. return [
  328. {
  329. id: 'I',
  330. itemName: '房屋建筑物',
  331. isCategory: true,
  332. categorySeq: 'I',
  333. children: [
  334. {
  335. id: 'I-1',
  336. itemName: '办公用房',
  337. unit: '',
  338. originalValue: '',
  339. entryDate: '',
  340. depreciationPeriod: '',
  341. depreciationExpense: '',
  342. fundSource: '',
  343. remark: '',
  344. },
  345. {
  346. id: 'I-2',
  347. itemName: '教保用房',
  348. unit: '',
  349. originalValue: '',
  350. entryDate: '',
  351. depreciationPeriod: '',
  352. depreciationExpense: '',
  353. fundSource: '',
  354. remark: '',
  355. },
  356. {
  357. id: 'I-3',
  358. itemName: '幼儿宿舍用房',
  359. unit: '',
  360. originalValue: '',
  361. entryDate: '',
  362. depreciationPeriod: '',
  363. depreciationExpense: '',
  364. fundSource: '',
  365. remark: '',
  366. },
  367. {
  368. id: 'I-4',
  369. itemName: '其它',
  370. unit: '',
  371. originalValue: '',
  372. entryDate: '',
  373. depreciationPeriod: '',
  374. depreciationExpense: '',
  375. fundSource: '',
  376. remark: '',
  377. },
  378. ],
  379. },
  380. {
  381. id: 'II',
  382. itemName: '交通运输工具',
  383. isCategory: true,
  384. categorySeq: 'II',
  385. children: [
  386. {
  387. id: 'II-1',
  388. itemName: '车辆',
  389. unit: '',
  390. originalValue: '',
  391. entryDate: '',
  392. depreciationPeriod: '',
  393. depreciationExpense: '',
  394. fundSource: '',
  395. remark: '',
  396. },
  397. ],
  398. },
  399. {
  400. id: 'III',
  401. itemName: '教保专用设备',
  402. isCategory: true,
  403. categorySeq: 'III',
  404. children: [
  405. {
  406. id: 'III-1',
  407. itemName: '电教',
  408. unit: '',
  409. originalValue: '',
  410. entryDate: '',
  411. depreciationPeriod: '',
  412. depreciationExpense: '',
  413. fundSource: '',
  414. remark: '',
  415. },
  416. {
  417. id: 'III-2',
  418. itemName: '文体',
  419. unit: '',
  420. originalValue: '',
  421. entryDate: '',
  422. depreciationPeriod: '',
  423. depreciationExpense: '',
  424. fundSource: '',
  425. remark: '',
  426. },
  427. ],
  428. },
  429. {
  430. id: 'IV',
  431. itemName: '办公设备',
  432. isCategory: true,
  433. categorySeq: 'IV',
  434. children: [
  435. {
  436. id: 'IV-1',
  437. itemName: '电脑',
  438. unit: '',
  439. originalValue: '',
  440. entryDate: '',
  441. depreciationPeriod: '',
  442. depreciationExpense: '',
  443. fundSource: '',
  444. remark: '',
  445. },
  446. ],
  447. },
  448. {
  449. id: 'V',
  450. itemName: '其它固定资产',
  451. isCategory: true,
  452. categorySeq: 'V',
  453. children: [
  454. {
  455. id: 'V-1',
  456. itemName: '空调',
  457. unit: '',
  458. originalValue: '',
  459. entryDate: '',
  460. depreciationPeriod: '',
  461. depreciationExpense: '',
  462. fundSource: '',
  463. remark: '',
  464. },
  465. {
  466. id: 'V-2',
  467. itemName: '家电',
  468. unit: '',
  469. originalValue: '',
  470. entryDate: '',
  471. depreciationPeriod: '',
  472. depreciationExpense: '',
  473. fundSource: '',
  474. remark: '',
  475. },
  476. {
  477. id: 'V-3',
  478. itemName: '供水系统',
  479. unit: '',
  480. originalValue: '',
  481. entryDate: '',
  482. depreciationPeriod: '',
  483. depreciationExpense: '',
  484. fundSource: '',
  485. remark: '',
  486. },
  487. {
  488. id: 'V-4',
  489. itemName: '洗涤用具',
  490. unit: '',
  491. originalValue: '',
  492. entryDate: '',
  493. depreciationPeriod: '',
  494. depreciationExpense: '',
  495. fundSource: '',
  496. remark: '',
  497. },
  498. {
  499. id: 'V-5',
  500. itemName: '家具',
  501. unit: '',
  502. originalValue: '',
  503. entryDate: '',
  504. depreciationPeriod: '',
  505. depreciationExpense: '',
  506. fundSource: '',
  507. remark: '',
  508. },
  509. {
  510. id: 'V-6',
  511. itemName: '炊事用具',
  512. unit: '',
  513. originalValue: '',
  514. entryDate: '',
  515. depreciationPeriod: '',
  516. depreciationExpense: '',
  517. fundSource: '',
  518. remark: '',
  519. },
  520. {
  521. id: 'V-7',
  522. itemName: '其它',
  523. unit: '',
  524. originalValue: '',
  525. entryDate: '',
  526. depreciationPeriod: '',
  527. depreciationExpense: '',
  528. fundSource: '',
  529. remark: '',
  530. },
  531. ],
  532. },
  533. ]
  534. },
  535. // 获取行样式类名
  536. getRowClassName({ row }) {
  537. if (row.isCategory) {
  538. return 'category-row'
  539. }
  540. return ''
  541. },
  542. // 添加行
  543. handleAddRow(row) {
  544. // 找到对应的分类
  545. const category = this.findCategoryById(row.id)
  546. if (category) {
  547. // 生成新的项目ID
  548. const newId = `${row.id}-${Date.now()}`
  549. const newItem = {
  550. id: newId,
  551. itemName: '',
  552. unit: '',
  553. originalValue: '',
  554. entryDate: '',
  555. depreciationPeriod: '',
  556. depreciationExpense: '',
  557. fundSource: '',
  558. remark: '',
  559. }
  560. // 在分类的 children 数组末尾添加新行
  561. if (!category.children) {
  562. this.$set(category, 'children', [])
  563. }
  564. category.children.push(newItem)
  565. // 重新生成扁平数据
  566. this.generateFlattenedData()
  567. Message.success('添加行成功')
  568. }
  569. },
  570. // 删除行(删除分类下的最后一个子项)
  571. handleDeleteRow(row) {
  572. // row 是分类行,需要找到该分类下的子项
  573. const category = this.findCategoryById(row.id)
  574. if (category && category.children && category.children.length > 0) {
  575. // 删除最后一个子项
  576. category.children.pop()
  577. // 重新生成扁平数据
  578. this.generateFlattenedData()
  579. Message.success('删除成功')
  580. } else {
  581. Message.warning('该分类下没有可删除的行')
  582. }
  583. },
  584. // 根据ID在保存的数据中查找
  585. findSavedItemById(id) {
  586. if (!this.savedData) return null
  587. // 递归查找
  588. const findInArray = (items) => {
  589. for (const item of items) {
  590. if (item.id === id) {
  591. return item
  592. }
  593. if (item.children && Array.isArray(item.children)) {
  594. const found = findInArray(item.children)
  595. if (found) return found
  596. }
  597. }
  598. return null
  599. }
  600. // 如果 savedData 是数组
  601. if (Array.isArray(this.savedData)) {
  602. return findInArray(this.savedData)
  603. }
  604. // 如果 savedData 是对象,尝试查找
  605. if (typeof this.savedData === 'object') {
  606. // 可能是一个映射对象,key 是 id
  607. if (this.savedData[id]) {
  608. return this.savedData[id]
  609. }
  610. // 或者是嵌套结构
  611. return findInArray([this.savedData])
  612. }
  613. return null
  614. },
  615. // 根据ID查找分类
  616. findCategoryById(id) {
  617. const findInArray = (items) => {
  618. for (const item of items) {
  619. if (item.id === id) {
  620. return item
  621. }
  622. if (item.children && Array.isArray(item.children)) {
  623. const found = findInArray(item.children)
  624. if (found) return found
  625. }
  626. }
  627. return null
  628. }
  629. return findInArray(this.fixedAssetsData)
  630. },
  631. // 单元格失焦验证
  632. handleCellBlur(row, field) {
  633. // 实时验证格式
  634. if (field === 'originalValue' || field === 'depreciationExpense') {
  635. const value = row[field]
  636. if (value && !/^\d+(\.\d+)?$/.test(value)) {
  637. Message.warning(
  638. `${this.getFieldLabel(field)}格式不正确,请输入数字`
  639. )
  640. }
  641. }
  642. if (field === 'depreciationPeriod') {
  643. const value = row[field]
  644. if (value && !/^\d+$/.test(value)) {
  645. Message.warning(`${this.getFieldLabel(field)}必须是正整数`)
  646. }
  647. }
  648. },
  649. // 获取字段标签
  650. getFieldLabel(field) {
  651. const labels = {
  652. originalValue: '固定资产原值',
  653. depreciationPeriod: '折旧年限',
  654. depreciationExpense: '折旧费',
  655. }
  656. return labels[field] || field
  657. },
  658. // 验证表单
  659. validate() {
  660. this.validationErrors = []
  661. const errors = []
  662. // 验证扁平数据(因为用户编辑的是扁平数据)
  663. const flatData = this.flattenedTableData
  664. flatData.forEach((item, index) => {
  665. if (!item.isCategory) {
  666. // 非空验证
  667. if (!item.itemName || String(item.itemName).trim() === '') {
  668. errors.push(`第${item.seq}行:项目名称不能为空`)
  669. }
  670. if (!item.unit || String(item.unit).trim() === '') {
  671. errors.push(`第${item.seq}行:计量单位不能为空`)
  672. }
  673. if (
  674. !item.originalValue ||
  675. String(item.originalValue).trim() === ''
  676. ) {
  677. errors.push(`第${item.seq}行:固定资产原值不能为空`)
  678. }
  679. if (!item.entryDate || String(item.entryDate).trim() === '') {
  680. errors.push(`第${item.seq}行:入帐或竣工验收日期不能为空`)
  681. }
  682. if (
  683. !item.depreciationPeriod ||
  684. String(item.depreciationPeriod).trim() === ''
  685. ) {
  686. errors.push(`第${item.seq}行:折旧年限不能为空`)
  687. }
  688. if (
  689. !item.depreciationExpense ||
  690. String(item.depreciationExpense).trim() === ''
  691. ) {
  692. errors.push(`第${item.seq}行:折旧费不能为空`)
  693. }
  694. if (!item.fundSource || String(item.fundSource).trim() === '') {
  695. errors.push(`第${item.seq}行:资金来源不能为空`)
  696. }
  697. // 格式验证
  698. if (
  699. item.originalValue &&
  700. String(item.originalValue).trim() !== '' &&
  701. !/^\d+(\.\d+)?$/.test(String(item.originalValue))
  702. ) {
  703. errors.push(`第${item.seq}行:固定资产原值格式不正确,请输入数字`)
  704. }
  705. if (
  706. item.depreciationPeriod &&
  707. String(item.depreciationPeriod).trim() !== '' &&
  708. !/^\d+$/.test(String(item.depreciationPeriod))
  709. ) {
  710. errors.push(`第${item.seq}行:折旧年限必须是正整数`)
  711. }
  712. if (
  713. item.depreciationExpense &&
  714. String(item.depreciationExpense).trim() !== '' &&
  715. !/^\d+(\.\d+)?$/.test(String(item.depreciationExpense))
  716. ) {
  717. errors.push(`第${item.seq}行:折旧费格式不正确,请输入数字`)
  718. }
  719. }
  720. })
  721. this.validationErrors = errors
  722. return errors.length === 0
  723. },
  724. // 获取表格数据(用于保存)
  725. // 需要将扁平数据同步回嵌套结构
  726. getTableData() {
  727. // 同步扁平数据的修改到嵌套结构
  728. const flatData = this.flattenedData
  729. const syncDataToNested = (items) => {
  730. return items.map((item) => {
  731. if (item.isCategory) {
  732. // 分类行
  733. const newItem = { ...item }
  734. if (item.children && Array.isArray(item.children)) {
  735. newItem.children = syncDataToNested(item.children)
  736. }
  737. return newItem
  738. } else {
  739. // 普通行,从扁平数据中同步
  740. const flatItem = flatData.find(
  741. (f) => f.id === item.id && !f.isCategory
  742. )
  743. if (flatItem) {
  744. return {
  745. ...item,
  746. itemName: flatItem.itemName,
  747. unit: flatItem.unit,
  748. originalValue: flatItem.originalValue,
  749. entryDate: flatItem.entryDate,
  750. depreciationPeriod: flatItem.depreciationPeriod,
  751. depreciationExpense: flatItem.depreciationExpense,
  752. fundSource: flatItem.fundSource,
  753. remark: flatItem.remark,
  754. }
  755. }
  756. return item
  757. }
  758. })
  759. }
  760. return syncDataToNested(this.fixedAssetsData)
  761. },
  762. },
  763. }
  764. </script>
  765. <style scoped lang="scss">
  766. .fixed-assets-table-container {
  767. // 分类行样式
  768. ::v-deep .category-row {
  769. background-color: #f5f7fa !important;
  770. td {
  771. background-color: #f5f7fa !important;
  772. font-weight: bold;
  773. }
  774. .category-name {
  775. color: #409eff;
  776. font-weight: bold;
  777. }
  778. .category-seq {
  779. color: #409eff;
  780. font-weight: bold;
  781. }
  782. }
  783. // 操作按钮样式
  784. .operation-buttons {
  785. display: flex;
  786. justify-content: center;
  787. gap: 5px;
  788. .el-button {
  789. padding: 5px;
  790. min-width: 24px;
  791. height: 24px;
  792. border-radius: 50%;
  793. background-color: #000;
  794. color: #fff;
  795. border: none;
  796. &:hover {
  797. background-color: #333;
  798. }
  799. i {
  800. font-size: 14px;
  801. }
  802. }
  803. }
  804. // 输入框样式
  805. ::v-deep .el-input__inner {
  806. border: 1px solid #dcdfe6;
  807. border-radius: 4px;
  808. &:focus {
  809. border-color: #409eff;
  810. }
  811. }
  812. // 日期选择器样式
  813. ::v-deep .el-date-editor {
  814. width: 100%;
  815. }
  816. }
  817. </style>