4月26日提交

master
rosehan 2 years ago
parent f4c1d8cfbd
commit 1313206464
  1. 30
      pages/mine/base/index.vue
  2. 59
      pages/traceability-product/machining/index.vue
  3. 11
      pages/traceability-product/machining/materialsList.vue

@ -4,7 +4,7 @@
<uni-forms :modelValue="formData" ref="formRef" :label-width="120" :rules="formRules">
<view class="v-form-item base" @click="goBase()">
<view class="row">
<view class="col">切换基地</view>
<view class="col">切换基地</view>
<uni-icons type="right" size="14" class="v-icon" color="#fff"></uni-icons>
</view>
</view>
@ -64,7 +64,10 @@
<script>
import * as BaseApi from '@/api/traceability/base'
import * as areaApi from '@/api/system/area'
import * as customApi from "@/api/traceability/custom"
import addressList from '@/uni_modules/piaoyi-cityPicker/components/piaoyi-cityPicker/cityData.js'
import cityPicker from '@/uni_modules/piaoyi-cityPicker/components/piaoyi-cityPicker/piaoyi-cityPicker'
@ -78,6 +81,7 @@
column: 3,
startVisible: false,
startMaskCloseAble: true,
addressList: [],
LocalData: {
provinceName: null,
cityName: null,
@ -151,7 +155,7 @@
CompanyPickerList: [], //
}
},
onLoad: function() {
onLoad: function() {
this.getListData()
},
onReady() {
@ -159,24 +163,38 @@
this.$refs.formRef.setRules(this.formRules)
},
methods: {
async getCity() {
try {
const res = await areaApi.getAreaTree()
this.addressList = res.data
} finally {}
},
//
async getListData() {
this.getCity()
try {
this.getCompany()
const res = await BaseApi.getBase(this.baseId)
this.formData = res.data
this.CurrentCompany = this.CompanyList.findIndex(item => Number(item.companyId) ===
Number(this.formData.companyId))
console.log("bb", this.formData)
this.LocalData.provinceName = this.formData.province
this.LocalData.cityName = this.formData.city
console.log("aaaaa", this.addressList)
const province=this.addressList.find((item, index) => {
return item.id == this.formData.province;
})
console.log(province)
this.LocalData.provinceName =province.name
this.LocalData.cityName = this.formData.city
this.LocalData.areaName = this.formData.district
this.LocalData.provinceCode = this.formData.province
this.LocalData.cityCode = this.formData.city
this.LocalData.areaCode = this.formData.district
console.log('aa', this.LocalData)
} finally {}
},

@ -6,11 +6,11 @@
<uni-forms-item label="产品名称" name="processingName" required>
<input v-model="formData.processingName" placeholder="请输入产品名称" />
</uni-forms-item>
<uni-forms-item label="生产数量" name="processingProduction" required>
<uni-forms-item label="生产数量(公斤)" name="processingProduction" required>
<input v-model="formData.processingProduction" type="digit" placeholder="请输入生产数量" />
</uni-forms-item>
<uni-forms-item label="加工车间" name="workshopId" required>
<picker @change="WorkShopChange" v-model="formData.workshopId" mode='selector'
<picker @change="WorkShopChange" v-model="formData.workshopId"
:value="CurrenWorkShop" :range="WorkShopPickerList">
<view class="uni-input" v-if="WorkShopPickerList[CurrenWorkShop]">
{{WorkShopPickerList[CurrenWorkShop]}}
@ -33,7 +33,7 @@
<view class="v-form-item">
<uni-forms-item label="认证类型" name="authenticationType">
<picker @change="AuthenticationTypeChange" v-model="formData.authenticationType" mode='selector'
<picker @change="AuthenticationTypeChange"
:value="CurrenAuthenticationType" :range="AuthenticationTypePickerList">
<view class="uni-input" v-if="AuthenticationTypePickerList[CurrenAuthenticationType]">
{{AuthenticationTypePickerList[CurrenAuthenticationType]}}
@ -41,6 +41,7 @@
<view v-else class="placeholder">请选择质检结论</view>
<uni-icons type="down" size="14" class="v-icon"></uni-icons>
</picker>
</uni-forms-item>
<uni-forms-item label="认证图片" name="authenticationPic">
<htz-image-upload v-model="imgList" :action="baseUrls" :chooseNum="1" :compress="false"
@ -52,7 +53,7 @@
</view>
<view class="v-form-item">
<uni-forms-item label="质检情况" name="qualityInspection" required>
<picker @change="QualityInspectionChange" v-model="formData.qualityInspection" mode='selector'
<picker @change="QualityInspectionChange"
:value="CurrenQualityInspection" :range="QualityInspectionPickerList">
<view class="uni-input" v-if="QualityInspectionPickerList[CurrenQualityInspection]">
{{QualityInspectionPickerList[CurrenQualityInspection]}}
@ -62,7 +63,7 @@
</picker>
</uni-forms-item>
<uni-forms-item label="质检结论" name="qualityResult" required>
<picker @change="QualityResultChange" v-model="formData.qualityResult" mode='selector'
<picker @change="QualityResultChange"
:value="CurrenQualityResult" :range="QualityResultPickerList">
<view class="uni-input" v-if="QualityResultPickerList[CurrenQualityResult]">
{{QualityResultPickerList[CurrenQualityResult]}}
@ -153,18 +154,17 @@
WorkShopPickerList: [], //
WorkshopList: [], //
CurrenQualityInspection: -1, //
CurrenQualityInspection: 0, //
QualityInspectionPickerList: [], //
QualityInspectionList: [], //
CurrenQualityResult: 1, //
CurrenQualityResult: 0, //
QualityResultPickerList: [], //
QualityResultList: [], //
CurrenAuthenticationType: 1, //
CurrenAuthenticationType: 0, //
AuthenticationTypePickerList: [], //
AuthenticationTypeList: [], //
formData: {
id: undefined,
cropperId: undefined,
@ -174,10 +174,10 @@
workshopId: undefined,
processingTime: undefined,
processingProjection: undefined,
authenticationType: undefined,
authenticationType: 1,
authenticationPic: undefined,
qualityInspection: undefined,
qualityResult: undefined,
qualityInspection: 1,
qualityResult: 1,
qualityImage: undefined,
certificateNumber: undefined,
husbandryImage: undefined,
@ -248,10 +248,10 @@
onLoad(options) {
if (options.params) {
this.formData = JSON.parse(decodeURIComponent(options.params));
console.log("回",this.formData)
this.formData.processingTime=this.formData.processingTime
this.CurrenWorkShop = this.formData.CurrenWorkShop
this.CurrenQualityInspection = this.formData.CurrenQualityInspection
this.CurrenQualityResult = this.formData.CurrenAuthenticationType
this.CurrenQualityResult = this.formData.CurrenQualityResult
this.CurrenAuthenticationType = this.formData.CurrenAuthenticationType
if (this.formData.authenticationPic) {
this.imgList[0] = this.formData.authenticationPic
@ -259,7 +259,6 @@
if (this.formData.qualityImage) {
this.imgList1[0] = this.formData.qualityImage
}
} else {
this.formData = {
id: undefined,
@ -270,10 +269,10 @@
workshopId: undefined,
processingTime: undefined,
processingProjection: undefined,
authenticationType: undefined,
authenticationType: 1,
authenticationPic: undefined,
qualityInspection: undefined,
qualityResult: undefined,
qualityInspection: 1,
qualityResult: 1,
qualityImage: undefined,
certificateNumber: undefined,
husbandryImage: undefined,
@ -292,14 +291,11 @@
onReady() {
//
this.$refs.formRef.setRules(this.formRules)
setTimeout(() => {
this.formData.processingTime = new Date().valueOf()
}, 500)
},
methods: {
/** 提交按钮 */
async submitForm() {
//
//
try {
await this.$refs['formRef'].validate()
const data = this.formData
@ -311,7 +307,7 @@
complete: function() {
setTimeout(function() {
uni.redirectTo({
url: '/pages/index'
url: '/pages/traceability-product/machining/index'
});
}, 2000);
}
@ -324,7 +320,6 @@
//
changeLog(e) {
this.formData.processingTime = e
console.log("变",this.formData.processingTime)
},
//
@ -383,6 +378,17 @@
this.formData.qualityInspection = this.QualityInspectionList[this.CurrenQualityInspection].value
},
//
getLossType() {
//
let newData = this.getDictDatas(DICT_TYPE.LOSS_TYPE);
this.LossTypeList = newData
this.LossTypePickerList = newData.map((item) => {
return item.label
})
},
//
getQualityResult() {
//
@ -420,7 +426,6 @@
//
goMaterials() {
console.log('走', this.formData)
const data = encodeURIComponent(JSON.stringify(this.formData));
uni.redirectTo({
url: '/pages/traceability-product/machining/materialsList?params=' + data
@ -444,7 +449,6 @@
ceshiUploadSuccess(res) {
//
var _res = JSON.parse(res.data);
console.log('_res', _res);
if (_res.code == 0) {
this.imgList.push(_res.data);
this.formData.authenticationPic = _res.data;
@ -453,7 +457,6 @@
ceshiUploadSuccess1(res) {
//
var _res = JSON.parse(res.data);
console.log('_res', _res);
if (_res.code == 0) {
this.imgList1.push(_res.data);
this.formData.qualityImage = _res.data;
@ -469,4 +472,4 @@
},
};
</script>
</script>

@ -71,7 +71,13 @@
onLoad: function(options) {
if (options.params) {
this.reviceData = JSON.parse(decodeURIComponent(options.params));
console.log("接",this.reviceData)
if (this.reviceData.materialsList) {
this.selectData = this.reviceData.materialsList.map((item, index, arr) => {
return item.cropperId
})
this.saveData=this.reviceData.materialsList
console.log(this.selectData)
}
} else {
this.reviceData = null;
}
@ -82,7 +88,7 @@
try {
const queryParams = {
pageNo: pageNo,
pageSize: pageSize,
pageSize: pageSize,
processingName: this.queryParams.processingName
}
const res = await ProductApi.getSelfOroducedProductsAndInventory(queryParams)
@ -122,7 +128,6 @@
}]
}
})
const data = encodeURIComponent(JSON.stringify(this.reviceData));
uni.redirectTo({
url: '/pages/traceability-product/machining/index?params=' + data

Loading…
Cancel
Save