index.vue 11 KB

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