|
@@ -6,7 +6,7 @@
|
|
|
<div class="text">选择统计时间段:</div>
|
|
|
<div style="display: flex">
|
|
|
<el-date-picker
|
|
|
- v-model="value1"
|
|
|
+ v-model="searchTime"
|
|
|
type="daterange"
|
|
|
range-separator="-"
|
|
|
start-placeholder="起始时间"
|
|
@@ -17,7 +17,7 @@
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="header">
|
|
|
+<!-- <div class="header">
|
|
|
<div class="text">选择统计维度:</div>
|
|
|
<div>
|
|
|
<el-radio-group v-model="radio" style="display: flex">
|
|
@@ -27,7 +27,7 @@
|
|
|
<el-radio size="small" :value="4">年</el-radio>
|
|
|
</el-radio-group>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </div>-->
|
|
|
<div class="header">
|
|
|
<div class="text">选择统计车间:</div>
|
|
|
<el-tree
|
|
@@ -35,7 +35,6 @@
|
|
|
:data="statProductionLineData"
|
|
|
show-checkbox
|
|
|
default-expand-all
|
|
|
- :default-checked-keys="['line']"
|
|
|
node-key="key"
|
|
|
/>
|
|
|
</div>
|
|
@@ -71,12 +70,15 @@
|
|
|
<div class="box">
|
|
|
<div class="boxheader">
|
|
|
<div>
|
|
|
- <el-button type="primary" class="btn" @click="getTableDataSearch"
|
|
|
+ <el-button type="primary" class="btn" @click="getTableData"
|
|
|
>统计查询</el-button
|
|
|
>
|
|
|
<el-button class="btn" @click="reset">重置</el-button>
|
|
|
</div>
|
|
|
- <el-button class="btn" @click="exportFnc">导出</el-button>
|
|
|
+
|
|
|
+ <el-button class="ml-3" @click="exportData('/api/v1/quality/stat/export')">
|
|
|
+ <template #icon> <i-ep-download /> </template>导出
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
<div class="info">
|
|
|
<el-table
|
|
@@ -100,13 +102,14 @@
|
|
|
prop="operationName"
|
|
|
label="工序名称"
|
|
|
/> -->
|
|
|
- <el-table-column prop="productLineName" label="车间名称" />
|
|
|
- <el-table-column prop="productName" label="产品名称" />
|
|
|
- <el-table-column prop="productCode" label="产品编码" />
|
|
|
- <el-table-column prop="batchNo" label="产品批次" />
|
|
|
- <el-table-column prop="goodRate" label="良率" />
|
|
|
- <el-table-column prop="badRate" label="不良率" />
|
|
|
- <el-table-column prop="timeStr" label="日期" />
|
|
|
+ <el-table-column prop="workshopName" label="车间名称" />
|
|
|
+ <el-table-column prop="materialName" label="产品名称" />
|
|
|
+ <el-table-column prop="materialCode" label="产品编码" />
|
|
|
+ <el-table-column prop="materialModel" label="产品规格" />
|
|
|
+ <el-table-column prop="workOrderCode" label="产品批次" />
|
|
|
+ <el-table-column prop="qualified" label="良率" />
|
|
|
+ <el-table-column prop="noQualified" label="不良率" />
|
|
|
+ <el-table-column prop="updated" label="日期" />
|
|
|
</el-table>
|
|
|
</div>
|
|
|
<div class="footer">
|
|
@@ -123,64 +126,35 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <el-dialog title="选择统计产品" v-model="dialogVisible" width="60%" center>
|
|
|
- <div>
|
|
|
- <Search :searchOptions="searchForm" ref="searchRef" />
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <el-table
|
|
|
- :data="tableProdtData"
|
|
|
- row-key="id"
|
|
|
- border
|
|
|
- @selection-change="handleSelectionChange"
|
|
|
- >
|
|
|
- <el-table-column type="selection" width="55" />
|
|
|
- <el-table-column prop="productLineName" label="车间名称" />
|
|
|
- <el-table-column prop="productName" label="产品名称" />
|
|
|
- <el-table-column prop="productCode" label="产品编码" />
|
|
|
- <el-table-column prop="batchNo" label="产品批次" />
|
|
|
- <el-table-column prop="productType" label="产品类型" />
|
|
|
- <el-table-column prop="timeStr" label="创建日期" />
|
|
|
- </el-table>
|
|
|
- <Pagination
|
|
|
- :total="currentProdtOption.total"
|
|
|
- :page="currentProdtOption.page"
|
|
|
- :limit="currentProdtOption.limit"
|
|
|
- :pageSizes="currentProdtOption.pageSizes"
|
|
|
- v-model:page="currentProdtOption.page"
|
|
|
- v-model:limit="currentProdtOption.limit"
|
|
|
- @pagination="getProdtData"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <el-button type="primary" class="btn" @click="handleConfirm"
|
|
|
- >确定</el-button
|
|
|
- >
|
|
|
- <el-button class="btn" @click="dialogVisible = false">取消</el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
+
|
|
|
+ <CrudTable
|
|
|
+ ref="ctableRef"
|
|
|
+ tableTitle="选择统计产品"
|
|
|
+ :multipleRow="multipleRow"
|
|
|
+ tableType="WORK_ORDER"
|
|
|
+ @selected-sure="handleConfirm"
|
|
|
+ />
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { getData, getStatLevel, getExport } from "@/api/statistic";
|
|
|
+import {getData, getStatLevel, getExport} from "@/api/statistic";
|
|
|
import { getMockData } from "@/api/statistic/firstPassYieldMockData";
|
|
|
import Pagination from "@/components/Pagination/index.vue";
|
|
|
import { downFile } from "@/utils/common";
|
|
|
import Search from "@/components/Search/index.vue";
|
|
|
-
|
|
|
+import {getWorkOrderInfo, getWorkShop} from "@/api/statistic/firstPassYieldData";
|
|
|
+import {useCrud} from "@/hooks/userCrud";
|
|
|
+const checkList=ref(null);
|
|
|
+const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
|
|
|
+ useCrud({
|
|
|
+ src: "/api/v1/quality/stat",
|
|
|
+ });
|
|
|
+const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
|
|
|
defineOptions({
|
|
|
name: "Dashboard",
|
|
|
inheritAttrs: false,
|
|
|
});
|
|
|
-const exportFnc = async () => {
|
|
|
- await getExport({
|
|
|
- endTime: value1.value ? value1.value[1] : "",
|
|
|
- startTime: value1.value ? value1.value[0] : "",
|
|
|
- queryTypes: getValue(treeRef1.value.getCheckedNodes()),
|
|
|
- queryIndex: getValue(treeRef2.value.getCheckedNodes()),
|
|
|
- timeType: radio.value,
|
|
|
- }).then((res) => downFile(res));
|
|
|
-};
|
|
|
+const ctableRef=ref(null);
|
|
|
const treeRef1 = ref(null);
|
|
|
const treeRef2 = ref(null);
|
|
|
const currentOption = ref({
|
|
@@ -193,7 +167,6 @@ const currentOption = ref({
|
|
|
const maxHeight = ref(null);
|
|
|
const maxWidth = ref(null);
|
|
|
|
|
|
-const value1 = ref(null);
|
|
|
const radio = ref(1);
|
|
|
const tableData = ref([]);
|
|
|
|
|
@@ -225,11 +198,10 @@ const getCurrentMonthStartAndEndDates = () => {
|
|
|
const getValue = (array) => {
|
|
|
let resarray = [];
|
|
|
for (let i = 0; i < array.length; i++) {
|
|
|
- resarray.push(array[i].value);
|
|
|
+ resarray.push(array[i].label);
|
|
|
}
|
|
|
return resarray;
|
|
|
};
|
|
|
-const queryIndexs = ref([]);
|
|
|
// const getTableData = async () => {
|
|
|
// queryIndexs.value = getValue(treeRef1.value.getCheckedNodes());
|
|
|
// const { data } = await getData({
|
|
@@ -247,45 +219,49 @@ const queryIndexs = ref([]);
|
|
|
|
|
|
// mock数据
|
|
|
const getTableData = async () => {
|
|
|
- queryIndexs.value = getValue(treeRef1.value.getCheckedNodes());
|
|
|
- const { data } = await getMockData({
|
|
|
- page: currentOption.value.page,
|
|
|
- limit: currentOption.value.limit,
|
|
|
+ search.value={};
|
|
|
+ const { data } = await getWorkOrderInfo({
|
|
|
+ pageNo: currentOption.value.page,
|
|
|
+ pageSize: currentOption.value.limit,
|
|
|
+ endTime: searchTime.value ? searchTime.value[1] : "",
|
|
|
+ startTime: searchTime.value ? searchTime.value[0] : "",
|
|
|
+ queryTypes: getValue(treeRef1.value.getCheckedNodes()),
|
|
|
+ queryIndex: workOrderCodes.value,
|
|
|
}); // 使用假数据函数
|
|
|
+ search.value.startTime=searchTime.value ? searchTime.value[0] : "",
|
|
|
+ search.value.endTime=searchTime.value ? searchTime.value[1] : "",
|
|
|
+ search.value.queryTypes=getValue(treeRef1.value.getCheckedNodes()),
|
|
|
+ search.value.queryIndex=workOrderCodes.value,
|
|
|
tableData.value = data.records;
|
|
|
currentOption.value.total = data.totalCount;
|
|
|
};
|
|
|
// -------
|
|
|
|
|
|
-const reset = () => {
|
|
|
- value1.value = getCurrentMonthStartAndEndDates();
|
|
|
+const reset = () => {searchTime.value = getCurrentMonthStartAndEndDates();
|
|
|
// treeRef1.value.setCheckedKeys([statProductionLineData[0].key], true, true);
|
|
|
// treeRef2.value.setCheckedKeys([statProductTypeData[0].key], true, true);
|
|
|
- radio.value = 1;
|
|
|
currentOption.value.page = 1;
|
|
|
- treeData.value = [];
|
|
|
- selectedRows.value = [];
|
|
|
- tableData.value = [];
|
|
|
+ workOrderCodes.value = [];
|
|
|
+ treeRef1.value.setCheckedNodes([]);
|
|
|
getTableData();
|
|
|
};
|
|
|
|
|
|
// mock数据
|
|
|
const statProductionLineData = ref([
|
|
|
- {
|
|
|
- key: "line",
|
|
|
- label: "微电子车间",
|
|
|
- children: [],
|
|
|
- },
|
|
|
]);
|
|
|
|
|
|
const tableProdtData = ref([]);
|
|
|
const dialogVisible = ref(false);
|
|
|
const searchRef = ref(null);
|
|
|
+const searchTime =ref(null);
|
|
|
const openProdtForm = async () => {
|
|
|
- dialogVisible.value = true;
|
|
|
- getProdtData();
|
|
|
+ ctableRef.value.startSelect();
|
|
|
+ ctableRef.value?.mergeOption({
|
|
|
+ selection: true,
|
|
|
+ reserveSelection: true,
|
|
|
+ });
|
|
|
};
|
|
|
-
|
|
|
+const multipleRow = ref(true);
|
|
|
const getProdtData = async () => {
|
|
|
const { data } = await getMockData({
|
|
|
page: currentProdtOption.value.page,
|
|
@@ -294,33 +270,7 @@ const getProdtData = async () => {
|
|
|
tableProdtData.value = data.records;
|
|
|
currentProdtOption.value.total = data.totalCount;
|
|
|
};
|
|
|
-const searchForm = [
|
|
|
- {
|
|
|
- label: "产品名称",
|
|
|
- type: "input",
|
|
|
- key: "prodtName",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "产品编码",
|
|
|
- type: "input",
|
|
|
- key: "prodtCode",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "产品类型",
|
|
|
- type: "select",
|
|
|
- key: "prodtType",
|
|
|
- options: [
|
|
|
- {
|
|
|
- label: "类型1",
|
|
|
- value: "1",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "类型2",
|
|
|
- value: "2",
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
-];
|
|
|
+
|
|
|
|
|
|
const currentProdtOption = ref({
|
|
|
total: 0,
|
|
@@ -329,63 +279,48 @@ const currentProdtOption = ref({
|
|
|
pageSizes: [10, 20, 30, 40, 50, 100],
|
|
|
});
|
|
|
// --------------------------------------------
|
|
|
-const statProductTypeData = ref([
|
|
|
- {
|
|
|
- key: "id",
|
|
|
- label: "产品类型",
|
|
|
- children: [
|
|
|
- {
|
|
|
- key: "productType1",
|
|
|
- label: "类型1",
|
|
|
- },
|
|
|
- {
|
|
|
- key: "productType2",
|
|
|
- label: "类型2",
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
-]);
|
|
|
+
|
|
|
const selectedRows = ref([]); // 存储选中的行数据
|
|
|
|
|
|
-const handleSelectionChange = (rows) => {
|
|
|
- selectedRows.value = rows; // 更新选中的行数据
|
|
|
-};
|
|
|
|
|
|
const treeData = ref([]); // 存储转换后的 el-tree 数据
|
|
|
-const handleConfirm = () => {
|
|
|
+
|
|
|
+const workOrderCodes = ref([]);
|
|
|
+const handleConfirm = (val) => {
|
|
|
const map = {};
|
|
|
const tree = [];
|
|
|
-
|
|
|
- selectedRows.value.forEach((row) => {
|
|
|
- const { productName, batchNo } = row;
|
|
|
+ workOrderCodes.value=[];
|
|
|
+ val.forEach((row) => {
|
|
|
+ workOrderCodes.value.push(row.workOrderCode);
|
|
|
+ const { materialName, workOrderCode } = row;
|
|
|
|
|
|
// 如果父级节点不存在,创建父级节点
|
|
|
- if (!map[productName]) {
|
|
|
+ if (!map[materialName]) {
|
|
|
const parentNode = {
|
|
|
- label: productName, // 父级名称
|
|
|
- key: productName, // 父级唯一标识
|
|
|
+ label: materialName, // 父级名称
|
|
|
+ key: materialName, // 父级唯一标识
|
|
|
children: [], // 子级数组
|
|
|
};
|
|
|
- map[productName] = parentNode;
|
|
|
+ map[materialName] = parentNode;
|
|
|
tree.push(parentNode);
|
|
|
}
|
|
|
|
|
|
// 添加子级节点
|
|
|
- map[productName].children.push({
|
|
|
- label: batchNo, // 子级名称
|
|
|
- key: batchNo, // 子级唯一标识
|
|
|
+ map[materialName].children.push({
|
|
|
+ label: workOrderCode, // 子级名称
|
|
|
+ key: workOrderCode, // 子级唯一标识
|
|
|
});
|
|
|
});
|
|
|
|
|
|
treeData.value = tree; // 更新 el-tree 数据源
|
|
|
- dialogVisible.value = false; // 关闭对话框
|
|
|
};
|
|
|
-
|
|
|
+//列表搜索体哦阿健
|
|
|
+const searchPageForm = ref({});
|
|
|
const getTableDataSearch = () => {
|
|
|
- if (treeData.value.length === 0) {
|
|
|
+ /* if (treeData.value.length === 0) {
|
|
|
ElMessage.warning("请选择产品");
|
|
|
return;
|
|
|
- }
|
|
|
+ }*/
|
|
|
// 提取 treeData 中的 productName 和 batchNo
|
|
|
const selectedProductMap = {};
|
|
|
treeData.value.forEach((parent) => {
|
|
@@ -412,11 +347,27 @@ const checkedKeys = computed(() => {
|
|
|
}
|
|
|
return array;
|
|
|
});
|
|
|
+const getWorkShopList=()=>{
|
|
|
+ getWorkShop({}).then(
|
|
|
+ (data)=>{
|
|
|
+ statProductionLineData.value=data.data;
|
|
|
|
|
|
+ }
|
|
|
+ )
|
|
|
+}
|
|
|
+/*const handleCheckChange=(data, checked, indeterminate)=>{
|
|
|
+ console.log("aaaaa",data); // 选中的节点数据
|
|
|
+ console.log(checked); // 是否选中
|
|
|
+ console.log(indeterminate); // 是否为半选状态
|
|
|
+}*/
|
|
|
onMounted(async () => {
|
|
|
+
|
|
|
window.addEventListener("resize", setHeight);
|
|
|
- value1.value = getCurrentMonthStartAndEndDates();
|
|
|
- setHeight();
|
|
|
+ searchTime.value = getCurrentMonthStartAndEndDates();
|
|
|
+ search.value.startTime=searchTime.value[0];
|
|
|
+ search.value.endTime=searchTime.value[1];
|
|
|
+ setHeight();
|
|
|
+ await getWorkShopList();
|
|
|
// await getStatLevelData();
|
|
|
getTableData();
|
|
|
});
|