| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- <template>
- <view class="operation">
- <view
- class="operation__header"
- :class="
- dourceData.local_model == '1'
- ? 'operation__header--info'
- : 'operation__header--warn'
- "
- >{{ dourceData.name }}
- <view
- :class="
- dourceData.local_model == '1'
- ? 'operation__header--infoing'
- : 'operation__header--warning'
- "
- >
- {{ dourceData.local_model == '1' ? '远程' : '本地' }}
- </view>
- </view>
- <view class="operation__model">
- 模式
- <view class="operation__model--container">
- <view
- class="hand"
- @click="changeClick('hand')"
- :class="{ active: dourceData.run_model == '0' }"
- >手动</view
- >
- <view
- class="auto"
- @click="changeClick('auto')"
- :class="{ active: dourceData.run_model == '1' }"
- >自动</view
- >
- </view>
- </view>
- <view class="operation__body">
- <view class="operation__body-content">
- <view class="operation__body-content--title">展开</view>
- <view class="operation__body-content--desc">
- <u-switch
- :disabled="this.dourceData.local_model == '0'"
- v-model="runStatus"
- active-color="#14A478"
- inactive-color="#C3CAD8"
- size="36"
- ></u-switch>
- </view>
- </view>
- <view class="operation__body-content">
- <view class="operation__body-content--title">收拢</view>
- <view class="operation__body-content--desc">
- <u-switch
- :disabled="this.dourceData.local_model == '0'"
- v-model="closeStatus"
- active-color="#14A478"
- inactive-color="#C3CAD8"
- size="36"
- ></u-switch>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'OperationCard',
- props: {
- dourceData: {
- type: Object,
- default: () => ({}),
- },
- },
- computed: {
- runStatus: {
- get() {
- // 展开
- return this.dourceData.down_status == '1';
- },
- set(val) {
- this.$emit('run-status', this.dourceData);
- },
- },
- closeStatus: {
- get() {
- // 收拢
- return this.dourceData.up_status == '1';
- },
- set(val) {
- this.$emit('close-status', this.dourceData);
- },
- },
- },
- data() {
- return {
- info: 'https://webstaticimg.oss-cn-hangzhou.aliyuncs.com/bigdata_app/image/zhongshui/info.png',
- warning:
- 'https://webstaticimg.oss-cn-hangzhou.aliyuncs.com/bigdata_app/image/zhongshui/warning.png',
- };
- },
- methods: {
- changeClick(type) {
- if (this.dourceData.local_model == '0') {
- return;
- }
- this.$emit('change-click', {
- type,
- dourceData: this.dourceData,
- });
- },
- },
- };
- </script>
- <style scoped lang="scss">
- .operation {
- justify-content: center;
- border-radius: 4px;
- background: #eff2fa;
- margin-bottom: 32rpx;
- position: relative;
- &__header {
- height: 64rpx;
- line-height: 64rpx;
- color: #333333;
- font-family: 'Source Han Sans CN VF';
- font-size: 28rpx;
- font-weight: 500;
- padding: 0 32rpx;
- position: relative;
- &--infoing {
- width: 150rpx;
- height: 56rpx;
- line-height: 50rpx;
- position: absolute;
- right: 0rpx;
- top: 0rpx;
- background: url('https://webstaticimg.oss-cn-hangzhou.aliyuncs.com/bigdata_app/image/zhongshui/info.png')
- no-repeat center center;
- background-size: 100%;
- color: #0085ff;
- text-align: center;
- font-family: 'Source Han Sans CN VF';
- font-size: 28rpx;
- font-weight: 400;
- }
- &--warning {
- width: 150rpx;
- height: 56rpx;
- line-height: 50rpx;
- position: absolute;
- right: 0rpx;
- top: 0rpx;
- background: url('https://webstaticimg.oss-cn-hangzhou.aliyuncs.com/bigdata_app/image/zhongshui/warning.png')
- no-repeat center center;
- background-size: 100%;
- text-align: center;
- font-family: 'Source Han Sans CN VF';
- font-size: 28rpx;
- font-weight: 400;
- color: #eeac19;
- }
- }
- &__header--info {
- background: linear-gradient(180deg, #eff4ff 20.24%, #eff2fa 100%);
- }
- &__header--warn {
- background: linear-gradient(180deg, #fffaef 20.24%, #eff2fa 100%);
- }
- &__model {
- display: flex;
- height: 80rpx;
- align-items: center;
- justify-content: space-between;
- border-radius: 16rpx;
- color: #333333;
- font-family: 'Source Han Sans CN VF';
- font-size: 28rpx;
- font-weight: 500;
- padding: 0 32rpx;
- color: #333333;
- font-family: 'Source Han Sans CN VF';
- font-size: 28rpx;
- margin-top: 16rpx;
- &--container {
- display: flex;
- align-items: center;
- justify-content: space-between;
- width: 164rpx;
- height: 48rpx;
- background: #ffffff;
- border-radius: 8rpx;
- padding: 0 6rpx;
- .hand {
- width: 50%;
- border-radius: 8rpx;
- text-align: center;
- height: 40rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- font-family: 'Source Han Sans CN VF';
- font-size: 24rpx;
- font-weight: 400;
- color: #687a74;
- }
- .auto {
- width: 50%;
- border-radius: 8rpx;
- text-align: center;
- display: flex;
- align-items: center;
- justify-content: center;
- height: 40rpx;
- font-family: 'Source Han Sans CN VF';
- font-size: 24rpx;
- font-weight: 400;
- color: #687a74;
- }
- .active {
- background: #14a478;
- color: #ffffff;
- }
- }
- }
- &__body {
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- grid-gap: 24rpx;
- padding: 30rpx;
- padding-top: 24rpx;
- &-content {
- height: 72rpx;
- background: #ffffff;
- border-radius: 16rpx;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 16rpx;
- }
- }
- }
- </style>
|