Przeglądaj źródła

bug生产运营会议,调整查看禁用

Zimo 2 dni temu
rodzic
commit
cc435343fd

+ 9 - 5
src/views/pms/operation-meeting/components/meeting-detail-drawer.vue

@@ -30,8 +30,9 @@ const detailFormRef = ref<FormInstance>()
 const detailForm = ref<DetailItem>(createDetailItem())
 
 const detailDrawerSize = computed(() => (width.value <= 768 ? '100%' : '50%'))
+const isReadonly = computed(() => props.type === 'view')
 const detailDrawerTitle = computed(() => {
-  if (props.type === 'view') {
+  if (isReadonly.value) {
     return '查看会议明细'
   }
 
@@ -438,7 +439,7 @@ const handleVisibleChange = (visible: boolean) => {
 }
 
 const saveDetailItem = async () => {
-  if (props.type === 'view' || !detailFormRef.value) return
+  if (isReadonly.value || !detailFormRef.value) return
 
   const valid = await detailFormRef.value.validate().catch(() => false)
 
@@ -496,7 +497,7 @@ onMounted(() => {
       size="default"
       :model="detailForm"
       :rules="detailRules"
-      :disabled="type === 'view'"
+      :disabled="isReadonly"
       scroll-to-error
       require-asterisk-position="right">
       <section class="detail-section">
@@ -575,7 +576,7 @@ onMounted(() => {
               v-model="item.actualValue"
               class="w-full!"
               :controls="false"
-              :disabled="isEquipmentUtilizationExtProperty(item)"
+              :disabled="isReadonly || isEquipmentUtilizationExtProperty(item)"
               :precision="2"
               @change="handleExtPropertyValueChange(item)" />
             <el-input
@@ -583,6 +584,7 @@ onMounted(() => {
               v-model="item.actualValue"
               type="textarea"
               :rows="3"
+              :disabled="isReadonly"
               :placeholder="`请输入${item.name}`"
               @input="handleExtPropertyValueChange(item)" />
           </el-form-item>
@@ -650,6 +652,7 @@ onMounted(() => {
               v-model="item.actualValue"
               class="w-full!"
               :controls="false"
+              :disabled="isReadonly"
               :precision="2"
               @change="handleExtPropertyValueChange(item)" />
             <el-input
@@ -657,6 +660,7 @@ onMounted(() => {
               v-model="item.actualValue"
               type="textarea"
               :rows="4"
+              :disabled="isReadonly"
               :placeholder="`请输入${item.name}`"
               @input="handleExtPropertyValueChange(item)" />
           </el-form-item>
@@ -666,7 +670,7 @@ onMounted(() => {
 
     <template #footer>
       <el-button size="default" @click="handleVisibleChange(false)">取消</el-button>
-      <el-button size="default" v-if="type !== 'view'" type="primary" @click="saveDetailItem">
+      <el-button size="default" v-if="!isReadonly" type="primary" @click="saveDetailItem">
         保存
       </el-button>
     </template>