123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- <template>
- <view class="">
- <form @submit="addCode">
- <view class="body">
- 名称:<input class="input" placeholder="如:炉头" name="name" :value=name />
- </view>
- <view class="body">
- 编码:<input class="input" name="code" />
- </view>
- <view class="title">配件</view>
- <view class="body2">
- <input class="input" name="flagCode1" />
- </view>
- <view class="body2">
- <input class="input" name="flagCode2" />
- </view>
- <view class="body2">
- <input class="input" name="flagCode3" />
- </view>
- <view class="body2">
- <input class="input" name="flagCode4" />
- </view>
- <view class="body2">
- <input class="input" name="flagCode5" />
- </view>
- <view class="body2">
- <input class="input" name="flagCode6" />
- </view>
- <view class="body2">
- <input class="input" name="flagCode7" />
- </view>
- <view class="body2">
- <input class="input" name="flagCode8" />
- </view>
- <view class="body2">
- <input class="input" name="flagCode9" />
- </view>
- <view class="body2">
- <input class="input" name="flagCode10" />
- </view>
- <view class="body2">
- <input class="input" name="flagCode11" />
- </view>
- <view class="body2">
- <input class="input" name="flagCode12" />
- </view>
- <view class="body2">
- <input class="input" name="flagCode13" />
- </view>
- <view class="body2">
- <input class="input" name="flagCode14" />
- </view>
- <view class="body2">
- <input class="input" name="flagCode15" />
- </view>
- <view class="body">
- 改动内容:<textarea class="input-two" name="remark" />
- </view>
- <view class="">
- <button type="primary" formType="submit" class="button">
- <p class="p">提交</p>
- </button>
- </view>
- </form>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapActions,
- mapMutations
- } from 'vuex'
- export default {
- data() {
- return {
- name: '',
- username: "",
- parm: {
- name: null,
- id: null
- },
- };
- },
- onPullDownRefresh() {},
- onShow() {
- var token = uni.getStorageSync("token");
- if (token.length > 1) {
- var name = uni.getStorageSync("name");
- } else {
- uni.reLaunch({
- url: '../Login/Login',
- });
- }
- },
- onLoad() {
- },
- methods: {
- // ...mapActions('chart', ['updata']),
- addCode(event) {
- const {
- value: code
- } = event.detail;
- //首先获取到表单提交上来的值,此时input的name是不同的,为a0,a1,a2,a3...
- var eValue = event.detail.value;
- let strMap = new Map();
- for (let k of Object.keys(eValue)) {
- strMap.set(k, eValue[k]);
- }
- //将value对象转为map
- var mapValue = strMap;
- //获取list,此处的目的为获取list的长度,并通过循环拼接需要取出的names列表
- var aList = [];
- for(var i = 1;i <=15;i++){
- var ai = "flagCode" + i;
- var a = mapValue.get(ai);
- if(a!=""&&a!=null){
- aList.push(a);
- }
- }
- code.flagCode = aList.toString();
- // console.log(aList);
- this.$store.dispatch('addCode', code)
- .then(_ => {
- uni.showModal({
- title: '提示',
- content: _.message,
- });
- });
- },
- }
- }
- </script>
- <style>
- .body {
- background-color: #FFFFFF;
- padding: 20upx 25upx 20upx 20upx;
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- }
- .body2 {
- background-color: #FFFFFF;
- padding: 20upx 25upx 20upx 20upx;
- padding-left: 100upx;
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- }
- .input {
- /* padding: 10upx 20upx 10upx 0upx; */
- padding-left: 20upx;
- padding-top: 0upx;
- background-color: #FFFFFF;
- width: 500upx;
- height: 50upx;
- box-shadow: 0upx 0upx 20upx #D3D3D3;
- border-radius: 5upx;
- }
- .input-two{
- padding-left: 20upx;
- width: 450upx;
- box-shadow: 0upx 0upx 20upx #D3D3D3;
- border-radius: 5upx;
- }
- .button {
- margin: auto;
- width: 60%;
- height: 100upx;
- }
- .p {
- /* #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%);
- }
- .title {
- padding-left: 20upx;
- font-size: 35upx;
- }
- </style>
|