table-classify.vue 9.0 KB

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