ソースを参照

Merge branch 'master' of http://120.46.159.163:7400/ezhizao/ezhizao_dms_vue

ezhizao_zx 1 年間 前
コミット
f5688813cf
34 ファイル変更3789 行追加2406 行削除
  1. 1 1
      package.json
  2. 78 47
      src/views/business/carrier/form.vue
  3. 97 67
      src/views/business/carrier/formAbandonment.vue
  4. 98 49
      src/views/business/carrier/formCategory.vue
  5. 258 148
      src/views/business/carrier/index.vue
  6. 74 61
      src/views/business/daywork/index.vue
  7. 106 61
      src/views/business/department/form.vue
  8. 81 43
      src/views/business/department/formUser.vue
  9. 270 160
      src/views/business/department/index.vue
  10. 9 22
      src/views/business/deptEquipment/DialogProcessChoice.vue
  11. 183 134
      src/views/business/deptEquipment/form.vue
  12. 387 236
      src/views/business/deptEquipment/index.vue
  13. 6 10
      src/views/business/employee/index.vue
  14. 1 2
      src/views/business/equipment/formCategory.vue
  15. 0 1
      src/views/business/equipment/formDoc.vue
  16. 48 87
      src/views/business/equipment/index.vue
  17. 3 4
      src/views/business/process/form.vue
  18. 3 6
      src/views/business/process/index.vue
  19. 3 32
      src/views/business/product/DialogProcessChoice.vue
  20. 1 1
      src/views/business/product/form.vue
  21. 654 334
      src/views/business/product/index.vue
  22. 50 53
      src/views/business/productionBatch/DialogCheckMaterial.vue
  23. 210 124
      src/views/business/productionBatch/form.vue
  24. 401 240
      src/views/business/productionBatch/index.vue
  25. 173 106
      src/views/business/reject/index.vue
  26. 10 31
      src/views/business/resourcePlan/form.vue
  27. 284 141
      src/views/business/resourcePlan/index.vue
  28. 0 3
      src/views/business/tenant/form.vue
  29. 2 6
      src/views/business/tenant/index.vue
  30. 68 48
      src/views/business/turnover/form.vue
  31. 12 10
      src/views/business/turnover/index.vue
  32. 6 9
      src/views/business/workshop/DialogDept.vue
  33. 0 2
      src/views/business/workshop/form.vue
  34. 212 127
      src/views/business/workshop/index.vue

+ 1 - 1
package.json

@@ -32,7 +32,7 @@
     "nprogress": "0.2.0",
     "pinia": "2.0.22",
     "print-js": "^1.6.0",
-    "qs": "^6.11.0",
+    "qs": "^6.11.2",
     "sortable.js": "^0.3.0",
     "sortablejs": "^1.15.0",
     "vue": "3.2.45",

+ 78 - 47
src/views/business/carrier/form.vue

@@ -1,97 +1,128 @@
 <template>
   <!-- 添加或修改项目信息对话框 -->
-  <el-dialog title="载具信息表单" v-model="visible" width="400px" append-to-body draggable>
+  <el-dialog
+    title="载具信息表单"
+    v-model="visible"
+    width="400px"
+    append-to-body
+    draggable
+  >
     <div class="form-container">
-      <el-form ref="carrierFormRef" class="master-container" :rules="rules" v-loading="loading" :model="form"
-               label-width="80px">
+      <el-form
+        ref="carrierFormRef"
+        class="master-container"
+        :rules="rules"
+        v-loading="loading"
+        :model="form"
+        label-width="80px"
+      >
         <!--        <el-form-item label="载具编号" prop="code" required>-->
         <!--          <el-input v-model.trim="form.code" placeholder="请输入载具编号" />-->
         <!--        </el-form-item>-->
-        <el-form-item label="是否多批" prop="status">
-          <el-select v-model="form.isAllowMore">
-            <el-option v-for="item in is_allow_more" :key="item.value" :label="item.label"
-                       :value="item.value"></el-option>
-          </el-select>
+        <el-form-item label="父级类别" prop="parentId">
+          <el-tree-select
+            v-model="form.categoryId"
+            :data="parentCategories"
+            :render-after-expand="false"
+          />
         </el-form-item>
+        <!--        <el-form-item label="是否多批" prop="status">-->
+        <!--          <el-select v-model="form.isAllowMore">-->
+        <!--            <el-option v-for="item in is_allow_more" :key="item.value" :label="item.label"-->
+        <!--                       :value="item.value"></el-option>-->
+        <!--          </el-select>-->
+        <!--        </el-form-item>-->
         <el-form-item label="备注" prop="remark">
-          <el-input v-model.trim="form.remark" placeholder="请输入备注"/>
+          <el-input v-model.trim="form.remark" placeholder="请输入备注" />
         </el-form-item>
       </el-form>
     </div>
     <template #footer>
-      <el-button type="primary" icon="Check" @click="handleSave">确 定</el-button>
+      <el-button type="primary" icon="Check" @click="handleSave"
+        >确 定</el-button
+      >
       <el-button icon="Close" @click="handleCancel">取 消</el-button>
     </template>
   </el-dialog>
 </template>
 <script setup>
-import {getCarrier, saveCarrier, updateCarrier} from '@/api/business/carrier'
-
-const {proxy} = getCurrentInstance()
-const {is_allow_more} = proxy.useDict('is_allow_more')
-const emit = defineEmits(['handleSaveSuccess'])
-
-const loading = ref(false)
-const visible = ref(false)
-const form = ref({})
+import { getCarrier, getCategory, updateCarrier } from "@/api/business/carrier";
+const { proxy } = getCurrentInstance();
+const emit = defineEmits(["handleSaveSuccess"]);
+/** 字典数组区 */
+const { is_allow_more } = proxy.useDict("is_allow_more");
+/** 表单抽屉 页变量 */
+const parentCategories = ref([]);
+const loading = ref(false);
+const visible = ref(false);
+const form = ref({});
+const categoryFrom = ref({});
 const rules = {
-  code: [{required: true, message: '载具编号不能为空', trigger: 'blur'}]
-}
+  code: [{ required: true, message: "载具编号不能为空", trigger: "blur" }],
+};
 
 /***********************  方法区  ****************************/
 /** 打开对话框 */
 const open = (data) => {
-  reset()
-  visible.value = true
-  loading.value = true
-  form.value.categoryId = data.categoryId
+  reset();
+  visible.value = true;
+  loading.value = true;
+  form.value.categoryId = data.categoryId;
   getCarrier(data.id || 0).then((res) => {
     if (res.data) {
       form.value = res.data;
-      form.value.isAllowMore = form.value.isAllowMore + '';
+      form.value.isAllowMore = form.value.isAllowMore + "";
     }
-    loading.value = false
-  })
-}
+    loading.value = false;
+  });
+};
 
 /** 表单重置 */
 const reset = () => {
   form.value = {
     id: null,
     categoryId: 0,
-    code: '',
-    remark: ''
+    code: "",
+    remark: "",
+  };
+  proxy.resetForm("carrierFormRef");
+};
+
+getCategory(0).then((res) => {
+  if (res.data.formData) {
+    categoryFrom.value = res.data.formData;
   }
-  proxy.resetForm('carrierFormRef')
-}
+  parentCategories.value = res.data.parentOptions;
+  loading.value = false;
+});
 
 /** 提交按钮 */
 const handleSave = () => {
-  proxy.$refs['carrierFormRef'].validate((valid) => {
+  proxy.$refs["carrierFormRef"].validate((valid) => {
     if (valid) {
       updateCarrier(form.value).then((res) => {
         if (res.code === 601) {
-          proxy.$modal.msgWarn(res.msg)
-          return
+          proxy.$modal.msgWarn(res.msg);
+          return;
         }
         if (res.code === 200) {
-          proxy.$modal.msgSuccess('操作成功')
-          emit('handleSaveSuccess')
+          proxy.$modal.msgSuccess("操作成功");
+          emit("handleSaveSuccess");
         }
-        visible.value = false
-      })
+        visible.value = false;
+      });
     }
-  })
-}
+  });
+};
 
 /** 取消按钮 */
 const handleCancel = () => {
-  visible.value = false
-  reset()
-}
+  visible.value = false;
+  reset();
+};
 
 /** 暴露给父组件的方法 */
 defineExpose({
-  open
-})
+  open,
+});
 </script>

+ 97 - 67
src/views/business/carrier/formAbandonment.vue

@@ -1,108 +1,138 @@
 <template>
   <!-- 添加或修改项目信息对话框 -->
-  <el-dialog title="载具信息表单" v-model="visible" width="400px" append-to-body draggable>
+  <el-dialog
+    title="载具信息表单"
+    v-model="visible"
+    width="400px"
+    append-to-body
+    draggable
+  >
     <div class="form-container">
-      <el-form ref="carrierFormRef" class="master-container" v-loading="loading" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="载具编号" prop="code" >{{ form.code }}</el-form-item>
-        <el-form-item label="废弃日期" prop="abandonmentDate" >
-          <el-date-picker type="date" v-model="form.abandonmentDate" placeholder="请选择废弃日期" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
+      <el-form
+        ref="carrierFormRef"
+        class="master-container"
+        v-loading="loading"
+        :model="form"
+        :rules="rules"
+        label-width="80px"
+      >
+        <el-form-item label="载具编号" prop="code">{{
+          form.code
+        }}</el-form-item>
+        <el-form-item label="废弃日期" prop="abandonmentDate">
+          <el-date-picker
+            type="date"
+            v-model="form.abandonmentDate"
+            placeholder="请选择废弃日期"
+            format="YYYY-MM-DD"
+            value-format="YYYY-MM-DD"
+          />
         </el-form-item>
-        <el-form-item label="废弃原因" prop="abandonmentReason" >
+        <el-form-item label="废弃原因" prop="abandonmentReason">
           <el-select
-                v-model="form.abandonmentReason"
-                placeholder="请选择废弃原因"
-                clearable
-              >
-                <el-option
-                  v-for="dict in reason_for_abandonment"
-                  :key="dict.value"
-                  :label="dict.label"
-                  :value="dict.label"
-                ></el-option>
-                </el-select>
+            v-model="form.abandonmentReason"
+            placeholder="请选择废弃原因"
+            clearable
+          >
+            <el-option
+              v-for="dict in reason_for_abandonment"
+              :key="dict.value"
+              :label="dict.label"
+              :value="dict.label"
+            ></el-option>
+          </el-select>
         </el-form-item>
       </el-form>
     </div>
     <template #footer>
-      <el-button type="primary" icon="Check" @click="handleSave">确 定</el-button>
+      <el-button type="primary" icon="Check" @click="handleSave"
+        >确 定</el-button
+      >
       <el-button icon="Close" @click="handleCancel">取 消</el-button>
     </template>
   </el-dialog>
 </template>
 <script setup>
-import { getCarrier, saveCarrier,saveCarrierReject } from '@/api/business/carrier'
-import { ref } from 'vue'
-const { proxy } = getCurrentInstance()
-const emit = defineEmits(['handleSaveSuccess'])
-
-const { reason_for_abandonment } = proxy.useDict('reason_for_abandonment')
-
-const loading = ref(false)
-const visible = ref(false)
-const form = ref({})
+import { getCarrier, saveCarrierReject } from "@/api/business/carrier";
+import { ref } from "vue";
+const { proxy } = getCurrentInstance();
+const emit = defineEmits(["handleSaveSuccess"]);
+/** 字典数组区 */
+const { reason_for_abandonment } = proxy.useDict("reason_for_abandonment");
+/** 表单抽屉 页变量 */
+const loading = ref(false);
+const visible = ref(false);
+const form = ref({});
 const rules = {
-  abandonmentDate: [{ required: true, message: '废弃日期不能为空', trigger: 'blur' }],
-  abandonmentReason: [{ required: true, message: '废弃原因不能为空', trigger: 'change' }]
-}
+  abandonmentDate: [
+    { required: true, message: "废弃日期不能为空", trigger: "blur" },
+  ],
+  abandonmentReason: [
+    { required: true, message: "废弃原因不能为空", trigger: "change" },
+  ],
+};
 
 /***********************  方法区  ****************************/
 /** 打开抽屉 */
 const open = (data) => {
-  reset()
-  visible.value = true
-  loading.value = true
-  form.value.categoryId = data.categoryId
+  reset();
+  visible.value = true;
+  loading.value = true;
+  form.value.categoryId = data.categoryId;
   getCarrier(data.id || 0).then((res) => {
     if (res.data) {
-      form.value = res.data
-      form.value.abandonmentDate = form.value.isAbandoned === 1 ? res.data.abandonmentDate : proxy.moment().format('YYYY-MM-DD')
-      form.value.isAbandoned = '1'
+      form.value = res.data;
+      form.value.abandonmentDate =
+        form.value.isAbandoned === 1
+          ? res.data.abandonmentDate
+          : proxy.moment().format("YYYY-MM-DD");
+      form.value.isAbandoned = "1";
     }
-    loading.value = false
-  })
-}
+    loading.value = false;
+  });
+};
 
 /** 表单重置 */
 const reset = () => {
   form.value = {
     id: null,
     categoryId: 0,
-    isAbandoned: '1',
-    code: '',
-    abandonmentDate: proxy.moment().format('YYYY-MM-DD'),
-    abandonmentReason: ''
-  }
-  proxy.resetForm('carrierFormRef')
-}
+    isAbandoned: "1",
+    code: "",
+    abandonmentDate: proxy.moment().format("YYYY-MM-DD"),
+    abandonmentReason: "",
+  };
+  proxy.resetForm("carrierFormRef");
+};
 
 /** 提交按钮 */
 const handleSave = () => {
-  proxy.$refs['carrierFormRef'].validate((valid) => {
+  proxy.$refs["carrierFormRef"].validate((valid) => {
     if (valid) {
-      var carrierReject = {}
-      carrierReject.carrierId = form.value.id
-      carrierReject.operationDate = form.value.abandonmentDate
-      carrierReject.abandonmentReason = form.value.abandonmentReason
-      carrierReject.isAbandoned = form.value.isAbandoned
+      var carrierReject = {};
+      carrierReject.carrierId = form.value.id;
+      carrierReject.operationDate = form.value.abandonmentDate;
+      carrierReject.abandonmentReason = form.value.abandonmentReason;
+      carrierReject.isAbandoned = form.value.isAbandoned;
       saveCarrierReject(carrierReject).then((res) => {
-    if (res.code === 200) {
-      proxy.$modal.msgSuccess('操作成功')
-      emit('handleSaveSuccess')
+        if (res.code === 200) {
+          proxy.$modal.msgSuccess("操作成功");
+          emit("handleSaveSuccess");
+        }
+        visible.value = false;
+      });
     }
-    visible.value = false
-  })
-}
-  })
-}
+  });
+};
 
 /** 取消按钮 */
 const handleCancel = () => {
-  visible.value = false
-  reset()
-}
+  visible.value = false;
+  reset();
+};
 
 /** 暴露给父组件的方法 */
 defineExpose({
-  open
-})
+  open,
+});
 </script>

+ 98 - 49
src/views/business/carrier/formCategory.vue

@@ -1,103 +1,152 @@
 <template>
-  <el-dialog title="载具类别表单" v-model="visible" width="400px" append-to-body draggable>
+  <el-dialog
+    title="载具类别表单"
+    v-model="visible"
+    width="400px"
+    append-to-body
+    draggable
+  >
     <div class="form-container">
-      <el-form ref="carrierCategoryRef" v-loading="loading" class="master-container" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="父级类别" prop="parentId">
-          <el-tree-select v-model="form.parentId" :data="parentCategories" check-strictly :render-after-expand="false" />
+      <el-form
+        ref="carrierCategoryRef"
+        v-loading="loading"
+        class="master-container"
+        :model="form"
+        :rules="rules"
+        label-width="80px"
+      >
+        <el-form-item label="父级类别" prop="parentId" :rules="rules">
+          <el-tree-select
+            v-model="form.parentId"
+            :data="parentCategories"
+            check-strictly
+            :render-after-expand="false"
+          />
         </el-form-item>
         <el-form-item label="类别名称" prop="name">
           <el-input v-model.trim="form.name" placeholder="类别名称" />
         </el-form-item>
+        <el-form-item
+          label="是否多批"
+          prop="status"
+          v-if="form.parentId !== '0'"
+        >
+          <el-select v-model="form.isAllowMore">
+            <el-option
+              v-for="item in is_allow_more"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item label="备注" prop="remark">
           <el-input v-model.trim="form.remark" placeholder="请填写备注" />
         </el-form-item>
       </el-form>
     </div>
     <template #footer>
-      <el-button type="primary" icon="Check" @click="handleSave">确 定</el-button>
+      <el-button type="primary" icon="Check" @click="handleSave"
+        >确 定</el-button
+      >
       <el-button icon="Close" @click="handleCancel">取 消</el-button>
     </template>
   </el-dialog>
 </template>
 <script setup>
-import { getCategory, saveCategory } from '@/api/business/carrier'
-const { proxy } = getCurrentInstance()
-const emit = defineEmits(['handleSaveSuccess'])
-
+import { getCategory, saveCategory } from "@/api/business/carrier";
+const { proxy } = getCurrentInstance();
+const emit = defineEmits(["handleSaveSuccess"]);
+/** 字典数组区 */
+const { is_allow_more } = proxy.useDict("is_allow_more");
 /** 父类别 */
-const parentCategories = ref([])
-
-const loading = ref(false)
-const visible = ref(false)
+const parentCategories = ref([]);
+const loading = ref(false);
+const visible = ref(false);
 const data = reactive({
   form: {},
   rules: {
-    name: [{ required: true, message: '类别名称不能为空', trigger: 'blur' }]
-  }
-})
-const { form, rules } = toRefs(data)
+    name: [{ required: true, message: "类别名称不能为空", trigger: "blur" }],
+    parentId: [
+      { required: true, trigger: "blur", validator: validateParentId },
+    ],
+  },
+});
+const { form, rules } = toRefs(data);
+
 /***********************  方法区  ****************************/
 /** 打开抽屉 */
 function open(id) {
-  reset()
-  visible.value = true
-  loading.value = true
+  reset();
+  visible.value = true;
+  loading.value = true;
   getCategory(id || 0).then((res) => {
     if (res.data.formData) {
-      form.value = res.data.formData
+      form.value = res.data.formData;
+      form.value.isAllowMore = form.value.isAllowMore + "";
     }
-    console.log(res.data.parentOptions)
-    parentCategories.value = res.data.parentOptions
+    parentCategories.value = res.data.parentOptions;
     parentCategories.value.unshift({
-      value: '0',
-      label: '一级分类'
-    })
-    if(id) {
-      var index = parentCategories.value.findIndex(obj => obj.value === id);
-      if(index > -1) {
-      parentCategories.value.splice(index,1)
+      value: "0",
+      label: "一级分类",
+    });
+    if (id) {
+      var index = parentCategories.value.findIndex((obj) => obj.value === id);
+      if (index > -1) {
+        parentCategories.value.splice(index, 1);
       }
     }
-    loading.value = false
-  })
+    loading.value = false;
+  });
 }
 
 /** 取消按钮 */
 function handleCancel() {
-  visible.value = false
-  reset()
+  visible.value = false;
+  reset();
 }
 
 /** 表单重置 */
 function reset() {
   form.value = {
     id: null,
-    parentId: '0',
-    code: '',
-    name: '',
-    remark: '',
-    sort: 1
-  }
-  proxy.resetForm('carrierCategoryRef')
+    parentId: "0",
+    code: "",
+    name: "",
+    remark: "",
+    sort: 1,
+  };
+  proxy.resetForm("carrierCategoryRef");
 }
 
 /** 提交按钮 */
 function handleSave() {
-  proxy.$refs['carrierCategoryRef'].validate((valid) => {
+  proxy.$refs["carrierCategoryRef"].validate((valid) => {
     if (valid) {
       saveCategory(form.value).then((res) => {
         if (res.code === 200) {
-          proxy.$modal.msgSuccess('操作成功')
-          emit('handleSaveSuccess')
+          proxy.$modal.msgSuccess("操作成功");
+          emit("handleSaveSuccess");
         }
-        visible.value = false
-      })
+        visible.value = false;
+      });
     }
-  })
+  });
+}
+
+/**
+ * 校验自己不能是自己的父级
+ */
+function validateParentId(rule, value, callback) {
+  if (value == form.value.id) {
+    callback(new Error("不能选择自己为父级"));
+  } else {
+    callback();
+  }
 }
 
 /** 暴露给父组件的方法 */
 defineExpose({
-  open
-})
+  open,
+});
 </script>

+ 258 - 148
src/views/business/carrier/index.vue

@@ -3,45 +3,70 @@
     <!-- 左侧区域 -->
     <section class="list-part-container">
       <!-- 搜索区域 -->
-      <el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true">
+      <el-form
+        class="list-search-container"
+        :model="queryParams"
+        ref="queryRef"
+        :inline="true"
+      >
         <el-form-item class="section-title" label="载具类别" />
         <el-form-item>
           <!-- <el-button type="success" icon="Refresh" @click="handleQueryCategory">刷新</el-button> -->
-          <el-button type="primary" icon="Plus" @click="handleShowCategoryDialog(null)" v-hasPermi="['business:carrier:add']">新增</el-button>
+          <el-button
+            type="primary"
+            icon="Plus"
+            @click="handleShowCategoryDialog(null)"
+            v-hasPermi="['business:carrier:add']"
+            >新增
+          </el-button>
         </el-form-item>
       </el-form>
       <!-- 列表区 -->
       <div class="el-table-container">
         <div class="el-table-inner-container">
-          <!-- <el-table ref="categoryTable" v-loading="categoryLoading" :data="carrierCategoryList" row-key="id" height="100%" :indent="20" highlight-current-row default-expand-all @current-change="handleCurrentCategoryChange">
-            <el-table-column type="index" label="序号" width="50" align="center" />
-            <el-table-column label="类别名称" header-align="center" prop="name" />
-            <el-table-column label="操作" width="140" align="center">
-              <template #default="scope">
-                <el-button link type="warning" icon="Edit" @click="handleShowCategoryDialog(scope.row.id)" v-hasPermi="['business:carrier:edit']">
-                  编辑
-                </el-button>
-                <el-button link type="danger" icon="Delete" @click="handleDeleteCategory(scope.row.id)" v-hasPermi="['business:carrier:remove']">
-                  删除
-                </el-button>
-              </template>
-            </el-table-column>
-          </el-table> -->
-          <el-tree ref="categoryTable" v-loading="categoryLoading" :data="carrierCategoryList" :props="{ label: 'name', children: 'children' }" :expand-on-click-node="false" :filter-node-method="filterNode" default-expand-all node-key="id" highlight-current @node-click="handleCurrentCategoryChange">
+          <el-tree
+            ref="categoryTable"
+            v-loading="categoryLoading"
+            :data="carrierCategoryList"
+            :props="{ label: 'name', children: 'children' }"
+            :expand-on-click-node="false"
+            default-expand-all
+            node-key="id"
+            highlight-current
+            @node-click="handleCurrentCategoryChange"
+          >
             <template #default="{ node, data }">
-              <div style="
+              <div
+                style="
                   display: flex;
                   width: 100%;
                   justify-content: space-between;
-                ">
+                "
+              >
                 <span>
-                  <span v-if="data.parentId == 0" style="display: inline-block; width: 20px;">{{ getNodeIndex(data) }}. </span>
+                  <span
+                    v-if="data.parentId == 0"
+                    style="display: inline-block; width: 20px"
+                    >{{ getNodeIndex(data) }}.
+                  </span>
                   <span>{{ node.label }}</span>
                 </span>
                 <span>
-                  <el-button link type="warning" icon="Edit" @click="handleShowCategoryDialog(data)" v-hasPermi="['business:carrier:edit']">编辑
+                  <el-button
+                    link
+                    type="warning"
+                    icon="Edit"
+                    @click="handleShowCategoryDialog(data)"
+                    v-hasPermi="['business:carrier:edit']"
+                    >编辑
                   </el-button>
-                  <el-button link type="danger" icon="Delete" @click="handleDeleteCategory(data)" v-hasPermi="['business:carrier:remove']">删除
+                  <el-button
+                    link
+                    type="danger"
+                    icon="Delete"
+                    @click="handleDeleteCategory(data)"
+                    v-hasPermi="['business:carrier:remove']"
+                    >删除
                   </el-button>
                 </span>
               </div>
@@ -53,14 +78,32 @@
 
     <!-- 右侧区域 -->
     <section class="list-part-container" style="flex: 2">
-      <el-form class="list-search-container" :model="carrierParams" ref="queryRef" :inline="true">
+      <el-form
+        class="list-search-container"
+        :model="carrierParams"
+        ref="queryRef"
+        :inline="true"
+      >
         <el-form-item class="section-title" label="载具管理" />
         <el-form-item label="载具编号:">
-          <el-input placeholder="请输入载具编号" :disabled="!carrierFlag" clearable style="width: 180px" v-model.trim="carrierParams.code" @keydown.enter.prevent />
+          <el-input
+            placeholder="请输入载具编号"
+            :disabled="!carrierFlag"
+            clearable
+            style="width: 180px"
+            v-model.trim="carrierParams.code"
+            @keydown.enter.prevent
+          />
         </el-form-item>
         <el-form-item>
-          <el-button type="info" icon="Search" :disabled="carrierCategoryList.length == 0" @click="handleQueryCarrier">搜索</el-button>
-          <!-- <el-button type="success" icon="Refresh" @click="handleRefreshCarrier">刷新</el-button> -->
+          <el-button
+            type="info"
+            icon="Search"
+            :disabled="carrierCategoryList.length == 0"
+            @click="handleQueryCarrier"
+          >
+            搜索
+          </el-button>
           <!-- <el-button type="primary" icon="Plus" @click="handleShowCarrierDialog(null)" v-hasPermi="['business:carrier:add']">新增</el-button> -->
           <el-button :disabled="selections.length == 0" type="warning" icon="Download" @click="handleBatchDownloadQrCode">批量下载二维码</el-button>
           <el-button :disabled="selections.length == 0" type="warning" icon="Printer" @click="handleBatchPrintQrCode">打印</el-button>
@@ -71,23 +114,57 @@
       <!-- 列表区 -->
       <div class="el-table-container">
         <div class="el-table-inner-container">
-          <el-table v-loading="carrierLoading" row-key="id" @selection-change="handleSelectionChange" :data="carrierList" height="100%">
-            <el-table-column type="selection" width="40" align="center" :reserve-selection="true" />
-            <el-table-column type="index" label="行号" width="50" align="center" />
-            <el-table-column prop="code" label="载具编号" width="80" align="center" />
-            <el-table-column label="状态" width="80" prop="isAbandoned" align="center">
+          <el-table
+            v-loading="carrierLoading"
+            row-key="id"
+            @selection-change="handleSelectionChange"
+            :data="carrierList"
+            height="100%"
+          >
+            <el-table-column
+              type="selection"
+              width="40"
+              align="center"
+              :reserve-selection="true"
+            />
+            <el-table-column
+              type="index"
+              label="行号"
+              width="50"
+              align="center"
+            />
+            <el-table-column
+              prop="code"
+              label="载具编号"
+              width="80"
+              align="center"
+            />
+            <el-table-column
+              label="状态"
+              width="80"
+              prop="isAbandoned"
+              align="center"
+            >
               <template #default="scope">
                 {{ scope.row.status }}
-                <dict-tag :options="carrier_status"  :value="scope.row.isAbandoned" />
+                <dict-tag
+                  :options="carrier_status"
+                  :value="scope.row.isAbandoned"
+                />
               </template>
             </el-table-column>
-            <el-table-column label="是否多批" width="80" prop="isAllowMore" align="center">
-              <template #default="scope">
-                {{ scope.row.status }}
-                <dict-tag :options="is_allow_more" :value="scope.row.isAllowMore" />
-              </template>
-            </el-table-column>
-            <el-table-column prop="createTime" label="添加日期" width="130" align="center">
+            <!--            <el-table-column label="是否多批" width="80" prop="isAllowMore" align="center">-->
+            <!--              <template #default="scope">-->
+            <!--                {{ scope.row.status }}-->
+            <!--                <dict-tag :options="is_allow_more" :value="scope.row.isAllowMore" />-->
+            <!--              </template>-->
+            <!--            </el-table-column>-->
+            <el-table-column
+              prop="createTime"
+              label="添加日期"
+              width="130"
+              align="center"
+            >
               <template #default="scope">
                 {{ proxy.moment(scope.row.createTime).format("YYYY-MM-DD") }}
               </template>
@@ -109,11 +186,34 @@
             </el-table-column> -->
             <el-table-column label="操作" width="180" align="center">
               <template #default="scope">
-                <el-button link type="warning" icon="Edit" @click="handleShowCarrierDialog(scope.row.id)" v-hasPermi="['business:carrier:edit']">
+                <el-button
+                  link
+                  type="warning"
+                  icon="Edit"
+                  @click="handleShowCarrierDialog(scope.row.id)"
+                  v-hasPermi="['business:carrier:edit']"
+                >
                   编辑
                 </el-button>
-                <el-button v-if="scope.row.isAbandoned === 0" link type="danger" icon="Delete" @click="handleShowAbandonDialog(scope.row.id)" v-hasPermi="['business:carrier:abandonment']">废弃</el-button>
-                <el-button v-else link type="success" icon="CircleCheck" @click="handleUnAbandoned(scope.row)" v-hasPermi="['business:carrier:unAbandonment']">取消废弃</el-button>
+                <el-button
+                  v-if="scope.row.isAbandoned === 0"
+                  link
+                  type="danger"
+                  icon="Delete"
+                  @click="handleShowAbandonDialog(scope.row.id)"
+                  v-hasPermi="['business:carrier:abandonment']"
+                >
+                  废弃
+                </el-button>
+                <el-button
+                  v-else
+                  link
+                  type="success"
+                  icon="CircleCheck"
+                  @click="handleUnAbandoned(scope.row)"
+                  v-hasPermi="['business:carrier:unAbandonment']"
+                  >取消废弃
+                </el-button>
               </template>
             </el-table-column>
           </el-table>
@@ -121,11 +221,20 @@
       </div>
 
       <!-- 分页 -->
-      <pagination v-show="carrierTotal > 0" :total="carrierTotal" v-model:page="carrierParams.pageNum" v-model:limit="carrierParams.pageSize" @pagination="getCarriers" />
+      <pagination
+        v-show="carrierTotal > 0"
+        :total="carrierTotal"
+        v-model:page="carrierParams.pageNum"
+        v-model:limit="carrierParams.pageSize"
+        @pagination="getCarriers"
+      />
     </section>
 
     <!-- 载具类别表单 -->
-    <carrier-category-form ref="carrierCategoryRef" @handleSaveSuccess="handleQueryCategory" />
+    <carrier-category-form
+      ref="carrierCategoryRef"
+      @handleSaveSuccess="handleQueryCategory"
+    />
 
     <!-- 载具表单 -->
     <carrier-form ref="carrierRef" @handleSaveSuccess="handleRefreshCarrier" />
@@ -164,187 +273,185 @@ const selections = ref([])
 const data = reactive({
   form: {},
   queryParams: {
-    code: '',
+    code: "",
     pageNum: 1,
-    pageSize: 10
+    pageSize: 10,
   },
   carrierParams: {
-    code: '',
+    code: "",
     pageNum: 1,
-    pageSize: 10
-  }
-})
+    pageSize: 10,
+  },
+});
 
-const { queryParams, carrierParams } = toRefs(data)
-/** 查询对象 */
+const { queryParams, carrierParams } = toRefs(data);
 
 /****************************  载具类别相关事件  ****************************/
 /** 载具分类列表 */
 const getCategories = () => {
-  categoryLoading.value = true
+  categoryLoading.value = true;
   listCategory().then((res) => {
-    categoryLoading.value = false
-    carrierCategoryList.value = res.rows
+    categoryLoading.value = false;
+    carrierCategoryList.value = res.rows;
     if (carrierCategoryList.value.length > 0) {
-      currentCategory.value = carrierCategoryList.value[0]
+      currentCategory.value = carrierCategoryList.value[0];
       nextTick(() => {
-        proxy.$refs.categoryTable.setCurrentKey(currentCategory.value.id)
-        handleCurrentCategoryChange(currentCategory.value)
-      })
-      // categoryTable.value.setCurrentRow(currentCategory.value);
+        proxy.$refs.categoryTable.setCurrentKey(currentCategory.value.id);
+        handleCurrentCategoryChange(currentCategory.value);
+      });
     }
-  })
-}
-const filterNode = (value, data) => {
-  queryParams.value.code = ''
-  if (!value) {
-    return true
-  }
-  return data.name.indexOf(value) !== -1
-}
+  });
+};
+/**载具类别点击事件 */
 const handleCurrentCategoryChange = (row) => {
   if (row) {
-    currentCategory.value = row
+    currentCategory.value = row;
   } else {
-    currentCategory.value = {}
+    currentCategory.value = {};
     if (carrierCategoryList.value.length > 0) {
-      currentCategory.value = carrierCategoryList.value[0]
+      currentCategory.value = carrierCategoryList.value[0];
     }
   }
   if (currentCategory.value.id) {
-    //categoryTable.value.setCurrentRow(currentCategory.value);
-    getCarriers()
+    getCarriers();
   } else {
-    carrierList.value = []
-    carrierTotal.value = 0
+    carrierList.value = [];
+    carrierTotal.value = 0;
   }
-}
+};
+/**载具类别编号 */
 function getNodeIndex(data) {
-  const index = carrierCategoryList.value.findIndex((item) => item.id === data.id)
-  return index + 1
+  const index = carrierCategoryList.value.findIndex(
+    (item) => item.id === data.id
+  );
+  return index + 1;
 }
+/**打开载具类别弹窗 */
 function handleShowCategoryDialog(data) {
   if (data) {
-    proxy.$refs.carrierCategoryRef.open(data.id)
+    proxy.$refs.carrierCategoryRef.open(data.id);
   } else {
-    proxy.$refs.carrierCategoryRef.open()
+    proxy.$refs.carrierCategoryRef.open();
   }
 }
 
 /** 删除按钮操作 */
 const handleDeleteCategory = (data) => {
-   // 禁用按钮点击
-   disableButtons();
-   var showErrorMessage = false
+  // 禁用按钮点击
+  disableButtons();
+  var showErrorMessage = false;
   proxy.$modal
-    .confirm('确定删除选中项?')
+    .confirm("确定删除选中项?")
     .then(() => {
-      categoryLoading.value = true
-      carrierLoading.value = true
+      categoryLoading.value = true;
+      carrierLoading.value = true;
       if (data.children) {
-         showErrorMessage = true;
-         return Promise.reject(new Error("HasChildrenError"));
+        showErrorMessage = true;
+        return Promise.reject(new Error("HasChildrenError"));
       }
-      return delCategory(data.id)
+      return delCategory(data.id);
     })
     .then(() => {
       if (!showErrorMessage) {
-        proxy.$modal.msgSuccess('操作成功!');
+        proxy.$modal.msgSuccess("操作成功!");
         getCategories();
       }
     })
     .catch(() => {
-      categoryLoading.value = false
-      carrierLoading.value = false
+      categoryLoading.value = false;
+      carrierLoading.value = false;
     })
     .finally(() => {
       if (showErrorMessage) {
         proxy.$modal.msgError("该载具类别下有子类别,不能删除");
       }
-      categoryLoading.value = false
-      carrierLoading.value = false
+      categoryLoading.value = false;
+      carrierLoading.value = false;
       // 启用按钮点击
       enableButtons();
-    })
-}
+    });
+};
+/**禁用按钮 */
 function disableButtons() {
   //禁用按钮同时,禁用载具编号的输入框
-  carrierFlag.value = false
+  carrierFlag.value = false;
   // 禁用页面上所有按钮的点击事件
-  const buttons = document.querySelectorAll('button');
-  buttons.forEach(button => {
+  const buttons = document.querySelectorAll("button");
+  buttons.forEach((button) => {
     button.disabled = true;
   });
 }
-
+/**取消禁用按钮 */
 function enableButtons() {
-  carrierFlag.value = true
+  carrierFlag.value = true;
   // 启用页面上所有按钮的点击事件
-  const buttons = document.querySelectorAll('button');
-  buttons.forEach(button => {
+  const buttons = document.querySelectorAll("button");
+  buttons.forEach((button) => {
     button.disabled = false;
   });
 }
-
+/**载具类别查询 */
 const handleQueryCategory = () => {
-  getCategories()
-}
+  getCategories();
+};
 /****************************  载具相关事件  ****************************/
-
+/**获取载具数据 */
 const getCarriers = () => {
   disableButtons();
-   categoryLoading.value = true
-  carrierLoading.value = true
-  carrierParams.value.categoryId = currentCategory.value.id
+  categoryLoading.value = true;
+  carrierLoading.value = true;
+  carrierParams.value.categoryId = currentCategory.value.id;
   listCarrier(carrierParams.value).then((res) => {
     enableButtons();
-    categoryLoading.value = false
-    carrierLoading.value = false
-    carrierList.value = res.rows
-    carrierTotal.value = res.total
-  })
-}
+    categoryLoading.value = false;
+    carrierLoading.value = false;
+    carrierList.value = res.rows;
+    carrierTotal.value = res.total;
+  });
+};
+
 /**
  * 列表checkbox列选择 事件
  */
 function handleSelectionChange(selection) {
-  selections.value = selection
-  console.log(selections.value)
+  selections.value = selection;
+  console.log(selections.value);
 }
+/**刷新载具 */
 const handleRefreshCarrier = () => {
-  getCarriers()
-}
-
+  getCarriers();
+};
+/**载具查询 */
 const handleQueryCarrier = () => {
-  carrierParams.value.pageNum = 1
-  handleRefreshCarrier()
-}
+  carrierParams.value.pageNum = 1;
+  handleRefreshCarrier();
+};
 
 /** 修改按钮操作 */
 const handleShowCarrierDialog = (id) => {
-  proxy.$refs.carrierRef.open({ categoryId: currentCategory.value.id, id: id })
-}
-
+  proxy.$refs.carrierRef.open({ categoryId: currentCategory.value.id, id: id });
+};
+/**打开废弃弹窗 */
 const handleShowAbandonDialog = (id) => {
-  proxy.$refs.carrierAbandonmentRef.open({ id: id })
-}
-
+  proxy.$refs.carrierAbandonmentRef.open({ id: id });
+};
+/** 取消废弃*/
 const handleUnAbandoned = (row) => {
   proxy.$modal
-    .confirm('确定取消废弃选中项?')
+    .confirm("确定取消废弃选中项?")
     .then(() => {
-      var carrierReject = {}
-      carrierReject.carrierId = row.id
-      carrierReject.isAbandoned = 0
-      carrierReject.operaionDate = proxy.moment().format('YYYY-MM-DD')
-      return saveCarrierReject(carrierReject)
+      var carrierReject = {};
+      carrierReject.carrierId = row.id;
+      carrierReject.isAbandoned = 0;
+      carrierReject.operaionDate = proxy.moment().format("YYYY-MM-DD");
+      return saveCarrierReject(carrierReject);
     })
     .then(() => {
-      proxy.$modal.msgSuccess('操作成功!')
-      handleRefreshCarrier()
+      proxy.$modal.msgSuccess("操作成功!");
+      handleRefreshCarrier();
     })
-    .catch(() => {})
-}
+    .catch(() => {});
+};
 
 const handleBatchPrintQrCode = async () => {
   const imageGroup = document.getElementById('image-group');
@@ -388,11 +495,12 @@ const handleBatchPrintPdf = () => {
 //   //   }
 //   // })
 // }
+/**批量下载二维码 */
 async function handleBatchDownloadQrCode() {
   console.log(selections.value);
-  
+
   const zip = new JSZip();
-  const zipFilename = '二维码.zip';
+  const zipFilename = "二维码.zip";
 
   for (var i = 0; i < selections.value.length; i++) {
     console.log(webHost + selections.value[i].qcCode);
@@ -402,18 +510,19 @@ async function handleBatchDownloadQrCode() {
     const qrCodeBlob = await qrCodeResponse.blob();
 
     // 将二维码图片添加到 ZIP 文件中
-    zip.file(selections.value[i].code + '.png', qrCodeBlob);
+    zip.file(selections.value[i].code + ".png", qrCodeBlob);
   }
-  
+
   // 生成 ZIP 文件并提供下载
-  zip.generateAsync({ type: 'blob' }).then((content) => {
+  zip.generateAsync({ type: "blob" }).then((content) => {
     // 使用 FileSaver.js 将 ZIP 文件保存到本地
     saveAs(content, zipFilename);
   });
 }
+
 onMounted(() => {
-  getCategories()
-})
+  getCategories();
+});
 </script>
 <style scoped>
 :deep(.el-tree-node__label) {
@@ -421,6 +530,7 @@ onMounted(() => {
   display: inline-block;
   width: 100%;
 }
+
 :deep(.el-tree-node__content) {
   height: 40px;
   border-bottom: 1px solid #ebeef5;

+ 74 - 61
src/views/business/daywork/index.vue

@@ -20,9 +20,6 @@
             style="width: 200px"
           />
         </el-form-item>
-        <!-- <el-form-item label="批次号:">
-          <el-input placeholder="请输入批次号" v-model.trim="queryDayworkParams.lotCode" @keyup.enter="handleQuery" @keydown.enter.prevent clearable style="width: 120px" />
-        </el-form-item> -->
         <el-form-item label="产品描述:">
           <el-input
             placeholder="请输入产品描述"
@@ -42,7 +39,11 @@
           />
         </el-form-item>
         <el-form-item style="margin-left: 0">
-          <el-button type="info" icon="Search" :disabled="deptList.length === 0" @click="handleQuery"
+          <el-button
+            type="info"
+            icon="Search"
+            :disabled="deptList.length === 0"
+            @click="handleQuery"
             >搜索
           </el-button>
         </el-form-item>
@@ -92,12 +93,6 @@
               width="60"
               align="center"
             />
-            <!-- <el-table-column
-              label="炉号"
-              prop="furnaceNumber"
-              width="60"
-              align="center"
-            /> -->
             <el-table-column
               label="下达日期"
               prop="createTime"
@@ -222,7 +217,8 @@
                 <el-button
                   v-if="
                     scope.row.deptProcessStatus &&
-                    (scope.row.status == 2 || scope.row.status == 3)
+                    (scope.row.status == 2 || scope.row.status == 3) &&
+                    scope.row.processId == latestProcessId
                   "
                   link
                   type="warning"
@@ -230,7 +226,7 @@
                   @click="handleUpdateDayworkItem(scope.row)"
                   >编辑</el-button
                 >
-                <el-button v-model="flag"
+                <el-button
                   v-else
                   link
                   type="primary"
@@ -252,7 +248,8 @@
         @pagination="getDayworkItems"
       />
     </section>
-    <dayworkItem-form
+     <!-- 报工信息表单 -->
+    <daywork-item-form
       ref="dayworkItemRef"
       @handleSaveSuccess="handleGetDayworkItems"
     />
@@ -268,29 +265,28 @@ import {
 import { listDeptProcess } from "@/api/business/deptProcess";
 import { getDept } from "@/api/business/planDetailSubDetail.js";
 import dayworkItemForm from "./form";
-import { get } from "@vueuse/core";
 const { proxy } = getCurrentInstance();
 
 /** 字典 */
 const { daywork_status } = proxy.useDict("daywork_status");
 
-/** daywork 列表 */
+/** 生产批次 */
 const dayworkList = ref([]);
-const dayworkItemList = ref([]);
 const dayworkTable = ref(null);
-const deptList = ref([]);
-
-/** daywork 批次 */
 const currentDaywork = ref({});
 const dayworkLoading = ref(false);
+const total = ref(0);
+/**工段 */
+const deptList = ref([]);
 const loading = ref(false);
+/** 报工信息 */
+const dayworkItemList = ref([]);
 const dayworkItemLoading = ref(false);
-const processList = ref([]);
-const deptProcessList = ref([]);
-const total = ref(0);
 const itemTotal = ref(0);
-const flag = ref(false);
-
+const latestProcessId = ref(null);
+const deptProcessList = ref([]);
+/**工序 */
+const processList = ref([]);
 /** 查询对象 */
 const queryDayworkParams = ref({
   productDescription: "",
@@ -306,12 +302,12 @@ const queryItemParams = ref({
   technologicalProcessDetailId: null,
 });
 
-/***********************  方法区  ****************************/
-
+/***********************  工段相关事件  ****************************/
 function getList() {
   loading.value = true;
   getDept().then((response) => {
     deptList.value = response.data;
+    loading.value = false;
     if (deptList.value.length > 0) {
       queryDayworkParams.value.deptId = deptList.value[0].value;
       getDayworks();
@@ -319,8 +315,13 @@ function getList() {
       dayworkList.value = [];
     }
   });
-  loading.value = false;
 }
+//切换工段
+function handleDeptChange() {
+  getDayworks();
+}
+/***********************  生产批次相关事件  ****************************/
+
 /** 查询计划明细 */
 function getDayworks() {
   dayworkLoading.value = true;
@@ -342,6 +343,21 @@ function getDayworks() {
     }
   });
 }
+
+/** 生产计划明细 current-change 事件 */
+function handleDayworkCurrentChange(row) {
+  if (row) {
+    currentDaywork.value = row;
+    queryItemParams.value.dayworkId = currentDaywork.value.id;
+    queryItemParams.value.technologicalProcessDetailId = null;
+    queryItemParams.value.technologicalProcessId = row.technologicalProcessId;
+    getDayworkItems();
+  } else {
+    dayworkItemList.value = [];
+  }
+}
+
+/***********************  报工信息相关事件  ****************************/
 //查询报工信息数据
 function handleGetDayworkItems() {
   dayworkLoading.value = true;
@@ -368,28 +384,30 @@ function handleGetDayworkItems() {
     proxy.$refs.dayworkTable.setCurrentRow(dayworkList.value[index]);
   });
 }
-//切换工段
-function handleDeptChange() {
-  getDayworks();
-}
-//修改
+//修改报工信息
 function handleUpdateDayworkItem(row) {
   //同工序下状态是否有工序已完成
-  let processFinish = false
+  let processFinish = false;
   //除了编辑此条以外的同工序合格数
   let totalQuailifiedNum = 0;
   for (let i = 0; i < dayworkItemList.value.length; i++) {
-    if (row.processId == dayworkItemList.value[i].processId &&(dayworkItemList.value[i].status == 2 ||dayworkItemList.value[i].status == 3) 
-    &&row.id != dayworkItemList.value[i].id) {
+    if (
+      row.processId == dayworkItemList.value[i].processId &&
+      (dayworkItemList.value[i].status == 2 ||
+        dayworkItemList.value[i].status == 3) &&
+      row.id != dayworkItemList.value[i].id
+    ) {
       totalQuailifiedNum += dayworkItemList.value[i].qualifiedNum;
     }
-    if(row.processId == dayworkItemList.value[i].processId && dayworkItemList.value[i].status == 3&&row.id != dayworkItemList.value[i].id) {
-      processFinish = true 
+    if (
+      row.processId == dayworkItemList.value[i].processId &&
+      dayworkItemList.value[i].status == 3 &&
+      row.id != dayworkItemList.value[i].id
+    ) {
+      processFinish = true;
     }
   }
-  let maxQuailifiedNum = Math.floor(
-    row.prodNum * 1.03 - totalQuailifiedNum
-  );
+  let maxQuailifiedNum = Math.floor(row.prodNum * 1.03 - totalQuailifiedNum);
   //该daywork合格数总数不能超过投产数的103%
   row.technologicalProcessId = queryItemParams.value.technologicalProcessId;
   row.deptId = queryDayworkParams.value.deptId;
@@ -410,7 +428,7 @@ function handleUpdateDayworkItem(row) {
   row.processFinish = processFinish;
   proxy.$refs.dayworkItemRef.open(row);
 }
-//查看
+//查看报工信息
 function handleCheckDayworkItem(row) {
   row.technologicalProcessId = queryItemParams.value.technologicalProcessId;
   row.deptId = queryDayworkParams.value.deptId;
@@ -425,16 +443,22 @@ function handleCheckDayworkItem(row) {
   }
   //修改向form表单传一个状态值
   row.editStatus = false;
+  // row.returnFlag = false;
+  // //如果是最新工序的已接收,则传一个状态值,给form表单一个退回按钮
+  // if (row.processId == latestProcessId.value && row.status == 7) {
+  //   row.returnFlag = true;
+  // }
   proxy.$refs.dayworkItemRef.open(row);
 }
-
+/**切换工序 */
 function handleProcessChange() {
   getDayworkItems();
 }
 
-/** 查询报工详情列表 */
+/** 报工详情列表 */
 function getDayworkItems() {
   dayworkItemLoading.value = true;
+  //查询该工段在工段资源分配时绑定的工序,传一个flag,如果flag有值则后端查询不分页
   listDeptProcess({ deptId: queryDayworkParams.value.deptId, flag: 1 }).then(
     (res) => {
       deptProcessList.value = res.rows;
@@ -445,6 +469,10 @@ function getDayworkItems() {
       if (res.rows[i].prodNum == 0) {
         res.rows[i].prodNum = currentDaywork.value.oneLotQuantity;
       }
+      //拿到最新一条报工信息的工序id,只能编辑当前序
+      if (res.rows[i] == res.rows[res.rows.length - 1]) {
+        latestProcessId.value = res.rows[i].processId;
+      }
     }
     for (var i = 0; i < res.rows.length; i++) {
       let timeStamp = res.rows[i].workingHours;
@@ -454,16 +482,15 @@ function getDayworkItems() {
       let time = `${hours}小时${minutes}分钟${seconds}秒`;
       res.rows[i].workingHours = time;
       res.rows[i].deptProcessStatus = false;
+      //报工记录的工序id是该工段绑定的工序时,允许编辑
       for (var item = 0; item < deptProcessList.value.length; item++) {
-        if (
-          res.rows[i].processId ==
-          deptProcessList.value[item].processId
-        ) {
+        if (res.rows[i].processId == deptProcessList.value[item].processId) {
           res.rows[i].deptProcessStatus = true;
         }
       }
     }
     dayworkItemList.value = res.rows;
+    //工序下拉框
     getProcessList({
       technologicalProcessId: queryItemParams.value.technologicalProcessId,
     }).then((res) => {
@@ -475,23 +502,9 @@ function getDayworkItems() {
 }
 /** 搜索按钮操作 */
 function handleQuery() {
-  //queryDayworkParams.value.pageNum = 1
   getDayworks();
 }
 
-/** 生产计划明细 current-change 事件 */
-function handleDayworkCurrentChange(row) {
-  if (row) {
-    currentDaywork.value = row;
-    queryItemParams.value.dayworkId = currentDaywork.value.id;
-    queryItemParams.value.technologicalProcessDetailId = null;
-    queryItemParams.value.technologicalProcessId = row.technologicalProcessId;
-    getDayworkItems();
-  } else {
-    dayworkItemList.value = [];
-  }
-}
-
 onMounted(() => {
   getList();
 });

+ 106 - 61
src/views/business/department/form.vue

@@ -1,15 +1,35 @@
 <template>
   <!-- 添加或修改项目信息对话框 -->
-  <el-dialog title="部门信息" v-model="visible" width="400px" append-to-body draggable>
+  <el-dialog
+    title="部门信息"
+    v-model="visible"
+    width="400px"
+    append-to-body
+    draggable
+  >
     <div class="form-container">
-      <el-form ref="deptRef" class="master-container" :model="form" :rules="rules" label-width="100px">
+      <el-form
+        ref="deptRef"
+        class="master-container"
+        :model="form"
+        :rules="rules"
+        label-width="100px"
+      >
         <el-form-item label="上级部门" prop="parentId">
-          <el-tree-select v-model="form.parentId" :data="deptOptions" :props="{
+          <el-tree-select
+            v-model="form.parentId"
+            :data="deptOptions"
+            :props="{
               value: 'deptId',
               label: 'deptName',
-              children: 'children'
-            }" value-key="deptId" placeholder="请选择上级部门" check-strictly :render-after-expand="false" >
-        </el-tree-select>
+              children: 'children',
+            }"
+            value-key="deptId"
+            placeholder="请选择上级部门"
+            check-strictly
+            :render-after-expand="false"
+          >
+          </el-tree-select>
         </el-form-item>
 
         <el-form-item label="部门名称" prop="deptName">
@@ -18,105 +38,130 @@
         <el-form-item label="部门编码" prop="deptCode">
           <el-input v-model.trim="form.deptCode" placeholder="请输入部门编码" />
         </el-form-item>
-        <el-form-item v-if="form.type === '0'" label="是否为工段" prop="isWorkSection">
-          <el-select v-model="form.isWorkSection" placeholder="请选择是否为工段">
-            <el-option v-for="item in work_section_status" :key="item.value" :label="item.label" :value="item.value"></el-option>
+        <el-form-item
+          v-if="form.type === '0'"
+          label="是否为工段"
+          prop="isWorkSection"
+        >
+          <el-select
+            v-model="form.isWorkSection"
+            placeholder="请选择是否为工段"
+          >
+            <el-option
+              v-for="item in work_section_status"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            ></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="显示排序" prop="orderNum">
-          <el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
+          <el-input-number
+            v-model="form.orderNum"
+            controls-position="right"
+            :min="0"
+          />
         </el-form-item>
       </el-form>
     </div>
     <template #footer>
-      <el-button type="primary" icon="Check" @click="submitForm">确 定</el-button>
+      <el-button type="primary" icon="Check" @click="submitForm"
+        >确 定</el-button
+      >
       <el-button icon="Close" @click="cancel">取 消</el-button>
     </template>
   </el-dialog>
 </template>
 <script setup>
-import { listDept, getDept, saveDept } from '@/api/system/dept'
-const { proxy } = getCurrentInstance()
-const { dept_type } = proxy.useDict('dept_type')
-const { work_section_status } = proxy.useDict('work_section_status')
-const emit = defineEmits(['handleSaveSuccess'])
+import { listDept, getDept, saveDept } from "@/api/system/dept";
+const { proxy } = getCurrentInstance();
 /** 字典数组区 */
+const { work_section_status } = proxy.useDict("work_section_status");
 /** 表单抽屉 页变量 */
-const visible = ref(false)
-const deptOptions = ref([])
-const disabled = ref(false)
+const visible = ref(false);
+const deptOptions = ref([]);
+const disabled = ref(false);
 const data = reactive({
   form: {},
   rules: {
-    parentId: [ { required: true, message: '请选择上级部门', trigger: 'blur' }],
-    deptName: [{ required: true, message: '部门名称不能为空', trigger: 'blur' }],
-    deptCode: [{ required: true, message: '部门编码不能为空', trigger: 'blur' }],
-    orderNum: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }]
-  }
-})
-const { form, rules } = toRefs(data)
+    parentId: [{ required: true, message: "请选择上级部门", trigger: "blur" }],
+    deptName: [
+      { required: true, message: "部门名称不能为空", trigger: "blur" },
+    ],
+    deptCode: [
+      { required: true, message: "部门编码不能为空", trigger: "blur" },
+    ],
+    orderNum: [
+      { required: true, message: "显示排序不能为空", trigger: "blur" },
+    ],
+  },
+});
+const { form, rules } = toRefs(data);
+const emit = defineEmits(["handleSaveSuccess"]);
 /***********************  方法区  ****************************/
 /** 打开抽屉 */
 function open(row) {
-  reset()
-  visible.value = true
+  reset();
+  visible.value = true;
   listDept().then((response) => {
-   response.rows =  response.rows.filter((item) => {
-      return item.type == '0'
-    })
-    deptOptions.value = deptOptions.value.concat(proxy.handleTree(response.rows, 'deptId'))
-    deptOptions.value.unshift({ deptId: '0', deptName: '无', children: [] })
-  })
+    response.rows = response.rows.filter((item) => {
+      return item.type == "0";
+    });
+    deptOptions.value = deptOptions.value.concat(
+      proxy.handleTree(response.rows, "deptId")
+    );
+    deptOptions.value.unshift({ deptId: "0", deptName: "无", children: [] });
+  });
   if (row) {
     getDept(row.id).then((response) => {
-      form.value = response.data
-    })
+      form.value = response.data;
+    });
   }
-  disabled.value = true
+  disabled.value = true;
 }
 /** 取消按钮 */
 function cancel() {
-  visible.value = false
-  reset()
+  visible.value = false;
+  reset();
 }
 
 /** 表单重置 */
 function reset() {
   form.value = {
     id: null,
-    deptId: '',
-    type: '0',
-    companyId: '0',
-    parentId: '',
-    code: '',
-    name: '',
-    remark: '',
-    isWorkSection: '0',
-    sort: 0
-  }
-  disabled.value = false
-  deptOptions.value = []
-  proxy.resetForm('deptRef')
+    deptId: "",
+    type: "0",
+    companyId: "0",
+    parentId: "",
+    code: "",
+    name: "",
+    remark: "",
+    isWorkSection: "0",
+    sort: 0,
+  };
+  disabled.value = false;
+  deptOptions.value = [];
+  proxy.resetForm("deptRef");
 }
 
 /** 提交按钮 */
 function submitForm() {
-  proxy.$refs['deptRef'].validate((valid) => {
+  proxy.$refs["deptRef"].validate((valid) => {
     if (valid) {
-      console.log(form.value)
+      console.log(form.value);
       saveDept(form.value).then((res) => {
         if (res.code === 200) {
-          proxy.$modal.msgSuccess('操作成功')
-          emit('handleSaveSuccess')
+          proxy.$modal.msgSuccess("操作成功");
+          emit("handleSaveSuccess");
         }
-        visible.value = false
-      })
+        visible.value = false;
+      });
     }
-  })
+  });
 }
 
 /** 暴露给父组件的方法 */
 defineExpose({
-  open
-})
+  open,
+});
 </script>

+ 81 - 43
src/views/business/department/formUser.vue

@@ -1,88 +1,126 @@
 <template>
   <!-- 添加或修改项目信息对话框 -->
-  <el-dialog title="员工信息" v-model="visible" width="400px" append-to-body draggable>
+  <el-dialog
+    title="员工信息"
+    v-model="visible"
+    width="400px"
+    append-to-body
+    draggable
+  >
     <div class="form-container">
-      <el-form ref="userRef" class="master-container" :model="form" :rules="rules" label-width="140px">
+      <el-form
+        ref="userRef"
+        class="master-container"
+        :model="form"
+        :rules="rules"
+        label-width="140px"
+      >
         <el-form-item label="是否为部门负责人" prop="isLeader">
-          <el-select v-model="form.isLeader" placeholder="请选择是否为部门负责人">
-            <el-option v-for="item in is_leader" :key="item.value" :label="item.label" :value="item.value"></el-option>
+          <el-select
+            v-model="form.isLeader"
+            placeholder="请选择是否为部门负责人"
+          >
+            <el-option
+              v-for="item in is_leader"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            ></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="是否为调度人员" prop="isDispatcher">
-          <el-select v-model="form.isDispatcher" placeholder="请选择是否为调度人员">
-            <el-option v-for="item in is_dispatcher" :key="item.value" :label="item.label" :value="item.value"></el-option>
+          <el-select
+            v-model="form.isDispatcher"
+            placeholder="请选择是否为调度人员"
+          >
+            <el-option
+              v-for="item in is_dispatcher"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            ></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="是否为工段长" prop="isFormman">
           <el-select v-model="form.isFormman" placeholder="请选择是否为工段长">
-            <el-option v-for="item in is_formman" :key="item.value" :label="item.label" :value="item.value"></el-option>
+            <el-option
+              v-for="item in is_formman"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            ></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="是否为调机班长" prop="isYardman">
-          <el-select v-model="form.isYardman" placeholder="请选择是否为调机班长">
-            <el-option v-for="item in is_yardman" :key="item.value" :label="item.label" :value="item.value"></el-option>
+          <el-select
+            v-model="form.isYardman"
+            placeholder="请选择是否为调机班长"
+          >
+            <el-option
+              v-for="item in is_yardman"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            ></el-option>
           </el-select>
         </el-form-item>
       </el-form>
     </div>
     <template #footer>
-      <el-button type="primary" icon="Check" @click="submitForm">确 定</el-button>
+      <el-button type="primary" icon="Check" @click="submitForm"
+        >确 定</el-button
+      >
       <el-button icon="Close" @click="cancel">取 消</el-button>
     </template>
   </el-dialog>
 </template>
 <script setup>
-import { updateDeptUser } from '@/api/system/user'
-const { proxy } = getCurrentInstance()
-const { is_leader } = proxy.useDict('is_leader')
-const { is_dispatcher } = proxy.useDict('is_dispatcher')
-const { is_yardman } = proxy.useDict('is_yardman')
-const { is_formman } = proxy.useDict('is_formman')
-const emit = defineEmits(['handleSaveSuccess'])
+import { updateDeptUser } from "@/api/system/user";
+const { proxy } = getCurrentInstance();
 /** 字典数组区 */
+const { is_leader } = proxy.useDict("is_leader");
+const { is_dispatcher } = proxy.useDict("is_dispatcher");
+const { is_yardman } = proxy.useDict("is_yardman");
+const { is_formman } = proxy.useDict("is_formman");
 /** 表单抽屉 页变量 */
-const visible = ref(false)
-const deptOptions = ref([])
-const disabled = ref(false)
+const visible = ref(false);
 const data = reactive({
   form: {},
-  rules: {
-   
-  }
-})
-const { form, rules } = toRefs(data)
+  rules: {},
+});
+const { form, rules } = toRefs(data);
+const emit = defineEmits(["handleSaveSuccess"]);
 
 /***********************  方法区  ****************************/
 /** 打开抽屉 */
 function open(row) {
-  visible.value = true
-  form.value.userId = row.userId
-  form.value.isFormman = row.isFormman
-  form.value.isLeader = row.isLeader
-  form.value.isYardman =row.isYardman
-  form.value.isDispatcher = row.isDispatcher
-  form.value.deptId = row.deptId
-
+  visible.value = true;
+  form.value.userId = row.userId;
+  form.value.isFormman = row.isFormman;
+  form.value.isLeader = row.isLeader;
+  form.value.isYardman = row.isYardman;
+  form.value.isDispatcher = row.isDispatcher;
+  form.value.deptId = row.deptId;
 }
 /** 取消按钮 */
 function cancel() {
-  visible.value = false
+  visible.value = false;
 }
 
 /** 提交按钮 */
 function submitForm() {
-  console.log(form.value)
+  console.log(form.value);
   updateDeptUser(form.value).then((res) => {
-        if (res.code === 200) {
-          proxy.$modal.msgSuccess('操作成功')
-          emit('handleSaveSuccess')
-        }
-        visible.value = false
-      })
+    if (res.code === 200) {
+      proxy.$modal.msgSuccess("操作成功");
+      emit("handleSaveSuccess");
     }
+    visible.value = false;
+  });
+}
 
 /** 暴露给父组件的方法 */
 defineExpose({
-  open
-})
+  open,
+});
 </script>

+ 270 - 160
src/views/business/department/index.vue

@@ -3,25 +3,59 @@
     <!-- 左侧区域 -->
     <section class="list-part-container" style="flex: 2">
       <!-- 搜索区 -->
-      <el-form class="list-search-container" :model="queryDeptParams" ref="queryRef" :inline="true">
+      <el-form
+        class="list-search-container"
+        :model="queryDeptParams"
+        ref="queryRef"
+        :inline="true"
+      >
         <el-form-item class="section-title" label="部门管理" />
         <el-form-item>
-          <el-button type="primary" icon="Plus" @click="handleAdd" v-hasPermi="['business:department:add']">新增</el-button>
+          <el-button
+            type="primary"
+            icon="Plus"
+            @click="handleAdd"
+            v-hasPermi="['business:department:add']"
+            >新增</el-button
+          >
         </el-form-item>
         <el-form-item label="部门编码:" prop="deptCode">
-          <el-input v-model.trim="queryDeptParams.deptCode" placeholder="请输入部门编码" @keydown.enter.prevent @keyup.enter="handleSearch" clearable style="width: 155px"  />
+          <el-input
+            v-model.trim="queryDeptParams.deptCode"
+            placeholder="请输入部门编码"
+            @keydown.enter.prevent
+            @keyup.enter="handleSearch"
+            clearable
+            style="width: 155px"
+          />
         </el-form-item>
         <el-form-item>
-          <el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
+          <el-button type="info" icon="Search" @click="handleSearch"
+            >搜索</el-button
+          >
         </el-form-item>
-        
       </el-form>
       <!-- 列表区 -->
       <div class="el-table-container">
         <div class="el-table-inner-container">
           <!-- 列表区 -->
-          <el-table ref="departmentTable" v-loading="loading" :data="deptList" row-key="id" height="100%" :indent="20" default-expand-all highlight-current-row @current-change="handleGetUser">
-            <el-table-column label="行号" type="index" width="50" align="center" />
+          <el-table
+            ref="departmentTable"
+            v-loading="deptLoading"
+            :data="deptList"
+            row-key="id"
+            height="100%"
+            :indent="20"
+            default-expand-all
+            highlight-current-row
+            @current-change="handleGetUser"
+          >
+            <el-table-column
+              label="行号"
+              type="index"
+              width="50"
+              align="center"
+            />
             <el-table-column label="部门名称" prop="label" align="center" />
             <el-table-column label="部门编码" prop="deptCode" align="center" />
             <!-- <el-table-column label="是否企业" prop="deptType" width="70" align="center">
@@ -29,15 +63,42 @@
                 <dict-tag :options="dept_type" :value="scope.row.deptType" />
               </template>
             </el-table-column> -->
-            <el-table-column label="是否工段" prop="isWorkSection" width="70" align="center">
+            <el-table-column
+              label="是否工段"
+              prop="isWorkSection"
+              width="70"
+              align="center"
+            >
               <template #default="scope">
-                <dict-tag :options="work_section_status" :value="scope.row.isWorkSection" />
+                <dict-tag
+                  :options="work_section_status"
+                  :value="scope.row.isWorkSection"
+                />
               </template>
             </el-table-column>
-            <el-table-column label="操作" width="150" align="center" v-hasPermi="['business:department:edit']">
+            <el-table-column
+              label="操作"
+              width="150"
+              align="center"
+              v-hasPermi="['business:department:edit']"
+            >
               <template #default="scope">
-                <el-button link type="warning" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['business:department:edit']">编辑</el-button>
-                <el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['business:department:remove']">删除</el-button>
+                <el-button
+                  link
+                  type="warning"
+                  icon="Edit"
+                  @click="handleUpdate(scope.row)"
+                  v-hasPermi="['business:department:edit']"
+                  >编辑</el-button
+                >
+                <el-button
+                  link
+                  type="danger"
+                  icon="Delete"
+                  @click="handleDelete(scope.row)"
+                  v-hasPermi="['business:department:remove']"
+                  >删除</el-button
+                >
               </template>
             </el-table-column>
           </el-table>
@@ -48,24 +109,73 @@
     <!-- 右侧区域 -->
     <section class="list-part-container" style="flex: 3">
       <!-- 搜索区 -->
-      <el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true">
+      <el-form
+        class="list-search-container"
+        :model="queryParams"
+        ref="queryRef"
+        :inline="true"
+      >
         <el-form-item class="section-title" label="员工" />
         <el-form-item>
-          <el-button type="primary" icon="Plus" :disabled="deptList.length == 0"  @click="openUser">新增</el-button>
-          <el-button type="danger" icon="Delete" :disabled="ids.length == 0"  @click="handleUserDelete"> 删除</el-button>
+          <el-button
+            type="primary"
+            icon="Plus"
+            :disabled="deptList.length == 0"
+            @click="openUser"
+            >新增</el-button
+          >
+          <el-button
+            type="danger"
+            icon="Delete"
+            :disabled="ids.length == 0"
+            @click="handleUserDelete"
+          >
+            删除</el-button
+          >
         </el-form-item>
       </el-form>
 
       <!-- 列表区 -->
       <div class="el-table-container">
         <div class="el-table-inner-container">
-          <el-table v-loading="loading" :data="userList" row-key="id" height="100%" @selection-change="handleSelectionChange">
+          <el-table
+            v-loading="userLoading"
+            :data="userList"
+            row-key="id"
+            height="100%"
+            @selection-change="handleSelectionChange"
+          >
             <el-table-column type="selection" width="40" align="center" />
-            <el-table-column type="index" label="行号" width="50" align="center" />
-            <el-table-column label="员工编码" width="100" prop="user.userName" align="center" />
-            <el-table-column label="员工姓名" width="100" prop="user.nickName" align="center" />
-            <el-table-column label="性别" width="50" prop="user.sex" align="center" />
-            <el-table-column label="手机号码" width="120" prop="user.phoneNumber" align="center" />
+            <el-table-column
+              type="index"
+              label="行号"
+              width="50"
+              align="center"
+            />
+            <el-table-column
+              label="员工编码"
+              width="100"
+              prop="user.userName"
+              align="center"
+            />
+            <el-table-column
+              label="员工姓名"
+              width="100"
+              prop="user.nickName"
+              align="center"
+            />
+            <el-table-column
+              label="性别"
+              width="50"
+              prop="user.sex"
+              align="center"
+            />
+            <el-table-column
+              label="手机号码"
+              width="120"
+              prop="user.phoneNumber"
+              align="center"
+            />
             <el-table-column label="部门负责人" width="90" align="center">
               <template #default="scope">
                 <dict-tag :options="yesOrNo" :value="scope.row.isLeader" />
@@ -86,9 +196,15 @@
                 <dict-tag :options="yesOrNo" :value="scope.row.isYardman" />
               </template>
             </el-table-column>
-            <el-table-column label="操作"  prop="phoneNumber" align="center">
+            <el-table-column label="操作" prop="phoneNumber" align="center">
               <template #default="scope">
-                <el-button link type="warning" icon="Edit" @click="handleUpdateUser(scope.row)" >编辑</el-button>
+                <el-button
+                  link
+                  type="warning"
+                  icon="Edit"
+                  @click="handleUpdateUser(scope.row)"
+                  >编辑</el-button
+                >
               </template>
             </el-table-column>
             <el-table-column />
@@ -96,220 +212,214 @@
         </div>
       </div>
       <!-- 分页 -->
-      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getUserList" />
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        v-model:page="queryParams.pageNum"
+        v-model:limit="queryParams.pageSize"
+        @pagination="getUserList"
+      />
     </section>
-
-    <!-- 表单 -->
+    <!-- 部门管理表单 -->
     <dept-form ref="deptRef" @handleSaveSuccess="getList" />
-    <person ref="personRef" :multiple="multiple" :multiple-selected="handleMultipleSelected" />
+    <!-- 员工选择弹窗 -->
+    <person
+      ref="personRef"
+      :multiple="multiple"
+      :multiple-selected="handleMultipleSelected"
+    />
+    <!-- 员工编辑表单 -->
     <user-form ref="updateUser" @handleSaveSuccess="getUserList" />
   </div>
 </template>
 
 <script setup name="Process">
-import { getUsersByDeptId, saveDeptUser, deptTreeSelect, delDeptUser, getDeptUser, getUsersItemByDeptId } from '@/api/system/user'
-import { delDept, getDept } from '@/api/system/dept'
-import {deleteGroupDetail } from '@/api/business/resourceGroupDetail'
-import deptForm from './form'
-import userForm from './formUser'
-import person from '@/views/dialog/person.vue'
-
-const { proxy } = getCurrentInstance()
-const { dept_type } = proxy.useDict('dept_type')
-const { work_section_status } = proxy.useDict('work_section_status')
-
-const deptList = ref([])
-const userList = ref([])
-const userInfoList = ref([])
-const loading = ref(true)
-const ids = ref([])
-const deptName = ref('')
-const single = ref(true)
-const multiple = ref(true)
+import {
+  saveDeptUser,
+  deptTreeSelect,
+  delDeptUser,
+  getDeptUser,
+} from "@/api/system/user";
+import { delDept } from "@/api/system/dept";
+import { deleteGroupDetail } from "@/api/business/resourceGroupDetail";
+import deptForm from "./form";
+import userForm from "./formUser";
+import person from "@/views/dialog/person.vue";
+const { proxy } = getCurrentInstance();
+/**字典 */
+const { work_section_status } = proxy.useDict("work_section_status");
+//部门
+const currentDept = ref({});
+const deptList = ref([]);
+const deptLoading = ref(true);
+//员工
+const userList = ref([]);
+const userLoading = ref(false);
+const total = ref(0);
+const ids = ref([]);
 
-//多选员工数据
-const deptUser = ref([])
-const currentDept = ref({})
-const total = ref(0)
+const single = ref(true);
+const multiple = ref(true);
 /** 查询对象 */
 const queryParams = ref({
   deptId: 0,
   pageNum: 1,
   pageSize: 10,
-  code: '',
-  name: ''
-})
+  code: "",
+  name: "",
+});
 const queryDeptParams = ref({
-  deptCode:''
-})
+  deptCode: "",
+});
 
 const yesOrNo = [
-  { label: '是', value: '1', elTagType: 'primary', elTagClass: '' },
-  { label: '否', value: '0', elTagType: 'danger', elTagClass: '' }
-]
+  { label: "是", value: "1", elTagType: "primary", elTagClass: "" },
+  { label: "否", value: "0", elTagType: "danger", elTagClass: "" },
+];
 
 /***********************  方法区  ****************************/
-
-/** 查询标准工序管理列表 */
+/***********************  部门管理相关事件  ****************************/
+/** 查询工段列表 */
 function getList() {
-  loading.value = true
+  deptLoading.value = true;
   deptTreeSelect(queryDeptParams.value).then((response) => {
     deptList.value = response.data.filter((item) => {
-      return item.deptType == '0'
-    })
+      return item.deptType == "0";
+    });
     if (deptList.value.length > 0) {
-      currentDept.value = deptList.value[0]
-      proxy.$refs.departmentTable.setCurrentRow(deptList.value[0])
-    }
-    else {
-      userList.value = []
+      currentDept.value = deptList.value[0];
+      proxy.$refs.departmentTable.setCurrentRow(deptList.value[0]);
+    } else {
+      userList.value = [];
     }
-    loading.value = false
-  })
+    deptLoading.value = false;
+  });
 }
-
+/**部门查询 */
 function handleSearch() {
-  getList()
+  getList();
+}
+/** 部门新增按钮操作 */
+function handleAdd() {
+  proxy.$refs.deptRef.open();
+}
+/** 部门修改按钮操作 */
+function handleUpdate(row) {
+  proxy.$refs.deptRef.open(row);
+}
+/**部门名称表点击事件 */
+function handleGetUser(row) {
+  if (row) {
+    currentDept.value = row;
+    getUserList();
+  } else {
+    userList.value = [];
+    total.value = 0;
+  }
 }
 
+/***********************  员工相关事件  ****************************/
+
 //打开添加人员
 const openUser = () => {
-  handleAddBatchUsers()
-}
-/** 多选添加 */
+  handleAddBatchUsers();
+};
+/** 新增员工 */
 function handleAddBatchUsers() {
-  multiple.value = true
-  const userInfo = {}
-  userInfo.identifying = true
-  userInfo.deptId = currentDept.value.id
-  proxy.$refs.personRef.open(userInfo)
+  multiple.value = true;
+  const userInfo = {};
+  userInfo.identifying = true;
+  userInfo.deptId = currentDept.value.id;
+  proxy.$refs.personRef.open(userInfo);
 }
-
+/**员工多选带回 */
 function handleMultipleSelected(selection) {
-  var newList = []
+  var newList = [];
   for (var i = 0; i < selection.length; ++i) {
-    var newPerson = {}
-
-    newPerson.userId = selection[i].userId
-    newPerson.deptId = currentDept.value.id
-
-    newList.push(newPerson)
+    var newPerson = {};
+    newPerson.userId = selection[i].userId;
+    newPerson.deptId = currentDept.value.id;
+    newList.push(newPerson);
   }
   saveDeptUser(newList).then((response) => {
     if (response.code == 200) {
-      proxy.$modal.msgSuccess('操作成功')
-      handleGetUser(currentDept.value)
+      proxy.$modal.msgSuccess("操作成功");
+      handleGetUser(currentDept.value);
     }
-  })
+  });
 }
 
 // 多选框选中数据
 function handleSelectionChange(selection) {
   ids.value = selection.map((item) => {
-    return { userId: item.userId, deptId: currentDept.value.id }
-  })
-  console.log(ids.value)
-  single.value = selection.length != 1
-  multiple.value = !selection.length
-}
-
-/** 新增按钮操作 */
-function handleAdd() {
-  proxy.$refs.deptRef.open()
-}
-
-/** 修改按钮操作 */
-function handleUpdate(row) {
-  // getDept(row.id).then((res) => {})
-  proxy.$refs.deptRef.open(row)
-}
-
-/**部门名称表点击事件 */
-function handleGetUser(row) {
-  if (row) {
-    currentDept.value = row
-    getUserList()
-  }
-  else {
-    userList.value = []
-      total.value = 0
-  }
+    return { userId: item.userId, deptId: currentDept.value.id };
+  });
+  single.value = selection.length != 1;
+  multiple.value = !selection.length;
 }
 
 /** 获取员工列表 */
-function getUsers() {
-  queryParams.value.deptId = currentDept.value.id
-  getDeptUser(queryParams.value).then((response) => {
-    if (response.code == 200) {
-      userList.value = response.rows
-      total.value = response.total
-    }
-  })
-}
-
 function getUserList() {
-  queryParams.value.deptId = currentDept.value.id
+  userLoading.value = true;
+  queryParams.value.deptId = currentDept.value.id;
   getDeptUser(queryParams.value).then((response) => {
     if (response.code == 200) {
-      userList.value = response.rows
-      total.value = response.total
+      userList.value = response.rows;
+      userLoading.value = false;
+      total.value = response.total;
     }
-  })
-  console.log(currentDept.value)
+  });
 }
 
-/** 修改按钮操作 */
+/** 员工修改按钮操作 */
 function handleUpdateUser(row) {
-  const id = row.id
-  const userData = row
-  userData.deptId = queryParams.value.deptId
-  userData.sysDept = currentDept.value
-  proxy.$refs.updateUser.open(userData)
+  const userData = row;
+  userData.deptId = queryParams.value.deptId;
+  userData.sysDept = currentDept.value;
+  proxy.$refs.updateUser.open(userData);
 }
 
-/** 删除按钮操作 */
+/** 员工删除按钮操作 */
 function handleDelete(row) {
-  var showErrorMessage = false
-  const _ids = row.id || ids.value
+  var showErrorMessage = false;
+  const _ids = row.id || ids.value;
   proxy.$modal
-    .confirm('是否确认删除选中的数据项?')
+    .confirm("是否确认删除选中的数据项?")
     .then(function () {
       if (row.children) {
-         showErrorMessage = true;
-         return Promise.reject(new Error("HasChildrenError"));
+        showErrorMessage = true;
+        return Promise.reject(new Error("HasChildrenError"));
       }
-      return delDept(_ids)
+      return delDept(_ids);
     })
     .then(() => {
-      getList()
-      proxy.$modal.msgSuccess('删除成功!')
+      getList();
+      proxy.$modal.msgSuccess("删除成功!");
     })
     .catch(() => {})
     .finally(() => {
       if (showErrorMessage) {
         proxy.$modal.msgError("该部门下有子部门,不能删除!");
       }
-    })
+    });
 }
 /** 人员删除按钮操作 */
 function handleUserDelete(row) {
-  console.log(ids.value)
   proxy.$modal
-    .confirm('是否确认删除选中的人员,资源组明细也将同步删除该人员?')
+    .confirm("是否确认删除选中的人员,资源组明细也将同步删除该人员?")
     .then(function () {
-      return delDeptUser(ids.value)
+      return delDeptUser(ids.value);
     })
     .then(function () {
-      deleteGroupDetail(ids.value)
+      deleteGroupDetail(ids.value);
     })
     .then(() => {
-      handleGetUser(currentDept.value)
-      proxy.$modal.msgSuccess('删除成功!')
+      handleGetUser(currentDept.value);
+      proxy.$modal.msgSuccess("删除成功!");
     })
-    .catch(() => {})
+    .catch(() => {});
 }
-
 onMounted(() => {
-  getList()
-})
+  getList();
+});
 </script>

+ 9 - 22
src/views/business/deptEquipment/DialogProcessChoice.vue

@@ -49,11 +49,9 @@
             @click="handleSearch"
             >搜索</el-button
           >
-          <!-- <el-button type="primary" icon="Delete" size="default" plain @click="handleSearch('clear')">清空</el-button> -->
         </el-form-item>
       </div>
     </el-form>
-
     <el-table
       ref="dialogTable"
       :data="processList"
@@ -70,7 +68,7 @@
         type="selection"
         width="40"
         align="center"
-        :reserve-selection="true" 
+        :reserve-selection="true"
       />
       <el-table-column type="index" label="行号" width="50" align="center" />
       <el-table-column label="工序编码" align="center" prop="processCode" />
@@ -94,7 +92,7 @@
         <el-button
           type="primary"
           icon="Check"
-          :disabled="selections.length === 0"
+          :disabled="selections.length == 0"
           @click="handleMultipleSelected"
           >确定</el-button
         >
@@ -107,33 +105,32 @@
 import { ref } from "@vue/reactivity";
 import { listFilterProcess } from "@/api/business/process";
 const { proxy } = getCurrentInstance();
+/** 字典数组区 */
 const { process_status } = proxy.useDict("process_status");
+/** 弹窗变量 */
 const total = ref(0);
 const props = defineProps({
-  selected: {
-    type: Array,
-    defalut: [],
-  },
   multipleSelected: {
     type: Function,
     default: null,
   },
 });
-
-const { multipleSelected, selected } = toRefs(props);
+const { multipleSelected } = toRefs(props);
 const processList = ref([]);
 const visible = ref(false);
-const processIds = ref([])
 const loading = ref(false);
+const selections = ref([]);
+/** 查询对象 */
 const data = reactive({
   queryParams: {
     pageSize: 10,
     pageNum: 1,
   },
 });
-const selections = ref([]);
+
 const { queryParams } = toRefs(data);
 
+/***********************  方法区  ****************************/
 /** 获取行 id */
 function getRowKey(row) {
   return row.id;
@@ -148,7 +145,6 @@ function open(data) {
   getList();
 }
 
-
 /**
  * 对话框关闭 事件
  */
@@ -179,14 +175,6 @@ function handleSelectionChange(selection) {
   selections.value = selection;
 }
 
-function selectable(row, index) {
-  if (selected.value.length > 0) {
-    return !selected.value.some((l) => l.personId === row.id);
-  } else {
-    return true;
-  }
-}
-
 /**  搜索 事件 */
 function handleSearch(type) {
   if (type && type === "clear") {
@@ -212,4 +200,3 @@ defineExpose({
   open,
 });
 </script>
-<style scoped></style>

+ 183 - 134
src/views/business/deptEquipment/form.vue

@@ -1,157 +1,205 @@
 <template>
   <!-- 添加或修改项目信息对话框 -->
-  <el-drawer v-model="visible" size="80%" direction="rtl" :close-on-press-escape="false">
+  <el-drawer
+    v-model="visible"
+    size="80%"
+    direction="rtl"
+    :close-on-press-escape="false"
+  >
     <div class="page-container form-container">
       <div class="form-btns-container">
-        <span class="title-label"><el-icon>
+        <span class="title-label"
+          ><el-icon>
             <Document />
-          </el-icon> 资源组详情</span>
-        <el-button type="primary" icon="Check" style="margin-right: 10px;" @click="handleSave">保 存</el-button>
+          </el-icon>
+          资源组详情</span
+        >
+        <el-button
+          type="primary"
+          icon="Check"
+          style="margin-right: 10px"
+          @click="handleSave"
+          >保 存</el-button
+        >
         <el-button icon="Close" @click="handleCancel">取 消</el-button>
       </div>
       <!-- 主表 -->
-      <el-form ref="formRef" class="master-container" :model="form" label-width="120px" :rules="rules" :show-message="true">
+      <el-form
+        ref="formRef"
+        class="master-container"
+        :model="form"
+        label-width="120px"
+        :rules="rules"
+        :show-message="true"
+      >
         <el-row :gutter="20">
           <el-col :span="12">
             <el-form-item label="资源组编号:" prop="code">
-              <el-input v-model.trim="form.code" placeholder="请输入资源组编号" :clearable="true" style="width: 280px" />
+              <el-input
+                v-model.trim="form.code"
+                placeholder="请输入资源组编号"
+                :clearable="true"
+                style="width: 280px"
+              />
             </el-form-item>
           </el-col>
-          <!-- <el-col :span="12">
-            <el-form-item label="备注:" prop="remark">
-              <el-input v-model.trim="form.remark" placeholder="请输入备注" style="width: 280px" />
-            </el-form-item>
-          </el-col> -->
         </el-row>
       </el-form>
       <!-- 搜索区域 -->
       <el-form class="list-search-container" :inline="true">
         <el-form-item class="section-title" label="资源组明细" />
         <el-form-item>
-          <el-button type="warning" icon="Plus" @click="handleOpenPerson('person')">添加人员</el-button>
-          <el-button type="success" icon="Plus" @click="handleOpenPerson('equipment')">添加设备</el-button>
-          <el-button type="danger" icon="Delete" :disabled="selections.length == 0" @click="handleDelete">批量删除</el-button>
-
+          <el-button
+            type="warning"
+            icon="Plus"
+            @click="handleOpenPerson('person')"
+            >添加人员</el-button
+          >
+          <el-button
+            type="success"
+            icon="Plus"
+            @click="handleOpenPerson('equipment')"
+            >添加设备</el-button
+          >
+          <el-button
+            type="danger"
+            icon="Delete"
+            :disabled="selections.length == 0"
+            @click="handleDelete"
+            >批量删除</el-button
+          >
         </el-form-item>
       </el-form>
       <!-- 列表区 -->
       <div class="el-table-container">
-        <el-table ref="equipmentTable" v-loading="loading" row-key="id" @selection-change="handleSelectionChange" :data="form.groupDetailList" height="100%">
+        <el-table
+          ref="equipmentTable"
+          v-loading="loading"
+          row-key="id"
+          @selection-change="handleSelectionChange"
+          :data="form.groupDetailList"
+          height="100%"
+        >
           <el-table-column type="selection" width="40" align="center" />
           <el-table-column label="资源编码" prop="commonCode" align="center" />
           <el-table-column label="资源名称" prop="commonName" align="center" />
           <el-table-column label="资源类别" prop="commonType" align="center">
             <template #default="scope">
-              <dict-tag :options="resource_group_detail" :value="scope.row.commonType" />
+              <dict-tag
+                :options="resource_group_detail"
+                :value="scope.row.commonType"
+              />
             </template>
           </el-table-column>
-          <el-table-column fixed="right" label="操作" align="center" width="140px">
+          <el-table-column
+            fixed="right"
+            label="操作"
+            align="center"
+            width="140px"
+          >
             <template #default="scope">
-              <el-button link type="danger" icon="Delete" @click="handleDeleteResource(scope.row)">删除</el-button>
+              <el-button
+                link
+                type="danger"
+                icon="Delete"
+                @click="handleDeleteResource(scope.row)"
+                >删除</el-button
+              >
             </template>
           </el-table-column>
         </el-table>
       </div>
-      <person ref="personRef" :multiple=true :multipleSelected="handleResourcePersonMultipleSelected" />
-      <equipment ref="equipmentRef" :multiple="true" :multipleSelected="handleResourceMultipleSelected" />
+      <person
+        ref="personRef"
+        :multiple="true"
+        :multipleSelected="handleResourcePersonMultipleSelected"
+      />
+      <equipment
+        ref="equipmentRef"
+        :multiple="true"
+        :multipleSelected="handleResourceMultipleSelected"
+      />
     </div>
   </el-drawer>
 </template>
 <script setup>
-import { detailList } from '@/api/business/equipment'
-import { getResourceGroup, addResourceGroup } from '@/api/business/resourceGroup'
-import person from '@/views/dialog/person.vue'
-import equipment from '@/views/dialog/equipment.vue'
-const { proxy } = getCurrentInstance()
-const emit = defineEmits(['handleSaveResourceSuccess'])
-const { resource_group_detail } = proxy.useDict('resource_group_detail')
-const queryParams = ref({
-  pageNum: 1,
-  pageSize: 10
-})
-
-const selections = ref([])
-const loading = ref(false)
-const title = ref('资源组信息')
-const equipmentDetailList = ref([])
-const detailTotal = ref(0)
-const personRef = ref(null)
-const equipmentRef = ref(null)
-const visible = ref(false)
-const props = defineProps({
-  multipleSelected: {
-    type: Function,
-    default: null
-  }
-})
-const { multipleSelected } = toRefs(props)
+import {
+  getResourceGroup,
+  addResourceGroup,
+} from "@/api/business/resourceGroup";
+import person from "@/views/dialog/person.vue";
+import equipment from "@/views/dialog/equipment.vue";
+const { proxy } = getCurrentInstance();
+const emit = defineEmits(["handleSaveResourceSuccess"]);
+/** 字典数组区 */
+const { resource_group_detail } = proxy.useDict("resource_group_detail");
+/** 表单抽屉 页变量 */
+const selections = ref([]);
+const loading = ref(false);
+const personRef = ref(null);
+const equipmentRef = ref(null);
+const visible = ref(false);
+/** 查询对象 */
 const data = reactive({
   form: {
     groupDetailList: [],
-    code: '',
-    remark: ''
+    code: "",
+    remark: "",
   },
   rules: {
-    code: [{ required: true, message: '资源组编码不能为空', trigger: 'blur' }]
-  }
-})
-const { form, rules } = toRefs(data)
+    code: [{ required: true, message: "资源组编码不能为空", trigger: "blur" }],
+  },
+});
+const { form, rules } = toRefs(data);
 
 /***********************  方法区  ****************************/
 /** 打开抽屉 */
 const open = (row) => {
-  reset()
-  loading.value = true
-  form.value.deptId = row.deptId
+  reset();
+  loading.value = true;
+  form.value.deptId = row.deptId;
   if (row.id) {
-    form.value = row
-    console.log(form.value.id)
+    form.value = row;
+    console.log(form.value.id);
     getResourceGroup(form.value.id).then((res) => {
       if (res.code == 200) {
-        form.value = res.data
+        form.value = res.data;
       }
-    })
+    });
   }
-  loading.value = false
-
-  visible.value = true
-}
+  loading.value = false;
+  visible.value = true;
+};
 
 /**
  * 列表checkbox列选择 事件
  */
 function handleSelectionChange(selection) {
-  selections.value = selection
-}
-/** 多选事件 */
-function handleMultipleSelected() {
-  if (multipleSelected.value) {
-    multipleSelected.value(selections.value)
-  }
-  close()
+  selections.value = selection;
 }
+/**打开员工/设备弹窗 */
 function handleOpenPerson(type) {
-  if (type === 'person') {
-    var userInfo = {}
-    userInfo.identifying = false
-    userInfo.deptId = form.value.deptId
-    userInfo.userIds = []
+  if (type === "person") {
+    var userInfo = {};
+    userInfo.identifying = false;
+    userInfo.deptId = form.value.deptId;
+    userInfo.userIds = [];
     form.value.groupDetailList.map((item) => {
-      if (item.commonType === 'person') {
-        userInfo.userIds.push(item.commonCode)
+      if (item.commonType === "person") {
+        userInfo.userIds.push(item.commonCode);
       }
-    })
-    proxy.$refs.personRef.open(userInfo)
-  } else if (type === 'equipment') {
-    var equipmentInfo = {}
-    equipmentInfo.deptId = form.value.deptId
-    equipmentInfo.equipmentCodeIds = []
+    });
+    proxy.$refs.personRef.open(userInfo);
+  } else if (type === "equipment") {
+    var equipmentInfo = {};
+    equipmentInfo.deptId = form.value.deptId;
+    equipmentInfo.equipmentCodeIds = [];
     form.value.groupDetailList.map((item) => {
-      if (item.commonType === 'equipmentDetail') {
-        equipmentInfo.equipmentCodeIds.push(item.commonCode)
+      if (item.commonType === "equipmentDetail") {
+        equipmentInfo.equipmentCodeIds.push(item.commonCode);
       }
-    })
-    proxy.$refs.equipmentRef.open(equipmentInfo)
+    });
+    proxy.$refs.equipmentRef.open(equipmentInfo);
   }
 }
 /**
@@ -159,89 +207,90 @@ function handleOpenPerson(type) {
  */
 function handleResourceMultipleSelected(section) {
   for (var i = 0; i < section.length; i++) {
-    var item = {}
-    item.commonId = section[i].id
-    item.commonCode = section[i].equipmentCode
-    item.commonName = section[i].equipmentName
-    item.commonType = 'equipmentDetail'
-    form.value.groupDetailList.push(item)
+    var item = {};
+    item.commonId = section[i].id;
+    item.commonCode = section[i].equipmentCode;
+    item.commonName = section[i].equipmentName;
+    item.commonType = "equipmentDetail";
+    form.value.groupDetailList.push(item);
   }
 }
 
 /**批量删除 */
 function handleDelete() {
-  form.value.groupDetailList = form.value.groupDetailList.filter((item) => !selections.value.some((selectedItem) => selectedItem === item))
+  form.value.groupDetailList = form.value.groupDetailList.filter(
+    (item) => !selections.value.some((selectedItem) => selectedItem === item)
+  );
 }
 /**人员多选带回 */
 function handleResourcePersonMultipleSelected(section) {
-  console.log(section)
+  console.log(section);
   for (var i = 0; i < section.length; i++) {
-    let item = {}
-    item.commonId = section[i].userId
-    item.commonCode = section[i].userName
-    item.commonName = section[i].nickName
-    item.commonType = 'person'
-    form.value.groupDetailList.push(item)
+    let item = {};
+    item.commonId = section[i].userId;
+    item.commonCode = section[i].userName;
+    item.commonName = section[i].nickName;
+    item.commonType = "person";
+    form.value.groupDetailList.push(item);
   }
 }
 /**
  * 对话框关闭 事件
  */
 function close() {
-  reset()
-  visible.value = false
+  reset();
+  visible.value = false;
 }
 /** 表单重置 */
 function reset() {
   form.value = {
     code: null,
     remark: null,
-    groupDetailList: []
-  }
-  proxy.resetForm('formRef')
+    groupDetailList: [],
+  };
+  proxy.resetForm("formRef");
 }
 
 /** 提交按钮 */
 const handleSave = () => {
-  proxy.$refs['formRef'].validate((valid) => {
+  proxy.$refs["formRef"].validate((valid) => {
     if (valid) {
       if (!form.value.groupDetailList) {
-        proxy.$modal.msg('资源组信息不能为空')
-      }
-      else {
-        var personInfo = []
+        proxy.$modal.msg("资源组信息不能为空");
+      } else {
+        var personInfo = [];
         form.value.groupDetailList.map((item) => {
-          if (item.commonType === 'person') {
-            personInfo.push(item.commonCode)
+          if (item.commonType === "person") {
+            personInfo.push(item.commonCode);
           }
-        })
-        if(personInfo.length == 0) {
-          proxy.$modal.msg('至少有一名资源组成员')
-        }
-        else {
+        });
+        if (personInfo.length == 0) {
+          proxy.$modal.msg("至少有一名资源组成员");
+        } else {
           addResourceGroup(form.value).then((res) => {
-        if (res.code == 200) {
-          emit('handleSaveResourceSuccess')
-          close()
-        }
-      })     
+            if (res.code == 200) {
+              emit("handleSaveResourceSuccess");
+              close();
+            }
+          });
         }
       }
     }
-  })
-}
+  });
+};
+/**删除资源组明细 */
 function handleDeleteResource(row) {
-  form.value.groupDetailList.splice(form.value.groupDetailList.indexOf(row), 1)
+  form.value.groupDetailList.splice(form.value.groupDetailList.indexOf(row), 1);
 }
 
 /** 取消按钮 */
 const handleCancel = () => {
-  visible.value = false
-  reset()
-}
+  visible.value = false;
+  reset();
+};
 
 /** 暴露给父组件的方法 */
 defineExpose({
-  open
-})
+  open,
+});
 </script>

+ 387 - 236
src/views/business/deptEquipment/index.vue

@@ -3,24 +3,37 @@
     <!-- 左侧区域 -->
     <section class="list-part-container">
       <!-- 搜索区域 -->
-      <el-form class="list-search-container" :inline="true" style="display:flex ;">
+      <el-form
+        class="list-search-container"
+        :inline="true"
+        style="display: flex"
+      >
         <el-form-item class="section-title" label="工段列表" />
-        <!-- <el-form-item label="工段编码:" prop="deptCode" style="margin-left: 24px;">
-          <el-input v-model.trim="queryDeptParams.deptCode" placeholder="请输入工段编码" clearable style="width: 155px" @keyup.enter="handleQueryUser" @keydown.enter.prevent  />
-        </el-form-item>
-        <el-form-item label="工段名称:" prop="deptName">
-          <el-input v-model.trim="queryDeptParams.deptName" placeholder="请输入工段名称" clearable style="width: 155px" @keyup.enter="handleQueryUser" @keydown.enter.prevent  />
-        </el-form-item>
-        <el-form-item>
-          <el-button type="info" icon="Search" @click="handleQueryUser">搜索</el-button>
-        </el-form-item> -->
       </el-form>
       <!-- 列表区 -->
       <div class="el-table-container">
         <div class="el-table-inner-container">
-          <el-table ref="workSectionTable" v-loading="workSectionLoading" :data="workSectionList" row-key="id" height="100%" highlight-current-row @current-change="handleWorkSectionChange">
-            <el-table-column label="行号" type="index" width="50" align="center" />
-            <el-table-column label="工段编码" prop="deptCode" width="80" align="center" />
+          <el-table
+            ref="workSectionTable"
+            v-loading="workSectionLoading"
+            :data="workSectionList"
+            row-key="id"
+            height="100%"
+            highlight-current-row
+            @current-change="handleWorkSectionChange"
+          >
+            <el-table-column
+              label="行号"
+              type="index"
+              width="50"
+              align="center"
+            />
+            <el-table-column
+              label="工段编码"
+              prop="deptCode"
+              width="80"
+              align="center"
+            />
             <el-table-column label="工段名称" prop="label" align="center" />
           </el-table>
         </div>
@@ -30,40 +43,86 @@
     <!-- 右侧区域 -->
     <section class="list-part-container column-container" style="flex: 3">
       <section class="list-part-container row-container" style="flex: 1">
-        <section class="list-part-container" >
+        <section class="list-part-container">
           <!-- 搜索区域 -->
-          <el-form class="list-search-container" :inline="true" style="display:flex ;">
+          <el-form
+            class="list-search-container"
+            :inline="true"
+            style="display: flex"
+          >
             <el-form-item class="section-title" label="资源组" />
-            <el-form-item >
-              <el-button type="primary" icon="Plus" :disabled="workSectionList.length === 0" @click="handleShowEquipmentFormDialog()" v-hasPermi="['business:deptEquipment:add']">新增</el-button>
+            <el-form-item>
+              <el-button
+                type="primary"
+                icon="Plus"
+                :disabled="workSectionList.length === 0"
+                @click="handleShowResourceGroupDetailForm()"
+                v-hasPermi="['business:deptEquipment:add']"
+                >新增</el-button
+              >
             </el-form-item>
             <el-form-item label="资源组名称:">
-          <el-input
-            v-model.trim="queryParams.code"
-            type="text"
-            style="width: 200px"
-            :disabled="workSectionList.length === 0"
-            placeholder="请输入资源组名称"
-            :clearable="true"
-            @keydown.enter.prevent
-            @keyup.enter="handleQueryResourceGroup"
-          />
-        </el-form-item>
-        <el-form-item>
-          <el-button type="info" icon="Search" :disabled="workSectionList.length === 0" @click="handleQueryResourceGroup">搜索</el-button>
-        </el-form-item>
+              <el-input
+                v-model.trim="queryParams.code"
+                type="text"
+                style="width: 200px"
+                :disabled="workSectionList.length === 0"
+                placeholder="请输入资源组名称"
+                :clearable="true"
+                @keydown.enter.prevent
+                @keyup.enter="handleQueryResourceGroup"
+              />
+            </el-form-item>
+            <el-form-item>
+              <el-button
+                type="info"
+                icon="Search"
+                :disabled="workSectionList.length === 0"
+                @click="handleQueryResourceGroup"
+                >搜索</el-button
+              >
+            </el-form-item>
           </el-form>
           <!-- 列表区 -->
           <div class="el-table-container">
             <div class="el-table-inner-container">
-              <el-table ref="groupTable" v-loading="groupLoading" :data="groupList" row-key="id" height="100%" highlight-current-row @current-change="handleGroupChange">
-                <el-table-column label="行号" type="index" width="50" align="center" />
-                <el-table-column label="资源组名称" prop="code" align="center" />
+              <el-table
+                ref="groupTable"
+                v-loading="groupLoading"
+                :data="groupList"
+                row-key="id"
+                height="100%"
+                highlight-current-row
+                @current-change="handleGroupChange"
+              >
+                <el-table-column
+                  label="行号"
+                  type="index"
+                  width="50"
+                  align="center"
+                />
+                <el-table-column
+                  label="资源组名称"
+                  prop="code"
+                  align="center"
+                />
                 <el-table-column label="操作" width="150" align="center">
                   <template #default="scope">
-                    <el-button icon="edit" link type="warning" @click="handleShowEquipmentFormDialog(scope.row)" v-hasPermi="['business:deptEquipment:edit']">编辑
+                    <el-button
+                      icon="edit"
+                      link
+                      type="warning"
+                      @click="handleShowResourceGroupDetailForm(scope.row)"
+                      v-hasPermi="['business:deptEquipment:edit']"
+                      >编辑
                     </el-button>
-                    <el-button icon="delete" link type="danger" @click="handledelGroup(scope.row)" v-hasPermi="['business:deptEquipment:remove']">删除
+                    <el-button
+                      icon="delete"
+                      link
+                      type="danger"
+                      @click="handledelGroup(scope.row)"
+                      v-hasPermi="['business:deptEquipment:remove']"
+                      >删除
                     </el-button>
                   </template>
                 </el-table-column>
@@ -72,48 +131,79 @@
           </div>
         </section>
         <section class="list-part-container" style="flex: 2">
-          <el-form class="list-search-container" :inline="true" style="display: flex;">
-
-            <el-form-item class="section-title" label="资源组明细" label-width="70px" />
-            <el-form-item label="资源明细:" >
-          <el-input
-            v-model.trim="queryResourceGroupDetailParams.commonCode"
-            type="text"
-            style="width: 220px"
-            placeholder="请输入资源编码/资源名称"
-            :clearable="true"
-            :disabled="groupList.length === 0"
-            @keydown.enter.prevent
-            @keyup.enter="handleQueryResourceGroupDetail"
-          />
-        </el-form-item>
-        <el-form-item style="margin-right: 0px;">
-          <el-button type="info" icon="Search" :disabled="groupList.length === 0" @click="handleQueryResourceGroupDetail">搜索</el-button>
-        </el-form-item>
+          <el-form
+            class="list-search-container"
+            :inline="true"
+            style="display: flex"
+          >
+            <el-form-item
+              class="section-title"
+              label="资源组明细"
+              label-width="70px"
+            />
+            <el-form-item label="资源明细:">
+              <el-input
+                v-model.trim="queryResourceGroupDetailParams.commonCode"
+                type="text"
+                style="width: 220px"
+                placeholder="请输入资源编码/资源名称"
+                :clearable="true"
+                :disabled="groupList.length === 0"
+                @keydown.enter.prevent
+                @keyup.enter="handleQueryResourceGroupDetail"
+              />
+            </el-form-item>
+            <el-form-item style="margin-right: 0px">
+              <el-button
+                type="info"
+                icon="Search"
+                :disabled="groupList.length === 0"
+                @click="handleQueryResourceGroupDetail"
+                >搜索</el-button
+              >
+            </el-form-item>
           </el-form>
           <!-- 列表区 -->
           <div class="el-table-container">
             <div class="el-table-inner-container">
-              <el-table ref="groupDetailTable" v-loading="groupDetailLoading" :data="groupDetailList" row-key="id" height="100%" highlight-current-row>
-                <el-table-column label="行号" type="index" width="50" align="center" />
-                <el-table-column label="资源编码" prop="commonCode" width="80" align="center" />
-                <el-table-column label="资源名称" prop="commonName"  align="center" />
-                <el-table-column label="资源类别" prop="commonType" width="70" align="center">
+              <el-table
+                ref="groupDetailTable"
+                v-loading="groupDetailLoading"
+                :data="groupDetailList"
+                row-key="id"
+                height="100%"
+                highlight-current-row
+              >
+                <el-table-column
+                  label="行号"
+                  type="index"
+                  width="50"
+                  align="center"
+                />
+                <el-table-column
+                  label="资源编码"
+                  prop="commonCode"
+                  width="80"
+                  align="center"
+                />
+                <el-table-column
+                  label="资源名称"
+                  prop="commonName"
+                  align="center"
+                />
+                <el-table-column
+                  label="资源类别"
+                  prop="commonType"
+                  width="70"
+                  align="center"
+                >
                   <template #default="scope">
-                    <dict-tag :options="resource_group_detail" :value="scope.row.commonType" />
+                    <dict-tag
+                      :options="resource_group_detail"
+                      :value="scope.row.commonType"
+                    />
                   </template>
                 </el-table-column>
-                <!-- <el-table-column label="是否临时" prop="protemDayworkId" width="70" align="center">
-                  <template #default="scope">
-                    <dict-tag :options="temporary_status" :value="scope.row.protemDayworkId" />
-                  </template>
-                </el-table-column> -->
-                <!-- <el-table-column label="操作" width="150" align="center">
-                  <template #default="scope">
-                    <el-button icon="delete" link type="danger" @click="handledelGroupDetail(scope.row)" v-hasPermi="['business:deptEquipment:remove']">删除
-                    </el-button>
-                  </template>
-                </el-table-column> -->
               </el-table>
             </div>
           </div>
@@ -121,283 +211,344 @@
       </section>
 
       <section class="list-part-container column-container" style="flex: 1">
-
         <el-form class="list-search-container" :inline="true">
           <el-form-item class="section-title" label="添加工序" />
           <el-form-item>
-            <el-button type="primary" icon="Plus" :disabled="workSectionList.length === 0" @click="handleShowProcessFormDialog()" v-hasPermi="['business:deptEquipment:add']">新增</el-button>
-            <el-button type="danger" icon="Delete" @click="handledelDeptProcess" :disabled="deptProcessIds.length === 0" v-hasPermi="['business:deptEquipment:remove']">
+            <el-button
+              type="primary"
+              icon="Plus"
+              :disabled="workSectionList.length === 0"
+              @click="handleShowProcessFormDialog()"
+              v-hasPermi="['business:deptEquipment:add']"
+              >新增</el-button
+            >
+            <el-button
+              type="danger"
+              icon="Delete"
+              @click="handledelDeptProcess"
+              :disabled="deptProcessIds.length === 0"
+              v-hasPermi="['business:deptEquipment:remove']"
+            >
               删除
             </el-button>
           </el-form-item>
-          <el-form-item label="工序名称:" >
-          <el-input v-model.trim="queryDeptProcessParams.processAlias" placeholder="请输入工序名称" :disabled="workSectionList.length === 0" clearable style="width: 155px" @keyup.enter="handleQueryProcess" @keydown.enter.prevent  />
-        </el-form-item>
-        <el-form-item>
-          <el-button type="info" icon="Search" :disabled="workSectionList.length === 0"  @click="handleQueryProcess">搜索</el-button>
-        </el-form-item>
+          <el-form-item label="工序名称:">
+            <el-input
+              v-model.trim="queryDeptProcessParams.processAlias"
+              placeholder="请输入工序名称"
+              :disabled="workSectionList.length === 0"
+              clearable
+              style="width: 155px"
+              @keyup.enter="handleQueryProcess"
+              @keydown.enter.prevent
+            />
+          </el-form-item>
+          <el-form-item>
+            <el-button
+              type="info"
+              icon="Search"
+              :disabled="workSectionList.length === 0"
+              @click="handleQueryProcess"
+              >搜索</el-button
+            >
+          </el-form-item>
         </el-form>
         <div class="el-table-container">
           <div class="el-table-inner-container">
-            <el-table v-loading="deptProcessLoading" :data="deptProcessList" row-key="id" height="100%" @selection-change="deptProcessSelectionChange">
-              <el-table-column type="selection" width="40" align="center" :reserve-selection="true"  />
-              <el-table-column label="行号" type="index" width="50" align="center" />
-              <el-table-column label="工序编码" prop="processCode" align="center" />
-              <el-table-column label="工序名称" prop="processAlias" align="center" />
+            <el-table
+              v-loading="deptProcessLoading"
+              :data="deptProcessList"
+              row-key="id"
+              height="100%"
+              @selection-change="deptProcessSelectionChange"
+            >
+              <el-table-column
+                type="selection"
+                width="40"
+                align="center"
+                :reserve-selection="true"
+              />
+              <el-table-column
+                label="行号"
+                type="index"
+                width="50"
+                align="center"
+              />
+              <el-table-column
+                label="工序编码"
+                prop="processCode"
+                align="center"
+              />
+              <el-table-column
+                label="工序名称"
+                prop="processAlias"
+                align="center"
+              />
             </el-table>
           </div>
         </div>
-        <pagination v-show="deptProcessTotal > 0" :total="deptProcessTotal" v-model:page="queryDeptProcessParams.pageNum" v-model:limit="queryDeptProcessParams.pageSize" @pagination="getDeptProcess" />
+        <pagination
+          v-show="deptProcessTotal > 0"
+          :total="deptProcessTotal"
+          v-model:page="queryDeptProcessParams.pageNum"
+          v-model:limit="queryDeptProcessParams.pageSize"
+          @pagination="getDeptProcess"
+        />
       </section>
     </section>
-    <resource-group-form ref="resourceGroupFormRef" @handleSaveResourceSuccess="handleRefreshEquipment" />
-    <process-form ref="processFormRef" :multipleSelected="handleProcessMultipleSelected" @handleSaveSuccess="handleRefreshProcess" />
+    <!-- 资源组明细表单 -->
+    <resource-group-form
+      ref="resourceGroupFormRef"
+      @handleSaveResourceSuccess="handleRefreshEquipment"
+    />
+    <!-- 工序弹窗 -->
+    <process-dialog
+      ref="processFormRef"
+      :multipleSelected="handleProcessMultipleSelected"
+      @handleSaveSuccess="handleRefreshProcess"
+    />
   </div>
 </template>
 
 <script setup>
-import { workSectionTree } from '@/api/system/dept'
-import { listResourceGroup, delResourceGroup } from '@/api/business/resourceGroup'
-import { delGroupDetail, listGroupDetail } from '@/api/business/resourceGroupDetail'
-import { listDeptProcess, addDeptProcess, delDeptProcess } from '@/api/business/deptProcess'
-import resourceGroupForm from './form'
-import processForm from './DialogProcessChoice'
-const { proxy } = getCurrentInstance()
-const { resource_group_detail } = proxy.useDict('resource_group_detail')
-const { temporary_status } = proxy.useDict('temporary_status')
-/** 设备档案 查询对象 */
+import { workSectionTree } from "@/api/system/dept";
+import {
+  listResourceGroup,
+  delResourceGroup,
+} from "@/api/business/resourceGroup";
+import { listGroupDetail } from "@/api/business/resourceGroupDetail";
+import {
+  listDeptProcess,
+  addDeptProcess,
+  delDeptProcess,
+} from "@/api/business/deptProcess";
+import resourceGroupForm from "./form";
+import processDialog from "./DialogProcessChoice";
+const { proxy } = getCurrentInstance();
+/** 字典数组区 */
+const { resource_group_detail } = proxy.useDict("resource_group_detail");
+/** 查询对象 */
 const data = reactive({
   form: {},
   queryDeptParams: {
-    deptName: '',
-    deptCode: ''
+    deptName: "",
+    deptCode: "",
   },
   queryParams: {
     pageNum: 1,
     pageSize: 10,
-    code:''
+    code: "",
   },
-  queryResourceGroupDetailParams : {
-    code:'',
-    productionResourceGroupId:''
+  queryResourceGroupDetailParams: {
+    code: "",
+    productionResourceGroupId: "",
   },
   queryDeptProcessParams: {
     pageNum: 1,
-    pageSize: 10
-  }
-})
-
-const { queryParams, queryDeptProcessParams, queryDeptParams,queryResourceGroupDetailParams } = toRefs(data)
+    pageSize: 10,
+  },
+});
 
-/** 查询 对象 */
-const currentGroup = ref({})
-const workSectionList = ref([])
-const groupList = ref([])
-const deptProcessList = ref([])
-const workSectionLoading = ref(false)
-const groupDetailLoading = ref(false)
-const groupLoading = ref(false)
-const deptProcessLoading = ref(false)
-const groupTotal = ref(0)
-const groupDetailList = ref([])
-const deptProcessTotal = ref(0)
-const single = ref(true)
-const currentWorkSection = ref({})
-const ids = ref([])
-const deptProcessIds = ref([])
+const {
+  queryParams,
+  queryDeptProcessParams,
+  queryDeptParams,
+  queryResourceGroupDetailParams,
+} = toRefs(data);
+/** 页面变量 */
+/**工段 */
+const workSectionList = ref([]);
+const workSectionLoading = ref(false);
+const currentWorkSection = ref({});
+/**资源组 */
+const currentGroup = ref({});
+const groupList = ref([]);
+const groupLoading = ref(false);
+/**资源组明细 */
+const groupDetailLoading = ref(false);
+const groupDetailList = ref([]);
+/**工序 */
+const deptProcessList = ref([]);
+const deptProcessLoading = ref(false);
+const deptProcessTotal = ref(0);
+const deptProcessIds = ref([]);
+const single = ref(true);
 
 /****************************  工段方法区  ****************************/
 
 /** 获取工段列表 */
 function getWorkSections() {
-  workSectionLoading.value = true
-  queryDeptParams.value.getType = true
+  workSectionLoading.value = true;
+  queryDeptParams.value.getType = true;
   workSectionTree(queryDeptParams.value).then((res) => {
-    workSectionList.value = res.data
+    workSectionList.value = res.data;
     if (workSectionList.value.length > 0) {
-      proxy.$refs.workSectionTable.setCurrentRow(workSectionList.value[0])
-    }
-    else{
-      workSectionList.value=[]
+      proxy.$refs.workSectionTable.setCurrentRow(workSectionList.value[0]);
+    } else {
+      workSectionList.value = [];
     }
-    workSectionLoading.value = false
-  })
+    workSectionLoading.value = false;
+  });
 }
 /**工段点击事件 */
 const handleWorkSectionChange = (row) => {
-  queryParams.value.code = ''
-  queryResourceGroupDetailParams.value.commonCode = ''
-  queryDeptProcessParams.value.processAlias = ''
+  queryParams.value.code = "";
+  queryResourceGroupDetailParams.value.commonCode = "";
+  queryDeptProcessParams.value.processAlias = "";
   if (row) {
-    currentWorkSection.value = row
-    queryParams.value.deptId = row.id
-
-    getResourceGroup()
-    getDeptProcess()
+    currentWorkSection.value = row;
+    queryParams.value.deptId = row.id;
+    getResourceGroup();
+    getDeptProcess();
   }
-}
-function handleQueryUser() {
-  queryParams.value.code = ''
-  queryResourceGroupDetailParams.value.commonCode = ''
-  queryDeptProcessParams.value.processAlias = ''
-  getWorkSections()
-}
+};
 
 /****************************  资源组方法区  ****************************/
+/**获取资源组 */
 function getResourceGroup() {
-  groupLoading.value = true
+  groupLoading.value = true;
   listResourceGroup(queryParams.value).then((res) => {
     if (res.code == 200) {
-      groupList.value = res.rows
+      groupList.value = res.rows;
       if (groupList.value.length > 0) {
-        currentGroup.value = groupList.value[0]
-        proxy.$refs.groupTable.setCurrentRow(groupList.value[0])
+        currentGroup.value = groupList.value[0];
+        proxy.$refs.groupTable.setCurrentRow(groupList.value[0]);
       } else {
-        groupDetailList.value = []
+        groupDetailList.value = [];
       }
     }
-    groupLoading.value = false
-  })
+    groupLoading.value = false;
+  });
 }
+/**资源组搜索 */
 function handleQueryResourceGroup() {
-  getResourceGroup()
+  getResourceGroup();
 }
 /**资源组点击事件 */
 function handleGroupChange(row) {
-  queryResourceGroupDetailParams.value.commonCode = ''
+  queryResourceGroupDetailParams.value.commonCode = "";
   if (row) {
-    currentGroup.value = row
-    getResourceGroupDetail()
+    currentGroup.value = row;
+    getResourceGroupDetail();
   }
 }
+/**删除资源组 */
+function handledelGroup(row) {
+  proxy.$modal
+    .confirm("是否确认删除选中的数据项?")
+    .then(function () {
+      return delResourceGroup(row.id);
+    })
+    .then(() => {
+      handleWorkSectionChange(currentWorkSection.value);
+      proxy.$modal.msgSuccess("删除成功!");
+    });
+}
 
-/** 打开设备对话框事件 */
-function handleShowEquipmentFormDialog(row) {
+/** 打开资源组明细表单 */
+function handleShowResourceGroupDetailForm(row) {
   if (row) {
-    console.log(row)
-    row.deptId = currentWorkSection.value.id
-    proxy.$refs.resourceGroupFormRef.open(row)
+    row.deptId = currentWorkSection.value.id;
+    proxy.$refs.resourceGroupFormRef.open(row);
   } else {
-    var item = {}
-    item.deptId = currentWorkSection.value.id
-    proxy.$refs.resourceGroupFormRef.open(item)
+    var item = {};
+    item.deptId = currentWorkSection.value.id;
+    proxy.$refs.resourceGroupFormRef.open(item);
   }
 }
 
 /** 刷新资源组事件 */
 function handleRefreshEquipment() {
-  handleWorkSectionChange(currentWorkSection.value)
- // handleGroupChange(currentGroup.value)
+  handleWorkSectionChange(currentWorkSection.value);
 }
+/****************************  资源明细方法区  ****************************/
 /**资源组明细获取方法 */
 function getResourceGroupDetail() {
-  groupDetailLoading.value = true
-  queryResourceGroupDetailParams.value.productionResourceGroupId = currentGroup.value.id
+  groupDetailLoading.value = true;
+  queryResourceGroupDetailParams.value.productionResourceGroupId =
+    currentGroup.value.id;
   listGroupDetail(queryResourceGroupDetailParams.value).then((res) => {
     if (res.code == 200) {
-      groupDetailList.value = res.rows.filter(obj => obj.protemDayworkId == 0);
-      console.log(groupDetailList.value)
+      groupDetailList.value = res.rows.filter(
+        (obj) => obj.protemDayworkId == 0
+      );
+      console.log(groupDetailList.value);
     }
-  })
-  groupDetailLoading.value = false
+  });
+  groupDetailLoading.value = false;
 }
-
+/**资源组明细搜索 */
 function handleQueryResourceGroupDetail() {
-  getResourceGroupDetail()
+  getResourceGroupDetail();
 }
 
 /*******************************工序方法区*********************************** */
-
+/**获取工序 */
 const getDeptProcess = () => {
-  deptProcessLoading.value = true
-  queryDeptProcessParams.value.deptId = currentWorkSection.value.id
+  deptProcessLoading.value = true;
+  queryDeptProcessParams.value.deptId = currentWorkSection.value.id;
   listDeptProcess(queryDeptProcessParams.value).then((res) => {
-    deptProcessList.value = res.rows
-    deptProcessLoading.value = false
-    deptProcessTotal.value = res.total
-  })
-}
+    deptProcessList.value = res.rows;
+    deptProcessLoading.value = false;
+    deptProcessTotal.value = res.total;
+  });
+};
+/**工序搜索框 */
 function handleQueryProcess() {
-  getDeptProcess()
+  getDeptProcess();
 }
 /** 打开工序对话框事件 */
 function handleShowProcessFormDialog() {
-  proxy.$refs.processFormRef.open(currentWorkSection.value.id)
+  proxy.$refs.processFormRef.open(currentWorkSection.value.id);
 }
 
 /**工序多选带回 */
 function handleProcessMultipleSelected(selection) {
-  var addDeptProcessList = []
+  var addDeptProcessList = [];
   for (var i = 0; i < selection.length; i++) {
-    var deptProcessAdd = {}
-    deptProcessAdd.deptId = currentWorkSection.value.id
-    deptProcessAdd.processId = selection[i].id
-    deptProcessAdd.processCode = selection[i].processCode
-    deptProcessAdd.processAlias = selection[i].processAlias
-    addDeptProcessList.push(deptProcessAdd)
+    var deptProcessAdd = {};
+    deptProcessAdd.deptId = currentWorkSection.value.id;
+    deptProcessAdd.processId = selection[i].id;
+    deptProcessAdd.processCode = selection[i].processCode;
+    deptProcessAdd.processAlias = selection[i].processAlias;
+    addDeptProcessList.push(deptProcessAdd);
   }
   addDeptProcess(addDeptProcessList).then((res) => {
     if (res.code == 200) {
-      proxy.$modal.msgSuccess('保存成功')
-      handleWorkSectionChange(currentWorkSection.value)
+      proxy.$modal.msgSuccess("保存成功");
+      handleWorkSectionChange(currentWorkSection.value);
     }
-  })
+  });
 }
 
 /** 刷新工序区事件 */
 function handleRefreshProcess(row) {
-  getDeptProcess()
+  getDeptProcess();
 }
 
 //工段工序多选框选中数据
 function deptProcessSelectionChange(selection) {
-  deptProcessIds.value = selection.map((item) => item.id)
-  single.value = selection.length != 1
-}
-/**删除资源组 */
-function handledelGroup(row) {
-  proxy.$modal
-    .confirm('是否确认删除选中的数据项?')
-    .then(function () {
-      return delResourceGroup(row.id)
-    })
-    .then(() => {
-      handleWorkSectionChange(currentWorkSection.value)
-      proxy.$modal.msgSuccess('删除成功!')
-    })
-}
-/**删除资源组明细 */
-function handledelGroupDetail(row) {
-  proxy.$modal
-    .confirm('是否确认删除选中的数据项?')
-    .then(function () {
-      return delGroupDetail(row.id)
-    })
-    .then(() => {
-      getResourceGroup()
-      proxy.$modal.msgSuccess('删除成功!')
-    })
-    .catch((e) => {
-      proxy.$modal.msg('操作失败!')
-    })
+  deptProcessIds.value = selection.map((item) => item.id);
+  single.value = selection.length != 1;
 }
+
 /**删除工序工段表数据 */
 function handledelDeptProcess() {
   proxy.$modal
-    .confirm('是否确认删除选中的数据项?')
+    .confirm("是否确认删除选中的数据项?")
     .then(function () {
-      return delDeptProcess(deptProcessIds.value)
+      return delDeptProcess(deptProcessIds.value);
     })
     .then(() => {
-      getDeptProcess()
-      proxy.$modal.msgSuccess('删除成功!')
+      getDeptProcess();
+      proxy.$modal.msgSuccess("删除成功!");
     })
     .catch((e) => {
-      proxy.$modal.msg('操作失败!')
-    })
+      proxy.$modal.msg("操作失败!");
+    });
 }
 
 onMounted(() => {
-  getWorkSections()
-})
+  getWorkSections();
+});
 </script>

+ 6 - 10
src/views/business/employee/index.vue

@@ -286,22 +286,20 @@ import {
   addUser,
 } from "@/api/system/user";
 import { listInfo } from "@/api/business/tenant";
-
 const { proxy } = getCurrentInstance();
-const { sys_user_sex } = proxy.useDict("sys_user_sex");
-
+/** 员工管理变量 */
 const userList = ref([]);
-const contractCompanyList = ref([]);
-const open = ref(false);
 const loading = ref(true);
 const showSearch = ref(true);
+const total = ref(0);
+/** 员工信息弹窗变量 */
+const contractCompanyList = ref([]);
+const open = ref(false);
 const ids = ref([]);
 const single = ref(true);
 const multiple = ref(true);
-const total = ref(0);
 const roleOptions = ref([]);
 const usageCompanyList = ref([]);
-const initPassword = ref(undefined);
 const manOrWoman = [
   { label: "男", value: "1" },
   { label: "女", value: "0" },
@@ -317,7 +315,7 @@ const columns = ref([
   { key: 5, label: `状态`, visible: true },
   { key: 6, label: `创建时间`, visible: true },
 ]);
-
+/** 查询对象 */
 const data = reactive({
   form: {
     usageCompanyId: null,
@@ -349,7 +347,6 @@ const data = reactive({
     ],
     password: [{ required: true, message: "密码不能为空", trigger: "blur" }],
     tenantId: [{ required: true, message: "合同单位不能为空", trigger: "change" }],
-    // phoneNumber: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '请输入正确的手机号码', trigger: 'blur' }]
   },
 });
 
@@ -378,7 +375,6 @@ function getList() {
     total.value = response.total;
   loading.value = false;
   });
- 
 }
 
 /** 搜索按钮操作 */

+ 1 - 2
src/views/business/equipment/formCategory.vue

@@ -31,9 +31,8 @@ import { getCategory, saveCategory } from '@/api/business/equipment'
 
 const emit = defineEmits(['handleSaveSuccess'])
 const { proxy } = getCurrentInstance()
-
-const loading = ref(false)
 /** 父类别 */
+const loading = ref(false)
 const parentCategories = ref([])
 const visible = ref(false)
 const data = reactive({

+ 0 - 1
src/views/business/equipment/formDoc.vue

@@ -26,7 +26,6 @@ import { getEquipment, saveEquipment } from '@/api/business/equipment'
 const { proxy } = getCurrentInstance()
 const emit = defineEmits(['handleSaveSuccess'])
 
-/** 字典数组区 */
 /** 表单抽屉 页变量 */
 const loading = ref(false)
 const visible = ref(false)

+ 48 - 87
src/views/business/equipment/index.vue

@@ -1,9 +1,9 @@
 <template>
   <div class="page-container row-container">
     <!-- 左侧区域 -->
-    <section class="list-part-container" >
+    <section class="list-part-container">
       <!-- 搜索区域 -->
-      <el-form class="list-search-container" :inline="true" >
+      <el-form class="list-search-container" :inline="true">
         <el-form-item class="section-title" label="设备类别" />
         <el-form-item label="设备类别名称:">
           <el-input
@@ -27,7 +27,7 @@
       </el-form>
       <!-- 设备类别列表区域 -->
       <div class="el-table-container">
-        <div class="el-table-inner-container" >
+        <div class="el-table-inner-container">
           <el-tree
             ref="categoryTable"
             v-loading="equipmentCategoryLoading"
@@ -38,7 +38,7 @@
             default-expand-all
             node-key="id"
             highlight-current
-            style="max-height: 100%; overflow-y: auto;margin-bottom: 20px;"
+            style="max-height: 100%; overflow-y: auto; margin-bottom: 20px"
             @node-click="handleCurrentCategoryChange"
           >
             <template #default="{ node, data }">
@@ -49,7 +49,7 @@
                   justify-content: space-between;
                 "
               >
-                  <span>{{ node.label }}</span>
+                <span>{{ node.label }}</span>
                 <span>
                   <el-button
                     link
@@ -104,7 +104,11 @@
           />
         </el-form-item>
         <el-form-item>
-          <el-button type="info" icon="Search" :disabled="equipmentCategoryList.length == 0" @click="handleRefreshEquipment"
+          <el-button
+            type="info"
+            icon="Search"
+            :disabled="equipmentCategoryList.length == 0"
+            @click="handleRefreshEquipment"
             >搜索</el-button
           >
         </el-form-item>
@@ -199,25 +203,6 @@
               </template>
             </el-table-column>
           </el-table>
-
-          <!-- <el-table ref="equipmentTable" v-loading="equipmentLoading" :data="equipmentList" height="100%">
-            <el-table-column label="行号" type="index" width="50" align="center" />
-            <el-table-column label="设备名称" prop="equipmentName" width="200" align="center" header-align="center" />
-            <el-table-column label="设备规格" prop="standard" width="130" align="center" />
-            <el-table-column label="设备数量" prop="equipmentNumber" width="80" align="center" />
-            <el-table-column label="备注" prop="remark" align="center" />
-            <el-table-column label="操作" width="220" align="center">
-              <template #default="scope">
-                <el-button link type="primary" icon="Edit" @click="handleShowEquipmentDetailDrawer(scope.row.id)">设备明细</el-button>
-                <el-button v-hasPermi="['business:equipment:edit']" link type="warning" icon="Edit" @click="handleShowEquipmentDocDialog(scope.row.id)">
-                  编辑
-                </el-button>
-                <el-button v-hasPermi="['business:equipment:remove']" link type="danger" icon="Delete" @click="handleDeleteEquipmentDoc(scope.row.id)">
-                  删除
-                </el-button>
-              </template>
-            </el-table-column>
-          </el-table> -->
         </div>
       </div>
       <pagination
@@ -228,12 +213,12 @@
         @pagination="getEquipmentList"
       />
     </section>
-    <!-- 分类表单 -->
+    <!-- 设备类别表单 -->
     <equipment-category-form
       ref="categoryRef"
       @handleSaveSuccess="handleRefreshCategory"
     />
-
+    <!-- 设备档案管理表单 -->
     <equipment-detail-form
       ref="detailRef"
       @handleSaveSuccess="handleRefreshDetail"
@@ -247,23 +232,20 @@ import equipmentDetailForm from "./formDetail";
 import {
   listCategory,
   delCategory,
-  listEquipment,
-  delEquipment,
-  downloadQcImgs,
-  download,
   detailList,
   delDetails,
 } from "@/api/business/equipment";
 const { proxy } = getCurrentInstance();
-const selections = ref([]);
 const webHost = import.meta.env.VITE_APP_PRODUCTION_API;
+/** 设备类别*/
 const categoryTable = ref(null);
 const currentCategory = ref({});
 const equipmentCategoryList = ref([]);
-const name = ref("");
 const equipmentCategoryTotal = ref(0);
+const name = ref("");
+/** 设备档案管理 */
+const selections = ref([]);
 const equipmentTable = ref(null);
-const equipmentList = ref([]);
 const equipmentTotal = ref(0);
 const equipmentDetailList = ref([]);
 const equipmentLoading = ref(false);
@@ -272,8 +254,6 @@ const equipmentCategoryLoading = ref(true);
 /** 设备类别 查询对象 */
 const queryEquipmentCategoryParams = ref({
   name: "",
-  // pageNum: 1,
-  // pageSize: 10,
 });
 
 /** 设备档案 查询对象 */
@@ -293,23 +273,22 @@ onMounted(() => {
 /****************************** 设备类别 事件处理区 ******************************/
 /** 获取设备分类列表 */
 const getCategoryList = () => {
-  queryParams.value.categoryId = null
+  queryParams.value.categoryId = null;
   equipmentCategoryLoading.value = true;
   listCategory(queryEquipmentCategoryParams.value).then((response) => {
     equipmentCategoryList.value = response.rows;
     equipmentCategoryTotal.value = response.total;
-    console.log(equipmentCategoryList.value.length)
-    if(equipmentCategoryList.value.length > 0) {
-    currentCategory.value = equipmentCategoryList.value[0];
-    nextTick(() => {
-      proxy.$refs.categoryTable.setCurrentKey(currentCategory.value.id)
-      handleCurrentCategoryChange(currentCategory.value)
-    })
-  }
-  else {
-    currentCategory.value = {}
-    equipmentDetailList.value = []
-  }
+    console.log(equipmentCategoryList.value.length);
+    if (equipmentCategoryList.value.length > 0) {
+      currentCategory.value = equipmentCategoryList.value[0];
+      nextTick(() => {
+        proxy.$refs.categoryTable.setCurrentKey(currentCategory.value.id);
+        handleCurrentCategoryChange(currentCategory.value);
+      });
+    } else {
+      currentCategory.value = {};
+      equipmentDetailList.value = [];
+    }
     equipmentCategoryLoading.value = false;
   });
 };
@@ -318,12 +297,10 @@ const handleShowEquipmentDetailDialog = (id) => {
   if (id) {
     var detailInfo = equipmentDetailList.value.filter((item) => item.id !== id);
     var equipmentCodeIds = detailInfo.map((item) => item.equipmentCode);
-    // var equipmentCategoryIds = detailInfo.map((item) => item.equipmentCategoryId)
   } else {
     var equipmentCodeIds = equipmentDetailList.value.map(
       (item) => item.equipmentCode
     );
-    // var equipmentCategoryIds = detailInfo.map((item) => item.equipmentCategoryId)
   }
 
   let data = {
@@ -351,32 +328,30 @@ const handleDeleteEquipmentDetail = (id) => {
 const handleRefreshCategory = () => {
   getCategoryList();
 };
-
+//设备类别搜索,前端过滤
 watch(name, (val) => {
-  equipmentDetailList.value = []
-  equipmentTotal.value = 0
+  equipmentDetailList.value = [];
+  equipmentTotal.value = 0;
   proxy.$refs["categoryTable"].filter(val);
 });
 const filterNode = (value, data) => {
   if (!value) {
     return true;
   }
-  queryParams.value.equipmentCode = ''
+  queryParams.value.equipmentCode = "";
   return data.name.indexOf(value) !== -1;
 };
-
-
+//删除设备类别
 const handleDeleteCategory = (data) => {
-  var showErrorMessage = false
+  var showErrorMessage = false;
   proxy.$modal
     .confirm("确定删除数据项?")
     .then(() => {
       if (data.children) {
-         showErrorMessage = true;
-         return Promise.reject(new Error("HasChildrenError"));
+        showErrorMessage = true;
+        return Promise.reject(new Error("HasChildrenError"));
       }
-      return delCategory(data.id)
-        
+      return delCategory(data.id);
     })
     .then(() => {
       if (!showErrorMessage) {
@@ -389,7 +364,7 @@ const handleDeleteCategory = (data) => {
       if (showErrorMessage) {
         proxy.$modal.msgError("该设备类别下有子类别,不能删除!");
       }
-    })
+    });
 };
 
 /** 设备类别表格 current-change 事件 */
@@ -403,17 +378,12 @@ function handleCurrentCategoryChange(row) {
 
 /** 打开设备分类表单 */
 const handleShowEquipmentCategoryDialog = (data) => {
-  if(data) {
+  if (data) {
     proxy.$refs.categoryRef.open(data.id);
   }
   proxy.$refs.categoryRef.open();
 };
 
-/** 搜索设备类别 */
-function handleRefreshEquipmentCategory() {
-  getCategoryList();
-}
-
 /****************************** 设备档案 事件处理区 ******************************/
 
 /** 搜索按钮操作 */
@@ -423,28 +393,19 @@ function handleRefreshEquipment() {
 /** 获取设备档案列表 */
 const getEquipmentList = () => {
   equipmentLoading.value = true;
-  console.log(queryParams.value)
-if(queryParams.value.equipmentCategoryId) {
-  detailList(queryParams.value).then((res) => {
-    equipmentDetailList.value = res.rows;
-    equipmentLoading.value = false;
-    equipmentTotal.value = res.total;
-  });
-}
+  console.log(queryParams.value);
+  if (queryParams.value.equipmentCategoryId) {
+    detailList(queryParams.value).then((res) => {
+      equipmentDetailList.value = res.rows;
+      equipmentLoading.value = false;
+      equipmentTotal.value = res.total;
+    });
+  }
 };
+//刷新设备档案管理
 function handleRefreshDetail() {
   getEquipmentList();
 }
-
-/**下载设备档案管理二维码 */
-function downloadEquipmentQrcode(id) {
-  downloadEquipmentQrcode(id);
-}
-
-/** 设备档案管理二维码 */
-function equipmentQrcode(id) {
-  equipmentQrcode(id);
-}
 /**
  * 列表checkbox列选择 事件
  */

+ 3 - 4
src/views/business/process/form.vue

@@ -28,10 +28,10 @@
 <script setup>
 import { getProcess, saveProcess } from '@/api/business/process'
 const { proxy } = getCurrentInstance()
-const { process_status } = proxy.useDict('process_status')
-
 const emit = defineEmits(['handleSaveSuccess'])
-
+/** 字典数组区 */
+const { process_status } = proxy.useDict('process_status')
+/** 工序表单变量 */
 const loading = ref(false)
 const visible = ref(false)
 const data = reactive({
@@ -51,7 +51,6 @@ function open(id) {
   getProcess(id || 0).then((res) => {
     if (res.data) {
       form.value = res.data
-      console.log(form.value)
     }
   })
 }

+ 3 - 6
src/views/business/process/index.vue

@@ -5,7 +5,6 @@
       <el-form-item class="section-title" label="标准工序" />
       <el-form-item>
         <el-button type="primary" icon="Plus" @click="handleShowProcessDialog(null)" v-hasPermi="['system:product:add']">新增</el-button>
-        <!-- <el-button type="success" icon="Refresh" @click="handleRefreshProcess">刷新</el-button> -->
       </el-form-item>
     </el-form>
 
@@ -13,7 +12,6 @@
     <div class="el-table-container">
       <div class="el-table-inner-container">
         <el-table v-loading="loading" :data="processList" height="100%" @selection-change="handleSelectionChange">
-          <!-- <el-table-column type="selection" width="40" align="center" /> -->
           <el-table-column label="行号" type="index" width="50" align="center" />
           <el-table-column label="工序编码" width="100" align="center" prop="processCode" />
           <el-table-column label="工序简称" width="100" align="center" prop="processAlias" />
@@ -38,7 +36,7 @@
     <!-- 分页 -->
     <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
 
-    <!-- 表单 -->
+    <!-- 新增工序表单 -->
     <process-form ref="processRef" @handleSaveSuccess="handleRefreshProcess" />
   </div>
 </template>
@@ -47,10 +45,9 @@
 import { listProcess, delProcess } from '@/api/business/process'
 import processForm from './form'
 const { proxy } = getCurrentInstance()
-const { process_status } = proxy.useDict('process_status')
 /** 字典数组区 */
-/** 查询 对象 */
-
+const { process_status } = proxy.useDict('process_status')
+/** 标准工序*/
 const processList = ref([])
 const loading = ref(true)
 const ids = ref([])

+ 3 - 32
src/views/business/product/DialogProcessChoice.vue

@@ -24,10 +24,8 @@
             @keyup.enter="handleSearch"
           />
         </el-form-item>
-  
         <el-form-item label-width="20px" style="margin-top: 20px;">
           <el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
-          <!-- <el-button type="primary" icon="Delete"  plain @click="handleSearch('clear')">清空</el-button> -->
         </el-form-item>
       </div>
     </el-form>
@@ -68,28 +66,18 @@
 import { ref } from '@vue/reactivity'
 import { listProcess } from '@/api/business/process'
 const { proxy } = getCurrentInstance()
+/** 字典数组区 */
 const { process_status } = proxy.useDict('process_status')
+/** 工序变量 */
 const total = ref(0)
 const props = defineProps({
-  multiple: {
-    type: Boolean,
-    default: false
-  },
-  selected: {
-    type: Array,
-    defalut: []
-  },
-  singleSelected: {
-    type: Function,
-    default: null
-  },
   multipleSelected: {
     type: Function,
     default: null
   }
 })
 
-const { singleSelected, multipleSelected, selected } = toRefs(props)
+const { multipleSelected } = toRefs(props)
 const processList = ref([])
 const visible = ref(false)
 const loading = ref(false)
@@ -142,17 +130,9 @@ function getList() {
  * 列表checkbox列选择 事件
  */
 function handleSelectionChange(selection) {
-  console.log(selection)
   selections.value = selection
 }
 
-function selectable(row, index) {
-  if (selected.value.length > 0) {
-    return !selected.value.some((l) => l.personId === row.id)
-  } else {
-    return true
-  }
-}
 
 /**  搜索 事件 */
 function handleSearch(type) {
@@ -167,15 +147,6 @@ function handleSearch(type) {
   }
   getList()
 }
-
-/** 单选事件 */
-function handleSingleSelected(row) {
-  if (singleSelected.value) {
-    singleSelected.value(row)
-  }
-  close()
-}
-
 /** 多选事件 */
 function handleMultipleSelected() {
   if (multipleSelected.value) {

+ 1 - 1
src/views/business/product/form.vue

@@ -167,7 +167,7 @@ const { product_type } = proxy.useDict("product_type");
 const { product_dtype } = proxy.useDict("product_dtype");
 const { product_status_code } = proxy.useDict("product_status_code");
 const { production_type_code } = proxy.useDict("production_type_code");
-
+/** 产品表单变量 */
 const loading = ref(false);
 const visible = ref(false);
 const data = reactive({

+ 654 - 334
src/views/business/product/index.vue

@@ -2,40 +2,116 @@
   <div class="page-container column-container">
     <section class="list-part-container column-container" style="flex: 1">
       <!-- 搜索区 -->
-      <el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true">
+      <el-form
+        class="list-search-container"
+        :model="queryParams"
+        ref="queryRef"
+        :inline="true"
+      >
         <el-form-item class="section-title" label="产品管理" />
         <el-form-item label="产品类别:">
-          <el-select v-model="queryParams.type" clearable placeholder="请选择类别" style="width: 130px">
-            <el-option v-for="dict in product_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
+          <el-select
+            v-model="queryParams.type"
+            clearable
+            placeholder="请选择类别"
+            style="width: 130px"
+          >
+            <el-option
+              v-for="dict in product_type"
+              :key="dict.value"
+              :label="dict.label"
+              :value="dict.value"
+            ></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="客户集团简称:">
-          <el-input placeholder="请输入客户集团简称" v-model.trim="queryParams.companyAlias" style="width: 150px" clearable @keyup.enter="handleQuery" @keydown.enter.prevent />
+          <el-input
+            placeholder="请输入客户集团简称"
+            v-model.trim="queryParams.companyAlias"
+            style="width: 150px"
+            clearable
+            @keyup.enter="handleQueryProduct"
+            @keydown.enter.prevent
+          />
         </el-form-item>
         <el-form-item label="图号:">
-          <el-input placeholder="请输入产品图号" v-model.trim="queryParams.drawingNumber" style="width: 130px" clearable @keyup.enter="handleQuery" @keydown.enter.prevent />
+          <el-input
+            placeholder="请输入产品图号"
+            v-model.trim="queryParams.drawingNumber"
+            style="width: 130px"
+            clearable
+            @keyup.enter="handleQueryProduct"
+            @keydown.enter.prevent
+          />
         </el-form-item>
         <el-form-item label="规格:">
-          <el-input placeholder="请输入产品规格" v-model.trim="queryParams.specification" style="width: 130px" clearable @keyup.enter="handleQuery" @keydown.enter.prevent />
+          <el-input
+            placeholder="请输入产品规格"
+            v-model.trim="queryParams.specification"
+            style="width: 130px"
+            clearable
+            @keyup.enter="handleQueryProduct"
+            @keydown.enter.prevent
+          />
         </el-form-item>
         <el-form-item label="料号:">
-          <el-input placeholder="请输入产品料号" v-model.trim="queryParams.productCode" style="width: 130px" clearable @keyup.enter="handleQuery" @keydown.enter.prevent />
+          <el-input
+            placeholder="请输入产品料号"
+            v-model.trim="queryParams.productCode"
+            style="width: 130px"
+            clearable
+            @keyup.enter="handleQueryProduct"
+            @keydown.enter.prevent
+          />
         </el-form-item>
         <el-form-item label="产品描述:">
-          <el-input placeholder="请输入产品描述" v-model.trim="queryParams.description" style="width: 130px" clearable @keyup.enter="handleQuery" @keydown.enter.prevent />
+          <el-input
+            placeholder="请输入产品描述"
+            v-model.trim="queryParams.description"
+            style="width: 130px"
+            clearable
+            @keyup.enter="handleQueryProduct"
+            @keydown.enter.prevent
+          />
         </el-form-item>
         <el-form-item>
-          <el-button type="info" icon="Search" @click="handleQuery">搜索</el-button>
-          <el-button type="primary" icon="Plus" @click="handleAdd" v-hasPermi="['business:product:add']">新增</el-button>
-          <el-button type="primary" icon="Refresh" @click="handleSync" v-hasPermi="['business:product:sync']">同步P2产品</el-button>
+          <el-button type="info" icon="Search" @click="handleQueryProduct"
+            >搜索</el-button
+          >
+          <el-button
+            type="primary"
+            icon="Plus"
+            @click="handleAddProduct"
+            v-hasPermi="['business:product:add']"
+            >新增</el-button
+          >
+          <el-button
+            type="primary"
+            icon="Refresh"
+            @click="handleSync"
+            v-hasPermi="['business:product:sync']"
+            >同步P2产品</el-button
+          >
         </el-form-item>
       </el-form>
       <!-- 列表区 -->
       <div class="el-table-container">
         <div class="el-table-inner-container">
-          <el-table ref="productTable" v-loading="productLoading" :data="productList" row-key="id" highlight-current-row height="100%" @current-change="handleCurrentProductChange">
-            <!-- <el-table-column type="selection" width="40" align="center" /> -->
-            <el-table-column type="index" label="行号" width="50" align="center" />
+          <el-table
+            ref="productTable"
+            v-loading="productLoading"
+            :data="productList"
+            row-key="id"
+            highlight-current-row
+            height="100%"
+            @current-change="handleCurrentProductChange"
+          >
+            <el-table-column
+              type="index"
+              label="行号"
+              width="50"
+              align="center"
+            />
             <el-table-column label="料号" align="center" prop="productCode" />
             <el-table-column label="预入仓库" align="center" prop="preStock" />
             <el-table-column label="类别" align="center" prop="type">
@@ -43,39 +119,119 @@
                 <dict-tag :options="product_type" :value="scope.row.type" />
               </template>
             </el-table-column>
-            <el-table-column label="轴类型大类" width="150px" align="center" prop="shaftBroadCategoryCode">
+            <el-table-column
+              label="轴类型大类"
+              width="150px"
+              align="center"
+              prop="shaftBroadCategoryCode"
+            >
               <template #default="scope">
-                <dict-tag :options="product_dtype" :value="scope.row.shaftBroadCategoryCode" />
+                <dict-tag
+                  :options="product_dtype"
+                  :value="scope.row.shaftBroadCategoryCode"
+                />
               </template>
             </el-table-column>
-            <el-table-column label="轴类型" align="center" prop="shaftCategoryCode" />
+            <el-table-column
+              label="轴类型"
+              align="center"
+              prop="shaftCategoryCode"
+            />
             <el-table-column label="规格" align="center" prop="specification" />
-            <el-table-column label="图号" align="center" width="110" prop="drawingNumber" />
-            <el-table-column label="客户集团简称" align="center" width="120px" prop="companyAlias" />
-            <el-table-column label="产品描述" align="center" width="200px" prop="description" />
+            <el-table-column
+              label="图号"
+              align="center"
+              width="110"
+              prop="drawingNumber"
+            />
+            <el-table-column
+              label="客户集团简称"
+              align="center"
+              width="120px"
+              prop="companyAlias"
+            />
+            <el-table-column
+              label="产品描述"
+              align="center"
+              width="200px"
+              prop="description"
+            />
             <el-table-column label="直径" align="center" prop="diameter" />
             <el-table-column label="成品长度" align="center" prop="lenght" />
             <el-table-column label="厚度" align="center" prop="thickness" />
-            <el-table-column label="客户代号" align="center" prop="companyCode" />
-            <el-table-column label="销售员编码" align="center" prop="salesmanCode" />
-            <el-table-column label="保管员编码" align="center" prop="stockKeeperCode" />
-            <el-table-column label="调度员编号" align="center" prop="dispatcherCode" />
+            <el-table-column
+              label="客户代号"
+              align="center"
+              prop="companyCode"
+            />
+            <el-table-column
+              label="销售员编码"
+              align="center"
+              prop="salesmanCode"
+            />
+            <el-table-column
+              label="保管员编码"
+              align="center"
+              prop="stockKeeperCode"
+            />
+            <el-table-column
+              label="调度员编号"
+              align="center"
+              prop="dispatcherCode"
+            />
             <el-table-column label="备注" align="center" prop="remark" />
-            <el-table-column label="产品状态" align="center" prop="productStatusCode">
+            <el-table-column
+              label="产品状态"
+              align="center"
+              prop="productStatusCode"
+            >
               <template #default="scope">
-                <dict-tag :options="product_status_code" :value="scope.row.productStatusCode" />
+                <dict-tag
+                  :options="product_status_code"
+                  :value="scope.row.productStatusCode"
+                />
               </template>
             </el-table-column>
-            <el-table-column label="生产类型" align="center" prop="productionTypeCode">
+            <el-table-column
+              label="生产类型"
+              align="center"
+              prop="productionTypeCode"
+            >
               <template #default="scope">
-                <dict-tag :options="production_type_code" :value="scope.row.productionTypeCode" />
+                <dict-tag
+                  :options="production_type_code"
+                  :value="scope.row.productionTypeCode"
+                />
               </template>
             </el-table-column>
-            <el-table-column label="技术员编码" align="center" prop="technicianCode" />
-            <el-table-column fixed="right" label="操作" align="center" width="140px">
+            <el-table-column
+              label="技术员编码"
+              align="center"
+              prop="technicianCode"
+            />
+            <el-table-column
+              fixed="right"
+              label="操作"
+              align="center"
+              width="140px"
+            >
               <template #default="scope">
-                <el-button link type="warning" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['business:product:edit']">编辑</el-button>
-                <el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['business:product:remove']">删除</el-button>
+                <el-button
+                  link
+                  type="warning"
+                  icon="Edit"
+                  @click="handleUpdateProduct(scope.row)"
+                  v-hasPermi="['business:product:edit']"
+                  >编辑</el-button
+                >
+                <el-button
+                  link
+                  type="danger"
+                  icon="Delete"
+                  @click="handleDelete(scope.row)"
+                  v-hasPermi="['business:product:remove']"
+                  >删除</el-button
+                >
               </template>
             </el-table-column>
           </el-table>
@@ -83,49 +239,116 @@
       </div>
     </section>
     <!-- 分页 -->
-    <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      v-model:page="queryParams.pageNum"
+      v-model:limit="queryParams.pageSize"
+      @pagination="getList"
+    />
 
     <section class="list-part-container row-container" style="flex: 1">
       <section class="list-part-container" style="flex: 1">
         <!-- 下边页面开始 -->
-        <el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true">
+        <el-form
+          class="list-search-container"
+          :model="queryParams"
+          ref="queryRef"
+          :inline="true"
+        >
           <el-form-item class="section-title" label="标准工艺" />
           <el-form-item>
-            <el-button type="primary" icon="Plus" @click="handleAddTechnologicalProcess" v-hasPermi="['business:product:add']" :disabled="!currentProduct.id">
+            <el-button
+              type="primary"
+              icon="Plus"
+              @click="handleAddTechnologicalProcess"
+              v-hasPermi="['business:product:add']"
+              :disabled="!currentProduct.id"
+            >
               添加工艺
             </el-button>
-            <el-button type="danger" icon="Delete" @click="TechnologicalProcessDelete" :disabled="technologicalProcessIds.length === 0" v-hasPermi="['business:product:remove']">
+            <el-button
+              type="danger"
+              icon="Delete"
+              @click="TechnologicalProcessDelete"
+              :disabled="technologicalProcessIds.length === 0"
+              v-hasPermi="['business:product:remove']"
+            >
               删除工艺
             </el-button>
           </el-form-item>
         </el-form>
         <div class="el-table-container">
           <div class="el-table-inner-container">
-            <el-table ref="technologicalProcessTable" :data="technologicalProcessList ? technologicalProcessList : []" v-loading="technologicalProcessLoading" :row-key="getRowKey" highlight-current-row height="100%" size="small" header-row-class-name="list-header-row" @selection-change="TechnologicalProcessSelectionChange" @current-change="handleCurrentTechnologicalProcessChange">
+            <el-table
+              ref="technologicalProcessTable"
+              :data="technologicalProcessList ? technologicalProcessList : []"
+              v-loading="technologicalProcessLoading"
+              :row-key="getRowKey"
+              highlight-current-row
+              height="100%"
+              size="small"
+              header-row-class-name="list-header-row"
+              @selection-change="TechnologicalProcessSelectionChange"
+              @current-change="handleCurrentTechnologicalProcessChange"
+            >
               <el-table-column type="selection" width="40" align="center" />
-              <el-table-column type="index" label="行号" width="50" align="center" />
-              <el-table-column label="工艺版本" align="center" prop="technologyVersion">
+              <el-table-column
+                type="index"
+                label="行号"
+                width="50"
+                align="center"
+              />
+              <el-table-column
+                label="工艺版本"
+                align="center"
+                prop="technologyVersion"
+              >
                 <template #default="scope">
                   <div v-if="scope.row.editStatus">
-                    <el-input v-model.trim="scope.row.technologyVersion" size="small" placeholder="工艺版本" />
+                    <el-input
+                      v-model.trim="scope.row.technologyVersion"
+                      size="small"
+                      placeholder="工艺版本"
+                    />
                   </div>
                   <div v-else>{{ scope.row.technologyVersion }}</div>
                 </template>
               </el-table-column>
               <el-table-column label="操作" width="140px" align="center">
                 <template #default="scope">
-                  <el-button v-if="scope.row.editStatus" link type="primary" icon="Check" @click="
+                  <el-button
+                    v-if="scope.row.editStatus"
+                    link
+                    type="primary"
+                    icon="Check"
+                    @click="
                       handleSaveTechnologicalProcess(scope.row, scope.$index)
-                    " v-hasPermi="['business:product:add']">
+                    "
+                    v-hasPermi="['business:product:add']"
+                  >
                     保存
                   </el-button>
 
-                  <el-button v-else link type="warning" icon="Edit" @click.prevent="scope.row.editStatus = true" v-hasPermi="['business:product:edit']">
+                  <el-button
+                    v-else
+                    link
+                    type="warning"
+                    icon="Edit"
+                    @click.prevent="scope.row.editStatus = true"
+                    v-hasPermi="['business:product:edit']"
+                  >
                     编辑
                   </el-button>
-                  <el-button link type="danger" icon="Delete" @click="
+                  <el-button
+                    link
+                    type="danger"
+                    icon="Delete"
+                    @click="
                       handleDeleteTechnologicalProcess(scope.row, scope.$index)
-                    " v-hasPermi="['business:product:remove']">
+                    "
+                    v-hasPermi="['business:product:remove']"
+                  >
                     删除
                   </el-button>
                 </template>
@@ -135,57 +358,149 @@
         </div>
       </section>
       <section class="list-part-container" style="flex: 1">
-        <el-form class="list-search-container list-search-container-child" :model="queryParams" ref="queryRef" :inline="true">
+        <el-form
+          class="list-search-container list-search-container-child"
+          :model="queryParams"
+          ref="queryRef"
+          :inline="true"
+        >
           <el-form-item class="section-title" label="标准工序" />
           <el-form-item>
-            <el-button v-if="!editStatus" @click="handleTechnologicalProcessDetailEdit" :disabled="
+            <el-button
+              v-if="!editStatus"
+              @click="handleTechnologicalProcessDetailEdit"
+              :disabled="
                 technologicalProcessList.length === 0 ||
                 currentTechnologicalProcess.id == null
-              " v-hasPermi="['business:product:edit']" type="warning" icon="Edit">
+              "
+              v-hasPermi="['business:product:edit']"
+              type="warning"
+              icon="Edit"
+            >
               编辑
             </el-button>
             <template v-if="editStatus">
-              <el-button type="primary" icon="Plus" @click="handleAddProcess" v-hasPermi="['business:product:add']" :disabled="!currentTechnologicalProcess.id">
+              <el-button
+                type="primary"
+                icon="Plus"
+                @click="handleAddProcess"
+                v-hasPermi="['business:product:add']"
+                :disabled="!currentTechnologicalProcess.id"
+              >
                 添加工序
               </el-button>
-              <el-button type="danger" @click="handleTechnologicalProcessCancel" v-hasPermi="['business:product:edit']" icon="Close">取消编辑</el-button>
+              <el-button
+                type="danger"
+                @click="handleTechnologicalProcessCancel"
+                v-hasPermi="['business:product:edit']"
+                icon="Close"
+                >取消编辑</el-button
+              >
             </template>
-            <el-button type="success" v-if="editStatus" icon="Check" :disabled="technologicalprocessDetailList.length === 0" v-hasPermi="['business:product:add']" @click="handleTechnologicalProcessDetailAdd">保存</el-button>
-            <el-button type="danger" icon="Delete" v-if="!editStatus" @click="handledelTechnologicalProcessDetail" :disabled="technologicalProcessDetailIds.length === 0" v-hasPermi="['business:product:remove']">
+            <el-button
+              type="success"
+              v-if="editStatus"
+              icon="Check"
+              :disabled="technologicalprocessDetailList.length === 0"
+              v-hasPermi="['business:product:add']"
+              @click="handleTechnologicalProcessDetailAdd"
+              >保存</el-button
+            >
+            <el-button
+              type="danger"
+              icon="Delete"
+              v-if="!editStatus"
+              @click="handledelTechnologicalProcessDetail"
+              :disabled="technologicalProcessDetailIds.length === 0"
+              v-hasPermi="['business:product:remove']"
+            >
               删除工序
             </el-button>
           </el-form-item>
         </el-form>
         <div class="el-table-container">
           <div class="el-table-inner-container">
-            <el-table :data="technologicalprocessDetailList" v-loading="technologicalprocessDetailLoading" :row-key="getRowKey" highlight-current-row height="100%" @selection-change="processDetailSelectionChange">
+            <el-table
+              :data="technologicalprocessDetailList"
+              v-loading="technologicalprocessDetailLoading"
+              :row-key="getRowKey"
+              highlight-current-row
+              height="100%"
+              @selection-change="processDetailSelectionChange"
+            >
               <el-table-column type="selection" width="40" align="center" />
-              <el-table-column type="index" label="行号" width="50" align="center" />
-              <el-table-column label="工序步骤编号" width="100" align="center" prop="processStepNumber">
+              <el-table-column
+                type="index"
+                label="行号"
+                width="50"
+                align="center"
+              />
+              <el-table-column
+                label="工序步骤编号"
+                width="100"
+                align="center"
+                prop="processStepNumber"
+              >
                 <template #default="scope">
                   <div v-if="scope.row.editStatus || editStatus">
-                    <el-input v-model.trim="scope.row.processStepNumber" size="small" placeholder="工序步骤编号" />
+                    <el-input
+                      v-model.trim="scope.row.processStepNumber"
+                      size="small"
+                      placeholder="工序步骤编号"
+                    />
                   </div>
                   <div v-else>{{ scope.row.processStepNumber }}</div>
                 </template>
               </el-table-column>
-              <el-table-column label="工序编码" align="center" prop="processCode" />
-              <el-table-column label="工序简称" align="center" prop="processAlias" />
-              <!-- <el-table-column label="图纸" prop="drawingFile" align="center" /> -->
-              <el-table-column v-if="!editStatus" label="操作" width="140px" align="center">
+              <el-table-column
+                label="工序编码"
+                align="center"
+                prop="processCode"
+              />
+              <el-table-column
+                label="工序简称"
+                align="center"
+                prop="processAlias"
+              />
+              <el-table-column
+                v-if="!editStatus"
+                label="操作"
+                width="140px"
+                align="center"
+              >
                 <template #default="scope">
-                  <el-button v-if="scope.row.editStatus && !editStatus" link type="primary" icon="Check" @click="handleSaveTechnologicalProcessDetail(scope.row)" v-hasPermi="['business:product:add']">
+                  <el-button
+                    v-if="scope.row.editStatus && !editStatus"
+                    link
+                    type="primary"
+                    icon="Check"
+                    @click="handleSaveTechnologicalProcessDetail(scope.row)"
+                    v-hasPermi="['business:product:add']"
+                  >
                     保存
                   </el-button>
-                  <el-button v-else-if="!editStatus && !scope.row.editStatus" link type="warning" icon="Edit" @click.prevent="scope.row.editStatus = true" v-hasPermi="['business:product:edit']">
+                  <el-button
+                    v-else-if="!editStatus && !scope.row.editStatus"
+                    link
+                    type="warning"
+                    icon="Edit"
+                    @click.prevent="scope.row.editStatus = true"
+                    v-hasPermi="['business:product:edit']"
+                  >
                     编辑
                   </el-button>
-                  <el-button link type="danger" icon="Delete" @click="
+                  <el-button
+                    link
+                    type="danger"
+                    icon="Delete"
+                    @click="
                       handleDeleteTechnologicalProcessDetail(
                         scope.row,
                         scope.$index
                       )
-                    " v-hasPermi="['business:product:remove']">
+                    "
+                    v-hasPermi="['business:product:remove']"
+                  >
                     删除
                   </el-button>
                 </template>
@@ -195,44 +510,55 @@
         </div>
       </section>
     </section>
-    <!-- 表单 -->
-    <product-form ref="productRef" @handleSaveSuccess="handleQueryProduct"></product-form>
-    <process-choice ref="processChoiceRef" :multiple="true" :multiple-selected="handleProcessSelected"></process-choice>
+    <!-- 产品表单 -->
+    <product-form
+      ref="productRef"
+      @handleSaveSuccess="handleQueryProduct"
+    ></product-form>
+    <!-- 工序弹窗 -->
+    <process-choice
+      ref="processChoiceRef"
+      :multiple-selected="handleProcessSelected"
+    ></process-choice>
   </div>
 </template>
 
 <script setup>
-import { listProduct, delProduct } from '@/api/business/product'
-import { getP2Product } from '@/api/business/p2.js'
-import productForm from './form'
-import processChoice from './DialogProcessChoice'
-import { listTechnologicalProcessDetail, saveTechnologicalProcessDetail, delTechnologicalProcessDetail, saveSingleTechnologicalProcessDetail } from '@/api/business/technologicalProcessDetail'
-import { listTechnologicalProcess, saveTechnologicalProcess, delTechnologicalProcess } from '@/api/business/technologicalProcess'
-import { ref } from 'vue'
-const { proxy } = getCurrentInstance()
+import { listProduct, delProduct } from "@/api/business/product";
+import { getP2Product } from "@/api/business/p2.js";
+import productForm from "./form";
+import processChoice from "./DialogProcessChoice";
+import {
+  listTechnologicalProcessDetail,
+  saveTechnologicalProcessDetail,
+  delTechnologicalProcessDetail,
+  saveSingleTechnologicalProcessDetail,
+} from "@/api/business/technologicalProcessDetail";
+import {
+  listTechnologicalProcess,
+  saveTechnologicalProcess,
+  delTechnologicalProcess,
+} from "@/api/business/technologicalProcess";
+import { ref } from "vue";
+const { proxy } = getCurrentInstance();
 /** 字典数组区 */
-const { product_type } = proxy.useDict('product_type')
-const { product_dtype } = proxy.useDict('product_dtype')
-const { product_status_code } = proxy.useDict('product_status_code')
-const { production_type_code } = proxy.useDict('production_type_code')
+const { product_type } = proxy.useDict("product_type");
+const { product_dtype } = proxy.useDict("product_dtype");
+const { product_status_code } = proxy.useDict("product_status_code");
+const { production_type_code } = proxy.useDict("production_type_code");
 
-/** 查询 对象 */
-const productList = ref([])
-const technologicalProcessList = ref([])
-const technologicalprocessDetailList = ref([])
-const productLoading = ref(false)
-const technologicalProcessLoading = ref(false)
-const technologicalprocessDetailLoading = ref(false)
-const ids = ref([])
-const deleteIds = ref([])
-const technologicalProcessIds = ref([])
-const technologicalProcessDetailIds = ref([])
-const single = ref(true)
-const multiple = ref(true)
-const editStatus = ref(false)
-const technologicalProcessAddMultiple = ref(true)
-
-const total = ref(0)
+/** 产品变量 */
+const productList = ref([]);
+const productLoading = ref(false);
+const ids = ref([]);
+const total = ref(0);
+const currentProduct = ref({});
+/** 工艺变量 */
+const technologicalProcessList = ref([]);
+const technologicalProcessLoading = ref(false);
+const technologicalProcessIds = ref([]);
+const currentTechnologicalProcess = ref({});
+const technologicalProcessAddMultiple = ref(true);
 const detailsRow = {
   id: null,
   tenantId: null,
@@ -240,343 +566,337 @@ const detailsRow = {
   productCode: undefined,
   productShaftCategory: undefined,
   productShaftCategoryName: undefined,
-  productDescription: undefined
-}
-const currentProduct = ref({})
-const currentTechnologicalProcess = ref({})
+  productDescription: undefined,
+};
+/** 工序变量 */
+const technologicalprocessDetailList = ref([]);
+const technologicalprocessDetailLoading = ref(false);
+const technologicalProcessDetailIds = ref([]);
+const single = ref(true);
+const editStatus = ref(false);
 
 /** 查询对象 */
 const queryParams = ref({
   pageNum: 1,
   pageSize: 10,
-  code: '',
-  name: '',
+  code: "",
+  name: "",
   combinedValue: null,
-  productCode: ''
-})
+  productCode: "",
+});
 
 /***********************  方法区  ****************************/
-
+/***********************  产品管理  ****************************/
 /** 查询产品管理列表
  * 进入页面产品表第一条和工艺表第一条默认选中
  */
 function getList() {
-  productLoading.value = true
+  productLoading.value = true;
   listProduct(queryParams.value).then((response) => {
-    productList.value = response.rows
-    total.value = response.total
-    productLoading.value = false
+    productList.value = response.rows;
+    total.value = response.total;
+    productLoading.value = false;
     if (productList.value.length > 0) {
-      proxy.$refs.productTable.setCurrentRow(productList.value[0])
-    } else {
-      technologicalProcessList.value = []
-      technologicalprocessDetailList.value = []
-    }
-  })
-}
-
-const handleQueryProduct = () => {
-  getList()
-}
-// 获取工艺列表
-const getTechnologicalProcesses = (index) => {
-  technologicalProcessLoading.value = true
-  listTechnologicalProcess({ productId: currentProduct.value.id }).then((res) => {
-    technologicalProcessList.value = res.rows
-    technologicalProcessLoading.value = false
-    if (technologicalProcessList.value.length > 0) {
-      proxy.$refs.technologicalProcessTable.setCurrentRow(technologicalProcessList.value[index])
+      proxy.$refs.productTable.setCurrentRow(productList.value[0]);
     } else {
-      technologicalProcessList.value = []
-      technologicalprocessDetailList.value = []
+      technologicalProcessList.value = [];
+      technologicalprocessDetailList.value = [];
     }
-  })
-}
-
-// 获取工序列表
-const getTechnologicalProcessDetails = () => {
-  if (!currentTechnologicalProcess.value.id) {
-    technologicalprocessDetailList.value = []
-  } else {
-    technologicalprocessDetailLoading.value = true
-    listTechnologicalProcessDetail({
-      technologicalProcessId: currentTechnologicalProcess.value.id
-    }).then((res) => {
-      technologicalprocessDetailList.value = res.rows
-      technologicalprocessDetailLoading.value = false
-    })
-  }
+  });
 }
-
 /**
  * 产品的 current change 事件
  * 要获取工艺列表
  */
 function handleCurrentProductChange(row) {
   if (row) {
-    currentProduct.value = row
-    editStatus.value = false
-    getTechnologicalProcesses(0)
+    currentProduct.value = row;
+    editStatus.value = false;
+    getTechnologicalProcesses(0);
   }
 }
+/** 产品搜索按钮操作 */
+function handleQueryProduct() {
+  queryParams.value.pageNum = 1;
+  getList();
+}
+/** 产品新增按钮操作 */
+function handleAddProduct() {
+  proxy.$refs.productRef.open();
+}
+
+/** 产品修改按钮操作 */
+function handleUpdateProduct(row) {
+  const id = row.id || ids.value;
+  proxy.$refs.productRef.open(id);
+}
+/** 删除产品表操作 */
+function handleDelete(row) {
+  const _ids = row.id;
+  proxy.$modal
+    .confirm("是否确认删除选中的数据项?")
+    .then(function () {
+      delProduct(_ids).then(() => {
+        getList();
+        proxy.$modal.msgSuccess("删除成功!");
+      });
+    })
+    .catch(() => {});
+}
 
+/***********************  标准工艺  ****************************/
+// 获取工艺列表
+const getTechnologicalProcesses = (index) => {
+  technologicalProcessLoading.value = true;
+  listTechnologicalProcess({ productId: currentProduct.value.id }).then(
+    (res) => {
+      technologicalProcessList.value = res.rows;
+      technologicalProcessLoading.value = false;
+      if (technologicalProcessList.value.length > 0) {
+        proxy.$refs.technologicalProcessTable.setCurrentRow(
+          technologicalProcessList.value[index]
+        );
+      } else {
+        technologicalProcessList.value = [];
+        technologicalprocessDetailList.value = [];
+      }
+    }
+  );
+};
 /**
  * 工艺的 current change 事件
  * 要获取工序列表
  */
 function handleCurrentTechnologicalProcessChange(row) {
-  editStatus.value = false
+  editStatus.value = false;
   if (row) {
-    technologicalProcessAddMultiple.value = true
-    technologicalprocessDetailLoading.value = true
-    currentTechnologicalProcess.value = row
-
-    technologicalProcessAddMultiple.value = false
+    technologicalProcessAddMultiple.value = true;
+    technologicalprocessDetailLoading.value = true;
+    currentTechnologicalProcess.value = row;
+    technologicalProcessAddMultiple.value = false;
+    getTechnologicalProcessDetails();
+  } else {
+    technologicalprocessDetailList.value = [];
+  }
+  technologicalprocessDetailLoading.value = false;
+}
+/** 工艺表多选框选中数据 */
+function TechnologicalProcessSelectionChange(selection) {
+  technologicalProcessIds.value = selection.map((item) => item.id);
+  single.value = selection.length != 1;
+}
+/**
+ * 工艺保存 事件
+ * 添加工艺操作:添加后,执行刷新操作,重新查找工艺表内容,并通过绑定添加行的下标来选中,从而获得row
+ */
+function handleSaveTechnologicalProcess(row, index) {
+  if (!row.technologyVersion) {
+    proxy.$modal.msgError("工艺版本不能为空!");
+  } else {
+    if (
+      row.technologyVersion !== "A" &&
+      row.technologyVersion !== "B" &&
+      row.technologyVersion !== "C"
+    ) {
+      proxy.$modal.msgError("工艺版本只能填写A、B、C");
+    } else {
+      row.productId = currentProduct.value.id;
+      saveTechnologicalProcess(row).then((response) => {
+        if (response.code == 200) {
+          getTechnologicalProcesses(index);
+          proxy.$modal.msgSuccess("操作成功!");
+        }
+      });
+      row.editStatus = false;
+    }
+  }
+}
+/** 工艺添加操作 */
+const handleAddTechnologicalProcess = () => {
+  const newDetail = JSON.parse(JSON.stringify(detailsRow));
+  newDetail.editStatus = true;
+  newDetail.productCode = currentProduct.value.productCode;
+  newDetail.productId = currentProduct.value.id;
+  newDetail.productShaftCategoryId = currentProduct.value.shaftCategoryId;
+  newDetail.productDrawingNumber = currentProduct.value.drawingNumber;
+  newDetail.productDescription = currentProduct.value.description;
+  newDetail.productSpecification = currentProduct.value.specification;
+  newDetail.tenantId = currentProduct.value.tenantId;
+  newDetail.technologyVersion = "";
+  technologicalProcessList.value.push(newDetail);
+};
+/** 工艺添加取消操作 */
+const handleSync = () => {
+  productLoading.value = true;
+  getP2Product(queryParams.value).then((res) => {
+    getList();
+  });
+};
 
-    getTechnologicalProcessDetails()
+/** 单条删除工艺操作
+ * 删除已经存在的数据-即row.id存在,执行一个对话框选择,如果确认则执行删除方法,并重新查询工艺表操作,
+ * 让工艺表第一条默认选中
+ * 删除未保存的苏剧-即row.id不存在,通过splice方法,通过下标删除数组的元素
+ */
+function handleDeleteTechnologicalProcess(row, index) {
+  if (row.id) {
+    proxy.$modal
+      .confirm("是否确认删除选中的数据项?")
+      .then(function () {
+        return delTechnologicalProcess(row.id);
+      })
+      .then(() => {
+        getTechnologicalProcesses(0);
+        proxy.$modal.msgSuccess("删除成功!");
+      });
   } else {
-    technologicalprocessDetailList.value = []
+    technologicalProcessList.value.splice(index, 1);
+    getTechnologicalProcesses(0);
   }
-  technologicalprocessDetailLoading.value = false
 }
 
-/** 搜索按钮操作 */
-function handleQuery() {
-  queryParams.value.pageNum = 1
-  getList()
+/** 工艺表批量删除操作
+ * 通过多选框选中方法,获得选中的工艺id,执行删除,山删除后,重新通过产品id获得工艺列表
+ */
+function TechnologicalProcessDelete() {
+  proxy.$modal
+    .confirm("是否确认删除选中的数据项?")
+    .then(function () {
+      return delTechnologicalProcess(technologicalProcessIds.value);
+    })
+    .then(() => {
+      getTechnologicalProcesses(0);
+      proxy.$modal.msgSuccess("删除成功!");
+    });
 }
 
+/***********************  标准工序  ****************************/
+// 获取工序列表
+const getTechnologicalProcessDetails = () => {
+  if (!currentTechnologicalProcess.value.id) {
+    technologicalprocessDetailList.value = [];
+  } else {
+    technologicalprocessDetailLoading.value = true;
+    listTechnologicalProcessDetail({
+      technologicalProcessId: currentTechnologicalProcess.value.id,
+    }).then((res) => {
+      technologicalprocessDetailList.value = res.rows;
+      technologicalprocessDetailLoading.value = false;
+    });
+  }
+};
+
 /** 点击工序编辑按钮 */
 function handleTechnologicalProcessDetailEdit() {
-  editStatus.value = true
+  editStatus.value = true;
 }
 
 /**点击工序取消编辑按钮 */
 function handleTechnologicalProcessCancel() {
-  editStatus.value = false
-  getTechnologicalProcessDetails()
-}
-/** 重置按钮操作 */
-function resetQuery() {
-  proxy.resetForm('queryRef')
-  handleQuery()
+  editStatus.value = false;
+  getTechnologicalProcessDetails();
 }
 
 /** 单条删除工序操作 */
 function handleDeleteTechnologicalProcessDetail(row, index) {
   if (!row.id) {
-    technologicalprocessDetailList.value.splice(index, 1)
+    technologicalprocessDetailList.value.splice(index, 1);
   } else {
     delTechnologicalProcessDetail(row.id).then((res) => {
       if (res.code == 200) {
-        getTechnologicalProcessDetails()
-        proxy.$modal.msgSuccess('删除成功')
+        getTechnologicalProcessDetails();
+        proxy.$modal.msgSuccess("删除成功");
       }
-    })
+    });
   }
 }
 
 /** 单条保存工序操作*/
 function handleSaveTechnologicalProcessDetail(row) {
   if (!row.processStepNumber) {
-    proxy.$modal.msgError('工序步骤编号不能为空')
+    proxy.$modal.msgError("工序步骤编号不能为空");
   } else {
     saveSingleTechnologicalProcessDetail(row).then((res) => {
       if (res.code == 200) {
-        getTechnologicalProcessDetails()
-        proxy.$modal.msgSuccess('保存成功')
-        row.editStatus = false
+        getTechnologicalProcessDetails();
+        proxy.$modal.msgSuccess("保存成功");
+        row.editStatus = false;
       }
-    })
+    });
   }
 }
-
-// 多选框选中数据
-function handleProductSelectionChange(selection) {
-  ids.value = selection.map((item) => item.id)
-  single.value = selection.length != 1
-  multiple.value = !selection.length
-}
 //工序多选框选中数据
 function processDetailSelectionChange(selection) {
-  technologicalProcessDetailIds.value = selection.map((item) => item.id)
-  single.value = selection.length != 1
+  technologicalProcessDetailIds.value = selection.map((item) => item.id);
+  single.value = selection.length != 1;
 }
 /** 获取行 id */
 function getRowKey(row) {
-  return row.id
+  return row.id;
 }
 /** 工序表多选带回保存
  * 将弹出框选中的内容保存到工序表
  */
 function handleProcessSelected(selection) {
   for (var i = 0; i < selection.length; i++) {
-    var technologicalProcessDetailAdd = {}
-    technologicalProcessDetailAdd.tenantId = currentProduct.value.tenantId
-    technologicalProcessDetailAdd.technologicalProcessId = currentTechnologicalProcess.value.id
-    technologicalProcessDetailAdd.productId = currentProduct.value.id
-    technologicalProcessDetailAdd.productCode = currentProduct.value.productCode
-    technologicalProcessDetailAdd.processId = selection[i].id
-    technologicalProcessDetailAdd.processAlias = selection[i].processAlias
-    technologicalProcessDetailAdd.processCode = selection[i].processCode
-    technologicalProcessDetailAdd.productShaftCategory = currentProduct.value.shaftCategoryCode
-    technologicalProcessDetailAdd.productShaftCategoryName = currentProduct.value.productShaftCategoryName
-    technologicalProcessDetailAdd.productDescription = currentProduct.value.remark
-    technologicalprocessDetailList.value.push(technologicalProcessDetailAdd)
-  }
-}
-/** 工艺表多选框选中数据 */
-function TechnologicalProcessSelectionChange(selection) {
-  technologicalProcessIds.value = selection.map((item) => item.id)
-  single.value = selection.length != 1
-}
-
-/** 新增按钮操作 */
-function handleAdd() {
-  proxy.$refs.productRef.open()
-}
-
-/** 修改按钮操作 */
-function handleUpdate(row) {
-  const id = row.id || ids.value
-  proxy.$refs.productRef.open(id)
-}
-
-/**
- * 工艺保存 事件
- * 添加工艺操作:添加后,执行刷新操作,重新查找工艺表内容,并通过绑定添加行的下标来选中,从而获得row
- */
-function handleSaveTechnologicalProcess(row, index) {
-  console.log(typeof row.technologyVersion)
-  if (!row.technologyVersion) {
-    proxy.$modal.msgError('工艺版本不能为空!')
-  } else {
-
-    if(row.technologyVersion !== "A" && row.technologyVersion !== "B" && row.technologyVersion !== "C") {
-    proxy.$modal.msgError('工艺版本只能填写A、B、C');
-}else {
-    row.productId = currentProduct.value.id
-    saveTechnologicalProcess(row).then((response) => {
-      if (response.code == 200) {
-        getTechnologicalProcesses(index)
-        proxy.$modal.msgSuccess('操作成功!')
-      }
-    })
-    row.editStatus = false
-  }
+    var technologicalProcessDetailAdd = {};
+    technologicalProcessDetailAdd.tenantId = currentProduct.value.tenantId;
+    technologicalProcessDetailAdd.technologicalProcessId =
+      currentTechnologicalProcess.value.id;
+    technologicalProcessDetailAdd.productId = currentProduct.value.id;
+    technologicalProcessDetailAdd.productCode =
+      currentProduct.value.productCode;
+    technologicalProcessDetailAdd.processId = selection[i].id;
+    technologicalProcessDetailAdd.processAlias = selection[i].processAlias;
+    technologicalProcessDetailAdd.processCode = selection[i].processCode;
+    technologicalProcessDetailAdd.productShaftCategory =
+      currentProduct.value.shaftCategoryCode;
+    technologicalProcessDetailAdd.productShaftCategoryName =
+      currentProduct.value.productShaftCategoryName;
+    technologicalProcessDetailAdd.productDescription =
+      currentProduct.value.remark;
+    technologicalprocessDetailList.value.push(technologicalProcessDetailAdd);
   }
 }
-
 /** 保存工序 */
 function handleTechnologicalProcessDetailAdd() {
   for (var i = 0; i < technologicalprocessDetailList.value.length; i++) {
     if (!technologicalprocessDetailList.value[i].processStepNumber) {
-      proxy.$modal.msgError('第' + (i + 1) + '行工序序号不能为空!')
-      return
+      proxy.$modal.msgError("第" + (i + 1) + "行工序序号不能为空!");
+      return;
     }
   }
-  saveTechnologicalProcessDetail(technologicalprocessDetailList.value).then((res) => {
-    if (res.code == 200) {
-      getTechnologicalProcessDetails()
-      proxy.$modal.msgSuccess('操作成功!')
+  saveTechnologicalProcessDetail(technologicalprocessDetailList.value).then(
+    (res) => {
+      if (res.code == 200) {
+        getTechnologicalProcessDetails();
+        proxy.$modal.msgSuccess("操作成功!");
+      }
     }
-  })
-  editStatus.value = false
-}
-
-/** 删除产品表操作 */
-function handleDelete(row) {
-  const _ids = row.id 
-  deleteIds.value.push(_ids)
-  proxy.$modal
-    .confirm('是否确认删除选中的数据项?')
-    .then(function () {
-      delProduct(deleteIds.value).then(() => {
-        getList()
-        proxy.$modal.msgSuccess('删除成功!')
-      })
-    })
-    .catch(() => {})
-}
-
-/** 单条删除工艺操作
- * 删除已经存在的数据-即row.id存在,执行一个对话框选择,如果确认则执行删除方法,并重新查询工艺表操作,
- * 让工艺表第一条默认选中
- * 删除未保存的苏剧-即row.id不存在,通过splice方法,通过下标删除数组的元素
- */
-function handleDeleteTechnologicalProcess(row, index) {
-  if (row.id) {
-    proxy.$modal
-      .confirm('是否确认删除选中的数据项?')
-      .then(function () {
-        return delTechnologicalProcess(row.id)
-      })
-      .then(() => {
-        getTechnologicalProcesses(0)
-        proxy.$modal.msgSuccess('删除成功!')
-      })
-  } else {
-    technologicalProcessList.value.splice(index, 1)
-    getTechnologicalProcesses(0)
-  }
-}
-
-/** 工艺表批量删除操作
- * 通过多选框选中方法,获得选中的工艺id,执行删除,山删除后,重新通过产品id获得工艺列表
- */
-function TechnologicalProcessDelete() {
-  proxy.$modal
-    .confirm('是否确认删除选中的数据项?')
-    .then(function () {
-      return delTechnologicalProcess(technologicalProcessIds.value)
-    })
-    .then(() => {
-      getTechnologicalProcesses(0)
-      proxy.$modal.msgSuccess('删除成功!')
-    })
+  );
+  editStatus.value = false;
 }
 /** 工序表批量删除操作
  * 通过多选框获得选中的工序id,执行删除操作后执行查询操作
  */
 function handledelTechnologicalProcessDetail() {
   proxy.$modal
-    .confirm('是否确认删除选中的数据项?')
+    .confirm("是否确认删除选中的数据项?")
     .then(function () {
-      return delTechnologicalProcessDetail(technologicalProcessDetailIds.value)
+      return delTechnologicalProcessDetail(technologicalProcessDetailIds.value);
     })
     .then(() => {
-      getTechnologicalProcessDetails()
-      proxy.$modal.msgSuccess('删除成功!')
-    })
+      getTechnologicalProcessDetails();
+      proxy.$modal.msgSuccess("删除成功!");
+    });
 }
 
 /** 添加工序 */
 function handleAddProcess() {
-  proxy.$refs.processChoiceRef.open()
-}
-/** 工艺添加操作 */
-const handleAddTechnologicalProcess = () => {
-  const newDetail = JSON.parse(JSON.stringify(detailsRow))
-  newDetail.editStatus = true
-  newDetail.productCode = currentProduct.value.productCode
-  newDetail.productId = currentProduct.value.id
-  newDetail.productShaftCategoryId = currentProduct.value.shaftCategoryId
-  newDetail.productDrawingNumber = currentProduct.value.drawingNumber
-  newDetail.productDescription = currentProduct.value.description
-  newDetail.productSpecification = currentProduct.value.specification
-  newDetail.tenantId = currentProduct.value.tenantId
-  newDetail.technologyVersion = ''
-  technologicalProcessList.value.push(newDetail)
-}
-/** 工艺添加取消操作 */
-const handleSync = () => {
-  productLoading.value = true
-  getP2Product(queryParams.value).then((res) => {
-    console.log(res)
-    getList()
-  })
+  proxy.$refs.processChoiceRef.open();
 }
+
 onMounted(() => {
-  getList()
-})
+  getList();
+});
 </script>

+ 50 - 53
src/views/business/productionBatch/DialogCheckMaterial.vue

@@ -18,15 +18,45 @@
         height="370px"
         header-row-class-name="list-header-row"
         row-class-name="list-row"
-      ><el-table-column type="index" label="行号" width="50" align="center" />
-       <el-table-column label="厂家" align="center" width="100px" prop="factory" />
-        <el-table-column label="炉号" align="center" width="100px" prop="furnaceNumber" />
-        <el-table-column label="牌号" align="center" width="100px" prop="brandNumber" />
+        ><el-table-column type="index" label="行号" width="50" align="center" />
+        <el-table-column
+          label="厂家"
+          align="center"
+          width="100px"
+          prop="factory"
+        />
+        <el-table-column
+          label="炉号"
+          align="center"
+          width="100px"
+          prop="furnaceNumber"
+        />
+        <el-table-column
+          label="牌号"
+          align="center"
+          width="100px"
+          prop="brandNumber"
+        />
         <el-table-column label="规格" align="center" width="70" prop="spec" />
-        <el-table-column label="材料直径" align="center" width="80" prop="diameter" />
+        <el-table-column
+          label="材料直径"
+          align="center"
+          width="80"
+          prop="diameter"
+        />
         <el-table-column label="形状" align="center" width="60" prop="shape" />
-        <el-table-column label="来料日期" align="center" width="100" prop="incomingDate" />
-        <el-table-column label="原料编码" align="center" width="90" prop="rawMaterialCode" />
+        <el-table-column
+          label="来料日期"
+          align="center"
+          width="100"
+          prop="incomingDate"
+        />
+        <el-table-column
+          label="原料编码"
+          align="center"
+          width="90"
+          prop="rawMaterialCode"
+        />
         <el-table-column
           label="技术要求1"
           align="center"
@@ -43,67 +73,34 @@
       <el-button type="primary" icon="Check" @click="submitForm"
         >确 定</el-button
       >
-      <!-- <el-button icon="Close" @click="cancel">取 消</el-button> -->
     </template>
   </el-dialog>
 </template>
 <script setup>
-import axios from "axios";
-import { getToken } from "@/utils/auth";
-import { getFurnaceNoInfo} from '@/api/business/furnaceNoInfo.js'
-
-const { proxy } = getCurrentInstance();
-/** 字典数组区 */
-/** 表单抽屉 页变量 */
+import { getFurnaceNoInfo } from "@/api/business/furnaceNoInfo.js";
+/** 领料信息变量 */
 const visible = ref(false);
 const loading = ref(false);
 const furnaceNoInfoList = ref([]);
-const data = reactive({
-  form: {},
-});
-const { form, rules } = toRefs(data);
 /***********************  方法区  ****************************/
 /** 打开抽屉 */
 function open(row) {
   loading.value = true;
-  furnaceNoInfoList.value = []
-  getFurnaceNoInfo({ productionPlanNo: row.productionPlanNo,
-      lineNumber: row.lineNumber}).then((res) => {
-        if (res.code === 200 && res.data.length>0) {
+  furnaceNoInfoList.value = [];
+  getFurnaceNoInfo({
+    productionPlanNo: row.productionPlanNo,
+    lineNumber: row.lineNumber,
+  }).then((res) => {
+    if (res.code === 200 && res.data.length > 0) {
       furnaceNoInfoList.value = res.data;
+    } else {
+      furnaceNoInfoList.value = [];
     }
-    else {
-      furnaceNoInfoList.value = []
-    }
-      })
-  // let token = "Bearer " + getToken();
-  // axios({
-  //   headers: {
-  //     Authorization: token,
-  //   },
-  //   method: "get",
-  //   url: "http://120.46.159.163:7002/business/furnaceNoInfo/getFurnaceNoInfo",
-  //   params: {
-  //     productionPlanNo: row.productionPlanNo,
-  //     lineNumber: row.lineNumber,
-  //   }
-  // }).then((res) => {
-  //   if (res.data.code === 200 && res.data.data.length>0) {
-  //     furnaceNoInfoList.value = res.data.data;
-  //   }
-  //   else {
-  //     furnaceNoInfoList.value = []
-  //   }
-  // });
-  loading.value = false
+  });
+  loading.value = false;
   visible.value = true;
 }
-/** 取消按钮 */
-function cancel() {
-  visible.value = false;
-}
-
-/** 提交按钮 */
+/** 确定按钮 */
 function submitForm() {
   visible.value = false;
 }

+ 210 - 124
src/views/business/productionBatch/form.vue

@@ -1,18 +1,44 @@
 <template>
   <!-- 添加或修改项目信息对话框 -->
-  <el-dialog title="投产" height="400px" v-model="visible" width="900px" append-to-body draggable>
+  <el-dialog
+    title="投产"
+    height="400px"
+    v-model="visible"
+    width="900px"
+    append-to-body
+    draggable
+  >
     <div class="form-container">
-      <el-form ref="productRef" class="master-container" :model="form" :rules="rules" label-width="120px">
+      <el-form
+        ref="productRef"
+        class="master-container"
+        :model="form"
+        :rules="rules"
+        label-width="120px"
+      >
         <el-row>
           <el-col :span="12">
             <el-form-item label="生产计划单号">
               <span>{{ detailsRow.productionPlanNo }}</span>
             </el-form-item>
             <el-form-item label="当前投产批数" prop="lotNumber">
-              <el-input-number v-model="form.lotNumber" controls-position="right" style="width: 150px" @input="handleUpdateLotNumber" :min="0" />
+              <el-input-number
+                v-model="form.lotNumber"
+                controls-position="right"
+                style="width: 150px"
+                @input="handleUpdateLotNumber"
+                :min="0"
+              />
             </el-form-item>
             <el-form-item label="下达日期" prop="issuanceDate">
-              <el-date-picker clearable v-model="form.issuanceDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择实际开始 时间" style="width: 150px" />
+              <el-date-picker
+                clearable
+                v-model="form.issuanceDate"
+                type="date"
+                value-format="YYYY-MM-DD"
+                placeholder="请选择实际开始 时间"
+                style="width: 150px"
+              />
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -20,140 +46,178 @@
               <span>{{ detailsRow.productDescription }}</span>
             </el-form-item>
             <el-form-item label="当前投产量" prop="productionQuantity">
-              <el-input-number v-model="form.productionQuantity" :precision="0" :disabled="true" controls-position="right" style="width: 150px" />
+              <el-input-number
+                v-model="form.productionQuantity"
+                :precision="0"
+                :disabled="true"
+                controls-position="right"
+                style="width: 150px"
+              />
             </el-form-item>
-            <el-form-item label="尾批" style="align-items: center;" prop="lastLotStatus">
-              <el-switch v-model="form.lastLotStatus" :disabled="detailsRow.lastLot || detailsRow.status" size="large" style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949" active-text="是" inactive-text="否" :active-value="1" :inactive-value="0" @change="handleUpdateLastLotStatus" />
+            <el-form-item
+              label="尾批"
+              style="align-items: center"
+              prop="lastLotStatus"
+            >
+              <el-switch
+                v-model="form.lastLotStatus"
+                :disabled="detailsRow.lastLot || detailsRow.status"
+                size="large"
+                style="
+                  --el-switch-on-color: #13ce66;
+                  --el-switch-off-color: #ff4949;
+                "
+                active-text="是"
+                inactive-text="否"
+                :active-value="1"
+                :inactive-value="0"
+                @change="handleUpdateLastLotStatus"
+              />
             </el-form-item>
           </el-col>
         </el-row>
       </el-form>
     </div>
     <template #footer>
-      <el-button type="primary" icon="Check" @click="handleSave">确定</el-button>
+      <el-button type="primary" icon="Check" @click="handleSave"
+        >确定</el-button
+      >
       <el-button icon="Close" @click="handleCancel">取 消</el-button>
     </template>
   </el-dialog>
 </template>
 <script setup>
-import { savePlanDetailSubDetail, getLastLotStatus } from '@/api/business/planDetailSubDetail.js'
-import { listPlanDetailSubDetail } from '@/api/business/planDetailSubDetail.js'
-import { updateLotCodeStatus } from '@/api/business/productionPlanDetail.js'
+import {
+  savePlanDetailSubDetail,
+  getLastLotStatus,
+} from "@/api/business/planDetailSubDetail.js";
+import { updateLotCodeStatus } from "@/api/business/productionPlanDetail.js";
 
-const { proxy } = getCurrentInstance()
-const emit = defineEmits(['handleSaveSuccess'])
+const { proxy } = getCurrentInstance();
+const emit = defineEmits(["handleSaveSuccess"]);
 
 /** 表单抽屉 页变量 */
-const loading = ref(false)
-const detailsRow = ref({})
-const visible = ref(false)
+const loading = ref(false);
+const detailsRow = ref({});
+const visible = ref(false);
+//校验投产批次
 const validateLotNumber = (rule, value, callback) => {
-  const min = 0
-  const max = detailsRow.value.lotNumber
+  const min = 0;
+  const max = detailsRow.value.lotNumber;
   //如果生产子计划里没有尾批并且是编辑状态时
-  if(!detailsRow.value.lastLot && detailsRow.value.status) {
-    const max = detailsRow.value.lotNumber - 1
-    if(value>max) {
-       callback(new Error(`尾批未投,当前投产批数不能超过` + max))
-    }else {
-    callback()
-  }
-  }
-  else {
-  if (!Number.isInteger(value)) {
-    callback(new Error(`当前投产批数不能是小数`))
-  } else if (value <= min) {
-    callback(new Error('当前投产批数应大于0'))
-  } else if (value > max) {
-    callback(new Error(`当前投产批数不能超过` + max))
+  if (!detailsRow.value.lastLot && detailsRow.value.status) {
+    const max = detailsRow.value.lotNumber - 1;
+    if (value > max) {
+      callback(new Error(`尾批未投,当前投产批数不能超过` + max));
+    } else {
+      callback();
+    }
   } else {
-    callback()
+    if (!Number.isInteger(value)) {
+      callback(new Error(`当前投产批数不能是小数`));
+    } else if (value <= min) {
+      callback(new Error("当前投产批数应大于0"));
+    } else if (value > max) {
+      callback(new Error(`当前投产批数不能超过` + max));
+    } else {
+      callback();
+    }
   }
-}
-}
+};
+//校验投产量
 const validateproductionQuantity = (rule, value, callback) => {
- //如果此批为尾批
+  //如果此批为尾批
   if (form.value.lastLotStatus == 1) {
-    var max = detailsRow.value.productionQuantity + detailsRow.value.lastLotQuantity
+    var max =
+      detailsRow.value.productionQuantity + detailsRow.value.lastLotQuantity;
   } else {
-    var max = detailsRow.value.productionQuantity
+    var max = detailsRow.value.productionQuantity;
   }
   if (value <= 0) {
-    callback(new Error('当前投产量应大于0'))
+    callback(new Error("当前投产量应大于0"));
   } else if (value > max) {
-    callback(new Error(`当前投产量不能超过` + max))
+    callback(new Error(`当前投产量不能超过` + max));
   } else {
-    callback()
+    callback();
   }
-}
+};
+//校验尾批switch
 const validateSwitch = (rule, value, callback) => {
   //detailsRow.value.status为true时为编辑,为false时是新增
   if (detailsRow.value.status) {
-    callback()
+    callback();
   } else {
     //当此批没选择尾批时
     if (form.value.lastLotStatus == 0) {
       //当前投产批数+子计划累计投产批数 = 总批数时,并且已投产的生产子计划没有尾批
-      if (form.value.lotNumber + detailsRow.value.lotTotalNumber == detailsRow.value.totalLotNumber && !detailsRow.value.lastLot) {
-        callback(new Error('此次投产应选尾批'))
+      if (
+        form.value.lotNumber + detailsRow.value.lotTotalNumber ==
+          detailsRow.value.totalLotNumber &&
+        !detailsRow.value.lastLot
+      ) {
+        callback(new Error("此次投产应选尾批"));
       } else {
-        callback()
-      }
-    }
-    else {
         callback();
       }
+    } else {
+      callback();
+    }
   }
-  }
+};
 const data = reactive({
   form: {
     deptId: null,
-    lotNumber: 0
-    },
+    lotNumber: 0,
+  },
   rules: {
     lotNumber: [
-      { required: true, message: '当前投产批数不能为空', trigger: 'blur' },
-      { validator: validateLotNumber, trigger: 'blur' }
+      { required: true, message: "当前投产批数不能为空", trigger: "blur" },
+      { validator: validateLotNumber, trigger: "blur" },
+    ],
+    issuanceDate: [
+      { required: true, message: "下达日期不能为空", trigger: "blur" },
     ],
-    issuanceDate: [{ required: true, message: '下达日期不能为空', trigger: 'blur' }],
     productionQuantity: [
-      { required: true, message: '当前投产量不能为空', trigger: 'blur' },
-      { validator: validateproductionQuantity, trigger: 'blur' }
+      { required: true, message: "当前投产量不能为空", trigger: "blur" },
+      { validator: validateproductionQuantity, trigger: "blur" },
     ],
     lastLotStatus: [
-      { required: false, message: '请选择是否尾批', trigger: ['change', 'blur'] },
-      { validator: validateSwitch, trigger: 'blur' } // 使用自定义验证函数进行验证
-    ]
-  }
-})
-const { form, rules } = toRefs(data)
+      {
+        required: false,
+        message: "请选择是否尾批",
+        trigger: ["change", "blur"],
+      },
+      { validator: validateSwitch, trigger: "blur" }, // 使用自定义验证函数进行验证
+    ],
+  },
+});
+const { form, rules } = toRefs(data);
 /***********************  方法区  ****************************/
 /** 表单重置 */
 function reset() {
   form.value = {
     id: null,
     productionPlanId: 0,
-    productionPlanDetailId: '0',
+    productionPlanDetailId: "0",
     productionQuantity: 0,
-    productId: '0',
-    technologicalProcessId: '0',
-    technologyVersion: '',
+    productId: "0",
+    technologicalProcessId: "0",
+    technologyVersion: "",
     lotNumber: 0,
     productionQuantity: 0,
-    issuanceDate: proxy.moment().format('YYYY-MM-DD'),
+    issuanceDate: proxy.moment().format("YYYY-MM-DD"),
     remark: null,
-    lastLotStatus:0
-  }
-  proxy.resetForm('productRef')
+    lastLotStatus: 0,
+  };
+  proxy.resetForm("productRef");
 }
 
 /** 打开抽屉 */
 function open(row) {
-  reset()
-  visible.value = true
-  loading.value = true
+  reset();
+  visible.value = true;
+  loading.value = true;
   if (row) {
-    console.log(row)
     detailsRow.value = proxy.deepClone(row);
     form.value.id = row.id;
     form.value.productionPlanNo = row.productionPlanNo;
@@ -162,100 +226,122 @@ function open(row) {
     form.value.deptId = row.deptId;
     form.value.technologicalProcessId = row.technologicalProcessId;
     form.value.technologyVersion = row.technologyVersion;
-    form.value.lastLotStatus =  detailsRow.value.lastLotStatus
-    console.log(form.value.lastLotStatus)
-    if (typeof row.pickUpQuantity == 'undefined') {
+    form.value.lastLotStatus = detailsRow.value.lastLotStatus;
+    if (typeof row.pickUpQuantity == "undefined") {
       detailsRow.value.pickUpQuantity = 0;
     }
-    if ( typeof row.lotTotalNumber == 'undefined') {
-      detailsRow.value.lotTotalNumber = 0
+    if (typeof row.lotTotalNumber == "undefined") {
+      detailsRow.value.lotTotalNumber = 0;
     }
     //当row.status为true时编辑状态
     if (row.status) {
-      form.value.lotNumber = row.lotNumber
-      detailsRow.value.lotNumber = detailsRow.value.totalLotNumber - detailsRow.value.lotTotalNumber + row.lotNumber
-      form.value.productionQuantity = row.productionQuantity
+      form.value.lotNumber = row.lotNumber;
+      detailsRow.value.lotNumber =
+        detailsRow.value.totalLotNumber -
+        detailsRow.value.lotTotalNumber +
+        row.lotNumber;
+      form.value.productionQuantity = row.productionQuantity;
       //已投产的生产子计划有尾批
       if (detailsRow.value.lastLot) {
-        detailsRow.value.productionQuantity = detailsRow.value.productionQuantityTotal - detailsRow.value.pickUpQuantity + detailsRow.value.productionQuantity    
+        detailsRow.value.productionQuantity =
+          detailsRow.value.productionQuantityTotal -
+          detailsRow.value.pickUpQuantity +
+          detailsRow.value.productionQuantity;
       } else {
-        detailsRow.value.productionQuantity = detailsRow.value.productionQuantityTotal - detailsRow.value.pickUpQuantity + detailsRow.value.productionQuantity - detailsRow.value.lastLotQuantity
+        detailsRow.value.productionQuantity =
+          detailsRow.value.productionQuantityTotal -
+          detailsRow.value.pickUpQuantity +
+          detailsRow.value.productionQuantity -
+          detailsRow.value.lastLotQuantity;
       }
       //新增状态
     } else {
-      detailsRow.value.lotNumber = detailsRow.value.totalLotNumber - detailsRow.value.lotTotalNumber;
-        //子计划已经有尾批
-        if(detailsRow.value.lastLot) {
+      detailsRow.value.lotNumber =
+        detailsRow.value.totalLotNumber - detailsRow.value.lotTotalNumber;
+      //子计划已经有尾批
+      if (detailsRow.value.lastLot) {
         detailsRow.value.productionQuantity =
-        detailsRow.value.productionQuantityTotal -
-        detailsRow.value.pickUpQuantity 
-        }
-        else {
+          detailsRow.value.productionQuantityTotal -
+          detailsRow.value.pickUpQuantity;
+      } else {
         detailsRow.value.productionQuantity =
-        detailsRow.value.productionQuantityTotal -
-        detailsRow.value.pickUpQuantity - detailsRow.value.lastLotQuantity;
-        }
+          detailsRow.value.productionQuantityTotal -
+          detailsRow.value.pickUpQuantity -
+          detailsRow.value.lastLotQuantity;
+      }
     }
   }
-  loading.value = false
+  loading.value = false;
 }
 //当前投产批数修改时,投产量自动改变
 function handleUpdateLotNumber(data) {
   if (data <= 0) {
-    form.value.productionQuantity = 0
+    form.value.productionQuantity = 0;
   } else {
     //该批为尾批
-    if(form.value.lastLotStatus == 1) {
-      if ((data-1) * detailsRow.value.oneLotQuantity >detailsRow.value.productionQuantity) {
-      form.value.productionQuantity = detailsRow.value.productionQuantity + detailsRow.value.lastLotQuantity;
-    } else {
-      form.value.productionQuantity = (data-1) * detailsRow.value.oneLotQuantity + detailsRow.value.lastLotQuantity ;
-    }   
+    if (form.value.lastLotStatus == 1) {
+      if (
+        (data - 1) * detailsRow.value.oneLotQuantity >
+        detailsRow.value.productionQuantity
+      ) {
+        form.value.productionQuantity =
+          detailsRow.value.productionQuantity +
+          detailsRow.value.lastLotQuantity;
+      } else {
+        form.value.productionQuantity =
+          (data - 1) * detailsRow.value.oneLotQuantity +
+          detailsRow.value.lastLotQuantity;
+      }
     }
     //该批不是尾批
-    else{
-       //当前投产批数*生产计划单批量>总投产量时,投产量为总投产量
-      if (data * detailsRow.value.oneLotQuantity >detailsRow.value.productionQuantity) {
-      form.value.productionQuantity = detailsRow.value.productionQuantity;
-    } else {
-        form.value.productionQuantity = data * detailsRow.value.oneLotQuantity
+    else {
+      //当前投产批数*生产计划单批量>总投产量时,投产量为总投产量
+      if (
+        data * detailsRow.value.oneLotQuantity >
+        detailsRow.value.productionQuantity
+      ) {
+        form.value.productionQuantity = detailsRow.value.productionQuantity;
+      } else {
+        form.value.productionQuantity = data * detailsRow.value.oneLotQuantity;
+      }
     }
   }
 }
-}
 //当尾批switch状态改变时
 function handleUpdateLastLotStatus() {
-  handleUpdateLotNumber(form.value.lotNumber)
+  handleUpdateLotNumber(form.value.lotNumber);
 }
 
 /** 提交按钮 */
 function handleSave() {
-  proxy.$refs['productRef'].validate((valid) => {
+  proxy.$refs["productRef"].validate((valid) => {
     if (valid) {
       // /**工艺版本变成P2拉取过来先绑定个假数据 */
       savePlanDetailSubDetail(form.value).then((res) => {
         if (res.code == 200) {
-          proxy.$modal.msgSuccess('保存成功!')
-          visible.value = false
+          proxy.$modal.msgSuccess("保存成功!");
+          visible.value = false;
           //detailsRow.value.id = detailsRow.value.productionPlanDetailId
           if (detailsRow.value.lotTotalNumber == 0) {
-            updateLotCodeStatus({ id: detailsRow.value.productionPlanDetailId, lotCodeStatusCode: 'OKK' }).then((res) => {})
+            updateLotCodeStatus({
+              id: detailsRow.value.productionPlanDetailId,
+              lotCodeStatusCode: "OKK",
+            }).then((res) => {});
           }
-          emit('handleSaveSuccess')
+          emit("handleSaveSuccess");
         }
-      })
-      console.log( form.value.lastLotStatus,form.value.lotNumber,detailsRow.value.lotTotalNumber,detailsRow.value.totalLotNumber,!detailsRow.value.lastLot)
+      });
     }
-  })
+  });
 }
 /** 取消按钮 */
 function handleCancel() {
-  visible.value = false
-  reset()
+  visible.value = false;
+  reset();
 }
 
 /** 暴露给父组件的方法 */
 defineExpose({
-  open
-})
+  open,
+});
 </script>

+ 401 - 240
src/views/business/productionBatch/index.vue

@@ -2,56 +2,198 @@
   <div class="page-container column-container">
     <section class="list-part-container column-container" style="flex: 1">
       <!-- 搜索区 -->
-      <el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true">
+      <el-form
+        class="list-search-container"
+        :model="queryParams"
+        ref="queryRef"
+        :inline="true"
+      >
         <el-form-item class="section-title" label="生产计划" />
         <el-form-item label="生产计划单号:">
-          <el-input placeholder="请输入生产计划单号" v-model.trim="queryParams.productionPlanNo" @keyup.enter="handleQuery" @keydown.enter.prevent clearable style="width: 200px" />
+          <el-input
+            placeholder="请输入生产计划单号"
+            v-model.trim="queryParams.productionPlanNo"
+            @keyup.enter="handleQueryProductionPlanDetail"
+            @keydown.enter.prevent
+            clearable
+            style="width: 200px"
+          />
         </el-form-item>
         <el-form-item label="产品描述:">
-          <el-input placeholder="请输入产品描述" v-model.trim="queryParams.keywords" @keyup.enter="handleQuery" @keydown.enter.prevent clearable style="width: 200px" />
+          <el-input
+            placeholder="请输入产品描述"
+            v-model.trim="queryParams.keywords"
+            @keyup.enter="handleQueryProductionPlanDetail"
+            @keydown.enter.prevent
+            clearable
+            style="width: 200px"
+          />
         </el-form-item>
 
         <el-form-item>
-          <el-button type="info" icon="Search" @click="handleQuery"> 搜索 </el-button>
-          <!-- <el-button type="success" icon="Refresh" @click="handleQuery">刷新</el-button> -->
+          <el-button
+            type="info"
+            icon="Search"
+            @click="handleQueryProductionPlanDetail"
+          >
+            搜索
+          </el-button>
         </el-form-item>
-
         <el-form-item class="section-title" label="请选择当前工段:">
-          <el-select-v2 v-model="queryParams.deptId" filterable :options="deptList" placeholder="请选择工段" style="width: 100%" @change="handleDeptChange" />
+          <el-select-v2
+            v-model="queryParams.deptId"
+            filterable
+            :options="deptList"
+            placeholder="请选择工段"
+            style="width: 100%"
+            @change="handleDeptChange"
+          />
         </el-form-item>
-
       </el-form>
       <div class="el-table-container">
         <div class="el-table-inner-container">
-          <el-table ref="planDetailTable" :data="detailPlanList" v-loading="detailLoading" highlight-current-row height="100%" @current-change="handlePlanDetailCurrentChange">
-            <el-table-column label="客户简称" prop="companyAlias" width="150" align="center" />
-            <el-table-column label="生产计划单号" prop="productionPlanNo" width="110" align="center" />
-            <el-table-column label="序号" width="60" prop="lineNumber" align="center" />
-            <el-table-column label="产品描述" prop="productDescription" width="150" align="center" />
-            <el-table-column label="图纸版本" prop="technologyVersion" width="70" align="center" />
-            <el-table-column label="总投产量" prop="productionQuantity" width="80" align="center" />
-            <el-table-column label="总批数" prop="totalLotNumber" width="80" align="center" />
-            <el-table-column label="单批量" prop="oneLotQuantity" width="80" align="center" />
-            <el-table-column label="尾批量" prop="lastLotQuantity" width="80" align="center" />
-            <el-table-column label="批号状态" prop="lotCodeStatusCode" width="100" align="center">
+          <el-table
+            ref="planDetailTable"
+            :data="detailPlanList"
+            v-loading="detailLoading"
+            highlight-current-row
+            height="100%"
+            @current-change="handlePlanDetailCurrentChange"
+          >
+            <el-table-column
+              label="客户简称"
+              prop="companyAlias"
+              width="120"
+              align="center"
+            />
+            <el-table-column
+              label="生产计划单号"
+              prop="productionPlanNo"
+              width="110"
+              align="center"
+            />
+            <el-table-column
+              label="序号"
+              width="60"
+              prop="lineNumber"
+              align="center"
+            />
+            <el-table-column
+              label="产品描述"
+              prop="productDescription"
+              align="center"
+            />
+            <el-table-column
+              label="图纸版本"
+              prop="technologyVersion"
+              width="70"
+              align="center"
+            />
+            <el-table-column
+              label="总投产量"
+              prop="productionQuantity"
+              width="80"
+              align="center"
+            />
+            <el-table-column
+              label="总批数"
+              prop="totalLotNumber"
+              width="70"
+              align="center"
+            />
+            <el-table-column
+              label="单批量"
+              prop="oneLotQuantity"
+              width="80"
+              align="center"
+            />
+            <el-table-column
+              label="尾批量"
+              prop="lastLotQuantity"
+              width="80"
+              align="center"
+            />
+            <el-table-column
+              label="批号状态"
+              prop="lotCodeStatusCode"
+              width="100"
+              align="center"
+            >
               <template #default="scope">
-                <dict-tag :options="lot_code_status_code" :value="scope.row.lotCodeStatusCode" />
+                <dict-tag
+                  :options="lot_code_status_code"
+                  :value="scope.row.lotCodeStatusCode"
+                />
               </template>
             </el-table-column>
-            <!-- <el-table-column label="批号状态" prop="lotCodeStatusCode" width="60" align="center" /> -->
-            <el-table-column label="累计投产量" prop="pickUpQuantity" width="80" align="center" />
-            <el-table-column label="累计投产批数" prop="lotTotalNumber" width="90" align="center" />
-            <el-table-column label="库位" prop="storageLocation" width="80" align="center" />
-            <el-table-column label="领料部门" prop="requisitionDepartmentName" align="center" >
+            <el-table-column
+              label="累计投产量"
+              prop="pickUpQuantity"
+              width="80"
+              align="center"
+            />
+            <el-table-column
+              label="累计投产批数"
+              prop="lotTotalNumber"
+              width="90"
+              align="center"
+            />
+            <el-table-column
+              label="库位"
+              prop="storageLocation"
+              width="80"
+              align="center"
+            />
+            <el-table-column
+              label="领料部门"
+              prop="requisitionDepartmentName"
+              width="100"
+              align="center"
+            >
               <template #default="scope">
                 <span>{{ scope.row.requisitionDepartmentName }}</span>
               </template>
             </el-table-column>
-            <el-table-column label="下达日期" prop="issueDate" width="120" align="center" />
-            <el-table-column  label="操作" width="200" align="center" fixed="right">
+            <el-table-column
+              label="下达日期"
+              prop="issueDate"
+              width="100"
+              align="center"
+            />
+            <el-table-column
+              label="操作"
+              width="240"
+              align="center"
+              fixed="right"
+            >
               <template #default="scope">
-                <el-button  link type="warning" icon="View" @click="handleCheckMarterialInfo(scope.row)" >领料信息 </el-button>
-                <el-button :disabled="!(queryParams.deptId == scope.row.requisitionDepartmentId) ||(scope.row.totalLotNumber == scope.row.lotTotalNumber) " link type="primary" icon="Postcard" @click="handleAddSubDetail(scope.row)" v-hasPermi="['business:productionBatch:add']">投产 </el-button>
+                <el-button
+                  link
+                  type="success"
+                  icon="View"
+                  @click="handleCheckMarterialInfo(scope.row)"
+                  >领料信息
+                </el-button>
+                <el-button
+                  :disabled="
+                    !(
+                      queryParams.deptId == scope.row.requisitionDepartmentId
+                    ) || scope.row.totalLotNumber == scope.row.lotTotalNumber
+                  "
+                  link
+                  type="primary"
+                  icon="Postcard"
+                  @click="handleAddSubDetail(scope.row)"
+                  v-hasPermi="['business:productionBatch:add']"
+                  >投产
+                </el-button>
+                <!-- <el-button
+                  icon="edit"
+                  link
+                  type="warning"
+                  @click="handleUpdateProduction(scope.row)"
+                  >编辑</el-button
+                > -->
               </template>
             </el-table-column>
           </el-table>
@@ -59,7 +201,13 @@
       </div>
     </section>
     <!-- 分页 -->
-    <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getSubDetail" />
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      v-model:page="queryParams.pageNum"
+      v-model:limit="queryParams.pageSize"
+      @pagination="getProductionPlanDetail"
+    />
 
     <section class="list-part-container row-container" style="flex: 1">
       <section class="list-part-container" style="flex: 4">
@@ -67,34 +215,101 @@
         <!-- 搜索区 -->
         <el-form class="list-search-container" :inline="true">
           <el-form-item class="section-title" label="生产子计划" />
-          <!-- <el-form-item class="section-title" label="请选择当前工段:">
-            <el-select-v2 v-model="queryParams.deptId" filterable :options="deptList" placeholder="请选择工段" style="width: 100%" @change="handleDeptChange" />
-          </el-form-item> -->
         </el-form>
         <div class="el-table-container">
           <div class="el-table-inner-container">
-            <el-table ref="subDetailsTable" v-loading="subDetailsLoading" :data="subList" highlight-current-row height="100%" @selection-change="handleSelectionChange" @current-change="handleSubDetailCurrentChange">
-              <el-table-column type="index" label="行号" width="50" align="center" />
-              <el-table-column label="生产计划单号" prop="productionPlanNo" width="110" align="center" />
-              <el-table-column label="产品描述" prop="productDescription" align="center" />
-              <el-table-column label="首序投产量" prop="productionQuantity" width="80" align="center" />
-              <el-table-column label="首序投产批数" prop="lotNumber" width="100" align="center">
+            <el-table
+              ref="subDetailsTable"
+              v-loading="subDetailsLoading"
+              :data="subList"
+              highlight-current-row
+              height="100%"
+            >
+              <el-table-column
+                type="index"
+                label="行号"
+                width="50"
+                align="center"
+              />
+              <el-table-column
+                label="生产计划单号"
+                prop="productionPlanNo"
+                width="110"
+                align="center"
+              />
+              <el-table-column
+                label="产品描述"
+                prop="productDescription"
+                align="center"
+              />
+              <el-table-column
+                label="首序投产量"
+                prop="productionQuantity"
+                width="80"
+                align="center"
+              />
+              <el-table-column
+                label="首序投产批数"
+                prop="lotNumber"
+                width="100"
+                align="center"
+              >
                 <template #default="scope">
-                  <el-input-number v-if="scope.row.editStatus" v-model="scope.row.lotNumber" placeholder="当前投产批数" :controls="false" :precision="0" :min="0" :max="scope.row.totalLotNumber" align="center" />
+                  <el-input-number
+                    v-if="scope.row.editStatus"
+                    v-model="scope.row.lotNumber"
+                    placeholder="当前投产批数"
+                    :controls="false"
+                    :precision="0"
+                    :min="0"
+                    :max="scope.row.totalLotNumber"
+                    align="center"
+                  />
                   <span v-else>{{ scope.row.lotNumber }}</span>
                 </template>
               </el-table-column>
-              <el-table-column label="下达日期" prop="issuanceDate" width="120" align="center">
+              <el-table-column
+                label="下达日期"
+                prop="issuanceDate"
+                width="120"
+                align="center"
+              >
                 <template #default="scope">
-                  <el-date-picker v-if="scope.row.editStatus" clearable v-model="scope.row.issuanceDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择实际开始 时间" />
+                  <el-date-picker
+                    v-if="scope.row.editStatus"
+                    clearable
+                    v-model="scope.row.issuanceDate"
+                    type="date"
+                    value-format="YYYY-MM-DD"
+                    placeholder="请选择实际开始 时间"
+                  />
                   <span v-else>{{ scope.row.issuanceDate }}</span>
                 </template>
               </el-table-column>
-              <el-table-column label="操作" width="150" align="center" v-if="flag">
+              <el-table-column
+                label="操作"
+                width="150"
+                align="center"
+                v-if="flag"
+              >
                 <template #default="scope">
-                  <el-button v-if="!scope.row.editStatus" icon="edit" link type="warning" @click="handleShowSubDetailDialog(scope.row)" v-hasPermi="['business:productionBatch:edit']">编辑
+                  <el-button
+                    v-if="!scope.row.editStatus"
+                    icon="edit"
+                    link
+                    type="warning"
+                    @click="handleShowSubDetailDialog(scope.row)"
+                    v-hasPermi="['business:productionBatch:edit']"
+                    >编辑
                   </el-button>
-                  <el-button v-if="!scope.row.editStatus" icon="delete" link type="danger" @click="handleDelSubDetail(scope.row)" v-hasPermi="['business:productionBatch:remove']">删除
+                  <el-button
+                    v-if="!scope.row.editStatus"
+                    icon="delete"
+                    link
+                    type="danger"
+                    @click="handleDelSubDetail(scope.row)"
+                    v-hasPermi="['business:productionBatch:remove']"
+                    >删除
                   </el-button>
                 </template>
               </el-table-column>
@@ -103,294 +318,240 @@
         </div>
       </section>
     </section>
-    <!-- 表单 -->
-    <production-lot-form ref="productionRef" @handleSaveSuccess="handleFresh()" />
+    <!-- 投产表单 -->
+    <production-lot-form
+      ref="productionRef"
+      @handleSaveSuccess="handleFresh()"
+    />
+    <!-- 领料信息弹窗 -->
     <check-material ref="checkMaterialRef" />
+    <!-- <production-dialog ref="productionDetailRef" @handleUpdateSuccess = "handleFresh()"/> -->
   </div>
 </template>
 <script setup name="ProductionBatch">
-import { ref } from 'vue'
-import { listProductionPlanDetail } from '@/api/business/productionPlanDetail.js'
-import { savePlanDetailSubDetail, listPlanDetailSubDetail, delPlanDetailSubDetail, getDept, getLastLotStatus } from '@/api/business/planDetailSubDetail.js'
-import { saveBatchEquipment, listEquipment, delEquipment } from '@/api/business/productionPlanDetailEquipment.js'
-import { listTechnologicalProcessDetail } from '@/api/business/technologicalProcessDetail.js'
-import { updateLotCodeStatus } from '@/api/business/productionPlanDetail.js'
-import checkMaterial from './DialogCheckMaterial.vue'
-import productionLotForm from './form'
-const { proxy } = getCurrentInstance()
-const { lot_code_status_code } = proxy.useDict('lot_code_status_code')
-
-/** 生产子计划列表 */
-const subList = ref([])
-/** 工序列表 */
-const processList = ref([])
-/** 设备列表 */
-const equipmentList = ref([])
-/**当前工段列表 */
-const deptList = ref([])
-const planDetailTable = ref(null)
-const subDetailsTable = ref(null)
-const processTable = ref(null)
-
-/**生产计划批次点击对象 */
-const currentPlanDetail = ref({})
-const flag = ref(false)
-
-/**子计划点击对象 */
-const currentSubDetail = ref({})
-const currentProcess = ref({})
-
-const subDetailsLoading = ref(false)
-const equipmentLoading = ref(false)
-const detailPlanList = ref([])
-const loading = ref(false)
-const detailLoading = ref(false)
-const ids = ref([])
-const equipmentCodeIds = ref([])
-const single = ref(true)
-const multiple = ref(true)
-/**设备多选 */
-const equipmentIds = ref([])
-const equipmentSingle = ref(true)
-const equipmentMultiple = ref(true)
-const total = ref(0)
+import { ref } from "vue";
+import { listProductionPlanDetail } from "@/api/business/productionPlanDetail.js";
+import {
+  listPlanDetailSubDetail,
+  delPlanDetailSubDetail,
+  getDept,
+  getLastLotStatus
+} from "@/api/business/planDetailSubDetail.js";
+import { updateLotCodeStatus } from "@/api/business/productionPlanDetail.js";
+import checkMaterial from "./DialogCheckMaterial";
+import productionLotForm from "./form";
+// import productionDialog from './DialogProduction'
+const { proxy } = getCurrentInstance();
+/** 字典数组区 */
+const { lot_code_status_code } = proxy.useDict("lot_code_status_code");
+/** 生产计划 */
+const currentPlanDetail = ref({});
+const detailPlanList = ref([]);
+const detailLoading = ref(false);
+const total = ref(0);
+/** 工段 */
+const loading = ref(false);
+const deptList = ref([]);
+/** 生产子计划 */
+const subList = ref([]);
+const flag = ref(false);
+const subDetailsLoading = ref(false);
 /** 查询对象 */
 const queryParams = ref({
-  deptId: '',
-  keywords: '',
+  deptId: "",
+  keywords: "",
   pageNum: 1,
-  pageSize: 10
-})
+  pageSize: 10,
+});
 
 /***********************  方法区  ****************************/
-
+/***********************  工段  ****************************/
 /**
- * 查询生产批次列表
- * 由于生产计划批次列表是根据首序进行投产,所以不需要今天部门的获取
+查询工段
  *
  */
 function getList() {
-  loading.value = true
+  loading.value = true;
   getDept().then((response) => {
-    deptList.value = response.data
+    deptList.value = response.data;
     if (deptList.value.length > 0) {
-      queryParams.value.deptId = deptList.value[0].value
-      getSubDetail()
+      queryParams.value.deptId = deptList.value[0].value;
+      getProductionPlanDetail();
     }
-  })
-  loading.value = false
+  });
+  loading.value = false;
+}
+/**工段下拉框change事件 */
+function handleDeptChange() {
+  handlePlanDetailCurrentChange(currentPlanDetail.value);
 }
+/***********************  生产计划  ****************************/
 
 /** 生产子计划进行修改时,对生产计划进行重新查询并选中*/
 function handleFresh() {
-  detailLoading.value = true
+  detailLoading.value = true;
   listProductionPlanDetail(queryParams.value).then((res) => {
-    detailPlanList.value = res.rows
-    total.value = res.total
-    detailLoading.value = false
+    detailPlanList.value = res.rows;
+    total.value = res.total;
+    detailLoading.value = false;
     //生产子计划点击
     if (detailPlanList.value.length > 0) {
       for (var i = 0; i < detailPlanList.value.length; i++) {
         if (detailPlanList.value[i].id == currentPlanDetail.value.id) {
-          var index = i
-          break
+          var index = i;
+          break;
         }
       }
     }
-    proxy.$refs.planDetailTable.setCurrentRow(detailPlanList.value[index])
-  })
+    proxy.$refs.planDetailTable.setCurrentRow(detailPlanList.value[index]);
+  });
 }
-
 /**查询计划明细 */
-function getSubDetail() {
-  detailLoading.value = true
+function getProductionPlanDetail() {
+  detailLoading.value = true;
   listProductionPlanDetail(queryParams.value).then((res) => {
-    detailPlanList.value = res.rows
-    total.value = res.total
-    detailLoading.value = false
-    detailPlanList.value = res.rows
-    total.value = res.total
-    detailLoading.value = false
+    detailPlanList.value = res.rows;
+    total.value = res.total;
+    detailLoading.value = false;
+    detailPlanList.value = res.rows;
+    total.value = res.total;
+    detailLoading.value = false;
     //生产子计划点击
     if (detailPlanList.value.length > 0) {
-      proxy.$refs.planDetailTable.setCurrentRow(detailPlanList.value[0])
+      proxy.$refs.planDetailTable.setCurrentRow(detailPlanList.value[0]);
     }
-  })
-}
-/** 搜索按钮操作 */
-function handleQuery() {
-  queryParams.value.pageNum = 1
-  getSubDetail()
-}
-
-// 多选框选中子计划数据
-function handleSelectionChange(selection) {
-  ids.value = selection.map((item) => item.id)
-  single.value = selection.length != 1
-  multiple.value = !selection.length
+  });
 }
-// 多选框选中设备数据
-function handleEquipmentSelectionChange(selection) {
-  equipmentIds.value = selection.map((item) => item.id)
-  equipmentSingle.value = selection.length != 1
-  equipmentMultiple.value = !selection.length
+/** 生产计划搜索按钮操作 */
+function handleQueryProductionPlanDetail() {
+  queryParams.value.pageNum = 1;
+  getProductionPlanDetail();
 }
+// //修改生产计划
+// function handleUpdateProduction(row) {
+//   proxy.$refs.productionDetailRef.open(row);
+// }
 //查询生产计划单的领料信息
 function handleCheckMarterialInfo(row) {
-  proxy.$refs.checkMaterialRef.open(row)
+  proxy.$refs.checkMaterialRef.open(row);
 }
 /** 生产计划明细 current-change 事件 */
 function handlePlanDetailCurrentChange(row) {
   if (row) {
-    currentPlanDetail.value = row
-    if(currentPlanDetail.value.requisitionDepartmentId == queryParams.value.deptId) {
-      flag.value = true
+    currentPlanDetail.value = row;
+    if (
+      currentPlanDetail.value.requisitionDepartmentId ==
+      queryParams.value.deptId
+    ) {
+      flag.value = true;
+    } else {
+      flag.value = false;
     }
-    else {
-      flag.value = false
-    }
-    subDetailsLoading.value = true
+    subDetailsLoading.value = true;
     listPlanDetailSubDetail({
       productionPlanDetailId: row.id,
-      deptId: queryParams.value.deptId
+      deptId: queryParams.value.deptId,
     }).then((res) => {
-      subList.value = res.rows
-      subDetailsLoading.value = false
-      if (subList.value.length > 0) {
-        proxy.$refs.subDetailsTable.setCurrentRow(subList.value[0])
-      }
-    })
+      subList.value = res.rows;
+      subDetailsLoading.value = false;
+    });
   } else {
-    subList.value = []
-    processList.value = []
-    equipmentList.value = []
+    subList.value = [];
   }
 }
-/** 生产子计划 current-change 事件 */
-function handleSubDetailCurrentChange(row) {
-  if (row) {
-    currentSubDetail.value = row
-    listTechnologicalProcessDetail({
-      technologicalProcessId: row.technologicalProcessId
-    }).then((res) => {
-      processList.value = res.rows
-    })
-  }
-}
-/**工段下拉框change事件 */
-function handleDeptChange() {
-  handlePlanDetailCurrentChange(currentPlanDetail.value)
-}
-
+/***********************  生产子计划  ****************************/
 /**新增按钮生产子计划 */
 function handleAddSubDetail(row) {
   /**创建一个空的对象,将生产计划中的数据赋值给子计划数据 */
-  const newDetail = {}
-  newDetail.productionPlanId = row.productionPlanId
-  newDetail.productionPlanDetailId = row.id
-  newDetail.productionPlanNo = row.productionPlanNo
+  const newDetail = {};
+  newDetail.productionPlanId = row.productionPlanId;
+  newDetail.productionPlanDetailId = row.id;
+  newDetail.productionPlanNo = row.productionPlanNo;
   //生产计划总投产量
-  newDetail.productionQuantityTotal = row.productionQuantity
-  newDetail.productId = row.productId
-  newDetail.productDescription = row.productDescription
-   //生产计划单批量
-  newDetail.oneLotQuantity = row.oneLotQuantity
-  newDetail.deptId = queryParams.value.deptId
-  newDetail.totalLotNumber = row.totalLotNumber
-  newDetail.technologicalProcessId = row.technologicalProcessId
-  newDetail.technologyVersion = row.technologyVersion
+  newDetail.productionQuantityTotal = row.productionQuantity;
+  newDetail.productId = row.productId;
+  newDetail.productDescription = row.productDescription;
+  //生产计划单批量
+  newDetail.oneLotQuantity = row.oneLotQuantity;
+  newDetail.deptId = queryParams.value.deptId;
+  newDetail.totalLotNumber = row.totalLotNumber;
+  newDetail.technologicalProcessId = row.technologicalProcessId;
+  newDetail.technologyVersion = row.technologyVersion;
   //子计划累计投产量
-  newDetail.pickUpQuantity = row.pickUpQuantity
-   //子计划累计投产批数
-  newDetail.lotTotalNumber = row.lotTotalNumber
-   //生产计划尾批数
-  newDetail.lastLotQuantity = row.lastLotQuantity
+  newDetail.pickUpQuantity = row.pickUpQuantity;
+  //子计划累计投产批数
+  newDetail.lotTotalNumber = row.lotTotalNumber;
+  //生产计划尾批数
+  newDetail.lastLotQuantity = row.lastLotQuantity;
   //新增尾批状态默认为否
-  newDetail.lastLotStatus = 0
+  newDetail.lastLotStatus = 0;
   //新增状态
-  newDetail.status = false
+  newDetail.status = false;
   //新增时查询生产子计划数据
   getLastLotStatus(row.id).then((response) => {
     if (response.code == 200) {
       //如果为true,生产子计划已有尾批
-      newDetail.lastLot = response.data
-      proxy.$refs.productionRef.open(newDetail)
+      newDetail.lastLot = response.data;
+      proxy.$refs.productionRef.open(newDetail);
     }
-  })
+  });
 }
 
 /** 修改 生产子计划 事件 */
 function handleShowSubDetailDialog(row) {
-  console.log(row)
   //生产计划单批量
-  row.oneLotQuantity = currentPlanDetail.value.oneLotQuantity
+  row.oneLotQuantity = currentPlanDetail.value.oneLotQuantity;
   //子计划累计投产量
-  row.pickUpQuantity = currentPlanDetail.value.pickUpQuantity
+  row.pickUpQuantity = currentPlanDetail.value.pickUpQuantity;
   //子计划累计投产批数
-  row.lotTotalNumber = currentPlanDetail.value.lotTotalNumber
+  row.lotTotalNumber = currentPlanDetail.value.lotTotalNumber;
   //生产计划总投产量
-  row.productionQuantityTotal = currentPlanDetail.value.productionQuantity
+  row.productionQuantityTotal = currentPlanDetail.value.productionQuantity;
   //生产计划总批数
-  row.totalLotNumber = currentPlanDetail.value.totalLotNumber
+  row.totalLotNumber = currentPlanDetail.value.totalLotNumber;
   //生产计划尾批数
-  row.lastLotQuantity = currentPlanDetail.value.lastLotQuantity
+  row.lastLotQuantity = currentPlanDetail.value.lastLotQuantity;
   //生产计划id
-  row.productionPlanDetailId = currentPlanDetail.value.id
+  row.productionPlanDetailId = currentPlanDetail.value.id;
   //编辑状态
-  row.status = true
+  row.status = true;
   //修改尾批状态在row里
   getLastLotStatus(currentPlanDetail.value.id).then((response) => {
     if (response.code == 200) {
       //如果为true,生产子计划已有尾批
-      newDetail.lastLot = response.data
-      proxy.$refs.productionRef.open(newDetail)
-    }
-  })
-  row.lastLot = false
-  proxy.$refs.productionRef.open(row)
-}
-
-/** 生产子计划 保存事件 */
-function handleSaveSubDetail(row) {
-  savePlanDetailSubDetail(row).then((res) => {
-    if (res.code == 200) {
-      proxy.$modal.msgSuccess('保存成功!')
-      getSubDetail()
-      //handlePlanDetailCurrentChange(currentPlanDetail.value)
+      newDetail.lastLot = response.data;
+      proxy.$refs.productionRef.open(newDetail);
     }
-  })
+  });
+  row.lastLot = false;
+  proxy.$refs.productionRef.open(row);
 }
 
 /** 删除子计划事件 */
 function handleDelSubDetail(row) {
-  const _ids = row.id || ids.value
-  var subInfo = subList.value.filter((item) => !item.id.includes(_ids))
+  const _ids = row.id;
+  var subInfo = subList.value.filter((item) => !item.id.includes(_ids));
   proxy.$modal
-    .confirm('是否确认删除选中的数据项?')
+    .confirm("是否确认删除选中的数据项?")
     .then(function () {
-      return delPlanDetailSubDetail(_ids)
+      return delPlanDetailSubDetail(_ids);
     })
     .then(() => {
       if (subInfo.length == 0) {
         updateLotCodeStatus({
           id: currentPlanDetail.value.id,
-          lotCodeStatusCode: 'NA'
-        }).then((res) => {})
+          lotCodeStatusCode: "NA",
+        }).then((res) => {});
       }
-      handleFresh()
-      //handlePlanDetailCurrentChange(currentPlanDetail.value)
-
-      proxy.$modal.msgSuccess('删除成功!')
+      handleFresh();
+      proxy.$modal.msgSuccess("删除成功!");
     })
-    .catch(() => {})
+    .catch(() => {});
 }
-
-/** */
-
 onMounted(() => {
-  getSubDetail()
-  getList()
-})
+  getProductionPlanDetail();
+  getList();
+});
 </script>
 <style scoped>
 .list-search-container-child .el-form-item {

+ 173 - 106
src/views/business/reject/index.vue

@@ -3,20 +3,31 @@
     <!-- 左侧区域 -->
     <section class="list-part-container" style="flex: 1">
       <!-- 搜索区域 -->
-      <el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true" style="display: flex">
+      <el-form
+        class="list-search-container"
+        ref="queryRef"
+        :inline="true"
+        style="display: flex"
+      >
         <el-form-item class="section-title" label="载具类别" />
         <el-form-item label="类别名称:">
-          <el-input placeholder="请输入类别名称" clearable style="width: 150px" v-model.trim="name" @keydown.enter.prevent  />
+          <el-input
+            placeholder="请输入类别名称"
+            clearable
+            style="width: 150px"
+            v-model.trim="name"
+            @keydown.enter.prevent
+          />
         </el-form-item>
       </el-form>
       <!-- 列表区 -->
       <div class="el-table-container">
         <div class="el-table-inner-container">
-          <el-tree 
+          <el-tree
             ref="categoryTable"
             v-loading="categoryLoading"
             :data="carrierCategoryList"
-            :props="{label: 'name', children: 'children'}"
+            :props="{ label: 'name', children: 'children' }"
             :expand-on-click-node="false"
             :filter-node-method="filterNode"
             default-expand-all
@@ -24,11 +35,15 @@
             highlight-current
             @node-click="handleCurrentCategoryChange"
           >
-          <template #default="{ node, data }">   
+            <template #default="{ node, data }">
               <span>
-                <span v-if="data.parentId == 0" style="display: inline-block; width: 20px;">{{ getNodeIndex(data) }}. </span>
-                <span>{{ node.label }}</span>
+                <span
+                  v-if="data.parentId == 0"
+                  style="display: inline-block; width: 20px"
+                  >{{ getNodeIndex(data) }}.
                 </span>
+                <span>{{ node.label }}</span>
+              </span>
             </template>
           </el-tree>
         </div>
@@ -37,175 +52,227 @@
 
     <!-- 右侧区域 -->
     <section class="list-part-container" style="flex: 3">
-      <el-form class="list-search-container" :model="carrierRejectParams" ref="queryRef" :inline="true">
+      <el-form
+        class="list-search-container"
+        :model="queryCarrierRejectParams"
+        ref="queryRef"
+        :inline="true"
+      >
         <el-form-item class="section-title" label="载具操作明细" />
         <el-form-item label="载具编号:">
-          <el-input placeholder="请输入载具编号" :disabled="carrierCategoryList.length == 0" clearable style="width: 180px" v-model.trim="carrierRejectParams.code" @keydown.enter.prevent @keyup.enter="handleQueryCarrier" />
+          <el-input
+            placeholder="请输入载具编号"
+            :disabled="carrierCategoryList.length == 0"
+            clearable
+            style="width: 180px"
+            v-model.trim="queryCarrierRejectParams.code"
+            @keydown.enter.prevent
+            @keyup.enter="handleQueryCarrier"
+          />
         </el-form-item>
         <el-form-item label="载具状态:">
-          <el-select v-model="carrierRejectParams.isAbandoned" clearable placeholder="请选择载具状态" style="width: 150px">
-            <el-option v-for="dict in carrier_status" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
+          <el-select
+            v-model="queryCarrierRejectParams.isAbandoned"
+            clearable
+            placeholder="请选择载具状态"
+            style="width: 150px"
+          >
+            <el-option
+              v-for="dict in carrier_status"
+              :key="dict.value"
+              :label="dict.label"
+              :value="dict.value"
+            ></el-option>
           </el-select>
         </el-form-item>
         <el-form-item>
-          <el-button type="info" icon="Search" :disabled="carrierCategoryList.length == 0" @click="handleQueryCarrier">搜索</el-button>
+          <el-button
+            type="info"
+            icon="Search"
+            :disabled="carrierCategoryList.length == 0"
+            @click="handleQueryCarrier"
+            >搜索</el-button
+          >
         </el-form-item>
       </el-form>
 
       <!-- 列表区 -->
       <div class="el-table-container">
         <div class="el-table-inner-container">
-          <el-table v-loading="carrierRejectLoading" :data="carrierRejectList" height="100%">
-            <el-table-column type="index" label="行号" width="50" align="center" />
-            <el-table-column prop="code" label="载具编号" width="120" align="center" />
-            <el-table-column label="状态" width="80" prop="isAbandoned" align="center">
+          <el-table
+            v-loading="carrierRejectLoading"
+            :data="carrierRejectList"
+            height="100%"
+          >
+            <el-table-column
+              type="index"
+              label="行号"
+              width="50"
+              align="center"
+            />
+            <el-table-column
+              prop="code"
+              label="载具编号"
+              width="120"
+              align="center"
+            />
+            <el-table-column
+              label="状态"
+              width="80"
+              prop="isAbandoned"
+              align="center"
+            >
               <template #default="scope">
                 {{ scope.row.status }}
-                <dict-tag :options="carrier_status" :value="scope.row.isAbandoned" />
+                <dict-tag
+                  :options="carrier_status"
+                  :value="scope.row.isAbandoned"
+                />
               </template>
             </el-table-column>
-            <el-table-column prop="operationDate" label="操作日期" width="130" align="center">
+            <el-table-column
+              prop="operationDate"
+              label="操作日期"
+              width="130"
+              align="center"
+            >
               <template #default="scope">
                 {{ proxy.moment(scope.row.operationDate).format("YYYY-MM-DD") }}
               </template>
             </el-table-column>
-            <el-table-column prop="abandonmentReason" label="废弃原因" align="center">
+            <el-table-column
+              prop="abandonmentReason"
+              label="废弃原因"
+              align="center"
+            >
             </el-table-column>
           </el-table>
         </div>
       </div>
-
       <!-- 分页 -->
-      <pagination v-show="carrierRejectTotal > 0" :total="carrierRejectTotal" v-model:page="carrierRejectParams.pageNum" v-model:limit="carrierRejectParams.pageSize" @pagination="getCarriersReject" />
+      <pagination
+        v-show="carrierRejectTotal > 0"
+        :total="carrierRejectTotal"
+        v-model:page="queryCarrierRejectParams.pageNum"
+        v-model:limit="queryCarrierRejectParams.pageSize"
+        @pagination="getCarriersReject"
+      />
     </section>
   </div>
 </template>
   
-  <script setup name="Process">
-import { listCategory, listCategoryInfo } from '@/api/business/carrier'
-import { listReject } from '@/api/business/reject'
-const { proxy } = getCurrentInstance()
-const { carrier_status } = proxy.useDict('carrier_status')
-const { reason_for_abandonment } = proxy.useDict('reason_for_abandonment')
-
-const categoryTable = ref(null)
-const carrierCategoryList = ref([])
-const carrierRejectList = ref([])
-const currentCategory = ref({})
-const categoryLoading = ref(false)
-const carrierRejectLoading = ref(false)
-const carrierRejectTotal = ref(0)
-const name = ref('')
-
+<script setup name="Process">
+import { listCategory } from "@/api/business/carrier";
+import { listReject } from "@/api/business/reject";
+const { proxy } = getCurrentInstance();
+/** 字典数组区 */
+const { carrier_status } = proxy.useDict("carrier_status");
+/** 载具类别变量 */
+const currentCategory = ref({});
+const carrierCategoryList = ref([]);
+const categoryLoading = ref(false);
+const name = ref("");
+/** 载具操作明细变量 */
+const carrierRejectList = ref([]);
+const carrierRejectLoading = ref(false);
+const carrierRejectTotal = ref(0);
+/** 查询对象 */
 const data = reactive({
   form: {},
-  queryParams: {
-    name: '',
-    pageNum: 1,
-    pageSize: 10
-  },
-  carrierRejectParams: {
-    code: '',
+  queryCarrierRejectParams: {
+    code: "",
     pageNum: 1,
     pageSize: 10,
-    isAbandoned: '',
-    categoryId: ''
-  }
-})
+    isAbandoned: "",
+    categoryId: "",
+  },
+});
 
-const { queryParams, carrierRejectParams } = toRefs(data)
-/** 查询对象 */
+const { queryCarrierRejectParams } = toRefs(data);
 
 /****************************  载具类别相关事件  ****************************/
 /** 载具分类列表 */
 const getCategories = () => {
-  categoryLoading.value = true
+  categoryLoading.value = true;
   listCategory().then((res) => {
-    categoryLoading.value = false
-    carrierCategoryList.value = res.rows
+    categoryLoading.value = false;
+    carrierCategoryList.value = res.rows;
     if (carrierCategoryList.value.length > 0) {
-      currentCategory.value = carrierCategoryList.value[0]
+      currentCategory.value = carrierCategoryList.value[0];
       nextTick(() => {
-      proxy.$refs.categoryTable.setCurrentKey(currentCategory.value.id)
-      handleCurrentCategoryChange(currentCategory.value)
-    })
+        proxy.$refs.categoryTable.setCurrentKey(currentCategory.value.id);
+        handleCurrentCategoryChange(currentCategory.value);
+      });
+    } else {
+      carrierRejectList.value = [];
     }
-    else {
-      carrierRejectList.value = []
-    }
-  })
-}
-
+  });
+};
+//载具类别点击事件
 const handleCurrentCategoryChange = (row) => {
   if (row) {
-    currentCategory.value = row
+    currentCategory.value = row;
   } else {
-    currentCategory.value = {}
+    currentCategory.value = {};
     if (carrierCategoryList.value.length > 0) {
-      currentCategory.value = carrierCategoryList.value[0]
+      currentCategory.value = carrierCategoryList.value[0];
     }
   }
   if (currentCategory.value.id) {
-    getCarriersReject()
+    getCarriersReject();
   } else {
-    carrierRejectList.value = []
-    carrierRejectTotal.value = 0
+    carrierRejectList.value = [];
+    carrierRejectTotal.value = 0;
   }
-}
+};
+//载具类别搜索事件
 watch(name, (val) => {
-  proxy.$refs['categoryTable'].filter(val)
-})
+  proxy.$refs["categoryTable"].filter(val);
+});
 const filterNode = (value, data) => {
   if (!value) {
-    return true
+    return true;
   }
-  carrierRejectParams.value.code = ''
-  carrierRejectParams.value.isAbandoned = null
-  handleCurrentCategoryChange(carrierCategoryList.value[0])
-  return data.name.indexOf(value) !== -1
-}
+  queryCarrierRejectParams.value.code = "";
+  queryCarrierRejectParams.value.isAbandoned = null;
+  handleCurrentCategoryChange(carrierCategoryList.value[0]);
+  return data.name.indexOf(value) !== -1;
+};
+//载具类别编号
 function getNodeIndex(data) {
   const index = carrierCategoryList.value.findIndex(
     (item) => item.id === data.id
   );
   return index + 1;
 }
-
-const handleQueryCategory = () => {
-  getCategories()
-}
 /****************************  载具操作明细相关事件  ****************************/
-
+//获取载具废弃明细
 const getCarriersReject = () => {
-  carrierRejectLoading.value = true
-  carrierRejectParams.value.categoryId = currentCategory.value.id
-  listReject(carrierRejectParams.value).then((res) => {
-    carrierRejectLoading.value = false
-    carrierRejectList.value = res.rows
-    carrierRejectTotal.value = res.total
-  })
-}
-
-const handleRefreshCarrier = () => {
-  getCarriersReject()
-}
-
+  carrierRejectLoading.value = true;
+  queryCarrierRejectParams.value.categoryId = currentCategory.value.id;
+  listReject(queryCarrierRejectParams.value).then((res) => {
+    carrierRejectLoading.value = false;
+    carrierRejectList.value = res.rows;
+    carrierRejectTotal.value = res.total;
+  });
+};
+// 载具操作明细搜索
 const handleQueryCarrier = () => {
-  carrierRejectParams.value.pageNum = 1
-  handleRefreshCarrier()
-}
+  queryCarrierRejectParams.value.pageNum = 1;
+  getCarriersReject();
+};
 onMounted(() => {
-  getCategories()
-})
+  getCategories();
+});
 </script>
 <style scoped>
 :deep(.el-tree-node__label) {
-    font-size: 14px !important;
+  font-size: 14px !important;
 }
 :deep(.el-tree-node__content) {
-    height: 40px;
-    border-bottom: 1px solid #ebeef5;
-    padding: 8px 0;
-    line-height: 23px;
+  height: 40px;
+  border-bottom: 1px solid #ebeef5;
+  padding: 8px 0;
+  line-height: 23px;
 }
 </style>

+ 10 - 31
src/views/business/resourcePlan/form.vue

@@ -15,7 +15,7 @@
       </el-form>
   
       <el-table ref="dialogTable" :data="subDetailList" :row-key="getRowKey" size="small" v-loading="loading" border height="360px" header-row-class-name="list-header-row" row-class-name="list-row" @selection-change="handleSelectionChange">
-        <el-table-column type="selection" width="40" align="center" :reserve-selection="true" :selectable="(row) => !planDetailIds.includes(row.id)"/>
+        <el-table-column type="selection" width="40" align="center" :reserve-selection="true" />
         <el-table-column type="index" label="行号" width="50" align="center" />
         <el-table-column label="生产计划单号" prop="productionPlanNo" width="110" align="center" />
         <el-table-column label="序号" width="60" prop="lineNumber" align="center" />
@@ -36,7 +36,7 @@
       <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
       <template #footer>
         <div class="dialog-footer">
-          <el-button type="primary" icon="Check" :disabled="selections.length === 0" @click="handleMultipleSelected">确定</el-button>
+          <el-button type="primary" icon="Check" :disabled="selections.length == 0" @click="handleMultipleSelected">确定</el-button>
           <el-button icon="Close" @click="close">取 消</el-button>
         </div>
       </template>
@@ -46,50 +46,36 @@
   import { ref } from 'vue'
   import { listProductionPlanDetailList } from '@/api/business/productionPlanDetail.js'
   const { proxy } = getCurrentInstance()
+  /**生产计划分配弹窗变量  */
   const total = ref(0)
   const props = defineProps({
     multiple: {
       type: Boolean,
       default: false
     },
-    selected: {
-      type: Array,
-      defalut: []
-    },
-    singleSelected: {
-      type: Function,
-      default: null
-    },
     multipleSelected: {
       type: Function,
       default: null
     }
   })
-  
-  const { singleSelected, multipleSelected, selected } = toRefs(props)
+  const { multipleSelected } = toRefs(props)
   const subDetailList = ref([])
   const visible = ref(false)
   const loading = ref(false)
+  const selections = ref([])
+  /**查询对象 */
   const data = reactive({
     queryParams: {
       pageSize: 10,
       pageNum: 1
     }
   })
-  const selections = ref([])
-  const planDetailIds = ref([])
   const { queryParams } = toRefs(data)
-  
+  /***********************  方法区  ****************************/
   /** 获取行 id */
   function getRowKey(row) {
     return row.id
   }
-  function getPendingLots(row) {
-    if(row.lotTotalNumber) {
-      row.lotTotalNumber = 0
-    }
-    return (row.totalLotNumber - row.lotTotalNumber) > 0 ? (row.totalLotNumber - row.lotTotalNumber) : 0;
-    };
   
   /**
    * 对话框打开 事件
@@ -98,10 +84,10 @@
     queryParams.value.pageNum = 1
     visible.value = true
     if(row) {
-      planDetailIds.value = row.planDetailIds
       queryParams.value.deptId = row.deptId
+      queryParams.value.resourceGroupId = row.resourceGroupId
+      getList()
     }
-    getList()
   }
   
   /**
@@ -110,6 +96,7 @@
   function close() {
     proxy.$refs.dialogForm.resetFields()
     proxy.$refs.dialogTable.clearSelection()
+    total.value = 0
     visible.value = false
   }
   /**
@@ -145,14 +132,6 @@
     }
   }
   
-  /** 单选事件 */
-  function handleSingleSelected(row) {
-    if (singleSelected.value) {
-      singleSelected.value(row)
-    }
-    close()
-  }
-  
   /** 多选事件 */
   function handleMultipleSelected() {
     if (multipleSelected.value) {

+ 284 - 141
src/views/business/resourcePlan/index.vue

@@ -6,243 +6,386 @@
       <el-form class="list-search-container" ref="queryRef" :inline="true">
         <el-form-item class="section-title" label="资源组" />
         <el-form-item class="section-title" label="请选择当前工段:">
-          <el-select-v2 v-model="queryParams.deptId" :options="deptList" placeholder="请选择工段" style="width: 100%" @change="handleChangeDeptId" />
+          <el-select-v2
+            v-model="queryParams.deptId"
+            :options="deptList"
+            placeholder="请选择工段"
+            style="width: 100%"
+            @change="handleChangeDeptId"
+          />
         </el-form-item>
         <el-form-item label="资源组名称:">
-          <el-input placeholder="请输入资源组名称"  v-model.trim="queryParams.code" style="width: 150px" clearable  @keydown.enter.prevent  />
+          <el-input
+            placeholder="请输入资源组名称"
+            v-model.trim="queryParams.code"
+            style="width: 150px"
+            clearable
+            @keydown.enter.prevent
+          />
         </el-form-item>
         <el-form-item>
-          <el-button type="info" icon="Search" :disabled="deptList.length === 0"  @click="handleQuery">搜索</el-button>
+          <el-button
+            type="info"
+            icon="Search"
+            :disabled="deptList.length === 0"
+            @click="handleQuery"
+            >搜索</el-button
+          >
         </el-form-item>
       </el-form>
       <div class="el-table-container">
         <div class="el-table-inner-container">
-          <el-table ref="resourceGroupTable" :data="resourceGroupList" v-loading="resourceGroupLoading" highlight-current-row height="100%" @current-change="handleResourceGroupCurrentChange">
-            <el-table-column label="行号" type="index" width="50" align="center" />
-            <el-table-column label="资源组名称" width="70" prop="code" align="center" />
-            <el-table-column label="资源组人员" width="200" prop="nickName" align="center" />
+          <el-table
+            ref="resourceGroupTable"
+            :data="resourceGroupList"
+            v-loading="resourceGroupLoading"
+            highlight-current-row
+            height="100%"
+            @current-change="handleResourceGroupCurrentChange"
+          >
+            <el-table-column
+              label="行号"
+              type="index"
+              width="50"
+              align="center"
+            />
+            <el-table-column
+              label="资源组名称"
+              width="70"
+              prop="code"
+              align="center"
+            />
+            <el-table-column
+              label="资源组人员"
+              width="200"
+              prop="nickName"
+              align="center"
+            />
             <el-table-column label="设备编码" width="120" align="center">
               <template #default="scope">
-                <div v-for="(item,index) in scope.row.groupEquipmentList" :key="index">
-                  <div style="height: auto;">{{item.commonCode}}</div>
+                <div
+                  v-for="(item, index) in scope.row.groupEquipmentList"
+                  :key="index"
+                >
+                  <div style="height: auto">{{ item.commonCode }}</div>
                 </div>
               </template>
             </el-table-column>
             <el-table-column label="设备名称" align="center">
               <template #default="scope">
-                <div v-for="(item,index) in scope.row.groupEquipmentList" :key="index">
-                  <div style="height: auto;">{{item.commonName}}</div>
+                <div
+                  v-for="(item, index) in scope.row.groupEquipmentList"
+                  :key="index"
+                >
+                  <div style="height: auto">{{ item.commonName }}</div>
                 </div>
               </template>
             </el-table-column>
-
           </el-table>
         </div>
       </div>
     </section>
     <!-- 右侧区域 -->
     <section class="list-part-container" style="flex: 2">
-      <el-form class="list-search-container" :inline="true" >
-        <el-form-item class="section-title" label="生产计划" label-width="60px" />
-        <el-form-item label="生产计划信息:" >
-          <el-input v-model.trim="queryItemParams.productionPlanNo"  placeholder="请输入厂家/生产计划单号/产品描述" clearable style="width: 250px"  @keydown.enter.prevent  />
+      <el-form class="list-search-container" :inline="true">
+        <el-form-item
+          class="section-title"
+          label="生产计划"
+          label-width="60px"
+        />
+        <el-form-item label="生产计划信息:">
+          <el-input
+            v-model.trim="queryItemParams.productionPlanNo"
+            placeholder="请输入厂家/生产计划单号/产品描述"
+            clearable
+            style="width: 250px"
+            @keydown.enter.prevent
+          />
         </el-form-item>
-        <el-form-item >
-          <el-button type="info" icon="Search" :disabled="!currentResourceGroup.id" @click="handleQueryPlanDetails">搜索</el-button>
-          <el-button type="primary" icon="Plus" :disabled="!currentResourceGroup.id" @click="handleOpenPlanDetailDialog()">新增</el-button>
-          <el-button type="danger" icon="Delete" :disabled="!currentResourceGroup.id ||planDetailIds.length == 0" @click="handleDeletePlanDetail()">批量删除</el-button>
+        <el-form-item>
+          <el-button
+            type="info"
+            icon="Search"
+            :disabled="!currentResourceGroup.id"
+            @click="handleQueryPlanDetails"
+            >搜索</el-button
+          >
+          <el-button
+            type="primary"
+            icon="Plus"
+            :disabled="!currentResourceGroup.id"
+            @click="handleOpenPlanDetailDialog()"
+            >新增</el-button
+          >
+          <el-button
+            type="danger"
+            icon="Delete"
+            :disabled="!currentResourceGroup.id || planDetailIds.length == 0"
+            @click="handleDeletePlanDetail()"
+            >批量删除</el-button
+          >
         </el-form-item>
-        </el-form>
-        <div class="el-table-container">
-          <div class="el-table-inner-container">
-            <el-table ref="planDetailsTable"  v-loading="planDetailLoading" row-key="id" :data="planDetailList" highlight-current-row height="100%" @selection-change="handleSelectionChange">
-              <el-table-column type="selection" width="40" align="center" />
-              <el-table-column type="index" label="行号" width="50" align="center" />
-              <el-table-column label="厂家" prop="companyAlias" width="150" align="center" />
-              <el-table-column label="生产计划单号" prop="productionPlanNo" width="100" align="center" />
-              <el-table-column label="序号" width="60" prop="lineNumber" align="center" />
-              <el-table-column label="产品描述" prop="productDescription" width="350" align="center" />
-              <el-table-column label="投产日期" prop="issuanceDate" width="100" align="center">
+      </el-form>
+      <div class="el-table-container">
+        <div class="el-table-inner-container">
+          <el-table
+            ref="planDetailsTable"
+            v-loading="planDetailLoading"
+            row-key="id"
+            :data="planDetailList"
+            highlight-current-row
+            height="100%"
+            @selection-change="handleSelectionChange"
+          >
+            <el-table-column type="selection" width="40" align="center" />
+            <el-table-column
+              type="index"
+              label="行号"
+              width="50"
+              align="center"
+            />
+            <el-table-column
+              label="厂家"
+              prop="companyAlias"
+              width="150"
+              align="center"
+            />
+            <el-table-column
+              label="生产计划单号"
+              prop="productionPlanNo"
+              width="100"
+              align="center"
+            />
+            <el-table-column
+              label="序号"
+              width="60"
+              prop="lineNumber"
+              align="center"
+            />
+            <el-table-column
+              label="产品描述"
+              prop="productDescription"
+              width="350"
+              align="center"
+            />
+            <el-table-column
+              label="投产日期"
+              prop="issuanceDate"
+              width="100"
+              align="center"
+            >
               <template #default="scope">
                 <span>{{
                   proxy.moment(scope.row.issuanceDate).format("YYYY-MM-DD")
                 }}</span>
               </template>
-        </el-table-column>
-        <el-table-column label="批次数" prop="lotTotalNumber" width="70" align="center" ></el-table-column>
-              <el-table-column fixed="right" label="操作" width="80" align="center">
-                <template #default="scope">
-                  <el-button  icon="delete" link type="danger" @click="handleDelPlanDetail(scope.row)">删除
-                  </el-button>
-                </template>
-              </el-table-column>
-            </el-table>
-          </div>
+            </el-table-column>
+            <el-table-column
+              label="批次数"
+              prop="lotTotalNumber"
+              width="70"
+              align="center"
+            ></el-table-column>
+            <el-table-column
+              fixed="right"
+              label="操作"
+              width="80"
+              align="center"
+            >
+              <template #default="scope">
+                <el-button
+                  icon="delete"
+                  link
+                  type="danger"
+                  @click="handleDelPlanDetail(scope.row)"
+                  >删除
+                </el-button>
+              </template>
+            </el-table-column>
+          </el-table>
         </div>
-        <!-- 分页 -->
-        <pagination v-show="itemTotal > 0" :total="itemTotal" v-model:page="queryItemParams.pageNum" v-model:limit="queryItemParams.pageSize" @pagination="getPlanDetail" />
-      </section>
-        <!-- 表单 -->
-    <plan-detail-form ref="planDetailRef"  :multiple-selected="handlePlanDetailSelected"></plan-detail-form>
-    </div>
-  </template>
+      </div>
+      <!-- 分页 -->
+      <pagination
+        v-show="itemTotal > 0"
+        :total="itemTotal"
+        v-model:page="queryItemParams.pageNum"
+        v-model:limit="queryItemParams.pageSize"
+        @pagination="getPlanDetail"
+      />
+    </section>
+    <!-- 生产计划分配弹窗 -->
+    <plan-detail-dialog
+      ref="planDetailRef"
+      :multiple-selected="handlePlanDetailSelected"
+    ></plan-detail-dialog>
+  </div>
+</template>
   
   <script setup>
-import { listResourceGroup } from '@/api/business/resourceGroup.js'
-import { listResourcePlan, saveBatchResourcePlan, delResourcePlan } from '@/api/business/resourcePlan.js'
-import { getDept } from '@/api/business/planDetailSubDetail.js'
-import planDetailForm from './form'
-import { ref } from 'vue'
-const { proxy } = getCurrentInstance()
+import { listResourceGroup } from "@/api/business/resourceGroup.js";
+import {
+  listResourcePlan,
+  saveBatchResourcePlan,
+  delResourcePlan,
+} from "@/api/business/resourcePlan.js";
+import { getDept } from "@/api/business/planDetailSubDetail.js";
+import planDetailDialog from "./form";
+import { ref } from "vue";
+const { proxy } = getCurrentInstance();
 
 /**资源组*/
-const resourceGroupList = ref([])
-const resourceGroupLoading = ref(false)
+const resourceGroupList = ref([]);
+const resourceGroupLoading = ref(false);
 
 /** 生产计划 */
-const planDetailList = ref([])
-const planDetailLoading = ref(false)
-const planDetailIds = ref([])
-const currentResourceGroup = ref({})
-const total = ref(0)
-const itemTotal = ref(0)
+const planDetailList = ref([]);
+const planDetailLoading = ref(false);
+const planDetailIds = ref([]);
+const currentResourceGroup = ref({});
+const itemTotal = ref(0);
 /**当前工段列表 */
-const deptList = ref([])
-const loading = ref(false)
+const deptList = ref([]);
+const loading = ref(false);
 
 /** 查询对象 */
 const queryItemParams = ref({
-  resourceGroupId: '',
-  deptId: '',
+  resourceGroupId: "",
+  deptId: "",
   pageNum: 1,
-  pageSize: 10
-})
+  pageSize: 10,
+});
 const queryParams = ref({
-  resourceGroupId: '',
+  resourceGroupId: "",
   deptId: null,
   pageNum: 1,
-  pageSize: 10
-})
+  pageSize: 10,
+});
 
 /***********************  方法区  ****************************/
+/***********************  工段相关事件 ****************************/
 /**
  * 查询生产批次列表
  * 由于生产计划批次列表是根据首序进行投产,所以不需要今天部门的获取
  *
  */
 function getList() {
-  loading.value = true
+  loading.value = true;
   getDept().then((response) => {
-    deptList.value = response.data
+    deptList.value = response.data;
     if (deptList.value.length > 0) {
-      queryParams.value.deptId = deptList.value[0].value
-      getResourceGroup()
+      queryParams.value.deptId = deptList.value[0].value;
+      getResourceGroup();
     }
-  })
-  loading.value = false
+  });
+  loading.value = false;
 }
+/**选择工段 */
 function handleChangeDeptId(row) {
-  queryParams.value.deptId = row
-  getResourceGroup()
+  queryParams.value.deptId = row;
+  getResourceGroup();
 }
-
+/***********************  资源组相关事件  ****************************/
 /** 查询资源组明细 */
 function getResourceGroup() {
-  resourceGroupLoading.value = true
+  resourceGroupLoading.value = true;
   listResourceGroup(queryParams.value).then((res) => {
-    resourceGroupList.value = res.rows
-    resourceGroupLoading.value = false
+    resourceGroupList.value = res.rows;
+    resourceGroupLoading.value = false;
     if (resourceGroupList.value.length > 0) {
-      proxy.$refs.resourceGroupTable.setCurrentRow(resourceGroupList.value[0])
+      proxy.$refs.resourceGroupTable.setCurrentRow(resourceGroupList.value[0]);
     }
-  })
-}
-
-/** 查询生产计划详情列表 */
-const getPlanDetail = () => {
-  planDetailLoading.value = true
-  listResourcePlan(queryItemParams.value).then((res) => {
-    planDetailList.value = res.rows
-    itemTotal.value = res.total
-    planDetailLoading.value = false
-  })
-}
-
-function handleQueryPlanDetails () {
-  getPlanDetail()
+  });
 }
+/**查询资源组 */
 function handleQuery() {
-  getResourceGroup()
+  getResourceGroup();
 }
-
 /** 资源组 current-change 事件 */
 function handleResourceGroupCurrentChange(row) {
   if (row) {
-    currentResourceGroup.value = row
-    queryItemParams.value.resourceGroupId = currentResourceGroup.value.id
-    getPlanDetail()
+    currentResourceGroup.value = row;
+    queryItemParams.value.resourceGroupId = currentResourceGroup.value.id;
+    getPlanDetail();
   } else {
-    planDetailList.value = []
+    planDetailList.value = [];
   }
 }
+/***********************  生产计划相关事件  ****************************/
+/** 查询生产计划详情列表 */
+const getPlanDetail = () => {
+  planDetailLoading.value = true;
+  listResourcePlan(queryItemParams.value).then((res) => {
+    planDetailList.value = res.rows;
+    itemTotal.value = res.total;
+    planDetailLoading.value = false;
+  });
+};
 
+/**查询生产计划 */
+function handleQueryPlanDetails() {
+  getPlanDetail();
+}
 /** 新增生产子计划 */
 function handleOpenPlanDetailDialog() {
-  var info = {}
-  info.planDetailIds = []
-  info.deptId = queryParams.value.deptId
-  planDetailList.value.map((item) => {
-    info.planDetailIds.push(item.productionPlanDetailId)
-  })
-  proxy.$refs.planDetailRef.open(info)
+  var info = {};
+  info.resourceGroupId = currentResourceGroup.value.id;
+  info.deptId = queryParams.value.deptId;
+  proxy.$refs.planDetailRef.open(info);
 }
 /** 生产计划批量删除*/
-  function handleSelectionChange(selection) {
-  planDetailIds.value = selection.map((item) => item.id)
+function handleSelectionChange(selection) {
+  planDetailIds.value = selection.map((item) => item.id);
 }
-
-  function handleDeletePlanDetail() {
-    delResourcePlan(planDetailIds.value).then((res) => {
-    if (res.code === 200) {
-      getPlanDetail()
-      proxy.$modal.msgSuccess('删除成功')
-    }
-  })
+/**多选删除生产计划 */
+function handleDeletePlanDetail() {
+  proxy.$modal
+    .confirm("是否确认删除选中的数据项?")
+    .then(function () {
+      delResourcePlan(planDetailIds.value).then((res) => {
+        getPlanDetail();
+        proxy.$modal.msgSuccess("删除成功!");
+      });
+    })
+    .catch(() => {});
 }
 
 /** 生产计划带回 */
 function handlePlanDetailSelected(selection) {
-  var planDetail = []
+  var planDetail = [];
   for (var i = 0; i < selection.length; i++) {
-    var planDetailInfo = {}
-    planDetailInfo.productionPlanDetailId = selection[i].id
-    planDetailInfo.productId = selection[i].productId
-    planDetailInfo.technologicalProcessId = selection[i].technologicalProcessId
-    planDetailInfo.resourceGroupId = currentResourceGroup.value.id
-    planDetailInfo.resourceGroupCode = currentResourceGroup.value.code
-    planDetail.push(planDetailInfo)
+    var planDetailInfo = {};
+    planDetailInfo.productionPlanDetailId = selection[i].id;
+    planDetailInfo.productId = selection[i].productId;
+    planDetailInfo.technologicalProcessId = selection[i].technologicalProcessId;
+    planDetailInfo.resourceGroupId = currentResourceGroup.value.id;
+    planDetailInfo.resourceGroupCode = currentResourceGroup.value.code;
+    planDetail.push(planDetailInfo);
   }
   saveBatchResourcePlan(planDetail).then((res) => {
     if (res.code === 200) {
-      getPlanDetail()
-      proxy.$modal.msgSuccess('保存成功')
+      getPlanDetail();
+      proxy.$modal.msgSuccess("保存成功");
     }
-  })
+  });
 }
 
 /**生产计划删除 */
 function handleDelPlanDetail(row) {
-  delResourcePlan(row.id).then((res) => {
-    if (res.code === 200) {
-      getPlanDetail()
-      proxy.$modal.msgSuccess('删除成功')
-    }
-  })
+  proxy.$modal
+    .confirm("是否确认删除选中的数据项?")
+    .then(function () {
+      delResourcePlan(row.id).then((res) => {
+        getPlanDetail();
+        proxy.$modal.msgSuccess("删除成功!");
+      });
+    })
+    .catch(() => {});
 }
 
 onMounted(() => {
-  getList()
-})
+  getList();
+});
 </script>
   <style scoped></style>
   

+ 0 - 3
src/views/business/tenant/form.vue

@@ -38,8 +38,6 @@
 import { getTenant, saveTenant } from '@/api/business/tenant'
 const { proxy } = getCurrentInstance()
 const emit = defineEmits(['handleSaveSuccess'])
-
-/** 字典数组区 */
 /** 表单抽屉 页变量 */
 const loading = ref(false)
 const visible = ref(false)
@@ -84,7 +82,6 @@ function reset() {
 function handleSave() {
   proxy.$refs['tenantRef'].validate((valid) => {
     if (valid) {
-      console.log(form.value)
       saveTenant(form.value).then((res) => {
         if (res.code == 200) {
           proxy.$modal.msgSuccess('操作成功')

+ 2 - 6
src/views/business/tenant/index.vue

@@ -8,7 +8,6 @@
       </el-form-item>
       <el-form-item>
         <el-button type="info" icon="Search" @click="handleQuery">搜索</el-button>
-        <!-- <el-button icon="Refresh" @click="resetQuery">重置</el-button> -->
         <el-button type="primary" icon="Plus" @click="handleShowFormDialog(null)" v-hasPermi="['business:tenant:add']">新增</el-button>
       </el-form-item>
     </el-form>
@@ -23,7 +22,6 @@
             </template>
           </el-table-column>
           <el-table-column label="企业名称" align="center" prop="orgName" />
-
           <el-table-column label="操作" align="center" width="140">
             <template #default="scope">
               <el-button link type="warning" icon="Edit" @click="handleShowFormDialog(scope.row.id)" v-hasPermi="['business:tenant:edit']">
@@ -37,7 +35,7 @@
     </div>
     <!-- 分页 -->
     <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
-    <!-- 表单 -->
+    <!-- 厂别表单 -->
     <tenant-form ref="tenantRef" @handleSaveSuccess="getList" />
   </div>
 </template>
@@ -46,9 +44,7 @@
 import tenantForm from './form.vue'
 import { listTenant, delTenant } from '@/api/business/tenant'
 const { proxy } = getCurrentInstance()
-/** 字典数组区 */
-const { org_nature } = proxy.useDict('org_nature')
-
+/**厂别变量 */
 const tenantList = ref([])
 const loading = ref(true)
 const total = ref(0)

+ 68 - 48
src/views/business/turnover/form.vue

@@ -1,14 +1,32 @@
 <template>
   <!-- 添加或修改项目信息对话框 -->
-  <el-dialog title="周转区信息表单" v-model="visible" width="400px" append-to-body draggable>
+  <el-dialog
+    title="周转区信息表单"
+    v-model="visible"
+    width="400px"
+    append-to-body
+    draggable
+  >
     <div class="form-container">
-      <el-form ref="turnoverFormRef" class="master-container" :rules="rules" v-loading="loading" :model="form" label-width="100px">
-        <el-form-item label="周转区名称" prop="code" >
+      <el-form
+        ref="turnoverFormRef"
+        class="master-container"
+        :rules="rules"
+        v-loading="loading"
+        :model="form"
+        label-width="100px"
+      >
+        <el-form-item label="周转区名称" prop="code">
           <el-input v-model.trim="form.code" placeholder="请输入周转区名称" />
         </el-form-item>
         <el-form-item label="状态" prop="status">
           <el-select v-model="form.status" placeholder="请选择周转区状态">
-            <el-option v-for="item in turnover_status" :key="item.value" :label="item.label" :value="item.value" />
+            <el-option
+              v-for="item in turnover_status"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            />
           </el-select>
         </el-form-item>
         <el-form-item label="备注" prop="remark">
@@ -17,20 +35,23 @@
       </el-form>
     </div>
     <template #footer>
-      <el-button type="primary" icon="Check" @click="handleSave">确 定</el-button>
+      <el-button type="primary" icon="Check" @click="handleSave"
+        >确 定</el-button
+      >
       <el-button icon="Close" @click="handleCancel">取 消</el-button>
     </template>
   </el-dialog>
 </template>
 <script setup>
-import { getTurnover, saveTurnover } from '@/api/business/turnover'
-const { proxy } = getCurrentInstance()
-const emit = defineEmits(['handleSaveSuccess'])
-const { turnover_status } = proxy.useDict('turnover_status')
-
-const loading = ref(false)
-const visible = ref(false)
-const form = ref({})
+import { getTurnover, saveTurnover } from "@/api/business/turnover";
+const { proxy } = getCurrentInstance();
+const emit = defineEmits(["handleSaveSuccess"]);
+/** 字典数组区 */
+const { turnover_status } = proxy.useDict("turnover_status");
+/**周转区表单变量 */
+const loading = ref(false);
+const visible = ref(false);
+const form = ref({});
 const rules = {
   code: [{ required: true, trigger: "blur", message: "周转区名称不能为空" }],
 };
@@ -38,59 +59,58 @@ const rules = {
 /***********************  方法区  ****************************/
 /** 打开抽屉 */
 const open = (data) => {
-  reset()
-  visible.value = true
-  loading.value = true
-  form.value.deptId = data.deptId
-  console.log(data)
+  reset();
+  visible.value = true;
+  loading.value = true;
+  form.value.deptId = data.deptId;
   getTurnover(data.id || 0).then((res) => {
     if (res.data) {
-      form.value = res.data
-      form.value.status = res.data.status + ''
+      form.value = res.data;
+      form.value.status = res.data.status + "";
     }
-    loading.value = false
-  })
-}
+    loading.value = false;
+  });
+};
 
 /** 表单重置 */
 const reset = () => {
   form.value = {
     id: null,
     deptId: 0,
-    code: '',
-    status: '0',
-    remark: ''
-  }
-  proxy.resetForm('turnoverFormRef')
-}
+    code: "",
+    status: "0",
+    remark: "",
+  };
+  proxy.resetForm("turnoverFormRef");
+};
 
 /** 提交按钮 */
 const handleSave = () => {
-  proxy.$refs['turnoverFormRef'].validate((valid) => {
+  proxy.$refs["turnoverFormRef"].validate((valid) => {
     if (valid) {
-  saveTurnover(form.value).then((res) => {
-    if (res.code === 601) {
-      proxy.$modal.msgWarn(res.msg)
-      return
+      saveTurnover(form.value).then((res) => {
+        if (res.code === 601) {
+          proxy.$modal.msgWarn(res.msg);
+          return;
+        }
+        if (res.code === 200) {
+          proxy.$modal.msgSuccess("操作成功");
+          emit("handleSaveSuccess");
+        }
+        visible.value = false;
+      });
     }
-    if (res.code === 200) {
-      proxy.$modal.msgSuccess('操作成功')
-      emit('handleSaveSuccess')
-    }
-    visible.value = false
-  })
-}
-  })
-}
+  });
+};
 
 /** 取消按钮 */
 const handleCancel = () => {
-  visible.value = false
-  reset()
-}
+  visible.value = false;
+  reset();
+};
 
 /** 暴露给父组件的方法 */
 defineExpose({
-  open
-})
+  open,
+});
 </script>

+ 12 - 10
src/views/business/turnover/index.vue

@@ -6,13 +6,13 @@
       <el-form class="list-search-container" style="display: flex">
         <el-form-item class="section-title" label="工段列表"  />
         <el-form-item label="工段编码:" prop="deptCode" style="margin-left: 30px;">
-          <el-input v-model.trim="queryParams.deptCode" placeholder="请输入工段编码" clearable style="width: 160px" @keyup.enter="handleQueryUser" />
+          <el-input v-model.trim="queryParams.deptCode" placeholder="请输入工段编码" clearable style="width: 160px" @keyup.enter="handleQueryDept" />
         </el-form-item>
         <el-form-item label="工段名称:" prop="deptName">
-          <el-input v-model.trim="queryParams.deptName" placeholder="请输入工段名称" clearable style="width: 160px" @keyup.enter="handleQueryUser" />
+          <el-input v-model.trim="queryParams.deptName" placeholder="请输入工段名称" clearable style="width: 160px" @keyup.enter="handleQueryDept" />
         </el-form-item>
         <el-form-item>
-          <el-button type="info" icon="Search" @click="handleQueryUser">搜索</el-button>
+          <el-button type="info" icon="Search" @click="handleQueryDept">搜索</el-button>
         </el-form-item>
       </el-form>
       <!-- 列表区 -->
@@ -72,16 +72,17 @@
 import { workSectionTree } from '@/api/system/dept'
 import { listTurnover, delTurnover } from '@/api/business/turnover'
 import turnoverForm from './form'
-import { get } from '@vueuse/core'
 const { proxy } = getCurrentInstance()
+/** 字典数组区 */
 const { turnover_status } = proxy.useDict('turnover_status')
 
-/** 查询 对象 */
+/** 工段变量 */
 const workSectionList = ref([])
-const turnoverList = ref([])
 const workSectionLoading = ref(false)
-const turnoverLoading = ref(false)
 const currentWorkSection = ref({})
+/**周转变量 */
+const turnoverList = ref([])
+const turnoverLoading = ref(false)
 const ids = ref([])
 /** 查询对象 */
 const queryParams = ref({
@@ -105,19 +106,20 @@ function getWorkSections() {
     workSectionLoading.value = false
   })
 }
-
+// 工段列表点击事件
 const handleWorkSectionChange = (row) => {
   if (row) {
     currentWorkSection.value = row
     getTurnovers()
   }
 }
-function handleQueryUser() {
-  console.log(queryParams.value)
+//工段列表查询
+function handleQueryDept() {
   getWorkSections()
 }
 
 /****************************  周转区方法区  ****************************/
+//获得周转位置
 const getTurnovers = () => {
   turnoverLoading.value = true
   listTurnover({ deptId: currentWorkSection.value.id ?? '0' }).then((res) => {

+ 6 - 9
src/views/business/workshop/DialogDept.vue

@@ -100,32 +100,31 @@
 <script setup>
 import { getDeptInfo } from "@/api/system/dept.js"
 const { proxy } = getCurrentInstance();
+/**工段弹窗变量 */
 const total = ref(0);
 const props = defineProps({
-  selected: {
-    type: Array,
-    defalut: [],
-  },
   multipleSelected: {
     type: Function,
     default: null,
   },
 });
 
-const { multipleSelected, selected } = toRefs(props);
+const { multipleSelected } = toRefs(props);
 const deptList = ref([]);
+const selections = ref([]);
 const visible = ref(false);
 const deptIds = ref([])
 const loading = ref(false);
+/**查询对象 */
 const data = reactive({
   queryParams: {
     pageSize: 10,
     pageNum: 1,
   },
 });
-const selections = ref([]);
-const { queryParams } = toRefs(data);
 
+const { queryParams } = toRefs(data);
+/***********************  方法区  ****************************/
 /** 获取行 id */
 function getRowKey(row) {
   return row.deptId;
@@ -167,7 +166,6 @@ function getList() {
  * 列表checkbox列选择 事件
  */
 function handleSelectionChange(selection) {
-  console.log(selection);
   selections.value = selection;
 }
 
@@ -197,4 +195,3 @@ defineExpose({
   open,
 });
 </script>
-<style scoped></style>

+ 0 - 2
src/views/business/workshop/form.vue

@@ -34,10 +34,8 @@ import {getWorkshop, addWorkshop, updateWorkshop} from "@/api/business/workshop"
 
 const {proxy} = getCurrentInstance();
 const emit = defineEmits(["handleSaveSuccess"]);
-/** 字典数组区 */
 /** 表单抽屉 页变量 */
 const visible = ref(false);
-const deptOptions = ref([]);
 const data = reactive({
   form: {},
   rules: {

+ 212 - 127
src/views/business/workshop/index.vue

@@ -3,29 +3,72 @@
     <!-- 左侧区域 -->
     <section class="list-part-container" style="flex: 2">
       <!-- 搜索区 -->
-      <el-form class="list-search-container" :model="queryDeptParams" ref="queryRef" :inline="true">
+      <el-form
+        class="list-search-container"
+        :model="queryDeptParams"
+        ref="queryRef"
+        :inline="true"
+      >
         <el-form-item class="section-title" label="车间管理" />
         <el-form-item>
-          <el-button type="primary" icon="Plus" @click="handleAdd">新增</el-button>
+          <el-button type="primary" icon="Plus" @click="handleAdd"
+            >新增</el-button
+          >
         </el-form-item>
         <el-form-item label="车间名称:" prop="name">
-          <el-input v-model.trim="queryParams.name" placeholder="请输入车间名称" @keydown.enter.prevent @keyup.enter="handleSearch" clearable style="width: 155px" />
+          <el-input
+            v-model.trim="queryParams.name"
+            placeholder="请输入车间名称"
+            @keydown.enter.prevent
+            @keyup.enter="handleSearch"
+            clearable
+            style="width: 155px"
+          />
         </el-form-item>
         <el-form-item>
-          <el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
+          <el-button type="info" icon="Search" @click="handleSearch"
+            >搜索</el-button
+          >
         </el-form-item>
       </el-form>
       <!-- 列表区 -->
       <div class="el-table-container">
         <div class="el-table-inner-container">
           <!-- 列表区 -->
-          <el-table ref="workshopTable" v-loading="loading" :data="workshopList" row-key="id" height="100%" :indent="20" default-expand-all highlight-current-row @current-change="handleGetDept">
-            <el-table-column label="行号" type="index" width="50" align="center" />
+          <el-table
+            ref="workshopTable"
+            v-loading="loading"
+            :data="workshopList"
+            row-key="id"
+            height="100%"
+            :indent="20"
+            default-expand-all
+            highlight-current-row
+            @current-change="handleGetDept"
+          >
+            <el-table-column
+              label="行号"
+              type="index"
+              width="50"
+              align="center"
+            />
             <el-table-column label="车间名称" prop="name" align="center" />
             <el-table-column label="操作" width="150" align="center">
               <template #default="scope">
-                <el-button link type="warning" icon="Edit" @click="handleUpdateWorkshop(scope.row)">编辑</el-button>
-                <el-button link type="danger" icon="Delete" @click="handleDeleteWorkshop(scope.row)">删除</el-button>
+                <el-button
+                  link
+                  type="warning"
+                  icon="Edit"
+                  @click="handleUpdateWorkshop(scope.row)"
+                  >编辑</el-button
+                >
+                <el-button
+                  link
+                  type="danger"
+                  icon="Delete"
+                  @click="handleDeleteWorkshop(scope.row)"
+                  >删除</el-button
+                >
               </template>
             </el-table-column>
           </el-table>
@@ -36,189 +79,231 @@
     <!-- 右侧区域 -->
     <section class="list-part-container" style="flex: 3">
       <!-- 搜索区 -->
-      <el-form class="list-search-container" :model="queryDeptParams" ref="queryRef" :inline="true">
+      <el-form
+        class="list-search-container"
+        :model="queryDeptParams"
+        ref="queryRef"
+        :inline="true"
+      >
         <el-form-item class="section-title" label="工段" />
         <el-form-item>
-          <el-button type="primary" icon="Plus" :disabled="workshopList.length == 0" @click="handleAddDept">新增</el-button>
-          <el-button type="danger" icon="Delete" :disabled="ids.length == 0" @click="handleDeptDelete">
-            删除</el-button>
+          <el-button
+            type="primary"
+            icon="Plus"
+            :disabled="workshopList.length == 0"
+            @click="handleAddDept"
+            >新增</el-button
+          >
+          <el-button
+            type="danger"
+            icon="Delete"
+            :disabled="ids.length == 0"
+            @click="handleDeptDelete"
+          >
+            删除</el-button
+          >
         </el-form-item>
       </el-form>
 
       <!-- 列表区 -->
       <div class="el-table-container">
         <div class="el-table-inner-container">
-          <el-table v-loading="deptLoading" :data="deptList" :row-key="getRowKey" height="100%" @selection-change="handleSelectionChange">
+          <el-table
+            v-loading="deptLoading"
+            :data="deptList"
+            :row-key="getRowKey"
+            height="100%"
+            @selection-change="handleSelectionChange"
+          >
             <el-table-column type="selection" width="40" align="center" />
-            <el-table-column type="index" label="行号" width="50" align="center" />
+            <el-table-column
+              type="index"
+              label="行号"
+              width="50"
+              align="center"
+            />
             <el-table-column label="工段名称" prop="deptName" align="center" />
             <el-table-column label="工段编码" prop="deptCode" align="center" />
           </el-table>
         </div>
       </div>
       <!-- 分页 -->
-      <pagination v-show="total > 0" :total="total" v-model:page="queryDeptParams.pageNum" v-model:limit="queryDeptParams.pageSize" @pagination="getdeptList" />
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        v-model:page="queryDeptParams.pageNum"
+        v-model:limit="queryDeptParams.pageSize"
+        @pagination="getdeptList"
+      />
     </section>
 
-    <!-- 表单 -->
+    <!-- 车间管理表单 -->
     <workshop-form ref="workshopRef" @handleSaveSuccess="getList" />
-    <dept-form ref="deptChoiceRef" :multiple="true" :multiple-selected="handleDeptSelected" />
+    <!-- 工段弹窗 -->
+    <dept-form
+      ref="deptChoiceRef"
+      :multiple="true"
+      :multiple-selected="handleDeptSelected"
+    />
   </div>
 </template>
 <script setup >
-import { listWorkshop, delWorkshop } from '@/api/business/workshop'
-import { listDept, updateDeptWorkshop, updateDeptWorkshopByDeptId } from '@/api/system/dept'
-import deptForm from '@/views/business/workshop/DialogDept'
-import workshopForm from './form'
-const { proxy } = getCurrentInstance()
-
-const workshopList = ref([])
-const deptList = ref([])
-const loading = ref(false)
-const deptLoading = ref(false)
-const currentWorkshop = ref({})
-const total = ref(0)
-const ids = ref([])
-const workshopIds = ref([])
+import { listWorkshop, delWorkshop } from "@/api/business/workshop";
+import {
+  listDept,
+  updateDeptWorkshop,
+  updateDeptWorkshopByDeptId,
+} from "@/api/system/dept";
+import deptForm from "@/views/business/workshop/DialogDept";
+import workshopForm from "./form";
+const { proxy } = getCurrentInstance();
+/**车间管理变量 */
+const workshopList = ref([]);
+const loading = ref(false);
+const currentWorkshop = ref({});
+/**工段变量 */
+const deptList = ref([]);
+const deptLoading = ref(false);
+const total = ref(0);
+const ids = ref([]);
 /** 查询对象 */
 const queryParams = ref({
-  name: ''
-})
+  name: "",
+});
 const queryDeptParams = ref({
-  pageSize : 10,
+  pageSize: 10,
   pageNum: 1,
-  deptCode: ''
-})
+  deptCode: "",
+});
 
 /***********************  方法区  ****************************/
-
+/***********************  车间管理事件  ****************************/
 /** 查询车间管理列表 */
 function getList() {
-  loading.value = true
-  currentWorkshop.value = {}
+  loading.value = true;
+  currentWorkshop.value = {};
   listWorkshop(queryParams.value).then((res) => {
     if (res.code == 200) {
-      workshopList.value = res.rows
-      loading.value = false
-      console.log(workshopList.value.length)
-      if (workshopList.value.length >0) {
-        currentWorkshop.value = workshopList.value[0]
-        proxy.$refs.workshopTable.setCurrentRow(workshopList.value[0])
+      workshopList.value = res.rows;
+      loading.value = false;
+      if (workshopList.value.length > 0) {
+        currentWorkshop.value = workshopList.value[0];
+        proxy.$refs.workshopTable.setCurrentRow(workshopList.value[0]);
       } else {
-        deptList.value = []
-        total.value = 0
+        deptList.value = [];
+        total.value = 0;
       }
     }
-  })
-  
+  });
 }
+/**车间查询 */
 function handleSearch() {
-  getList()
+  getList();
+}
+/** 车间新增按钮操作 */
+function handleAdd() {
+  proxy.$refs.workshopRef.open();
+}
+
+/** 修改按钮操作 */
+function handleUpdateWorkshop(row) {
+  proxy.$refs.workshopRef.open(row);
 }
 
+/**车间表点击事件 */
+function handleGetDept(row) {
+  if (row) {
+    currentWorkshop.value = row;
+  }
+  getdeptList();
+}
+/** 车间删除按钮操作 */
+function handleDeleteWorkshop(row) {
+  const _ids = row.id;
+  proxy.$modal
+    .confirm("是否确认删除选中的车间?")
+    .then(function () {
+      return delWorkshop(_ids);
+    })
+    //删除车间的同时删除工段上workId
+    .then(function () {
+      return updateDeptWorkshopByDeptId({ workshopId: _ids });
+    })
+    .then(() => {
+      getList();
+      proxy.$modal.msgSuccess("删除成功!");
+    })
+    .catch(() => {});
+}
+/***********************  工段相关事件  ****************************/
 //打开添加工段
 const handleAddDept = () => {
-  handleAddBatchDept()
-}
+  handleAddBatchDept();
+};
 /** 多选添加 */
 function handleAddBatchDept() {
-  let deptIds = []
+  let deptIds = [];
   deptIds = deptList.value.map((item) => {
-    return item.deptId
-  })
-  proxy.$refs.deptChoiceRef.open(deptIds)
+    return item.deptId;
+  });
+  proxy.$refs.deptChoiceRef.open(deptIds);
 }
 
-// 多选框选中数据
+// 工段多选框选中数据
 function handleSelectionChange(selection) {
   ids.value = selection.map((item) => {
-    return item.deptId
-  })
-  console.log(ids.value)
+    return item.deptId;
+  });
 }
 /** 获取行 id */
 function getRowKey(row) {
-  return row.deptId
-}
-/** 新增按钮操作 */
-function handleAdd() {
-  proxy.$refs.workshopRef.open()
-}
-
-/** 修改按钮操作 */
-function handleUpdateWorkshop(row) {
-  proxy.$refs.workshopRef.open(row)
+  return row.deptId;
 }
 
-/**车间表点击事件 */
-function handleGetDept(row) {
-  if (row) {
-    currentWorkshop.value = row
-  }
-  getdeptList()
-}
 //工段多选带回
 function handleDeptSelected(selection) {
-  let deptInfo = {}
-  let deptIds = []
+  let deptInfo = {};
+  let deptIds = [];
   deptIds = selection.map((item) => {
-    return item.deptId
-  })
-  deptInfo.workshopId = currentWorkshop.value.id
-  deptInfo.ids = deptIds
-  console.log(deptInfo)
+    return item.deptId;
+  });
+  deptInfo.workshopId = currentWorkshop.value.id;
+  deptInfo.ids = deptIds;
   updateDeptWorkshop(deptInfo).then((res) => {
     if (res.code == 200) {
-      handleGetDept(currentWorkshop.value)
-      proxy.$modal.msgSuccess('添加成功!')
+      handleGetDept(currentWorkshop.value);
+      proxy.$modal.msgSuccess("添加成功!");
     }
-  })
+  });
 }
+/**获得工段列表 */
 function getdeptList() {
-  deptLoading.value = true
-  queryDeptParams.value.workshopId = currentWorkshop.value.id
-  console.log(total.value)
-  if(currentWorkshop.value.id) {
-  listDept(queryDeptParams.value).then((res) => {
-    if (res.code == 200) {
-      deptList.value = res.rows
-      total.value = res.total
-    }
-  })
-}
-deptLoading.value = false
-}
-
-/** 删除按钮操作 */
-function handleDeleteWorkshop(row) {
-  const _ids = row.id
-  proxy.$modal
-    .confirm('是否确认删除选中的车间?')
-    .then(function () {
-      return delWorkshop(_ids)
-    })
-    //删除车间的同时删除工段上workId
-    .then(function () {
-      return updateDeptWorkshopByDeptId({ workshopId: _ids })
-    })
-    .then(() => {
-      getList()
-      proxy.$modal.msgSuccess('删除成功!')
-    })
-    .catch(() => {})
+  deptLoading.value = true;
+  queryDeptParams.value.workshopId = currentWorkshop.value.id;
+  if (currentWorkshop.value.id) {
+    listDept(queryDeptParams.value).then((res) => {
+      if (res.code == 200) {
+        deptList.value = res.rows;
+        total.value = res.total;
+      }
+    });
+  }
+  deptLoading.value = false;
 }
 /** 车间工段删除按钮操作 */
-function handleDeptDelete(row) {
-  updateDeptWorkshop({ ids: ids.value }).then((res) => {
-    if (res.code == 200) {
-      handleGetDept(currentWorkshop.value)
-      proxy.$modal.msgSuccess('删除成功!')
-    }
-  })
+function handleDeptDelete() {
+  proxy.$modal.confirm("是否确认删除选中的车间?").then(function () {
+    updateDeptWorkshop({ ids: ids.value }).then((res) => {
+      if (res.code == 200) {
+        handleGetDept(currentWorkshop.value);
+        proxy.$modal.msgSuccess("删除成功!");
+      }
+    });
+  });
 }
 
 onMounted(() => {
-  getList()
-})
+  getList();
+});
 </script>