|
|
|
@ -21,7 +21,8 @@ |
|
|
|
|
</uni-forms-item> |
|
|
|
|
<uni-forms-item label="加工日期" name="processingTime"> <uni-datetime-picker ref="datetimePicker" |
|
|
|
|
v-model="formData.processingTime" :clear-icon="false" returnType="timestamp" type="date"> |
|
|
|
|
{{parseTime(formData.processingTime,'{y}-{m}-{d}')||'请选择加工时间'}} <uni-icons type="calendar"></uni-icons> |
|
|
|
|
{{parseTime(formData.processingTime,'{y}-{m}-{d}')||'请选择加工时间'}} <uni-icons |
|
|
|
|
type="calendar"></uni-icons> |
|
|
|
|
</uni-datetime-picker> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
<uni-forms-item label="加工项目" name="processingProjection" required> |
|
|
|
@ -86,7 +87,7 @@ |
|
|
|
|
<view @click="goMaterials()">选择生产原料<uni-icons type="right" size="14"></uni-icons></view> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
<view class="v-materials-list no-label no-right" v-if="materialsList.length>0"> |
|
|
|
|
<uni-forms-item required :label-width="0" :name="['materialsList',i,'productUsed']" |
|
|
|
|
<uni-forms-item required :label-width="0" :name="['materialsList',i,'productUsed']" |
|
|
|
|
:key="cell.cropperId" :rules="cell.rules" v-for="(cell,i) in materialsList"> |
|
|
|
|
<view class="v-materials-list-item"> |
|
|
|
|
<view class="v-materials-list-box row"> |
|
|
|
@ -102,8 +103,8 @@ |
|
|
|
|
<view class="col-10"> |
|
|
|
|
<view class="total-input row"> |
|
|
|
|
<view class="col"> |
|
|
|
|
<input class="border" v-model="cell.productUsed" |
|
|
|
|
placeholder="总用量" type="digit" /> |
|
|
|
|
<input class="border" v-model="cell.productUsed" placeholder="总用量" |
|
|
|
|
type="digit" /> |
|
|
|
|
</view> |
|
|
|
|
<view class="unit">公斤</view> |
|
|
|
|
</view> |
|
|
|
@ -122,7 +123,9 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import {parseTime} from "@/utils/ruoyi.js"; |
|
|
|
|
import { |
|
|
|
|
parseTime |
|
|
|
|
} from "@/utils/ruoyi.js"; |
|
|
|
|
|
|
|
|
|
import * as ProductApi from "@/api/traceability/product" |
|
|
|
|
import * as customApi from "@/api/traceability/custom" |
|
|
|
@ -168,9 +171,9 @@ import {parseTime} from "@/utils/ruoyi.js"; |
|
|
|
|
CurrenAuthenticationType: 0, //当前认证类型 |
|
|
|
|
AuthenticationTypePickerList: [], //认证类型列表 |
|
|
|
|
AuthenticationTypeList: [], //认证类型选择列表 |
|
|
|
|
|
|
|
|
|
materialsList:[], |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
materialsList: [], |
|
|
|
|
|
|
|
|
|
formData: { |
|
|
|
|
id: undefined, |
|
|
|
|
cropperId: undefined, |
|
|
|
@ -258,15 +261,15 @@ import {parseTime} from "@/utils/ruoyi.js"; |
|
|
|
|
this.CurrenWorkShop = this.formData.CurrenWorkShop |
|
|
|
|
this.CurrenQualityInspection = this.formData.CurrenQualityInspection |
|
|
|
|
this.CurrenQualityResult = this.formData.CurrenQualityResult |
|
|
|
|
this.CurrenAuthenticationType = this.formData.CurrenAuthenticationType |
|
|
|
|
this.CurrenAuthenticationType = this.formData.CurrenAuthenticationType |
|
|
|
|
if (this.formData.authenticationPic) { |
|
|
|
|
this.imgList[0] = this.formData.authenticationPic |
|
|
|
|
} |
|
|
|
|
if (this.formData.qualityImage) { |
|
|
|
|
this.imgList1[0] = this.formData.qualityImage |
|
|
|
|
} |
|
|
|
|
console.log("lai",this.formData) |
|
|
|
|
this.materialsList=this.formData.materialsList |
|
|
|
|
console.log("lai", this.formData) |
|
|
|
|
this.materialsList = this.formData.materialsList |
|
|
|
|
} else { |
|
|
|
|
this.formData = { |
|
|
|
|
id: undefined, |
|
|
|
@ -303,7 +306,7 @@ import {parseTime} from "@/utils/ruoyi.js"; |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
parseTime(time, pattern) { |
|
|
|
|
return parseTime(time, pattern); |
|
|
|
|
return parseTime(time, pattern); |
|
|
|
|
}, |
|
|
|
|
/** 提交按钮 */ |
|
|
|
|
async submitForm() { |
|
|
|
@ -323,7 +326,7 @@ import {parseTime} from "@/utils/ruoyi.js"; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} catch (err) { |
|
|
|
|
console.log("验证未通过",err) |
|
|
|
|
console.log("验证未通过", err) |
|
|
|
|
} finally {} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -436,7 +439,7 @@ import {parseTime} from "@/utils/ruoyi.js"; |
|
|
|
|
|
|
|
|
|
// 跳转加工材料 |
|
|
|
|
goMaterials() { |
|
|
|
|
this.formData.materialsList=this.materialsList |
|
|
|
|
this.formData.materialsList = this.materialsList |
|
|
|
|
const data = encodeURIComponent(JSON.stringify(this.formData)); |
|
|
|
|
uni.redirectTo({ |
|
|
|
|
url: '/sunPages/traceability-product/machining/materialsList?params=' + data |
|
|
|
@ -446,8 +449,10 @@ import {parseTime} from "@/utils/ruoyi.js"; |
|
|
|
|
getInventory(item) { |
|
|
|
|
item.productState = false |
|
|
|
|
if (item.productUsed && !isNaN(item.productUsed)) { |
|
|
|
|
if ((item.inventoryProduction - item.productUsed) >= 0) { |
|
|
|
|
return item.inventoryProduction - item.productUsed |
|
|
|
|
var m = Math.pow(10, 2); //放大10的2次方倍 100 |
|
|
|
|
var num = (item.inventoryProduction * m - item.productUsed * m) / m |
|
|
|
|
if (num >= 0) { |
|
|
|
|
return num |
|
|
|
|
} else { |
|
|
|
|
item.productState = true |
|
|
|
|
return item.inventoryProduction |
|
|
|
|