123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- <template>
- <view>
- <form @submit="add">
- <view class="body">
- <input class="input" style="display:none;" name="coding" :value=coding />
- 编码:<input class="input" v-model="coding" />
- <button type="primary" @click="saoma()" class="button1">
- <p class="p">扫码</p>
- </button>
- <button type="primary" @click="getMessage(coding)" class="button1">
- <p class="p">获取</p>
- </button>
- </view>
- <view class="body">
- 名称:<input class="input" name="name" :value="name" />
- </view>
- <view class="body">
- 版本号:<input class="input" name="versions" :value="versions" />
- </view>
- <view class="body">
- 生产人员:<input class="input" name="producePersonnel" :value="producePersonnel" readonly="readonly"/>
- </view>
- <timeSelector showType="date" @btnConfirm="btnConfirm0" @btnCancel="btnCancel0">
- <view class="body">
- 生产日期:<input type="text" class="input" name="produceDate" :value="produceDate" />
- </view>
- </timeSelector>
- <view class="title">配件</view>
- <view class="lis" v-for="item in desList" >
- {{item}}
- </view>
-
- <view class="">
- <button type="primary" formType="submit" class="button">
- <p class="p1">提交</p>
- </button>
- </view>
- </form>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapActions,
- mapMutations
- } from 'vuex';
- import timeSelector from '@/components/wing-time-selector/wing-time-selector.vue';
- export default {
- components: {
- timeSelector
- },
- data() {
- return {
- produceDate:'',
- coding:null,
- name:null,
- versions:null,
- producePersonnel:null,
- desList:{}
- }
- },
- methods: {
- btnConfirm0(e) {
- // console.log('确定时间为:', e);
- this.produceDate = e.key;
- },
- btnCancel0() {
- this.produceDate = '';
- },
- saoma(){
- var that = this;
- // 允许从相机和相册扫码
- uni.scanCode({
- success(res) {
- // console.log('条码类型:' + res.scanType);
- // console.log('条码内容:' + res.result);
- that.coding = res.result;
- }
- });
- },
- getMessage(coding){
- console.log("a");
- var that = this;
- var serverUrl = that.serverurl;
- var token = uni.getStorageSync("token");
- uni.request({
- url: serverUrl + "/TModules/getMessage?coding="+coding,
- method: "GET",
- header: {
- 'token': token
- },
- success: (Result) => {
- console.log("1");
- var res = Result;
- if(res.data.code==true){
- var codes = res.data.data;
- that.name = codes.name;
- that.versions = codes.versions
- that.produceDate = codes.createDate;
- that.producePersonnel = uni.getStorageSync("name");
- that.desList = codes.flagCode.split(",");
- }else{
- uni.showModal({
- content: res.data.message,
- });
- }
- }
- });
- },
- add(event) {
- var serverUrl = this.serverurl;
- const {
- value: modules
- } = event.detail;
- console.log("2");
- var token = uni.getStorageSync("token");
- uni.request({
- url: serverUrl + "/TModules/add",
- method: "POST",
- data:{
- "coding":modules.coding,
- "name":modules.name,
- "producePersonnel":modules.producePersonnel
- },
- header: {
- 'token': token
- },
- success: (Result) => {
- var res = Result;
- if(res.data.code==true){
-
- }
-
- uni.showModal({
- title: '提示',
- content: res.data.message,
- });
- }
- });
-
-
- },
- }
- }
- </script>
- <style>
- .body {
- background-color: #FFFFFF;
- padding: 20upx 20upx 20upx 20upx;
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- }
-
- .input {
- /* padding: 10upx 20upx 10upx 0upx; */
- padding-left: 20upx;
- padding-top: 10upx;
- background-color: #FFFFFF;
- width: 400upx;
- height: 50upx;
- box-shadow: 0upx 0upx 20upx #D3D3D3;
- border-radius: 5upx;
- }
- .button {
- margin: auto;
- width: 60%;
- height: 100upx;
- }
- .button1 {
- margin: auto;
- width: 75upx;
- height: 50upx;
- }
- .p {
- /* #ifdef H5 */
- top: -13%;
- /* #endif */
- width: 50upx;
- height: 30upx;
- font-size: 25upx;
- padding-right: 9upx;
- padding-top: 6upx;
- /* #ifndef H5 */
- /* padding-top: 10upx; */
- /* #endif */
- position: absolute;
- /* 水平居中 */
- left: 50%;
- -webkit-transform: translateX(-50%);
- transform: translateX(-50%);
- }
- .p1 {
- /* #ifdef H5 */
- top: -13%;
- /* #endif */
- width: 80upx;
- height: 60upx;
- font-size: 40upx;
- padding-top: 6upx;
- /* #ifndef H5 */
- padding-top: 10upx;
- /* #endif */
- position: absolute;
- /* 水平居中 */
- left: 50%;
- -webkit-transform: translateX(-50%);
- transform: translateX(-50%);
- }
- .radio {
- padding-top: 20upx;
- padding-left: 30upx;
- }
- .lis{
- padding-left: 90upx;
- font-size: 30upx;
- padding-top: 5upx;
- }
- .title {
- padding-left: 20upx;
- font-size: 35upx;
- }
- </style>
|