浏览代码

feat:返工处理

lupeng 8 月之前
父节点
当前提交
615c541fad

+ 30 - 32
src/api/fault/index.ts

@@ -1,7 +1,6 @@
 import request from "@/utils/request";
 import { AxiosPromise } from "axios";
-import {Fault, FaultHandle} from "@/api/fault/types";
-
+import { Fault, FaultHandle } from "@/api/fault/types";
 
 /**
  * 获取关联图片
@@ -42,32 +41,32 @@ export function handleEscalationFault(data: FaultHandle): AxiosPromise<any> {
   });
 }
 
-  /**
-   * 处理结果
-   *
-   * @param id
-   * @param data
-   */
-  export function getSeqNoList(data:Fault): AxiosPromise<any> {
-    return request({
-      url: "/api/v1/process/escalationItem/list",
-      method: "post",
-      data: data,
-    });
-  }
+/**
+ * 处理结果
+ *
+ * @param id
+ * @param data
+ */
+export function getSeqNoList(data: Fault): AxiosPromise<any> {
+  return request({
+    url: "/api/v1/process/escalationItem/list",
+    method: "post",
+    data: data,
+  });
+}
 
-    /**
-     * 处理结果
-     *
-     * @param id
-     * @param data
-     */
-    export function getProcessInfoList(data:Object) {
-      return request({
-        url: "/api/v1/process/info/list" ,
-        method: "post",
-        data:data,
-      });
+/**
+ * 处理结果
+ *
+ * @param id
+ * @param data
+ */
+export function handleReworkRecord(data: Object) {
+  return request({
+    url: "/api/v1/rework/record/handle",
+    method: "post",
+    data: data,
+  });
 }
 
 /**
@@ -76,11 +75,11 @@ export function handleEscalationFault(data: FaultHandle): AxiosPromise<any> {
  *
  * @param data
  */
-export function rework(data:Object) {
+export function rework(data: Object) {
   return request({
     url: "/api/v1/process/info/rework",
     method: "post",
-    data:data,
+    data: data,
   });
 }
 
@@ -90,11 +89,10 @@ export function rework(data:Object) {
  * @param id
  * @param data
  */
-export function updateFault(data:Object) {
+export function updateFault(data: Object) {
   return request({
     url: "/api/v1/process/escalationFault/update",
     method: "post",
-    data:data,
+    data: data,
   });
 }
-

+ 2 - 0
src/store/modules/dictionary.ts

@@ -33,6 +33,8 @@ export const useDictionaryStore = defineStore("dictionaryStore", () => {
     "excel_states",
     "process_state",
     "form_params",
+    "bill_type",
+    "warehouse_type",
   ];
   const dicts = ref<{ [key: string]: any[] }>({});
 

+ 37 - 0
src/views/plan/finishProduct/components/in-stock.vue

@@ -74,6 +74,8 @@ const {
 } = Methords; //增删改查
 const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
 const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
+
+const { dicts } = useDictionaryStore();
 // checkBtnPerm(ButtonPermKeys.PLAN.BTNS.order_add) :permission="permission"
 // const permission = reactive({
 //   delBtn: checkPerm(buttonPermission.PLAN.BTNS.order_del),
@@ -197,6 +199,41 @@ option2.value = {
       ],
     },
     {
+      label: "检验码",
+      prop: "checkCode",
+      span: 24,
+    },
+    {
+      label: "单据类型",
+      prop: "billType",
+      span: 24,
+      type: "select",
+      dicData: dicts.bill_type,
+      props: { label: "dictLabel", value: "dictValue" },
+      rules: [
+        {
+          required: true,
+          message: "请选择单据类型",
+          trigger: "blur",
+        },
+      ],
+    },
+    {
+      label: "仓库类型",
+      prop: "warehouseType",
+      span: 24,
+      type: "select",
+      dicData: dicts.warehouse_type,
+      props: { label: "dictLabel", value: "dictValue" },
+      rules: [
+        {
+          required: true,
+          message: "请选择仓库类型",
+          trigger: "blur",
+        },
+      ],
+    },
+    {
       label: "备注",
       prop: "remark",
       span: 24,

+ 216 - 197
src/views/quality/faultHandle/index.vue

@@ -1,7 +1,5 @@
 <template>
   <div class="mainContentBox">
-
-
     <avue-crud
       ref="crudRef"
       v-model:search="search"
@@ -19,42 +17,52 @@
       @selection-change="selectionChange"
     >
       <template #menu-left>
-        <el-radio-group v-model="radio1" size="large" @change="searchChangeState">
+        <el-radio-group
+          v-model="radio1"
+          size="large"
+          @change="searchChangeState"
+        >
           <el-radio-button label="未完成" value="1" />
           <el-radio-button label="已完成" value="3" />
         </el-radio-group>
-       </template>
-      <template #menu="{row,index,type}">
-        <el-button @click="viewFault(row)"
-                   icon="el-icon-view"
-                   text
-                   type="primary"
-        >查看</el-button>
-        <el-button @click="faultEdit(row)"
-                   icon="el-icon-link"
-                   text
-                   type="primary"
-                   v-if="row.currentState==6"
-                   v-hasPerm="[ButtonPermKeys.FAULT.BTNS.faultHandle_handle]"
-        >处理</el-button>
-
-        <el-button @click="faultThaw(row)"
-                   icon="el-icon-open"
-                   text
-                   type="primary"
-                   v-hasPerm="[ButtonPermKeys.FAULT.BTNS.faultHandle_thaw]"
-                   v-if="row.currentState==4"
-        >解冻</el-button>
-        <el-button @click="faultExamine(row)"
-                   icon="el-icon-reading"
-                   text
-                   type="primary"
-                   v-hasPerm="[ButtonPermKeys.FAULT.BTNS.faultHandle_examine]"
-                   v-if="row.currentState==1"
-        >审核</el-button>
       </template>
+      <template #menu="{ row, index, type }">
+        <el-button
+          @click="viewFault(row)"
+          icon="el-icon-view"
+          text
+          type="primary"
+          >查看</el-button
+        >
+        <el-button
+          @click="faultEdit(row)"
+          icon="el-icon-link"
+          text
+          type="primary"
+          v-if="row.currentState == 6"
+          v-hasPerm="[ButtonPermKeys.FAULT.BTNS.faultHandle_handle]"
+          >处理</el-button
+        >
 
-
+        <el-button
+          @click="faultThaw(row)"
+          icon="el-icon-open"
+          text
+          type="primary"
+          v-hasPerm="[ButtonPermKeys.FAULT.BTNS.faultHandle_thaw]"
+          v-if="row.currentState == 4"
+          >解冻</el-button
+        >
+        <el-button
+          @click="faultExamine(row)"
+          icon="el-icon-reading"
+          text
+          type="primary"
+          v-hasPerm="[ButtonPermKeys.FAULT.BTNS.faultHandle_examine]"
+          v-if="row.currentState == 1"
+          >审核</el-button
+        >
+      </template>
     </avue-crud>
 
     <el-dialog
@@ -64,7 +72,7 @@
       @close="dialog.visible = false"
       :destroy-on-close="true"
     >
-      <fault-detail  :escalationFaultId="fault.id" :dialog="dialog" />
+      <fault-detail :escalationFaultId="fault.id" :dialog="dialog" />
     </el-dialog>
 
     <el-dialog
@@ -74,7 +82,7 @@
       @close="closeFaultDetail"
       :destroy-on-close="true"
     >
-      <fault-handle  :escalationId="faultInfo.id" :dia="dialog1" />
+      <fault-handle :escalationId="faultInfo.id" :dia="dialog1" />
     </el-dialog>
 
     <el-dialog
@@ -84,7 +92,11 @@
       @close="closeFaultHandel"
       :destroy-on-close="true"
     >
-      <fault-page  :faultId="faultEs.id" :dial="dialog2" :workOrderCode="faultEs.workOrderCode"/>
+      <fault-page
+        :faultId="faultEs.id"
+        :dial="dialog2"
+        :workOrderCode="faultEs.workOrderCode"
+      />
     </el-dialog>
 
     <el-dialog
@@ -94,180 +106,187 @@
       @close="closeFault"
       :destroy-on-close="true"
     >
-      <FaultExamine  :escFaultId="faultExa.id" :dialogPs="dialog3" />
+      <FaultExamine :escFaultId="faultExa.id" :dialogPs="dialog3" />
     </el-dialog>
   </div>
 </template>
 <script setup>
-  import { ref, getCurrentInstance } from "vue";
-  import { useCrud } from "@/hooks/userCrud";
-  import ButtonPermKeys from "@/common/configs/buttonPermission";
-  import dictDataUtil from "@/common/configs/dictDataUtil";
-  import { useCommonStoreHook, useDictionaryStore } from "@/store";
-  import FaultExamine from "@/views/quality/faultHandle/components/fault-examine.vue"
-  const { isShowTable, tableType } = toRefs(useCommonStoreHook());
-  // 数据字典相关
-  const { dicts } = useDictionaryStore();
-
-  const test = () => {
-    isShowTable.value = true;
-    tableType.value = tableType.value == 1 ? 2 : 1;
-  };
-  const dialog = ref({
-    title: "报故详情",
-    visible: false,
-  });
-  const dialog1 = ref({
-    title: "报故处理",
-    visible: false,
-  });
-  const dialog2 = ref({
-    title: "解冻",
-    visible: false,
-  });
-  const dialog3 = ref({
-    title: "审核",
-    visible: false,
-  });
-
-  const closeFaultDetail=()=>{
-    dialog1.visible = false;
-    dataList();
-  }
-  const closeFaultHandel=()=>{
-    dialog2.visible = false;
-    dataList();
-  }
-  const fault=ref({});
-  const faultInfo=ref({});
-  const faultEs=ref({});
-  const faultExa=ref({});
-  const faultEdit=(row)=>{
-
-    faultInfo.value.id=row.id;
-
-    dialog1.value.visible=true;
-  }
-  const faultThaw=(row)=>{
-    faultEs.value=row;
-    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({
-      src: "/api/v1/process/escalationFault",
-    });
-  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,
-  // });
+import { ref, getCurrentInstance } from "vue";
+import { useCrud } from "@/hooks/userCrud";
+import ButtonPermKeys from "@/common/configs/buttonPermission";
+import dictDataUtil from "@/common/configs/dictDataUtil";
+import { useCommonStoreHook, useDictionaryStore } from "@/store";
+import FaultExamine from "@/views/quality/faultHandle/components/fault-examine.vue";
+const { isShowTable, tableType } = toRefs(useCommonStoreHook());
+// 数据字典相关
+const { dicts } = useDictionaryStore();
 
-  const crudRef = ref(null); //crudRef.value 获取avue-crud对象
-  const router = useRouter();
-  const route = useRoute();
-  const viewFault = (row) => {
+const test = () => {
+  isShowTable.value = true;
+  tableType.value = tableType.value == 1 ? 2 : 1;
+};
+const dialog = ref({
+  title: "报故详情",
+  visible: false,
+});
+const dialog1 = ref({
+  title: "报故处理",
+  visible: false,
+});
+const dialog2 = ref({
+  title: "解冻",
+  visible: false,
+});
+const dialog3 = ref({
+  title: "审核",
+  visible: false,
+});
 
-    fault.value.id=row.id;
-    console.info(fault)
-    dialog.value.visible=true;
-  };
-  onMounted(() => {
-    // console.log("crudRef", crudRef)
+const closeFaultDetail = () => {
+  dialog1.visible = false;
+  dataList();
+};
+const closeFaultHandel = () => {
+  dialog2.visible = false;
+  dataList();
+};
+const fault = ref({});
+const faultInfo = ref({});
+const faultEs = ref({});
+const faultExa = ref({});
+const faultEdit = (row) => {
+  faultInfo.value.id = row.id;
 
-    search.value.id = route.query.id;
-    search.value.state = radio1.value;
-    dataList();
+  dialog1.value.visible = true;
+};
+const faultThaw = (row) => {
+  faultEs.value = row;
+  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({
+    src: "/api/v1/process/escalationFault",
   });
+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,
+// });
 
-  const searchChangeState=()=>{
-    search.value.state=radio1.value;
-    dataList();
-  }
+const crudRef = ref(null); //crudRef.value 获取avue-crud对象
+const router = useRouter();
+const route = useRoute();
+const viewFault = (row) => {
+  fault.value.id = row.id;
+  console.info(fault);
+  dialog.value.visible = true;
+};
+onMounted(() => {
+  // console.log("crudRef", crudRef)
 
-  const radio1 = ref('1')
+  search.value.id = route.query.id;
+  search.value.state = radio1.value;
+  dataList();
+});
 
-  // 设置表格列或者其他自定义的option
-  option.value = Object.assign(option.value, {
-    addBtn: false,
-    editBtn:false,
-    delBtn:false,
-    viewBtn:false,
-    column: [
+const searchChangeState = () => {
+  search.value.state = radio1.value;
+  dataList();
+};
 
-      {
-        label: "审理单号",
-        prop: "trackingNumber",
-        overHidden: true,
-        search: true,
-      },
-      {
-        label: "工单号",
-        prop: "workOrderCode",
-        overHidden: true,
-        search: true,
-      },
-      {
-        label: "订单号",
-        prop: "orderCode",
-        overHidden: true,
-        width:120,
-        search: true,
-      },
-      {
-        label: "不合格数量",
-        overHidden: true,
-        width:100,
-        prop: "unqualifiedNum",
-      },
-      {
-        label: "产品编码", prop: "materialCode", overHidden: true,
-
-      },
-      {
-        label: "产品名称", prop: "materialName", overHidden: true,
-        width:100,
-      },
-
-      {
-        label: "流转卡号", prop: "seqNo", overHidden: true,search:true,
-      },
-      {
-        label: "状态", prop: "state", overHidden: true,
-        width:120,
-        dicUrl:dictDataUtil.request_url + dictDataUtil.TYPE_CODE.escalation_fault_state,
-        props: { label: "dictLabel", value: "dictValue" },
-      },
-      {
-        label: "跟踪状态", prop: "currentState", overHidden: true,
-        width:100,
-        dicUrl:dictDataUtil.request_url + dictDataUtil.TYPE_CODE.fault_current_state,
-        props: { label: "dictLabel", value: "dictValue" },
-      },
-      {
-        label: "报故人", prop: "creator",
-        overHidden: true,
-        width:100,
-      },
-
-    ],
-  });
+const radio1 = ref("1");
 
+// 设置表格列或者其他自定义的option
+option.value = Object.assign(option.value, {
+  addBtn: false,
+  editBtn: false,
+  delBtn: false,
+  viewBtn: false,
+  column: [
+    {
+      label: "审理单号",
+      prop: "trackingNumber",
+      overHidden: true,
+      search: true,
+    },
+    {
+      label: "工单号",
+      prop: "workOrderCode",
+      overHidden: true,
+      search: true,
+    },
+    {
+      label: "订单号",
+      prop: "orderCode",
+      overHidden: true,
+      width: 120,
+      search: true,
+    },
+    {
+      label: "不合格数量",
+      overHidden: true,
+      width: 100,
+      prop: "unqualifiedNum",
+    },
+    {
+      label: "产品编码",
+      prop: "materialCode",
+      overHidden: true,
+    },
+    {
+      label: "产品名称",
+      prop: "materialName",
+      overHidden: true,
+      width: 100,
+    },
 
+    {
+      label: "流转卡号",
+      prop: "seqNo",
+      overHidden: true,
+      search: true,
+    },
+    {
+      label: "状态",
+      prop: "state",
+      overHidden: true,
+      width: 120,
+      dicUrl:
+        dictDataUtil.request_url +
+        dictDataUtil.TYPE_CODE.escalation_fault_state,
+      props: { label: "dictLabel", value: "dictValue" },
+    },
+    {
+      label: "跟踪状态",
+      prop: "currentState",
+      overHidden: true,
+      width: 100,
+      dicUrl:
+        dictDataUtil.request_url + dictDataUtil.TYPE_CODE.fault_current_state,
+      props: { label: "dictLabel", value: "dictValue" },
+    },
+    {
+      label: "报故人",
+      prop: "creator",
+      overHidden: true,
+      width: 100,
+    },
+  ],
+});
 </script>

+ 249 - 0
src/views/quality/rework/components/rework-detail.vue

@@ -0,0 +1,249 @@
+<template>
+  <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"
+      @size-change="dataList"
+      @current-change="dataList"
+      @selection-change="selectionChange"
+    >
+      <template #menu="{ size, row, index }">
+        <el-button
+          icon="el-icon-edit"
+          text
+          @click="doEdit(row, index)"
+          type="primary"
+          :size="size"
+          >编辑</el-button
+        >
+      </template>
+      <!--        <single-upload v-model="form.drawingPath" :generatePdf="true"/>-->
+      <template #drawingPath-form="scope">
+        <FilesUpload
+          v-model="form.drawingPath"
+          v-model:src-list="srcList"
+          v-model:file-name-list="fileNameList"
+          v-model:file-list="fileList"
+          :limit="10"
+          @finished="testFiles"
+          :key="uploadKey"
+        />
+      </template>
+    </avue-crud>
+  </div>
+</template>
+<script setup>
+import { useCrud } from "@/hooks/userCrud";
+import dictDataUtil from "@/common/configs/dictDataUtil";
+import ButtonPermKeys from "@/common/configs/buttonPermission";
+import { useCommonStoreHook, useDictionaryStore } from "@/store";
+import SingleUpload from "@/components/Upload/SingleUpload.vue";
+import { getUserList } from "@/api/system/user";
+import { ref } from "vue";
+import FilesUpload from "@/components/Upload/FilesUpload.vue";
+
+// 数据字典相关
+const { dicts } = useDictionaryStore();
+const userList = ref([]);
+
+// 传入一个url,后面不带/
+const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
+  useCrud({
+    src: "/api/v1/rework/item",
+  });
+const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
+  Methords; //增删改查
+const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
+const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
+const filePath = import.meta.env.VITE_APP_UPLOAD_URL;
+const crudRef = ref(null); //crudRef.value 获取avue-crud对象
+const props = defineProps({
+  recordId: {
+    type: String,
+    default: () => {
+      return 0;
+    },
+  },
+  dialog: {
+    type: Object,
+    default: () => {
+      return {};
+    },
+  },
+});
+const doEdit = (row, index) => {
+  srcList.value = [];
+  fileNameList.value = [];
+  crudRef.value && crudRef.value.rowEdit(row, index);
+};
+const srcList = ref([]);
+const fileNameList = ref([]);
+const testFiles = () => {
+  form.value.drawingPathList = srcList.value;
+  form.value.fileNameList = fileNameList.value;
+};
+
+onMounted(() => {
+  search.value.recordId = props.recordId;
+  dataList();
+  getUserList({}).then((data) => {
+    userList.value = data.data;
+  });
+});
+
+// 设置表格列或者其他自定义的option
+option.value = Object.assign(option.value, {
+  selection: false,
+  addBtn: false,
+  editBtn: false,
+  delBtn: false,
+  viewBtn: true,
+  column: [
+    {
+      label: "工序",
+      prop: "operationName",
+      search: true,
+      width: 100,
+      overHidden: true,
+      editDisabled: true,
+    },
+    {
+      label: "工艺条件",
+      prop: "processAsk",
+      width: 160,
+      overHidden: true,
+      editDisabled: true,
+    },
+    {
+      label: "接收数",
+      prop: "num",
+      rules: [
+        {
+          required: true,
+          message: "请填写接收数量",
+          trigger: "blur",
+        },
+      ],
+    },
+    {
+      label: "合格数",
+      prop: "qualifiedNum",
+      rules: [
+        {
+          required: true,
+          message: "请填写合格数量",
+          trigger: "blur",
+        },
+      ],
+    },
+    {
+      label: "合格率",
+      prop: "qualifiedRate",
+      editDisplay: false,
+    },
+    {
+      label: "检验人",
+      prop: "checkName",
+      type: "select",
+      dicData: userList,
+      filterable: true,
+      props: { label: "userName", value: "userName" },
+    },
+    {
+      label: "操作者",
+      prop: "operateName",
+      editDisplay: false,
+    },
+    {
+      label: "日期",
+      prop: "operateDate",
+      width: 120,
+      editDisplay: false,
+    },
+    {
+      label: "附件",
+      prop: "drawingPath",
+      viewDisplay: false,
+      slot: true,
+      hide: true,
+    },
+    {
+      label: "附件",
+      prop: "drawingPathList",
+      display: false,
+      hide: true,
+    },
+    {
+      label: "附件",
+      prop: "fileNameList",
+      display: false,
+      hide: true,
+    },
+    {
+      label: "文件",
+      prop: "filePath",
+      display: false,
+      width: 160,
+      type: "textarea",
+      html: true,
+      formatter: (val) => {
+        if (val.filePath != "" && null != val.filePath) {
+          let array = JSON.parse(val.filePath);
+          let file = "";
+          array.forEach((item) => {
+            file =
+              file +
+              '<a class="el-tag el-tag--info el-tag--light" href="' +
+              filePath +
+              item.filePath +
+              '" >' +
+              item.fileName +
+              "</a>";
+          });
+          return file;
+          /* return (
+            '<a class="el-tag el-tag--info el-tag--light" href="' +
+            filePath +
+            val.filePath +
+            '" >文件下载</a>'
+          );*/
+        } else {
+          return val.filePath;
+        }
+      },
+    },
+    /* {
+      label: "附件",
+      prop: "operateDate",
+      display: false,
+    },
+    {
+      label: "附件下载",
+      prop: "filePath",
+      width: 120,
+      html: true,
+      formatter: (val) => {
+        if (val.filePath != "") {
+          return (
+            '<a class="el-tag el-tag--info el-tag--light" href="' +
+            filePath +
+            val.filePath +
+            '" >文件下载</a>'
+          );
+        } else {
+          return val.filePath;
+        }
+      },
+    },*/
+  ],
+});
+</script>

+ 216 - 0
src/views/quality/rework/index.vue

@@ -0,0 +1,216 @@
+<template>
+  <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"
+      @size-change="dataList"
+      @current-change="dataList"
+      @selection-change="selectionChange"
+    >
+      <template #menu="{ row, index, type }">
+        <el-button
+          @click="operation(row)"
+          icon="el-icon-link"
+          text
+          type="primary"
+          >返工工序</el-button
+        >
+
+        <el-button
+          icon="el-icon-edit"
+          text
+          @click="handle(row, index, 2)"
+          type="primary"
+          v-if="row.state === 0"
+          :size="size"
+          >驳回</el-button
+        >
+        <el-button
+          icon="el-icon-edit"
+          text
+          v-if="row.state === 0"
+          @click="handle(row, index, 1)"
+          type="primary"
+          :size="size"
+          >返工完成</el-button
+        >
+      </template>
+    </avue-crud>
+    <el-dialog
+      v-model="dialog.visible"
+      :title="dialog.title"
+      width="900px"
+      @close="closeOperation"
+      :destroy-on-close="true"
+    >
+      <ReworkItem :recordId="record.id" :dialog="dialog" />
+    </el-dialog>
+  </div>
+</template>
+<script setup>
+import { useCrud } from "@/hooks/userCrud";
+import dictDataUtil from "@/common/configs/dictDataUtil";
+import ButtonPermKeys from "@/common/configs/buttonPermission";
+import { useCommonStoreHook, useDictionaryStore } from "@/store";
+import ReworkItem from "@/views/quality/rework/components/rework-detail.vue";
+import { ref } from "vue";
+import { handleReworkRecord } from "@/api/fault/index";
+
+// 数据字典相关
+const { dicts } = useDictionaryStore();
+
+// 传入一个url,后面不带/
+const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
+  useCrud({
+    src: "/api/v1/rework/record",
+  });
+const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
+  Methords; //增删改查
+const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
+const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
+
+const crudRef = ref(null); //crudRef.value 获取avue-crud对象
+const dialog = ref({
+  title: "关联工序",
+  visible: false,
+});
+onMounted(() => {
+  dataList();
+});
+const record = ref({});
+const operation = (row) => {
+  record.value = row;
+  dialog.value.visible = true;
+};
+const closeOperation = () => {
+  dialog.value.visible = false;
+};
+const handleData = ref({});
+const handle = (row, index, state) => {
+  handleData.value.id = row.id;
+  handleData.value.state = state;
+  handleData.value.seqNos = row.seqNos;
+  handleReworkRecord(handleData.value).then((data) => {
+    if (data.code === "200") {
+      ElMessage({
+        message: data.msg,
+        type: "success",
+      });
+      dataList();
+    } else {
+      ElMessage({
+        message: data.msg,
+        type: "error",
+      });
+    }
+  });
+};
+// 设置表格列或者其他自定义的option
+option.value = Object.assign(option.value, {
+  selection: false,
+  addBtn: false,
+  delBtn: false,
+  editBtn: false,
+  viewBtn: true,
+  column: [
+    {
+      label: "生产批号",
+      prop: "workOrderCode",
+      width: 160,
+      overHidden: true,
+      search: true,
+    },
+    {
+      label: "产品名称",
+      prop: "materialName",
+      search: true,
+    },
+    {
+      label: "数量",
+      prop: "num",
+    },
+    {
+      label: "管号",
+      prop: "seqNos",
+    },
+    {
+      label: "管号",
+      prop: "seqNo",
+      search: true,
+      hide: true,
+      display: false,
+    },
+    {
+      label: "返工内容",
+      prop: "remark",
+      width: 160,
+      overHidden: true,
+      type: "textarea",
+    },
+    {
+      label: "状态",
+      prop: "state",
+      type: "select",
+      display: false,
+      dicData: [
+        {
+          label: "待处理",
+          value: 0,
+        },
+        {
+          label: "返工完成",
+          value: 1,
+        },
+        {
+          label: "驳回",
+          value: 2,
+        },
+      ],
+    },
+    {
+      label: "返工原因",
+      prop: "reason",
+      width: 160,
+      overHidden: true,
+      type: "textarea",
+    },
+    {
+      label: "返工提出者",
+      prop: "creator",
+    },
+    {
+      label: "日期",
+      prop: "created",
+      type: "date",
+      width: 160,
+      format: "YYYY-MM-DD",
+      valueFormat: "YYYY-MM-DD",
+      overHidden: true,
+    },
+    {
+      label: "日期",
+      prop: "createdSearch",
+      width: 160,
+      type: "daterange",
+      searchRange: true,
+      display: false,
+      hide: true,
+      startPlaceholder: "开始范围",
+      endPlaceholder: "结束范围",
+      format: "YYYY-MM-DD",
+      valueFormat: "YYYY-MM-DD",
+      overHidden: true,
+      search: true,
+    },
+  ],
+});
+</script>