guoyujia 2 月之前
父節點
當前提交
aa0c76dbc7

+ 16 - 1
src/api/business/certificate.js

@@ -51,6 +51,15 @@ export function generateQrCode(data) {
     data: data
   })
 }
+export function exportCertificate(data) {
+  download(
+    baseUrl + "/business/certificate/batchExport",
+    {
+      ...data,
+    },
+    `合格证_${new Date().getTime()}.xlsx`
+  )
+}
 
 export function printPdf(data) {
   return downloadPdf(
@@ -69,7 +78,13 @@ export function getDayworkList(data) {
     params: data
   });
 }
-
+export function getBatchCertificateList(data) {
+  return request({
+    url: baseUrl + "/business/certificate/getBatchCertificateList",
+    method: "get",
+    params: data
+  });
+}
 export function newCertificate(data) {
   return request({
     url: baseUrl + "/business/certificate/newCertificate",

+ 87 - 0
src/views/business/batchCertificate/DeptChoiceDialog.vue

@@ -0,0 +1,87 @@
+<template>
+  <el-dialog title="选择部门" v-model="visible" width="800px" append-to-body draggable>
+    <el-form ref="dialogForm" class="master-container" :model="queryParams" style="align-items: center;">
+      <div style="display: flex;">
+        <el-form-item label="部门编码:" prop="deptCode" label-width="100px" style="margin-top: 20px;">
+          <el-input v-model.trim="queryParams.deptCode" type="text" @keydown.enter.prevent style="width: 180px"
+            placeholder="请输入部门编码" :clearable="true" @keyup.enter="handleSearch" />
+        </el-form-item>
+        <el-form-item label="部门名称:" prop="deptName" label-width="100px" style="margin-top: 20px;">
+          <el-input v-model.trim="queryParams.deptName" type="text" @keydown.enter.prevent style="width: 180px"
+            placeholder="请输入部门名称" :clearable="true" @keyup.enter="handleSearch" />
+        </el-form-item>
+        <el-form-item label-width="20px" style="margin-top: 20px;">
+          <el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
+        </el-form-item>
+      </div>
+    </el-form>
+    <el-table v-loading="loading" row-key="deptId" :data="dataList" height="400px">
+      <el-table-column label="行号" type="index" width="50" align="center" />
+      <el-table-column label="部门编码" prop="deptCode" width="150" align="center" />
+      <el-table-column label="部门名称" prop="deptName" align="center" />
+      <el-table-column label="操作" width="100" align="center">
+        <template #default="scope">
+          <el-button link type="success" icon="Select" @click="handleSelectDept(scope.row)">选择</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+  </el-dialog>
+</template>
+<script setup>
+import { listDept, listForCertificate } from '@/api/system/dept'
+const emit = defineEmits(['handleSelectDept', 'handleSelectBelongingDept'])
+const { proxy } = getCurrentInstance()
+const loading = ref(false)
+const visible = ref(false)
+const multiple = ref(false)
+
+const dataList = ref([])
+
+/** 设备档案 查询对象 */
+const queryParams = ref({
+  type: 0,
+  deptName: '',
+  deptCode: '',
+  isWorkSection: 1
+})
+/***********************  方法区  ****************************/
+/** 打开抽屉 */
+const open = (data) => {
+  visible.value = true
+  multiple.value = data
+  loadData()
+}
+
+const loadData = () => {
+  loading.value = true
+  listForCertificate(queryParams.value).then((res) => {
+    dataList.value = res.rows
+    //dataTotal.value = res.total
+    loading.value = false
+  })
+}
+
+const handleRefreshDetail = () => {
+  loadData()
+}
+
+const handleSelectDept = (data) => {
+  if (multiple.value) {
+    emit('handleSelectDept', data)
+  }
+  else {
+    emit('handleSelectBelongingDept', data)
+  }
+
+  proxy.$refs.dialogForm.resetFields()
+  visible.value = false
+}
+const handleSearch = () => {
+  loadData()
+}
+
+/** 暴露给父组件的方法 */
+defineExpose({
+  open
+})
+</script>

+ 141 - 0
src/views/business/batchCertificate/DialogFurnaceNoInfo.vue

@@ -0,0 +1,141 @@
+<template>
+  <el-dialog title="选择炉号" v-model="visible" width="800px" height="400px" @close="close" append-to-body draggable>
+    <!-- <el-form ref="dialogForm" :model="queryParams" :inline="true" style="padding-top: 16px">
+      <el-form-item label="炉号:" prop="code" label-width="104">
+        <el-input v-model.trim="queryParams.processAlias" type="text" @keydown.enter.prevent style="width: 160px"
+          placeholder="请输入关键字" :clearable="true" @keyup.enter="handleSearch" />
+      </el-form-item>
+      <el-form-item label-width="20px">
+        <el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
+      </el-form-item>
+    </el-form> -->
+
+    <el-table ref="dialogTable" :data="productList" size="small" v-loading="loading" border height="370px"
+      @selection-change="handleSelectionChange">
+      <!-- <el-table-column type="selection" width="40" align="center" /> -->
+      <el-table-column label="序号" width="56" align="center" type="index" />
+      <el-table-column label="材料厂家" align="center" prop="factory" />
+      <el-table-column label="炉号" align="center" prop="furnaceNumber" />
+      <el-table-column label="牌号" align="center" prop="brandNumber" />
+      <el-table-column label="规格" align="center" prop="spec" />
+      <el-table-column label="材料直径" align="center" prop="diameter" />
+      <el-table-column label="形状" align="center" prop="shape" />
+      <el-table-column label="来料日期" align="center" prop="incomingDate" />
+      <el-table-column label="原料编码" align="center" prop="rawMaterialCode" />
+      <el-table-column label="技术要求1" align="center" prop="firstTechnicalRequirement" />
+      <el-table-column label="技术要求2" align="center" prop="secondTechnicalRequirement" />
+      <el-table-column label="操作" align="center" prop="rawMaterialCode">
+        <template #default="scope">
+          <el-button type="success" icon="finished" circle @click="handleSingleSelected(scope.row)" />
+        </template>
+      </el-table-column>
+    </el-table>
+    <!-- 分页 -->
+    <!-- <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
+      v-model:limit="queryParams.pageSize" @pagination="getList" /> -->
+    <!-- <template #footer>
+      <div class="dialog-footer">
+        <el-button type="primary" icon="Check" :disabled="selections.length === 0" @click="handleMultipleSelected">
+          确 定
+        </el-button>
+        <el-button type="danger" icon="Close" @click="close">取 消</el-button>
+      </div>
+    </template> -->
+  </el-dialog>
+</template>
+<script setup>
+// import { carrierForOutsource } from "@/api/business/outsourcedOrder";
+import { getFurnaceNoInfo } from '@/api/business/p2'
+const { proxy } = getCurrentInstance();
+/** 字典数组区 */
+const { process_status } = proxy.useDict("process_status");
+/** 工序变量 */
+const total = ref(0);
+const props = defineProps({
+  singleSelected: {
+    type: Function,
+    default: null,
+  },
+  multipleSelected: {
+    type: Function,
+    default: null,
+  },
+  supplierId: {
+    type: String,
+    default: "",
+  },
+});
+
+const { multipleSelected, supplierId, singleSelected } = toRefs(props);
+const productList = ref([]);
+const visible = ref(false);
+const lotId = ref({});
+const loading = ref(false);
+const queryParams = ref({
+});
+const details = ref([])
+const selections = ref([]);
+
+/**
+ * 对话框打开 事件
+ */
+function open(data) {
+  queryParams.value = data
+  details.value = data.details
+  visible.value = true;
+  getList();
+}
+
+/**
+ * 对话框关闭 事件
+ */
+function close() {
+  // proxy.$refs.dialogForm.resetFields();
+  proxy.$refs.dialogTable.clearSelection();
+  visible.value = false;
+}
+
+/**
+ * 加载数据
+ */
+function getList() {
+  loading.value = true;
+  getFurnaceNoInfo({
+    productionPlanNo: queryParams.value.productionPlanNo,
+    lineNumber: queryParams.value.lineNumber
+  }).then((res) => {
+    productList.value = res.data;
+    loading.value = false;
+  });
+}
+
+/**
+ * 列表checkbox列选择 事件
+ */
+function handleSelectionChange(selection) {
+  selections.value = selection;
+}
+
+/**  搜索 事件 */
+function handleSearch() {
+  getList();
+}
+/** 多选事件 */
+function handleMultipleSelected() {
+  if (multipleSelected.value) {
+    multipleSelected.value(selections.value, lotId.value);
+  }
+  close();
+}
+
+function handleSingleSelected(row) {
+  if (singleSelected.value) {
+    singleSelected.value(details.value, row);
+  }
+  close();
+}
+
+defineExpose({
+  open,
+});
+</script>

+ 84 - 0
src/views/business/batchCertificate/HistoryDialog.vue

@@ -0,0 +1,84 @@
+<template>
+  <el-dialog title="历史记录" v-model="visible" width="800px" append-to-body draggable>
+    <el-form ref="dialogForm" class="master-container" :model="queryParams" style="align-items: center;">
+      <div style="display: flex;">
+      </div>
+    </el-form>
+    <el-table v-loading="loading" row-key="deptId" :data="dataList" height="400px">
+      <el-table-column label="行号" type="index" width="50" align="center" />
+      <el-table-column label="生成日期" prop="printDate" width="150" align="center" />
+      <el-table-column label="部门名称" prop="deptName" width="150" align="center" />
+      <el-table-column label="包装线名" prop="packageResourceGroupName" align="center" />
+      <el-table-column label="包装线号" prop="packageLineNo" width="150" align="center" />
+      <el-table-column label="开始编码" prop="startCode" width="150" align="center" />
+      <el-table-column label="结束编码" prop="endCode" width="150" align="center" />
+      <el-table-column label="包装箱号" prop="packageCode" width="150" align="center" />
+      <el-table-column label="包装规格" prop="packageStandard" width="150" align="center" />
+      <el-table-column label="打印时间" prop="printTime" width="150" align="center" />
+    </el-table>
+  </el-dialog>
+</template>
+<script setup>
+import { listCertificate, getDayworkList } from '@/api/business/certificate'
+const emit = defineEmits(['multipleChoice', 'singleChoice'])
+const { proxy } = getCurrentInstance()
+const props = defineProps({
+  multiple: {
+    default: false,
+    type: Boolean
+  }
+})
+
+const { multiple } = toRefs(props)
+
+const loading = ref(false)
+const visible = ref(false)
+
+const dataList = ref([])
+
+/** 设备档案 查询对象 */
+const queryParams = ref({
+})
+/***********************  方法区  ****************************/
+/** 打开抽屉 */
+const open = (data) => {
+  visible.value = true
+  if (data) {
+    queryParams.value = { ...queryParams.value, ...data }
+  }
+  loadData()
+}
+
+const loadData = () => {
+  loading.value = true
+  listCertificate(queryParams.value).then((res) => {
+    dataList.value = res.rows
+    //dataTotal.value = res.total
+    loading.value = false
+  })
+}
+
+const handleRefreshDetail = () => {
+  loadData()
+}
+
+const handleSelectDept = (data) => {
+  if (multiple.value) {
+    emit('multipleChoice', data)
+  }
+  else {
+    emit('singleChoice', data)
+  }
+
+  proxy.$refs.dialogForm.resetFields()
+  visible.value = false
+}
+const handleSearch = () => {
+  loadData()
+}
+
+/** 暴露给父组件的方法 */
+defineExpose({
+  open
+})
+</script>

+ 97 - 0
src/views/business/batchCertificate/PackageLineChoiceDialog.vue

@@ -0,0 +1,97 @@
+<template>
+  <el-dialog title="选择包装线" v-model="visible" width="800px" append-to-body draggable>
+    <el-form ref="dialogForm" class="master-container" :model="queryParams" style="align-items: center;">
+      <div style="display: flex;">
+        <el-form-item label="包装线名称:" prop="name" label-width="100px" style="margin-top: 20px;">
+          <el-input v-model.trim="queryParams.name" type="text" @keydown.enter.prevent style="width: 180px"
+            placeholder="请输入包装线名称" :clearable="true" @keyup.enter="handleSearch" />
+        </el-form-item>
+        <!-- <el-form-item label="部门名称:" prop="deptName" label-width="100px" style="margin-top: 20px;">
+          <el-input v-model.trim="queryParams.deptName" type="text" @keydown.enter.prevent style="width: 180px"
+            placeholder="请输入部门名称" :clearable="true" @keyup.enter="handleSearch" />
+        </el-form-item> -->
+        <el-form-item label-width="20px" style="margin-top: 20px;">
+          <el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
+        </el-form-item>
+      </div>
+    </el-form>
+    <el-table v-loading="loading" row-key="deptId" :data="dataList" height="400px">
+      <el-table-column label="行号" type="index" width="50" align="center" />
+      <el-table-column label="包装线名" prop="name" align="center" />
+      <el-table-column label="包装线号" prop="packageLineNo" width="150" align="center" />
+      <el-table-column label="操作" width="60" align="center">
+        <template #default="scope">
+          <el-button link type="success" icon="Select" @click="handleSelectDept(scope.row)">选择</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+  </el-dialog>
+</template>
+<script setup>
+import { listGroup } from '@/api/business/packageResourceGroup'
+const emit = defineEmits(['multipleChoice', 'singleChoice'])
+const { proxy } = getCurrentInstance()
+const props = defineProps({
+  multiple: {
+    default: false,
+    type: Boolean
+  }
+})
+
+const { multiple } = toRefs(props)
+
+const loading = ref(false)
+const visible = ref(false)
+
+const dataList = ref([])
+
+/** 设备档案 查询对象 */
+const queryParams = ref({
+  type: 0,
+  deptName: '',
+  deptCode: '',
+  isWorkSection: 1
+})
+/***********************  方法区  ****************************/
+/** 打开抽屉 */
+const open = (data) => {
+  visible.value = true
+  if (data) {
+    queryParams.value = { ...queryParams.value, ...data }
+  }
+  loadData()
+}
+
+const loadData = () => {
+  loading.value = true
+  listGroup(queryParams.value).then((res) => {
+    dataList.value = res.rows
+    //dataTotal.value = res.total
+    loading.value = false
+  })
+}
+
+const handleRefreshDetail = () => {
+  loadData()
+}
+
+const handleSelectDept = (data) => {
+  if (multiple.value) {
+    emit('multipleChoice', data)
+  }
+  else {
+    emit('singleChoice', data)
+  }
+
+  proxy.$refs.dialogForm.resetFields()
+  visible.value = false
+}
+const handleSearch = () => {
+  loadData()
+}
+
+/** 暴露给父组件的方法 */
+defineExpose({
+  open
+})
+</script>

+ 99 - 0
src/views/business/batchCertificate/PackageTypeChoiceDialog.vue

@@ -0,0 +1,99 @@
+<template>
+  <el-dialog title="选择包装" v-model="visible" width="800px" append-to-body draggable>
+    <el-form ref="dialogForm" class="master-container" :model="queryParams" style="align-items: center;">
+      <div style="display: flex;">
+        <el-form-item label="包装编码:" prop="packageCode" label-width="100px" style="margin-top: 20px;">
+          <el-input v-model.trim="queryParams.packageCode" type="text" @keydown.enter.prevent style="width: 180px"
+            placeholder="请输入包装编码" :clearable="true" @keyup.enter="handleSearch" />
+        </el-form-item>
+        <!-- <el-form-item label="部门名称:" prop="deptName" label-width="100px" style="margin-top: 20px;">
+          <el-input v-model.trim="queryParams.deptName" type="text" @keydown.enter.prevent style="width: 180px"
+            placeholder="请输入部门名称" :clearable="true" @keyup.enter="handleSearch" />
+        </el-form-item> -->
+        <el-form-item label-width="20px" style="margin-top: 20px;">
+          <el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
+        </el-form-item>
+      </div>
+    </el-form>
+    <el-table v-loading="loading" row-key="deptId" :data="dataList" height="400px">
+      <el-table-column label="行号" type="index" width="50" align="center" />
+      <el-table-column label="包装编码" prop="packageCode" align="center" />
+      <el-table-column label="包装箱号" prop="packageNo" width="150" align="center" />
+      <el-table-column label="包装形式码" prop="packageTypeCode" width="150" align="center" />
+      <el-table-column label="包装尺寸" prop="packageStandard" width="150" align="center" />
+      <el-table-column label="操作" width="60" align="center">
+        <template #default="scope">
+          <el-button link type="success" icon="Select" @click="handleSelectDept(scope.row)">选择</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+  </el-dialog>
+</template>
+<script setup>
+import { listProductPackage } from '@/api/business/productPackage'
+const emit = defineEmits(['multipleChoice', 'singleChoice'])
+const { proxy } = getCurrentInstance()
+const props = defineProps({
+  multiple: {
+    default: false,
+    type: Boolean
+  }
+})
+
+const { multiple } = toRefs(props)
+
+const loading = ref(false)
+const visible = ref(false)
+
+const dataList = ref([])
+
+/** 设备档案 查询对象 */
+const queryParams = ref({
+  type: 0,
+  deptName: '',
+  deptCode: '',
+  isWorkSection: 1
+})
+/***********************  方法区  ****************************/
+/** 打开抽屉 */
+const open = (data) => {
+  visible.value = true
+  if (data) {
+    queryParams.value = { ...queryParams.value, ...data }
+  }
+  loadData()
+}
+
+const loadData = () => {
+  loading.value = true
+  listProductPackage(queryParams.value).then((res) => {
+    dataList.value = res.rows
+    //dataTotal.value = res.total
+    loading.value = false
+  })
+}
+
+const handleRefreshDetail = () => {
+  loadData()
+}
+
+const handleSelectDept = (data) => {
+  if (multiple.value) {
+    emit('multipleChoice', data)
+  }
+  else {
+    emit('singleChoice', data)
+  }
+
+  proxy.$refs.dialogForm.resetFields()
+  visible.value = false
+}
+const handleSearch = () => {
+  loadData()
+}
+
+/** 暴露给父组件的方法 */
+defineExpose({
+  open
+})
+</script>

+ 69 - 0
src/views/business/batchCertificate/companyDialog.vue

@@ -0,0 +1,69 @@
+<template>
+  <el-dialog title="客户简称表单" v-model="visible" width="400px" append-to-body draggable>
+    <div class="form-container">
+      <el-form ref="carrierCategoryRef" v-loading="loading" class="master-container" :model="form" :rules="rules"
+        label-width="80px">
+        <el-form-item label="客户简称" prop="name">
+          <el-input v-model.trim="form.name" maxlength="20"
+          show-word-limit placeholder="客户简称" />
+        </el-form-item>
+      </el-form>
+    </div>
+    <template #footer>
+      <el-button type="primary" icon="Check" @click="handleSave">确 定</el-button>
+      <el-button icon="Close" @click="handleCancel">取 消</el-button>
+    </template>
+  </el-dialog>
+</template>
+<script setup>
+const { proxy } = getCurrentInstance();
+const emit = defineEmits(["inputSuccess"]);
+
+const visible = ref(false);
+const data = reactive({
+  form: {},
+  rules: {
+    name: [{ required: true, message: "客户简称不能为空", trigger: "blur" }],
+  },
+});
+const { form, rules } = toRefs(data);
+
+/***********************  方法区  ****************************/
+/** 打开抽屉 */
+function open(data) {
+  reset();
+  visible.value = true;
+ form.value.name = data
+}
+
+/** 取消按钮 */
+function handleCancel() {
+  visible.value = false;
+  reset();
+}
+
+/** 表单重置 */
+function reset() {
+  form.value = {
+    name: "",
+  };
+  proxy.resetForm("companyRef");
+}
+
+/** 提交按钮 */
+function handleSave() {
+  proxy.$refs["carrierCategoryRef"].validate((valid) => {
+    if (valid) {
+       emit("inputSuccess",form.value.name);
+        visible.value = false;
+    }
+  })
+ 
+}
+
+
+/** 暴露给父组件的方法 */
+defineExpose({
+  open,
+});
+</script>

+ 405 - 0
src/views/business/batchCertificate/index.vue

@@ -0,0 +1,405 @@
+<template>
+  <div class="page-container row-container">
+    <section class="list-part-container" style="flex: 2">
+      <!-- 搜索区域 -->
+      <el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true">
+        <el-form-item class="section-title" label="合格证批量导出" />
+        <el-form-item label="批次号:">
+          <el-input placeholder="请输入批次号" v-model.trim="queryParams.lotCode" @keydown.enter.prevent clearable
+            style="width: 200px" />
+        </el-form-item>
+        <el-form-item label="炉号:">
+          <el-input placeholder="请输入炉号" v-model.trim="queryParams.furnaceNumber" @keydown.enter.prevent clearable
+            style="width: 200px" />
+        </el-form-item>
+        <el-form-item label="产品描述:">
+          <el-input placeholder="请输入产品描述" v-model.trim="queryParams.productDescription" @keydown.enter.prevent clearable
+            style="width: 200px" />
+        </el-form-item>
+        <el-form-item label="包装线:">
+          <el-select placeholder="请选择包装线" v-model.trim="queryParams.packageResourceGroupId" @keydown.enter.prevent
+            clearable style="width: 200px">
+            <el-option v-for="item in packageLineList" :key="item.id" :label="item.name" :value="item.id" />
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" @click="handleQuery">搜索</el-button>
+          <el-button type="primary" :disabled="selections.length == 0" @click="handleExport">导出</el-button>
+          <!-- <el-button type="primary" @click="getInfoFromP2">拉取包装信息</el-button> -->
+        </el-form-item>
+      </el-form>
+      <!-- 列表区域 -->
+      <div class="el-table-container">
+        <div class="el-table-inner-container">
+          <el-table ref="certificateTable" v-loading="loading" row-key="id" @row-click="handleRow"
+            :data="certificateList" height="100%" @selection-change="handleSelectionChange">
+            <el-table-column type="selection" width="55" align="center" />"
+            <el-table-column label="行号" type="index" width="80" align="center" />
+            <el-table-column label="批次号" prop="lotCode" align="center" width="120"/>
+            <el-table-column label="产品描述" prop="productDescription" align="center" width="250" />
+            <el-table-column label="生产工段" prop="certificate.deptName" align="center" width="230" >
+              <template #default="scope">
+                <el-input readonly :disabled="scope.row.certificate.generateTime != null" v-model="scope.row.certificate.deptName" placeholder=""
+                  style="width: 210px">
+                  <template #append>
+                    <el-button :disabled="scope.row.certificategenerateTime != null" icon="Search"
+                      @click="showDeptChoiceDialog(scope.row)"></el-button>
+                  </template>
+                </el-input>
+              </template>
+            </el-table-column>
+            <el-table-column label="包装线号" prop="certificate.packageLineNo" align="center" width="230" >
+              <template #default="scope">
+                <el-input readonly :disabled="scope.row.certificate.generateTime != null" v-model="scope.row.certificate.packageLineNo" placeholder=""
+                  style="width: 210px">
+                  <template #append>
+                    <el-button :disabled="scope.row.certificate.generateTime != null" icon="Search"
+                      @click="showLineChoiceDialog(scope.row)"></el-button>
+                  </template>
+                </el-input>
+              </template>
+            </el-table-column>
+            <el-table-column label="包装箱号" prop="certificate.packageNo" align="center" width="230" >
+              <template #default="scope">
+                <el-input readonly :disabled="scope.row.certificate.generateTime != null" v-model="scope.row.certificate.packageNo" placeholder=""
+                  style="width: 210px">
+                  <template #append>
+                    <el-button :disabled="scope.row.certificate.generateTime != null" icon="Search"
+                      @click="showPackageChoiceDialog(scope.row)"></el-button>
+                  </template>
+                </el-input>
+              </template>
+            </el-table-column>
+            <el-table-column label="包装数量" prop="certificate.number" align="center" width="100" >
+              <template #header>
+      <div style="display: flex; align-items: center; justify-content: center;">
+        包装数量
+        <el-tooltip
+          style="margin-left: 10px;"
+          effect="dark"
+          content="包装数量=批次数量+零取数量-零存数量"
+          placement="top"
+        >
+          <el-icon>
+            <InfoFilled />
+          </el-icon>
+        </el-tooltip>
+      </div>
+    </template>
+            </el-table-column>
+            <el-table-column label="标签数量" prop="certificate.labelNumber" align="center" width="130" >
+              <template #default="scope">
+                <el-input-number :disabled="scope.row.certificate.generateTime != null" v-model="scope.row.certificate.labelNumber" :step="1"
+                  step-strictly :controls="false" @change="handleLabelNumberChange(scope.row)" style="width: 100px" />
+              </template>
+            </el-table-column>
+            <el-table-column label="打印份数" prop="certificate.printPages" align="center" width="130" >
+              <template #default="scope">
+                <el-input :disabled="scope.row.certificate.generateTime != null" v-model="scope.row.certificate.printPages" style="width: 100px" />
+              </template>
+            </el-table-column>
+            <el-table-column label="包装日期" prop="certificate.printDate" align="center" width="170" >
+              <template #default="scope">
+                <el-date-picker :disabled="scope.row.certificate.generateTime != null" v-model="scope.row.certificate.printDate" value-format="YYYY-MM-DD"
+                style="width: 150px" :clearable="false" />
+              </template>
+            </el-table-column>
+            <el-table-column label="客户简称" prop="certificate.companyName" align="center" width="230" >
+              <template #default="scope">
+                <el-input disabled v-model="scope.row.certificate.companyName" placeholder="" style="width: 210px"> <template #append>
+                    <el-button :disabled="scope.row.certificate.generateTime != null" icon="Edit"
+                      @click="showCompanyNameDialog(scope.row)"></el-button>
+                  </template></el-input>
+              </template>
+            </el-table-column>
+            <el-table-column label="采购订单号" prop="certificate.purchaseOrderNo" align="center" width="230" >
+              <template #default="scope">
+                <el-input :disabled="scope.row.certificate.generateTime != null" v-model="scope.row.certificate.purchaseOrderNo" style="width: 210px" />
+              </template>
+            </el-table-column>
+            <el-table-column label="炉号" prop="certificate.furnaceNumber" align="center" width="230" >
+              <template #default="scope">
+                <el-input disabled v-model="scope.row.certificate.furnaceNumber" placeholder="" style="width: 210px"> <template #append>
+                    <el-button :disabled="scope.row.certificate.generateTime != null" icon="Edit"
+                      @click="showFurnaceNumberDialog(scope.row)"></el-button>
+                  </template></el-input>
+              </template>
+            </el-table-column>
+            <el-table-column label="包装尺寸" prop="certificate.packageStandard" align="center" width="200" >
+            </el-table-column>
+            <el-table-column label="包装形式码" prop="certificate.packageTypeCode" align="center" width="200" >
+            </el-table-column>        
+            <el-table-column label="创建时间" prop="submitTime" align="center" width="150" />
+            <el-table-column label="打印次数" prop="printCount" align="center" />
+            <el-table-column label="操作" fixed="right" align="center" width="250">
+              <template #default="scope">
+                <el-button type="primary" :disabled="scope.row.certificate.generateTime != null" @click="handleGenerate(scope.row)">保存并生成</el-button>
+                <el-button type="primary" @click="handleHistory(scope.row)">历史记录</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </div>
+      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
+        v-model:limit="queryParams.pageSize" @pagination="getList" />
+    </section>
+    <DeptChoiceDialog ref="deptChoiceDialogRef" @handleSelectBelongingDept="handleDeptChoice" />
+    <PackageLineChoiceDialog ref="packageLineChoiceDialogRef" @singleChoice="handlePackageLineChoice" />
+    <PackageTypeChoiceDialog ref="packageTypeChoiceDialogRef" @singleChoice="handlePackageTypeChoice" />
+    <DialogFurnaceNoInfo ref="dialogFurnaceNoInfoRef" @singleChoice="handleFurnaceNoInfo" />
+    <companyDialog ref="companyDialogRef" @inputSuccess="handleCompanySuccess" />
+    <HistoryDialog ref="historyDialogRef" />
+  </div>
+</template>
+
+<script setup name="Equipment">
+import { getBatchCertificateList, generateQrCode,exportCertificate } from "@/api/business/certificate";
+import { listGroup } from "@/api/business/packageResourceGroup";
+import {
+  getP2Accessories,
+  getP2CompanyProductPackage,
+  setP2Certificate
+} from "@/api/business/p2.js";
+import { getToken } from "@/utils/auth";
+import DeptChoiceDialog from "./DeptChoiceDialog.vue";
+import PackageLineChoiceDialog from "./PackageLineChoiceDialog.vue";
+import PackageTypeChoiceDialog from "./PackageTypeChoiceDialog.vue";
+import DialogFurnaceNoInfo from "./DialogFurnaceNoInfo.vue";
+import companyDialog from "./companyDialog.vue";
+import HistoryDialog from "./HistoryDialog.vue";
+import { ElLoading } from "element-plus";
+const { proxy } = getCurrentInstance();
+/**字典数组 */
+/** 设备档案管理 */
+const selections = ref([]);
+const certificateTable = ref(null);
+const total = ref(0);
+const sealItem = ref({});
+const certificateList = ref([]);
+const loading = ref(false);
+const ids = ref([]);
+const historyDialogRef = ref(null);
+const packageLineList = ref([]);
+const deptChoiceDialogRef = ref(null);
+const packageLineChoiceDialogRef = ref(null);
+const packageTypeChoiceDialogRef = ref(null);
+/** 设备档案 查询对象 */
+const queryParams = ref({
+  pageNum: 1,
+  pageSize: 10,
+});
+const form = ref({});
+const formLoading = ref(false);
+let previousDeptId = 0;
+
+onMounted(() => {
+  getList();
+  getPackageLine();
+  getInfoFromP2();
+});
+
+const getPackageLine = () => {
+  listGroup({}).then((res) => {
+    if (res.code == 200) {
+      packageLineList.value = res.rows;
+    }
+  });
+};
+
+/** 获取设备档案列表 */
+const getList = () => {
+  loading.value = true
+  getBatchCertificateList(queryParams.value).then((res) => {
+    if (res.code == 200) {
+      certificateList.value = res.rows;
+      if (certificateList.value.length > 0) {
+        handleRow(certificateList.value[0]);
+      }
+      total.value = res.total;
+    }
+    loading.value = false
+  }).catch(e => {
+    loading.value = false
+  });
+};
+
+function handleRow(row) {
+  sealItem.value = row;
+}
+function showDeptChoiceDialog(row) {
+  previousDeptId = row.certificate.deptId;
+  deptChoiceDialogRef.value.open();
+}
+function showLineChoiceDialog(row) {
+  if (row.certificate.deptId) {
+    packageLineChoiceDialogRef.value.open({ deptId: row.certificate.deptId });
+  } else {
+    proxy.$modal.msgError("请先选择生产工段");
+  }
+}
+function showPackageChoiceDialog(row) {
+  packageTypeChoiceDialogRef.value.open({
+    productId: row.certificate.productId,
+    companyId:row.certificate.companyId,
+  });
+}
+function handleLabelNumberChange(row) {
+ row.certificate.printPages =
+    Number.isNaN(row.certificate.number) || Number.isNaN(row.certificate.labelNumber)
+      ? 0
+      : Math.floor(row.certificate.number / row.certificate.labelNumber);
+}
+function showCompanyNameDialog(row) {
+  proxy.$refs.companyDialogRef.open(row.certificate.companyName);
+}
+function showFurnaceNumberDialog(row){
+  proxy.$refs.dialogFurnaceNoInfoRef.open({productionPlanNo:row.certificate.productionPlanNo,lineNumber:row.certificate.lineNumber})
+}
+function handleDeptChoice(item) {
+  let index = certificateList.value.findIndex(item=>item.id == sealItem.value.id)
+  certificateList.value[index].certificate.deptName = item.deptName;
+  certificateList.value[index].certificate.deptId = item.deptId;
+  if (previousDeptId != certificateList.value[index].certificate.deptId) {
+    certificateList.value[index].certificate.deptNo = null;
+    certificateList.value[index].certificate.packageLineNo = null;
+    certificateList.value[index].certificate.year = null;
+    certificateList.value[index].certificate.packageResourceGroupId = null;
+    certificateList.value[index].certificate.packageResourceGroupName = null;
+  }
+}
+function handlePackageLineChoice(item) {
+  let index = certificateList.value.findIndex(item=>item.id == sealItem.value.id)
+  certificateList.value[index].certificate.deptNo = item.deptNo;
+  certificateList.value[index].certificate.packageLineNo = item.packageLineNo;
+  certificateList.value[index].certificate.year = item.year;
+  certificateList.value[index].certificate.packageResourceGroupId = item.id;
+  certificateList.value[index].certificate.packageResourceGroupName = item.name;
+}
+function handlePackageTypeChoice(item) {
+  let index = certificateList.value.findIndex(item=>item.id == sealItem.value.id)
+  certificateList.value[index].certificate.packageCode = item.packageCode;
+  certificateList.value[index].certificate.packageStandard = item.packageStandard;
+  certificateList.value[index].certificate.packageId = item.accessoriesId;
+  certificateList.value[index].certificate.packageTypeCode = item.packageTypeCode;
+}
+function handleCompanySuccess(data) {
+  let index = certificateList.value.findIndex(item=>item.id == sealItem.value.id)
+  certificateList.value[index].certificate.companyName = data;
+}
+/**
+ * 列表checkbox列选择 事件
+ */
+function handleSelectionChange(selection) {
+  selections.value = selection
+  ids.value = selections.value.map((item) => item.certificate.id);
+}
+async function handleExport(){
+  let index = selections.value.findIndex(item=>item.certificate.generateTime == null)
+  if(index != -1){
+    proxy.$modal.msgError("批次"+selections.value[index].certificate.lotCode+"未保存并生成条码")
+    return
+  }
+  console.log(selections.value)
+  await exportCertificate({ ids: ids.value });
+        proxy.$modal.msgSuccess("导出成功");
+        getList();
+}
+function handleHistory(row) {
+  historyDialogRef.value.open({ dayworkId: row.id });
+}
+
+function handleQuery() {
+  getList();
+}
+function handleGenerate(row){
+  if(row.certificate.generateTime != null){
+    return
+  }
+  let index = certificateList.value.findIndex(item=>item.id == row.id)
+  // 生成判断
+  if (row.certificate.deptId == null) {
+    proxy.$modal.msgError("请先选择生产工段");
+    return;
+  }
+  if (row.certificate.packageLineNo == null) {
+    proxy.$modal.msgError("请先选择包装线号");
+    return;
+  }
+  if (row.certificate.labelNumber == null) {
+    proxy.$modal.msgError("请填写标签数量");
+    return;
+  }
+  if (row.certificate.printPages == null || row.certificate.printPages == 0) {
+    proxy.$modal.msgError("请填写打印份数");
+    return;
+  }
+  if (row.certificate.packageId == null) {
+    proxy.$modal.msgError("请先选择包装");
+    return;
+  }
+  const loading = ElLoading.service({
+    lock: true,
+  });
+  generateQrCode(row.certificate).then((res) => {
+    loading.close();
+    if (res.code === 200) {
+      certificateList.value[index].certificate = res.data;
+      proxy.$modal.msgSuccess("生成成功");
+      //向P2保存
+      setP2Certificate({ id:res.data.id });
+    } else {
+      proxy.$modal.msgError("生成失败");
+    }
+  });
+  console.log("保存");
+}
+
+function getInfoFromP2() {
+  proxy.$modal.loading("正在拉取数据,请稍后...");
+  getP2Accessories()
+    .then((res) => {
+      if (res.code === 200) {
+        getP2CompanyProductPackage()
+          .then((res) => {
+            if (res.code === 200) {
+              proxy.$modal.closeLoading();
+              // proxy.$modal.msgSuccess("拉取成功")
+            } else {
+              proxy.$modal.closeLoading();
+              // proxy.$modal.msgError("拉取失败")
+            }
+          })
+          .catch((err) => {
+            proxy.$modal.closeLoading();
+            // proxy.$modal.msgError("拉取失败")
+          });
+      } else {
+        proxy.$modal.closeLoading();
+        // proxy.$modal.msgError("拉取失败")
+      }
+    })
+    .catch((err) => {
+      proxy.$modal.closeLoading();
+      // proxy.$modal.msgError("拉取失败")
+    });
+}
+</script>
+<style scoped>
+:deep(.el-tree-node__label) {
+  font-size: 14px !important;
+  display: inline-block;
+  width: 100%;
+}
+
+:deep(.el-tree-node__content) {
+  height: 40px;
+  border-bottom: 1px solid #ebeef5;
+  padding: 8px 0;
+  line-height: 23px;
+}
+
+.move-handle {
+  cursor: move;
+  background-color: #eee;
+}
+</style>