123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- <template>
- <view class="mould-page">
- <navigation title="手动报工"></navigation>
-
- <view class="list-box" v-if="dataList.length>0">
- <view class="list-item" v-for="(item, index) in dataList" :key="index">
- <view class="item-text flex-box">
- <view>工单名称:</view>
- <view>{{item.taskName}}</view>
- </view>
- <view class="item-text flex-box">
- <view>工单编号:</view>
- <view>{{item.orderNum}}</view>
- </view>
- <view class="item-text flex-box">
- <view>工序名称:</view>
- <view style="width: calc(100% - 150rpx);">
- <uni-data-select
- v-model="item.processId"
- :localdata="productProcessData"
- @change="change"
- ></uni-data-select>
- </view>
- </view>
- <view class="item-text flex-box">
- <view>工单数量:</view>
- <view>{{item.orderAmounts || 0}}</view>
- </view>
- <!-- <view class="item-text flex-box">
- <view>剩余数量:</view>
- <view>{{Number(item.orderAmounts) - Number(item.productNum) || 0}}</view>
- </view> -->
- <view class="btn-box">
- <view class="btn-item" @click="reportingforwork(item)">
- <view>报工</view>
- </view>
- <!-- <view class="btn-item" >
- <view>换模</view>
- </view> -->
- </view>
- </view>
- </view>
- <empty v-else text="暂无数据"></empty>
-
- <view v-if="total !== 0 && dataList.length != 0" style="height: 60rpx;">
- <u-loadmore :status="status" />
- </view>
-
- <!-- 输入框示例 -->
- <uni-popup ref="inputDialog" type="dialog">
- <uni-popup-dialog ref="inputClose" mode="input" title="报工" v-model="popform.productNum"
- placeholder="请填写报工数量" @confirm="dialogInputConfirm">
- </uni-popup-dialog>
- </uni-popup>
-
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- // 请求传递的参数
- form:{
- current:1,
- size:10,
- orderStatus:1
- },
- // 列表数据
- dataList:[],
- total:0,
- status: 'loadmore',
- // 工序名称
- productProcessData:[],
- popform:{
- productNum:null
- }
- }
- },
- onShow() {
- this.productOrderListfun()
- this.productProcesslistfun()
- },
- onReachBottom() {
- this.status = 'loading'
- if (this.dataList.length < this.total) {
- this.page.current++
- this.productOrderListfun()
- } else {
- this.status = 'nomore'
- }
- },
- methods: {
- // 报工
- reportingforwork(item){
- if (!item.processId) {
- uni.showToast({
- title: '请先选择工序名称!',
- duration: 2000
- });
- return
- }
- this.popform.orderId = item.id
- this.popform.processId = item.processId
- this.popform.taskId = item.taskId
- this.$refs.inputDialog.open()
- },
- // 报工确认
- dialogInputConfirm(e){
- console.log(e,104);
- this.popform.productNum = e
- console.log(this.popform,107);
- this.$api.productOrderDetailAddNonautomatic(this.popform).then(res=>{
- uni.showToast({
- title: '操作成功!',
- duration: 2000
- });
- setTimeout(()=> {
- this.dataList = []
- this.form.current = 1
- this.productOrderListfun()
- }, 2000);
-
- })
- },
- // 获取列表接口
- productOrderListfun(){
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- this.$api.productOrderList(this.form).then(res=>{
- this.dataList = this.dataList.concat(res.rows)
- this.total = res.total
- if (this.dataList.length == res.total) {
- this.status = 'nomore'
- }
- uni.hideLoading();
- })
- },
- // 获取工序的下拉数据
- productProcesslistfun(){
- this.$api.productProcesslist().then(res=>{
- this.productProcessData = res.rows.map(item=>{
- return {
- value:item.id,
- text:item.processName
- }
- })
- })
- },
- // 工序的下拉回调
- change(e){
- console.log(e);
- // for(let res of this.productProcessData) {
- // console.log(res,139);
- // console.log(item.processName);
- // if (res.text == item.processName) {
- // item.processId = res.value
- // }
- // }
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .mould-page {
- .white-card {
- background-color: $uni-bg-color;
- }
- .list-box {
- padding: 0 20rpx;
- color: $uni-text-color-list; // #666
- .list-item {
- background-color: $uni-bg-color; // #ffffff
- padding: 20rpx;
- border-radius: 20rpx;
- margin-top: 28rpx;
-
- .item-text {
- margin-top: 10rpx;
- font-size: 30rpx;
- padding: 10rpx 0;
- border-bottom: 1rpx solid rgba(0, 0, 0, .1);
- &:last-child {
- border: 0;
- }
- }
- .flex-box {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- }
-
- .btn-box {
- display: flex;
- justify-content: flex-end;
- margin-top: 20rpx;
-
- .btn-item {
- width: 175rpx;
- height: 50rpx;
- line-height: 50rpx;
- text-align: center;
- border-radius: 24rpx;
- margin-left: 20rpx;
- border: 1px solid #3d6df0;
- color: #fff;
- background: #3d6df0;
- }
- }
- }
- }
- </style>
|