| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <template>
- <view
- class="rotation-wrapper"
- :style="{ height: tktype === 1 ? '176rpx' : '450rpx' }"
- >
- <view class="rotation-item" v-for="(item, index) in list" :key="index">
- <view class="rotation-item__label">{{ item.label }}</view>
- <view class="rotation-item__value">
- <u-number-box
- v-model="item.value"
- :min="1"
- :max="9999"
- maxlength="4"
- @change="() => valChange(item)"
- v-if="item.isNumber"
- ></u-number-box>
- <view class="rotation-item__value__input">
- <u-input
- v-model="item.value"
- type="number"
- maxlength="6"
- :max="999999"
- input-align="right"
- @blur="valChange(item)"
- v-if="!item.isNumber && !item.isSelect"
- />
- <text
- style="margin-left: 16rpx; width: 80rpx"
- v-if="!item.isNumber && !item.isSelect"
- >分钟</text
- >
- </view>
- <view
- v-if="!item.isNumber && item.isSelect"
- class="rotation-item__value__select"
- @click="show = true"
- >
- <text
- style="color: #9ba6a3; margin-right: 16rpx"
- :style="{ color: formData.sfmode ? '#666' : '#9ba6a3' }"
- >{{ selectText }}</text
- >
- <u-icon name="arrow-right" color="#4E5969" size="24rpx"></u-icon>
- </view>
- </view>
- </view>
- <u-action-sheet
- :list="actionSheetList"
- v-model="show"
- @click="actionSheetCallback"
- ></u-action-sheet>
- </view>
- </template>
- <script>
- export default {
- name: 'rotationItem',
- props: {
- formData: {
- type: Object,
- default: () => {},
- },
- tktype: {
- type: Number,
- default: 1,
- },
- },
- watch: {
- tktype: {
- handler(val) {
- if (val !== 1) {
- this.list = [
- {
- label: '轮灌次数',
- isNumber: true,
- value: this.formData['lgcs'] || 1,
- key: 'lgcs',
- },
- {
- label: '轮灌间隔',
- isNumber: false,
- value: this.formData['lgjg'] || '',
- key: 'lgjg',
- },
- {
- label: '肥前水',
- isNumber: false,
- value: this.formData['fqcx'] || '',
- key: 'fqcx',
- },
- {
- label: '肥后水',
- isNumber: false,
- value: this.formData['fhcx'] || '',
- key: 'fhcx',
- },
- {
- label: '模式选择',
- isNumber: false,
- value: this.formData['sfmode'] || '',
- key: 'sfmode',
- isSelect: true,
- },
- ];
- } else {
- this.list = [
- {
- label: '轮灌次数',
- isNumber: true,
- value: this.formData['lgcs'] || 1,
- key: 'lgcs',
- },
- {
- label: '轮灌间隔',
- isNumber: false,
- value: this.formData['lgjg'] || '',
- key: 'lgjg',
- },
- ];
- }
- },
- deep: true,
- immediate: true,
- },
- formData: {
- handler(val) {},
- deep: true,
- immediate: true,
- },
- },
- data() {
- return {
- list: [],
- selectText: '请选择',
- show: false,
- actionSheetList: [
- {
- text: '定时',
- id: 1,
- },
- {
- text: '定量',
- id: 2,
- },
- {
- text: 'EC调配',
- id: 3,
- },
- {
- text: '混肥比例',
- id: 4,
- },
- ],
- };
- },
- methods: {
- valChange(item) {
- this.formData[item.key] = item.value;
- this.$emit('formDataHandler', { key: [item.key], value: item.value });
- },
- actionSheetCallback(index) {
- this.formData['sfmode'] = this.actionSheetList[index].id;
- this.selectText = this.actionSheetList[index].text;
- },
- },
- };
- </script>
- <style scoped lang="scss">
- .rotation-wrapper {
- height: 450rpx;
- border-radius: 16rpx;
- background-color: #ffffff;
- position: relative;
- width: calc(100% - 64rpx);
- margin: 0 32rpx;
- margin-top: 32rpx;
- .rotation-item {
- height: 88rpx;
- width: calc(100% - 32rpx);
- margin: 0 32rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- border-bottom: 4rpx solid #f0f0f0;
- .rotation-item__label {
- width: 50%;
- text-align: left;
- color: #042118;
- font-family: 'Source Han Sans CN VF';
- font-size: 28rpx;
- font-weight: 400;
- }
- .rotation-item__value {
- width: 50%;
- text-align: right;
- padding-right: 16rpx;
- .rotation-item__value__input {
- display: flex;
- align-items: center;
- }
- }
- }
- }
- </style>
|