Преглед изворни кода

feat: 场景管理-车间管理 添加工位时设置随机code

“fujiacheng” пре 1 година
родитељ
комит
75344106b2
1 измењених фајлова са 5 додато и 13 уклоњено
  1. 5 13
      src/views/system-config/scene-manage/components/WorkspaceDrawer.vue

+ 5 - 13
src/views/system-config/scene-manage/components/WorkspaceDrawer.vue

@@ -1,12 +1,6 @@
 <template>
   <div>
-    <el-drawer
-      class="test"
-      :model-value="true"
-      @close="() => emit('onClose')"
-      with-header="true"
-      size="35%"
-    >
+    <el-drawer class="test" :model-value="true" @close="() => emit('onClose')" with-header="true" size="35%">
       <template #header="{ titleId }">
         <p :id="titleId">{{ title }}</p>
       </template>
@@ -39,12 +33,8 @@
       </el-form>
       <div style="position: absolute; left: 108px; bottom: 67px">
         <el-button v-if="!props.detail.id" @click="resetDraw">重置</el-button>
-        <el-button v-if="!props.detail.id" type="primary" @click="addNewType(ruleFormRef)">
-          提交
-        </el-button>
-        <el-button v-if="props.detail.id" type="primary" @click="editedSub(ruleFormRef)">
-          提交
-        </el-button>
+        <el-button v-if="!props.detail.id" type="primary" @click="addNewType(ruleFormRef)"> 提交 </el-button>
+        <el-button v-if="props.detail.id" type="primary" @click="editedSub(ruleFormRef)"> 提交 </el-button>
       </div>
     </el-drawer></div
   >
@@ -55,6 +45,7 @@
   // import { IS_DISABLED } from '@/types/scene/constant.ts';
   import { type FormInstance, type FormRules } from 'element-plus';
   import { addWorkspace, editWorkspace } from '@/api/scene/scene.ts';
+  import { uid } from 'uid';
 
   const props = defineProps<{
     // allCodes: string[];
@@ -133,6 +124,7 @@
         // // isDisabled: ruleForm.isDisabled,
         workshopId: props.detail.workshopId,
         // orderNum: props.detail.orderNum,
+        code: uid(20),
       };
       addWorkspace(newAddData)
         .then(() => {