table-classify.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <template>
  2. <div class="hc-page-box">
  3. <hc-new-card>
  4. <template #header>
  5. <!-- <HcNewSwitch :datas="tabData" :keys="tabKey" :round="false" @change="tabChange" /> -->
  6. </template>
  7. <template #extra>
  8. <HcTooltip keys="file_collection_btn_upload_scanned_files">
  9. <el-button v-if="!showBtn" type="warning" hc-btn :disabled="isCanClick" @click="reportModalClick">
  10. <HcIcon name="git-pull-request" />
  11. <span>申请验收</span>
  12. </el-button>
  13. <el-button v-else type="warning" hc-btn :disabled="isCanClick" @click="cancelClick">
  14. <HcIcon name="git-pull-request" />
  15. <span>撤回验收申请</span>
  16. </el-button>
  17. </HcTooltip>
  18. <el-button hc-btn type="primary" @click="onSubmitReportClick">
  19. <HcIcon name="eye" />
  20. <span>历史验收报告</span>
  21. </el-button>
  22. <el-button hc-btn class=" m-1" type="primary">
  23. <HcIcon name="eye" />
  24. <span>历史整改报告</span>
  25. </el-button>
  26. </template>
  27. <HcTable
  28. ref="tableRef" :column="tableColumn" :datas="tableData" :loading="tableLoading"
  29. is-new :index-style="{ width: 60 }" is-check :check-style="{ width: 29 }"
  30. is-reserve-selection @selection-change="tableSelection"
  31. />
  32. <template #action>
  33. <HcPages :pages="searchForm" @change="pageChange" />
  34. </template>
  35. </hc-new-card>
  36. <!-- 批量上报审批 -->
  37. <HcReportModal
  38. title="申请验收"
  39. widths="1080px"
  40. url="archivesauto/saveApply"
  41. :show="showReportModal"
  42. :project-id="projectId"
  43. :contract-id="contractId"
  44. :task-name="reportTaskName"
  45. :ids="reportIds"
  46. is-datas
  47. :datas="reportDatas"
  48. @hide="showReportModal = false"
  49. @finish="showReportFinish"
  50. @tag-close="reportTaskTagClose"
  51. />
  52. <!-- 历史报告 -->
  53. <HcDrawer
  54. v-model="isSubmitReportDrawer" to-id="submit-report-layout-target2" uis="hc-submit-report-target2"
  55. @close="onSubmitReportDrawerClose"
  56. >
  57. <template #header>
  58. <div class="hc-select-view w-52">
  59. <el-select v-model="pdfDateId" placeholder="选择日期" @change="changePdfDate">
  60. <el-option v-for="item in reportData" :key="item.id" :label="item.approveDate" :value="item.id" />
  61. </el-select>
  62. </div>
  63. <div class="hc-title-view">{{ tableTitle }})</div>
  64. </template>
  65. <template #extra>
  66. <el-button type="danger" round plain @click="onSubmitReportDrawerClose">返回主页</el-button>
  67. </template>
  68. <HcPdf
  69. :src="curPdf"
  70. />
  71. </HcDrawer>
  72. </div>
  73. </template>
  74. <script setup>
  75. import { nextTick, onMounted, ref, watch } from 'vue'
  76. import { arrToKey, getArrValue, getObjValue } from 'js-fast-way'
  77. import { rowsToId } from '~uti/tools'
  78. import tuningApi from '~api/archiveConfig/tuning.js'
  79. import initialgApi from '~api/initial/initial'
  80. //参数
  81. const props = defineProps({
  82. projectId: {
  83. type: [String, Number],
  84. default: '',
  85. },
  86. contractId: {
  87. type: [String, Number],
  88. default: '',
  89. },
  90. treeData: {
  91. type: Object,
  92. default: () => ({}),
  93. },
  94. })
  95. //变量
  96. const projectId = ref(props.projectId)
  97. const contractId = ref(props.contractId)
  98. const nodeData = ref(props.treeData)
  99. //监听
  100. watch(() => [
  101. props.treeData,
  102. ], ([treeData]) => {
  103. nodeData.value = treeData
  104. searchForm.value.nodeIds = treeData.id || ''
  105. console.log(treeData, 'treeData')
  106. getTableData()
  107. getBtnstatus()
  108. })
  109. //渲染完成
  110. onMounted(() => {
  111. getTableData()
  112. getBtnstatus()
  113. })
  114. //搜索表单
  115. const searchForm = ref({
  116. current: 1, size: 20, total: 0,
  117. })
  118. //分页被点击
  119. const pageChange = ({ current, size }) => {
  120. searchForm.value.current = current
  121. searchForm.value.size = size
  122. getTableData()
  123. }
  124. //表头
  125. const tableRef = ref(null)
  126. const tableColumn = ref([
  127. { key:'fileNumber', name: '档号', width: 200 },
  128. { key:'name', name: '案卷题名' },
  129. { key:'storageTimeValue', name: '保管期限', width: 140 },
  130. { key:'pageN', name: '总页数', width: 140 },
  131. ])
  132. const tableData = ref([])
  133. //获取数据
  134. const tableLoading = ref(false)
  135. const getTableData = async () => {
  136. tableLoading.value = true
  137. const { error, code, data } = await tuningApi.pageByArchive({
  138. ...searchForm.value,
  139. projectId: projectId.value,
  140. contractId: contractId.value,
  141. isArchive :1,
  142. })
  143. tableLoading.value = false
  144. if (!error && code === 200) {
  145. tableData.value = getArrValue(data['records'])
  146. searchForm.value.total = data['total'] || 0
  147. } else {
  148. tableData.value = []
  149. searchForm.value.total = 0
  150. }
  151. }
  152. //多选
  153. const tableKeys = ref([])
  154. const tableSelection = (rows) => {
  155. tableKeys.value = rows
  156. }
  157. const reportIds = ref('')
  158. const reportTaskName = ref('')
  159. const reportDatas = ref([])
  160. const showReportModal = ref(false)
  161. const reportLoading = ref(false)
  162. const reportModalClick = async () => {
  163. const rows = tableKeys.value
  164. console.log(rows, 'rows验收申请行')
  165. if (rows.length > 0) {
  166. //初始ID
  167. const row = getObjValue(rows[0])
  168. reportIds.value = rowsToId(rows)
  169. //设置任务数据
  170. let reportDataArr = []
  171. rows.forEach(item => {
  172. reportDataArr.push({
  173. id: item?.id,
  174. name: item?.name,
  175. })
  176. })
  177. reportDatas.value = reportDataArr
  178. //设置任务名称
  179. reportTaskName.value = rows.length > 1 ? `${row.name}等${rows.length}个文件` : row.name
  180. reportLoading.value = false
  181. showReportModal.value = true
  182. } else {
  183. window.$message?.warning('请先勾选需要申请验收的数据')
  184. }
  185. }
  186. //上报完成
  187. const showReportFinish = async () => {
  188. showReportModal.value = false
  189. tableKeys.value = []
  190. await getBtnstatus()
  191. getTableData()
  192. }
  193. //上报的审批内容移除
  194. const reportTaskTagClose = (index) => {
  195. const row = tableKeys.value[index]
  196. tableRef.value?.toggleRowSelection(row, false)
  197. if ( tableKeys.value.length > 0) {
  198. const row = getObjValue( tableKeys.value[0])
  199. reportTaskName.value = tableKeys.value.length > 0 ? `${row.name}等${tableKeys.value.length}个文件` : tableKeys.value.name
  200. }
  201. }
  202. //查看验收申请状态
  203. const showBtn = ref(true)
  204. const isCanClick = ref(false)
  205. const getBtnstatus = async ()=>{
  206. const { error, code, data } = await initialgApi.getApplyStatus({
  207. projectId: projectId.value,
  208. })
  209. if (!error && code === 200) {
  210. showBtn.value = data['appStatus']
  211. isCanClick.value = !data['isShow']
  212. } else {
  213. showBtn.value = true
  214. isCanClick.value = false
  215. }
  216. }
  217. //撤回验收申请
  218. const cancelClick = ()=>{
  219. window?.$messageBox?.alert('确认撤销? 撤销之后专家账号也一并清空删除', '提示', {
  220. showCancelButton: true,
  221. confirmButtonText: '确认撤销',
  222. cancelButtonText: '取消',
  223. callback: async (action, ctx ) => {
  224. if (action === 'confirm') {
  225. ctx.confirmButtonLoading = true
  226. const { code, msg, error } = await initialgApi.annulApply({
  227. projectId:projectId.value,
  228. })
  229. ctx.confirmButtonLoading = true
  230. if (!error && code === 200) {
  231. window.$message?.success(msg)
  232. getBtnstatus()
  233. getTableData()
  234. }
  235. }
  236. },
  237. })
  238. }
  239. //历史报告
  240. const isSubmitReportDrawer = ref(false)
  241. const reportData = ref([])
  242. const timeData = ref([])
  243. const onSubmitReportClick = async () => {
  244. const { data } = await initialgApi.getHistoryTable({
  245. projectId: projectId.value,
  246. })
  247. const res = getArrValue(data)
  248. reportData.value = res
  249. if (res.length >= 0) {
  250. pdfDateId.value = res[0].id
  251. curPdf.value = res[0].tableUrl
  252. tableTitle.value = res[0].tableTitle
  253. isSubmitReportDrawer.value = true
  254. } else {
  255. window.$message?.warning('暂无历史报告')
  256. }
  257. }
  258. const pdfDateId = ref(null)
  259. const curPdf = ref('')
  260. const tableTitle = ref('')
  261. //历史报告
  262. const onSubmitReportDrawerClose = () => {
  263. isSubmitReportDrawer.value = false
  264. curPdf.value = ''
  265. }
  266. const changePdfDate = (val) => {
  267. reportData.value.forEach((ele)=>{
  268. if (ele.id === val) {
  269. curPdf.value = ele.tableUrl
  270. tableTitle.value = ele.tableTitle
  271. }
  272. })
  273. }
  274. </script>
  275. <style lang="scss" scoped>
  276. </style>