123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- <template>
- <view class="container_input">
- <view class="container_input_item" v-for="(item, index) in platformClassification" :key="index" @click="selectItem(item)" v-if="!item.DoNotShow">
- <view class="select_and_input" v-if="item.type == 'select' || item.type == 'input' || item.type == 'switch'">
- <view class="container_input_item_label">
- <text class="select_check" :class="{ select: item.select }" @click.stop="selectRadio(item)" v-if="Object.keys(item).indexOf('select') != -1">
- <text v-if="item.select" class="iconfont"></text>
- </text>
- <text class="select_label line1">{{ item.label }}</text>
- </view>
- <view class="container_input_item_value greyColor" v-if="item.type == 'select'">
- <text v-if="item.value" class="text">{{ item.value }}</text>
- <text v-else>{{ item.holder }}</text>
- <text class="iconfont"></text>
- </view>
- <view class="container_input_item_value" v-if="item.type == 'input'">
- <input v-model="formData[item.model]" type="text" value="" :placeholder="item.holder" placeholder-class="inputPlaceHolder" />
- </view>
- <view class="container_input_item_value" v-if="item.type == 'switch'">
- <switch :checked="formData[item.model] == 1" color="#E93323" style="transform:scale(0.8)" @change="switchChange($event, item)" />
- </view>
- </view>
- <view class="radio" v-if="item.type == 'radio' || item.type == 'check'">
- <view class="container_input_item_label">{{ item.label }}</view>
- <view class="container_input_item_value flex_start" v-if="item.type == 'radio'">
- <radio-group class="select_group" @change="radioChange($event, item)">
- <label class="container_input_item_value_select" v-for="(val, i) in item.radioList" :key="val.value">
- <view>
- <radio :value="val.value" :checked="val.value == item.inforValue" />
- </view>
- <view>{{ val.name }}</view>
- </label>
- </radio-group>
- </view>
- <view class="container_input_item_value flex_start" v-if="item.type == 'check'">
- <checkbox-group class="select_group" @change="checkChange($event, item)">
- <label class="container_input_item_value_select" v-for="(val, i) in item.checkList" :key="val.value">
- <view>
- <checkbox class="chenk_list" :value="val.value" :checked="val.value == item.inforValue" />
- </view>
- <view>{{ val.name }}</view>
- </label>
- </checkbox-group>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
-
- export default {
- props: {
- platformClassification: {
- type: Array,
- default() {
- return [];
- }
- },
- form: {
- type: Object,
- default: () => {
- return {};
- }
- }
- },
- data() {
- return {
- value: '',
- formData: this.form
- };
- },
- watch: {
- formData: {
- handler(val) {
- this.$emit('input',val)
- },
- deep: true
- },
- form: {
- handler(val) {
- this.formData = val
- },
- deep: true
- }
- },
- created() {
- this.platformClassification.forEach(item => {
- if(item.inforValue) {
- this.$emit('formInitData', item.inforValue, item.model);
- }
- });
- },
- methods: {
- selectItem(item) {
- if(item.jumpLogic) {
-
- this.$emit('handleJumpLogic', item);
- return;
- }
- this.$emit('handleSelectItem', item);
- },
- radioChange(e, item) {
- this.$emit('radioChange', e.detail.value, item);
- },
-
- switchChange(e, item) {
- this.$emit('switchChange', e.detail.value, item);
- },
-
-
- selectRadio(item) {
- item.select = !item.select;
- },
-
- checkChange(e, item) {
- this.$emit('checkChange', e.detail.value, item);
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .container_input {
- background: #fff;
- padding: 0 20rpx;
- width: 710rpx;
- margin: auto;
- margin-top: 31rpx;
- border-radius: 10rpx;
- &_item {
- .select_and_input {
- height: 106rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- .greyColor {
- color: #bbbbbb;
- }
- }
- .radio {
- padding: 30rpx 0;
- }
- &_label {
- padding-left: 10rpx;
- color: #333333;
- font-size: 30rpx;
- display: flex;
- align-items: center;
- .select_label{
- max-width: 520rpx;
- }
- .select_check {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 40rpx;
- height: 40rpx;
- border: 1px solid #cccccc;
- border-radius: 50%;
- margin-right: 20rpx;
- .iconfont {
- font-size: 24rpx;
- }
- }
- .select {
- background: #e93323;
- border: none;
- .iconfont {
- color: #fff;
- }
- }
- }
- &_value {
- padding-right: 10rpx;
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- > span:nth-child(1) {
- display: inline-block;
- margin-right: 15rpx;
- }
- .text {
- color: #000;
- display: inline-block;
- max-width: 400rpx;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- input {
- text-align: right;
- }
- .select_group {
- display: flex;
- }
- &_select {
- display: flex;
- margin-right: 110rpx;
- }
- }
- .flex_start {
- padding: 0 10rpx;
- margin-top: 40rpx;
- justify-content: flex-start;
- }
- }
- > view:not(:last-child) {
- border-bottom: 1px solid #eeeeee;
- }
- }
- .inputPlaceHolder {
- color: #bbbbbb;
- }
- </style>
|