123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417 |
- <template>
- <view class="page-container uni-column">
- <view class="search-container uni-row">
- <input type="text" v-model="quer.keyword" placeholder="请输入关键字" />
- <view class="btn uni-row" @click="getList">搜索</view>
- <!-- <uni-icons type="scan" size="24" /> -->
- </view>
- <view class="time-controls" style="margin-top: 10rpx;">
- <uni-section title="报工日期:" type="square" class="uni-row sta">
- <input v-model="startTime" type="date" @input="timeSizer" />
- <!-- <view>
- <uni-datetime-picker v-model="startTime" type="date" @change="timeSizer"></uni-datetime-picker>
- </view> -->
- </uni-section>
- </view>
- <view class="scan-btn uni-row" style="min-height: 80rpx;" @click.stop="handleAddAuxilaryDaywork">新增辅助工序报工
- </view>
- <view class="daywork-item uni-column" v-for="(item, index) in inspecionList" :key="index"
- @click="handleSelection(item)">
- <view class="lot-code uni-row">
- <text>批次号:{{ item.lotCode }}</text>
- <text :style="selectType(item)">{{ selectText(item) }}</text>
- <!-- <uni-icons type="right" size="16" /> -->
- <!-- item.creatorId === userId && item.status == 0 -->
- <!-- <text v-if="delable(item)" class="fa fa-trash" style="font-size: 16; color: red;"
- @click.stop="deleteItem(item)"></text> -->
- <!-- <text v-else class="fa fa-trash" style="font-size: 16; color: white;"></text> -->
- </view>
- <view class="info">
- <view class="info-row uni-row">
- <view class="label">报工人员:</view>
- <view class="value">{{ item.nickName }}</view>
- </view>
- <view class="info-row uni-row">
- <view class="label">产品描述:</view>
- <view class="value">{{ item.productDescription }}</view>
- </view>
- <view class="info-row uni-row">
- <view class="label">合格数量:</view>
- <view class="value">{{ item.qualifiedNum }}</view>
- <view class="label">废品数量:</view>
- <view class="value">{{ item.rejectNum }}</view>
- </view>
- <view class="info-row uni-row">
- <view class="label">生产工序:</view>
- <view class="value">{{ item.processAlias }}</view>
- <view class="label">辅助工序:</view>
- <view class="value">{{ item.auxiliaryProcessAlias }}</view>
- </view>
- <view class="info-row uni-row" style="justify-content: space-between;">
- <view class="label">箱号:</view>
- <view class="value">{{ item.carrierName }}</view>
- <button class="reporting-tag" size="mini" type="primary"
- @click.stop="changeCheckCarrier(item)">载具变更</button>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import {
- ref
- } from 'vue'
- import {
- getOutsourcedInspection,
- getLotInfo,
- delProcessInspection
- } from '@/api/business/processInspection.js'
- import {
- getDayWorkList
- } from '@/api/business/auxiliaryDaywork.js'
- import {
- timestampToTime,
- toHHmmss
- } from '@/utils/common.js'
- import {
- onLoad,
- onReady,
- onUnload,
- onShow
- } from '@dcloudio/uni-app'
- import {
- store
- } from '@/store/index.js'
- import {
- getToken
- } from '@/utils/auth'
- import path from '@/api/base/path.js'
- const keywords = ref('')
- const inspecionList = ref([]); //时间后筛选数组
- const original = ref([]); //原始数组
- const startTime = ref(new Date().toISOString().split('T')[0])
- const userId = ref(store.userInfo.userId)
- const range = [{
- value: 0,
- text: "未开始",
- type: "color: #fcab53"
- }, {
- value: 1,
- text: "进行中",
- type: "color: #55ff7f"
- }, {
- value: 3,
- text: "已完成",
- type: "color: #ff0c2c"
- }]
- const quer = ref({}) //用于查询
- /***************************** 页面生命周期函数 *****************************/
- onShow(() => {
- getList();
- // getP2();
- })
- /***************************** 定义了一些方法 *****************************/
- function getList() {
- uni.showLoading({
- title: '加载中'
- });
- // quer.value.userId = store.userInfo.userId;
- // quer.value.startTime = startTime.value;
- quer.value.startTime = `${startTime.value} 00:00:00`
- quer.value.userId = userId.value
- quer.value.isAuto = 0
- getDayWorkList(quer.value).then(res => {
- console.log("res", res);
- if (res.code == 200) {
- original.value = res.rows;
- inspecionList.value = res.rows;
- // timeSizer();
- uni.hideLoading();
- // uni.hideLoading();
- }
- });
- }
- //查询P2中外协完成后需要检查的工序
- function getP2() {
- let token = 'Bearer ' + getToken();
- let header = {
- Authorization: token
- }
- uni.request({
- url: path.furnaceNoURL + '/business/sfc10300/getP2ProcessWrbz/' + "Y",
- method: 'GET',
- header,
- sslVerify: false,
- success: (res) => {
- console.log("P2查询", res);
- //将工序编码保存到store中
- if (res.data.code == 200) {
- store.outsourcedCode = res.data.rows.map(item => item.prcode.trim());
- // console.log("store", store.outsourcedCode);
- }
- },
- fail: (err) => {
- console.log(err)
- }
- })
- }
- //时间筛选
- function timeSizer() {
- // inspecionList.value = filterSameDayItems(original.value, startTime.value);
- getList()
- }
- // 筛选函数
- const filterSameDayItems = (inspectionList, startTime) => {
- // 使用filter方法筛选出与startTime同一天的元素
- const filteredList = inspectionList.filter(item => {
- // 将数组中每个元素的date属性转换为不包含时分秒的字符串
- const itemDateString = item.createTime.split(' ')[0];
- // 比较两个日期字符串是否相同
- return itemDateString === startTime;
- });
- return filteredList;
- };
- function isSameDate(date1, date2) {
- // 使用Date对象的toISOString()方法来格式化日期,并去除时分秒部分
- const formatDate = (date) => date.toISOString().split('T')[0];
- // 比较两个日期的年月日部分是否相同
- return formatDate(date1) === formatDate(date2);
- }
- //查看序捡详情
- function handleSelection(item) {
- store.auxiliaryDaywork = item;
- uni.navigateTo({
- url: '/pages/auxiliaryDaywork/form'
- })
- }
- //状态文本
- function selectText(item) {
- for (var i = 0; i < range.length; i++) {
- if (item.status == range[i].value) {
- return range[i].text
- }
- }
- }
- //状态样式
- function selectType(item) {
- for (var i = 0; i < range.length; i++) {
- if (item.status == range[i].value) {
- return range[i].type
- }
- }
- }
- const addProcessInspection = (data) => {
- const info = {
- title: data.title,
- standard: data.standard,
- result: '',
- number: 1
- }
- unfitInfos.value.push(info)
- }
- /***************************** 定义了一些事件 *****************************/
- // 新增辅助工序报工
- const handleAddAuxilaryDaywork = () => {
- uni.navigateTo({
- url: '/pages/auxiliaryDaywork/scan'
- })
- }
- // 修改信息
- const handleShowUnfit = () => {
- uni.navigateTo({
- url: '/pages/auxiliaryDaywork/form'
- })
- }
- const deleteItem = (item) => {
- // uni.showToast({
- // title: "删除方法未完成"
- // })
- uni.showModal({
- title: '确认',
- content: (item.rejectNum > 0 ? "已有外协检测信息,确认删除么?" : '确认删除该序检么?'),
- success: function(res) {
- if (res.confirm) {
- delProcessInspection(item.id).then(res => {
- if (res.code === 200) {
- console.log(res)
- getList()
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg
- })
- }
- })
- } else if (res.cancel) {
- uni.showToast({
- title: '已取消',
- icon: 'none'
- })
- }
- }
- })
- }
- const changeCheckCarrier = (item) => {
- // uni.showToast({
- // title: "检测载具方法未完成"
- // })
- // uni.$once('refreshProcessInspection', () => {
- // })
- const openItem = {
- dayworkId: item.dayworkId,
- processInspectionId: item.id,
- daywork: item.daywork
- }
- uni.navigateTo({
- url: "/pages/changeBox/index",
- success: function(res) {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit('acceptDataFromOpenerPage', {
- data: openItem
- })
- }
- })
- }
- function delable(item) {
- if (store.userInfo.permissions.some(item => item === 'business:outsourcedInspection:remove') && item.status == 0) {
- return true
- }
- if (item.creatorId === userId.value && item.status == 0) {
- return true
- }
- return false
- }
- </script>
- <style lang="scss">
- .time-controls {
- .title {
- margin: 20% auto 40% auto;
- .first {
- font-size: 48rpx;
- margin: 0 auto;
- }
- .second {
- color: red;
- font-size: 24rpx;
- margin: 10rpx auto 0 auto;
- }
- }
- .sta {
- justify-content: center;
- align-items: center;
- input {
- border: 1rpx solid gray;
- border-radius: 8rpx;
- width: 400rpx;
- height: 64rpx;
- }
- }
- button {
- width: 78%;
- background-color: #1684fc;
- color: white;
- margin: 0 auto;
- }
- }
- .page-container {
- // height: 100%;
- background-color: #ececec;
- font-size: 28rpx;
- padding: 24rpx;
- box-sizing: border-box;
- }
- .search-container {
- border-radius: 12rpx;
- align-items: center;
- input {
- flex: 1;
- background-color: #ffffff;
- height: 64rpx;
- box-sizing: border-box;
- padding: 0 16rpx;
- }
- .btn {
- width: 120rpx;
- height: 64rpx;
- background-color: #1684FC;
- justify-content: center;
- font-size: 24rpx;
- color: #ffffff;
- justify-content: center;
- align-items: center;
- }
- }
- .scan-btn {
- height: 64rpx;
- margin: 32rpx 32rpx 0 32rpx;
- color: #ffffff;
- background-color: #f47c3c;
- align-items: center;
- justify-content: center;
- border-radius: 8rpx;
- }
- .daywork-item {
- padding: 24rpx;
- background-color: #ffffff;
- margin-top: 24rpx;
- border-radius: 8rpx;
- .lot-code {
- align-items: center;
- justify-content: space-between;
- font-weight: 700;
- }
- .info {
- font-size: 24rpx;
- color: #767676;
- .info-row {
- margin-top: 16rpx;
- .label {
- width: 120rpx;
- }
- .value {
- flex: 1;
- }
- }
- }
- }
- </style>
|