Răsfoiți Sursa

🐛 fix(日报时效): 放开时效状态下的表单编辑权限

Zimo 15 ore în urmă
părinte
comite
8ebdc644aa
1 a modificat fișierele cu 42 adăugiri și 38 ștergeri
  1. 42 38
      pages/ruiDu/compontents/report-form.vue

+ 42 - 38
pages/ruiDu/compontents/report-form.vue

@@ -74,15 +74,7 @@ onMounted(() => {
   });
 });
 
-const selectPlaceholder = computed(() => {
-  return props.formDisable ? " " : t("operation.PleaseSelect");
-});
-
-const inputPlaceholder = computed(() => {
-  return props.formDisable ? " " : t("operation.PleaseInput");
-});
-
-const props = defineProps({
+const props = defineProps({
   reportId: {
     type: String,
     default: "",
@@ -98,12 +90,24 @@ const props = defineProps({
   type: {
     type: String,
     default: "edit",
-  },
-});
-
-const isRequired = computed(() => {
-  return props.formDisable ? false : true;
-});
+  },
+});
+
+const formReadonly = computed(() => {
+  return props.formDisable && istime.value !== "true";
+});
+
+const selectPlaceholder = computed(() => {
+  return formReadonly.value ? " " : t("operation.PleaseSelect");
+});
+
+const inputPlaceholder = computed(() => {
+  return formReadonly.value ? " " : t("operation.PleaseInput");
+});
+
+const isRequired = computed(() => {
+  return !formReadonly.value;
+});
 
 const reportFormRef = ref(null);
 
@@ -1193,7 +1197,7 @@ watch(
           :clear="false"
           align="right"
           placeholder="请选择平台井"
-          :disabled="formDisable && istime !== 'true'"
+          :disabled="formReadonly"
           :localdata="wellOptions"
           multiple
           v-model="form.platformIds" />
@@ -1206,7 +1210,7 @@ watch(
           :required="isRequired">
           <view
             class="item-content"
-            @click="props.formDisable ? '' : handleClickTimeRange()">
+            @click="formReadonly ? '' : handleClickTimeRange()">
             <view class="time-range-item" v-if="form.startTime && form.endTime">
               {{ form.startTime }} 至 {{ form.endTime }}
             </view>
@@ -1223,8 +1227,8 @@ watch(
               <button
                 class="mini-btn form-item-btn"
                 type="primary"
-                :disabled="formDisable"
-                v-if="!formDisable"
+                :disabled="formReadonly"
+                v-if="!formReadonly"
                 @click="handleClickSelectDevice">
                 {{ $t("device.selectDevice") }}
               </button>
@@ -1268,7 +1272,7 @@ watch(
             :clearable="false"
             :styles="{ disableColor: '#fff' }"
             :placeholder="inputPlaceholder"
-            :disabled="formDisable"
+            :disabled="formReadonly"
             v-model.number="dailyFuel" />
         </uni-forms-item>
 
@@ -1285,7 +1289,7 @@ watch(
             :clearable="false"
             :styles="{ disableColor: '#fff' }"
             :placeholder="inputPlaceholder"
-            :disabled="formDisable"
+            :disabled="formReadonly"
             v-model="form.productionStatus"
             :maxlength="1000" />
         </uni-forms-item> -->
@@ -1303,7 +1307,7 @@ watch(
             :clearable="false"
             :styles="{ disableColor: '#fff' }"
             :placeholder="inputPlaceholder"
-            :disabled="formDisable"
+            :disabled="formReadonly"
             v-model="form.nextPlan"
             :maxlength="1000" />
         </uni-forms-item>
@@ -1320,7 +1324,7 @@ watch(
             :clearable="false"
             :styles="{ disableColor: '#fff' }"
             :placeholder="inputPlaceholder"
-            :disabled="formDisable"
+            :disabled="formReadonly"
             v-model="form.externalRental"
             :maxlength="1000" />
         </uni-forms-item>
@@ -1337,7 +1341,7 @@ watch(
             :clearable="false"
             :styles="{ disableColor: '#fff' }"
             :placeholder="inputPlaceholder"
-            :disabled="formDisable"
+            :disabled="formReadonly"
             v-model="form.malfunction"
             :maxlength="1000" />
         </uni-forms-item>
@@ -1353,7 +1357,7 @@ watch(
             :clearable="true"
             :styles="{ disableColor: '#fff' }"
             :placeholder="inputPlaceholder"
-            :disabled="formDisable"
+            :disabled="formReadonly"
             v-model="form.faultDowntime"
             :maxlength="1000" />
         </uni-forms-item>
@@ -1383,7 +1387,7 @@ watch(
           :label="`${$t('ruiDu.attachment')}:`"
           :required="false"
           name="attachments">
-          <view v-if="!formDisable" class="file-parent">
+          <view v-if="!formReadonly" class="file-parent">
             <view class="file-picker-container item-end">
               <view class="file-size-limit">
                 {{ $t("ruiDu.fileSizeLimit") }}
@@ -1430,7 +1434,7 @@ watch(
           生产动态
 
           <button
-            v-if="!formDisable && istime !== 'true'"
+            v-if="!formReadonly"
             type="primary"
             size="mini"
             class="detail-btn"
@@ -1453,7 +1457,7 @@ watch(
               :clear-icon="false"
               :border="false"
               :placeholder="selectPlaceholder"
-              :disabled="formDisable"
+              :disabled="formReadonly"
               :styles="{ disableColor: '#fff' }"
               v-model="item.reportDate"
               @change="handleReportDetailDateChange(index)" />
@@ -1470,7 +1474,7 @@ watch(
               :clear-icon="false"
               :border="false"
               :placeholder="selectPlaceholder"
-              :disabled="formDisable"
+              :disabled="formReadonly"
               :styles="{ disableColor: '#fff' }"
               v-model="item.endDateTime"
               @change="handleReportDetailDateChange(index)" />
@@ -1481,7 +1485,7 @@ watch(
             required>
             <view
               class="item-content"
-              @click="props.formDisable ? '' : handleClickTimeRangeItem(index)">
+              @click="formReadonly ? '' : handleClickTimeRangeItem(index)">
               <view
                 class="time-range-item"
                 v-if="item.startTime && item.endTime">
@@ -1516,12 +1520,12 @@ watch(
               :clearable="true"
               :styles="{ disableColor: '#fff' }"
               :placeholder="inputPlaceholder"
-              :disabled="formDisable"
+              :disabled="formReadonly"
               v-model="item.constructionDetail"
               :maxlength="2000" />
           </uni-forms-item>
           <uni-forms-item
-            v-if="!formDisable && istime !== 'true'"
+            v-if="!formReadonly"
             class="form-item"
             label="操作">
             <button
@@ -1564,7 +1568,7 @@ watch(
             placement="top"
             :localdata="rdStatusRange"
             :placeholder="selectPlaceholder"
-            :disabled="formDisable"
+            :disabled="formReadonly"
             v-model="form[platformId].rdStatus">
           </uni-data-select>
         </uni-forms-item>
@@ -1591,7 +1595,7 @@ watch(
             :multiple="true"
             :clear="false"
             :localdata="techniqueRange"
-            :disabled="formDisable"
+            :disabled="formReadonly"
             placement="top"
             @change="getWorkloadInfoByTechnique(platformId)"
             v-model="form[platformId].techniqueIds">
@@ -1606,7 +1610,7 @@ watch(
                     type="close"
                     size="18"
                     color="#909399"
-                    v-if="!formDisable"
+                    v-if="!formReadonly"
                     @click="
                       removeSelectedItem(platformId, item.value)
                     "></uni-icons>
@@ -1667,7 +1671,7 @@ watch(
             :clearable="true"
             :styles="{ disableColor: '#fff' }"
             :placeholder="inputPlaceholder"
-            :disabled="formDisable"
+            :disabled="formReadonly"
             v-model.number="form[platformId].extProperty[index].actualValue" />
           <uni-easyinput
             v-else
@@ -1676,7 +1680,7 @@ watch(
             :inputBorder="false"
             :clearable="true"
             :placeholder="inputPlaceholder"
-            :disabled="formDisable"
+            :disabled="formReadonly"
             v-model="form[platformId].extProperty[index].actualValue"
             :type="'textarea'"></uni-easyinput>
         </uni-forms-item>
@@ -1762,7 +1766,7 @@ watch(
             :clearable="false"
             :styles="{ disableColor: '#fff' }"
             :placeholder="inputPlaceholder"
-            :disabled="formDisable"
+            :disabled="formReadonly"
             v-model.number="fuel.customFuel"
             @input="handleListChange" />
         </uni-forms-item>