index.vue 11 KB

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