index.vue 11 KB

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