Przeglądaj źródła

运行统计优化

yuanchao 3 tygodni temu
rodzic
commit
ff64e17de7

+ 1 - 0
src/utils/dict.ts

@@ -273,6 +273,7 @@ export enum DICT_TYPE {
   PMS_MAIN_WORK_ORDER_TYPE = 'pms_main_work_order_type', // 保养工单类型
   PMS_MAIN_WORK_ORDER_RESULT = 'pms_main_work_order_result', // 保养工单状态
   RQ_IOT_ISCOLLECTION = 'rq_iot_isCollection',//是否数采
+  RQ_IOT_ISREPORT = 'rq_iot_isReport',//日报是否取值
   RQ_IOT_MODEL_TEMPLATE_ATTR = 'rq_iot_model_template_attr',
   RQ_IOT_MODEL_PLUS = "rq_iot_model_plus",
   RQ_IOT_SUM = 'rq_iot_isSum',//是否累计

+ 72 - 34
src/views/pms/iotopeationfill/index1.vue

@@ -7,14 +7,19 @@
         :key="index"
       >
         <template #label>
-<!--          <span  @click="openFill(item.deviceCategoryId,item.deviceId,item.deptId,item.deviceName,item.deviceCode)">
-           {{item.deviceCode}} ({{ item.deviceName }})
-          </span>-->
-          <span class="custom-label" v-if='item.isFill === 1' @click="openFill(item.deviceCategoryId,item.deviceId,item.deptId,item.deviceName,item.deviceCode)">
-           {{item.deviceCode}} ({{ item.deviceName }})
+          <span
+            :class="['custom-label', { 'has-border': item.deviceName === '生产日报' }]"
+            v-if='item.isFill === 1'
+            @click="openFill(item.deviceCategoryId,item.deviceId,item.deptId,item.deviceName,item.deviceCode)"
+          >
+            {{item.deviceCode}} ({{ item.deviceName }})
           </span>
-          <span class="custom-label1" v-else  @click="openFill(item.deviceCategoryId,item.deviceId,item.deptId,item.deviceName,item.deviceCode)">
-           {{item.deviceCode}} ({{ item.deviceName }})
+                  <span
+                    :class="['custom-label1', { 'has-border': item.deviceName === '生产日报' }]"
+                    v-else
+                    @click="openFill(item.deviceCategoryId,item.deviceId,item.deptId,item.deviceName,item.deviceCode)"
+                  >
+            {{item.deviceCode}} ({{ item.deviceName }})
           </span>
         </template>
         <div class="form-wrapper">
@@ -65,28 +70,37 @@
                 />
               </div>
                 <el-form-item :label='item.name' prop="deviceId"  label-position="top">
-                  <el-input
-                    v-if="fillStatus === '1'"
-                    v-model="item.fillContent"
-                    clearable
-                    style="width: 200px"
-                    disabled
-                  />
-<!--                  <el-input
-                    v-else
-                    v-model="item.fillContent"
-                    clearable
-                    style="width: 200px"
-                  />-->
-                  <el-input
-                    v-else
-                    v-model="item.fillContent"
-                    clearable
-                    style="width: 200px"
-                    :placeholder="item.type === 'double' ? t('operationFillForm.enterNumber') : t('operationFillForm.enterContent')"
-                    @input="handleInput(item)"
-                    :maxlength="item.type === 'double' ? calculateMaxLength(item) : undefined"
-                  />
+                    <el-input
+                      v-if="fillStatus === '1'"
+                      v-model="item.fillContent"
+                      clearable
+                      style="width: 200px"
+                      disabled
+                    />
+                    <el-input
+                      v-else-if="item.type === 'textarea'"
+                      v-model="item.fillContent"
+                      type="textarea"
+                      clearable
+                      style="width: 200px"
+                    />
+                    <el-select  v-model="item.fillContent" clearable v-else-if="item.type === 'enum' && item.description !== null" style="width: 200px" filterable>
+                      <el-option
+                        v-for="dict in getIntDictOptions(item.description)"
+                        :key="dict.label"
+                        :label="dict.label"
+                        :value="dict.value"
+                      />
+                    </el-select>
+                    <el-input
+                      v-else
+                      v-model="item.fillContent"
+                      clearable
+                      style="width: 200px"
+                      :placeholder="item.type === 'double' ? t('operationFillForm.enterNumber') : t('operationFillForm.enterContent')"
+                      @input="handleInput(item)"
+                      :maxlength="item.type === 'double' ? calculateMaxLength(item) : undefined"
+                    />
                 </el-form-item>
             </div>
             <el-form-item>
@@ -112,7 +126,7 @@ import { ElMessage } from 'element-plus'
 import moment from 'moment';
 import { format } from 'date-fns';
 import {cx} from "@fullcalendar/core/internal-common";
-
+import { DICT_TYPE, getIntDictOptions} from '@/utils/dict'
 
 /** 运行记录填报 列表 */
 defineOptions({ name: 'FillOrderInfo' })
@@ -306,9 +320,22 @@ const getAttrList = async () => {
     attrList.value = data[0].nonSumList;
     attrList1.value = data[0].sumList;
     attrList.value.forEach(function (item,index){
-
-      if(item.fillContent!=''){
-        item.fillContent = Number(item.fillContent).toFixed(2)
+      if(item.fillContent!=''&& item.fillContent !== null){
+        // 尝试将字符串转换为数字
+        const num = Number(item.fillContent);
+
+        // 检查是否是有效的数字
+        if (!isNaN(num)) {
+          // 检查是否包含小数
+          if (item.fillContent.includes('.')) {
+            // 保留两位小数
+            item.fillContent = Number(num.toFixed(2));
+          } else {
+            // 转换为整数
+            item.fillContent = Math.floor(num);
+          }
+        }
+        // 如果不是有效的数字,则保持原文本不变
       }
       item.deviceCode = queryParams.deviceCode;
       item.deptId = queryParams.deptId;
@@ -316,7 +343,6 @@ const getAttrList = async () => {
       item.deviceCategoryId = queryParams.deviceCategoryId;
       item.modelId = item.id;
     })
-    console.log(JSON.stringify(attrList.value))
     attrList1.value.forEach(function (item,index){
       item.deviceCode = queryParams.deviceCode;
       item.deptId = queryParams.deptId;
@@ -448,6 +474,12 @@ onMounted(() => {
   font-size: 17px;
   padding: 0 10px;
 }
+.has-border {
+  border: 2px solid #333; /* 加粗到2px,使用深灰色#333让边框更清晰 */
+  padding: 3px 8px; /* 适当增加内边距,避免文字太贴近边框 */
+  border-radius: 2px; /* 轻微圆角,可选 */
+  font-size: 20px;
+}
 ::v-deep .el-step__icon {
   background-color: #409eff;
   color: #fff;
@@ -505,4 +537,10 @@ onMounted(() => {
   flex: 1; /* 等宽分布 */
   min-width: 200px; /* 最小宽度防止挤压 */
 }
+/* 新增日报填报项的边框样式 */
+.report-border {
+  border: 2px solid #42b983; /* 使用Vue标志性的绿色边框 */
+  padding: 2px 4px;
+  border-radius: 4px;
+}
 </style>

+ 19 - 7
src/views/pms/modeltemplate/detail/attrsModel/AttrTemplateModelForm.vue

@@ -14,7 +14,19 @@
             <el-input v-model="formData.name" placeholder="请输入属性名称" />
           </el-form-item>
         </el-col>
-
+        <el-col :span="12">
+          <el-form-item label="日报取值" prop="dailyReport">
+            <el-radio-group v-model="formData.dailyReport">
+              <el-radio
+                v-for="dict in getIntDictOptions(DICT_TYPE.RQ_IOT_ISCOLLECTION)"
+                :key="dict.value"
+                :value="dict.value"
+              >
+                {{ dict.label }}
+              </el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </el-col>
       </el-row>
       <el-row>
         <el-col :span="12">
@@ -48,7 +60,7 @@
       </el-row>
       <el-row>
         <el-col :span="12">
-          <el-form-item label="累加值" prop="defaultValue" v-if="formData.isSum === 1">
+          <el-form-item label="累加值" prop="defaultValue" v-show="formData.isSum === 1">
             <!--            <el-input v-model="formData.defaultValue" placeholder="请选择累加值" />-->
             <el-select v-model="formData.defaultValue" placeholder="请选择累加值" clearable>
               <el-option
@@ -60,9 +72,7 @@
               />
             </el-select>
           </el-form-item>
-          <el-form-item label="填写阈值" prop="threshold" v-else>
-            <el-input v-model="formData.threshold" placeholder="请输入阈值" type="number"/>
-          </el-form-item>
+
         </el-col>
         <el-col :span="12">
           <el-form-item label="是否累加" prop="sumId" v-show="formData.isSum === 1">
@@ -80,18 +90,20 @@
       </el-row>
       <el-row>
         <el-col :span="12">
-          <el-form-item label="标识符" prop="code" v-show="formData.isSum === 1">
+          <el-form-item label="标识符" prop="code" v-if="formData.isSum === 1">
             <el-radio-group v-model="formData.code">
               <el-radio
                 v-for="dict in getStrDictOptions(DICT_TYPE.RQ_IOT_MODEL_TEMPLATE_ATTR)"
                 :key="dict.value"
                 :value="dict.value"
-                @click="radioChange(dict.value)"
               >
                 {{ dict.label }}
               </el-radio>
             </el-radio-group>
           </el-form-item>
+          <el-form-item label="填写阈值" prop="threshold" v-else>
+            <el-input v-model="formData.threshold" placeholder="请输入阈值" type="number"/>
+          </el-form-item>
         </el-col>
         <el-col :span="12">
           <el-form-item label="物属性" prop="modelAttr">

+ 4 - 4
src/views/pms/modeltemplate/detail/attrsModel/AttrTemplateModelProperty.vue

@@ -23,12 +23,12 @@
       )
     "
     v-model="selectOptions.dataSpecs"
-  />
-  &lt;!&ndash; 枚举型配置 &ndash;&gt;
-  <ModelAttrModelNumberDataSpecs
+  />-->
+  <!-- 枚举型配置 -->
+  <ModelAttrModelEnumDataSpecs
     v-if="selectOptions.type === DataSpecsDataType.ENUM"
     v-model="selectOptions.dataSpecsList"
-  />-->
+  />
   <!-- 布尔型配置 -->
   <el-form-item v-if="selectOptions.type === DataSpecsDataType.BOOL" label="布尔值">
     <template v-for="(item, index) in selectOptions.dataSpecsList" :key="item.value">