duy vor 3 Monaten
Ursprung
Commit
0da53d658e
1 geänderte Dateien mit 86 neuen und 84 gelöschten Zeilen
  1. 86 84
      src/views/tentative/material/modules/testSample/flow.vue

+ 86 - 84
src/views/tentative/material/modules/testSample/flow.vue

@@ -23,9 +23,10 @@
                     @change="betweenTimeUpdate"
                 />
             </div>
-            <div class="ml-2 w-250px">
+            <div class="ml-2 w-350px">
                 <hc-search-input
                     v-model="searchForm.materialName"
+                    placeholder="请输入“样品名称”、“规格型号”进行搜索"
                     @search="searchClick"
                 />
             </div>
@@ -38,10 +39,11 @@
                 <el-button
                     type="primary"
                     :disabled="tableCheckedKeys.length <= 0"
-                    @click="manualStorageClick"
                     :loading="manualStorageLoading"
-                    >手动入库</el-button
+                    @click="manualStorageClick"
                 >
+                    手动入库
+                </el-button>
             </el-tooltip>
         </template>
         <hc-table
@@ -60,11 +62,11 @@
 </template>
 
 <script setup>
-import { onMounted, ref, watch } from "vue";
-import { useAppStore } from "~src/store";
-import { getErtractInfo } from "~api/other";
-import { arrToId, getArrValue, getObjValue, isNullES } from "js-fast-way";
-import mainApi from "~api/tentative/material/testSample";
+import { onMounted, ref, watch } from 'vue'
+import { useAppStore } from '~src/store'
+import { getErtractInfo } from '~api/other'
+import { arrToId, getArrValue, getObjValue, isNullES } from 'js-fast-way'
+import mainApi from '~api/tentative/material/testSample'
 
 //参数
 const props = defineProps({
@@ -72,27 +74,27 @@ const props = defineProps({
         type: Object,
         default: () => ({}),
     },
-});
+})
 
 //变量
-const store = useAppStore();
-const projectId = ref(store.getProjectId);
-const contractId = ref(store.getContractId);
+const store = useAppStore()
+const projectId = ref(store.getProjectId)
+const contractId = ref(store.getContractId)
 
 //渲染完成
 onMounted(() => {
-    getContractData();
-});
+    getContractData()
+})
 
 //监听数据
-const treeInfo = ref(props.tree);
+const treeInfo = ref(props.tree)
 watch(
     () => props.tree,
     (obj) => {
-        treeInfo.value = getObjValue(obj);
-        searchClick();
-    }
-);
+        treeInfo.value = getObjValue(obj)
+        searchClick()
+    },
+)
 
 //搜索表单
 const searchForm = ref({
@@ -103,121 +105,121 @@ const searchForm = ref({
     current: 1,
     size: 20,
     total: 0,
-});
+})
 
 //获取合同段信息
-const contractData = ref([]);
+const contractData = ref([])
 const getContractData = async () => {
     const { data } = await getErtractInfo({
         projectId: projectId.value,
         contractId: contractId.value,
-    });
-    const res = getArrValue(data);
-    contractData.value = res;
-    if (res.length <= 0) return;
-    let cid;
+    })
+    const res = getArrValue(data)
+    contractData.value = res
+    if (res.length <= 0) return
+    let cid
     for (let i = 0; i < res.length; i++) {
         if (contractId.value == res[i].id) {
-            cid = res[i].id;
+            cid = res[i].id
         }
     }
-    searchForm.value.contractId = isNullES(cid) ? res[0].id : cid;
-    searchClick();
-};
+    searchForm.value.contractId = isNullES(cid) ? res[0].id : cid
+    searchClick()
+}
 
 //日期时间被选择
-const betweenTime = ref(null);
+const betweenTime = ref(null)
 const betweenTimeUpdate = ({ arr }) => {
-    betweenTime.value = arr;
+    betweenTime.value = arr
     if (arr.length > 0) {
-        searchForm.value.startTime = arr[0];
-        searchForm.value.endTime = arr[1];
+        searchForm.value.startTime = arr[0]
+        searchForm.value.endTime = arr[1]
     } else {
-        searchForm.value.startTime = null;
-        searchForm.value.endTime = null;
+        searchForm.value.startTime = null
+        searchForm.value.endTime = null
     }
-};
+}
 
 //搜索
 const searchClick = () => {
-    searchForm.value.current = 1;
-    getTableData();
-};
+    searchForm.value.current = 1
+    getTableData()
+}
 
 //分页被点击
 const pageChange = ({ current, size }) => {
-    searchForm.value.current = current;
-    searchForm.value.size = size;
-    getTableData();
-};
+    searchForm.value.current = current
+    searchForm.value.size = size
+    getTableData()
+}
 
 //表格数据
 const tableColumn = ref([
-    { key: "materialName", name: "样品名称" },
-    { key: "specificationModel", name: "规格型号", align: "center" },
-    { key: "materialCount", name: "试样数量", align: "center" },
-    { key: "calculationUnit", name: "试样单位", align: "center" },
-    { key: "proposedPosition", name: "拟用部位" },
-    { key: "representativeCount", name: "代表数量", align: "center" },
-    { key: "representativeUnit", name: "代表单位" },
-    { key: "userName", name: "取样人", align: "center" },
-    { key: "entrustTime", name: "委托单上报时间", align: "center" },
-]);
-const tableData = ref([]);
+    { key: 'materialName', name: '样品名称' },
+    { key: 'specificationModel', name: '规格型号', align: 'center' },
+    { key: 'materialCount', name: '试样数量', align: 'center' },
+    { key: 'calculationUnit', name: '试样单位', align: 'center' },
+    { key: 'proposedPosition', name: '拟用部位' },
+    { key: 'representativeCount', name: '代表数量', align: 'center' },
+    { key: 'representativeUnit', name: '代表单位' },
+    { key: 'userName', name: '取样人', align: 'center' },
+    { key: 'entrustTime', name: '委托单上报时间', align: 'center' },
+])
+const tableData = ref([])
 
 //获取表格数据
-const tableLoading = ref(false);
+const tableLoading = ref(false)
 const getTableData = async () => {
-    const { primaryKeyId } = treeInfo.value;
-    if (isNullES(primaryKeyId)) return;
-    tableLoading.value = true;
+    const { primaryKeyId } = treeInfo.value
+    if (isNullES(primaryKeyId)) return
+    tableLoading.value = true
     const { error, code, data } = await mainApi.queryPage({
         ...searchForm.value,
         projectId: projectId.value,
-        nodeId: primaryKeyId || "",
-    });
+        nodeId: primaryKeyId || '',
+    })
     //处理数据
-    tableLoading.value = false;
+    tableLoading.value = false
     if (!error && code === 200) {
-        tableData.value = getArrValue(data?.records);
-        searchForm.value.total = data.total || 0;
+        tableData.value = getArrValue(data?.records)
+        searchForm.value.total = data.total || 0
     } else {
-        tableData.value = [];
-        searchForm.value.total = 0;
+        tableData.value = []
+        searchForm.value.total = 0
     }
-};
+}
 
 //多选
-const tableCheckedKeys = ref([]);
+const tableCheckedKeys = ref([])
 const tableSelection = (rows) => {
-    tableCheckedKeys.value = rows;
-};
+    tableCheckedKeys.value = rows
+}
 
 //手动入库
-const manualStorageLoading = ref(false);
+const manualStorageLoading = ref(false)
 const manualStorageClick = async () => {
-    const rows = tableCheckedKeys.value;
+    const rows = tableCheckedKeys.value
     //判断是否满足条件
     const result = rows.every(({ rfId }) => {
-        return !isNullES(rfId);
-    });
+        return !isNullES(rfId)
+    })
     if (!result) {
-        window.$message?.warning("存在材料未使用RFID,无法手动入库");
-        return;
+        window.$message?.warning('存在材料未使用RFID,无法手动入库')
+        return
     }
-    const ids = arrToId(rows);
-    manualStorageLoading.value = true;
+    const ids = arrToId(rows)
+    manualStorageLoading.value = true
     const { error, code, msg } = await mainApi.update({
         id: ids,
         sampleStatus: 2,
-    });
-    manualStorageLoading.value = false;
+    })
+    manualStorageLoading.value = false
     if (!error && code === 200) {
-        window.$message.success(msg);
+        window.$message.success(msg)
 
-        getTableData().then();
+        getTableData().then()
     } else {
-        window.$message.error(msg || "操作失败");
+        window.$message.error(msg || '操作失败')
     }
-};
+}
 </script>