ソースを参照

curd 表头按钮增加刷新操作

liuyanpeng 1 年間 前
コミット
be6182d22d

+ 48 - 30
src/window1/tabGridView/NewTabButton.vue

@@ -10,8 +10,11 @@
         <BookTwoTone v-if="item.action === 'OPEN_CUSTOMER_WINDOW'" />
         <ContainerTwoTone v-if="item.action === 'OPEN_HTML_WINDOW'" />
         <FileTextTwoTone v-if="item.action === 'EXPORT'" />
+        <ReloadOutlined v-if="item.action === 'REFRESH'" />
         <BellTwoTone v-if="item.action === 'NOTICE'" />
-        <HddOutlined v-if="item.action === 'OPEN_REMOTE_COMPONENT_MODULE_IN_MODAL'" />
+        <HddOutlined
+          v-if="item.action === 'OPEN_REMOTE_COMPONENT_MODULE_IN_MODAL'"
+        />
 
         <span v-if="item.action === 'CREATE'" @click="create">{{
           item.name
@@ -22,12 +25,13 @@
         <span v-else-if="item.action === 'EXPORT'" @click="exportConfirm">{{
           item.name
         }}</span>
-        <span
-          v-else-if="item.action === 'OPEN_REMOTE_COMPONENT_MODULE_IN_MODAL'" 
-          @click="openRemotCompoentModule(item)"
-        >{{
+        <span v-else-if="item.action === 'REFRESH'" @click="refresh">{{
           item.name
         }}</span>
+        <span
+          v-else-if="item.action === 'OPEN_REMOTE_COMPONENT_MODULE_IN_MODAL'"
+          @click="openRemoteComponentModule(item)"
+        >{{ item.name }}</span>
         <span v-else>{{ item.name }}</span>
       </a-breadcrumb-item>
 
@@ -50,7 +54,10 @@
         <ContainerTwoTone v-if="item.action === 'OPEN_HTML_WINDOW'" />
         <FileTextTwoTone v-if="item.action === 'EXPORT'" />
         <BellTwoTone v-if="item.action === 'NOTICE'" />
-        <HddOutlined v-if="item.action === 'OPEN_REMOTE_COMPONENT_MODULE_IN_MODAL'" />
+        <ReloadOutlined v-if="item.action === 'REFRESH'" />
+        <HddOutlined
+          v-if="item.action === 'OPEN_REMOTE_COMPONENT_MODULE_IN_MODAL'"
+        />
         <span v-if="item.action === 'CREATE'" @click="create">{{
           item.name
         }}</span>
@@ -60,9 +67,13 @@
         <span v-else-if="item.action === 'EXPORT'" @click="exportConfirm">{{
           item.name
         }}</span>
-        <span v-else-if="item.action === 'OPEN_REMOTE_COMPONENT_MODULE_IN_MODAL'" @click="openRemotCompoentModule(item)">{{
+        <span v-else-if="item.action === 'REFRESH'" @click="refresh">{{
           item.name
         }}</span>
+        <span
+          v-else-if="item.action === 'OPEN_REMOTE_COMPONENT_MODULE_IN_MODAL'"
+          @click="openRemoteComponentModule(item)"
+        >{{ item.name }}</span>
         <span
           v-else-if="item.action === 'NOTICE'"
           @click="notificationModal = true"
@@ -91,14 +102,20 @@
     </template>
   </Modal>
 
-  
   <a-modal v-model:open="modal1Open">
     <component :is="modal1Component" v-model:open="modal1Open" />
   </a-modal>
 </template>
 
 <script setup>
-import { ref, defineProps, defineEmits, watch, getCurrentInstance, defineAsyncComponent } from 'vue';
+import {
+  ref,
+  defineProps,
+  defineEmits,
+  watch,
+  getCurrentInstance,
+  defineAsyncComponent,
+} from 'vue';
 import Common from '../../common/Common';
 import DownloadService from '../../resource/file/DownloadService.js';
 import NotificationPanel from '../../customer/NotificationPanel.vue';
@@ -119,6 +136,7 @@ import {
   FileTextTwoTone,
   ContainerTwoTone,
   ControlTwoTone,
+  ReloadOutlined,
 } from '@ant-design/icons-vue';
 const props = defineProps({
   window: {
@@ -163,7 +181,11 @@ const props = defineProps({
   },
 });
 
-const emit = defineEmits(['createRecordInWindowEdit', 'deleteRecords']);
+const emit = defineEmits([
+  'createRecordInWindowEdit',
+  'deleteRecords',
+  'refreshDatas',
+]);
 
 const tabButtons = ref([]);
 const leftTabButton = ref([]);
@@ -175,9 +197,6 @@ const modal1Open = ref(false);
 // 模态框的组件
 const modal1Component = ref(null);
 
-
-
-
 const { proxy } = getCurrentInstance(); //访问this
 // 新建数据
 const create = () => {
@@ -188,6 +207,11 @@ const deleteData = () => {
   emit('deleteRecords');
 };
 
+// 刷新
+const refresh = () => {
+  emit('refreshDatas', false);
+};
+
 /**
  * 导出确认
  */
@@ -408,10 +432,9 @@ const isEmpty = obj => {
   }
 };
 
-
 /**
  * 获取字符串的哈希值
- * @param input 
+ * @param input
  */
 const getHash = function (input) {
   let hash = 0;
@@ -420,22 +443,20 @@ const getHash = function (input) {
   }
   for (let i = 0; i < input.length; i++) {
     const char = input.charCodeAt(i);
-    hash = ((hash << 5) - hash) + char;
+    hash = (hash << 5) - hash + char;
     hash = hash & hash; // 确保返回值是一个32位有符号整数
   }
   return Math.abs(hash).toString();
 };
 
-
 /**
-     * 远程加载ES VUE组件模块,并在模态框中打开。
-     * @param jsUrl js路径
-     * @param cssUrl css路径
-     */
-const openRemotCompoentModule = async function(tabButton){
-
+ * 远程加载ES VUE组件模块,并在模态框中打开。
+ * @param jsUrl js路径
+ * @param cssUrl css路径
+ */
+const openRemoteComponentModule = async function (tabButton) {
   let jsUrl = tabButton.remoteComponentModuleJsUrl;
-  
+
   let cssUrl = tabButton.remoteComponentModuleCssUrl;
 
   // 显示模态框
@@ -443,7 +464,7 @@ const openRemotCompoentModule = async function(tabButton){
   //let jsUrl = './static/client-eam-module-v3/dist/AssetCheckCreate.js';
   //let cssUrl = './static/client-eam-module-v3/dist/AssetCheckCreate.css';
 
-  if(cssUrl != null && cssUrl.length > 0){
+  if (cssUrl != null && cssUrl.length > 0) {
     let cssUrlHash = getHash(cssUrl);
     CssUtil.dynamicLoadCss(cssUrl, cssUrlHash);
   }
@@ -451,9 +472,9 @@ const openRemotCompoentModule = async function(tabButton){
   // const testAsyncRemoteComponent  = await import(/* webpackIgnore: true */ jsUrl);
 
   // console.log(testAsyncRemoteComponent);
-  if(jsUrl != null && jsUrl.length > 0){
+  if (jsUrl != null && jsUrl.length > 0) {
     const testAsyncRemoteComponent = defineAsyncComponent({
-    // 加载函数
+      // 加载函数
       loader: () => {
         return import(/* webpackIgnore: true */ jsUrl);
       },
@@ -471,10 +492,7 @@ const openRemotCompoentModule = async function(tabButton){
     modal1Component.value = testAsyncRemoteComponent;
     modal1Open.value = true;
   }
-  
 };
-
-
 </script>
 
 <style scoped>

+ 6 - 71
src/window1/tabGridView/TabGridEdit.vue

@@ -30,42 +30,13 @@
           />
         </div>
       </div>
-
-      <div ref="zc" class="zc">
-        <a-modal
-          v-model:open="createModal" :mask-closable="false" :width="step === '1' ? '800px' : '500px'"
-          class="custom-modal" :get-container="() => $refs.zc" @cancel="cancelCreate"
-        >
-          <template #title>
-            <div class="modal_title">
-              <AppstoreTwoTone />
-              <span style="padding-left: 10px">资产分类</span>
-            </div>
-          </template>
-          <template #footer>
-            <a-button v-if="step === '0'" type="primary" @click="cancelCreate">
-              取消
-            </a-button>
-            <div v-if="step === '1'" class="modal_footer">
-              <div>
-                您当前选择的是:<span style="color: red">{{ nowAsset }}</span>
-              </div>
-              <div>
-                <a-button type="primary" @click="confirmCreate">
-                  确认
-                </a-button>
-              </div>
-            </div>
-          </template>
-        </a-modal>
-      </div>
-
       <div class="grid-item-row2">
         <NewTabButton
           :window="window" :now-tab="nowTab" :simple-filter-params="searchText"
           :complex-filter-params="complexFilterParams" :uuid="uuid" :show-tab-dto="tab" :model-datas="modelDatas"
           :view-type="'Grid'" :curd-window-function-access="curdWindowFunctionAccess"
           @create-record-in-window-edit="createRecordInWindowEdit" @delete-records="deleteRecords"
+          @refresh-datas="refreshDatas"
         />
       </div>
 
@@ -212,10 +183,8 @@ export default {
   data: function () {
     this.Language = Language;
     return {
-      createModal: false,
       window: {},
       tabIndex: null,
-      step: '0',
       nowTab: null, // 当前是哪个阶段
       nowAsset: '', // 所选资产分类名称
       selectCategory: null, //所选资产分类数据
@@ -1107,6 +1076,11 @@ export default {
       _self.queryGridData(true);
     },
 
+    // 刷新数据
+    refreshDatas: function (flag) {
+      this.queryGridData(flag);
+    },
+
     // 删除选择的数据
     deleteRecords: function (isAlert) {
       var _self = this;
@@ -1802,45 +1776,6 @@ export default {
   cursor: none;
 }
 
-.modal_title {
-  background: #267fcf;
-  height: 32px;
-  line-height: 32px;
-  color: #fff;
-  /* padding: 0 80px 0 40px; */
-  border: 0;
-  padding-left: 8px;
-}
-
-.modal_footer {
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-  text-align: unset;
-}
-
-:deep(.zc .ant-modal-content) {
-  padding: 0 0 8px 0;
-}
-
-:deep( :where(.css-dev-only-do-not-override-16pw25h).ant-modal .ant-modal-close) {
-  top: 6px;
-  color: #fff;
-}
-
-:deep(.zc .ant-modal-header) {
-  margin-bottom: 0px;
-}
-
-:deep(.ant-modal-footer) {
-  padding-right: 8px;
-  padding-left: 8px;
-}
-
-:deep(.ant-breadcrumb-link > .btn-group) {
-  margin-top: -2px;
-}
-
 :deep(.ant-pagination-options-quick-jumper) {
   margin-right: -18px !important;
 }