XiaXxxxxx 2 years ago
parent
commit
d2f7fd0853

+ 1 - 1
src/api/authorize/authorize.ts

@@ -27,7 +27,7 @@ export function list(params) {
     var params = {
         keyStr: "",
         page: 1,
-        rows: 100
+        rows: 1000
     }
     return new Promise<void>((resolve, reject) => {
         defHttp.post({ url: Api.List, params })

+ 3 - 3
src/views/authorize/empower/AuditModal.vue

@@ -112,7 +112,7 @@ export default defineComponent({
                     // okType: 'danger',
                     cancelText: '取消',
                     onOk: (() => {
-                        message.success('调用审核通过')
+                        // message.success('调用审核通过')
                         handleSubmit(true)
                     })
                 });
@@ -144,12 +144,12 @@ export default defineComponent({
         const handleSubmit = (isPass) => {
             let params = {
                 bussInfoId: form.bussInfoId,
-                isPass: isPass ? "1" : "0",
+                ispass: isPass ? "1" : "0",
                 opinion: form.opinion,
                 userId: form.userId
             }
             subminExamineResult(params).then(res => {
-                console.log(res);
+                // console.log(res);
                 if (res.resp_code === 0 && res.resp_msg === '提交成功') {
                     message.success('审核成功')
                 } else {

+ 149 - 22
src/views/interface/item/child/InterfaceCarModal.vue

@@ -7,7 +7,8 @@
                 <div class="left-search-input">
                     <div class="input">
                         <span>关键字</span>
-                        <a-input v-model:value="searchValue" style="width: 200px;" placeholder="请输入资源名称"></a-input>
+                        <a-input allowClear v-model:value="searchValue" style="width: 200px;"
+                            placeholder="请输入资源名称"></a-input>
                     </div>
                     <div class="input">
                         <span>审核状态</span>
@@ -16,7 +17,7 @@
                     </div>
                     <div class="input">
                         <span>申请时间</span>
-                        <a-date-picker show-time v-model:value="searchTime" placeholder="申请时间" style="width: 200px" />
+                        <a-date-picker v-model:value="searchTime" placeholder="申请时间" style="width: 200px" />
                     </div>
                 </div>
                 <div class="right-btns">
@@ -29,6 +30,10 @@
                     <!-- <template #OPT="{ record }">
                     <span>{{ record.OPT==='login' ? '登录' : '退出' }}</span>
                 </template> -->
+                    <template #toolbar>
+                        <a-button style="background-color: #fc8b01;color: #fff;" @click="handleAdd"
+                            :disabled="hasSelected">提交申请</a-button>
+                    </template>
                     <template #action="{ record }">
                         <TableAction :actions="[
                             {
@@ -36,6 +41,7 @@
                                 tooltip: '移出',
                                 // icon: 'ant-design:form-outlined',
                                 onClick: handleDelete.bind(null, record),
+                                disabled: !(record.shzt === '未提交')
                             },
                         ]" />
                     </template>
@@ -43,15 +49,36 @@
             </div>
         </div>
     </a-modal>
+    <a-modal v-model:visible="showSelectAppModal" centered title="选择应用" width="400px" :maskClosable="false"
+        @cancel="closeSelectAppModal">
+        <div class="content" style="padding: 20px 10px 10px;font-size: 16px;">
+            <a-form :label-col="labelCol" :wrapper-col="wrapperCol">
+                <a-form-item label="选择应用" name="selectAppKey">
+                    <a-select allowClear v-model:value="selectAppKey" :options="appOptions">
+                    </a-select>
+                </a-form-item>
+            </a-form>
+        </div>
+        <template #footer>
+            <a-button @click="closeSelectAppModal">取消</a-button>
+            <a-button type="primary" @click="handleSubmit">确定</a-button>
+        </template>
+    </a-modal>
 </template>
 <script>
-import { defineComponent, reactive, ref, onMounted, watch, toRefs } from 'vue';
+import { defineComponent, reactive, ref, onMounted, watch, toRefs, computed, createVNode } from 'vue';
 // 导入表格组件,表格事件
 import { BasicTable, useTable, TableAction } from '/@/components/Table';
-import { message } from 'ant-design-vue';
+import { message, Modal } from 'ant-design-vue';
+import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
 import { session } from '/@/utils/Memory';
 import moment from 'moment';
-import { getResInCar, clearResInCar } from '/@/api/resource/plat';
+//操作申请库资源
+import { getResInCar, clearResInCar, deleteResInCar } from '/@/api/resource/plat';
+//提交授权申请
+import { queryFlowInfoPage, submitExamine } from '/@/api/resource/examine';
+//获取应用数据
+import { list } from '/@/api/authorize/authorize';
 
 const props = {
     // resId: {
@@ -61,7 +88,7 @@ const props = {
 }
 export default defineComponent({
     name: 'modal',
-    components: { BasicTable, TableAction },
+    components: { BasicTable, TableAction, ExclamationCircleOutlined },
     props,
     setup(props, { emit }) {
         const data = reactive({
@@ -69,8 +96,8 @@ export default defineComponent({
             title: '申请库',
         })
         const searchValue = ref('')
-        const selectValue = ref('未审核')
-        const searchTime = ref(moment())
+        const selectValue = ref('')
+        const searchTime = ref(null)
         const statusOptions = [
             {
                 label: "未提交",
@@ -89,6 +116,9 @@ export default defineComponent({
                 value: "审核不通过"
             },
         ]
+        const selectAppKey = ref('')
+        const showSelectAppModal = ref(false)
+        const appOptions = []
         // 请求所有申请库中的资源
         const getAllData = () => {
             return new Promise((resolve) => {
@@ -102,10 +132,11 @@ export default defineComponent({
                         let resData = []
                         res.datas.forEach(item => {
                             //筛掉接口服务
-                            if (item.applyCarInfo.workflowType === 'MAP' || item.applyCarInfo.workflowType === 'SCENE' || item.applyCarInfo.workflowType === 'FILE') {
+                            if (item.applyCarInfo.workflowType === 'INTERFACE') {
                                 resData.push({
-                                    serviceid: item.resInfo.SERVICEID,
-                                    zylx: item.applyCarInfo.workflowType === 'MAP' ? '地图资源' : item.applyCarInfo.workflowType === 'SCENE' ? '场景资源' : '文件资源',
+                                    resInCarId: item.applyCarInfo.id,
+                                    serviceid: item.applyCarInfo.resId,
+                                    zylx: '接口服务',
                                     // zymc: item.resInfo.SERVICENAME,
                                     zymc: item.applyCarInfo.resName,
                                     yyxt: "",
@@ -139,7 +170,7 @@ export default defineComponent({
                 title: '资源名称',
                 align: 'center',
                 dataIndex: 'zymc',
-                key:'zymc'
+                key: 'zymc'
             },
             // {
             //     title: '操作IP',
@@ -155,12 +186,12 @@ export default defineComponent({
                 dataIndex: 'yyxt',
                 key: 'yyxt'
             },
-            {
-                title: '申请单位',
-                align: 'center',
-                dataIndex: 'sqdw',
-                key: 'sqdw'
-            },
+            // {
+            //     title: '申请单位',
+            //     align: 'center',
+            //     dataIndex: 'sqdw',
+            //     key: 'sqdw'
+            // },
             {
                 title: '申请时间',
                 align: 'center',
@@ -193,7 +224,7 @@ export default defineComponent({
             }
         ]
         //注册表格
-        const [registerTable, { reload }] = useTable({
+        const [registerTable, { reload, getRowSelection, getSelectRowKeys, clearSelectedRowKeys }] = useTable({
             title: '资源列表',
             api: getAllData,		 //数据
             // dataSource: [],
@@ -213,6 +244,7 @@ export default defineComponent({
                 // pageSize: 10,
                 hideOnSinglePage: false
             },
+            rowKey: (record) => record.serviceid,
             canResize: true,
             showTableSetting: true,  // 显示表格设置
             tableSetting: {
@@ -224,6 +256,11 @@ export default defineComponent({
             showIndexColumn: true,
             indexColumnProps: { fixed: 'left' },
         });
+        //判断是否选中数据
+        const hasSelected = computed(() => {
+            const rowSelection = getRowSelection();
+            return !(rowSelection.selectedRowKeys?.length === 1);
+        });
         //重置查询
         const handleReset = () => {
             searchValue.value = ''
@@ -236,7 +273,81 @@ export default defineComponent({
         }
         //移除资源
         const handleDelete = (record) => {
-            console.log('要移除的资源', record);
+            // console.log(record)
+            Modal.confirm({
+                title: '移出提示',
+                icon: createVNode(ExclamationCircleOutlined),
+                content: '确定移出该资源?',
+                centered: true,
+                okText: '确定',
+                okType: 'danger',
+                cancelText: '取消',
+                onOk: (() => {
+                    let params = {
+                        idList: [record.resInCarId]
+                    }
+                    deleteResInCar(params).then(res => {
+                        reload();
+                    })
+                })
+            });
+        }
+        //添加申请
+        const handleAdd = () => {
+            showSelectAppModal.value = true;
+            selectAppKey.value = ''
+            // console.log('开始申请');
+            // Modal.confirm({
+            //     title: '申请提示',
+            //     icon: createVNode(ExclamationCircleOutlined),
+            //     content: '确定提交申请该接口?',
+            //     centered: true,
+            //     okText: '确定',
+            //     cancelText: '取消',
+            //     onOk: (() => {
+
+            //     })
+            // });
+        }
+        const handleSubmit = () => {
+            // message.info('开始申请')
+            queryFlowInfoPage({
+                page: 1,
+                rows: 1000000
+            }).then(flowRes => {
+                const rowKeys = getSelectRowKeys();
+                let ids = rowKeys.toString();
+                // console.log(flowRes);
+                let flag = 0
+                flowRes.forEach(item => {
+                    if (item.FLOWNAME === '接口授权') {
+                        flag = 1
+                        let params = {
+                            bussInfo: {
+                                bussname: '接口授权',//业务名称
+                                flowid: item.id,//流程id
+                                serverids: ids,//资源id
+                                systemkey:selectAppKey.value,
+                            }
+                        }
+                        submitExamine(params).then(res => {
+                            if (res.resp_code === 0 && res.resp_msg === '提交成功') {
+                                message.success('申请成功')
+                                reload();
+                            } else {
+                                message.error('申请失败')
+                            }
+                        })
+                    }
+                })
+                clearSelectedRowKeys();
+                !flag && message.info('没有对应流程,请联系管理员');
+            })
+            showSelectAppModal.value = false;
+        }
+        const closeSelectAppModal = () => {
+            showSelectAppModal.value = false;
+            selectAppKey.value = ''
         }
         // 关闭请求弹窗
         const onClose = (e) => {
@@ -244,7 +355,14 @@ export default defineComponent({
         }
         //初始化请求所需数据
         onMounted(() => {
-
+            list().then(res => {
+                res.forEach(item=>{
+                    appOptions.push({
+                        label:item.NAME,
+                        value:item.KEY
+                    })
+                })
+            })
         })
         return {
             // formRef,
@@ -252,12 +370,21 @@ export default defineComponent({
             selectValue,
             searchTime,
             statusOptions,
+            selectAppKey,
+            showSelectAppModal,
+            appOptions,
+            labelCol: { span: 6 },
+            wrapperCol: { span: 16 },
+            hasSelected,
             ...toRefs(data),
             registerTable,
             handleReset,
             handleSearch,
             handleDelete,
-            onClose
+            handleAdd,
+            onClose,
+            closeSelectAppModal,
+            handleSubmit
         };
     },
 });