Forráskód Böngészése

项目档案-增加停用按钮

jingbb 1 hónapja
szülő
commit
7b6ab43c48

+ 8 - 0
src/views/baseCode/ProjectArchive/BaseProjectArchive.api.ts

@@ -11,6 +11,7 @@ enum Api {
   deleteBatch = '/baseCode/baseProjectArchive/deleteBatch',
   importExcel = '/baseCode/baseProjectArchive/importExcel',
   exportXls = '/baseCode/baseProjectArchive/exportXls',
+  Deactive = '/baseCode/baseProjectArchive/submitClose'
 }
 /**
  * 导出api
@@ -62,3 +63,10 @@ export const saveOrUpdate = (params, isUpdate) => {
   let url = isUpdate ? Api.edit : Api.save;
   return defHttp.post({url: url, params});
 }
+
+//停用
+export const getDeactive= (params, handleSuccess) => {
+  return defHttp.get({url: Api.Deactive, params}, {joinParamsToUrl: true}).then(() => {
+    handleSuccess();
+  });
+}

+ 5 - 0
src/views/baseCode/ProjectArchive/BaseProjectArchive.data.ts

@@ -27,6 +27,11 @@ export const columns: BasicColumn[] = [
     align: 'center',
     dataIndex: 'notes',
   },
+  {
+    title: '停用原因(Deactivate reason)',
+    align: 'center',
+    dataIndex: 'closeReason',
+  },
   {
     title: '创建时间(create time)',
     align: 'center',

+ 23 - 2
src/views/baseCode/ProjectArchive/BaseProjectArchiveList.vue

@@ -6,6 +6,7 @@
       <template #tableTitle>
           <a-button type="primary" v-auth="'baseCode:base_project_archive:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增(add)</a-button>
           <a-button  type="primary" v-auth="'baseCode:base_project_archive:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出(export)</a-button>
+          <a-button  type="primary"  @click="handleDeactivate"> 停用(Deactivate)</a-button>
           <a-dropdown v-if="selectedRowKeys.length > 0">
               <template #overlay>
                 <a-menu>
@@ -30,6 +31,7 @@
     </BasicTable>
     <!-- 表单区域 -->
     <BaseProjectArchiveModal @register="registerModal" @success="handleSuccess"></BaseProjectArchiveModal>
+    <SetCloseReasonModal ref="SetCloseReasonModalRef"  @success="successfullyDeactive"></SetCloseReasonModal>
   </div>
 </template>
 
@@ -40,12 +42,14 @@
   import { useListPage } from '/@/hooks/system/useListPage'
   import BaseProjectArchiveModal from './components/BaseProjectArchiveModal.vue'
   import {columns, searchFormSchema, superQuerySchema} from './BaseProjectArchive.data';
-  import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './BaseProjectArchive.api';
-  import { downloadFile } from '/@/utils/common/renderUtils';
+  import SetCloseReasonModal from '../../publicComponents/SetCloseReasonModal.vue'
+  import {list, deleteOne, batchDelete, getImportUrl,getExportUrl,getDeactive} from './BaseProjectArchive.api';
+  import { message } from 'ant-design-vue';
   import { useUserStore } from '/@/store/modules/user';
   const queryParam = reactive<any>({});
   const checkedKeys = ref<Array<string | number>>([]);
   const userStore = useUserStore();
+  var SetCloseReasonModalRef = ref();
   //注册model
   const [registerModal, {openModal}] = useModal();
   //注册table数据
@@ -107,6 +111,23 @@
        isUpdate: false,
        showFooter: true,
      });
+  }
+  //停用
+  function handleDeactivate(){
+    if (selectedRowKeys.value.length == 0) {
+      message.warning('请选择数据');
+    } else {
+      var ids = selectedRowKeys.value.join(',');
+      var ids=selectedRowKeys.value.join(',')
+      SetCloseReasonModalRef.value.getTableDeactivate(ids)
+    }
+  }
+  function successfullyDeactive(reason,id){
+    var params={
+      ids: id,
+      closeReason: reason
+    }
+    getDeactive(params,handleSuccess);
   }
    /**
     * 编辑事件

+ 10 - 2
src/views/publicComponents/SetCloseReasonModal.vue

@@ -1,6 +1,6 @@
 <template>
     <a-modal
-      title="关闭原因(close reason)"
+      :title="title"
       width="45%"
       :visible="visible"
       :maskClosable="false"
@@ -35,6 +35,7 @@
     var form = ref({
         reason :""
     });
+    var title = ref("关闭原因(Close reason")
     const labelCol = ref({
         xs: { span: 24 },
         sm: { span: 5 },
@@ -65,9 +66,16 @@
     function getTable(ids){
         visible.value = true
         fatherIds.value = ids
+        title.value = "关闭原因(Close reason)"
+    }
+    function getTableDeactivate(ids){
+        visible.value = true
+        fatherIds.value = ids
+        title.value = "停用原因(Deactivate reason)"
     }
     defineExpose({
-        getTable
+        getTable,
+        getTableDeactivate
     });
 </script>
 <style scoped lang="less">