audit-archives-list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. <template>
  2. <div :class="$style.mainDiv">
  3. <a-card>
  4. <!-- 高级搜索组件 -->
  5. <audit-advanced-query
  6. :expand="expand"
  7. :search-data="formData"
  8. :ref-name="searchform"
  9. :search-style="{ height: '170px', left: '20px', top: '57px' }"
  10. :search-fun="handleSearch"
  11. @searchedClick="searchedClick"
  12. @resetForm="resetForm"
  13. >
  14. <template>
  15. <a-col :span="12">
  16. <a-form-model-item :label="'年\u2002\u2002\u2002\u2002度:'">
  17. <a-date-picker
  18. v-model="formData.year"
  19. mode="year"
  20. format="YYYY"
  21. :allow-clear="false"
  22. placeholder="选择年份"
  23. :input-read-only="true"
  24. :open="yearShow"
  25. style-echartclass-open-change="openChange"
  26. @openChange="openChange"
  27. @panelChange="panelYearChange"
  28. ></a-date-picker>
  29. </a-form-model-item>
  30. </a-col>
  31. <a-col :span="12">
  32. <a-form-model-item :label="'项目名称'" prop="projectName">
  33. <a-input v-model="formData.projectName" allow-clear />
  34. </a-form-model-item>
  35. </a-col>
  36. <a-col :span="12">
  37. <a-form-model-item :label="'档案编号'" prop="archivesCode">
  38. <a-input v-model="formData.archivesCode" allow-clear />
  39. </a-form-model-item>
  40. </a-col>
  41. <a-col :span="12">
  42. <a-form-model-item :label="'案卷状态'" prop="fileState">
  43. <a-select v-model="formData.fileState" :allow-clear="true">
  44. <a-select-option :value="'FILING'"> 立卷 </a-select-option>
  45. <a-select-option :value="'STAY_FILE'"> 待归档 </a-select-option>
  46. <a-select-option :value="'ALREADY_FILE'"> 已归档 </a-select-option>
  47. </a-select>
  48. </a-form-model-item>
  49. </a-col>
  50. </template>
  51. </audit-advanced-query>
  52. <sd-data-table-ex
  53. ref="archivesDataTable"
  54. :filter-expressions="expressions"
  55. :columns="czflag ? columnscz : columns"
  56. :actions="actions"
  57. form-id="iamArchivesMaintain"
  58. data-url="api/xcoa-mobile/v1/iamarchivesmaintain/all-list"
  59. :search-fields="['projectName', 'archivesCode', 'fileState']"
  60. show-selection
  61. :show-advance-query="true"
  62. @searchbtnClick="searchbtnClick"
  63. >
  64. <div slot="islink" slot-scope="text, record">
  65. <a :title="text" @click="rowClick(record)">{{ text }}</a>
  66. </div>
  67. </sd-data-table-ex>
  68. </a-card>
  69. </div>
  70. </template>
  71. <script>
  72. import moment from 'moment'
  73. import { message, Modal } from 'ant-design-vue'
  74. import auditAdvancedQueryMixins from '../../components/audit-advanced-query-mixins'
  75. import auditAdvancedGroupMixins from '../../components/audit-advanced-group-mixins'
  76. import auditAdvancedQuery from '../../components/audit-advanced-query.vue'
  77. import AuditArchivesService from './audit-archives-service'
  78. import components from './_import-components/audit-archives-list-import'
  79. import PageService from '@/common/services/page-service'
  80. import axios from '@/common/services/axios-instance'
  81. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  82. import TableColumnTypes from '@/common/services/table-column-types'
  83. import TableActionTypes from '@/common/services/table-action-types'
  84. import SdIcon from '@/common/components/sd-icon'
  85. import download from '@/common/services/download'
  86. export default {
  87. name: 'AuditArchivesList',
  88. metaInfo: {
  89. title: '档案管理',
  90. },
  91. components: {
  92. ...components,
  93. auditAdvancedQuery,
  94. },
  95. mixins: [auditAdvancedQueryMixins, auditAdvancedGroupMixins],
  96. data() {
  97. return {
  98. year: '',
  99. searchYear: '',
  100. yearShow: false,
  101. searchform: 'searchform',
  102. formData: {
  103. year: '',
  104. },
  105. formId: 'iamArchivesMaintain',
  106. expressions: [],
  107. columns: [
  108. {
  109. title: '序号',
  110. dataIndex: 'sortNumber',
  111. customRender: (text, record, index) => `${index + 1}`,
  112. width: '80px',
  113. },
  114. {
  115. title: '项目名称',
  116. dataIndex: 'projectName',
  117. scopedSlots: { customRender: 'islink' },
  118. width: '35%',
  119. },
  120. {
  121. title: '档案编号',
  122. dataIndex: 'archivesCode',
  123. sorter: true,
  124. defaultSortOrder: 'descend', // 没有点击任何排序列时,默认的排序列
  125. },
  126. {
  127. title: '案卷状态',
  128. dataIndex: 'fileState',
  129. },
  130. {
  131. title: '档案类型',
  132. dataIndex: 'archivesType',
  133. },
  134. {
  135. title: '归档时间',
  136. dataIndex: 'filingDate',
  137. sorter: true,
  138. sdRender: TableColumnTypes.dateTime,
  139. },
  140. ],
  141. columnscz: [
  142. {
  143. title: '序号',
  144. dataIndex: 'sortNumber',
  145. customRender: (text, record, index) => `${index + 1}`,
  146. width: '80px',
  147. },
  148. {
  149. title: '项目名称',
  150. dataIndex: 'projectName',
  151. scopedSlots: { customRender: 'islink' },
  152. width: '35%',
  153. },
  154. {
  155. title: '档案编号',
  156. dataIndex: 'archivesCode',
  157. sorter: true,
  158. defaultSortOrder: 'descend', // 没有点击任何排序列时,默认的排序列
  159. },
  160. {
  161. title: '案卷状态',
  162. dataIndex: 'fileState',
  163. },
  164. {
  165. title: '档案类型',
  166. dataIndex: 'archivesType',
  167. },
  168. {
  169. title: '归档时间',
  170. dataIndex: 'filingDate',
  171. sorter: true,
  172. sdRender: TableColumnTypes.dateTime,
  173. },
  174. {
  175. title: '操作',
  176. dataIndex: 'opt',
  177. sdHidden: false,
  178. customRender: (text, record, index) => {
  179. if (record.fileState !== '立卷') {
  180. if (record.fileState !== '已归档') {
  181. return (
  182. <span>
  183. <a-button
  184. type='link'
  185. size='small'
  186. title='归档'
  187. vOn:click={(evt) => this.isNotfileBtn(record.id, 'ALREADY_FILE')}
  188. >
  189. <SdIcon type='sd-audit-archive' theme='fill' />
  190. </a-button>
  191. </span>
  192. )
  193. } else {
  194. return (
  195. <span>
  196. <a-button
  197. type='link'
  198. size='small'
  199. title='重新归档'
  200. vOn:click={(evt) => this.isNotfileBtn(record.id, 'FILING')}
  201. >
  202. <SdIcon type='sd-audit-archives-management' theme='fill' />
  203. </a-button>
  204. </span>
  205. )
  206. }
  207. }
  208. },
  209. },
  210. ],
  211. // 项目组长/项目副组长——查看自己相关所有的
  212. actions: [],
  213. czflag: true,
  214. }
  215. },
  216. mounted() {
  217. this.setUserType()
  218. },
  219. methods: {
  220. // 档案管理员——查看所有
  221. setUserType() {
  222. axios({
  223. url: 'api/xcoa-mobile/v1/iamarchivesmaintain/findHasPermission',
  224. method: 'post',
  225. }).then((res) => {
  226. if (res.data === true) {
  227. this.refresh()
  228. this.actions = [
  229. {
  230. label: '删除',
  231. id: 'delete',
  232. permission: null,
  233. type: TableActionTypes.batch,
  234. callback: this.deleteRows,
  235. },
  236. {
  237. label: '新建',
  238. id: 'new',
  239. permission: 'create',
  240. type: TableActionTypes.primary,
  241. callback: () => {
  242. const url = '/audit-archives-form' // 新页面要打开的路由地址
  243. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  244. if (refreshFlag) {
  245. // 这里写或者调刷新的方法
  246. this.refresh()
  247. }
  248. })
  249. },
  250. },
  251. {
  252. label: '导出',
  253. id: 'export',
  254. permission: null,
  255. callback: () => {
  256. this.exportdata()
  257. },
  258. },
  259. ]
  260. } else {
  261. this.czflag = false
  262. }
  263. })
  264. },
  265. exportdata() {
  266. const selectedRowKeys = this.$refs.archivesDataTable.getSelectedRowKeys()
  267. if (selectedRowKeys.length === 0) {
  268. Modal.warning({
  269. title: '提示',
  270. content: '请选择导出的数据!',
  271. })
  272. return false
  273. }
  274. AuditArchivesService.fileExport(selectedRowKeys.join(',')).then((res) => {
  275. if (res.status === 200) {
  276. const url = URL.createObjectURL(res.data)
  277. const filename = res.headers['content-disposition']
  278. const fname = filename.substring(filename.indexOf('fileName=') + 9, filename.length)
  279. download(url, decodeURI(fname))
  280. } else {
  281. Modal.warning({
  282. title: '提示',
  283. content: '导出报错,请联系管理员!',
  284. })
  285. return false
  286. }
  287. })
  288. },
  289. // 是否归档
  290. isNotfileBtn(id, value) {
  291. axios({
  292. url: `api/xcoa-mobile/v1/iamarchivesmaintain/isNotfileBtn?id=${id}&isNotfile=${value}`,
  293. method: 'post',
  294. }).then((res) => {
  295. if (res.data === true) {
  296. if (value === 'FILING') {
  297. message.success('重新归档')
  298. } else {
  299. message.success('归档成功')
  300. }
  301. this.$refs.archivesDataTable.refresh()
  302. } else {
  303. Modal.error({
  304. title: '修改失败,请联系管理员!',
  305. })
  306. }
  307. })
  308. },
  309. // 删除数据
  310. deleteRows(record) {
  311. const selecteArchivesType = this.$refs.archivesDataTable.getSelectedRows()
  312. const selectedRowKeys = this.$refs.archivesDataTable.getSelectedRowKeys()
  313. if (selectedRowKeys.length === 0) {
  314. Modal.info({
  315. content: '请选择需要删除的文件',
  316. })
  317. return
  318. }
  319. let flag = false
  320. selecteArchivesType.forEach((item) => {
  321. if (item.archivesType === '系统档案') {
  322. flag = true
  323. }
  324. if (item.fileState !== '立卷') {
  325. flag = true
  326. }
  327. })
  328. if (flag) {
  329. // 有过错误
  330. Modal.error({
  331. title: '删除失败,存在“系统档案”、“已归档”、“待归档”数据!',
  332. })
  333. } else {
  334. Modal.confirm({
  335. title: '你确定删除这项内容吗?',
  336. content: '删除这条数据后,就无法恢复初始的状态。',
  337. okText: '删除',
  338. okType: 'danger',
  339. onOk: () => {
  340. this.loading = true
  341. const params = {
  342. ids: selectedRowKeys.join(','),
  343. }
  344. PageService.delete(params, this.formId).then((res) => {
  345. if (res.status === 200) {
  346. message.success({ content: '删除成功!' }, 1).then(() => {
  347. this.$refs.archivesDataTable.clearSelection()
  348. this.$refs.archivesDataTable.refresh()
  349. this.loading = false
  350. })
  351. }
  352. })
  353. },
  354. })
  355. }
  356. },
  357. moment,
  358. panelYearChange(value) {
  359. this.year = value
  360. this.formData.year = value
  361. this.searchYear = moment(value).format('YYYY')
  362. this.yearShow = false
  363. },
  364. // 弹出日历和关闭日历的回调
  365. openChange(status) {
  366. // status是打开或关闭的状态
  367. if (status) {
  368. this.yearShow = true
  369. } else {
  370. this.yearShow = false
  371. }
  372. },
  373. refresh() {
  374. return this.$refs.archivesDataTable.refresh(true)
  375. },
  376. rowClick(record) {
  377. const url = '/audit-archives-form?record=' + record.id // 新页面要打开的路由地址
  378. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  379. if (refreshFlag) {
  380. this.refresh()
  381. }
  382. })
  383. },
  384. // 查询
  385. handleSearch() {
  386. this.expressions = []
  387. // 年度
  388. if (this.searchYear) {
  389. this.expressions.push({
  390. dataType: 'str',
  391. name: 'searchYear',
  392. op: 'like',
  393. stringValue: `${this.searchYear}`,
  394. })
  395. }
  396. // 项目名称
  397. if (this.formData.projectName) {
  398. this.expressions.push({
  399. dataType: 'str',
  400. name: 'projectName',
  401. op: 'like',
  402. stringValue: `${this.formData.projectName}`,
  403. })
  404. }
  405. // 档案编号
  406. if (this.formData.archivesCode) {
  407. this.expressions.push({
  408. dataType: 'str',
  409. name: 'archivesCode',
  410. op: 'like',
  411. stringValue: `${this.formData.archivesCode}`,
  412. })
  413. }
  414. // 案卷状态
  415. if (this.formData.fileState) {
  416. this.expressions.push({
  417. dataType: 'str',
  418. name: 'fileState',
  419. op: 'like',
  420. stringValue: `${this.formData.fileState}`,
  421. })
  422. }
  423. },
  424. // 重置年份
  425. resetForm() {
  426. this.formData.year = null
  427. this.searchYear = null
  428. },
  429. },
  430. }
  431. </script>
  432. <style module lang="scss">
  433. @use '@/common/design' as *;
  434. .main-div {
  435. :global(.ant-calendar-picker) {
  436. width: 100%;
  437. }
  438. }
  439. </style>