detail.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <script>
  2. import { defineComponent, ref, getCurrentInstance, reactive } from "@vue/composition-api";
  3. import request, { download } from '~/utils/request';
  4. import { Message } from 'element-ui'
  5. import pie from './components/pie.vue';
  6. import FileUpload from '@/components/FileUpload/indey.vue';
  7. import { user } from '@/stores/user';
  8. export default defineComponent({
  9. props: ['id'],
  10. components: { pie, FileUpload },
  11. setup(props) {
  12. // #region (constant)
  13. const TABLE_KEY = 'jxj_id'
  14. const URL_CUT = '/jdbg/xxgzjc_jcrw'
  15. // #endregion
  16. // #region (variable)
  17. const loading = ref(true)
  18. // #endregion
  19. function detailApi() {
  20. return request({
  21. url: URL_CUT + '/detail',
  22. data: {
  23. [TABLE_KEY]: props.id,
  24. }
  25. })
  26. }
  27. const detail_Data = ref()
  28. // #region (page init)
  29. async function init() {
  30. await Promise.all([
  31. new Promise(async resolve => {
  32. const res = await detailApi(props.id)
  33. return resolve(detail_Data.value = (res.data.one_info))
  34. }),
  35. queryTableData()
  36. ])
  37. loading.value = false
  38. }
  39. // #endregion
  40. const loading_table = ref(false)
  41. const tableData = ref([])
  42. const multipleSelection = ref([])
  43. const handleSelectionChange = (val) => {
  44. multipleSelection.value = val
  45. }
  46. function handleTableColBtn_detail(scope) {
  47. download(scope.row.jxjtl_path)
  48. }
  49. function handleRemind() {
  50. request({
  51. url: '/jdbg/xxgzjc_jcrw/send',
  52. data: {
  53. jxj_id: props.id
  54. }
  55. }).then(res => {
  56. if (res.code === '1') {
  57. Message.success('已提醒')
  58. }
  59. })
  60. }
  61. function handleTableColBtn_download() {
  62. if (multipleSelection.value?.length) {
  63. request({
  64. url: '/upload/main/download_batch',
  65. data: {
  66. files: multipleSelection.value.map(({ jxjtl_path }) => jxjtl_path)
  67. }
  68. }).then(res => {
  69. if (res.code === '1') {
  70. download(res.data.download_url)
  71. }
  72. })
  73. } else {
  74. Message.info("请先勾选下载的文件")
  75. }
  76. }
  77. const total = ref(0)
  78. const limit = ref(10)
  79. const currentPage = ref(1)
  80. function handleCurrentChange() {
  81. queryTableData()
  82. }
  83. function queryTableData() {
  84. return request({
  85. url: '/jdbg/xxgzjc_jcrw_tjjl/index',
  86. data: {
  87. jxj_id: props.id,
  88. limit: limit.value,
  89. page: currentPage.value,
  90. jxjx_to_id: user.uo_id
  91. }
  92. }).then(res => {
  93. if (res.code === '1') {
  94. tableData.value = res.data.page_data
  95. total.value = res.data.total_rows * 1
  96. }
  97. })
  98. }
  99. init()
  100. function handleChange(files) {
  101. const file = files[0]
  102. // console.log('file :>> ', file);
  103. // console.log('object :>> ', {
  104. // jxjtl_name: file.name,
  105. // jxjtl_scr: user.real_name,
  106. // jxjtl_date: new Date().toLocaleDateString(),
  107. // jxj_id: props.id,
  108. // jxjx_id: undefined,
  109. // jxjx_to_id: user.uo_id,
  110. // jxjtl_path: file.part_url,
  111. // });
  112. request({
  113. url: '/jdbg/xxgzjc_jcrw_tjjl/add',
  114. data: {
  115. jdbg_xxgzjc_jcrw_tjjl: {
  116. jxjtl_name: file.name,
  117. jxjtl_scr: user.real_name,
  118. jxjtl_date: new Date().toLocaleDateString(),
  119. jxj_id: props.id,
  120. jxjx_id: undefined,
  121. jxjx_to_id: user.uo_id,
  122. jxjtl_path: file.url,
  123. }
  124. }
  125. }).then(res => {
  126. if (res.code === '1') {
  127. queryTableData()
  128. }
  129. })
  130. }
  131. // function handleBeforeUpload(file) {
  132. // console.log('file :>> ', file);
  133. // return false
  134. // }
  135. return {
  136. loading,
  137. detail_Data,
  138. loading_table,
  139. tableData,
  140. handleSelectionChange,
  141. handleTableColBtn_detail,
  142. handleRemind,
  143. handleTableColBtn_download,
  144. currentPage,
  145. total,
  146. limit,
  147. handleCurrentChange,
  148. handleChange,
  149. // handleBeforeUpload
  150. }
  151. }
  152. })
  153. </script>
  154. <template>
  155. <div :loading="loading" :key="loading" class="text-sm p-6">
  156. <template v-if="detail_Data">
  157. <!--<div class="flex">
  158. <!~~ <div>检查任务标题</div> ~~>
  159. <div class="text-2xl">{{ detail_Data.jxj_title }}</div>
  160. </div>
  161. <div class="flex">
  162. <div class="w-3/5">
  163. <!~~ <div class="flex">
  164. <div>发起人</div>
  165. <div>{{ detail_Data.jxj_fqr }}</div>
  166. </div> ~~>
  167. <div class="flex mt-6">
  168. <div>任务结束时间</div>
  169. <div class="text-hex-969696 ml-3">{{ detail_Data.jxj_wcsj }}</div>
  170. </div>
  171. <!~~ <div class="flex">
  172. <div>完成情况</div>
  173. <div>{{ detail_Data.jxj_wcqk }}</div>
  174. </div> ~~>
  175. <div class="flex mt-8">
  176. <!~~ <div>检查任务内容</div> ~~>
  177. <div class="text-base text-hex-AEAEAE">{{ detail_Data.jxj_content }}</div>
  178. </div>
  179. <!~~ <div class="flex">
  180. <div>下发对象JSON</div>
  181. <div>{{ detail_Data.jxj_xfdx_json }}</div>
  182. </div>
  183. <div class="flex">
  184. <div>归档状态</div>
  185. <div>{{ detail_Data.jxj_id }}</div>
  186. </div> ~~>
  187. </div>
  188. <!~~ <div class="flex flex-col items-end">
  189. <el-button @click="handleRemind" type="primary">提醒</el-button>
  190. <pie class="w-2/5 min-w-600px h-300px" :d="detail_Data.progress" />
  191. </div> ~~>
  192. </div>-->
  193. <table class="Tb" width="100%" cellspacing="0" cellpadding="0">
  194. <tr>
  195. <td class="titleOpt">检查任务标题:</td>
  196. <td>{{ detail_Data.jxj_title }}</td>
  197. </tr>
  198. <tr>
  199. <td class="titleOpt">任务结束时间:</td>
  200. <td>{{ detail_Data.jxj_wcsj }}</td>
  201. </tr>
  202. <tr>
  203. <td class="titleOpt">检查任务内容:</td>
  204. <td>{{ detail_Data.jxj_content }}</td>
  205. </tr>
  206. </table>
  207. <el-divider></el-divider>
  208. <file-upload :full="total !== 0 ? `${tableData[0].jxjtl_path}|${tableData[0].jxjtl_name}` : undefined" :limit="1"
  209. @success="handleChange">
  210. <el-button type="success" icon="el-icon-plus">提交文件材料</el-button>
  211. </file-upload>
  212. <!-- <el-table :data="tableData" @selection-change="handleSelectionChange" element-loading-background="#ffffff70">
  213. <el-table-column type="selection"></el-table-column>
  214. <el-table-column prop="jxjtl_name" label="文件" width="auto" show-overflow-tooltip></el-table-column>
  215. <el-table-column prop="org_name" label="上传学校" width="auto" show-overflow-tooltip></el-table-column>
  216. <el-table-column prop="jxjtl_scr" label="上传者" width="auto" show-overflow-tooltip></el-table-column>
  217. <el-table-column prop="jxjtl_date" label="时间" width="auto" show-overflow-tooltip></el-table-column>
  218. <el-table-column fixed="right">
  219. <template #header>
  220. <el-button link :auto-insert-space="false" @click="handleTableColBtn_download()" type="text">批量下载
  221. </el-button>
  222. </template>
  223. <template #default="scope">
  224. <el-button link :auto-insert-space="false" @click="handleTableColBtn_detail(scope)" type="text">详情
  225. </el-button>
  226. </template>
  227. </el-table-column>
  228. </el-table>
  229. <div class="flex justify-end mt-10 py-4">
  230. <el-pagination :page-size="limit" :current-page.sync="currentPage" @current-change="handleCurrentChange"
  231. background layout="total, prev, pager, next" :total="total" />
  232. </div> -->
  233. </template>
  234. </div>
  235. </template>
  236. <style scoped>
  237. @import "@/styles/singleTable.scss";
  238. </style>