Browse Source

试验,设备进场,接口调试

iZaiZaiA 2 years ago
parent
commit
f70273fe66
2 changed files with 35 additions and 27 deletions
  1. 8 3
      src/global/components/hc-counter/index.vue
  2. 27 24
      src/views/tentative/device/approach.vue

+ 8 - 3
src/global/components/hc-counter/index.vue

@@ -52,6 +52,7 @@ watch(() => [
 //转换
 const setModelVal = (val) => {
     modelValues.value = Number(val)
+    setEmitData(val)
 }
 
 const emit = defineEmits(['update:modelValue','addClick','moveClick', 'change'])
@@ -63,9 +64,7 @@ const moveBtnClick = () => {
         modelValues.value =  1;
     } else {
         modelValues.value =  val;
-        emit('update:modelValue', val)
-        emit('moveClick', val)
-        emit('change', val)
+        setEmitData(val)
     }
 }
 
@@ -73,10 +72,16 @@ const moveBtnClick = () => {
 const addBtnClick = () => {
     let val = modelValues.value + 1;
     modelValues.value =  val;
+    setEmitData(val)
+}
+
+//事件
+const setEmitData = (val) => {
     emit('update:modelValue', val)
     emit('addClick', val)
     emit('change', val)
 }
+
 </script>
 
 <style lang="scss" scoped>

+ 27 - 24
src/views/tentative/device/approach.vue

@@ -27,19 +27,19 @@
                         </el-button>
                     </HcTooltip>
                     <HcTooltip keys="tentative_device_approach_edit">
-                        <el-button hc-btn @click="editFormModalClick">
+                        <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" @click="editFormModalClick">
                             <HcIcon name="edit"/>
                             <span>编辑</span>
                         </el-button>
                     </HcTooltip>
                     <HcTooltip keys="tentative_device_approach_del">
-                        <el-button hc-btn @click="delNodeModalClick">
+                        <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" @click="delNodeModalClick">
                             <HcIcon name="delete-bin-2"/>
                             <span>删除</span>
                         </el-button>
                     </HcTooltip>
                     <HcTooltip keys="tentative_device_approach_printer">
-                        <el-button hc-btn>
+                        <el-button hc-btn :disabled="tableCheckedKeys.length <= 0">
                             <HcIcon name="printer"/>
                             <span>打印</span>
                         </el-button>
@@ -206,7 +206,6 @@ import approachApi from "~api/tentative/device/approach";
 import {formValidate, getArrValue} from "vue-utils-plus"
 import samplingApi from "~api/tentative/material/sampling";
 import {getContractUserList} from "~api/other";
-//import {getDictionary} from "~api/other";
 
 //初始变量
 const useAppState = useAppStore()
@@ -329,23 +328,23 @@ const pageChange = ({current, size}) => {
 //表格数据
 const tableRef = ref(null)
 const tableColumn = ref([
-    {key:'deviceName', name: '设备名称'},
-    {key:'deviceClassName', name: '设备分类'},
-    {key:'deviceNumber', name: '设备编号'},
-    {key:'deviceModel', name: '设备型号'},
-    {key:'manufacturer', name: '生产厂家'},
-    {key:'factoryDate', name: '出厂日期'},
-    {key:'factoryNumber', name: '出厂编号'},
-    {key:'mobilizationDate', name: '进场日期'},
-    {key:'measuringRange', name: '测量范围'},
-    {key:'accuracy', name: '精准度'},
-    {key:'calibrationCycle', name: '校准周期(月)'},
-    {key:'lastCalibrationTime', name: '最近效验时间'},
-    {key:'status', name: '状态'},
-    {key:'isCalibration', name: '是否需要效验'},
-    {key:'equipmentAcquisitionNumber', name: '设备采集编号'},
-    {key:'managerName', name: '设备管理人员'},
-    {key:'remarks', name: '备注'},
+    {key:'deviceName', name: '设备名称', width: '200'},
+    {key:'deviceClassName', name: '设备分类', width: '160'},
+    {key:'deviceNumber', name: '设备编号', width: '160'},
+    {key:'deviceModel', name: '设备型号', width: '180'},
+    {key:'manufacturer', name: '生产厂家', width: '200'},
+    {key:'factoryDate', name: '出厂日期', width: '160'},
+    {key:'factoryNumber', name: '出厂编号', width: '160'},
+    {key:'mobilizationDate', name: '进场日期', width: '160'},
+    {key:'measuringRange', name: '测量范围', width: '120'},
+    {key:'accuracy', name: '精准度', width: '120'},
+    {key:'calibrationCycle', name: '校准周期(月)', width: '120'},
+    {key:'lastCalibrationTime', name: '最近效验时间', width: '160'},
+    {key:'status', name: '状态', width: '100'},
+    {key:'isCalibration', name: '是否需要效验', width: '100'},
+    {key:'equipmentAcquisitionNumber', name: '设备采集编号', width: '160'},
+    {key:'managerName', name: '设备管理人员', width: '120'},
+    {key:'remarks', name: '备注', width: '160'},
 ])
 const tableData = ref([])
 
@@ -377,7 +376,6 @@ const tableSelection = (rows) => {
     })
 }
 
-
 //新增/编辑 分类
 const addEditNodeFormRef = ref(null)
 const addEditNodeFormModal = ref(false)
@@ -455,7 +453,6 @@ const setClassRemove = async (id) => {
     }
 }
 
-
 //导入
 const importModal = ref(false)
 const importModalClick = () => {
@@ -515,7 +512,13 @@ const addFormModalClick = () => {
 
 //编辑 设备信息
 const editFormModalClick = () => {
-    addEditFormModal.value = true
+    const keys = tableCheckedKeys.value
+    if (keys.length === 1) {
+        addEditFormModel.value = keys[0]
+        addEditFormModal.value = true
+    } else if (keys.length > 1) {
+        window?.$message?.warning('只能选择一条数据编辑')
+    }
 }
 
 //关闭新增/编辑的弹窗