Quellcode durchsuchen

设备类型管理编辑值禁用修改-提交

lxh vor 3 Monaten
Ursprung
Commit
6a8e22edc4

+ 12 - 3
src/views/vent/deviceManager/equipManager/component/DeviceModal.vue

@@ -17,7 +17,8 @@
         <FormModal v-if="activeKey == '2'" :record="passwordRecord" :formSchema="passwordFormSchema" @saveOrUpdate="savePassword" />
       </a-tab-pane>
     </a-tabs>
-    <FormModal v-else :record="record"  :formSchema="formSchema" @saveOrUpdate="saveOrUpdate" />
+    <FormModal v-if="!isEditParent && isAddorEdit=='add'" :record="record"  :formSchema="formSchema1" @saveOrUpdate="saveOrUpdate" />
+    <FormModal v-if="!isEditParent && isAddorEdit=='edit'" :record="record"  :formSchema="formSchema" @saveOrUpdate="saveOrUpdate" />
   </BasicModal>
 </template>
 
@@ -25,9 +26,12 @@
   import { ref, onMounted, reactive } from 'vue';
   import { BasicModal, useModalInner } from '/@/components/Modal';
   import FormModal from './FormModal.vue';
-  import { formSchema, passwordFormSchema } from '../equip.data.ts';
-  import { passwordList, editPassword } from '../equip.api.ts'
+  import { formSchema,formSchema1, passwordFormSchema } from '../equip.data';
+  import { passwordList, editPassword } from '../equip.api'
 
+  let props=defineProps({
+    isAddorEdit:String,
+  })
   // 声明Emits
   const emit = defineEmits(['saveOrUpdate', 'register']);
   const title = ref('')
@@ -78,3 +82,8 @@
     color: #fff;
   }
 </style>
+<style>
+div[aria-hidden="true"] {
+    display: none !important
+}
+</style>

+ 5 - 3
src/views/vent/deviceManager/equipManager/component/normalBtnTable.vue

@@ -32,7 +32,7 @@
         <slot name="filterCell" v-bind="{ column, record }"></slot>
       </template>
     </BasicTable>
-    <DeviceModal @register="registerModal" @saveOrUpdate="saveOrUpdateHandler" />
+    <DeviceModal :isAddorEdit="isAddorEdit" @register="registerModal" @saveOrUpdate="saveOrUpdateHandler" />
   </div>
 </template>
 
@@ -85,6 +85,7 @@ const props = defineProps({
     type: String,
   },
 });
+const isAddorEdit=ref('')
 const emit = defineEmits(['submitSuccess']);
 const isUpdate = ref(false);
 //lxh
@@ -163,6 +164,7 @@ const saveOrUpdateHandler = async (params) => {
  */
 function handleAdd() {
   dictId.value = null;
+   isAddorEdit.value='add'
   for (let key in record) {
     delete record[key];
   }
@@ -173,8 +175,7 @@ function handleAdd() {
  * 新增下级
  */
 function handleAdds(data) {
-  // debugger;
-  console.log(data, '添加下级');
+  isAddorEdit.value='add'
   dictId.value = data.subDictId;
   for (let key in record) {
     delete record[key];
@@ -187,6 +188,7 @@ function handleAdds(data) {
  */
 function handleEdit(data) {
   isUpdate.value = true;
+  isAddorEdit.value='edit'
   dictId.value = data.dictId;
   Object.assign(record, toRaw(data));
   openModal(true, {

+ 40 - 0
src/views/vent/deviceManager/equipManager/equip.data.ts

@@ -90,6 +90,7 @@ export const formSchema: FormSchema[] = [
   {
     label: '数据值',
     field: 'itemValue',
+    dynamicDisabled:true,
     component: 'Input',
   },
   // {
@@ -114,4 +115,43 @@ export const formSchema: FormSchema[] = [
     component: 'InputNumber',
   },
 ];
+export const formSchema1: FormSchema[] = [
+  {
+    label: '',
+    field: 'id',
+    component: 'Input',
+    show: false,
+  },
+  {
+    label: '',
+    field: 'dictId',
+    component: 'Input',
+    show: false,
+  },
+  {
+    label: '名称',
+    field: 'itemText',
+    component: 'Input',
+  },
+  {
+    label: '数据值',
+    field: 'itemValue',
+    component: 'Input',
+  },
+  {
+    label: '所属系统',
+    field: 'description',
+    component: 'JDictSelectTag',
+    componentProps: {
+      dictCode: 'kindtype ',
+      placeholder: '请选择所属系统',
+    },
+  },
+  {
+    label: '排序值',
+    field: 'sortOrder',
+    suffix: '值越小越靠前',
+    component: 'InputNumber',
+  },
+];