OnlineFill.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370
  1. <template>
  2. <el-dialog
  3. title="在线填报"
  4. :visible.sync="dialogVisible"
  5. width="90%"
  6. :close-on-click-modal="false"
  7. top="5vh"
  8. @close="handleClose"
  9. >
  10. <div class="online-fill-container">
  11. <!-- 主要内容区域 -->
  12. <div class="main-content">
  13. <!-- 单记录类型 -->
  14. <div v-if="tableType === '单记录'" class="form-section">
  15. <el-card>
  16. <!-- <div slot="header" class="card-header">
  17. <span>{{ surveyData.name }}</span>
  18. </div> -->
  19. <el-form
  20. ref="singleRecordForm"
  21. :model="singleRecordForm"
  22. :rules="singleRecordRules"
  23. label-width="120px"
  24. >
  25. <el-form-item label="机构名称" prop="institutionName">
  26. <el-input
  27. v-model="singleRecordForm.institutionName"
  28. placeholder="请输入机构名称"
  29. style="width: 400px"
  30. ></el-input>
  31. </el-form-item>
  32. <el-form-item label="机构性质" prop="institutionNature">
  33. <el-select
  34. v-model="singleRecordForm.institutionNature"
  35. placeholder="请选择机构性质"
  36. style="width: 400px"
  37. >
  38. <el-option label="公办" value="公办"></el-option>
  39. <el-option label="民办" value="民办"></el-option>
  40. <el-option label="混合所有制" value="混合所有制"></el-option>
  41. </el-select>
  42. </el-form-item>
  43. <el-form-item label="机构评定等级" prop="institutionLevel">
  44. <el-select
  45. v-model="singleRecordForm.institutionLevel"
  46. placeholder="请选择机构评定等级"
  47. style="width: 400px"
  48. >
  49. <el-option label="一级" value="一级"></el-option>
  50. <el-option label="二级" value="二级"></el-option>
  51. <el-option label="三级" value="三级"></el-option>
  52. <el-option label="未评定" value="未评定"></el-option>
  53. </el-select>
  54. </el-form-item>
  55. <el-form-item label="机构办学方式" prop="educationMode">
  56. <el-select
  57. v-model="singleRecordForm.educationMode"
  58. placeholder="请选择机构办学方式"
  59. style="width: 400px"
  60. >
  61. <el-option label="全日制" value="全日制"></el-option>
  62. <el-option label="非全日制" value="非全日制"></el-option>
  63. <el-option label="混合制" value="混合制"></el-option>
  64. </el-select>
  65. </el-form-item>
  66. <el-form-item label="机构地址" prop="institutionAddress">
  67. <el-input
  68. v-model="singleRecordForm.institutionAddress"
  69. placeholder="请输入机构地址"
  70. style="width: 400px"
  71. ></el-input>
  72. </el-form-item>
  73. <el-form-item label="机构财务负责人" prop="financialManager">
  74. <el-input
  75. v-model="singleRecordForm.financialManager"
  76. placeholder="请输入机构财务负责人"
  77. style="width: 400px"
  78. ></el-input>
  79. </el-form-item>
  80. <el-form-item label="机构填表人" prop="formFiller">
  81. <el-input
  82. v-model="singleRecordForm.formFiller"
  83. placeholder="请输入机构填表人"
  84. style="width: 400px"
  85. ></el-input>
  86. </el-form-item>
  87. </el-form>
  88. <div class="form-actions">
  89. <el-button @click="handleCancel">取消</el-button>
  90. <el-button type="primary" @click="handleSave">保存</el-button>
  91. <el-button type="success" @click="handleSubmit">提交</el-button>
  92. </div>
  93. </el-card>
  94. </div>
  95. <!-- 固定表类型 -->
  96. <div v-if="tableType === '固定表'" class="table-section">
  97. <el-card>
  98. <div slot="header" class="card-header">
  99. <span>{{ surveyData.name }}</span>
  100. <el-button type="primary" size="small" @click="handleAddFixedRow">
  101. 新增行
  102. </el-button>
  103. </div>
  104. <el-table :data="fixedTableData" border style="width: 100%">
  105. <el-table-column
  106. prop="seq"
  107. label="序号"
  108. width="80"
  109. align="center"
  110. >
  111. <template slot-scope="scope">
  112. {{ scope.$index + 1 }}
  113. </template>
  114. </el-table-column>
  115. <el-table-column prop="project" label="项目" min-width="200">
  116. <template slot-scope="scope">
  117. <el-input
  118. v-model="scope.row.project"
  119. placeholder="请输入项目名称"
  120. ></el-input>
  121. </template>
  122. </el-table-column>
  123. <el-table-column
  124. prop="unit"
  125. label="单位"
  126. width="120"
  127. align="center"
  128. >
  129. <template slot-scope="scope">
  130. <el-input
  131. v-model="scope.row.unit"
  132. placeholder="单位"
  133. ></el-input>
  134. </template>
  135. </el-table-column>
  136. <el-table-column
  137. prop="dynamicYear"
  138. label="动态年份"
  139. width="120"
  140. align="center"
  141. >
  142. <template slot-scope="scope">
  143. <el-date-picker
  144. v-model="scope.row.dynamicYear"
  145. type="year"
  146. placeholder="选择年份"
  147. size="mini"
  148. ></el-date-picker>
  149. </template>
  150. </el-table-column>
  151. <el-table-column prop="remark" label="备注" min-width="200">
  152. <template slot-scope="scope">
  153. <el-input
  154. v-model="scope.row.remark"
  155. placeholder="请输入备注"
  156. ></el-input>
  157. </template>
  158. </el-table-column>
  159. <el-table-column label="操作" width="100" align="center">
  160. <template slot-scope="scope">
  161. <el-button
  162. type="text"
  163. size="small"
  164. @click="handleDeleteFixedRow(scope.$index)"
  165. >
  166. 删除
  167. </el-button>
  168. </template>
  169. </el-table-column>
  170. </el-table>
  171. <div class="form-actions">
  172. <el-button @click="handleCancel">取消</el-button>
  173. <el-button type="primary" @click="handleSave">保存</el-button>
  174. <el-button type="success" @click="handleSubmit">提交</el-button>
  175. </div>
  176. </el-card>
  177. </div>
  178. <!-- 动态表类型 -->
  179. <div v-if="tableType === '动态表'" class="table-section">
  180. <el-card>
  181. <div slot="header" class="card-header">
  182. <!-- <span>{{ surveyData.name }}</span> -->
  183. <div>
  184. <el-button
  185. type="primary"
  186. size="small"
  187. @click="handleAddDynamicRow"
  188. >
  189. 新增
  190. </el-button>
  191. <el-button
  192. type="danger"
  193. size="small"
  194. :disabled="selectedRows.length === 0"
  195. @click="handleBatchDelete"
  196. >
  197. 批量删除
  198. </el-button>
  199. </div>
  200. </div>
  201. <el-table
  202. :data="dynamicTableData"
  203. border
  204. style="width: 100%"
  205. @selection-change="handleSelectionChange"
  206. >
  207. <el-table-column
  208. type="selection"
  209. width="55"
  210. align="center"
  211. ></el-table-column>
  212. <el-table-column
  213. prop="seq"
  214. label="序号"
  215. width="80"
  216. align="center"
  217. >
  218. <template slot-scope="scope">
  219. {{ scope.$index + 1 }}
  220. </template>
  221. </el-table-column>
  222. <el-table-column
  223. prop="auditPeriod"
  224. label="监审期间"
  225. min-width="200"
  226. >
  227. <template slot-scope="scope">
  228. {{ scope.row.auditPeriod }}
  229. </template>
  230. </el-table-column>
  231. <el-table-column
  232. prop="fillTime"
  233. label="填报时间"
  234. width="150"
  235. align="center"
  236. >
  237. <template slot-scope="scope">
  238. {{ scope.row.fillTime }}
  239. </template>
  240. </el-table-column>
  241. <el-table-column
  242. prop="lastModifyTime"
  243. label="最后修改时间"
  244. width="150"
  245. align="center"
  246. >
  247. <template slot-scope="scope">
  248. {{ scope.row.lastModifyTime }}
  249. </template>
  250. </el-table-column>
  251. <el-table-column label="操作" width="200" align="center">
  252. <template slot-scope="scope">
  253. <el-button
  254. type="text"
  255. size="small"
  256. @click="handleViewDetail(scope.row)"
  257. >
  258. 详情
  259. </el-button>
  260. <el-button
  261. type="text"
  262. size="small"
  263. @click="handleEdit(scope.row)"
  264. >
  265. 编辑
  266. </el-button>
  267. <el-button
  268. type="text"
  269. size="small"
  270. @click="handleDelete(scope.row)"
  271. >
  272. 删除
  273. </el-button>
  274. </template>
  275. </el-table-column>
  276. </el-table>
  277. <div class="form-actions">
  278. <el-button @click="handleCancel">取消</el-button>
  279. <el-button type="primary" @click="handleSave">保存</el-button>
  280. <el-button type="success" @click="handleSubmit">提交</el-button>
  281. </div>
  282. </el-card>
  283. </div>
  284. </div>
  285. </div>
  286. <!-- 详情弹窗 -->
  287. <el-dialog
  288. title="详情"
  289. :visible.sync="detailDialogVisible"
  290. width="90%"
  291. :append-to-body="true"
  292. :modal-append-to-body="false"
  293. :close-on-click-modal="false"
  294. >
  295. <div v-if="currentDetail" class="detail-content">
  296. <!-- 固定资产表格 - 只读模式 -->
  297. <div class="fixed-assets-table">
  298. <el-table
  299. :data="flattenedTableData"
  300. border
  301. style="width: 100%"
  302. size="small"
  303. >
  304. <el-table-column prop="seq" label="序号" width="80" align="center">
  305. <template slot-scope="scope">
  306. {{ scope.row.seq }}
  307. </template>
  308. </el-table-column>
  309. <el-table-column prop="name" label="项目" min-width="150">
  310. <template slot-scope="scope">
  311. <span v-if="scope.row.isCategory" class="category-name">
  312. {{ scope.row.name }}
  313. </span>
  314. <span v-else>{{ scope.row.name }}</span>
  315. </template>
  316. </el-table-column>
  317. <el-table-column
  318. prop="unit"
  319. label="计量单位"
  320. width="120"
  321. align="center"
  322. >
  323. <template slot-scope="scope">
  324. <span v-if="!scope.row.isCategory">{{ scope.row.unit }}</span>
  325. </template>
  326. </el-table-column>
  327. <el-table-column
  328. prop="originalValue"
  329. label="固定资产原值"
  330. width="150"
  331. align="center"
  332. >
  333. <template slot-scope="scope">
  334. <span v-if="!scope.row.isCategory">
  335. {{ scope.row.originalValue }}
  336. </span>
  337. </template>
  338. </el-table-column>
  339. <el-table-column
  340. prop="entryDate"
  341. label="入帐或竣工验收日期"
  342. width="180"
  343. align="center"
  344. >
  345. <template slot-scope="scope">
  346. <span v-if="!scope.row.isCategory">
  347. {{ scope.row.entryDate }}
  348. </span>
  349. </template>
  350. </el-table-column>
  351. <el-table-column
  352. prop="depreciationPeriod"
  353. label="折旧年限"
  354. width="120"
  355. align="center"
  356. >
  357. <template slot-scope="scope">
  358. <span v-if="!scope.row.isCategory">
  359. {{ scope.row.depreciationPeriod }}
  360. </span>
  361. </template>
  362. </el-table-column>
  363. <el-table-column
  364. prop="depreciationExpense"
  365. label="折旧费"
  366. width="120"
  367. align="center"
  368. >
  369. <template slot-scope="scope">
  370. <span v-if="!scope.row.isCategory">
  371. {{ scope.row.depreciationExpense }}
  372. </span>
  373. </template>
  374. </el-table-column>
  375. <el-table-column
  376. prop="fundSource"
  377. label="资金来源"
  378. width="120"
  379. align="center"
  380. >
  381. <template slot-scope="scope">
  382. <span v-if="!scope.row.isCategory">
  383. {{ scope.row.fundSource }}
  384. </span>
  385. </template>
  386. </el-table-column>
  387. <el-table-column prop="remark" label="备注" min-width="150">
  388. <template slot-scope="scope">
  389. <span v-if="!scope.row.isCategory">{{ scope.row.remark }}</span>
  390. </template>
  391. </el-table-column>
  392. </el-table>
  393. </div>
  394. </div>
  395. </el-dialog>
  396. <!-- 编辑弹窗 -->
  397. <el-dialog
  398. title="编辑"
  399. :visible.sync="editDialogVisible"
  400. width="90%"
  401. :append-to-body="true"
  402. :modal-append-to-body="false"
  403. :close-on-click-modal="false"
  404. >
  405. <!-- 固定资产表格 -->
  406. <div class="fixed-assets-table">
  407. <el-table
  408. :data="flattenedTableData"
  409. border
  410. style="width: 100%"
  411. size="small"
  412. >
  413. <el-table-column prop="seq" label="序号" width="80" align="center">
  414. <template slot-scope="scope">
  415. {{ scope.row.seq }}
  416. </template>
  417. </el-table-column>
  418. <el-table-column prop="name" label="项目" min-width="150">
  419. <template slot-scope="scope">
  420. <el-input
  421. v-if="!scope.row.isCategory"
  422. v-model="scope.row.name"
  423. placeholder="请输入项目名称"
  424. size="mini"
  425. ></el-input>
  426. <span v-else class="category-name">{{ scope.row.name }}</span>
  427. </template>
  428. </el-table-column>
  429. <el-table-column
  430. prop="unit"
  431. label="计量单位"
  432. width="120"
  433. align="center"
  434. >
  435. <template slot-scope="scope">
  436. <el-input
  437. v-if="!scope.row.isCategory"
  438. v-model="scope.row.unit"
  439. placeholder="单位"
  440. size="mini"
  441. ></el-input>
  442. </template>
  443. </el-table-column>
  444. <el-table-column
  445. prop="originalValue"
  446. label="固定资产原值"
  447. width="150"
  448. align="center"
  449. >
  450. <template slot-scope="scope">
  451. <el-input
  452. v-if="!scope.row.isCategory"
  453. v-model="scope.row.originalValue"
  454. placeholder="原值"
  455. size="mini"
  456. ></el-input>
  457. </template>
  458. </el-table-column>
  459. <el-table-column
  460. prop="entryDate"
  461. label="入帐或竣工验收日期"
  462. width="180"
  463. align="center"
  464. >
  465. <template slot-scope="scope">
  466. <el-date-picker
  467. v-if="!scope.row.isCategory"
  468. v-model="scope.row.entryDate"
  469. type="date"
  470. placeholder="选择日期"
  471. size="mini"
  472. format="yyyy-MM-dd"
  473. value-format="yyyy-MM-dd"
  474. ></el-date-picker>
  475. </template>
  476. </el-table-column>
  477. <el-table-column
  478. prop="depreciationPeriod"
  479. label="折旧年限"
  480. width="120"
  481. align="center"
  482. >
  483. <template slot-scope="scope">
  484. <el-input
  485. v-if="!scope.row.isCategory"
  486. v-model="scope.row.depreciationPeriod"
  487. placeholder="年限"
  488. size="mini"
  489. ></el-input>
  490. </template>
  491. </el-table-column>
  492. <el-table-column
  493. prop="depreciationExpense"
  494. label="折旧费"
  495. width="120"
  496. align="center"
  497. >
  498. <template slot-scope="scope">
  499. <el-input
  500. v-if="!scope.row.isCategory"
  501. v-model="scope.row.depreciationExpense"
  502. placeholder="费用"
  503. size="mini"
  504. ></el-input>
  505. </template>
  506. </el-table-column>
  507. <el-table-column
  508. prop="fundSource"
  509. label="资金来源"
  510. width="120"
  511. align="center"
  512. >
  513. <template slot-scope="scope">
  514. <el-input
  515. v-if="!scope.row.isCategory"
  516. v-model="scope.row.fundSource"
  517. placeholder="来源"
  518. size="mini"
  519. ></el-input>
  520. </template>
  521. </el-table-column>
  522. <el-table-column prop="remark" label="备注" min-width="150">
  523. <template slot-scope="scope">
  524. <el-input
  525. v-if="!scope.row.isCategory"
  526. v-model="scope.row.remark"
  527. placeholder="备注"
  528. size="mini"
  529. ></el-input>
  530. </template>
  531. </el-table-column>
  532. <el-table-column label="操作" width="100" align="center">
  533. <template slot-scope="scope">
  534. <div v-if="!scope.row.isCategory" class="operation-buttons">
  535. <el-button
  536. type="text"
  537. size="mini"
  538. icon="el-icon-plus"
  539. @click="handleAddRow(scope.row)"
  540. ></el-button>
  541. <el-button
  542. type="text"
  543. size="mini"
  544. icon="el-icon-minus"
  545. @click="handleDeleteRow(scope.row)"
  546. ></el-button>
  547. </div>
  548. </template>
  549. </el-table-column>
  550. </el-table>
  551. </div>
  552. <div class="form-actions">
  553. <el-button @click="editDialogVisible = false">取消</el-button>
  554. <el-button type="primary" @click="handleEditSave">确定</el-button>
  555. </div>
  556. </el-dialog>
  557. </el-dialog>
  558. </template>
  559. <script>
  560. import { Message } from 'element-ui'
  561. export default {
  562. name: 'OnlineFillDialog',
  563. props: {
  564. visible: {
  565. type: Boolean,
  566. default: false,
  567. },
  568. tableType: {
  569. type: String,
  570. default: '单记录',
  571. },
  572. surveyData: {
  573. type: Object,
  574. default: () => ({}),
  575. },
  576. },
  577. data() {
  578. return {
  579. dialogVisible: false,
  580. // 单记录表单数据
  581. singleRecordForm: {
  582. institutionName: '',
  583. institutionNature: '',
  584. institutionLevel: '',
  585. educationMode: '',
  586. institutionAddress: '',
  587. financialManager: '',
  588. formFiller: '',
  589. },
  590. singleRecordRules: {
  591. institutionName: [
  592. { required: true, message: '请输入机构名称', trigger: 'blur' },
  593. ],
  594. institutionNature: [
  595. { required: true, message: '请选择机构性质', trigger: 'change' },
  596. ],
  597. institutionLevel: [
  598. {
  599. required: true,
  600. message: '请选择机构评定等级',
  601. trigger: 'change',
  602. },
  603. ],
  604. educationMode: [
  605. {
  606. required: true,
  607. message: '请选择机构办学方式',
  608. trigger: 'change',
  609. },
  610. ],
  611. institutionAddress: [
  612. { required: true, message: '请输入机构地址', trigger: 'blur' },
  613. ],
  614. financialManager: [
  615. {
  616. required: true,
  617. message: '请输入机构财务负责人',
  618. trigger: 'blur',
  619. },
  620. ],
  621. formFiller: [
  622. { required: true, message: '请输入机构填表人', trigger: 'blur' },
  623. ],
  624. },
  625. // 固定表数据
  626. fixedTableData: [
  627. {
  628. project: '',
  629. unit: '',
  630. dynamicYear: null,
  631. remark: '',
  632. },
  633. ],
  634. // 动态表数据
  635. dynamicTableData: [
  636. {
  637. auditPeriod: '2023年1月-2023年12月',
  638. fillTime: '2023-12-01 10:00:00',
  639. lastModifyTime: '2023-12-01 10:00:00',
  640. detail: '固定资产表格数据',
  641. },
  642. ],
  643. // 选中的行
  644. selectedRows: [],
  645. // 弹窗控制
  646. detailDialogVisible: false,
  647. editDialogVisible: false,
  648. currentDetail: null,
  649. // 编辑表单
  650. editForm: {
  651. auditPeriod: '',
  652. detail: '',
  653. },
  654. editRules: {
  655. auditPeriod: [
  656. { required: true, message: '请输入监审期间', trigger: 'blur' },
  657. ],
  658. detail: [
  659. { required: true, message: '请输入详细信息', trigger: 'blur' },
  660. ],
  661. },
  662. // 固定资产表格数据 - 用于弹窗显示
  663. fixedAssetsData: [
  664. // 房屋建筑物
  665. {
  666. id: 'I',
  667. category: '房屋建筑物',
  668. items: [
  669. {
  670. id: 'I-1',
  671. name: '办公用房',
  672. unit: '',
  673. originalValue: '',
  674. entryDate: '',
  675. depreciationPeriod: '',
  676. depreciationExpense: '',
  677. fundSource: '',
  678. remark: '',
  679. },
  680. {
  681. id: 'I-2',
  682. name: '教保用房',
  683. unit: '',
  684. originalValue: '',
  685. entryDate: '',
  686. depreciationPeriod: '',
  687. depreciationExpense: '',
  688. fundSource: '',
  689. remark: '',
  690. },
  691. {
  692. id: 'I-3',
  693. name: '幼儿宿舍用房',
  694. unit: '',
  695. originalValue: '',
  696. entryDate: '',
  697. depreciationPeriod: '',
  698. depreciationExpense: '',
  699. fundSource: '',
  700. remark: '',
  701. },
  702. {
  703. id: 'I-4',
  704. name: '其它',
  705. unit: '',
  706. originalValue: '',
  707. entryDate: '',
  708. depreciationPeriod: '',
  709. depreciationExpense: '',
  710. fundSource: '',
  711. remark: '',
  712. },
  713. ],
  714. },
  715. // 交通运输工具
  716. {
  717. id: 'II',
  718. category: '交通运输工具',
  719. items: [
  720. {
  721. id: 'II-1',
  722. name: '车辆',
  723. unit: '',
  724. originalValue: '',
  725. entryDate: '',
  726. depreciationPeriod: '',
  727. depreciationExpense: '',
  728. fundSource: '',
  729. remark: '',
  730. },
  731. ],
  732. },
  733. // 教保专用设备
  734. {
  735. id: 'III',
  736. category: '教保专用设备',
  737. items: [
  738. {
  739. id: 'III-1',
  740. name: '电教',
  741. unit: '',
  742. originalValue: '',
  743. entryDate: '',
  744. depreciationPeriod: '',
  745. depreciationExpense: '',
  746. fundSource: '',
  747. remark: '',
  748. },
  749. {
  750. id: 'III-2',
  751. name: '文体',
  752. unit: '',
  753. originalValue: '',
  754. entryDate: '',
  755. depreciationPeriod: '',
  756. depreciationExpense: '',
  757. fundSource: '',
  758. remark: '',
  759. },
  760. ],
  761. },
  762. // 办公设备
  763. {
  764. id: 'IV',
  765. category: '办公设备',
  766. items: [
  767. {
  768. id: 'IV-1',
  769. name: '电脑',
  770. unit: '',
  771. originalValue: '',
  772. entryDate: '',
  773. depreciationPeriod: '',
  774. depreciationExpense: '',
  775. fundSource: '',
  776. remark: '',
  777. },
  778. ],
  779. },
  780. // 其它固定资产
  781. {
  782. id: 'V',
  783. category: '其它固定资产',
  784. items: [
  785. {
  786. id: 'V-1',
  787. name: '空调',
  788. unit: '',
  789. originalValue: '',
  790. entryDate: '',
  791. depreciationPeriod: '',
  792. depreciationExpense: '',
  793. fundSource: '',
  794. remark: '',
  795. },
  796. {
  797. id: 'V-2',
  798. name: '家电',
  799. unit: '',
  800. originalValue: '',
  801. entryDate: '',
  802. depreciationPeriod: '',
  803. depreciationExpense: '',
  804. fundSource: '',
  805. remark: '',
  806. },
  807. {
  808. id: 'V-3',
  809. name: '供水系统',
  810. unit: '',
  811. originalValue: '',
  812. entryDate: '',
  813. depreciationPeriod: '',
  814. depreciationExpense: '',
  815. fundSource: '',
  816. remark: '',
  817. },
  818. {
  819. id: 'V-4',
  820. name: '洗涤用具',
  821. unit: '',
  822. originalValue: '',
  823. entryDate: '',
  824. depreciationPeriod: '',
  825. depreciationExpense: '',
  826. fundSource: '',
  827. remark: '',
  828. },
  829. {
  830. id: 'V-5',
  831. name: '家具',
  832. unit: '',
  833. originalValue: '',
  834. entryDate: '',
  835. depreciationPeriod: '',
  836. depreciationExpense: '',
  837. fundSource: '',
  838. remark: '',
  839. },
  840. {
  841. id: 'V-6',
  842. name: '炊事用具',
  843. unit: '',
  844. originalValue: '',
  845. entryDate: '',
  846. depreciationPeriod: '',
  847. depreciationExpense: '',
  848. fundSource: '',
  849. remark: '',
  850. },
  851. {
  852. id: 'V-7',
  853. name: '其它',
  854. unit: '',
  855. originalValue: '',
  856. entryDate: '',
  857. depreciationPeriod: '',
  858. depreciationExpense: '',
  859. fundSource: '',
  860. remark: '',
  861. },
  862. ],
  863. },
  864. ],
  865. }
  866. },
  867. computed: {
  868. // 将嵌套的表格数据扁平化,用于表格显示
  869. flattenedTableData() {
  870. const result = []
  871. let seq = 1
  872. this.fixedAssetsData.forEach((category) => {
  873. // 添加分类行
  874. result.push({
  875. seq: category.id,
  876. name: category.category,
  877. isCategory: true,
  878. categoryId: category.id,
  879. })
  880. // 添加分类下的项目行
  881. category.items.forEach((item) => {
  882. result.push({
  883. ...item,
  884. seq: seq++,
  885. isCategory: false,
  886. categoryId: category.id,
  887. })
  888. })
  889. })
  890. return result
  891. },
  892. },
  893. watch: {
  894. visible: {
  895. handler(newVal) {
  896. this.dialogVisible = newVal
  897. },
  898. immediate: true,
  899. },
  900. },
  901. methods: {
  902. // 关闭弹窗
  903. handleClose() {
  904. this.$emit('update:visible', false)
  905. },
  906. // 取消
  907. handleCancel() {
  908. this.handleClose()
  909. },
  910. // 保存
  911. handleSave() {
  912. if (this.tableType === '单记录') {
  913. this.$refs.singleRecordForm.validate((valid) => {
  914. if (valid) {
  915. console.log('保存单记录数据:', this.singleRecordForm)
  916. Message.success('保存成功')
  917. } else {
  918. Message.error('请完善表单信息')
  919. return false
  920. }
  921. })
  922. } else if (this.tableType === '固定表') {
  923. console.log('保存固定表数据:', this.fixedTableData)
  924. Message.success('保存成功')
  925. } else if (this.tableType === '动态表') {
  926. // 动态表保存时不进行严格验证
  927. console.log('保存动态表数据:', this.dynamicTableData)
  928. Message.success('保存成功')
  929. }
  930. },
  931. // 提交
  932. handleSubmit() {
  933. if (this.tableType === '单记录') {
  934. this.$refs.singleRecordForm.validate((valid) => {
  935. if (valid) {
  936. console.log('提交单记录数据:', this.singleRecordForm)
  937. Message.success('提交成功')
  938. this.handleClose()
  939. } else {
  940. Message.error('请完善表单信息')
  941. return false
  942. }
  943. })
  944. } else if (this.tableType === '固定表') {
  945. console.log('提交固定表数据:', this.fixedTableData)
  946. Message.success('提交成功')
  947. this.handleClose()
  948. } else if (this.tableType === '动态表') {
  949. // 动态表提交时不进行验证
  950. console.log('提交动态表数据:', this.dynamicTableData)
  951. Message.success('提交成功')
  952. this.handleClose()
  953. }
  954. },
  955. // 固定表相关方法
  956. handleAddFixedRow() {
  957. this.fixedTableData.push({
  958. project: '',
  959. unit: '',
  960. dynamicYear: null,
  961. remark: '',
  962. })
  963. },
  964. handleDeleteFixedRow(index) {
  965. this.$confirm('确定删除该行吗?', '提示', {
  966. confirmButtonText: '确定',
  967. cancelButtonText: '取消',
  968. type: 'warning',
  969. }).then(() => {
  970. this.fixedTableData.splice(index, 1)
  971. Message.success('删除成功')
  972. })
  973. },
  974. // 固定资产表格相关方法
  975. handleAddRow(row) {
  976. // 找到对应的分类
  977. const category = this.fixedAssetsData.find(
  978. (cat) => cat.id === row.categoryId
  979. )
  980. if (category) {
  981. // 生成新的项目ID
  982. const newId = `${row.categoryId}-${Date.now()}`
  983. const newItem = {
  984. id: newId,
  985. name: '',
  986. unit: '',
  987. originalValue: '',
  988. entryDate: '',
  989. depreciationPeriod: '',
  990. depreciationExpense: '',
  991. fundSource: '',
  992. remark: '',
  993. }
  994. // 在指定行后插入新行
  995. const itemIndex = category.items.findIndex(
  996. (item) => item.id === row.id
  997. )
  998. if (itemIndex !== -1) {
  999. category.items.splice(itemIndex + 1, 0, newItem)
  1000. } else {
  1001. category.items.push(newItem)
  1002. }
  1003. Message.success('添加行成功')
  1004. }
  1005. },
  1006. handleDeleteRow(row) {
  1007. this.$confirm('确定删除该行吗?', '提示', {
  1008. confirmButtonText: '确定',
  1009. cancelButtonText: '取消',
  1010. type: 'warning',
  1011. }).then(() => {
  1012. // 找到对应的分类
  1013. const category = this.fixedAssetsData.find(
  1014. (cat) => cat.id === row.categoryId
  1015. )
  1016. if (category) {
  1017. const itemIndex = category.items.findIndex(
  1018. (item) => item.id === row.id
  1019. )
  1020. if (itemIndex !== -1) {
  1021. category.items.splice(itemIndex, 1)
  1022. Message.success('删除成功')
  1023. }
  1024. }
  1025. })
  1026. },
  1027. // 动态表相关方法
  1028. handleAddDynamicRow() {
  1029. const newRow = {
  1030. auditPeriod: '',
  1031. fillTime: new Date().toLocaleString(),
  1032. lastModifyTime: new Date().toLocaleString(),
  1033. detail: '',
  1034. }
  1035. this.dynamicTableData.unshift(newRow)
  1036. // 打开编辑弹窗
  1037. this.handleEdit(newRow)
  1038. },
  1039. handleBatchDelete() {
  1040. if (this.selectedRows.length === 0) {
  1041. Message.warning('请选择要删除的行')
  1042. return
  1043. }
  1044. this.$confirm(
  1045. `确定删除选中的 ${this.selectedRows.length} 行吗?`,
  1046. '提示',
  1047. {
  1048. confirmButtonText: '确定',
  1049. cancelButtonText: '取消',
  1050. type: 'warning',
  1051. }
  1052. ).then(() => {
  1053. this.selectedRows.forEach((row) => {
  1054. const index = this.dynamicTableData.indexOf(row)
  1055. if (index > -1) {
  1056. this.dynamicTableData.splice(index, 1)
  1057. }
  1058. })
  1059. this.selectedRows = []
  1060. Message.success('删除成功')
  1061. })
  1062. },
  1063. handleSelectionChange(selection) {
  1064. this.selectedRows = selection
  1065. },
  1066. handleViewDetail(row) {
  1067. // 详情弹窗显示整个表格数据
  1068. this.currentDetail = this.dynamicTableData
  1069. this.detailDialogVisible = true
  1070. },
  1071. handleEdit(row) {
  1072. // 编辑弹窗显示整个表格数据
  1073. this.currentDetail = this.dynamicTableData
  1074. this.editDialogVisible = true
  1075. },
  1076. handleDelete(row) {
  1077. this.$confirm('确定删除该行吗?', '提示', {
  1078. confirmButtonText: '确定',
  1079. cancelButtonText: '取消',
  1080. type: 'warning',
  1081. }).then(() => {
  1082. const index = this.dynamicTableData.indexOf(row)
  1083. if (index > -1) {
  1084. this.dynamicTableData.splice(index, 1)
  1085. }
  1086. Message.success('删除成功')
  1087. })
  1088. },
  1089. handleEditSave() {
  1090. // 编辑保存逻辑 - 验证固定资产表格
  1091. const validationErrors = this.validateFixedAssetsTable()
  1092. if (validationErrors.length > 0) {
  1093. Message.error('表单验证失败,请检查以下问题:')
  1094. validationErrors.forEach((error) => {
  1095. console.error(error)
  1096. })
  1097. return false
  1098. }
  1099. console.log('编辑保存数据:', this.fixedAssetsData)
  1100. Message.success('编辑保存成功')
  1101. this.editDialogVisible = false
  1102. },
  1103. // 表单验证
  1104. validateFixedAssetsTable() {
  1105. const errors = []
  1106. this.fixedAssetsData.forEach((category) => {
  1107. category.items.forEach((item, index) => {
  1108. const rowNum = index + 1
  1109. // 必填字段验证
  1110. if (!item.name) {
  1111. errors.push(
  1112. `${category.category} 第${rowNum}行:项目名称不能为空`
  1113. )
  1114. }
  1115. if (!item.unit) {
  1116. errors.push(
  1117. `${category.category} 第${rowNum}行:计量单位不能为空`
  1118. )
  1119. }
  1120. if (!item.originalValue) {
  1121. errors.push(
  1122. `${category.category} 第${rowNum}行:固定资产原值不能为空`
  1123. )
  1124. }
  1125. if (!item.entryDate) {
  1126. errors.push(
  1127. `${category.category} 第${rowNum}行:入帐或竣工验收日期不能为空`
  1128. )
  1129. }
  1130. if (!item.depreciationPeriod) {
  1131. errors.push(
  1132. `${category.category} 第${rowNum}行:折旧年限不能为空`
  1133. )
  1134. }
  1135. if (!item.depreciationExpense) {
  1136. errors.push(`${category.category} 第${rowNum}行:折旧费不能为空`)
  1137. }
  1138. if (!item.fundSource) {
  1139. errors.push(
  1140. `${category.category} 第${rowNum}行:资金来源不能为空`
  1141. )
  1142. }
  1143. // 格式验证
  1144. if (
  1145. item.originalValue &&
  1146. !/^\d+(\.\d+)?$/.test(item.originalValue)
  1147. ) {
  1148. errors.push(
  1149. `${category.category} 第${rowNum}行:固定资产原值格式不正确`
  1150. )
  1151. }
  1152. if (
  1153. item.depreciationPeriod &&
  1154. !/^\d+$/.test(item.depreciationPeriod)
  1155. ) {
  1156. errors.push(
  1157. `${category.category} 第${rowNum}行:折旧年限必须为正整数`
  1158. )
  1159. }
  1160. if (
  1161. item.depreciationExpense &&
  1162. !/^\d+(\.\d+)?$/.test(item.depreciationExpense)
  1163. ) {
  1164. errors.push(
  1165. `${category.category} 第${rowNum}行:折旧费格式不正确`
  1166. )
  1167. }
  1168. })
  1169. })
  1170. return errors
  1171. },
  1172. },
  1173. }
  1174. </script>
  1175. <style scoped lang="scss">
  1176. .online-fill-container {
  1177. padding: 20px;
  1178. }
  1179. .page-header {
  1180. margin-bottom: 20px;
  1181. h3 {
  1182. margin: 0;
  1183. font-size: 20px;
  1184. font-weight: bold;
  1185. }
  1186. }
  1187. .action-buttons {
  1188. margin-bottom: 20px;
  1189. }
  1190. .main-content {
  1191. .form-section,
  1192. .table-section {
  1193. margin-bottom: 20px;
  1194. }
  1195. }
  1196. .card-header {
  1197. display: flex;
  1198. justify-content: space-between;
  1199. align-items: center;
  1200. span {
  1201. font-weight: bold;
  1202. font-size: 16px;
  1203. }
  1204. }
  1205. .form-actions {
  1206. margin-top: 20px;
  1207. text-align: right;
  1208. .el-button {
  1209. margin-left: 10px;
  1210. }
  1211. }
  1212. .dialog-footer {
  1213. text-align: right;
  1214. .el-button {
  1215. margin-left: 10px;
  1216. }
  1217. }
  1218. // 固定资产表格样式
  1219. .fixed-assets-table {
  1220. .category-name {
  1221. font-weight: bold;
  1222. color: #409eff;
  1223. background-color: #f5f7fa;
  1224. padding: 8px;
  1225. display: block;
  1226. }
  1227. .operation-buttons {
  1228. display: flex;
  1229. justify-content: center;
  1230. gap: 5px;
  1231. .el-button {
  1232. padding: 5px;
  1233. min-width: 24px;
  1234. height: 24px;
  1235. }
  1236. }
  1237. // 分类行样式
  1238. ::v-deep .el-table__row {
  1239. &.category-row {
  1240. background-color: #f5f7fa;
  1241. td {
  1242. background-color: #f5f7fa !important;
  1243. font-weight: bold;
  1244. color: #409eff;
  1245. }
  1246. }
  1247. }
  1248. // 输入框样式
  1249. ::v-deep .el-input__inner {
  1250. border: 1px solid #dcdfe6;
  1251. border-radius: 4px;
  1252. &:focus {
  1253. border-color: #409eff;
  1254. }
  1255. }
  1256. // 日期选择器样式
  1257. ::v-deep .el-date-editor {
  1258. width: 100%;
  1259. }
  1260. }
  1261. // 详情弹窗样式
  1262. .detail-content {
  1263. .fixed-assets-table {
  1264. .category-name {
  1265. font-weight: bold;
  1266. color: #409eff;
  1267. background-color: #f5f7fa;
  1268. padding: 8px;
  1269. display: block;
  1270. }
  1271. // 只读模式下的样式
  1272. ::v-deep .el-table__row {
  1273. &.category-row {
  1274. background-color: #f5f7fa;
  1275. td {
  1276. background-color: #f5f7fa !important;
  1277. font-weight: bold;
  1278. color: #409eff;
  1279. }
  1280. }
  1281. }
  1282. // 只读文本样式
  1283. span {
  1284. display: inline-block;
  1285. padding: 4px 8px;
  1286. min-height: 20px;
  1287. line-height: 20px;
  1288. }
  1289. }
  1290. }
  1291. </style>