Browse Source

fix:报故处理,订单关联报故单,员工技能管理

lupeng 1 year ago
parent
commit
6859d1ddfc

+ 15 - 1
src/api/fault/index.ts

@@ -72,7 +72,7 @@ export function handleEscalationFault(data: FaultHandle): AxiosPromise<any> {
 /**
  * 返工处理
  *
- * @param id
+ *
  * @param data
  */
 export function rework(data:Object) {
@@ -83,3 +83,17 @@ export function rework(data:Object) {
   });
 }
 
+/**
+ * 线长审核
+ *
+ * @param id
+ * @param data
+ */
+export function updateFault(data:Object) {
+  return request({
+    url: "/api/v1/process/escalationFault/update",
+    method: "post",
+    data:data,
+  });
+}
+

+ 37 - 1
src/api/system/skill/index.ts

@@ -1,5 +1,4 @@
 import request from "@/utils/request";
-import { AxiosPromise } from "axios";
 
 
 
@@ -16,3 +15,40 @@ export function addPostSkill(data: any) {
     data: data,
   });
 }
+  /**
+   * 获取岗位下的技能
+   *
+   * @param postId
+   *
+   */
+  export function getPostSkill(postId: Number) {
+    return request({
+      url: "/api/v1/sys/postSkill/list/"+postId,
+      method: "get",
+    });
+}
+
+
+/**
+ * 获取岗位下的技能
+ * @param data
+ */
+export function addEmployeeSkill(data: Object) {
+  return request({
+    url: "/api/v1/sys/employeeSkill/add",
+    method: "post",
+    data:data,
+  });
+}
+
+/**
+ * 获取岗位下的技能
+ * @param data
+ */
+export function getSkillDetail(id: String) {
+  return request({
+    url: "/api/v1/sys/employeeSkill/add",
+    method: "get",
+
+  });
+}

+ 27 - 2
src/components/CommonTable/configs/tableConfig.ts

@@ -575,34 +575,59 @@ export const tableConfig = {
 
 
   FAULT: {
-    url: "/api/v1/process/escalationFault",
+    url: "/api/v1/process/escalationFault/order",
     column: [
       {
         label: "不合格审理单号",
         prop: "trackingNumber",
         search: true,
+        width:120,
+        overHidden:true,
       },
       {
         label: "工单号",
         prop: "workOrderCode",
+        width:120,
+        overHidden:true,
         search: true,
       },
       {
         label: "订单号",
         prop: "orderCode",
+        width:120,
+        overHidden:true,
         search: true,
       },
       {
         label: "不合格数量",
         prop: "unqualifiedNum",
+        width:100,
+        overHidden:true,
       },
 
       {
         label: "序列号", prop: "seqNo", overHidden: true,
-        width:100,
+
       },
       {
         label: "报故人", prop: "creator",
+        width:100,
+
+      },
+
+      {
+        label: "产品编码", prop: "materialCode",
+        width:120,overHidden: true,
+
+      },
+      {
+        label: "产品名称", prop: "materialName",
+        width:100,overHidden: true,
+
+      },
+      {
+        label: "规格", prop: "spec",
+        width:150,overHidden: true,
 
       },
     ],

+ 327 - 0
src/views/base/skill/components/edit-skill.vue

@@ -0,0 +1,327 @@
+<template>
+  <div class="mainContentBox">
+    <avue-form
+      ref="formRef"
+      v-model:search="search"
+      v-model="form"
+      :data="data2"
+      :option="option2"
+    >
+    </avue-form>
+    <avue-crud
+      ref="crudRef"
+      v-model="form"
+      :data="data"
+      :option="option"
+      v-model:page="page"
+      @row-save="createRow"
+      @row-update="updateRow"
+      @row-del="deleteRow"
+    >
+      <template #menu-left="{ size }">
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          circle
+          @click="addSkill"
+        ></el-button
+        ></template>
+
+    </avue-crud>
+    <CommonTable
+      ref="ctableRef"
+      tableTitle="员工选择"
+      tableType="USERS"
+      @selected-sure="onSelectedFinish"
+    />
+    <div class="detail-footer">
+      <el-button type="primary" @click="onHandle"> 确定 </el-button>
+      <el-button @click="cancelWindow">取消</el-button>
+
+    </div>
+  </div>
+</template>
+<script setup>
+import { ref, getCurrentInstance } from "vue";
+import { useCrud } from "@/hooks/userCrud";
+import ButtonPermKeys from "@/common/configs/buttonPermission";
+import { useCommonStoreHook, useDictionaryStoreHook } from "@/store";
+import dictDataUtil from "@/common/configs/dictDataUtil";
+import SingleUpload from "@/components/Upload/SingleUpload.vue";
+const { isShowTable, tableType } = toRefs(useCommonStoreHook());
+import {getPostSkill,addEmployeeSkill} from "@/api/system/skill";
+// 数据字典相关
+const { dicts } = useDictionaryStoreHook();
+
+const test = () => {
+  isShowTable.value = true;
+  tableType.value = tableType.value == 1 ? 2 : 1;
+};
+const data2=ref(null);
+// 传入一个url,后面不带/
+const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
+  useCrud({
+    src: "/api/v1/sys/skillScore",
+  });
+const { dataList, createRow, updateRow, deleteRow, searchChange, dataNoPageList } =
+  Methords; //增删改查
+const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
+const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
+// checkBtnPerm(ButtonPermKeys.PLAN.BTNS.order_add) :permission="permission"
+// const permission = reactive({
+//   delBtn: checkPerm(buttonPermission.PLAN.BTNS.order_del),
+//   addBtn: checkPerm(buttonPermission.PLAN.BTNS.order_add),
+//   editBtn: checkPerm(buttonPermission.PLAN.BTNS.order_edit),
+//   menu: true,
+// });
+const option2=ref(null);
+const ctableRef = ref(null); //crudRef.value 获取avue-crud对象
+const router = useRouter();
+onMounted(() => {
+  // console.log("crudRef", crudRef)
+ //postIdSkill.value.postId=
+  dataNoPageList();
+
+});
+const skillChange=(row)=>{
+  if(skillValue.value!==undefined&&skillValue.value!==null&&skillValue.value!==""){
+    data.value[row.$index].skillDictValue=skillValue.value;
+  }
+}
+const cancelWindow=()=>{
+  props.editDialog.visible=false;
+}
+const addSkill = () => {
+  const bom=ref({
+    $cellEdit:true,
+  });
+  data.value.push(bom.value);
+};
+const employeeSkill=ref({});
+const onHandle=()=>{
+  console.info(form.value);
+  if(form.value.userId===null||form.value.userId===undefined||form.value.userId===""){
+    ElMessage({
+      message: "未选择打分用户",
+      type: "error",
+    });
+    return false;
+  }
+  if(form.value.postId===null||form.value.postId===undefined||form.value.postId===""){
+    ElMessage({
+      message: "未选择岗位",
+      type: "error",
+    });
+    return false;
+  }
+  console.info("data",data.value);
+  if(data.value.length===0){
+    ElMessage({
+      message: "没有要保存的打分项",
+      type: "error",
+    });
+    return false;
+  }
+  if(data.value.length>0){
+    for(let i=0;i<data.value.length;i++){
+      if(data.value[i].skillDictValue===undefined||data.value[i].skillDictValue===null||data.value[i].skillDictValue===""){
+        ElMessage({
+          message: "第"+(i+1)+"项没有选择技能",
+          type: "error",
+        });
+        return false;
+      }
+      if(data.value[i].score===undefined||data.value[i].score===null||data.value[i].score===""){
+        ElMessage({
+          message: "第"+(i+1)+"项没有打分",
+          type: "error",
+        });
+        return false;
+      }
+    }
+  }
+  employeeSkill.value.userId=form.value.userId;
+  employeeSkill.value.postId=form.value.postId;
+  employeeSkill.value.skillList=Array.from(data.value);
+  console.info("11",employeeSkill.value)
+  addEmployeeSkill(employeeSkill.value).then(
+    (data)=>{
+      if(data.code==="200") {
+        ElMessage({
+          message: data.msg,
+          type: "success",
+        });
+        props.dialog.visible=false;
+      }
+      else {
+        ElMessage({
+          message: data.msg,
+          type: "error",
+        });
+      }
+    }
+  )
+
+}
+const postIdValue=ref(null);
+// 设置表格列或者其他自定义的option
+option2.value = {
+  selection: true,
+  submitBtn:false,
+  clearAbleBtn:false,
+  emptyBtn:false,
+  column: [
+
+    { label: "用户id", prop: "userId", width: 130,overHidden: true,search: true ,
+      filterable: true,
+      width: 100,overHidden: true,
+      disabled:true,
+      display:false,
+
+    },
+    { label: "用户名", prop: "userName", width: 140,overHidden: true,search: true ,rules: [{
+        required: true,
+        search: true,
+        message: "请选择员工姓名",
+        trigger: "blur"
+      }],
+      click: ({ value, column }) => {
+        ctableRef.value.startSelect();
+      },},
+    { label: "所属机构", prop: "institution", width: 130,overHidden: true,search: true ,
+      filterable: true,
+      width: 100,overHidden: true,
+      disabled:true,
+
+    },
+    {
+      label: "员工编号",
+      prop: "employeeCode",
+      search: true,
+      disabled:true,
+    },
+    { label: "岗位", prop: "postId",
+      search: true,
+      filterable: true,
+      type: "select",
+      overHidden: true,
+      dicUrl:dictDataUtil.post_list_url,
+      dicMethod:"post",
+      change:({ value, column })=>{
+       if(value!==undefined) {
+         postIdValue.value = value;
+         skillValue.value=null;
+         optionSkill.value=null;
+       }
+      },
+      props: { label: "postName", value: "id" },
+
+    },
+    { label: "部门", prop: "deptName", overHidden: true,
+      disabled:true, },
+
+  ],
+};
+
+const props = defineProps({
+  editDialog:{
+    type:Object,
+    default:()=>{
+      return {};
+    }
+  },
+  skillId:{
+    type:String,
+    default:()=>{
+      return "0";
+    }
+  }
+
+})
+const postIdSkill=ref({});
+// 设置表格列或者其他自定义的option
+option.value = Object.assign(option.value,{
+  selection: false,
+  addBtn: false,
+  viewBtn: false,
+  editBtn:false,
+  saveBtn:false,
+
+  cellBtn: true,
+  column: [{
+    label: "技能",
+    prop: "skillDictValue",
+    align: 'center',
+    headerAlign: 'center',
+    span:24,
+    type: 'select',
+    dicUrl: import.meta.env.VITE_APP_BASE_API + "/api/v1/sys/postSkill/list/"+postIdSkill.value.postId,
+    props: {
+      label: "userName", // 下拉菜单显示的字段
+      value: "userName", // 下拉菜单值的字段
+    },
+  },
+    {
+      label: "分数",
+      prop: "score",
+      align: 'center',
+      headerAlign: 'center',
+      cell: true,
+      type:"number",
+      precision: 2,
+      max:100,
+      min:0,
+      span:24,
+    },],
+});
+const onSelectedFinish=(selectedValue)=>{
+  form.value.userId=selectedValue.id;
+
+  form.value.userName=selectedValue.userName;
+  form.value.deptName=selectedValue.deptName;
+  form.value.employeeCode=selectedValue.employeeCode;
+  form.value.institution=selectedValue.institution;
+
+}
+const skillValue=ref(null);
+const optionSkill=ref([]);
+const getPostSkills=()=>{
+  if(postIdValue.value===undefined||postIdValue.value===null||postIdValue.value===""){
+    ElMessage({
+      message: "未选择岗位",
+      type: "error",
+    });
+    return false;
+  }
+  getPostSkill(postIdValue.value).then(
+    (data)=>{
+      optionSkill.value=Array.from(data.data);
+    }
+  )
+}
+
+</script>
+<style type="text/css">
+  .title-detail{
+    width: 30%;
+    height: 50px;
+    line-height: 50px;
+    margin: 25px 20px 25px 0;
+    float: left;
+  }
+  .detail{
+    margin: 0 auto;
+    width: 100%;
+  }
+  .avue-crud{
+    float: left;
+  }
+  .detail-footer{
+    float: right;
+    margin-top:15px;
+  }
+  .el-select__selection{
+    width: 150px;
+  }
+
+</style>

+ 131 - 34
src/views/base/skill/components/user-skill.vue

@@ -26,6 +26,17 @@
       @row-update="updateRow"
       @row-del="deleteRow"
     >
+      <template #skillDictValue="{row,index,type}">
+        <el-select v-model="skillValue" placeholder="请选择技能" @click="getPostSkills()" @change="skillChange(row)">
+          <el-option
+            v-for="item in optionSkill"
+            :key="item.value"
+            :label="item.skillDictLabel"
+            :value="item.skillDictValue"
+          >
+          </el-option>
+        </el-select>
+      </template>
       <template #menu-left="{ size }">
         <el-button
           type="primary"
@@ -34,6 +45,7 @@
           @click="addSkill"
         ></el-button
         ></template>
+
     </avue-crud>
     <CommonTable
       ref="ctableRef"
@@ -41,6 +53,11 @@
       tableType="USERS"
       @selected-sure="onSelectedFinish"
     />
+    <div class="detail-footer">
+      <el-button type="primary" @click="onHandle"> 确定 </el-button>
+      <el-button @click="cancelWindow">取消</el-button>
+
+    </div>
   </div>
 </template>
 <script setup>
@@ -51,6 +68,7 @@ import { useCommonStoreHook, useDictionaryStoreHook } from "@/store";
 import dictDataUtil from "@/common/configs/dictDataUtil";
 import SingleUpload from "@/components/Upload/SingleUpload.vue";
 const { isShowTable, tableType } = toRefs(useCommonStoreHook());
+import {getPostSkill,addEmployeeSkill} from "@/api/system/skill";
 // 数据字典相关
 const { dicts } = useDictionaryStoreHook();
 
@@ -78,37 +96,94 @@ const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等
 const option2=ref(null);
 const ctableRef = ref(null); //crudRef.value 获取avue-crud对象
 const router = useRouter();
-const binding = (row) => {
-  router.push(`/base/bom/${row.materialCode}`);
-};
+
 onMounted(() => {
   // console.log("crudRef", crudRef)
-  dataNoPageList();
+  //dataNoPageList();
 
 });
-
+const skillChange=(row)=>{
+  if(skillValue.value!==undefined&&skillValue.value!==null&&skillValue.value!==""){
+    data.value[row.$index].skillDictValue=skillValue.value;
+  }
+}
+const cancelWindow=()=>{
+  props.dialog.visible=false;
+}
 const addSkill = () => {
   const bom=ref({
     $cellEdit:true,
   });
   data.value.push(bom.value);
 };
-
-/**
- * 上传excel相关
- */
-const uploadRef = ref(null);
-const uploadFinished = () => {
-  // 上传完成后的刷新操作
-  page.currentPage = 1;
-  dataList();
-};
-const importExcelData = () => {
-  if (uploadRef.value) {
-    uploadRef.value.show("/api/v1/plan/order/import");
+const employeeSkill=ref({});
+const onHandle=()=>{
+  console.info(form.value);
+  if(form.value.userId===null||form.value.userId===undefined||form.value.userId===""){
+    ElMessage({
+      message: "未选择打分用户",
+      type: "error",
+    });
+    return false;
   }
-};
-const postId=ref({});
+  if(form.value.postId===null||form.value.postId===undefined||form.value.postId===""){
+    ElMessage({
+      message: "未选择岗位",
+      type: "error",
+    });
+    return false;
+  }
+  console.info("data",data.value);
+  if(data.value.length===0){
+    ElMessage({
+      message: "没有要保存的打分项",
+      type: "error",
+    });
+    return false;
+  }
+  if(data.value.length>0){
+    for(let i=0;i<data.value.length;i++){
+      if(data.value[i].skillDictValue===undefined||data.value[i].skillDictValue===null||data.value[i].skillDictValue===""){
+        ElMessage({
+          message: "第"+(i+1)+"项没有选择技能",
+          type: "error",
+        });
+        return false;
+      }
+      if(data.value[i].score===undefined||data.value[i].score===null||data.value[i].score===""){
+        ElMessage({
+          message: "第"+(i+1)+"项没有打分",
+          type: "error",
+        });
+        return false;
+      }
+    }
+  }
+  employeeSkill.value.userId=form.value.userId;
+  employeeSkill.value.postId=form.value.postId;
+  employeeSkill.value.skillList=Array.from(data.value);
+  console.info("11",employeeSkill.value)
+  addEmployeeSkill(employeeSkill.value).then(
+    (data)=>{
+      if(data.code==="200") {
+        ElMessage({
+          message: data.msg,
+          type: "success",
+        });
+        props.dialog.visible=false;
+      }
+      else {
+        ElMessage({
+          message: data.msg,
+          type: "error",
+        });
+      }
+    }
+  )
+
+}
+
+const postIdValue=ref(null);
 // 设置表格列或者其他自定义的option
 option2.value = {
   selection: true,
@@ -153,9 +228,11 @@ option2.value = {
       dicUrl:dictDataUtil.post_list_url,
       dicMethod:"post",
       change:({ value, column })=>{
-        postId.value=value;
-        console.log(value);
-        console.log(postId.value);
+       if(value!==undefined) {
+         postIdValue.value = value;
+         skillValue.value=null;
+         optionSkill.value=null;
+       }
       },
       props: { label: "postName", value: "id" },
 
@@ -165,6 +242,15 @@ option2.value = {
 
   ],
 };
+
+const props = defineProps({
+  dialog:{
+    type:Object,
+    default:()=>{
+      return {};
+    }
+  }
+})
 // 设置表格列或者其他自定义的option
 option.value = Object.assign(option.value,{
   selection: false,
@@ -179,14 +265,10 @@ option.value = Object.assign(option.value,{
     prop: "skillDictValue",
     align: 'center',
     headerAlign: 'center',
-    cell: true,
     span:24,
     type: 'select',
-    dicUrl: `${baseUrl}/getProvince?id={{key}}`,
-    props: {
-      label: "dictLabel", // 下拉菜单显示的字段
-      value: "dictValue" // 下拉菜单值的字
-    },
+    dicData:dicts.skill_type,
+    props: { label: "dictLabel", value: "dictValue" },
   },
     {
       label: "分数",
@@ -194,12 +276,11 @@ option.value = Object.assign(option.value,{
       align: 'center',
       headerAlign: 'center',
       cell: true,
+      type:"number",
+      precision: 2,
+      max:100,
+      min:0,
       span:24,
-      dicData:dicts.skill_type,
-      props: {
-        label: "dictLabel", // 下拉菜单显示的字段
-        value: "dictValue" // 下拉菜单值的字
-      },
     },],
 });
 const onSelectedFinish=(selectedValue)=>{
@@ -211,6 +292,22 @@ const onSelectedFinish=(selectedValue)=>{
   form.value.institution=selectedValue.institution;
 
 }
+const skillValue=ref(null);
+const optionSkill=ref([]);
+const getPostSkills=()=>{
+  if(postIdValue.value===undefined||postIdValue.value===null||postIdValue.value===""){
+    ElMessage({
+      message: "未选择岗位",
+      type: "error",
+    });
+    return false;
+  }
+  getPostSkill(postIdValue.value).then(
+    (data)=>{
+      optionSkill.value=Array.from(data.data);
+    }
+  )
+}
 
 </script>
 <style type="text/css">

+ 27 - 3
src/views/base/skill/index.vue

@@ -32,11 +32,11 @@
           >删除</el-button
         ></template>
         <template #menu="{row,index,type}">
-          <el-button @click="binding(row)"
-                     icon="el-icon-link"
+          <el-button @click="editSkills(row)"
+                     icon="el-icon-edit"
                      text
                      type="primary"
-          >BOM</el-button>
+          >编辑</el-button>
         </template>
 
     </avue-crud>
@@ -44,10 +44,21 @@
       v-model="dialog.visible"
       :title="dialog.title"
       width="800px"
+      :destroy-on-close="true"
       @close="dialog.visible = false"
     >
       <user-skill   :dialog="dialog"/>
     </el-dialog>
+
+    <el-dialog
+      v-model="editDialog.visible"
+      :title="editDialog.title"
+      width="800px"
+      :destroy-on-close="true"
+      @close="editDialog.visible = false"
+    >
+      <editSkill   :editDialog="editDialog" :skillId="editUser.id"/>
+    </el-dialog>
   </div>
 </template>
 <script setup>
@@ -56,6 +67,7 @@ import { useCrud } from "@/hooks/userCrud";
 import ButtonPermKeys from "@/common/configs/buttonPermission";
 import { useCommonStoreHook, useDictionaryStoreHook } from "@/store";
 import dictDataUtil from "@/common/configs/dictDataUtil";
+import editSkill from "@/views/base/skill/components/edit-skill.vue"
 const { isShowTable, tableType } = toRefs(useCommonStoreHook());
 // 数据字典相关
 const { dicts } = useDictionaryStoreHook();
@@ -69,6 +81,11 @@ const dialog = reactive({
   visible: false,
 });
 
+const editDialog = reactive({
+  title: "编辑",
+  visible: false,
+});
+
 const addRow=()=>{
   dialog.visible=true;
 }
@@ -115,11 +132,18 @@ const importExcelData = () => {
     uploadRef.value.show("/api/v1/plan/order/import");
   }
 };
+const editUser=ref(null);
+const editSkills=(row)=>{
+  editDialog.visible=true;
+  editUser.value=row;
 
+}
 // 设置表格列或者其他自定义的option
 option.value = Object.assign(option.value, {
   selection: true,
   addBtn:false,
+  viewBtn:false,
+  editBtn:false,
   column: [
 
 

+ 61 - 41
src/views/plan/order/index.vue

@@ -236,6 +236,57 @@ option.value = {
       ],
     },
     {
+      label: "订单类型",
+      prop: "orderType",
+      type: "select", //类型为下拉选择框
+      width: 100,
+      overHidden: true,
+      dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.plan_order_type,
+      props: {
+        label: "dictLabel",
+        value: "dictValue",
+      },
+      searchClearable: false, //可清空的输入框,默认为true
+      filterable: true, //添加filterable属性即可启用搜索功能
+      rules: [
+        {
+          required: true,
+          message: "订单类型不能为空",
+          trigger: "trigger",
+        },
+      ],
+      change: ({ value, column }) => {
+        if(value==='2'){
+          option.value.column[4].display=true;
+          option.value.column[6].disabled=true;
+        }
+        if(value==='1'){
+          option.value.column[4].display=false;
+          option.value.column[6].disabled=false;
+        }
+      },
+    },
+    {
+      label: "报故单",
+      prop: "trackingNumber",
+      width: 100,
+      display:false,
+      click:({ value, column }) => {
+        if (ctableRef.value) {
+          ctableRef.value.startSelect();
+        }
+      },
+
+    },
+    {
+      label: "报故单id",
+      prop: "faultId",
+      width: 100,
+      display:false,
+      hide:true,
+
+    },
+    {
       label: "产品编码",
       prop: "materialCode",
       search: true,
@@ -292,48 +343,8 @@ option.value = {
       searchClearable: false, //可清空的输入框,默认为true
       filterable: true, //添加filterable属性即可启用搜索功能
     },
-    {
-      label: "订单类型",
-      prop: "orderType",
-      type: "select", //类型为下拉选择框
-      width: 100,
-      overHidden: true,
-      dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.plan_order_type,
-      props: {
-        label: "dictLabel",
-        value: "dictValue",
-      },
-      searchClearable: false, //可清空的输入框,默认为true
-      filterable: true, //添加filterable属性即可启用搜索功能
-      rules: [
-        {
-          required: true,
-          message: "订单类型不能为空",
-          trigger: "trigger",
-        },
-      ],
-      change: ({ value, column }) => {
-        if(value==='2'){
-          option.value.column[8].display=true;
-        }
-        if(value==='1'){
-          option.value.column[8].display=false;
-        }
-      },
-    },
-    {
-      label: "报故单",
-      prop: "faultId",
-      width: 100,
-      display:false,
-      type:"select",
-      click:({ value, column }) => {
-        if (ctableRef.value) {
-          ctableRef.value.startSelect();
-        }
-      },
 
-    },
+
     {
       label: "订单数量",
       prop: "orderNum",
@@ -622,4 +633,13 @@ onMounted?.(() => {
   queryExpandAlias();
   handleQuery(null, null);
 });
+
+/** 选择报故单 */
+const onSelectedFinish=(selectedValue)=>{
+  form.value.materialCode=selectedValue.materialCode;
+  form.value.materialName=selectedValue.materialName;
+  form.value.materialModel=selectedValue.spec;
+  form.value.faultId=selectedValue.id;
+  form.value.trackingNumber=selectedValue.trackingNumber;
+}
 </script>

+ 12 - 2
src/views/quality/faultHandle/columns.ts

@@ -5,30 +5,38 @@ export const columns = [
   {
     label: "审理单号",
     prop: "trackingNumber",
+    overHidden: true,
+    width:120,
     search: true,
   },
   {
     label: "工单号",
     prop: "workOrderCode",
+    overHidden: true,
+    width:120,
     search: true,
   },
   {
     label: "订单号",
     prop: "orderCode",
+    overHidden: true,
+    width:120,
     search: true,
   },
   {
     label: "不合格数量",
+    overHidden: true,
+    width:100,
     prop: "unqualifiedNum",
   },
 
   {
     label: "序列号", prop: "seqNo", overHidden: true,
-    width:100,
+
   },
   {
     label: "状态", prop: "state", overHidden: true,
-    width:100,
+    width:120,
     dicData:dicts.escalation_fault_state,
     props: { label: "dictLabel", value: "dictValue" },
   },
@@ -40,6 +48,8 @@ export const columns = [
   },
   {
     label: "报故人", prop: "creator",
+    overHidden: true,
+    width:100,
     search: true,
   },
 

+ 21 - 28
src/views/quality/faultHandle/components/fault-detail.vue

@@ -1,10 +1,10 @@
 <template>
-  <div class="fault" v-if="faultDetails!=null">
+  <div class="fault" v-if="faultDetails1!=null">
     <div class="title-fault" >
-      产品名称:&nbsp;&nbsp;{{faultDetails.materialName}}
+      产品名称:&nbsp;&nbsp;{{faultDetails1.materialName}}
     </div>
     <div class="title-fault">
-      产品编码:&nbsp;&nbsp;{{faultDetails.materialCode}}
+      产品编码:&nbsp;&nbsp;{{faultDetails1.materialCode}}
     </div>
   </div>
   <div class="mainContentBox">
@@ -31,27 +31,27 @@
   </div>
   <div class="fault">
     <div class="image-title">图片</div>
-      <div v-for="(image, index) in faultImg" :key="index" class="fault-image">
+      <div v-for="(image, index) in faultImg1" :key="index" class="fault-image">
         <!-- 使用v-for循环渲染图片列表 -->
         <img :src="dictDataUtil.img_url+image.fileUrl" alt="图片" width="150px" class="fault-img">
       </div>
 
   </div>
-  <div class="fault" v-if="faultDetails!=null">
-    <div class="fault-detail" >序列号:&nbsp;&nbsp;{{faultDetails.seqNo}}</div>
-    <div class="fault-detail">故障描述:&nbsp;&nbsp;{{faultDetails.remark}}</div>
+  <div class="fault" v-if="faultDetails1!=null">
+    <div class="fault-detail" >序列号:&nbsp;&nbsp;{{faultDetails1.seqNo}}</div>
+    <div class="fault-detail">故障描述:&nbsp;&nbsp;{{faultDetails1.remark}}</div>
 
     <div class="title-fault" style="margin-top: 10px">
-      报故人:&nbsp;&nbsp;{{faultDetails.creator}}
+      报故人:&nbsp;&nbsp;{{faultDetails1.creator}}
     </div>
     <div class="title-fault" style="margin-top: 10px">
-      报故工位:&nbsp;&nbsp;{{faultDetails.stationName}}
+      报故工位:&nbsp;&nbsp;{{faultDetails1.stationName}}
     </div>
     <div class="title-fault" style="margin-top: 10px">
-      报故数量:&nbsp;&nbsp;{{faultDetails.unqualifiedNum}}
+      报故数量:&nbsp;&nbsp;{{faultDetails1.unqualifiedNum}}
     </div>
     <div class="title-fault" style="margin-top: 10px">
-      处理结果:&nbsp;&nbsp;{{faultDetails.disposalMeasures}}
+      处理结果:&nbsp;&nbsp;{{faultDetails1.disposalMeasures}}
     </div>
   </div>
 </template>
@@ -109,26 +109,26 @@
   const crudRef = ref(null); //crudRef.value 获取avue-crud对象
   const router = useRouter();
 
-  const faultImg=ref(null);
-  const formData=ref({});
-  const faultDetails=ref(null);
+  const faultImg1=ref(null);
+  const formData1=ref({});
+  const faultDetails1=ref(null);
 
   onMounted(() => {
     // console.log("crudRef", crudRef)
     search.value.escalationFaultId=props.escalationFaultId;
     dataNoPageList();
-    formData.value.escalationFaultId=props.escalationFaultId;
-    getFault(formData).then((data) => {
+    formData1.value.escalationFaultId=props.escalationFaultId;
+    getFault(formData1.value).then((data) => {
 
-      faultImg.value=data.data;
-      console.info(faultImg.value);
+      faultImg1.value=data.data;
+      console.info(faultImg1.value);
     });
     getFaultDetails(props.escalationFaultId).then((data) => {
 
-      faultDetails.value=data.data;
+      faultDetails1.value=data.data;
       for(let i=0;i<dicts.disposal_measures_type.length;i++){
-        if(faultDetails.value.disposalMeasures===dicts.disposal_measures_type[i].dictValue){
-          faultDetails.value.disposalMeasures=dicts.disposal_measures_type[i].dictLabel;
+        if(faultDetails1.value.disposalMeasures===dicts.disposal_measures_type[i].dictValue){
+          faultDetails1.value.disposalMeasures=dicts.disposal_measures_type[i].dictLabel;
         }
       }
     });
@@ -136,13 +136,6 @@
   });
 
 
-  watch(
-    () => props.escalationFaultId,
-    () => {
-      search.value.escalationFaultId=props.escalationFaultId
-      dataNoPageList();
-    }
-  );
 
   // 设置表格列或者其他自定义的option
   option.value = Object.assign(option.value, {

+ 243 - 0
src/views/quality/faultHandle/components/fault-examine.vue

@@ -0,0 +1,243 @@
+<template>
+  <div class="fault" v-if="faultDetails1!=null">
+    <div class="title-fault" >
+      产品名称:&nbsp;&nbsp;{{faultDetails1.materialName}}
+    </div>
+    <div class="title-fault">
+      产品编码:&nbsp;&nbsp;{{faultDetails1.materialCode}}
+    </div>
+  </div>
+  <div class="mainContentBox">
+
+    <avue-crud
+      ref="crudRef"
+      v-model:search="search"
+      v-model="form"
+      :data="data"
+      :option="option"
+      v-model:page="page"
+      @row-save="createRow"
+      @row-update="updateRow"
+      @row-del="deleteRow"
+      @search-change="searchChange"
+      @search-reset="resetChange"
+      @selection-change="selectionChange"
+    >
+
+
+
+    </avue-crud>
+
+  </div>
+  <div class="fault">
+    <div class="image-title">图片</div>
+      <div v-for="(image, index) in faultImg1" :key="index" class="fault-image">
+        <!-- 使用v-for循环渲染图片列表 -->
+        <img :src="dictDataUtil.img_url+image.fileUrl" alt="图片" width="150px" class="fault-img">
+      </div>
+
+  </div>
+  <div class="fault" v-if="faultDetails1!=null">
+    <div class="fault-detail" >序列号:&nbsp;&nbsp;{{faultDetails1.seqNo}}</div>
+    <div class="fault-detail">故障描述:&nbsp;&nbsp;{{faultDetails1.remark}}</div>
+
+    <div class="title-fault" style="margin-top: 10px">
+      报故人:&nbsp;&nbsp;{{faultDetails1.creator}}
+    </div>
+    <div class="title-fault" style="margin-top: 10px">
+      报故工位:&nbsp;&nbsp;{{faultDetails1.stationName}}
+    </div>
+    <div class="title-fault" style="margin-top: 10px">
+      报故数量:&nbsp;&nbsp;{{faultDetails1.unqualifiedNum}}
+    </div>
+    <div class="title-fault" style="margin-top: 10px">
+      处理结果:&nbsp;&nbsp;{{faultDetails1.disposalMeasures}}
+    </div>
+  </div>
+  <div class="fault" v-if="faultDetails1!=null">
+
+
+
+    <el-radio-group v-model="radio1" size="large">
+      <el-radio-button label="审核通过" value="6" />
+      <el-radio-button label="驳回" value="2" />
+    </el-radio-group>
+  </div>
+
+  <div class="fault" v-if="faultDetails1!=null" style="margin-top: 15px;margin-bottom: 15px">
+
+    <el-input
+      type="textarea"
+      :autosize="{ minRows: 3, maxRows: 6}"
+      placeholder="请输入处理意见"
+      v-model="textarea2"
+    >
+    </el-input>
+
+
+  </div>
+  <div style="overflow: hidden">
+    <div class="detail-footer">
+      <el-button type="primary" @click="onHandle"> 确定 </el-button>
+      <el-button @click="cancelWindow">取消</el-button>
+
+    </div>
+  </div>
+
+</template>
+<script setup>
+  import { ref, getCurrentInstance } from "vue";
+  import { useCrud } from "@/hooks/userCrud";
+  import ButtonPermKeys from "@/common/configs/buttonPermission";
+  import { useCommonStoreHook, useDictionaryStoreHook } from "@/store";
+  const { isShowTable, tableType } = toRefs(useCommonStoreHook());
+  import {getFault,getFaultDetails,updateFault} from "@/api/fault"
+  import dictDataUtil from "@/common/configs/dictDataUtil";
+  // 数据字典相关
+  const { dicts } = useDictionaryStoreHook();
+
+  const test = () => {
+    isShowTable.value = true;
+    tableType.value = tableType.value == 1 ? 2 : 1;
+  };
+  const props = defineProps({
+    escFaultId: {
+      type: String,
+      default: () => {
+        return 0;
+      }
+    },
+    dialogPs:{
+      type:Object,
+      default:()=>{
+        return {};
+      }
+    },
+  })
+  const drawingDetail=ref(null);
+
+  // 传入一个url,后面不带/
+  const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
+    useCrud({
+      src: "/api/v1/process/escalationDefects",
+    });
+  const { dataNoPageList, createRow, updateRow, deleteRow, searchChange, resetChange } =
+    Methords; //增删改查
+  const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
+  const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
+  // checkBtnPerm(ButtonPermKeys.PLAN.BTNS.order_add) :permission="permission"
+  // const permission = reactive({
+  //   delBtn: checkPerm(buttonPermission.PLAN.BTNS.order_del),
+  //   addBtn: checkPerm(buttonPermission.PLAN.BTNS.order_add),
+  //   editBtn: checkPerm(buttonPermission.PLAN.BTNS.order_edit),
+  //   menu: true,
+  // });
+
+  const crudRef = ref(null); //crudRef.value 获取avue-crud对象
+  const router = useRouter();
+  const radio1=ref("6");
+  const faultImg1=ref(null);
+  const formData1=ref({});
+  const faultDetails1=ref(null);
+  const textarea2=ref('');
+  onMounted(() => {
+    // console.log("crudRef", crudRef)
+    search.value.escalationFaultId=props.escFaultId;
+    dataNoPageList();
+    formData1.value.escalationFaultId=props.escFaultId;
+    getFault(formData1.value).then((data) => {
+
+      faultImg1.value=data.data;
+      console.info(faultImg1.value);
+    });
+    getFaultDetails(props.escFaultId).then((data) => {
+
+      faultDetails1.value=data.data;
+      for(let i=0;i<dicts.disposal_measures_type.length;i++){
+        if(faultDetails1.value.disposalMeasures===dicts.disposal_measures_type[i].dictValue){
+          faultDetails1.value.disposalMeasures=dicts.disposal_measures_type[i].dictLabel;
+        }
+      }
+    });
+
+  });
+
+  const onHandle=()=>{
+    const updateFaultData=ref({id:faultDetails1.value.id,currentState:radio1.value,opinion:textarea2.value});
+    updateFault(updateFaultData.value).then(
+      (data)=>{
+        if(data.code==="200") {
+          ElMessage({
+            message: data.msg,
+            type: "success",
+          });
+          props.dialogPs.visible=false;
+          dataList();
+        }
+        else {
+          ElMessage({
+            message: data.msg,
+            type: "error",
+          });
+        }
+      }
+    )
+  }
+
+
+  // 设置表格列或者其他自定义的option
+  option.value = Object.assign(option.value, {
+    addBtn: false,
+    editBtn:false,
+    delBtn:false,
+    viewBtn:false,
+    menu:false,
+    column: [
+      {
+        label: "缺陷大类",
+        prop: "bugType",
+        dicData:dicts.defect_mana,
+        props: { label: "dictLabel", value: "dictValue" },
+      },
+      {
+        label: "缺陷小类",
+        prop: "bugName",
+      },
+    ],
+  });
+
+ const cancelWindow=()=>{
+   props.dialogPs.visible=false;
+ }
+</script>
+<style>
+  .title-fault{
+    float: left;
+    width: 300px;
+  }
+  .fault{
+    margin-left: 15px;
+    margin-top: 10px;
+    display: block;
+    overflow: hidden;
+  }
+  .fault-image{
+    width: 150px;
+    float: left;
+    margin-left: 10px;
+    overflow: hidden;
+  }
+  .image-title{
+    margin-bottom: 15px;
+  }
+  .fault-img{
+    display: inline-block;
+  }
+  .fault-detail{
+    margin-top: 20px;
+  }
+  .detail-footer{
+    float: right;
+    overflow: hidden;
+  }
+</style>

+ 21 - 1
src/views/quality/faultHandle/components/fault-handle.vue

@@ -134,7 +134,7 @@
     search.value.escalationFaultId=props.escalationId;
     dataNoPageList();
     formData.value.escalationFaultId=props.escalationId;
-    getFault(formData).then((data) => {
+    getFault(formData.value).then((data) => {
 
       faultImg.value=data.data;
     });
@@ -149,7 +149,27 @@
     });
 
   });
+  /*watch(
+    () => props.escalationId,
+    ()=>{
+      search.value.escalationFaultId=props.escalationId;
+      dataNoPageList();
+      formData.value.escalationFaultId=props.escalationId;
+      getFault(formData.value).then((data) => {
 
+        faultImg.value=data.data;
+      });
+      getFaultDetails(props.escalationId).then((data) => {
+
+        faultDetails.value=data.data;
+        for(let i=0;i<dicts.disposal_measures_type.length;i++){
+          if(faultDetails.value.disposalMeasures===dicts.disposal_measures_type[i].dictValue){
+            faultDetails.value.disposalMeasures=dicts.disposal_measures_type[i].dictLabel;
+          }
+        }
+      });
+    }
+  );*/
 const faultHandle=ref({});
  const onHandle=()=>{
    faultHandle.value.id=faultDetails.value.id;

+ 5 - 5
src/views/quality/faultHandle/components/fault-page.vue

@@ -111,6 +111,7 @@
       }
     }
   })
+
   // 传入一个url,后面不带/
   const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
     useCrud({
@@ -143,7 +144,7 @@
     dataNoPageList();
     formData.value.escalationFaultId=props.faultId;
     formFault.value.escalationFaultId=props.faultId;
-    getFault(formData).then((data) => {
+    getFault(formData.value).then((data) => {
 
       faultImg.value=data.data;
     });
@@ -161,9 +162,8 @@
       data2.value=data.data;
       for(let i=0;i<data2.value.length;i++){
         data2.value[i].$cellEdit=true;
-        postDetail.value[i].seqNo=data2.value[i].seqNo;
-
       }
+      postDetail.value=Array.from(data2.value);
     });
 
   });
@@ -171,14 +171,14 @@
 const listData=(row)=>{
   for(let i=0;i<postDetail.value.length;i++){
     if(postDetail.value[i].seqNo===row.seqNo){
-      postDetail.value[i].processId=value.value.id;
+      postDetail.value[i].reworkProcessId=value.value;
     }
   }
 }
 const faultHandle=ref({});
  const onHandle=()=>{
    for(let i=0;i<postDetail.value.length;i++){
-     if(null===postDetail.value[i].processId){
+     if(undefined===postDetail.value[i].reworkProcessId){
        ElMessage({
          message:postDetail.value[i].seqNo+"没选择返工工序",
          type: "error",

+ 36 - 3
src/views/quality/faultHandle/index.vue

@@ -34,15 +34,21 @@
                    icon="el-icon-link"
                    text
                    type="primary"
-                   v-if="row.currentState==1"
+                   v-if="row.currentState==6"
         >处理</el-button>
 
         <el-button @click="faultThaw(row)"
                    icon="el-icon-link"
                    text
                    type="primary"
-
+                   v-if="row.currentState==4"
         >解冻</el-button>
+        <el-button @click="faultExamine(row)"
+                   icon="el-icon-link"
+                   text
+                   type="primary"
+                   v-if="row.currentState==1"
+        >审核</el-button>
       </template>
 
 
@@ -53,6 +59,7 @@
       :title="dialog.title"
       width="900px"
       @close="dialog.visible = false"
+      :destroy-on-close="true"
     >
       <fault-detail  :escalationFaultId="fault.id" :dialog="dialog" />
     </el-dialog>
@@ -62,6 +69,7 @@
       :title="dialog1.title"
       width="900px"
       @close="dialog1.visible = false"
+      :destroy-on-close="true"
     >
       <fault-handle  :escalationId="faultInfo.id" :dia="dialog1" />
     </el-dialog>
@@ -71,9 +79,20 @@
       :title="dialog2.title"
       width="900px"
       @close="dialog2.visible = false"
+      :destroy-on-close="true"
     >
       <fault-page  :faultId="faultEs.id" :dial="dialog2" />
     </el-dialog>
+
+    <el-dialog
+      v-model="dialog3.visible"
+      :title="dialog3.title"
+      width="900px"
+      @close="closeFault"
+      :destroy-on-close="true"
+    >
+      <FaultExamine  :escFaultId="faultExa.id" :dialogPs="dialog3" />
+    </el-dialog>
   </div>
 </template>
 <script setup>
@@ -82,6 +101,7 @@
   import ButtonPermKeys from "@/common/configs/buttonPermission";
   import { columns } from "./columns";
   import { useCommonStoreHook, useDictionaryStoreHook } from "@/store";
+  import FaultExamine from "@/views/quality/faultHandle/components/fault-examine.vue"
   const { isShowTable, tableType } = toRefs(useCommonStoreHook());
   // 数据字典相关
   const { dicts } = useDictionaryStoreHook();
@@ -102,10 +122,14 @@
     title: "解冻",
     visible: false,
   });
-
+  const dialog3 = ref({
+    title: "审核",
+    visible: false,
+  });
   const fault=ref({});
   const faultInfo=ref({});
   const faultEs=ref({});
+  const faultExa=ref({});
   const faultEdit=(row)=>{
 
     faultInfo.value.id=row.id;
@@ -116,6 +140,15 @@
     faultEs.value.id=row.id;
     dialog2.value.visible=true;
   }
+
+  const faultExamine =(row)=>{
+    faultExa.value.id=row.id;
+    dialog3.value.visible=true;
+  }
+  const closeFault=()=>{
+    dialog3.value.visible=false;
+    dataList();
+  }
   // 传入一个url,后面不带/
   const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
     useCrud({

+ 38 - 26
src/views/quality/unqualified/columns.ts

@@ -3,41 +3,53 @@ const { dicts } = useDictionaryStoreHook();
 export const columns = [
 
   {
-    label: "报故时间",
-    prop: "created",
+    label: "审理单号",
+    prop: "trackingNumber",
+    overHidden: true,
+    width:120,
+    search: true,
   },
-
-
   {
-    label: "物料名称",
-    prop: "bomMaterialName",
-    overHidden:true,
+    label: "工单号",
+    prop: "workOrderCode",
+    overHidden: true,
+    width:120,
+    search: true,
   },
   {
-    label: "物料属性",
-    prop: "bomMaterialAttribute",
-    type: 'select',
-    dicData:dicts.material_properties,
-    props: { label: "dictLabel", value: "dictValue" },
+    label: "订单号",
+    prop: "orderCode",
+    overHidden: true,
+    width:120,
+    search: true,
   },
   {
-    label: "物料数量",
-    prop: "bomMaterialNumber",
-    min:0,
-    slot:true,
-    cell: true,
-    type: "number",
-    precision: 2,
+    label: "不合格数量",
+    overHidden: true,
+    width:100,
+    prop: "unqualifiedNum",
   },
+
   {
-    label: "物料名称",
-    prop: "materialName",
-    overHidden:true,
-  },
+    label: "序列号", prop: "seqNo", overHidden: true,
 
+  },
   {
-    label: "物料编码",
-    prop: "bomMaterialCode",
+    label: "状态", prop: "state", overHidden: true,
+    width:120,
+    dicData:dicts.escalation_fault_state,
+    props: { label: "dictLabel", value: "dictValue" },
+  },
+  {
+    label: "跟踪状态", prop: "currentState", overHidden: true,
+    width:100,
+    dicData:dicts.fault_current_state,
+    props: { label: "dictLabel", value: "dictValue" },
+  },
+  {
+    label: "报故人", prop: "creator",
+    overHidden: true,
+    width:100,
+    search: true,
   },
-
 ];

+ 98 - 224
src/views/quality/unqualified/index.vue

@@ -1,260 +1,134 @@
 <template>
   <div class="mainContentBox">
-    <!--{{dataDetail}}-->
-    <!--{{dicts}}-->
-    <div class="detail">
-      <div class="title-detail">物料名称:{{dataDetail.materialCode}}</div>
-      <div class="title-detail">物料编码:{{dataDetail.materialName}}</div>
-      <div class="title-detail">物料属性:{{dataDetail.attributeDictLabel}}</div>
-    </div>
+
+
     <avue-crud
       ref="crudRef"
       v-model:search="search"
       v-model="form"
       :data="data"
       :option="option"
+      v-model:page="page"
+      @row-save="createRow"
       @row-update="updateRow"
       @row-del="deleteRow"
       @search-change="searchChange"
       @search-reset="resetChange"
+      @size-change="dataList"
+      @current-change="dataList"
       @selection-change="selectionChange"
     >
-      <template #menu-left="{ size }">
-        <el-button
-          type="primary"
-          icon="el-icon-plus"
-          @click="openMaterial"
-          >新增</el-button
-        ></template>
 
-        <CommonTable
-          ref="ctableRef"
-          tableTitle="物料选择"
-          tableType="BOM"
-          @selected-sure="onSelectedFinish"
-        />
-      <template #footer>
-        <div class="detail-footer">
-          <el-button type="primary" @click="onSelected"> 保存 </el-button>
-          <el-button @click="routeBack">取消</el-button>
-
-        </div>
-      </template>
-      <template #menu-right="{}">
-        <el-dropdown split-button
-          >导入
-          <template #dropdown>
-            <el-dropdown-menu>
-              <el-dropdown-item
-                @click="downloadTemplate('/api/v1/plan/order/template')"
-              >
-                <i-ep-download />下载模板
-              </el-dropdown-item>
-              <el-dropdown-item @click="importExcelData">
-                <i-ep-top />导入数据
-              </el-dropdown-item>
-            </el-dropdown-menu>
-          </template>
-        </el-dropdown>
+      <template #menu="{row,index,type}">
+        <el-button @click="viewFault(row)"
+                   icon="el-icon-view"
+                   text
+                   type="primary"
+        >查看</el-button>
       </template>
+
+
     </avue-crud>
-    <CommonTable
-      ref="ctableRef"
-      tableTitle="BOM添加"
-      tableType="MARTERIAL"
-      @selected-sure="onSelectedFinish"
-    />
+
+    <el-dialog
+      v-model="dialog.visible"
+      :title="dialog.title"
+      width="900px"
+      @close="dialog.visible = false"
+      :destroy-on-close="true"
+    >
+      <FaultDetail  :escalationFaultId="fault.id" :dialog="dialog" />
+    </el-dialog>
+
 
   </div>
 </template>
-<script setup lang="ts">
-import { ref, getCurrentInstance } from "vue";
-import { useCrud } from "../../../hooks/userCrud";
-import ButtonPermKeys from "../../../common/configs/buttonPermission";
-import { columns } from "./columns";
-import { useCommonStoreHook, useDictionaryStoreHook } from "../../../store/index";
-import {
-  getList,
-} from "@/api/bom";
-import {
-  getMaterialDetails,
-} from "@/api/material";
+<script setup>
+  import { ref, getCurrentInstance } from "vue";
+  import { useCrud } from "@/hooks/userCrud";
+  import ButtonPermKeys from "@/common/configs/buttonPermission";
+  import { columns } from "./columns";
+  import { useCommonStoreHook, useDictionaryStoreHook } from "@/store";
+  import FaultDetail from "@/views/quality/faultHandle/components/fault-detail.vue"
+  const { isShowTable, tableType } = toRefs(useCommonStoreHook());
+  // 数据字典相关
+  const { dicts } = useDictionaryStoreHook();
+
+  const test = () => {
+    isShowTable.value = true;
+    tableType.value = tableType.value == 1 ? 2 : 1;
+  };
+  const dialog = ref({
+    title: "报故详情",
+    visible: false,
+  });
+  const fault=ref({});
+  const faultInfo=ref({});
+  const faultEs=ref({});
+  const faultExa=ref({});
+  const faultEdit=(row)=>{
 
-import {
-  batchAddBom,
-} from "@/api/bom";
-const { isShowTable, tableType } = toRefs(useCommonStoreHook());
-// 数据字典相关
-const { dicts } = useDictionaryStoreHook();
-const router = useRouter();
-const route = useRoute();
+    faultInfo.value.id=row.id;
 
-const dataDetail=ref({});
-const test = () => {
-  isShowTable.value = true;
-  tableType.value = tableType.value == 1 ? 2 : 1;
-};
-const openMaterial=()=>{
-  if (ctableRef.value) {
-    ctableRef.value.startSelect();
+    dialog1.value.visible=true;
+  }
+  const faultThaw=(row)=>{
+    faultEs.value.id=row.id;
+    dialog2.value.visible=true;
   }
-}
-const formData=ref({});
-const dataBomLists=()=>{
-  search.value.materialCode=route.value.materialCode;
-  dataNoPageList();
-}
-
-const ctableRef = ref(null);
 
-const binding = (row) => {
-  if (ctableRef.value) {
-    ctableRef.value.startSelect();
+  const faultExamine =(row)=>{
+    faultExa.value.id=row.id;
+    dialog3.value.visible=true;
   }
-};
-const onSelected=()=>{
-  for(var i=0;i<data.value.length;i++){
-    if(data.value[i].bomMaterialNumber<=0){
-      ElMessage({
-        message: data.value[i].bomMaterialName+"数量不能为0",
-        type: "error",
-      });
-      return;
-    }
+  const closeFault=()=>{
+    dialog3.value.visible=false;
+    dataList();
   }
-  if(data.value.length===0){
-    ElMessage({
-      message: "物料记录不能为空!",
-      type: "error",
+  // 传入一个url,后面不带/
+  const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
+    useCrud({
+      src: "/api/v1/process/escalationFault",
     });
-    return;
-  }
-  batchAddBom(data.value).then(
-    (data: any)=>{
-      if(data.code==="200") {
-        ElMessage({
-          message: data.msg,
-          type: "success",
-        });
-        router.back();
-      }
-      else {
-        ElMessage({
-          message: data.msg,
-          type: "error",
-        });
-      }
-    }
-  );
-}
-// 传入一个url,后面不带/
-const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
-  useCrud({
-    src: "/api/v1/base/materialBom",
-  });
-const { dataNoPageList,createRow, updateRow, deleteRow, searchChange, resetChange } =
-  Methords; //增删改查
-const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
-const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
-// checkBtnPerm(ButtonPermKeys.PLAN.BTNS.order_add) :permission="permission"
-// const permission = reactive({
-//   delBtn: checkPerm(buttonPermission.PLAN.BTNS.order_del),
-//   addBtn: checkPerm(buttonPermission.PLAN.BTNS.order_add),
-//   editBtn: checkPerm(buttonPermission.PLAN.BTNS.order_edit),
-//   menu: true,
-// });
-
-const crudRef = ref(null); //crudRef.value 获取avue-crud对象
+  const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
+    Methords; //增删改查
+  const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
+  const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
+  // checkBtnPerm(ButtonPermKeys.PLAN.BTNS.order_add) :permission="permission"
+  // const permission = reactive({
+  //   delBtn: checkPerm(buttonPermission.PLAN.BTNS.order_del),
+  //   addBtn: checkPerm(buttonPermission.PLAN.BTNS.order_add),
+  //   editBtn: checkPerm(buttonPermission.PLAN.BTNS.order_edit),
+  //   menu: true,
+  // });
 
-onMounted(() => {
-  // console.log("crudRef", crudRef)
-  search.value.materialCode=route.params.materialCode;
-  queryMaterialDetail();
-  dataNoPageList();
+  const crudRef = ref(null); //crudRef.value 获取avue-crud对象
+  const router = useRouter();
+  const viewFault = (row) => {
 
-});
+    fault.value.id=row.id;
+    console.info(fault)
+    dialog.value.visible=true;
+  };
+  onMounted(() => {
+    // console.log("crudRef", crudRef)
+    dataList();
+  });
 
-/**
- * 上传excel相关
- */
-const uploadRef = ref(null);
-const uploadFinished = () => {
-  // 上传完成后的刷新操作
-  dataNoPageList();
-};
-const importExcelData = () => {
-  if (uploadRef.value) {
-    uploadRef.value.show("/api/v1/plan/order/import");
+  const searchChangeState=()=>{
+    dataList();
   }
-};
 
-// 设置表格列或者其他自定义的option
-option.value = Object.assign(option.value, {
-  selection: true,
-  addBtn: false,
-  viewBtn: false,
-  editBtn:false,
-  saveBtn:false,
-  cellBtn: true,
-  column: columns,
-});
-const routeBack =()=>{
-  router.back();
-}
-const onSelectedFinish = (selectedValue) => {
-  for(var i=0;i<data.value.length;i++){
-    if(data.value[i].bomMaterialCode===selectedValue.materialCode){
-      ElMessage({
-        message: data.value[i].bomMaterialName+"已经添加过了",
-        type: "error",
-      });
-      return;
-    }
-  }
-  const bom=ref({
-    materialCode:route.params.materialCode,
-    bomMaterialCode:selectedValue.materialCode,
-    bomMaterialName:selectedValue.materialName,
-    bomMaterialAttribute:selectedValue.attributeDictValue,
-    bomMaterialNumber:0,
-    $cellEdit:true,
+
+
+  // 设置表格列或者其他自定义的option
+  option.value = Object.assign(option.value, {
+    addBtn: false,
+    editBtn:false,
+    delBtn:false,
+    viewBtn:false,
+    column: columns,
   });
-  data.value.push(bom.value);
-};
-const queryMaterialDetail = () => {
-  getMaterialDetails(route.params.materialCode).then(
 
-    ({ data }) => {
-      dataDetail.value=data;
-      dicts.material_properties;
-      for(var i=0;i<dicts.material_properties.length;i++){
-        if(data.attributeDictValue===dicts.material_properties[i].dictValue){
-          dataDetail.value.attributeDictLabel=dicts.material_properties[i].dictLabel;
-        }
-      }
 
-    }
-  );
-};
 </script>
-<style type="text/css">
-  .title-detail{
-    width: 30%;
-    height: 50px;
-    line-height: 50px;
-    margin: 25px 20px 25px 0;
-    float: left;
-  }
-  .detail{
-    margin: 0 auto;
-    width: 100%;
-  }
-  .avue-crud{
-    float: left;
-  }
-  .detail-footer{
-    float: right;
-    margin-top:15px;
-  }
-
-</style>

+ 20 - 11
src/views/system/post/components/post-skill.vue

@@ -52,25 +52,18 @@
     tableType.value = tableType.value == 1 ? 2 : 1;
   };
 
-  const formData=ref({});
-  const dataBomLists=()=>{
-    search.value.materialCode=route.value.materialCode;
-    dataNoPageList();
-  }
 
 
-  const dialog=ref(null);
-
 
 
   const addList=()=>{
     for(var i=0;i<data.value.length;i++){
-      if(data.value[i].skillDictValue==="0"||data.value[i].skillDictValue ===null){
+      if(data.value[i].skillDictValue==="0"||data.value[i].skillDictValue ===null||data.value[i].skillDictValue ===""){
         ElMessage({
           message:"技能选项存在空值",
           type: "error",
         });
-        return;
+        return false;
       }
     }
     if(data.value.length===0){
@@ -78,8 +71,24 @@
         message: "没有添加记录!",
         type: "error",
       });
-      return;
+      return false;
+    }
+
+    //判断试验类型是否重复
+    if(data.value.length > 0){
+      for (let i = 0; i < data.value.length; i++) {
+        for (let j = i + 1; j < data.value.length; j++) {
+          if (data.value[i].skillDictValue == data.value[j].skillDictValue) {
+            ElMessage({
+              message: data.value[i].$skillDictValue+ " 存在重复的技能项",
+              type: "error",
+            });
+            return false;
+          }
+        }
+      }
     }
+
     addPostSkill(data.value).then(
       (data: any)=>{
         if(data.code==="200") {
@@ -118,7 +127,7 @@
   const crudRef = ref(null); //crudRef.value 获取avue-crud对象
   const props = defineProps({
     postId: {
-      type: Number,
+      type: String,
       default: () => {
         return 0;
       }

+ 1 - 0
src/views/system/post/index.vue

@@ -39,6 +39,7 @@
       :title="dialog.title"
       width="800px"
       @close="dialog.visible = false"
+      :destroy-on-close="true"
     >
       <post-skill  :postId="post.id" :dialog="dialog"/>
     </el-dialog>