From 351ef2827d05262218d1e4275535d6d1e8af26c1 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 24 五月 2024 18:15:17 +0800
Subject: [PATCH] 最新版本

---
 admin/src/components/business/OperaCarAuthWindow.vue |  176 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 176 insertions(+), 0 deletions(-)

diff --git a/admin/src/components/business/OperaCarAuthWindow.vue b/admin/src/components/business/OperaCarAuthWindow.vue
index e69de29..5cee43c 100644
--- a/admin/src/components/business/OperaCarAuthWindow.vue
+++ b/admin/src/components/business/OperaCarAuthWindow.vue
@@ -0,0 +1,176 @@
+<template>
+  <GlobalWindow
+      :title="title"
+      width="800px"
+      :visible.sync="visible"
+      :confirm-working="isWorking"
+      @confirm="confirm"
+  >
+    <p class="tip-warn"><i class="el-icon-warning"></i>鎻愰啋锛�<br>
+      1.杞﹁締鏉冮檺閰嶇疆鎴愬姛鍚庯紝鎺堟潈浠诲姟鍗宠繘鍏ユ潈闄愪笅鍙戦槦鍒楋紝鍙墠寰�銆愯溅杈嗘巿鏉冪敵璇疯褰曘�戞煡鐪嬩笅鍙戣繘搴�;<br>
+      2.濡傛灉闇�瑕佹竻绌哄綋鍓嶉�変腑浜哄憳涓嬪彂鏉冮檺锛屼互涓嬨�愭巿鏉冨仠杞﹀満銆戜负绌烘彁浜ゅ嵆鍙��
+    </p>
+    <p class="tip" v-if="form.codes != null">姝e湪涓�<em>銆恵{ form.codes.map(item => `${item}`).join('锛�') }}銆�</em> 閰嶇疆鍋滆溅鍦烘潈闄�</p>
+      <el-form :model="form" ref="form" :rules="rules">
+        <el-form-item label="鎺堟潈鏈夋晥鏈燂細" prop="authTimeType" >
+          <el-radio-group v-model="form.authTimeType">
+            <el-radio :label="0">闀挎湡鏈夋晥</el-radio>
+            <el-radio :label="1">鑷畾涔夋椂闂�</el-radio>
+            <el-radio :label="2">璺熼殢杞︿富</el-radio>
+          </el-radio-group>
+          <div v-if="form.authTimeType ==1" style="margin-top: 10px" >
+            <el-date-picker
+                @change="seleTime"
+                v-model="time"
+                type="datetimerange"
+                format="yyyy-MM-dd HH:mm:ss"
+                value-format="yyyy-MM-dd HH:mm:ss"
+                range-separator="鑷�"
+                start-placeholder="寮�濮嬫棩鏈�"
+                end-placeholder="缁撴潫鏃ユ湡">
+            </el-date-picker>
+          </div>
+        </el-form-item>
+        <el-form-item label="閫夋嫨鍋滆溅搴�" prop="parkIdList">
+          <el-select multiple v-model="form.parkIdList" filterable placeholder="璇烽�夋嫨" clearable>
+            <el-option
+                v-for="item in parks"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id">
+            </el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+  </GlobalWindow>
+</template>
+
+<script>
+import BaseOpera from '@/components/base/BaseOpera'
+import GlobalWindow from '@/components/common/GlobalWindow'
+import { findList } from '@/api/business/parks'
+export default {
+  name: 'OperaCarsWindow',
+  extends: BaseOpera,
+  components: { GlobalWindow },
+  data () {
+    var validateTime = (rule, value, callback) => {
+      if (this.form.authTimeType == null) {
+        callback(new Error('璇峰~鍐欐纭殑鎺堟潈鏈夋晥鏈熸椂闂�'))
+        return
+      }
+      if (this.form.authTimeType === 1 && (this.form.startTime == null || this.form.endTime == null)) {
+        callback(new Error('璇峰~鍐欐纭殑鎺堟潈鏈夋晥鏈熸椂闂�'))
+        return
+      }
+      callback()
+    }
+    return {
+      // 琛ㄥ崟鏁版嵁
+      form: {
+        ids: [],
+        codes: [],
+        authTimeType: 0,
+        startTime: null,
+        endTime: null,
+        parkIdList: []
+      },
+      time: null,
+      parks: [],
+      // 楠岃瘉瑙勫垯
+      rules: {
+        authTimeType: [
+          { required: true, validator: validateTime, message: '璇烽�変腑闂ㄧ鏈夋晥鏈�' }
+        ]
+
+      },
+      options: []
+    }
+  },
+  created () {
+    this.config({
+      api: '/business/parkBook',
+      'field.id': 'id'
+    })
+  },
+  methods: {
+    confirm () {
+      this.$refs.form.validate((valid) => {
+        if (!valid) {
+          return
+        }
+        if (this.form.parkIdList == null || this.form.parkIdList.length === 0) {
+          this.$dialog.actionConfirm('鎺堟潈鍋滆溅搴撲负绌猴紝鎻愪氦鍚庡嵆娓呴櫎鎵�閫夎溅杈嗗凡鍒嗛厤鐨勫叏閮ㄦ潈闄�,璇疯皑鎱庢搷浣滐紒', '鎮ㄧ‘璁よ繘琛岃鎿嶄綔鍚楋紵')
+            .then(() => {
+              this.confirmDo()
+            })
+            .catch(() => {})
+        } else {
+          this.confirmDo()
+        }
+      })
+    },
+    confirmDo () {
+      // 璋冪敤鏂板缓鎺ュ彛
+      this.isWorking = true
+      this.api.batchAuth({
+        idList: this.form.ids,
+        authTimeType: this.form.authTimeType,
+        startTime: this.form.startTime,
+        endTime: this.form.endTime,
+        parkIdList: this.form.parkIdList
+      })
+        .then(() => {
+          this.visible = false
+          this.$tip.apiSuccess('鎺堟潈鎴愬姛,鍙墠寰�銆愯溅杈嗘巿鏉冪敵璇疯褰曘�戞煡鐪嬩笅鍙戣繘搴�')
+          this.$emit('success')
+        })
+        .catch(e => {
+          // this.$tip.apiFailed(e)
+        })
+        .finally(() => {
+          this.isWorking = false
+        })
+    },
+    seleTime (e) {
+      if (e && e.length >= 2) {
+        this.form.startTime = e[0]
+        this.form.endTime = e[1]
+      } else {
+        this.form.startTime = null
+        this.form.endTime = null
+      }
+    },
+    open (title, ids, names, companyType) {
+      this.title = title
+      this.visible = true
+      this.companyType = companyType
+      // 鏂板缓
+      this.$nextTick(() => {
+        this.$refs.form.resetFields()
+        this.form[this.configData['field.id']] = null
+        this.form.ids = ids
+        this.form.codes = names
+
+        this.loadParks()
+        console.log(names)
+      })
+    },
+    loadParks () {
+      this.parks = []
+      findList({
+        isdeleted: 0
+      })
+        .then(res => {
+          this.parks = res
+        })
+        .catch(e => {
+          this.$message.error('鍔犺浇鍋滆溅搴撲俊鎭け璐�')
+        })
+        .finally(() => {
+          // this.isWorking = false
+        })
+    }
+  }
+}
+</script>

--
Gitblit v1.9.3