| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- <template>
- <div v-if="modalFlag">
- <div class="vehicle_servies_modal" @mousewheel="mousewheel">
- <div class="modal_content">
- <div class="time">
- <p>选择时间</p>
- <input type="month" v-model="time" />
- </div>
- <div class="plate">
- <p>选择平台</p>
- <select v-model="selectedForm" @change="slectPlatForm($event)">
- <option v-for="(item, index) in optionList" :key="index">
- {{ item.platformName }}
- </option>
- </select>
- </div>
- <div class="num">
- <p>设置上传数量</p>
- <input type="text" v-model="num" />
- </div>
- <div class="btn">
- <button @click="submit" style="margin: 0">保存</button>
- <button @click="hideModal" style="margin: 0">取消</button>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- props: {
- modalFlag: {
- type: Boolean,
- default: false,
- },
- optionList: {
- type: Array,
- default: () => {
- return [];
- },
- },
- },
- data() {
- return {
- time: "",
- num: 0,
- selectedForm: this.optionList[0]['platformName'],
- platformId: this.optionList[0]['id'],
- };
- },
- methods: {
- submit: function () {
- if (!this.num) {
- alert("请选择上传数量");
- return;
- }
- let num = +this.num;
- if (typeof num !== "number") {
- alert("请输入大于零的数字");
- } else if (num <= 0) {
- alert("请输入大于零的整数");
- } else if (Math.ceil(num) !== num) {
- alert("请输入大于零的整数");
- } else {
- this.$emit("submit", this.time, this.num, this.platformId);
- }
- },
- hideModal: function () {
- this.$emit("hide_modal");
- },
- mousewheel: function (e) {
- e.preventDefault();
- },
- slectPlatForm: function (e) {
- let index = e.target.options.selectedIndex
- this.platformId = this.optionList[index]['id']
- },
- },
- created() {
- console.log(this.optionList);
- }
- };
- </script>
- <style scoped lang="less">
- .vehicle_servies_modal {
- position: fixed;
- left: 0;
- top: 0;
- height: 100vh;
- width: 100vw;
- background-color: rgba(127, 127, 127, 0.7);
- display: flex;
- justify-content: center;
- align-items: center;
- .modal_content {
- width: 600px;
- height: 400px;
- background-color: #fff;
- transform: translateY(-80px);
- padding-left: 240px;
- .time {
- margin-top: 80px;
- display: flex;
- height: 28px;
- p {
- width: 80px;
- height: 28px;
- line-height: 28px;
- margin-right: 20px;
- }
- input {
- height: 28px;
- width: 200px;
- border: 1px solid #ccc;
- color: #555;
- }
- }
- .plate {
- margin-top: 20px;
- margin-right: 20px;
- display: flex;
- p {
- width: 100px;
- }
- select{
- height: 26px;
- width: 144px;
- }
- }
- .num {
- display: flex;
- margin-top: 20px;
- p {
- height: 28px;
- line-height: 28px;
- width: 100px;
- }
- input {
- color: #555;
- height: 28px;
- width: 200px;
- border: 1px solid #ccc;
- }
- }
- .btn {
- width: 200px;
- margin-top: 30px;
- display: flex;
- justify-content: space-between;
- }
- }
- }
- </style>
|