Browse Source

Merge remote-tracking branch 'origin/qingban' into qingban

jxq 3 months ago
parent
commit
938e18428f

File diff suppressed because it is too large
+ 2 - 2
public/LuckExcel/luckysheet.umd.js


+ 31 - 5
src/api/prosteps/ceshishuju.ts

@@ -1,17 +1,18 @@
 import request from "@/utils/request";
 
 //获取当前列表
-export function dataArrayList(processId: string) {
+export function dataArrayList(processId: string,deviceNo :string) {
   return request({
-    url: `/api/v1/testData/get/${processId}`,
+    url: `/api/v1/testData/get/${processId}/${deviceNo}`,
     method: "get",
   });
 }
 
-export function startCSSJTesting(processId: string, deviceNo: string) {
+export function startCSSJTesting(data: any) {
   return request({
-    url: `/api/v1/testData/startTest/${processId}/${deviceNo}`,
-    method: "get",
+    url: `/api/v1/testData/startTest`,
+    method: "post",
+    data: data,
   });
 }
 
@@ -48,3 +49,28 @@ export function getDeviceListPage(data: any) {
     data: data,
   });
 }
+
+
+export function getDataDevice(data: any) {
+    return request({
+        url: `api/v1/processDataDevice/list`,
+        method: "post",
+        data: data,
+    });
+}
+
+export function addDataDevice(data: any) {
+    return request({
+        url: `api/v1/processDataDevice/add`,
+        method: "post",
+        data: data,
+    });
+}
+
+export function delDataDevice(data: any) {
+    return request({
+        url: `api/v1/processDataDevice/del`,
+        method: "post",
+        data: data,
+    });
+}

+ 1 - 1
src/api/prosteps/excel.ts

@@ -17,7 +17,7 @@ export function setExcelData(data: any) {
 //获取检验签章
 export function getJYQZ(data: any) {
   return request({
-    url: "/api/v1/base/signature/page",
+    url: "/api/v1/base/signature/list",
     method: "post",
     data: data,
   });

+ 819 - 0
src/components/CrudTable/configs/tableConfig.ts

@@ -0,0 +1,819 @@
+import { useDictionaryStore } from "@/store";
+const { dicts } = useDictionaryStore();
+import dictDataUtil from "@/common/configs/dictDataUtil";
+export const tableConfig = {
+  MARTERIAL: {
+    url: "/api/v1/base/material",
+    column: [
+      { label: "物料编码", prop: "materialCode", search: true },
+      { label: "物料名称", prop: "materialName", search: true },
+      { label: "保质期", prop: "qualityGuaranteePeriod" },
+
+      { label: "物料规格", prop: "spec", search: true },
+
+      {
+        label: "物料属性",
+        prop: "attributeDictValue",
+        search: true,
+        filterable: true,
+        type: "select",
+        dataType: "string",
+        dicData: dicts.material_properties,
+        props: { label: "dictLabel", value: "dictValue" },
+      },
+      {
+        label: "是否工装",
+        prop: "frock",
+        filterable: true,
+        type: "radio", //类型为单选框
+        dicData: [
+          {
+            label: "否",
+            value: 0,
+          },
+          {
+            label: "是",
+            value: 1,
+          },
+        ],
+        value: 0,
+      },
+      {
+        label: "质检方案",
+        prop: "inspectDictValue",
+        search: true,
+        filterable: true,
+        type: "select",
+        dataType: "string",
+        dicData: dicts.quality_testing_plan,
+        props: { label: "dictLabel", value: "dictValue" },
+      },
+      {
+        label: "物料级别",
+        prop: "levelDictValue",
+        search: true,
+        filterable: true,
+        type: "select",
+        dataType: "string",
+        dicData: dicts.material_level,
+        props: { label: "dictLabel", value: "dictValue" },
+      },
+      {
+        label: "封装方法",
+        prop: "packageDictValue",
+        search: true,
+        filterable: true,
+        type: "select",
+        dataType: "string",
+        dicData: dicts.packaging_method,
+        props: { label: "dictLabel", value: "dictValue" },
+      },
+      {
+        label: "质量等级",
+        prop: "qualityLevelDictValue",
+        search: true,
+        filterable: true,
+        type: "select",
+        dataType: "string",
+        dicData: dicts.quality_grade,
+        props: { label: "dictLabel", value: "dictValue" },
+      },
+      {
+        label: "选用类型",
+        prop: "selectionDictValue",
+        search: true,
+        filterable: true,
+        type: "select",
+        dataType: "string",
+        dicData: dicts.selection_type,
+        props: { label: "dictLabel", value: "dictValue" },
+      },
+      {
+        label: "阶段",
+        prop: "stageDictValue",
+        search: true,
+        filterable: true,
+        type: "select",
+        dataType: "string",
+        dicData: dicts.stage,
+        props: { label: "dictLabel", value: "dictValue" },
+      },
+      {
+        label: "物料单位",
+        prop: "unitDictValue",
+        search: true,
+        filterable: true,
+        type: "select",
+        dataType: "string",
+        dicData: dicts.danwei_type,
+        props: { label: "dictLabel", value: "dictValue" },
+      },
+      { label: "备注", prop: "remark", type: "textarea" },
+    ],
+  },
+
+  STATION: {
+    url: "/api/v1/base/station",
+    column: [
+      {
+        label: "工位编号",
+        prop: "stationCode",
+        search: true,
+        rules: [
+          {
+            required: true,
+            message: "请填写工位编号",
+            trigger: "blur",
+          },
+        ],
+      },
+      {
+        label: "工位名称",
+        prop: "name",
+        search: true,
+        rules: [
+          {
+            required: true,
+            message: "请填写工位名称",
+            trigger: "blur",
+          },
+        ],
+      },
+      {
+        label: "工位类型",
+        prop: "stationDictValue",
+        search: true,
+        rules: [
+          {
+            required: true,
+            message: "请选择工位类型",
+            trigger: "blur",
+          },
+        ],
+        type: "select",
+        dicData: dicts.station_type,
+        searchClearable: false, //可清空的输入框,默认为true
+        filterable: true, //添加filterable属性即可启用搜索功能
+        props: {
+          label: "dictLabel", // 下拉菜单显示的字段
+          value: "dictValue", // 下拉菜单值的字段
+        },
+      },
+      {
+        label: "工位操作方式",
+        prop: "operateDictValue",
+        rules: [
+          {
+            required: true,
+            message: "请选择工位方式",
+            trigger: "blur",
+          },
+        ],
+        type: "select",
+        dicData: dicts.station_operate_type,
+        props: {
+          label: "dictLabel", // 下拉菜单显示的字段
+          value: "dictValue", // 下拉菜单值的字
+        },
+      },
+
+      {
+        label: "所属产线",
+        prop: "productionLineName",
+        display: false,
+      },
+      {
+        label: "工位地址",
+        prop: "position",
+        rules: [
+          {
+            required: true,
+            message: "请填写工位地址",
+            trigger: "blur",
+          },
+        ],
+      },
+      {
+        label: "工位IP地址",
+        prop: "stationIp",
+        rules: [
+          {
+            required: true,
+            message: "请填写工位IP地址",
+            trigger: "blur",
+          },
+        ],
+      },
+      {
+        label: "工位描述",
+        prop: "remark",
+        type: "textarea",
+        span: 24,
+      },
+      {
+        label: "创建人",
+        prop: "creator",
+        display: false,
+      },
+      {
+        label: "创建时间",
+        prop: "created",
+        display: false,
+      },
+    ],
+  },
+
+  DEVICE: {
+    url: "/api/v1/device",
+    column: [
+      {
+        label: "资产编号",
+        prop: "deviceNo",
+        search: true,
+        rules: [
+          {
+            required: true,
+            message: "设备编号不能为空",
+            trigger: "trigger",
+          },
+        ],
+      },
+      {
+        label: "设备名称",
+        prop: "deviceName",
+        search: true,
+        rules: [
+          {
+            required: true,
+            message: "设备名称不能为空",
+            trigger: "trigger",
+          },
+        ],
+      },
+      {
+        label: "设备类型",
+        prop: "deviceType",
+        type: "select",
+        hide: true,
+        dicData: dicts.device_type,
+        props: {
+          label: "dictLabel",
+          value: "dictValue",
+        },
+      },
+      {
+        label: "负责人",
+        prop: "head",
+      },
+      {
+        label: "存放位置",
+        prop: "devicePosition",
+      },
+      {
+        label: "型号",
+        prop: "specifications",
+      },
+      {
+        label: "制造厂",
+        prop: "brand",
+      },
+
+    ],
+  },
+
+  MARTERIAL_BOM: {
+    url: "/api/v1/base/materialBom",
+    column: [
+      {
+        label: "物料版本",
+        prop: "bomVersion",
+        type: "select",
+        // search: true,  先选择版本代替了
+      },
+      {
+        label: "物料编码",
+        search: true,
+        prop: "bomMaterialCode",
+      },
+      {
+        label: "物料编码",
+        prop: "materialCode",
+        hide: true,
+      },
+
+      {
+        label: "物料名称",
+        prop: "materialName",
+        overHidden: true,
+        hide: true,
+      },
+
+      {
+        label: "物料名称",
+        prop: "bomMaterialName",
+        overHidden: true,
+      },
+      {
+        label: "物料属性",
+        prop: "bomMaterialAttribute",
+        type: "select",
+        dicData: dicts.material_properties,
+        props: { label: "dictLabel", value: "dictValue" },
+      },
+      {
+        label: "物料数量",
+        prop: "bomMaterialNumber",
+        min: 0,
+        slot: true,
+        cell: true,
+        type: "number",
+        precision: 2,
+      },
+      { label: "物料规格", prop: "spec",search: true },
+    ],
+  },
+
+  OP_CHECK: {
+    url: "/api/v1/op/base/check",
+    column: [
+      {
+        label: "点检项名称",
+        prop: "checkName",
+        span: 12,
+        labelWidth: "150",
+        search: true,
+        editDisabled: true,
+      },
+      {
+        label: "点检项编码",
+        prop: "checkCode",
+        labelWidth: "150",
+        editDisabled: true,
+        span: 12,
+        search: true,
+      },
+      {
+        label: "内容",
+        prop: "content",
+        span: 12,
+        search: false,
+      },
+    ],
+  },
+
+  ESOP: {
+    url: "/api/v1/base/drawing",
+    column: [
+      {
+        label: "图纸编码",
+        prop: "drawingCode",
+        span: 12,
+        labelWidth: "150",
+        search: true,
+        editDisabled: true,
+      },
+      {
+        label: "标题",
+        prop: "drawingTitle",
+        labelWidth: "150",
+        editDisabled: true,
+        span: 12,
+        search: false,
+      },
+      {
+        label: "版本号",
+        prop: "drawingVersion",
+        span: 12,
+        search: false,
+      },
+      /*{
+			  label: "图纸",
+			  prop: "drawingPath",
+			  span: 24,
+			  display: false,
+			  slot: true,
+			  // formatter: (row, column, cellValue, index) => {
+			  //   return `${row.drawingPath}`;
+			  // },
+			}*/
+    ],
+  },
+
+  USERS: {
+    url: "/api/v1/sys/employeeSkill/users",
+    column: [
+      {
+        label: "用户名",
+        prop: "userName",
+        search: true,
+        width: "120",
+      },
+      {
+        label: "员工编码",
+        prop: "employeeCode",
+        search: true,
+      },
+      {
+        label: "用户id",
+        prop: "id",
+        hide: true,
+        /*display:false,*/
+      },
+      {
+        label: "用户电话",
+        prop: "phone",
+        search: true,
+      },
+
+      {
+        label: "部门",
+        prop: "deptName",
+        overHidden: true,
+        disabled: true,
+      },
+      /*{
+        label: "所属机构",
+        prop: "deptName",
+        filterable: true,
+        type: "select",
+        width: 100,
+        overHidden: true,
+        dicUrl: dictDataUtil.dept_list_url,
+        dicMethod: "post",
+        props: { label: "deptName", value: "id" },
+        disabled: true,
+      },*/
+    ],
+  },
+
+  FAULT: {
+    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,
+      },
+      {
+        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,
+      },
+    ],
+  },
+
+  ROUTE_COMMON: {
+    url: "/api/v1/op/route/common",
+    column: [
+      {
+        label: "工艺编号",
+        prop: "processRouteCode",
+        search: true,
+        width: 150,
+        addDisplay: true,
+        editDisabled: true,
+        overHidden: true,
+        rules: [
+          {
+            required: true,
+            message: "工艺路线名称不能为空",
+            trigger: "blur",
+          },
+        ],
+      },
+      {
+        label: "工艺名称",
+        prop: "processRouteName",
+        width: 150,
+        search: true,
+        overHidden: true,
+        rules: [
+          {
+            required: true,
+            message: "工艺路线名称不能为空",
+            trigger: "blur",
+          },
+        ],
+      },
+      {
+        label: "工艺类型",
+        prop: "processRouteType",
+        minWidth: 120,
+        search: true,
+        overHidden: true,
+        rules: [
+          {
+            required: true,
+            message: "工艺路线类型不能为空",
+            trigger: "change",
+          },
+        ],
+        type: "select",
+        dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.routing_type,
+        props: {
+          label: "dictLabel",
+          value: "dictValue",
+        },
+      },
+      {
+        label: "启用状态",
+        prop: "enabled",
+        addDisplay: false,
+        // editDisplay: false,
+        slot: true,
+        width: 100,
+        type: "radio",
+        dicData: [
+          {
+            label: "未启用",
+            value: 1,
+          },
+          {
+            label: "启用",
+            value: 0,
+          },
+        ],
+        value: 0,
+      },
+      // 只有绑定了工序才可以复制。
+      {
+        label: "是否可复制",
+        prop: "usable2",
+        slot: true,
+        width: 100,
+        search: false,
+        filterable: true,
+        hide: true,
+        addDisplay: false,
+        editDisplay: false,
+        type: "radio",
+        dicData: [
+          {
+            label: "否",
+            value: 0,
+          },
+          {
+            label: "是",
+            value: 1,
+          },
+        ],
+        value: 0,
+      },
+      {
+        label: "创建人",
+        prop: "creator",
+        addDisplay: false,
+        editDisplay: false,
+        overHidden: true,
+      },
+      {
+        label: "创建时间",
+        prop: "created",
+        addDisplay: false,
+        editDisplay: false,
+        width: 150,
+        overHidden: true,
+      },
+    ],
+  },
+  FULIAO_CAIJI: {
+    url: "/api/v1/base/accessories/material",
+    column: [
+      {
+        label: "辅料属性",
+        prop: "accessoriesProperty",
+        search: true,
+        type: "select",
+        dicData: dicts.accessories_property,
+        props: {
+          label: "dictLabel",
+          value: "dictValue",
+        },
+        rules: [
+          {
+            required: true,
+            message: "辅料属性不能为空",
+            trigger: "blur",
+          },
+        ],
+      },
+      {
+        label: "物料编码",
+        prop: "materialCode",
+        clearable: false,
+        search: true,
+        rules: [
+          {
+            required: true,
+            message: "生产物料编码不能为空",
+            trigger: "change",
+          },
+        ],
+      },
+      {
+        label: "物料名称",
+        prop: "materialName",
+        addDisplay: false,
+        editDisplay: false,
+        search: true,
+      },
+      {
+        label: "物料规格",
+        prop: "spec",
+        addDisplay: false,
+        editDisplay: false,
+        search: true,
+      },
+      {
+        label: "辅料类型",
+        prop: "accessoriesType",
+        search: true,
+        type: "select",
+        dicData: dicts.accessories_type,
+        props: {
+          label: "dictLabel",
+          value: "dictValue",
+        },
+        rules: [
+          {
+            required: true,
+            message: "辅料类型不能为空",
+            trigger: "blur",
+          },
+        ],
+      },
+    ],
+  },
+
+  MATERIAL_GATHER: {
+    url: "/api/v1/op/operationItem",
+    column: [
+      {
+        label: "id",
+        prop: "id",
+        display: false,
+        hide: true,
+      },
+      {
+        label: "物料名称",
+        prop: "itemName",
+        search: true,
+        addDisabled: true,
+        editDisabled: true,
+      },
+      {
+        label: "物料版本号",
+        prop: "recordVersion",
+        addDisabled: true,
+        editDisabled: true,
+      },
+      {
+        label: "物料编码",
+        prop: "itemCode",
+        search: true,
+        addDisabled: true,
+        editDisabled: true,
+      },
+      {
+        label: "物料规格",
+        prop: "itemModel",
+        addDisabled: true,
+        search: true,
+        editDisabled: true,
+      },
+      { label: "所需数量", prop: "num" },
+      {
+        label: "追溯类型",
+        prop: "traceType",
+        filterable: true,
+        type: "select",
+        dataType: "string",
+        dicData: dicts.trace_type,
+        props: { label: "dictLabel", value: "dictValue" },
+      },
+      {
+        label: "单位",
+        prop: "unit",
+        filterable: true,
+        type: "select",
+        dataType: "string",
+        dicData: dicts.danwei_type,
+        props: { label: "dictLabel", value: "dictValue" },
+      },
+    ],
+  },
+
+  OP_ACCESSORY: {
+    url: "/api/v1/operationAccessoryItem",
+    column: [
+      {
+        label: "id",
+        prop: "id",
+        display: false,
+        hide: true,
+
+      },
+      {
+        label: "物料名称",
+        prop: "itemName",
+        addDisabled: true,
+        search: true,
+        editDisabled: true,
+      },
+      {
+        label: "物料版本号",
+        prop: "recordVersion",
+        addDisabled: true,
+        editDisabled: true,
+      },
+      {
+        label: "物料编码",
+        prop: "itemCode",
+        addDisabled: true,
+        search: true,
+        editDisabled: true,
+      },
+      {
+        label: "物料规格",
+        prop: "itemModel",
+        addDisabled: true,
+        search: true,
+        editDisabled: true,
+      },
+      // {
+      //   label: "是否需要",
+      //   prop: "isTrace",
+      //   type: "radio", //类型为单选框
+      //   dicData: [
+      //     {
+      //       label: "需采集物料",
+      //       value: 1,
+      //     },
+      //     {
+      //       label: "非必须采集物料",
+      //       value: 0,
+      //     },
+      //   ],
+      //   value: 1,
+      //   rules: [
+      //     {
+      //       required: true,
+      //       message: "是否需要",
+      //       trigger: "blur",
+      //     },
+      //   ],
+      // },
+    ],
+  },
+
+
+
+
+};

+ 228 - 0
src/components/CrudTable/index.vue

@@ -0,0 +1,228 @@
+<template>
+  <el-dialog
+    v-model="isShowTable"
+    :title="tableTitle"
+    width="1200"
+    :before-close="handleClose"
+    :append-to-body="true"
+  >
+    <avue-crud
+      ref="crudRef"
+      v-model:search="search"
+      v-model="form"
+      :data="data"
+      :option="option"
+      v-model:page="page"
+      @row-click="rowClick"
+      @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 #footer>
+      <div class="dialog-footer">
+        <el-button @click="handleClose">取消</el-button>
+        <el-button type="primary" @click="onSelected"> 确定 </el-button>
+      </div>
+    </template>
+  </el-dialog>
+</template>
+<script setup>
+import { ref, getCurrentInstance } from "vue";
+import { useCrud } from "@/hooks/userCrud";
+import { tableConfig } from "./configs/tableConfig";
+
+const props = defineProps({
+  tableTitle: {
+    default: "",
+    type: String,
+  },
+  tableType: {
+    default: "",
+    type: String,
+  },
+  multiple: {
+    default: false,
+    type: Boolean,
+  },
+  // 用于多选的返回值
+  multipleKey: {
+    default: "id",
+    type: String,
+  },
+  multipleRow: {
+    default: false,
+    type: Boolean,
+  },
+});
+
+const isShowTable = ref(false);
+const startSelect = async (param) => {
+  if (param) {
+    commonConfig.value.params = param;
+  }
+  dataList();
+  isShowTable.value = true;
+};
+
+/**
+ * propName 要跟字典配置的key一致
+ * dictData 字典数据, 注意props的value和label
+ * */
+const refreshDictData = (propName, dictData, keyName = "value") => {
+  nextTick(() => {
+    if (dictData && dictData.length > 0 && crudRef.value) {
+      crudRef.value.updateDic(propName, dictData);
+      search.value[propName] = dictData[0][keyName];
+    }
+  });
+};
+
+/**
+ * op 对象的字段要跟option实际字段一直 才能进行合并操作
+ */
+const mergeOption = (op) => {
+  for (const key of Object.keys(op)) {
+    option.value[key] = op[key];
+  }
+};
+
+// 传入一个url,后面不带/
+const {
+  url,
+  form,
+  data,
+  option,
+  search,
+  page,
+  toDeleteIds,
+  selectedRows,
+  Methords,
+  Utils,
+  commonConfig,
+} = useCrud({
+  src: tableConfig[props.tableType].url,
+  multipleSelectKey: props.multipleKey,
+});
+const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
+  Methords; //增删改查
+const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
+
+const crudRef = ref(null); //crudRef.value 获取avue-crud对象
+
+const commonTableEmits = defineEmits(["selectedSure", "selectMultipleSure"]);
+
+const calculateColumnWidth = (column) => {
+  if (!column.label) {
+    return column.minWidth;
+  }
+  // 字宽度
+  const fontSize = 17;
+  let width = fontSize * (column.label.length + 2);
+  // 如果开启过滤
+  if (column.filters) {
+    width += 12;
+  }
+  // 如果开启排序
+  if (column.sortable) {
+    width += 24;
+  }
+  return width;
+};
+
+onMounted(() => {
+  url.value = tableConfig[props.tableType].url;
+  option.value = Object.assign(option.value, {
+    searchEnter: true,
+    menu: false,
+    highlightCurrentRow: true,
+    selection: props.multiple,
+    addBtn: false,
+    height: "500",
+    overHidden: true,
+    indexWidth: "120px",
+    searchLabelWidth: "120px",
+    column: tableConfig[props.tableType].column,
+  });
+  // 列处理
+  if (option.value.column) {
+    for (let col of option.value.column) {
+      col.minWidth = calculateColumnWidth(col);
+    }
+  }
+  // dataList();
+});
+watch(
+  () => props.tableType,
+  () => {
+    url.value = tableConfig[props.tableType].url;
+    option.value = Object.assign(option.value, {
+      searchEnter: true,
+      menu: false,
+      highlightCurrentRow: true,
+      selection: props.multiple,
+      addBtn: false,
+      height: "500",
+      overHidden: true,
+      searchLabelWidth: "120px",
+      column: tableConfig[props.tableType].column,
+    });
+    // 列处理
+    if (option.value.column) {
+      for (let col of option.value.column) {
+        col.minWidth = calculateColumnWidth(col);
+      }
+    }
+    //dataList();
+  }
+);
+
+const selectRowValue = ref({});
+const rowClick = (row) => {
+  selectRowValue.value = row;
+};
+
+const handleClose = () => {
+  // 在这里可以清空打开的commonTable的搜索条件
+  search.value.bomMaterialCode = "";
+
+  crudRef.value.clearSelection();
+  toDeleteIds.value = [];
+  selectedRows.value = [];
+  selectRowValue.value = {};
+  isShowTable.value = false;
+
+  console.log(
+    "关闭弹窗",
+    toDeleteIds.value,
+    selectedRows.value,
+    selectRowValue.value
+  );
+};
+
+const onSelected = () => {
+  if (props.multiple) {
+    if (toDeleteIds.value.length < 1) {
+      ElMessage.warning("未选择任何数据");
+      return;
+    }
+    commonTableEmits("selectMultipleSure", toDeleteIds.value);
+  } else {
+    if (props.multipleRow) {
+      console.log(selectedRows);
+      commonTableEmits("selectedSure", selectedRows.value);
+    } else {
+      commonTableEmits("selectedSure", selectRowValue.value);
+    }
+  }
+
+  handleClose();
+};
+
+defineExpose({ startSelect, refreshDictData, mergeOption });
+</script>

+ 106 - 51
src/views/pro-steps/components/ceshishuju.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <div class="csTitle-header">
-      <el-button type="primary" @click="startTesting">选择设备</el-button>
+      <el-button type="primary" @click="startCreat">选择设备</el-button>
       <span>产品编码: {{ csObj?.materialName }}</span>
       <span>产品名称: {{ csObj?.materialCode }}</span>
       <span>测试人员: {{ csObj?.creator }}</span>
@@ -43,6 +43,14 @@
               >
                 查看
               </el-button>
+              <el-button
+                  link
+                  class="btnText"
+                  type="danger"
+                  @click="preDel(scope.row)"
+              >
+                删除
+              </el-button>
             </template>
           </el-table-column>
         </el-table>
@@ -62,7 +70,7 @@
           align="center"
         />
         <el-table-column fixed prop="value" label="测试值" align="center" />
-        <el-table-column prop="flag" align="center" label="是否合格">
+<!--        <el-table-column prop="flag" align="center" label="是否合格">
           <template #default="scope">
             <span
               :class="{
@@ -73,7 +81,7 @@
               {{ scope.row.flag == 1 ? "合格" : "不合格" }}
             </span>
           </template>
-        </el-table-column>
+        </el-table-column>-->
 
         <!--      <el-table-column label="操作" fixed="right" width="200">-->
         <!--        <template #default="scope">-->
@@ -121,49 +129,28 @@
         <el-form-item label="测试值">
           <el-input v-model="editRow.value" />
         </el-form-item>
-        <el-form-item label="是否合格">
+<!--        <el-form-item label="是否合格">
           <el-radio v-model="editRow.flag" :label="1">合格</el-radio>
           <el-radio v-model="editRow.flag" :label="0">不合格</el-radio>
-        </el-form-item>
+        </el-form-item>-->
       </el-form>
       <template #footer>
         <el-button @click="handleDialogCancel">取 消</el-button>
         <el-button type="primary" @click="handleDialogConfirm">确 定</el-button>
       </template>
     </el-dialog>
-    <el-dialog title="设备列表" v-model="dialogDevice" append-to-body>
-      <el-table
-        :data="deviceList"
-        style="width: 100%; height: calc(100vh - 400px); margin-bottom: 10px"
-        ref="singleTableRef"
-        row-key="id"
-        highlight-current-row
-        @current-change="handleCurrentChange"
-        @selection-change="handleSelectionAllChange"
-      >
-        <el-table-column type="selection" width="50" />
-        <el-table-column prop="id" label="id" width="180" v-if="false" />
-        <el-table-column prop="deviceNo" label="设备编号" />
-        <el-table-column prop="deviceName" label="设备名称" />
-      </el-table>
-      <el-pagination
-        v-model:current-page="currentPageAll"
-        v-model:page-size="pageSizeAll"
-        layout="total, prev, pager, next"
-        :total="totalAll"
-        background
-        @size-change="sizeChangeAll"
-        @current-change="currentChangeAll"
-      />
-      <template #footer>
-        <el-button @click="dialogDevice = false">取 消</el-button>
-        <el-button type="primary" @click="dialogDevice = false"
-          >确 定</el-button
-        >
-      </template>
-    </el-dialog>
 
-    <el-dialog title="设置时间" v-model="startSettingVisible" append-to-body>
+        <CrudTable
+                ref="ctableRef"
+                tableTitle="设备绑定"
+                :multipleRow="multipleRow"
+                tableType="DEVICE"
+                @selected-sure="onSelectedFinish"
+        />
+
+
+
+    <el-dialog title="设置时间" v-model="startSettingVisible" append-to-body style="top:20%">
       <el-date-picker
         v-model="startSettingTime"
         type="datetimerange"
@@ -188,14 +175,58 @@ import {
   startCSSJTesting,
   getDeviceList,
   getDeviceListPage,
+  getDataDevice,
+  addDataDevice, delDataDevice
 } from "@/api/prosteps/ceshishuju";
 import { useProcessStore } from "@/store";
 import { emitter, EventsNames } from "@/utils/common";
+import { useCrud } from "@/hooks/userCrud";
+const multipleRow = ref(true);
 
-const store = useProcessStore();
+const dataDeviceList = ref([]);
+const onSelectedFinish = (val) => {
+  if (Object.keys(val).length == 0) {
+    ElMessage.error("请选择设备,数据不能为空!");
+  }
+  val?.forEach(
+      (item,index)=>{
+        const dataDevice =  ref({});
+        dataDevice.value.processId = store.scanInfo.id;
+        dataDevice.value.seqNo = store.scanInfo.seqNo;
+        dataDevice.value.operationId = store.scanInfo.operationId;
+        dataDevice.value.operationName = store.scanInfo.operationName;
+        dataDevice.value.workOrderCode = store.scanInfo.workOrderCode;
+        dataDevice.value.deviceNo = item.deviceNo;
+        dataDevice.value.deviceName = item.deviceName;
+        dataDeviceList.value.push(dataDevice.value);
+      }
+
+  )
+  addDataDevice(dataDeviceList.value).then(
+      (res)=>{
+         if(res.code==='200'){
+           const param=ref({processId:store.scanInfo.id});
+           getDataDevice(param.value).then(
+               (data)=>{
+                 selectedDeviceList.value = JSON.parse(JSON.stringify(data.data));
+               }
+           )
+         }
+      }
+  )
 
+}
+const store = useProcessStore();
+const ctableRef = ref({});
 const csObj = ref<any>(null);
+const startCreat = () => {
+  ctableRef.value.startSelect({deviceType : "DDS"});
+    ctableRef.value?.mergeOption({
+        selection: true,
+        reserveSelection: true,
+    });
 
+};
 const tableData = ref<any[]>([]);
 
 const currentRow = ref<any>(null);
@@ -204,7 +235,11 @@ const handleCurrentChange = (val: any) => {
 };
 const deviceList = ref<any[]>([]);
 const getList = () => {
-  dataArrayList(store.scanInfo.id).then((res: any) => {
+  if(!currentToStartRow||!currentToStartRow.deviceNo){
+    tableData.value=[];
+    return;
+  }
+  dataArrayList(store.scanInfo.id,currentToStartRow.deviceNo).then((res: any) => {
     csObj.value = res.data;
     tableData.value = JSON.parse(res.data.testData);
     console.log(tableData.value, "返回的列表数据");
@@ -224,16 +259,16 @@ const handleSelectionAllChange = (vals: any[]) => {
   selectedDeviceList.value = JSON.parse(JSON.stringify(vals));
 };
 
-const dialogConfirm = () => {
-  console.log(currentRow);
-  if (!currentRow || !currentRow.value || !currentRow.value.deviceNo) {
-    ElMessage.error("未选择设备!");
-    return;
-  }
-  startCSSJTesting(store.scanInfo.id, currentRow.value.deviceNo).then(
+const afterTimeStart = () => {
+  const testParam = ref({});
+  testParam.value.processId=store.scanInfo.id;
+  testParam.value.deviceNo = currentToStartRow.deviceNo;
+  testParam.value.times = startSettingTime.value;
+  startCSSJTesting(testParam.value).then(
     (data) => {
       if (data.code === "200") {
         dialogDevice.value = false;
+        startSettingVisible.value = false;
       }
       if (!emitter.all.has(EventsNames.TEST_DATA)) {
         emitter.on(EventsNames.TEST_DATA, (mesaage: any) => {
@@ -248,6 +283,12 @@ onMounted(() => {
   getList();
   deviceSearch.value.deviceType = "DDS";
   getDeviceListPageAll();
+  const param=ref({processId:store.scanInfo.id});
+  getDataDevice(param.value).then(
+      (data)=>{
+        selectedDeviceList.value = JSON.parse(JSON.stringify(data.data));
+      }
+  )
 });
 
 const getDeviceListPageAll = () => {
@@ -319,16 +360,30 @@ const preToStart = (row) => {
   currentToStartRow = JSON.parse(JSON.stringify(row));
   startSettingVisible.value = true;
 };
+
+const preDel = (row) =>{
+  delDataDevice({id:row.id}).then(
+    (data)=>{
+      if(data.code==='200'){
+        ElMessage.success("操作成功!");
+        const param=ref({processId:store.scanInfo.id});
+        getDataDevice(param.value).then(
+            (data)=>{
+              selectedDeviceList.value = JSON.parse(JSON.stringify(data.data));
+            }
+        )
+      }
+    }
+  )
+}
 const preToLook = (row) => {
-  // currentToStartRow = JSON.parse(JSON.stringify(row));
+  currentToStartRow = JSON.parse(JSON.stringify(row));
   // startSettingVisible.value = true;
+  getList();
 };
 
 const startSettingVisible = ref(false);
 const startSettingTime = ref<any>(null);
-const afterTimeStart = () => {
-  console.log(startSettingTime.value);
-};
 const afterTimeCancel = () => {
   startSettingVisible.value = false;
 };
@@ -351,7 +406,7 @@ const afterTimeCancel = () => {
 }
 
 .left-selected-devs {
-  width: 400px;
+  width: 450px;
   background-color: #fff;
   border-radius: 16px;
   height: calc(100vh - 300px);

+ 3 - 3
src/views/pro-steps/components/excel.vue

@@ -124,12 +124,12 @@ const imgUrl = ref("");
 const options = ref([]);
 const getUrlOption = async () => {
   const data = await getJYQZ({
-    pageNo: 1,
+    /*pageNo: 1,
     pageSize: 999,
-    signUser: userStore.user.username,
+    /!*signUser: userStore.user.username,*!/*/
     signatureType: "3",
   });
-  options.value = data.data.records;
+  options.value = data.data;
 };
 const addImg = () => {
   if (