zhangdan 4 лет назад
Родитель
Сommit
9805e41a13

+ 16 - 6
src/config/router.config.js

@@ -286,7 +286,7 @@ export const asyncRouterMap = [{
 	  component: PageView,
 	  meta: {
 	    title: '清运管理',
-	    icon: 'apartment'
+	    icon: 'car'
 	  },
 	  children: [{
 	    path: '/cleanManage/statisticalReport',
@@ -305,7 +305,7 @@ export const asyncRouterMap = [{
 	      '@/views/cleanManage/driverManage.vue'),
 	    meta: {
 	      title: '司机管理',
-	      icon: 'usb'
+	      icon: 'contacts'
 	    }
 	  },
 	  {
@@ -315,7 +315,7 @@ export const asyncRouterMap = [{
 	      '@/views/cleanManage/cleanDetail.vue'),
 	    meta: {
 	      title: '清运明细',
-	      icon: 'block'
+	      icon: "unordered-list"
 	    }
 	  },
 	  {
@@ -325,7 +325,7 @@ export const asyncRouterMap = [{
 	      '@/views/cleanManage/netWorkCleanRecord.vue'),
 	    meta: {
 	      title: '网点清运记录',
-	      icon: 'build'
+	      icon: 'line-chart'
 	    }
 	  },
 	  {
@@ -335,7 +335,7 @@ export const asyncRouterMap = [{
 	      '@/views/cleanManage/notCleanNetwork.vue'),
 	    meta: {
 	      title: '待清运网点',
-	      icon: 'dashboard'
+	      icon: 'cluster'
 	    }
 	  }
 	  ]
@@ -411,6 +411,16 @@ export const asyncRouterMap = [{
         icon: 'credit-card'
         // permission: 'M_lottery_list'
       }
+    },
+    {
+		  path: '/market/luckDrawRecord',
+		  name: 'luckDrawRecord',
+		  component: () => import(/* webpackChunkName: "market" */ '@/views/market/luckDrawRecord.vue'),
+		  meta: {
+		    title: '抽奖记录',
+		    icon: 'profile'
+		    // permission: 'M_lottery_list'
+		  }
     }
     ]
   },
@@ -472,7 +482,7 @@ export const asyncRouterMap = [{
 	    '@/views/equipmentManage/electronicScale/electronicScale.vue'),
 	  meta: {
 	    title: '电子秤管理',
-	    icon: 'usb'
+	    icon: 'dashboard'
 	  }
     },
     {

+ 27 - 40
src/views/cleanManage/addDiverModal.vue

@@ -5,23 +5,23 @@
       :title="titleText"
       v-model="isshow"
       @cancle="cancel"
-      width="40%"
       :centered="true">
-      <a-form-model ref="ruleForm" :model="formData" :rules="rules" :label-col="{ span: 6 }" :wrapper-col="{ span: 16 }">
-        <a-form-model-item label="司机姓名" prop="name">
+      <a-form-model ref="ruleForm" :model="formData" :rules="rules" :label-col="{ span: 6 }" :wrapper-col="{ span: 15 }">
+        <a-form-model-item label="司机姓名" prop="name" ref="name">
           <a-input v-model.trim="formData.name" :maxLength="30" placeholder="请输入司机姓名(最多30个字符)" id="addDiverModal-name"/>
         </a-form-model-item>
-        <a-form-model-item label="手机号码" prop="phone">
-          <a-input v-model.trim="formData.phone" @input="mobileInput" :maxLength="11" placeholder="请输入手机号" id="addDiverModal-phone"/>
+        <a-form-model-item label="手机号码" prop="phone" ref="phone">
+          <a-input v-model.trim="formData.phone" :maxLength="11" placeholder="请输入手机号" id="addDiverModal-phone"/>
         </a-form-model-item>
-        <a-form-model-item label="状态" prop="loginFlag"><a-radio-group
+        <a-form-model-item label="状态" prop="loginFlag"ref="loginFlag"><a-radio-group
           name="radioGroup"
-          v-model="formData.loginFlag" id="addDiverModal-loginFlag"
+          v-model="formData.loginFlag"
+          id="addDiverModal-loginFlag"
         >
           <a-radio :value="1">是</a-radio>
           <a-radio :value="0">否</a-radio>
         </a-radio-group> </a-form-model-item>
-        <a-form-model-item label="" class="btn-cont" :wrapper-col="{ span: 24, offset: 9 }">
+        <a-form-model-item label="" class="btn-cont" :wrapper-col="{ span: 24, offset: 8 }">
           <a-button type="primary" @click="onSubmit" :style="{ marginRight: '15px' }" id="addDiverModal-onSubmit">保存</a-button>
           <a-button @click="cancel" :style="{ marginLeft: '15px' }" id="addDiverModal-cancel">取消</a-button>
         </a-form-model-item>
@@ -59,9 +59,6 @@ export default {
       titleText: '新增',
       isshow: this.visible,
       formLayout: 'horizontal',
-      // form: this.$form.createForm(this, {
-      //   name: 'ruleForm'
-      // }),
       optionData: [],
       formData: {
         name: '',
@@ -69,23 +66,9 @@ export default {
         phone: ''
       },
       rules: {
-        phone: [{
-          required: true,
-		  pattern: /^\d{11}$/,
-          message: '请输入手机号',
-          trigger: 'blur'
-        }],
-        name: [{
-          required: true,
-          message: '请输入司机姓名',
-          trigger: 'blur'
-        }],
-        loginFlag: [{
-          required: true,
-          message: '请选择状态',
-          trigger: 'blur'
-        }]
-      }
+        phone: [{ required: true, pattern: /^\d{11}$/, message: '请输入手机号', trigger: 'blur' }],
+        name: [{ required: true, message: '请输入司机姓名', trigger: 'blur' }],
+        loginFlag: [{ required: true, message: '请选择状态', trigger: 'blur' }] }
     }
   },
   methods: {
@@ -107,20 +90,23 @@ export default {
         option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
       )
     },
+    // 编辑查详情
     getPageInfo () {
       slelerDetails({
         id: this.itemId
       }).then(res => {
         if (res.status == 200) {
           console.log(res, '-------------返回数据')
-          this.form.setFieldsValue({
-            'formData': res.data
-          })
+		  this.formData = Object.assign({}, this.formData, res.data)
+		  this.formData.loginFlag = Number(this.formData.loginFlag)
+		  // this.formData.loginFlag
+		  // console.log(this.formData, '-----------数据')
           // this.form.setFieldsValue({
-          //   'formData.loginFlag': Number(res.data.loginFlag)
+          //   'formData': res.data
           // })
-          // this.form.setFieldsValue({ 'formData.name': res.data.name })
-          // this.form.setFieldsValue({ 'formData.phone': res.data.phone })
+          // this.formData.setFieldsValue({ 'formData.loginFlag': Number(res.data.loginFlag) })
+          // this.formData.setFieldsValue({ 'formData.name': res.data.name })
+          // this.formData.setFieldsValue({ 'formData.phone': res.data.phone })
           // this.form.setFieldsValue({ 'formData.sex': res.data.sex })
           // this.form.setFieldsValue({ 'formData.org.name': res.data.org.name })
           // this.form.setFieldsValue({ 'formData.remarks': res.data.remarks })
@@ -130,7 +116,9 @@ export default {
     // 保存提交
     onSubmit () {
       this.$refs.ruleForm.validate(valid => {
+		  console.log(valid, '--------------提交')
         if (valid) {
+          console.log(valid, '--------------提交', this.formData)
           const params = JSON.parse(JSON.stringify(this.formData))
 				 console.log(params)
           // saveUserPower(formData).then(res => {
@@ -151,26 +139,25 @@ export default {
       this.cancel()
     },
     clear () {
+      this.$refs.ruleForm.resetFields()
       delete this.formData.id
       this.formData.name = ''
       this.formData.loginFlag = ''
       this.formData.phone = ''
     }
   },
-  beforeCreate () {
-    this.form = this.$form.createForm(this, {
-      name: 'miniForm'
-    })
-  },
   watch: {
     visible (newValue, oldValue) {
       this.isshow = newValue
     },
     isshow (val) {
+      console.log(val, '------------弹窗')
       if (!val) {
         this.$emit('close')
       } else {
-        // this.form.resetFields()
+        this.$nextTick(() => {
+          this.$refs.ruleForm.resetFields()
+        })
       }
     },
     itemId (newValue, oldValue) {

+ 1 - 1
src/views/cleanManage/cleanDetail.vue

@@ -63,7 +63,7 @@
       </span>
     </a-table>
     <!-- 详情弹窗 -->
-    <cleanDetailModal :id="itemId" :visible="isOpenModal" @click="isOpenModal=false"></cleanDetailModal>
+    <cleanDetailModal :id="itemId" :visible="isOpenModal" @close="isOpenModal=false"></cleanDetailModal>
   </a-card>
 </template>
 

+ 121 - 114
src/views/cleanManage/cleanModal.vue

@@ -1,121 +1,128 @@
 <template>
-	<div>
-		<a-modal title="确认清运" :footer="null" v-model="isShow" @cancel="isShow=false" centered>
-			<a-form-model ref="ruleForm" :model="queryParam" :rules="rules" :label-col="{span:5}" :wrapper-col="{span:17}">
-				<a-form-model-item label="清运司机" prop="stationNo">
-				  <a-select
-				    placeholder="请选择清运司机"
-				    allowClear
-				    v-model="queryParam.stationNo"
-				    :showSearch="true"
-				    option-filter-prop="children"
-				    :filter-option="filterOption">
-				    <a-select-option v-for="item in optionData" :key="item.stationNo" :value="item.stationNo">{{ item.name }}</a-select-option>
-				  </a-select>
-				</a-form-model-item>
-				<a-form-model-item label="备注">
-					<a-textarea
-					  :maxLength="500"
-					v-model="queryParam.remarks"
-					  style="min-height: 60px;"
-					  placeholder="请输入备注(最多500个字符)"
-					  autoSize />
-				</a-form-model-item>
-				<a-form-model-item :wrapper-col="{ span: 24, offset: 8 }">
-					<a-button type="primary" @click="handleSubmit()" :style="{ marginRight: '15px' }">
-					  保存
-					</a-button>
-					<a-button :style="{ marginLeft: '15px' }" @click="isShow=false" >
-					  取消
-					</a-button>
-				</a-form-model-item>
-			</a-form-model>
-		</a-modal>
-	</div>
-	
+  <div>
+    <a-modal title="确认清运" :footer="null" v-model="isShow" @cancel="cancel" centered>
+      <a-form-model ref="ruleForm" :model="queryParam" :rules="rules" :label-col="{span:5}" :wrapper-col="{span:17}">
+        <a-form-model-item label="清运司机" prop="stationNo">
+          <a-select
+            placeholder="请选择清运司机"
+            allowClear
+            v-model="queryParam.stationNo"
+            :showSearch="true"
+            option-filter-prop="children"
+            :filter-option="filterOption">
+            <a-select-option v-for="item in optionData" :key="item.stationNo" :value="item.stationNo">{{ item.name }}</a-select-option>
+          </a-select>
+        </a-form-model-item>
+        <a-form-model-item label="备注">
+          <a-textarea
+            :maxLength="500"
+            v-model="queryParam.remarks"
+            style="min-height: 60px;"
+            placeholder="请输入备注(最多500个字符)"
+            autoSize />
+        </a-form-model-item>
+        <a-form-model-item :wrapper-col="{ span: 24, offset: 8 }">
+          <a-button type="primary" @click="handleSubmit()" :style="{ marginRight: '15px' }">
+            保存
+          </a-button>
+          <a-button :style="{ marginLeft: '15px' }" @click="isShow=false" >
+            取消
+          </a-button>
+        </a-form-model-item>
+      </a-form-model>
+    </a-modal>
+  </div>
 </template>
 
 <script>
-	import {
-	  stationList
-	} from '@/api/releaseRecord.js'
-	export default{
-		name: 'cleanModal',
-		props: {
-		  visible: {
-		    type: Boolean,
-		    default: false
-		  },
-		  id: {
-		    type: [Number, String],
-		    default: ''
-		  }
-		},
-		data(){
-			return{
-				optionData: [],
-				isShow:this.visible,
-				// form: this.$form.createForm(this, {
-				//   name: 'ruleForm'
-				// }),
-				// 查询参数
-				queryParam: {
-				  stationNo: undefined,
-				  remarks: ''
-				},
-				rules:{stationNo:[{required: true,
-          message: '请输入司机姓名',
-          trigger: 'blur'}]}
-			}
-		},
-		methods:{
-			filterOption (input, option) {
-			  return (
-			    option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-			  )
-			},
-			getStationList () {
-			  stationList().then(res => {
-			    if (res.status == 200) {
-			      this.optionData = res.data || []
-			    }
-			  })
-			},
-			// 保存
-			handleSubmit(){
-				this.$refs.ruleForm.validate(valid => {
-				  if (valid) {
-				    const params = JSON.parse(JSON.stringify(this.queryParam))
-					 console.log(params)
-				    // saveUserPower(formData).then(res => {
-				    //   console.log(res, 'rrrrrrrrr')
-				    //   if (res.status == 200) {
-				    //     _this.$message.success(res.message)
-				    //     _this.$emit('refresh')
-				    //     setTimeout(function () {
-				    //       _this.isshow = false
-				    //     }, 300)
-				    //   }
-				    // })
-				  }
-				})
-			},
-		},
-		watch: {
-		  visible (newValue, oldValue) {
-			  // this.getStationList()
-		    this.isShow = newValue
-	
-		  },
-		  isShow (newValue, oldValue) {
-		  if (!newValue) {
-		    this.$emit('close')
-		  }else{
-			  // this.getStationList()
-		  }
-		  }
-		}
-	}
+import { stationList } from '@/api/releaseRecord.js'
+export default {
+  name: 'CleanModal',
+  props: {
+    visible: {
+      type: Boolean,
+      default: false
+    },
+    id: {
+      type: [Number, String],
+      default: ''
+    }
+  },
+  data () {
+    return {
+      // 司机数据
+      optionData: [],
+      isShow: this.visible,
+      // 查询参数
+      queryParam: {
+        stationNo: undefined,
+        remarks: ''
+      },
+      // 校验规则
+      rules: { stationNo: [{ required: true, message: '请输入司机姓名', trigger: 'blur' }] }
+    }
+  },
+  methods: {
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    getStationList () {
+      stationList().then(res => {
+        if (res.status == 200) {
+          this.optionData = res.data || []
+        }
+      })
+    },
+    // 保存
+    handleSubmit () {
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const params = JSON.parse(JSON.stringify(this.queryParam))
+          console.log(params)
+          // saveUserPower(formData).then(res => {
+          //   console.log(res, 'rrrrrrrrr')
+          //   if (res.status == 200) {
+          //     _this.$message.success(res.message)
+          //     _this.$emit('refresh')
+          //     setTimeout(function () {
+          //       _this.isshow = false
+          //     }, 300)
+          //   }
+          // })
+        }
+      })
+    },
+    // 取消
+    cancel (e) {
+	  this.clear()
+	  this.$emit('close')
+    },
+    // 重置input框
+    clear () {
+      this.$refs.ruleForm.resetFields()
+      delete this.queryParam.id
+      this.queryParam = {
+        stationNo: undefined,
+        remarks: ''
+      }
+    }
+  },
+  watch: {
+    visible (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    isShow (val) {
+      if (!val) {
+		  console.log(val, '--------弹窗状态')
+        this.$emit('close')
+      } else {
+
+      }
+    }
+  }
+}
 </script>
 
 <style>

+ 2 - 1
src/views/cleanManage/driverManage.vue

@@ -32,7 +32,8 @@
       :data="loadData"
       bordered>
       <template slot="loginFlag" slot-scope="text, record">
-        <span :class="record.loginFlag == 0 ? 'red' : record.loginFlag == 1 ? 'green' :'' ">{{ record.loginFlag == 0 ? '禁用' :record.loginFlag == 1 ? '启用' : '--' }}</span>
+        <!-- <span :class="[record.loginFlag == 0 ? 'red' :'green' ]">{{ record.loginFlag == 0 ? '禁用' :record.loginFlag == 1 ? '启用' : '--' }}</span> -->
+        <span :style="{'color': (record.loginFlag == 0 ? 'red' : 'green')}">{{ record.loginFlag == 0 ? '禁用' :record.loginFlag == 1 ? '启用' : '--' }}</span>
       </template>
       <span slot="action" slot-scope="text, record">
         <a-icon

+ 64 - 22
src/views/cleanManage/netWorkCleanModal.vue

@@ -4,27 +4,31 @@
     :footer="null"
     v-model="isShow"
     @cancel="isShow=false"
-    centered
-    width="40%">
+    :centered="true"
+    width="60%">
     <s-table
       ref="table"
       :rowKey="(record) => record.id"
       :columns="columns"
       :data="loadData"
       bordered
-      @change="changeSort">
-      <span slot="action" slot-scope="text,record">
-        <a-button type="primary" @click="handleDetail(record)" id="netWorkCleanModal-handleDetail">查看详情</a-button>
-      </span>
+      :scroll="{ y: 400 }">
     </s-table>
   </a-modal>
 </template>
 
 <script>
-import { STable } from '@/components'
+import {
+  STable
+} from '@/components'
+import {
+  getLuckyWinList
+} from '@/api/luckyDraw.js'
 export default {
   name: 'CleanDetailModal',
-  components: { STable },
+  components: {
+    STable
+  },
   props: {
     visible: {
       type: Boolean,
@@ -38,14 +42,52 @@ export default {
   data () {
     return {
       isShow: this.visible,
-	  columns: [{ title: '序号', dataIndex: 'no', width: 60, align: 'center' },
-	  { title: '清运时间', dataIndex: 'no', width: 100, align: 'center' },
-	  { title: '设备编号', dataIndex: 'no', width: 100, align: 'center' },
-	  { title: '清运重量', dataIndex: 'no', width: 100, align: 'center' },
-	  { title: '清运司机', dataIndex: 'no', width: 100, align: 'center' }],
-	  // 加载数据方法 必须为 Promise 对象
-	  loadData: parameter => {
-	  }
+      columns: [{
+        title: '序号',
+        dataIndex: 'no',
+        width: 60,
+        align: 'center'
+      },
+      {
+        title: '清运时间',
+        dataIndex: 'no',
+        width: 100,
+        align: 'center'
+      },
+      {
+        title: '设备编号',
+        dataIndex: 'no',
+        width: 100,
+        align: 'center'
+      },
+      {
+        title: '清运重量',
+        dataIndex: 'no',
+        width: 100,
+        align: 'center'
+      },
+      {
+        title: '清运司机',
+        dataIndex: 'no',
+        width: 100,
+        align: 'center'
+      }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        const searchData = Object.assign(parameter)
+        return getLuckyWinList(searchData).then(res => {
+          if (res.status == 200) {
+            const no = (res.data.pageNo - 1) * res.data.pageSize
+            for (let i = 0; i < res.data.list.length; i++) {
+              const _item = res.data.list[i]
+              _item.no = no + i + 1
+              _item.status = _item.status + '' === '1'
+            }
+            return res.data
+          }
+        })
+      }
     }
   },
   watch: {
@@ -53,19 +95,19 @@ export default {
       this.isShow = newValue
     },
     isShow (newValue, oldValue) {
-	  if (!newValue) {
-	    this.$emit('close')
-	  }
+      console.log(newValue, oldValue, '----')
+      if (!newValue) {
+        this.$emit('close')
+      }
     }
   }
 }
-
 </script>
 
 <style lang="less" scoped="scoped">
-	.detail-item{
+	.detail-item {
 		text-align: center;
-		margin:10px 0;
+		margin: 10px 0;
 		letter-spacing: 0.5px;
 	}
 </style>

+ 1 - 1
src/views/cleanManage/netWorkCleanRecord.vue

@@ -69,7 +69,7 @@
       </span>
     </a-table>
     <!-- 详情弹窗 -->
-    <netWorkCleanModal :id="itemId" :visible="isOpenModal" @click="isOpenModal=false"></netWorkCleanModal>
+    <netWorkCleanModal :id="itemId" :visible="isOpenModal" @close="isOpenModal=false"></netWorkCleanModal>
   </a-card>
 </template>
 

+ 30 - 30
src/views/cleanManage/notCleanNetwork.vue

@@ -88,22 +88,22 @@
       :data-source="data"
       bordered
       @change="changeSort">
-	  <template slot="customTitle">
-	    <a-tooltip placement="top">
-	      <template slot="title">
-	        <span>当【套餐管理】中的套餐启用时,可在当前页面进行合作商对应套餐的启用和禁用操作。禁用后,该套餐将不能被对应合作商销售。如果【套餐管理】中套餐被禁用,则在当前页面不能进行合作商套餐的启用和禁用操作。</span>
-	      </template>
-	      可回收垃圾库存量(kg)
-	      <a-icon type="question-circle" :style="{ color: '#1890FF' }" />
-	    </a-tooltip>
-	  </template>
-	  <!-- 操作 -->
+      <template slot="customTitle">
+        <a-tooltip placement="top">
+          <template slot="title">
+            <span>1.可回收垃圾库存量:当箱体未清运过时,库存量即投递量;当箱体清运过时,库存量即最近一次清运时间后的投递量。2.红色:表示投递重量最大的分类。</span>
+          </template>
+          可回收垃圾库存量(kg)
+          <a-icon type="question-circle" :style="{ color: '#1890FF' }" />
+        </a-tooltip>
+      </template>
+      <!-- 操作 -->
       <span slot="action" slot-scope="text,record">
         <a-button type="primary" @click="handleDetail(record)">立即清运</a-button>
       </span>
     </a-table>
     <!-- 清运弹窗 -->
-    <cleanModal :id="itemId" :visible="isOpenModal" @click="isOpenModal=false"></cleanModal>
+    <cleanModal :id="itemId" :visible="isOpenModal" @close="isOpenModal=false"></cleanModal>
   </a-card>
 </template>
 
@@ -139,23 +139,23 @@ const columns = [{
   }
 },
 {
-		slots: {title: 'customTitle'},
-          children: [
-            { title: '废旧衣物', width: 100, align: 'center',customRender: (text) => {return text || 0} },
-            { title: '废旧纸张', width: 100, align: 'center',customRender: (text) => {return text || 0} },
-            { title: '废旧塑料', width: 100, align: 'center', customRender: (text) => {return text || 0} },
-            { title: '废旧金属', width: 100, align: 'center', customRender: (text) => {return text || 0} },
-            { title: '废旧金属/塑料', width: 100, align: 'center', customRender: (text) => {return text || 0} },
-            { title: '废旧玻璃', width: 100, align: 'center', customRender: (text) => {return text || 0} },
-            { title: '可回收物', width: 100, align: 'center', customRender: (text) => {return text || 0} }
-          ]
- },
- {
-   title: '可回收垃圾小计(kg)',
-   dataIndex: 'createDate',
-   width: 100,
-   align: 'center',
- },
+  slots: { title: 'customTitle' },
+  children: [
+    { title: '废旧衣物', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
+    { title: '废旧纸张', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
+    { title: '废旧塑料', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
+    { title: '废旧金属', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
+    { title: '废旧金属/塑料', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
+    { title: '废旧玻璃', width: 100, align: 'center', customRender: (text) => { return text || 0 } },
+    { title: '可回收物', width: 100, align: 'center', customRender: (text) => { return text || 0 } }
+  ]
+},
+{
+  title: '可回收垃圾小计(kg)',
+  dataIndex: 'createDate',
+  width: 100,
+  align: 'center'
+},
 {
   title: '最后清运时间',
   dataIndex: 'changjia',
@@ -349,8 +349,8 @@ export default {
     // 查看清运详情
     handleDetail (record) {
       // this.itemId = record.id
-	  this.isOpenModal = true
-      console.log('----------详情')
+      this.isOpenModal = true
+      console.log(this.isOpenModal, '----------详情')
     }
   }
 }

+ 33 - 31
src/views/equipmentManage/electronicScale/addElectronicScale.vue

@@ -41,40 +41,38 @@ export default {
       form: {
         MAC: ''
       },
-	  isShow: this.visible, // 弹框状态
-	  // form: this.$form.createForm(this),
-	  rules: { MAC: [{ required: true, message: '请输入设备MAC码', trigger: 'blur' }] }
+      isShow: this.visible, // 弹框状态
+      rules: { MAC: [{ required: true, message: '请输入设备MAC码', trigger: 'blur' }] }
     }
   },
   methods: {
-	 handleSubmit () {
-		 const _this = this
-		 this.$refs.ruleForm.validate(valid => {
-		   console.log(valid, this.form, ' formData.type222222222')
-		   if (valid) {
-		     const params = JSON.parse(JSON.stringify(this.form))
-		     // 编辑
-		     // if (this.id) {
-		     //   params.deviceTypeBoxList.map(item => {
-		     //     delete item.id
-		     //   })
-		     // }
-		     console.log(params)
-		     // saveBoxSetting(params).then(res => {
-		     //   console.log(res, 'res--save')
-		     //   if (res.status == '200') {
-		     //     this.$message.success(res.message)
-		     //     this.$emit('refresh')
-		     //     setTimeout(function () {
-		     //       _this.cancel()
-		     //     }, 300)
-		     //   } else {
-		     //     // this.$message.error(res.message)
-		     //   }
-		     // })
-		   }
-		 })
-	 }
+    handleSubmit () {
+      this.$refs.ruleForm.validate(valid => {
+        console.log(valid, this.form, ' formData.type222222222')
+        if (valid) {
+          const params = JSON.parse(JSON.stringify(this.form))
+          // 编辑
+          // if (this.id) {
+          //   params.deviceTypeBoxList.map(item => {
+          //     delete item.id
+          //   })
+          // }
+          console.log(params)
+          // saveBoxSetting(params).then(res => {
+          //   console.log(res, 'res--save')
+          //   if (res.status == '200') {
+          //     this.$message.success(res.message)
+          //     this.$emit('refresh')
+          //     setTimeout(function () {
+          //       _this.cancel()
+          //     }, 300)
+          //   } else {
+          //     // this.$message.error(res.message)
+          //   }
+          // })
+        }
+      })
+    }
   },
   computed: {
     modalTit () {
@@ -90,6 +88,10 @@ export default {
     isShow (newValue, oldValue) {
       if (!newValue) {
         this.$emit('close')
+      } else {
+        this.$nextTick(() => {
+          this.$refs.ruleForm.resetFields()
+        })
       }
     }
   }

+ 258 - 0
src/views/market/luckDrawRecord.vue

@@ -0,0 +1,258 @@
+<template>
+  <a-card :bordered="false" class="luckDrawRecord-table-page-search-wrapper">
+    <div class="luckDrawRecord-searchForm">
+      <a-form layout="inline" v-bind="formItemLayout" @keyup.enter.native="$refs.table.refresh(true)">
+        <a-row :gutter="24">
+          <a-col :xs="24" :sm="12" :md="6" :lg="5">
+            <a-form-item label="抽奖时间" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+              <a-range-picker
+                id="luckDrawRecord-time"
+                v-model="time"
+                :format="dateFormat"
+                :placeholder="['开始时间','结束时间']"
+                :disabledDate="disabledDate"
+                @change="onChange" />
+            </a-form-item>
+          </a-col>
+          <a-col :xs="24" :sm="12" :md="6" :lg="5">
+            <a-form-item label="用户账号" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+              <a-input id="luckDrawRecord-customerMobile" allowClear v-model="queryParam.customerMobile" placeholder="请输入用户账号" />
+            </a-form-item>
+          </a-col>
+          <a-col :xs="24" :sm="12" :md="6" :lg="5">
+            <a-form-item label="活动名称" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+              <a-input id="luckDrawRecord-activeName" allowClear v-model="queryParam.activeName" placeholder="请输入活动名称" />
+            </a-form-item>
+          </a-col>
+          <a-col :xs="24" :sm="12" :md="6" :lg="5">
+            <a-form-item label="是否中奖" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+              <v-select
+                v-model="queryParam.state"
+                ref="orderState"
+                id="luckDrawRecord-state"
+                code="PRIZE_WIN_STATE"
+                placeholder="请选择"
+                allowClear></v-select>
+            </a-form-item>
+          </a-col>
+          <a-col :xs="24" :sm="12" :md="6" :lg="4">
+            <a-button class="handle-btn serach-btn" id="luckDrawRecord-btn-serach" type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+            <a-button class="handle-btn serach-btn" type="" id="luckDrawRecord-btn-reset" @click="handleReset">重置</a-button>
+            <a-button class="export-btn" id="luckDrawRecord-btn--export" :loading="loading" v-hasPermission="'B_winingRecord_export'" @click="handleExport">导出</a-button>
+          </a-col>
+        </a-row>
+        <a-row :gutter="20">
+        </a-row>
+      </a-form>
+    </div>
+    <s-table
+      ref="table"
+      size="default"
+      :rowKey="(record) => record.id"
+      :columns="columns"
+      :data="loadData"
+      bordered>
+    </s-table>
+  </a-card>
+</template>
+
+<script>
+import {
+  STable,
+  VSelect
+} from '@/components'
+import {
+  getLuckyWinList
+} from '@/api/luckyDraw.js'
+import moment from 'moment'
+export default {
+  name: 'LuckDrawRecord',
+  components: {
+    STable,
+    VSelect
+  },
+  data () {
+    return {
+      formItemLayout: {
+        labelCol: {
+          span: 6
+        },
+        wrapperCol: {
+          span: 18
+        }
+      },
+      // 查询参数
+      queryParam: {
+        beginDate: null, // 开始时间
+        endDate: null, // 结束时间
+        customerMobile: '', // 用户
+        activeName: '' // 活动名称
+      },
+      loading: false, // 导出loading
+      // 表头
+      columns: [{
+        title: '序号',
+        dataIndex: 'no',
+        width: 80,
+        align: 'center'
+      },
+      {
+        title: '参与抽奖时间',
+        dataIndex: 'winTime',
+        width: 200,
+        align: 'center'
+      },
+      {
+        title: '活动名称',
+        dataIndex: 'activeName',
+        width: 200,
+        align: 'center'
+      },
+      {
+        title: '用户账号',
+        dataIndex: 'customerMobile',
+        width: 200,
+        align: 'center'
+      },
+      {
+        title: '是否中奖',
+        dataIndex: 'stateDictValue',
+        width: 200,
+        align: 'center'
+      }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        const searchData = Object.assign(parameter, this.queryParam)
+        if (this.time && this.time.length) {
+          searchData.beginDate = moment(this.time[0]).format('YYYY-MM-DD 00:00:00')
+          searchData.endDate = moment(this.time[1]).format('YYYY-MM-DD 23:59:59')
+        } else {
+          searchData.beginDate = ''
+          searchData.endDate = ''
+        }
+        return getLuckyWinList(searchData).then(res => {
+          if (res.status == 200) {
+            const no = (res.data.pageNo - 1) * res.data.pageSize
+            for (let i = 0; i < res.data.list.length; i++) {
+              const _item = res.data.list[i]
+              _item.no = no + i + 1
+              _item.status = _item.status + '' === '1'
+            }
+            return res.data
+          }
+        })
+      },
+      // 将默认当天时间日期回显在时间选择框中  抽奖时间
+      time: [],
+      dateFormat: 'YYYY-MM-DD'
+    }
+  },
+  methods: {
+    moment,
+    // 不可选日期
+    disabledDate (date, dateStrings) {
+      return date && date.valueOf() > Date.now()
+    },
+    // 创建时间change
+    onChange (dates, dateStrings) {
+      if ((dates, dateStrings)) {
+        this.queryParam.beginDate = dateStrings[0]
+        this.queryParam.endDate = dateStrings[1]
+      }
+    },
+    // 重置
+    handleReset () {
+      this.queryParam.beginDate = null
+      this.queryParam.endDate = null
+      this.time = []
+      this.queryParam.customerMobile = ''
+      this.queryParam.activeName = ''
+      this.$refs.table.refresh(true)
+    },
+    // 导出
+    handleExport () {
+      const params = this.queryParam
+      if (this.time && this.time.length) {
+        params.beginDate = moment(this.time[0]).format('YYYY-MM-DD 00:00:00')
+        params.endDate = moment(this.time[1]).format('YYYY-MM-DD 23:59:59')
+      } else {
+        params.beginDate = ''
+        params.endDate = ''
+      }
+      if (!params.beginDate && !params.endDate) {
+        this.$message.error('请先选择需要导出的抽奖时间区间再进行导出!')
+        return
+      }
+      // 判断两个时间段是否相差m个月  第二个参数指相差单位,第三个参数指是否返回浮点形式(小数)
+      if (moment(params.endDate).diff(moment(params.beginDate), 'months', true) > 3) {
+        this.$message.error('单次最多只能导出3个月的数据,请缩小查询区间后再进行导出!')
+        return
+      }
+      this.$confirm({
+        title: '提示',
+        content: '导出过程可能需要一段时间,且导出期间不可进行其他操作,确认要导出吗?',
+        onOk: () => {
+          this.loading = true
+          // exportLuckyDrawWin(params).then(res => {
+          //   this.loading = false
+          //   this.download(res)
+          // })
+        },
+        onCancel () {}
+      })
+    },
+    download (data) {
+      if (!data) {
+        return
+      }
+      const url = window.URL.createObjectURL(new Blob([data]))
+      const link = document.createElement('a')
+      link.style.display = 'none'
+      link.href = url
+      // const a = moment().format('YYYY-MM-DD')
+      const a = moment(this.queryParam.beginDate).format('LL') + '-' + moment(this.queryParam.endDate).format('LL')
+      console.log(a)
+      const fname = a + '抽奖记录表'
+      link.setAttribute('download', fname + '.xlsx')
+      document.body.appendChild(link)
+      link.click()
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+	.luckDrawRecord-table-page-search-wrapper {
+		.luckDrawRecord-searchForm {
+			.ant-form-inline .ant-form-item {
+				width: 100%;
+			}
+
+			// 搜索框的下间距
+			.ant-form-item {
+				margin-bottom: 10px;
+			}
+
+			.handle-btn {
+				margin-top: 4px;
+				margin-bottom: 20px;
+			}
+
+			.serach-btn {
+				margin-right: 10px;
+			}
+		}
+
+		.export-btn {
+			background-color: #ff9900;
+			border-color: #ff9900;
+			color: #fff;
+		}
+
+		.export-btn.ant-btn:focus:not(.ant-btn-primary):not(.ant-btn-danger),
+		.export-btn.ant-btn:hover:not(.ant-btn-primary):not(.ant-btn-danger) {
+			color: #fff;
+			border-color: #ff9900;
+		}
+	}
+</style>