| | |
| | | <script setup lang="ts"> |
| | | import { ref, onMounted, watch } from 'vue' |
| | | import { ref, onMounted, watch, nextTick } from 'vue' |
| | | import { ElMessage } from 'element-plus' |
| | | import TaskTabs from '@/views/dashboard/components/TaskTabs.vue' |
| | | import CurrentDateTime from '@/views/dashboard/components/CurrentDateTime.vue' |
| | | import { getQualityProcedureApi, getProjectApi, getProductApi, getWorkerApi, updateQualityProcedureApi } from '@/api' |
| | | import { |
| | | getQualityProcedureApi, |
| | | getProjectApi, |
| | | getProductApi, |
| | | getWorkerApi, |
| | | updateQualityProcedureApi, |
| | | qualityCountApi, |
| | | IQualityCountParams |
| | | } from '@/api' |
| | | import BigButton from '@/views/dashboard/components/BigButton.vue' |
| | | import EditInspection from '@/views/newDashboard/components/EditInspection.vue' |
| | | defineOptions({ |
| | |
| | | const qualityList = ref([]) |
| | | const lookQuality = ref({}) |
| | | const oldLookQuality = ref({}) |
| | | const DEFAULT_QUALITY_COUNT = { wait: '--', over: '--', scrapped: '--', pass: '--' } |
| | | const qualityCountObj = ref({ ...DEFAULT_QUALITY_COUNT }) |
| | | const tableHeaderColor = ({ rowIndex }: any) => { |
| | | if (rowIndex === 0) { |
| | | return 'header-row-class' // 这个类名需要你自己定义 |
| | | } |
| | | } |
| | | const changeTab = (tabObj: any) => { |
| | | console.log(tabObj) |
| | | } |
| | | const checkProduct = (quality: any) => { |
| | | lookQuality.value = { ...quality } |
| | |
| | | if (code == 200) { |
| | | ElMessage.success(data) |
| | | queryQualityProcedure() |
| | | queryQualityCount() |
| | | modalObj.value.modalValue = false |
| | | } else { |
| | | ElMessage.error(data) |
| | |
| | | if (Array.isArray(data) && data.length > 0) { |
| | | projectIdArray.value[0] = data[0].id |
| | | queryProduct() |
| | | queryQualityProcedure() |
| | | } |
| | | } |
| | | }) |
| | |
| | | getProductApi({ projectId: projectIdArray.value[0], ...pageData.value }).then(({ code, data }) => { |
| | | if (code == 200) { |
| | | productList.value = data |
| | | if (Array.isArray(data) && data.length > 0) { |
| | | productIdArray.value[0] = data[0].id |
| | | queryQualityProcedure() |
| | | queryQualityCount() |
| | | } |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | } |
| | | if (Array.isArray(productIdArray.value) && productIdArray.value.length > 0) { |
| | | params.productId = productIdArray.value[0] + '' |
| | | } else { |
| | | qualityList.value = [] |
| | | return |
| | | } |
| | | getQualityProcedureApi(params).then(({ code, data }: any) => { |
| | | if (code == 200) { |
| | |
| | | [() => activeTaskTab.value, () => productIdArray.value, () => projectIdArray.value], |
| | | () => { |
| | | queryQualityProcedure() |
| | | queryQualityCount() |
| | | }, |
| | | { immediate: false } |
| | | ) |
| | |
| | | } |
| | | }) |
| | | } |
| | | //6.查询质检数据统计 |
| | | const queryQualityCount = () => { |
| | | const params: IQualityCountParams = { productId: '', projectId: '' } |
| | | if (Array.isArray(projectIdArray.value) && projectIdArray.value.length > 0) { |
| | | params.projectId = projectIdArray.value[0] + '' |
| | | } else { |
| | | qualityCountObj.value = { ...DEFAULT_QUALITY_COUNT } |
| | | return |
| | | } |
| | | if (Array.isArray(productIdArray.value) && productIdArray.value.length > 0) { |
| | | params.productId = productIdArray.value[0] + '' |
| | | } else { |
| | | qualityCountObj.value = { ...DEFAULT_QUALITY_COUNT } |
| | | return |
| | | } |
| | | qualityCountApi(params).then(({ code, data }) => { |
| | | if (code == 200) { |
| | | for (let fieldName in data) { |
| | | if (isNaN(parseInt(data[fieldName]))) { |
| | | data[fieldName] = '--' |
| | | } |
| | | } |
| | | qualityCountObj.value = data |
| | | } |
| | | }) |
| | | } |
| | | //6.初始化页面数据 |
| | | const initPage = () => { |
| | | queryProject() |
| | | //queryQualityProcedure() |
| | | queryWorker() |
| | | } |
| | | onMounted(() => { |
| | |
| | | <div class="img bg1"><img src="@/assets/images/u820.png" /></div> |
| | | <div class="text"> |
| | | <div>待检测</div> |
| | | <div>1</div> |
| | | <div>{{ qualityCountObj.wait }}</div> |
| | | </div> |
| | | </div> |
| | | <div class="item"> |
| | | <div class="img bg2"><img src="@/assets/images/u820.png" /></div> |
| | | <div class="text"> |
| | | <div>完成数</div> |
| | | <div>1</div> |
| | | <div>{{ qualityCountObj.over }}</div> |
| | | </div> |
| | | </div> |
| | | <div class="item"> |
| | | <div class="img bg3"><img src="@/assets/images/u820.png" /></div> |
| | | <div class="text"> |
| | | <div>合格数</div> |
| | | <div class="success-number">1</div> |
| | | <div>合格率</div> |
| | | <div class="success-number"> |
| | | {{ qualityCountObj.pass }} |
| | | <span v-show="!isNaN(parseInt(qualityCountObj.pass))">%</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="item"> |
| | | <div class="img bg4"><img src="@/assets/images/u820.png" /></div> |
| | | <div class="text"> |
| | | <div>报废数</div> |
| | | <div class="fail-number">0</div> |
| | | <div>报废率</div> |
| | | <div class="fail-number"> |
| | | {{ qualityCountObj.scrapped }}<span v-show="!isNaN(parseInt(qualityCountObj.scrapped))">%</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="table-filter"> |
| | | <div class="left"> |
| | | <TaskTabs v-model="activeTaskTab" style="margin-top: 20px" :list="taskTabsList" @change="changeTab"></TaskTabs> |
| | | <TaskTabs v-model="activeTaskTab" style="margin-top: 20px" :list="taskTabsList"></TaskTabs> |
| | | </div> |
| | | <div class="right"> |
| | | <el-select |
| | |
| | | multiple |
| | | placeholder="产品" |
| | | > |
| | | <el-option v-for="item in productList" :key="item.id" :label="item.productName" :value="item.id" multiple> |
| | | <el-option v-for="item in productList" :key="item.id" :label="item.name" :value="item.id" multiple> |
| | | <div class="item-option"> |
| | | <div>{{ item.id }}</div> |
| | | <div>{{ item.productName }}</div> |
| | | <div>{{ item.name }}</div> |
| | | </div> |
| | | </el-option> |
| | | </el-select> |
| | |
| | | <el-table-column prop="passAmount" align="center" label="合格数" /> |
| | | <el-table-column prop="workerName" align="center" label="加工人员" /> |
| | | <el-table-column prop="inspectionPeople" align="center" label="质检员" /> |
| | | <el-table-column prop="procedureId" align="center" label="工序号" /> |
| | | <!--<el-table-column prop="procedureId" align="center" label="工序号" />--> |
| | | <el-table-column fixed="right" align="center" label="操作" width="120px"> |
| | | <template #default="scope"> |
| | | <BigButton bg-color="#00ff00" @click="checkProduct(scope.row)">质检</BigButton> |
| | |
| | | margin-left: 10px; |
| | | } |
| | | .right { |
| | | width: 34%; |
| | | width: 40%; |
| | | display: flex; |
| | | justify-content: space-around; |
| | | margin-top: 2.5vh; |
| | | margin-right: -10px; |
| | | .el-select { |
| | | width: 256px; |
| | | :deep(.el-select__wrapper) { |
| | |
| | | /*);*/ |
| | | } |
| | | :deep(.el-select__popper) { |
| | | width: 100%; |
| | | border: 1px solid #1ca898; |
| | | background: deepskyblue; |
| | | } |
| | |
| | | display: flex; |
| | | flex: 1; |
| | | > div { |
| | | width: 50%; |
| | | min-width: 50%; |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | text-align: center; |
| | | } |
| | | } |