workDraft.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <template>
  2. <div class="work-draft-container">
  3. <ht-editor
  4. v-model="workingPaperContent"
  5. class="working-paper-editor"
  6. height="500px"
  7. width="100%"
  8. :config="editorConfig"
  9. @ready="onEditorReady"
  10. />
  11. <!-- 工作底稿列表 -->
  12. <div>
  13. <el-button type="primary" size="small" @click="handleAddWorkingPaper">
  14. 核增核减记录
  15. </el-button>
  16. </div>
  17. <el-table
  18. :data="workingPaperRecords"
  19. style="width: 100%; margin-top: 20px"
  20. border
  21. >
  22. <el-table-column type="selection" width="55"></el-table-column>
  23. <el-table-column prop="id" label="序号" width="80"></el-table-column>
  24. <el-table-column
  25. prop="auditSubject"
  26. label="核增核减科目"
  27. width="180"
  28. ></el-table-column>
  29. <el-table-column
  30. prop="basicInfo"
  31. label="基本情况"
  32. width="200"
  33. ></el-table-column>
  34. <el-table-column prop="auditDesc" label="核增核减说明"></el-table-column>
  35. <el-table-column
  36. prop="auditTime"
  37. label="时间"
  38. width="180"
  39. ></el-table-column>
  40. <el-table-column label="附件" width="100">
  41. <template slot-scope="scope">
  42. <el-button
  43. v-if="scope.row.attachments && scope.row.attachments.length > 0"
  44. type="text"
  45. size="small"
  46. @click="handlePreviewWorkingPaperAttachment(scope.row)"
  47. >
  48. 查看
  49. </el-button>
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="操作" width="150">
  53. <template slot-scope="scope">
  54. <el-button
  55. type="text"
  56. size="small"
  57. @click="handleEditWorkingPaper(scope.row)"
  58. >
  59. 修改
  60. </el-button>
  61. <el-button
  62. type="text"
  63. size="small"
  64. @click="handleDeleteWorkingPaper(scope.row)"
  65. >
  66. 删除
  67. </el-button>
  68. </template>
  69. </el-table-column>
  70. </el-table>
  71. <!-- 工作底稿编辑弹窗 -->
  72. <el-dialog
  73. :title="workingPaperDialogTitle"
  74. :visible.sync="workingPaperDialogVisible"
  75. width="70%"
  76. >
  77. <el-form
  78. ref="workingPaperForm"
  79. :model="workingPaperForm"
  80. :rules="workingPaperRules"
  81. label-width="120px"
  82. >
  83. <el-form-item label="被审核科目" prop="auditSubject">
  84. <el-input
  85. v-model="workingPaperForm.auditSubject"
  86. placeholder="请输入被审核科目"
  87. />
  88. </el-form-item>
  89. <el-form-item label="基本情况" prop="basicInfo">
  90. <el-input
  91. v-model="workingPaperForm.basicInfo"
  92. type="textarea"
  93. :rows="4"
  94. placeholder="请输入基本情况"
  95. />
  96. </el-form-item>
  97. <el-form-item label="核增核减说明" prop="auditDesc">
  98. <el-input
  99. v-model="workingPaperForm.auditDesc"
  100. type="textarea"
  101. :rows="4"
  102. placeholder="请输入核增核减说明"
  103. />
  104. </el-form-item>
  105. <el-form-item label="日期">
  106. <el-date-picker
  107. v-model="workingPaperForm.auditDate"
  108. type="date"
  109. placeholder="选择日期"
  110. style="width: 100%"
  111. />
  112. </el-form-item>
  113. <el-form-item label="时间范围">
  114. <div style="display: flex; gap: 10px">
  115. <el-time-picker
  116. v-model="workingPaperForm.startTime"
  117. format="HH:mm"
  118. placeholder="开始时间"
  119. style="flex: 1"
  120. />
  121. <span>-</span>
  122. <el-time-picker
  123. v-model="workingPaperForm.endTime"
  124. format="HH:mm"
  125. placeholder="结束时间"
  126. style="flex: 1"
  127. />
  128. </div>
  129. </el-form-item>
  130. </el-form>
  131. <div slot="footer" class="dialog-footer">
  132. <el-button @click="workingPaperDialogVisible = false">取消</el-button>
  133. <el-button type="primary" @click="handleWorkingPaperSubmit">
  134. 确定
  135. </el-button>
  136. </div>
  137. </el-dialog>
  138. </div>
  139. </template>
  140. <script>
  141. export default {
  142. name: 'WorkDraft',
  143. data() {
  144. return {
  145. editorConfig: {
  146. // 可以在这里覆盖全局配置的选项
  147. height: '300px',
  148. placeholder: '请输入内容...',
  149. excludeMenus: ['image', 'video'],
  150. },
  151. // 工作底稿数据
  152. workingPaperContent: '工作底稿内容将在这里展示。',
  153. // 工作底稿记录列表
  154. workingPaperRecords: [
  155. {
  156. id: '001',
  157. auditSubject: '科目核减',
  158. basicInfo: '该科目存在多计费用情况',
  159. auditDesc: '根据凭证检查,发现重复列支费用20万元,建议核减',
  160. auditTime: '2025-01-20 13:00-17:00',
  161. attachments: ['审计凭证.pdf'],
  162. },
  163. {
  164. id: '002',
  165. auditSubject: '科目核增',
  166. basicInfo: '该科目存在少计收入情况',
  167. auditDesc: '通过银行流水核对,发现未入账收入15万元,建议核增',
  168. auditTime: '2025-01-27 14:00-17:30',
  169. attachments: [],
  170. },
  171. {
  172. id: '003',
  173. auditSubject: '费用列支',
  174. basicInfo: '检查期间费用列支情况',
  175. auditDesc: '发现部分费用列支不规范,需补充说明材料',
  176. auditTime: '2025-01-30 09:00-18:00',
  177. attachments: ['费用明细.xlsx'],
  178. },
  179. ],
  180. // 工作底稿弹窗
  181. workingPaperDialogVisible: false,
  182. workingPaperDialogTitle: '添加工作底稿',
  183. isEditWorkingPaper: false,
  184. workingPaperForm: {
  185. id: '',
  186. auditSubject: '',
  187. basicInfo: '',
  188. auditDesc: '',
  189. auditDate: '',
  190. startTime: '',
  191. endTime: '',
  192. attachments: [],
  193. },
  194. workingPaperRules: {
  195. auditSubject: [
  196. { required: true, message: '请输入被审核科目', trigger: 'blur' },
  197. ],
  198. basicInfo: [
  199. { required: true, message: '请输入基本情况', trigger: 'blur' },
  200. ],
  201. auditDesc: [
  202. { required: true, message: '请输入核增核减说明', trigger: 'blur' },
  203. ],
  204. },
  205. }
  206. },
  207. methods: {
  208. onEditorReady(editor) {
  209. // 编辑器初始化完成后的回调
  210. console.log('编辑器已就绪', editor)
  211. // 可以在这里获取编辑器实例,进行更多操作
  212. },
  213. // 工作底稿操作
  214. handleAddWorkingPaper() {
  215. this.isEditWorkingPaper = false
  216. this.workingPaperDialogTitle = '添加工作底稿'
  217. this.workingPaperForm = {
  218. id: '',
  219. auditSubject: '',
  220. basicInfo: '',
  221. auditDesc: '',
  222. auditDate: new Date(),
  223. startTime: '',
  224. endTime: '',
  225. attachments: [],
  226. }
  227. this.workingPaperDialogVisible = true
  228. },
  229. handleEditWorkingPaper(row) {
  230. this.isEditWorkingPaper = true
  231. this.workingPaperDialogTitle = '修改工作底稿'
  232. const timeParts = row.auditTime.split(' ')
  233. const date = timeParts[0]
  234. const timeRange = timeParts[1].split('-')
  235. this.workingPaperForm = {
  236. ...row,
  237. auditDate: new Date(date),
  238. startTime: timeRange[0],
  239. endTime: timeRange[1],
  240. }
  241. this.workingPaperDialogVisible = true
  242. },
  243. handleDeleteWorkingPaper(row) {
  244. this.$confirm('确定要删除这条工作底稿吗?', '提示', {
  245. confirmButtonText: '确定',
  246. cancelButtonText: '取消',
  247. type: 'warning',
  248. })
  249. .then(() => {
  250. const index = this.workingPaperRecords.indexOf(row)
  251. if (index !== -1) {
  252. this.workingPaperRecords.splice(index, 1)
  253. }
  254. this.$message({ type: 'success', message: '工作底稿已删除' })
  255. })
  256. .catch(() => {
  257. this.$message({ type: 'info', message: '已取消删除' })
  258. })
  259. },
  260. handleWorkingPaperSubmit() {
  261. this.$refs.workingPaperForm.validate((valid) => {
  262. if (valid) {
  263. const auditDate = new Date(this.workingPaperForm.auditDate)
  264. const formattedDate = `${auditDate.getFullYear()}-${String(
  265. auditDate.getMonth() + 1
  266. ).padStart(2, '0')}-${String(auditDate.getDate()).padStart(2, '0')}`
  267. const auditTime = `${formattedDate} ${
  268. this.workingPaperForm.startTime || '00:00'
  269. }-${this.workingPaperForm.endTime || '23:59'}`
  270. if (this.isEditWorkingPaper) {
  271. // 修改操作
  272. const index = this.workingPaperRecords.findIndex(
  273. (item) => item.id === this.workingPaperForm.id
  274. )
  275. if (index !== -1) {
  276. this.workingPaperRecords[index] = {
  277. ...this.workingPaperRecords[index],
  278. auditSubject: this.workingPaperForm.auditSubject,
  279. basicInfo: this.workingPaperForm.basicInfo,
  280. auditDesc: this.workingPaperForm.auditDesc,
  281. auditTime: auditTime,
  282. }
  283. this.$message({ type: 'success', message: '工作底稿修改成功' })
  284. }
  285. } else {
  286. // 添加操作
  287. const newId = String(
  288. this.workingPaperRecords.length + 1
  289. ).padStart(3, '0')
  290. this.workingPaperRecords.push({
  291. id: newId,
  292. auditSubject: this.workingPaperForm.auditSubject,
  293. basicInfo: this.workingPaperForm.basicInfo,
  294. auditDesc: this.workingPaperForm.auditDesc,
  295. auditTime: auditTime,
  296. attachments: [],
  297. })
  298. this.$message({ type: 'success', message: '工作底稿添加成功' })
  299. }
  300. this.workingPaperDialogVisible = false
  301. }
  302. })
  303. },
  304. handlePreviewWorkingPaperAttachment(row) {
  305. this.$message({
  306. type: 'info',
  307. message: `预览附件:${row.attachments.join(', ')}`,
  308. })
  309. },
  310. },
  311. }
  312. </script>
  313. <style scoped>
  314. .work-draft-container {
  315. padding: 20px;
  316. }
  317. .working-paper-editor {
  318. margin-bottom: 20px;
  319. }
  320. </style>