CzRger 5 月之前
父節點
當前提交
7db59f91cd
共有 2 個文件被更改,包括 17 次插入3 次删除
  1. 9 3
      src/views/manage/service/detail.vue
  2. 8 0
      src/views/manage/service/index.vue

+ 9 - 3
src/views/manage/service/detail.vue

@@ -182,7 +182,7 @@
                 required
                 type="textarea"
                 v-model:param="state.params.requestBody.str"
-                :rows="12"
+                :rows="6"
                 :rules="[
                   {
                     handle: (val) => {
@@ -563,6 +563,7 @@ import {ElMessage, ElMessageBox} from "element-plus";
 import complexRequestParams from './complex-params.vue'
 import formatRuleDict from './format-rule-dict.vue'
 import {outsideServiceFindById, outsideServiceSaveOrUpdate} from "@/api/modules/manage/service";
+import { v4 } from "uuid";
 
 const emit = defineEmits(['update:show', 'refresh'])
 const {proxy} = getCurrentInstance()
@@ -680,6 +681,8 @@ const titleCpt = computed(() => {
   switch (props.transfer.mode) {
     case 'add': t = '新增外部服务'
       break
+    case 'copy': t = '新增外部服务'
+      break
     case 'edit': t = '编辑外部服务'
       break
   }
@@ -791,7 +794,6 @@ const onSubmit = () => {
         data: state.params.responseBody.other.data.length > 0 ? state.params.responseBody.other.data : null
       }
     })
-    console.log(params)
     ElMessageBox.confirm("是否提交?", "提示", {
       confirmButtonText: "确定",
       cancelButtonText: "取消",
@@ -799,7 +801,7 @@ const onSubmit = () => {
     } as any).then(() => {
       state.loading = true
       outsideServiceSaveOrUpdate(params).then(res => {
-        ElMessage.success(props.transfer.mode === 'add' ? '新增成功!' : '编辑成功!')
+        ElMessage.success(props.transfer.mode === 'edit' ? '编辑成功!' : '新增成功!')
         emit('update:show', false)
         emit('refresh')
         state.loading = false
@@ -850,6 +852,10 @@ const initDetail = () => {
         state.params.responseBody.other.data = p.other.data || []
       } catch (e) {}
     }
+    if (props.transfer.mode === 'copy') {
+      state.form.id = ''
+      state.form.serviceName = v4()
+    }
     state.loading = false
   })
 }

+ 8 - 0
src/views/manage/service/index.vue

@@ -48,6 +48,7 @@
           <CusButton v-else type="table-edit" title="禁用" @click="onStatus(scope.row, '2')"/>
           <CusButton type="table-del" @click="onDel(scope.row)"/>
           <CusButton type="table" icon="relation" title="关联主题" @click="onTheme(scope.row)"/>
+          <CusButton type="table-add" title="复制" @click="onCopy(scope.row)"/>
         </template>
       </CusTable>
     </div>
@@ -194,6 +195,13 @@ const onStatus = (row, status) => {
     })
   }).catch(() => {})
 }
+const onCopy = (row) => {
+  state.detail.transfer = {
+    mode: 'copy',
+    id: row.id,
+  }
+  state.detail.show = true
+}
 const initDictionary = () => {
   DictionaryStore.initDict('gx_method')
   DictionaryStore.initDict('role_status')