<template>
|
<view class="page-box">
|
<u-form label-position="top" label-width="120px">
|
<u-form-item label="执法主题">
|
<u-input placeholder="请输入" v-model="form.enforceReason"></u-input>
|
</u-form-item>
|
<u-form-item label="执法对象">
|
<u-input placeholder="请输入" v-model="form.companyName">
|
<template slot="suffix">
|
<text @click="search">搜索</text>
|
</template>
|
</u-input>
|
</u-form-item>
|
<u-form-item label="执法时间" @click="showTimeFun">
|
<u-input placeholder="请输入" v-model="form.applyTime" readonly></u-input>
|
</u-form-item>
|
<u-form-item label="执法类型" @click="showType = true">
|
<u-input placeholder="请输入" v-model="form.enforceTypeName" readonly></u-input>
|
</u-form-item>
|
<u-form-item label="执法内容">
|
<u-input placeholder="请输入" v-model="form.regionReason"></u-input>
|
</u-form-item>
|
<u-form-item label="执法人员">
|
<u-input placeholder="请输入" v-model="form.applyName"></u-input>
|
</u-form-item>
|
<u-form-item label="执法部门">
|
<u-input placeholder="请输入" v-model="form.applyDeptName"></u-input>
|
</u-form-item>
|
<u-form-item label="随行人员数量">
|
<u-input placeholder="请输入" v-model="form.userNum"></u-input>
|
</u-form-item>
|
<u-form-item label="是否通知企业">
|
<u-switch v-model="form.isNoticeCompany" :activeValue="1" :inactiveValue="0"></u-switch>
|
</u-form-item>
|
</u-form>
|
<u-button @click="submitApply">提交申请</u-button>
|
<u-button @click="applyRecord">申请记录</u-button>
|
<u-picker :show="show" @close="show = false" @confirm="confirmSearch" @cancel="show = false" :columns="columns" keyName="companyName"></u-picker>
|
<u-datetime-picker
|
:show="showTime"
|
@close="showTime = false"
|
@cancel="showTime = false"
|
v-model="currentTime"
|
@confirm="confirmTime"
|
:minDate="minDate"
|
mode="dateTime"
|
ref="datetimePicker"
|
class="hide-clear-button"
|
></u-datetime-picker>
|
<u-picker :show="showType" @close="showType = false" @confirm="confirmType" @cancel="showType = false" :columns="columnsType" keyName="dictLabel"></u-picker>
|
|
</view>
|
</template>
|
|
<script>
|
import { orderAdd, companyList } from '@/api/policy.js'
|
import { getInfo } from '@/api/auth.js'
|
import { getDicts } from '@/api/data'
|
export default {
|
data() {
|
return {
|
currentTime: "",
|
form: {
|
executeTime: "",
|
applyName: '',
|
applyDeptName: '',
|
enforceType: 1,
|
isNoticeCompany: 0
|
},
|
show: false,
|
columns: [],
|
showTime: false,
|
columnsType: [],
|
showType: false,
|
minDate: ''
|
}
|
},
|
onLoad() {
|
this.currentTime = this.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss')
|
this.getInfo()
|
this.getDicts()
|
},
|
methods: {
|
getDicts() {
|
getDicts('enforce_type').then(val =>{
|
console.log(val.data.data)
|
this.columnsType = [val.data.data]
|
})
|
},
|
getInfo() {
|
getInfo().then(val => {
|
const value = val.data.data
|
this.form.applyName = value.nickName
|
this.form.applyId = value.userId
|
this.form.applyDeptName = value.dept.deptName
|
this.form.applyDeptId = value.dept.deptId
|
this.form.applyPhone = value.phonenumber
|
})
|
},
|
timeFilter(mode, options) {
|
let d = new Date()
|
// console.log(d.getFullYear());
|
if(mode === 'year'){
|
return options.filter((option)=>option>= d.getFullYear())
|
}
|
if(mode === 'month'){
|
return options.filter((option)=>option>= d.getMonth()+1)
|
}
|
if (mode === 'minute') {
|
return options.filter((option) => option === '00' || option === '30');
|
}
|
return options;
|
},
|
submitApply(){
|
orderAdd(this.form).then(val => {
|
if(val.data.code == 200) {
|
uni.navigateBack()
|
}
|
})
|
},
|
applyRecord() {
|
|
},
|
search() {
|
companyList({companyName: this.form.companyName}).then(val => {
|
if(val.data.code == 200){
|
if(!val.data.rows.length || !val.data.rows){
|
uni.showToast({
|
title: '没有符合的数据,请检查输入的执法对象',
|
icon: 'none',
|
duration: 3000
|
})
|
} else {
|
this.columns = [val.data.rows]
|
this.show = true
|
}
|
|
}
|
})
|
},
|
confirmSearch(e){
|
const value = this.columns[0].find(item => item.companyName == e.value[0].companyName)
|
this.form.companyName = e.value[0].companyName
|
this.form.companyCode = value.companyCode
|
this.form.companyId = value.companyId
|
this.form.companyPhone = value.companyPhone
|
this.form.companyUser = value.companyUser
|
this.form.companyAddress = value.companyAddress
|
this.show = false
|
},
|
confirmTime(e) {
|
// console.log(e.value)
|
this.form.applyTime = e.value
|
this.showTime = false
|
},
|
showTimeFun() {
|
this.showTime = true
|
|
},
|
sheet(){
|
|
},
|
confirmType(e){
|
this.form.enforceType = e.value[0].dictCode
|
this.form.enforceTypeName = e.value[0].dictLabel
|
this.showType = false
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.page-box{
|
padding:0 30rpx;
|
}
|
/deep/ .u-picker__view{
|
|
}
|
</style>
|