table-classify.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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. @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. :show="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="pdfDate" placeholder="选择日期" @change="changePdfDate">
  60. <el-option v-for="item in timeData " :label="item" :value="item" />
  61. </el-select>
  62. </div>
  63. <div class="hc-title-view">{{ tableTitle }})</div>
  64. </template>
  65. <template #extra>
  66. <div class="hc-icon-view text-hover" @click="onSubmitReportDrawerClose">
  67. <HcIcon name="close" />
  68. </div>
  69. </template>
  70. <HcPdf
  71. :src="curPdf"
  72. />
  73. </HcDrawer>
  74. </div>
  75. </template>
  76. <script setup>
  77. import { nextTick, onMounted, ref, watch } from 'vue'
  78. import { arrToKey, getArrValue, getObjValue } from 'js-fast-way'
  79. import { rowsToId } from '~uti/tools'
  80. import tuningApi from '~api/archiveConfig/tuning.js'
  81. import initialgApi from '~api/initial/initial'
  82. //参数
  83. const props = defineProps({
  84. projectId: {
  85. type: [String, Number],
  86. default: '',
  87. },
  88. contractId: {
  89. type: [String, Number],
  90. default: '',
  91. },
  92. treeData: {
  93. type: Object,
  94. default: () => ({}),
  95. },
  96. })
  97. //变量
  98. const projectId = ref(props.projectId)
  99. const contractId = ref(props.contractId)
  100. const nodeData = ref(props.treeData)
  101. //监听
  102. watch(() => [
  103. props.treeData,
  104. ], ([treeData]) => {
  105. nodeData.value = treeData
  106. searchForm.value.nodeIds = treeData.id || ''
  107. console.log(treeData, 'treeData')
  108. getTableData()
  109. getBtnstatus()
  110. })
  111. //渲染完成
  112. onMounted(() => {
  113. getTableData()
  114. getBtnstatus()
  115. })
  116. //搜索表单
  117. const searchForm = ref({
  118. current: 1, size: 20, total: 0,
  119. })
  120. //分页被点击
  121. const pageChange = ({ current, size }) => {
  122. searchForm.value.current = current
  123. searchForm.value.size = size
  124. getTableData()
  125. }
  126. //表头
  127. const tableRef = ref(null)
  128. const tableColumn = ref([
  129. { key:'fileNumber', name: '档号', width: 200 },
  130. { key:'name', name: '案卷题名' },
  131. { key:'storageTimeValue', name: '保管期限', width: 140 },
  132. { key:'pageN', name: '总页数', width: 140 },
  133. ])
  134. const tableData = ref([])
  135. //获取数据
  136. const tableLoading = ref(false)
  137. const getTableData = async () => {
  138. tableLoading.value = true
  139. const { error, code, data } = await tuningApi.pageByArchive({
  140. ...searchForm.value,
  141. projectId: projectId.value,
  142. contractId: contractId.value,
  143. isArchive :1,
  144. })
  145. tableLoading.value = false
  146. if (!error && code === 200) {
  147. tableData.value = getArrValue(data['records'])
  148. searchForm.value.total = data['total'] || 0
  149. } else {
  150. tableData.value = []
  151. searchForm.value.total = 0
  152. }
  153. }
  154. //多选
  155. const tableKeys = ref([])
  156. const tableSelection = (rows) => {
  157. tableKeys.value = rows
  158. }
  159. const reportIds = ref('')
  160. const reportTaskName = ref('')
  161. const reportDatas = ref([])
  162. const showReportModal = ref(false)
  163. const reportLoading = ref(false)
  164. const reportModalClick = async () => {
  165. const rows = tableKeys.value
  166. console.log(rows, 'rows验收申请行')
  167. if (rows.length > 0) {
  168. //初始ID
  169. const row = getObjValue(rows[0])
  170. reportIds.value = rowsToId(rows)
  171. //设置任务数据
  172. let reportDataArr = []
  173. rows.forEach(item => {
  174. reportDataArr.push({
  175. id: item?.id,
  176. name: item?.name,
  177. })
  178. })
  179. reportDatas.value = reportDataArr
  180. //设置任务名称
  181. reportTaskName.value = rows.length > 1 ? `${row.name}等${rows.length}个文件` : row.name
  182. reportLoading.value = false
  183. showReportModal.value = true
  184. } else {
  185. window.$message?.warning('请先勾选需要申请验收的数据')
  186. }
  187. }
  188. //上报完成
  189. const showReportFinish = async () => {
  190. showReportModal.value = false
  191. tableKeys.value = []
  192. await getBtnstatus()
  193. getTableData()
  194. }
  195. //上报的审批内容移除
  196. const reportTaskTagClose = (index) => {
  197. const row = tableKeys.value[index]
  198. tableRef.value?.toggleRowSelection(row, false)
  199. }
  200. //查看验收申请状态
  201. const showBtn = ref(true)
  202. const isCanClick = ref(false)
  203. const getBtnstatus = async ()=>{
  204. const { error, code, data } = await initialgApi.getApplyStatus({
  205. projectId: projectId.value,
  206. })
  207. if (!error && code === 200) {
  208. showBtn.value = data['appStatus']
  209. isCanClick.value = !data['isShow']
  210. } else {
  211. showBtn.value = true
  212. isCanClick.value = false
  213. }
  214. }
  215. //撤回验收申请
  216. const cancelClick = ()=>{
  217. window?.$messageBox?.alert('确认撤销? 撤销之后专家账号也一并清空删除', '提示', {
  218. showCancelButton: true,
  219. confirmButtonText: '确认撤销',
  220. cancelButtonText: '取消',
  221. callback: async (action, ctx ) => {
  222. if (action === 'confirm') {
  223. ctx.confirmButtonLoading = true
  224. const { code, msg, error } = await initialgApi.annulApply({
  225. projectId:projectId.value,
  226. })
  227. ctx.confirmButtonLoading = true
  228. if (!error && code === 200) {
  229. window.$message?.success(msg)
  230. getBtnstatus()
  231. getTableData()
  232. }
  233. }
  234. },
  235. })
  236. }
  237. //历史报告
  238. const isSubmitReportDrawer = ref(false)
  239. const reportData = ref([])
  240. const timeData = ref([])
  241. const onSubmitReportClick = async () => {
  242. const { error, code, data } = await initialgApi.getHistoryTable({
  243. projectId: projectId.value,
  244. })
  245. if (!error && code === 200) {
  246. reportData.value = getArrValue(data)
  247. const dataString = arrToKey( reportData.value, 'approveDate', ',')
  248. timeData.value = dataString.split(',')
  249. if (timeData.value.length > 0) {
  250. pdfDate.value = timeData.value[0]
  251. curPdf.value = reportData.value[0].tableUrl
  252. tableTitle.value = reportData.value[0].tableTitle
  253. isSubmitReportDrawer.value = true
  254. }
  255. } else {
  256. reportData.value = []
  257. }
  258. }
  259. const pdfDate = ref(null)
  260. const curPdf = ref('')
  261. const tableTitle = ref('')
  262. //历史报告
  263. const onSubmitReportDrawerClose = () => {
  264. isSubmitReportDrawer.value = false
  265. curPdf.value = ''
  266. }
  267. const changePdfDate = (val)=>{
  268. reportData.value.forEach((ele)=>{
  269. if (ele.approveDate === val) {
  270. curPdf.value = ele.
  271. tableTitle.value = ele.tableTitle
  272. }
  273. })
  274. }
  275. </script>
  276. <style lang="scss" scoped>
  277. </style>