index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <template>
  2. <div class="p-4">
  3. <div class="top-search">
  4. <div class="left-search-input">
  5. <div class="input">
  6. <span>关键字</span>
  7. <a-input allowClear v-model:value="searchValue" style="width: 200px;" placeholder="请输入资源名称"></a-input>
  8. </div>
  9. <div class="input">
  10. <span>资源类型</span>
  11. <a-select allowClear @change="handleTypeChange" v-model:value="selectTypeValue" style="width: 200px"
  12. :options="typeOptions"></a-select>
  13. </div>
  14. <div class="input" v-if="selectTypeValue != 'SR'">
  15. <span>应用系统</span>
  16. <a-select allowClear v-model:value="selectSystemValue" style="width: 200px" :options="sysOptions"></a-select>
  17. </div>
  18. <div class="input">
  19. <span>审核状态</span>
  20. <a-select allowClear v-model:value="selectStatusValue" style="width: 200px" :options="statusOptions">
  21. </a-select>
  22. </div>
  23. <!-- <div class="input">
  24. <span>申请时间</span>
  25. <a-date-picker v-model:value="searchTime" placeholder="申请时间" style="width: 200px" />
  26. </div> -->
  27. </div>
  28. <div class="right-btns">
  29. <a-button style="margin-right: 15px;" @click="handleReset">重置</a-button>
  30. <a-button type="primary" @click="handleSearch">查询</a-button>
  31. </div>
  32. </div>
  33. <div class="bottom-table">
  34. <BasicTable @register="registerTable" class="basic-table" @fetch-success="onFetchSuccess">
  35. <template #toolbar>
  36. <a-button style="background-color: #fc8b01;color: #fff;" :disabled="hasSelected"
  37. @click="handleAuditAll">批量审核</a-button>
  38. </template>
  39. <template #BLZT="{ record }">
  40. <a-tag :style="`color:${record.status === 3 || record.status === 3 ? 'red' : ''};`">
  41. {{
  42. record.BLZT == '在办' ? '审核中' : record.BLZT == '已办结' ? '审核完' : ''
  43. }}
  44. </a-tag>
  45. </template>
  46. <template #action="{ record }">
  47. <TableAction :actions="[
  48. {
  49. label: '详情',
  50. tooltip: '详情',
  51. onClick: handleDetail.bind(null, record),
  52. },
  53. {
  54. label: '审核',
  55. tooltip: '审核',
  56. disabled: selectStatusValue == '0' ? false : true,
  57. onClick: handleAudit.bind(null, record),
  58. }
  59. ]" />
  60. </template>
  61. </BasicTable>
  62. </div>
  63. <AuditModal v-if="ischect && showAuditModal" @closeModal="showAuditModal = false" :bussInfo="bussInfo"
  64. @onSubmit="onSubmit" />
  65. <map-resource-upload v-if="!ischect && selectTypeValue === 'MR'" @register="registerModal"
  66. @success="handleSuccess"></map-resource-upload>
  67. <scene-resource-upload v-if="!ischect && selectTypeValue === 'ER'" @register="registerModal"
  68. @success="handleSuccess"></scene-resource-upload>
  69. <file-resource-upload v-if="!ischect && selectTypeValue === 'DR'" @register="registerModal"
  70. @success="handleSuccess"></file-resource-upload>
  71. <ass-resource-upload v-if="!ischect && selectTypeValue === 'SR'" @register="registerModal"
  72. @success="handleSuccess"></ass-resource-upload>
  73. </div>
  74. </template>
  75. <script>
  76. import { defineComponent, reactive, ref, onMounted, watch, toRefs, computed, createVNode, nextTick } from 'vue';
  77. import { BasicTable, useTable, TableAction } from '/@/components/Table';
  78. import AuditModal from './AuditModal.vue';
  79. import { columns } from './map.data';
  80. import { list } from '/@/api/authorize/authorize';
  81. import moment from 'moment';
  82. import { session } from '/@/utils/Memory';
  83. import { queryTaskInfoPage, queryTaskYbInfoPage } from '/@/api/resource/examine';
  84. import { getAppDesign } from '/@/api/oem';
  85. import { useRouter } from 'vue-router';
  86. import MapResourceUpload from '/@/views/dataAdmin/dataAdmin/mapUpload/MapSourceModal.vue';
  87. import FileResourceUpload from '/@/views/dataAdmin/dataAdmin/fileResourceUpload/AddMethod.vue';
  88. import SceneResourceUpload from '/@/views/dataAdmin/dataAdmin/sceneResourceUpload/AddMethod.vue';
  89. import AssResourceUpload from '/@/views/dataAdmin/assembly/MapSourceModal.vue';
  90. import { useModal } from '/@/components/Modal';
  91. import { queryResourceById } from '/@/api/resource/map';
  92. export default defineComponent({
  93. setup() {
  94. const [registerModal, { openModal }] = useModal();
  95. const ischect = ref(true)
  96. const searchValue = ref('')
  97. const selectTypeValue = ref('MR')
  98. const selectSystemValue = ref('')
  99. const selectStatusValue = ref('0')
  100. const searchTime = ref(null)
  101. const { currentRoute } = useRouter();
  102. const currRoute = currentRoute.value;
  103. //mr是地图资源,dr是文件,er场景,sr组件
  104. const typeOptions = [
  105. {
  106. label: "地图资源",
  107. value: "MR"
  108. },
  109. {
  110. label: "场景资源",
  111. value: "ER"
  112. },
  113. {
  114. label: "文件资源",
  115. value: "DR"
  116. },
  117. {
  118. label: "组件资源",
  119. value: "SR"
  120. },
  121. {
  122. label: "接口服务",
  123. value: "interface"
  124. }
  125. ]
  126. function handleTypeChange() {
  127. }
  128. const sysOptions = ref([]);
  129. onMounted(() => getApp());
  130. function getApp() {
  131. list().then(r => sysOptions.value = r.map(i => { return { label: i.NAME, value: i.KEY } }))
  132. }
  133. const statusOptions = [
  134. {
  135. label: "在办",
  136. value: "0"
  137. },
  138. {
  139. label: "已办结",
  140. value: "1"
  141. }
  142. ]
  143. const showAuditModal = ref(false)
  144. const bussInfo = ref({
  145. bussInfoId: "",
  146. resId: ""
  147. })
  148. onMounted(() => {
  149. // getAllData();
  150. })
  151. //获取所有状态的资源
  152. const getAllData = () => {
  153. return new Promise(async (resolve) => {
  154. let params = {
  155. page: 1,
  156. rows: 10000,
  157. serviceType: selectTypeValue.value,
  158. userId: session.getItem('userId'),
  159. keyStr: searchValue.value
  160. }
  161. let resdb = null;
  162. let resyb = null;
  163. if (selectStatusValue.value == "0") {
  164. resdb = await queryTaskInfoPage(params)
  165. resyb = [];
  166. } else if (selectStatusValue.value == "1") {
  167. resdb = []
  168. resyb = await queryTaskYbInfoPage(params)
  169. } else {
  170. resdb = await queryTaskInfoPage(params)
  171. resyb = await queryTaskYbInfoPage(params)
  172. }
  173. let allData = removeDp(resyb, resdb)
  174. if (allData.length) {
  175. allData.filter(item => item.BUSSNAME.indexOf('授权') > -1)
  176. console.log("授权审核列表:", allData)
  177. resolve(allData)
  178. } else {
  179. resolve([])
  180. }
  181. })
  182. }
  183. //两个对象数组去重
  184. const removeDp = (arr1, arr2) => {
  185. let arr = arr1.concat(arr2)
  186. let obj = {}
  187. let newArray = arr.reduce((pre, cur) => {
  188. if (!obj[cur.BUSSID]) {
  189. obj[cur.BUSSID] = true
  190. pre.push(cur)
  191. }
  192. return pre
  193. }, [])
  194. return newArray;
  195. }
  196. //注册表格
  197. const [registerTable, { reload, getRowSelection, getSelectRowKeys, clearSelectedRowKeys, getDataSource }] = useTable({
  198. title: '授权资源列表',
  199. api: getAllData,
  200. // dataSource: [],
  201. columns,
  202. rowSelection: { type: 'checkbox' },
  203. useSearchForm: false,
  204. showTableSetting: true,
  205. bordered: false,
  206. striped: false,
  207. canResize: true,
  208. showIndexColumn: true,
  209. indexColumnProps: { fixed: 'left' },
  210. actionColumn: {
  211. width: 120,
  212. title: '操作',
  213. dataIndex: 'action',
  214. slots: { customRender: 'action' },
  215. fixed: 'right',
  216. },
  217. pagination: {
  218. hideOnSinglePage: false,
  219. },
  220. clickToRowSelect: false,
  221. tableSetting: {
  222. redo: true,
  223. size: true,
  224. setting: false,
  225. fullScreen: false
  226. },
  227. });
  228. //判断是否选中数据
  229. const hasSelected = computed(() => {
  230. const rowSelection = getRowSelection();
  231. return !(rowSelection.selectedRowKeys?.length);
  232. });
  233. //重置查询
  234. const handleReset = () => {
  235. searchValue.value = ''
  236. selectTypeValue.value = ''
  237. selectSystemValue.value = ''
  238. selectStatusValue.value = '0'
  239. searchTime.value = moment()
  240. }
  241. //条件查询
  242. const handleSearch = () => {
  243. reload();
  244. }
  245. // 批量审核
  246. const handleAuditAll = () => {
  247. }
  248. //资源详情
  249. const handleDetail = async (record) => {
  250. ischect.value = false;
  251. const res = await queryResourceById(record?.SERVICEID);
  252. if (res) {
  253. if (res.dataVersionConf) {
  254. res.metadata.isnew = res.servicebase.isnew = res.dataVersionConf.active == 'Y' ? "1" : "0";
  255. }
  256. const result = Object.assign(res.metadata, res.servicebase, res.dataVersionConf || {});
  257. if (record.bussid) res.bussid = record.BUSSID;
  258. openModal(true, {
  259. record: result,
  260. isUpdate: true,
  261. isView: true,
  262. });
  263. }
  264. }
  265. //单个审核,打开审核弹窗
  266. const handleAudit = (record) => {
  267. ischect.value = true;
  268. console.log("单个审核,打开审核弹窗:", record)
  269. bussInfo.value.bussInfoId = record.BUSSID;
  270. bussInfo.value.resId = record.SERVICEID;
  271. bussInfo.value.record = record;
  272. showAuditModal.value = true;
  273. appStore.setRouterPushAuditFlag(false)
  274. }
  275. //审核提交
  276. const onSubmit = (isPass) => {
  277. showAuditModal.value = false
  278. reload()
  279. }
  280. const onFetchSuccess = () => {
  281. // 请求后拿到数据,打开对应的资源审核弹窗
  282. nextTick(() => {
  283. let dataList = getDataSource()
  284. if (currRoute?.query?.bussid && appStore.routerPushAuditFlag) {
  285. dataList.forEach(item => {
  286. item.BUSSID === currRoute.query.bussid && handleAudit(item)
  287. })
  288. }
  289. });
  290. }
  291. return {
  292. <<<<<<< HEAD
  293. ischect,
  294. =======
  295. >>>>>>> 6c31e76 (添加详情功能)
  296. handleTypeChange,
  297. showAuditModal,
  298. bussInfo,
  299. searchValue,
  300. selectTypeValue,
  301. selectSystemValue,
  302. selectStatusValue,
  303. searchTime,
  304. typeOptions,
  305. sysOptions,
  306. statusOptions,
  307. hasSelected,
  308. registerTable,
  309. registerModal,
  310. handleReset,
  311. handleSearch,
  312. handleAuditAll,
  313. handleDetail,
  314. handleAudit,
  315. onSubmit,
  316. onFetchSuccess
  317. };
  318. },
  319. });
  320. </script>
  321. <style lang="less" scoped>
  322. .p-4 {
  323. height: 100%;
  324. .top-search {
  325. width: 100%;
  326. height: 74px;
  327. border-radius: 6px;
  328. background: #FFFFFF;
  329. display: flex;
  330. justify-content: space-between;
  331. align-items: center;
  332. .left-search-input {
  333. margin-left: 20px;
  334. display: flex;
  335. .input {
  336. margin-right: 30px;
  337. span {
  338. margin-right: 10px;
  339. }
  340. }
  341. }
  342. .right-btns {
  343. margin-right: 20px;
  344. }
  345. }
  346. .bottom-table {
  347. margin-top: 24px;
  348. padding: 20px;
  349. height: calc(100% - 98px);
  350. background-color: #fff;
  351. .basic-table {
  352. height: 100%;
  353. ::v-deep .ant-table-title {
  354. padding: 0 !important;
  355. .vben-basic-title {
  356. font-family: '阿里巴巴普惠体 2.0';
  357. font-size: 16px;
  358. font-weight: bold;
  359. color: #333333;
  360. }
  361. }
  362. }
  363. }
  364. }
  365. </style>