From 4b9dfff19ff70db47f99cb93070d0650267c6896 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 06 三月 2025 16:22:19 +0800
Subject: [PATCH] 检验任务-添加查看工时功能

---
 src/api/business/inspectionTask.js                              |   16 ++++
 src/views/business/inspectionTask/components/viewManHourDia.vue |  179 ++++++++++++++++++++++++++++++++++++++++++++
 src/views/business/inspectionTask/index.vue                     |   21 ++++
 3 files changed, 213 insertions(+), 3 deletions(-)

diff --git a/src/api/business/inspectionTask.js b/src/api/business/inspectionTask.js
index 4187ad6..d4b8158 100644
--- a/src/api/business/inspectionTask.js
+++ b/src/api/business/inspectionTask.js
@@ -287,3 +287,19 @@
     params: query,
   });
 }
+// 鏌ヨ宸ユ椂
+export function getWorkingHoursByOrderId(query) {
+  return request({
+    url: "/insOrderPlan/getWorkingHoursByOrderId",
+    method: "get",
+    params: query,
+  });
+}
+// 淇敼宸ユ椂璇︽儏
+export function updateWorkingHours(query) {
+  return request({
+    url: "/insOrderPlan/updateWorkingHours",
+    method: "post",
+    data: query,
+  });
+}
diff --git a/src/views/business/inspectionTask/components/viewManHourDia.vue b/src/views/business/inspectionTask/components/viewManHourDia.vue
new file mode 100644
index 0000000..c5dc4ca
--- /dev/null
+++ b/src/views/business/inspectionTask/components/viewManHourDia.vue
@@ -0,0 +1,179 @@
+<template>
+  <div>
+    <el-dialog
+      :visible.sync="editInspectionDia"
+      title="鏌ョ湅宸ユ椂"
+      width="80%"
+      @close="editInspectionDia = false"
+    >
+      <lims-table :tableData="tableData0" :column="column0"
+                  :page="page0" :tableLoading="tableLoading"
+                  height="560" @pagination="pagination0"></lims-table>
+    </el-dialog>
+    <el-dialog :visible.sync="editAskDia" title="淇敼" width="50%">
+      <el-form ref="form" :model="editForm" label-width="100px">
+        <el-form-item label="妫�娴嬩汉" prop="name">
+          <el-select v-model="editForm.name" clearable size="small">
+            <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="浜ч噺宸ユ椂" prop="outputWorkTime">
+          <el-input v-model="editForm.outputWorkTime" clearable size="small"></el-input>
+        </el-form-item>
+        <el-form-item label="鏃ユ湡" prop="dateTime">
+          <el-date-picker
+            v-model="editForm.dateTime"
+            placeholder="閫夋嫨鏃ユ湡"
+            size="small"
+            style="width: 100%;"
+            type="date"
+            format="yyyy-MM-dd"
+            value-format="yyyy-MM-dd">
+          </el-date-picker>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="editAskDia = false">鍙� 娑�</el-button>
+        <el-button
+          :loading="handleEditLoading"
+          type="primary"
+          @click="handleEdit"
+        >纭� 瀹�</el-button
+        >
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import limsTable from "@/components/Table/lims-table.vue";
+import {
+  getWorkingHoursByOrderId, updateWorkingHours,
+} from "@/api/business/inspectionTask.js";
+import {selectUserCondition} from "@/api/system/user";
+export default {
+  name: "EditInspectionItem",
+  // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
+  components: { limsTable },
+  data() {
+    // 杩欓噷瀛樻斁鏁版嵁
+    return {
+      editInspectionDia: false,
+      entity: {
+        orderId: 0,
+      },
+      tableData0: [],
+      tableLoading: false,
+      column0: [
+        { label: "妫�娴嬩汉", prop: "name" },
+        { label: "妫�娴嬮」鍒嗙被", prop: "inspectionItemClass" },
+        { label: "妫�娴嬮」", prop: "inspectionItem", width: 110 },
+        { label: "妫�娴嬪瓙椤�", prop: "inspectionItemSubclass", width: 110  },
+        { label: "鏍峰搧缂栧彿", prop: "sample", width: 160 },
+        { label: "濮旀墭鍗曞彿", prop: "orderNo", width: 160 },
+        { label: "鐢电紗鏍囪瘑", prop: "cableTag" },
+        { label: "浜ч噺宸ユ椂", prop: "outputWorkTime" },
+        { label: "宸ユ椂鍒嗙粍", prop: "manHourGroup" },
+        { label: "鍗曚环", prop: "price" },
+        { label: "鏃ユ湡", prop: "dateTime" },
+        { label: "鍛ㄦ", prop: "week" },
+        { label: "鏄熸湡", prop: "weekDay" },
+        {
+          dataType: "action",
+          width: "80px",
+          label: "鎿嶄綔",
+          fixed: "right",
+          operation: [
+            {
+              name: "缂栬緫",
+              type: "text",
+              clickFun: (row) => {
+                this.editIns(row);
+              },
+            },
+          ],
+        },
+      ],
+      page0: {
+        total: 0,
+        size: 10,
+        current: 1,
+      },
+      editAskDia: false,
+      editForm: {
+        id: "",
+        name: "",
+        outputWorkTime: "",
+        inspectionValueType: "",
+      },
+      handleEditLoading: false,
+      inspectionValueType: [],
+      responsibleOptions: []
+    };
+  },
+  mounted() {
+
+  },
+  // 鏂规硶闆嗗悎
+  methods: {
+    showDialog(id) {
+      this.editInspectionDia = true;
+      this.entity.orderId = id;
+      this.getList0();
+    },
+    getList0() {
+      this.tableLoading = true;
+      getWorkingHoursByOrderId({ ...this.entity, ...this.page0 })
+        .then((res) => {
+          this.tableLoading = false;
+          if (res.code === 200) {
+            this.tableData0 = res.data.records;
+            this.page0.total = res.data.total;
+          }
+        })
+        .catch((err) => {
+          this.tableLoading = false;
+        });
+    },
+    // 淇敼寮规
+    editIns(row) {
+      this.editAskDia = true;
+      this.editForm = { ...row };
+      this.getUserList()
+    },
+    // 鎻愪氦淇敼
+    handleEdit() {
+      this.handleEditLoading = true;
+      updateWorkingHours({...this.editForm})
+        .then((res) => {
+          this.handleEditLoading = false;
+          this.$message.success("淇敼鎴愬姛");
+          this.editAskDia = false;
+          this.getList0();
+        })
+        .catch(() => {
+          this.handleEditLoading = false;
+        });
+    },
+    pagination0({ page, limit }) {
+      this.page0.current = page;
+      this.page0.size = limit;
+      this.getList0();
+    },
+    // 鑾峰彇璐熻矗浜轰俊鎭帴鍙�
+    getUserList() {
+      selectUserCondition({ type: 1 }).then((res) => {
+        this.responsibleOptions = res.data;
+      })
+    }
+  },
+};
+</script>
+
+<style scoped>
+.pagination {
+  display: flex;
+  justify-content: space-between;
+}
+</style>
diff --git a/src/views/business/inspectionTask/index.vue b/src/views/business/inspectionTask/index.vue
index 01fc535..b514734 100644
--- a/src/views/business/inspectionTask/index.vue
+++ b/src/views/business/inspectionTask/index.vue
@@ -232,7 +232,10 @@
       ref="showInfoDialog"
       :showInfoDialog="showInfoDialog"
     ></ShowInfo> -->
+    <!--淇敼妫�楠屽�煎脊妗�-->
     <edit-inspection-item ref="editInspectionItem"></edit-inspection-item>
+    <!--鏌ョ湅宸ユ椂寮规-->
+    <viewManHourDia ref="viewManHourDia"></viewManHourDia>
   </div>
 </template>
 
@@ -240,6 +243,7 @@
 import { getYearAndMonthAndDays } from "@/utils/date";
 import EditInspectionItem from "./components/EditInspectionItem.vue";
 import limsTable from "@/components/Table/lims-table.vue";
+import viewManHourDia from "./components/viewManHourDia.vue"
 import {
   claimInsOrderPlan,
   upPlanUser2,
@@ -258,6 +262,7 @@
   components: {
     EditInspectionItem,
     limsTable,
+    viewManHourDia
   },
   dicts: ["urgency_level", "inspection_task_state"],
   computed: {
@@ -429,6 +434,16 @@
               },
               disabled: (row) => {
                 return (row.userName == null || row.insState == 3 || row.insState == 5) && this.checkPermi(['update:product:onPlan'])
+              },
+            },
+            {
+              name: "鏌ョ湅宸ユ椂",
+              type: "text",
+              clickFun: (row) => {
+                this.viewManHour(row);
+              },
+              showHide: (row) => {
+                return this.checkPermi(['get:working:hours:byOrder'])
               },
             },
             {
@@ -629,9 +644,9 @@
     editInspection(row) {
       this.$refs.editInspectionItem.showDialog(row.id);
     },
-    // 鍒锋柊椤甸潰
-    refreshView() {
-      this.getList();
+    // 鏌ョ湅宸ユ椂
+    viewManHour(row) {
+      this.$refs.viewManHourDia.showDialog(row.id);
     },
     // 鏁版嵁鏌ョ湅
     handleDataLook(row) {

--
Gitblit v1.9.3