4月26日提交

master
rosehan 2 years ago
parent 56193a3012
commit af2a1feb2a
  1. 4
      config.js
  2. 28
      pages/index.vue
  3. 38
      pages/login.vue
  4. 1
      store/index.js
  5. 17
      store/modules/user.js
  6. 134
      sunPages/mine/base/index.vue
  7. 17
      sunPages/traceability-product/delivery/deliveryEdit.vue
  8. 45
      sunPages/traceability-product/machining/index.vue
  9. 2
      utils/constant.js

@ -1,8 +1,8 @@
// 应用全局配置
module.exports = {
baseUrl: 'https://sy.hbcjy.com/prod-api',
//baseUrl: 'https://sy.hbcjy.com/prod-api',
// baseUrl: 'http://127.0.0.1:48080',
// baseUrl: 'http://192.168.130.193:48080',
baseUrl: 'http://192.168.130.193:48080',
baseApi: '/admin-api',
// 应用信息
appInfo: {

@ -7,8 +7,8 @@
</image>
<view class="row v-index-top-base">
<view class="text"><text class="iconfont icon-farm"></text>{{ BaseInfo.baseName }}</view>
<view class="text"><text class="iconfont icon-leader"></text>负责人{{ BaseInfo.baseLeader }}</view>
<view class="text"><text class="iconfont icon-farm"></text>{{ baseName }}</view>
<view class="text"><text class="iconfont icon-leader"></text>负责人{{ baseLeader }}</view>
</view>
<view class="v-index-top-nav v-container">
@ -178,15 +178,27 @@
baseId: this.$store.state.user.baseId,
BaseInfo: null,
ProductData: null,
ProductCode: null
ProductCode: null,
baseName: null,
baseLeader: null,
}
},
watch: {
"$store.state.user.baseId"(newValue, oldVal) {
console.log("AAAA",newValue)
this.baseId=newValue
this.baseId = newValue
this.getBaseData()
}
},
"$store.state.user.baseName": {
handler(newVal) {
this.baseName = newVal
},
},
"$store.state.user.baseLeader": {
handler(newVal) {
this.baseLeader = newVal
},
},
},
onLoad: function() {
this.getBaseData()
@ -195,13 +207,15 @@
},
methods: {
//
async getBaseData() {
async getBaseData() {
try {
let params = {
id: this.baseId
}
const res = await indexApi.getAllBaseInfo(params)
this.BaseInfo = res.data
this.baseName = this.BaseInfo.baseName
this.baseLeader = this.BaseInfo.baseLeader
} finally {}
},

@ -1,9 +1,13 @@
<template>
<view class="normal-login-container">
<view class="logo-content">
<image src="https://sy.hbcjy.com/prod-api/admin-api/infra/file/23/get/7e06dab83f0c2f4de0f6768f8d2f114aa6d752db73d9cb054dff9f8a13aa2267.png" class="logo-content-bg"></image>
<image
src="https://sy.hbcjy.com/prod-api/admin-api/infra/file/23/get/7e06dab83f0c2f4de0f6768f8d2f114aa6d752db73d9cb054dff9f8a13aa2267.png"
class="logo-content-bg"></image>
<view class="title">
<view class="text">欢迎登录</view><view class="text">溯源管理系统</view></view>
<view class="text">欢迎登录</view>
<view class="text">溯源管理系统</view>
</view>
</view>
<view class="login-form-content">
<view class="input-item flex align-center">
@ -32,7 +36,7 @@
<script>
import verify from "../sunPages/components/verifition/verify"
import * as CryptoUtils from '@/utils/cryptoUtils.js';
import store from "@/store"
import store from "@/store"
export default {
name: 'Login',
@ -44,8 +48,8 @@
captchaEnabled: true, // TODO
globalConfig: getApp().globalData.config,
loginForm: {
username: "",
password: "",
username: "admin",
password: "cjy@1501!",
captchaVerification: ""
}
}
@ -84,13 +88,11 @@
this.$store.dispatch('Login', this.loginForm).then(() => {
this.$modal.closeLoading()
this.loginSuccess()
this.$store.dispatch('getBaseList').then(res=>{
console.log(res)
// setTimeout(()=>{
this.$store.dispatch('changeBaseId',res[0].id)
// },1500)
})
this.$store.dispatch('getBaseList').then(res => {
// setTimeout(()=>{
this.$store.dispatch('changeBaseId', res[0].id)
// },1500)
})
})
},
//
@ -130,10 +132,14 @@
.title {
position: absolute;
top:30px;
top: 30px;
width: 100%;
text-align: center;
.text{font-weight: 600; color: #fff;}
.text {
font-weight: 600;
color: #fff;
}
}
}
@ -169,7 +175,7 @@
height: 45px;
background-color: #14c171;
color: #fff;
border-radius: 45px;
border-radius: 45px;
}
.xieyi {
@ -186,4 +192,4 @@
.login-code-img {
height: 45px;
}
</style>
</style>

@ -19,7 +19,6 @@ const store = new Vuex.Store({
modules: {
user,
dict
},
getters
})

@ -16,6 +16,8 @@ const user = {
roles: storage.get(constant.roles),
permissions: storage.get(constant.permissions),
baseId: storage.get(constant.baseId),
baseName: storage.get(constant.baseName),
baseLeader: storage.get(constant.baseLeader),
// baseList: storage.get(constant.baseList)
},
@ -43,6 +45,14 @@ const user = {
state.baseId = permissions
storage.set(constant.baseId, permissions)
},
SET_BASENAME: (state, permissions) => {
state.baseName = permissions
storage.set(constant.baseName, permissions)
},
SET_BASELEADER: (state, permissions) => {
state.baseLeader = permissions
storage.set(constant.baseLeader, permissions)
},
CHANGE_BASEID: (state, permissions) => {
state.baseId = permissions
storage.set(constant.baseId, permissions)
@ -125,8 +135,13 @@ const user = {
})
},
changeBaseId({commit}, state) {
console.log(commit,state)
commit('CHANGE_BASEID', state)
},
changeBaseName({commit}, state) {
commit('SET_BASENAME', state)
},
changeBaseLeader({commit}, state) {
commit('SET_BASELEADER', state)
}
}
}

@ -1,7 +1,7 @@
<template>
<view class="v-pages">
<view class="v-form v-container">
<uni-forms :modelValue="formData" ref="formRef" :label-width="120" :rules="formRules">
<view class="v-form v-container" style="padding-bottom: 120rpx;">
<uni-forms :modelValue="formData" ref="formRef" :label-width="80" :rules="formRules">
<view class="v-form-item base" @click="goBase()">
<view class="row">
<view class="col">切换基地</view>
@ -14,8 +14,7 @@
<input v-model="formData.baseName" placeholder="请输入基地名称" />
</uni-forms-item>
<uni-forms-item label="所属企业" name="companyId">
<picker @change="CompanyChange" v-model="formData.companyId" mode='selector'
:value="CurrentCompany" :range="CompanyPickerList">
<picker @change="CompanyChange" :value="CurrentCompany" :range="CompanyPickerList">
<view class="uni-input" v-if="CompanyPickerList[CurrentCompany]">
{{CompanyPickerList[CurrentCompany]}}
</view>
@ -37,28 +36,31 @@
<uni-forms-item label="基地地址" name="baseAddress">
<input v-model="formData.baseAddress" placeholder="请输入基地地址" class="m-form-small" />
</uni-forms-item>
<uni-forms-item label="基地面积(亩)" name="baseArea">
<uni-forms-item label="基地面积(亩)" name="baseArea":label-width="120">
<input v-model="formData.baseArea" placeholder="请输入联系电话" class="m-form-small" />
</uni-forms-item>
<uni-forms-item label="负责人" name="baseLeader">
<input v-model="formData.baseLeader" placeholder="请输入联系电话" class="m-form-small" />
</uni-forms-item>
<uni-forms-item label="联系电话" name="basePhone">
<input v-model="formData.basePhone" placeholder="请输入联系电话" class="m-form-small" />
<input v-model="formData.basePhone" placeholder="请输入联系电话" type="digit" class="m-form-small" />
</uni-forms-item>
<uni-forms-item label="基地简介" name="baseDescription">
<rich-text :nodes="formData.baseDescription"></rich-text>
<rich-text :nodes="formData.baseDescription"></rich-text>
</uni-forms-item>
<uni-forms-item label="基地图片" name="baseImage">
<image class="v-base-img" :src="formData.baseImage"></image>
<htz-image-upload v-model="imgList" :action="baseUrls" :chooseNum="1" :compress="false"
:headers="headers" :max="1" :quality="80" :remove="true" :sourceType="['album', 'camera']"
class="m-img-upload" mediaType="image" @imgDelete="ceshiImgDelete"
@uploadFail="ceshiUploadFail" @uploadSuccess="ceshiUploadSuccess"></htz-image-upload>
<uni-easyinput v-model="formData.companyLicense" class="not-show" placeholder=" " />
</uni-forms-item>
</view>
</uni-forms>
<!-- 页面 提交 -->
<view class="sticky fixedBottom"><button class="v-primary-btn large" @click="submitForm()">保存</button>
</view>
</view>
</uni-forms>
<!-- 页面 提交 -->
<view class="fixed fixedBottom v-container"><button class="v-primary-btn large" @click="submitForm()">保存</button>
</view>
</view>
</view>
</template>
@ -71,12 +73,26 @@
import cityPicker from '@/uni_modules/piaoyi-cityPicker/components/piaoyi-cityPicker/piaoyi-cityPicker'
import {
getAccessToken
} from '@/utils/auth';
import config from '@/config';
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue';
export default {
components: {
cityPicker
cityPicker,
htzImageUpload
},
data() {
return {
imgList: [],
baseUrls: config.baseUrl + config.baseApi + '/infra/file/upload',
headers: {
Authorization: 'Bearer ' + getAccessToken()
}, //
defaultValue: '',
column: 3,
startVisible: false,
@ -90,7 +106,6 @@
cityCode: null,
cityCode: null,
},
formData: {
id: undefined,
baseName: undefined,
@ -141,11 +156,17 @@
errorMessage: '请输入基地面积'
}]
},
baseAddress: {
rules: [{
required: true,
errorMessage: '请输入基地详细地址'
}]
},
basePhone: {
rules: [{
required: true,
errorMessage: '请输入联系电话'
}]
}, ]
}
},
@ -153,9 +174,13 @@
CurrentCompany: undefined,
CompanyList: [], //
CompanyPickerList: [], //
provinceList: [],
cityList: [],
areaList: [],
}
},
onLoad: function() {
onLoad: function() {
this.getListData()
},
onReady() {
@ -163,36 +188,49 @@
this.$refs.formRef.setRules(this.formRules)
},
methods: {
async getCity() {
async getAddressList() {
try {
const res = await areaApi.getAreaTree()
this.addressList = res.data
} finally {}
},
//
async getListData() {
this.getCity()
try {
this.getCompany()
await this.getCompany()
await this.getAddressList()
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("aaaaa", this.addressList)
const province=this.addressList.find((item, index) => {
//
this.CompanyList.map((item, index, arr) => {
if (item.companyId === this.formData.companyId) {
this.CurrentCompany = index
}
})
this.provinceList = 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.cityList = this.provinceList.children.find((item, index) => {
return item.id == this.formData.city;
})
this.areaList = this.cityList.children.find((item, index) => {
return item.id == this.formData.district;
})
this.LocalData.provinceName = this.provinceList.name
this.LocalData.cityName = this.cityList.name
this.LocalData.areaName = this.areaList.name
this.LocalData.provinceCode = this.formData.province
this.LocalData.cityCode = this.formData.city
this.LocalData.areaCode = this.formData.district
this.imgList[0]=this.formData.baseImage
} finally {}
@ -201,16 +239,21 @@
/** 提交按钮 */
async submitForm() {
//
try {
await this.$refs['formRef'].validate()
try {
const that = this
await this.$refs['formRef'].validate()
const data = this.formData
await BaseApi.updateBase(data)
console.log(this.formData)
uni.showToast({
title: `保存成功`,
icon: 'success',
duration: 2000,
complete: function() {
complete: function() {
setTimeout(function() {
that.$store.dispatch('changeBaseName',that.formData.baseName)
that.$store.dispatch('changeBaseLeader',that.formData.baseLeader)
uni.redirectTo({
url: '/pages/mine/index'
});
@ -245,6 +288,7 @@
//
CompanyChange(e) {
this.CurrentCompany = e.detail.value
this.formData.companyId = this.CompanyList[this.CurrentCompany].companyId
},
//
@ -252,17 +296,33 @@
this.startVisible = true
},
startConfirm(val) {
console.log(val)
this.LocalData = val
this.startVisible = false
this.formData.startRegion = this.LocalData.name
this.formData.startProvince = this.LocalData.provinceCode
this.formData.startCity = this.LocalData.cityCode
this.formData.startCountry = this.LocalData.areaCode
this.formData.province = this.LocalData.provinceCode
this.formData.city = this.LocalData.cityCode
this.formData.district = this.LocalData.areaCode
},
startCancel() {
this.startVisible = false
},
ceshiUploadSuccess(res) {
//
var _res = JSON.parse(res.data);
console.log('_res', _res);
if (_res.code == 0) {
this.imgList.push(_res.data);
this.formData.baseImage = _res.data;
}
},
ceshiImgDelete(e, num) {
console.log('ceshiImgDelete', e);
},
ceshiUploadFail(err) {
//
console.log('err', err);
},
}
}
</script>

@ -23,7 +23,8 @@
<uni-forms-item label="配送人" name="deliveryMan" required>
<input v-model="formData.deliveryMan" placeholder="请输入配送人" />
</uni-forms-item>
<uni-forms-item label="配送日期" name="deliveryTime">
<uni-forms-item label="配送日期" name="deliveryTime">
<uni-datetime-picker :clear-icon="false" type="date" returnType="timestamp" v-model="formData.deliveryTime" @change="changeLog($event)" />
</uni-forms-item>
<uni-forms-item label="所在地区" name="startRegion" required>
@ -128,43 +129,43 @@
logisticsId: {
rules: [{
required: true,
errorMessage: '配送公司不能为空'
errorMessage: '配送公司不能为空'
}]
},
deliveryMan: {
rules: [{
required: true,
errorMessage: '配送人不能为空'
errorMessage: '配送人不能为空'
}]
},
deliveryTime: {
rules: [{
required: true,
errorMessage: '配送日期不能为空'
errorMessage: '配送日期不能为空'
}]
},
startAddress: {
rules: [{
required: true,
errorMessage: '详细地址不能为空'
errorMessage: '详细地址不能为空'
}]
},
endAddress: {
rules: [{
required: true,
errorMessage: '详细地址不能为空'
errorMessage: '详细地址不能为空'
}]
},
startRegion: {
rules: [{
required: true,
errorMessage: '所在区不能为空'
errorMessage: '所在区不能为空'
}]
},
endRegion: {
rules: [{
required: true,
errorMessage: '所在区不能为空'
errorMessage: '所在区不能为空'
}]
},
},

@ -1,17 +1,17 @@
<template>
<view class="v-pages">
<view class="v-form v-container">
<view class="v-form v-container" style="padding-bottom: 120rpx;">
<uni-forms :modelValue="formData" ref="formRef" :label-width="80" :rules="formRules">
<view class="v-form-item">
<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 :label-width="120">
<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"
:value="CurrenWorkShop" :range="WorkShopPickerList">
<picker @change="WorkShopChange" v-model="formData.workshopId" :value="CurrenWorkShop"
:range="WorkShopPickerList">
<view class="uni-input" v-if="WorkShopPickerList[CurrenWorkShop]">
{{WorkShopPickerList[CurrenWorkShop]}}
</view>
@ -19,9 +19,10 @@
<uni-icons type="down" size="14" class="v-icon"></uni-icons>
</picker>
</uni-forms-item>
<uni-forms-item label="加工日期" name="processingTime">
<uni-datetime-picker :clear-icon="false" type="date" returnType="timestamp"
v-model="formData.processingTime" @change="changeLog($event)" />
<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>
</uni-datetime-picker>
</uni-forms-item>
<uni-forms-item label="加工项目" name="processingProjection" required>
<input v-model="formData.processingProjection" placeholder="请输入加工项目" />
@ -33,8 +34,8 @@
<view class="v-form-item">
<uni-forms-item label="认证类型" name="authenticationType">
<picker @change="AuthenticationTypeChange"
:value="CurrenAuthenticationType" :range="AuthenticationTypePickerList">
<picker @change="AuthenticationTypeChange" :value="CurrenAuthenticationType"
:range="AuthenticationTypePickerList">
<view class="uni-input" v-if="AuthenticationTypePickerList[CurrenAuthenticationType]">
{{AuthenticationTypePickerList[CurrenAuthenticationType]}}
</view>
@ -53,8 +54,8 @@
</view>
<view class="v-form-item">
<uni-forms-item label="质检情况" name="qualityInspection" required>
<picker @change="QualityInspectionChange"
:value="CurrenQualityInspection" :range="QualityInspectionPickerList">
<picker @change="QualityInspectionChange" :value="CurrenQualityInspection"
:range="QualityInspectionPickerList">
<view class="uni-input" v-if="QualityInspectionPickerList[CurrenQualityInspection]">
{{QualityInspectionPickerList[CurrenQualityInspection]}}
</view>
@ -63,8 +64,8 @@
</picker>
</uni-forms-item>
<uni-forms-item label="质检结论" name="qualityResult" required>
<picker @change="QualityResultChange"
:value="CurrenQualityResult" :range="QualityResultPickerList">
<picker @change="QualityResultChange" :value="CurrenQualityResult"
:range="QualityResultPickerList">
<view class="uni-input" v-if="QualityResultPickerList[CurrenQualityResult]">
{{QualityResultPickerList[CurrenQualityResult]}}
</view>
@ -113,7 +114,7 @@
</view>
</view>
</uni-forms>
<view class="sticky fixedBottom">
<view class="fixed fixedBottom v-container">
<view class="m-t-large v-primary-btn large" @click="submitForm()">保存</view>
</view>
</view>
@ -121,6 +122,8 @@
</template>
<script>
import {parseTime} from "@/utils/ruoyi.js";
import * as ProductApi from "@/api/traceability/product"
import * as customApi from "@/api/traceability/custom"
import mix from '@/utils/mix.js'
@ -248,11 +251,11 @@
onLoad(options) {
if (options.params) {
this.formData = JSON.parse(decodeURIComponent(options.params));
this.formData.processingTime=this.formData.processingTime
this.formData.processingTime = this.formData.processingTime
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
}
@ -281,6 +284,7 @@
husbandryNotes: undefined,
materialsList: []
}
this.formData.processingTime = new Date().valueOf()
}
this.getAllWorkShop()
@ -293,6 +297,9 @@
this.$refs.formRef.setRules(this.formRules)
},
methods: {
parseTime(time, pattern) {
return parseTime(time, pattern);
},
/** 提交按钮 */
async submitForm() {
//
@ -307,13 +314,13 @@
complete: function() {
setTimeout(function() {
uni.redirectTo({
url: '/sunPages/traceability-product/machining/index'
url: '/pages/index'
});
}, 2000);
}
})
} catch (err) {
console.log("验证未通过")
console.log("验证未通过",err)
} finally {}
},
@ -472,4 +479,4 @@
},
};
</script>
</script>

@ -4,6 +4,8 @@ const constant = {
roles: 'vuex_roles',
permissions: 'vuex_permissions',
baseId: 'vuex_baseId',
baseName: 'vuex_baseName',
baseLeader: 'vuex_baseLeader',
// baseList: 'vuex_baseList',
}

Loading…
Cancel
Save