工地字段限制

master
lion 4 years ago
parent 0d1ac6abc8
commit 8304d6bfb0

@ -44,10 +44,10 @@
<u-form-item label="工地编号" label-position="top" prop="number"> <u-form-item label="工地编号" label-position="top" prop="number">
<u-input disabled placeholder="工地编号" v-model="form.number" type="text" :border="true" /> <u-input disabled placeholder="工地编号" v-model="form.number" type="text" :border="true" />
</u-form-item> </u-form-item>
<u-form-item label="建设单位" label-position="top" prop="build_unit"> <u-form-item label="建设单位" label-position="top" prop="build_unit" required>
<u-input placeholder="请填写建设单位" v-model="form.build_unit" type="text" :border="true" /> <u-input required placeholder="请填写建设单位" v-model="form.build_unit" type="text" :border="true" />
</u-form-item> </u-form-item>
<u-form-item label="施工单位" label-position="top" prop="carry_unit"> <u-form-item label="施工单位" label-position="top" prop="carry_unit" required>
<u-input placeholder="请填写施工单位" v-model="form.carry_unit" type="text" :border="true" /> <u-input placeholder="请填写施工单位" v-model="form.carry_unit" type="text" :border="true" />
</u-form-item> </u-form-item>
<u-form-item label="工地类型" label-position="top" prop="type"> <u-form-item label="工地类型" label-position="top" prop="type">
@ -64,6 +64,12 @@
</u-radio> </u-radio>
</u-radio-group> </u-radio-group>
</u-form-item> </u-form-item>
<u-form-item label="联系人" label-position="top" prop="link_name" required>
<u-input required placeholder="请填写联系人" v-model="form.link_name" type="text" :border="true" />
</u-form-item>
<u-form-item label="联系号码" label-position="top" prop="link_mobile">
<u-input placeholder="请填写联系号码" v-model="form.link_mobile" type="text" :border="true" />
</u-form-item>
<u-form-item label="备注" label-position="top" prop="remark"> <u-form-item label="备注" label-position="top" prop="remark">
<u-input placeholder="请填写备注" v-model="form.remark" type='textarea' height='100' :border="true" /> <u-input placeholder="请填写备注" v-model="form.remark" type='textarea' height='100' :border="true" />
</u-form-item> </u-form-item>
@ -122,12 +128,14 @@
<u-form-item label="巡查开始位置" label-position="top"> <u-form-item label="巡查开始位置" label-position="top">
<!-- <text>{{form.address}}</text> --> <!-- <text>{{form.address}}</text> -->
<u-input v-model="form.start_address" placeholder='请选择巡查开始位置' disabled type='text' /> <u-input v-model="form.start_address" placeholder='请选择巡查开始位置' disabled type='text' />
<u-button shape="square" slot='right' size="mini" @click="chooseStartLocation" type="info">重新获取</u-button> <u-button shape="square" slot='right' size="mini" @click="chooseStartLocation" type="info">重新获取
</u-button>
</u-form-item> </u-form-item>
<u-form-item label="巡查结束位置" label-position="top"> <u-form-item label="巡查结束位置" label-position="top">
<!-- <text>{{form.address}}</text> --> <!-- <text>{{form.address}}</text> -->
<u-input v-model="form.end_address" placeholder='请选择巡查结束位置' disabled type='text' /> <u-input v-model="form.end_address" placeholder='请选择巡查结束位置' disabled type='text' />
<u-button shape="square" slot='right' size="mini" @click="chooseEndLocation" type="info">重新获取</u-button> <u-button shape="square" slot='right' size="mini" @click="chooseEndLocation" type="info">重新获取
</u-button>
</u-form-item> </u-form-item>
</block> </block>
@ -139,8 +147,7 @@
<u-select v-model="unusualShow" mode="single-column" value-name="id" label-name="value" <u-select v-model="unusualShow" mode="single-column" value-name="id" label-name="value"
:list="rainArr.unusualList" @confirm="confirmUnusualType"></u-select> :list="rainArr.unusualList" @confirm="confirmUnusualType"></u-select>
</u-form-item> </u-form-item>
<u-form-item label-position="top" label="异常处置建议" <u-form-item label-position="top" label="异常处置建议" prop="tip">
prop="tip">
<u-input v-model="form.tip" type='textarea' height='100' :border="true" /> <u-input v-model="form.tip" type='textarea' height='100' :border="true" />
</u-form-item> </u-form-item>
</block> </block>
@ -167,7 +174,7 @@
</view> </view>
</u-form> </u-form>
<u-button type="primary" @click="submit">提交</u-button> <u-button type="primary" @click="submit">提交</u-button>
<u-toast ref="uToast" />
</view> </view>
</template> </template>
@ -183,7 +190,7 @@
instype: 1, instype: 1,
typeShow: false, typeShow: false,
askShow: false, askShow: false,
unusualShow:false, unusualShow: false,
formshow: true, formshow: true,
lawshow: false, lawshow: false,
showInfoId: false, showInfoId: false,
@ -193,7 +200,7 @@
typeName: "日常雨水设施", typeName: "日常雨水设施",
askName: "", askName: "",
lawName: "", lawName: "",
unusualName:"", unusualName: "",
buildName: "", buildName: "",
confirmText: "确认", confirmText: "确认",
dateparams: { dateparams: {
@ -209,49 +216,49 @@
buildList: [], buildList: [],
lawTypes: [], lawTypes: [],
askContentList: [], askContentList: [],
unusualList:[], unusualList: [],
statuss: [{ statuss: [{
id:1, id: 1,
name: "在建" name: "在建"
}, },
{ {
id:2, id: 2,
name: "完工" name: "完工"
}, },
], ],
rainTypes: [{ rainTypes: [{
id:1, id: 1,
name: "日常雨水设施" name: "日常雨水设施"
}, },
{ {
id:2, id: 2,
name: "在建工地" name: "在建工地"
} }
], ],
scenes: [{ scenes: [{
id:0, id: 0,
name: "否" name: "否"
}, },
{ {
id:1, id: 1,
name: "是" name: "是"
} }
], ],
laws: [{ laws: [{
id:0, id: 0,
name: "否" name: "否"
}, },
{ {
id:1, id: 1,
name: "是" name: "是"
} }
], ],
unusuals: [{ unusuals: [{
id:0, id: 0,
name: "否" name: "否"
}, },
{ {
id:1, id: 1,
name: "是" name: "是"
} }
] ]
@ -271,7 +278,7 @@
address: "", address: "",
longitude: "", longitude: "",
latitude: "", latitude: "",
start_address:"", start_address: "",
start_longitude: "", start_longitude: "",
start_latitude: "", start_latitude: "",
end_address: "", end_address: "",
@ -287,12 +294,11 @@
remark: "", remark: "",
is_law: "", is_law: "",
break_id: "", break_id: "",
mobile_worksheet_id:"", mobile_worksheet_id: "",
build_unit:"", build_unit: "",
carry_unit:"" carry_unit: ""
}, },
rules: { rules: {
}, },
apis: { apis: {
store: [ store: [
@ -363,8 +369,7 @@
let _latlog= that.gcoord.transformFromWGSToGCJ(that.form.latitude,that.form.longitude); let _latlog = that.gcoord.transformFromWGSToGCJ(that.form.latitude, that.form.longitude);
const url = const url =
"https://apis.map.qq.com/ws/geocoder/v1/?key=EUQBZ-MJALU-WZFVR-2HFNW-TIK2K-TNBJI&location=" + "https://apis.map.qq.com/ws/geocoder/v1/?key=EUQBZ-MJALU-WZFVR-2HFNW-TIK2K-TNBJI&location=" +
@ -434,6 +439,8 @@
that.form.address = buildinfo.address; that.form.address = buildinfo.address;
that.form.build_unit = buildinfo.build_unit that.form.build_unit = buildinfo.build_unit
that.form.carry_unit = buildinfo.carry_unit that.form.carry_unit = buildinfo.carry_unit
that.form.link_name = buildinfo.link_name
that.form.link_mobile = buildinfo.link_mobile
for (var m of that.rainArr.buildTypes) { for (var m of that.rainArr.buildTypes) {
if (that.form.type == m.id) { if (that.form.type == m.id) {
that.buildtypeName = m.value that.buildtypeName = m.value
@ -477,14 +484,14 @@
if (val[0].value == 2) { if (val[0].value == 2) {
that.formshow = false that.formshow = false
that.lawshow = false that.lawshow = false
that.form.start_address="" that.form.start_address = ""
that.form.start_longitude="" that.form.start_longitude = ""
that.form.start_latitude="" that.form.start_latitude = ""
that.form.end_address="" that.form.end_address = ""
that.form.end_longitude="" that.form.end_longitude = ""
that.form.end_latitude="" that.form.end_latitude = ""
that.form.ask_content_id="" that.form.ask_content_id = ""
that.askName="" that.askName = ""
} }
if (val[0].value == 1) { if (val[0].value == 1) {
that.loadAskContent() that.loadAskContent()
@ -495,8 +502,7 @@
var that = this; var that = this;
let _latlog= that.gcoord.transformFromWGSToGCJ(that.form.latitude,that.form.longitude); let _latlog = that.gcoord.transformFromWGSToGCJ(that.form.latitude, that.form.longitude);
uni.chooseLocation({ uni.chooseLocation({
longitude: _latlog.longitude, longitude: _latlog.longitude,
latitude: _latlog.latitude, latitude: _latlog.latitude,
@ -507,10 +513,10 @@
} }
}); });
}, },
unusualchange(val){ unusualchange(val) {
console.log(val) console.log(val)
var that = this var that = this
if(val==1){ if (val == 1) {
that.form.start_address = ""; that.form.start_address = "";
that.form.start_longitude = ""; that.form.start_longitude = "";
that.form.start_latitude = ""; that.form.start_latitude = "";
@ -521,7 +527,7 @@
}, },
chooseStartLocation(e) { //打开地图选择位置 chooseStartLocation(e) { //打开地图选择位置
var that = this; var that = this;
let s_latlog= that.gcoord.transformFromWGSToGCJ(that.form.start_latitude,that.form.start_longitude); let s_latlog = that.gcoord.transformFromWGSToGCJ(that.form.start_latitude, that.form.start_longitude);
uni.chooseLocation({ uni.chooseLocation({
longitude: s_latlog.longitude, longitude: s_latlog.longitude,
latitude: s_latlog.latitude, latitude: s_latlog.latitude,
@ -534,7 +540,7 @@
}, },
chooseEndLocation(e) { //打开地图选择位置 chooseEndLocation(e) { //打开地图选择位置
var that = this; var that = this;
let e_latlog= that.gcoord.transformFromWGSToGCJ(that.form.end_latitude,that.form.end_longitude); let e_latlog = that.gcoord.transformFromWGSToGCJ(that.form.end_latitude, that.form.end_longitude);
uni.chooseLocation({ uni.chooseLocation({
longitude: e_latlog.end_longitude, longitude: e_latlog.end_longitude,
@ -662,7 +668,7 @@
}, },
utilSuccess: function(result) { utilSuccess: function(result) {
that.rainArr.askContentList = result.detail that.rainArr.askContentList = result.detail
that.form.ask_content_id = that.rainArr.askContentList[0].id+"" that.form.ask_content_id = that.rainArr.askContentList[0].id + ""
that.askName = that.rainArr.askContentList[0].value that.askName = that.rainArr.askContentList[0].value
}, },
utilFail: function(res) { utilFail: function(res) {
@ -704,7 +710,8 @@
that.form = result.rain_equipment_info; that.form = result.rain_equipment_info;
that.form.rain_equipment_id = result.rain_equipment_id; that.form.rain_equipment_id = result.rain_equipment_id;
that.askName = result.rain_equipment_info.ask_content_detail.value that.askName = result.rain_equipment_info.ask_content_detail.value
that.unusualName = result.rain_equipment_info.unusual_type_detail?result.rain_equipment_info.unusual_type_detail.value:"" that.unusualName = result.rain_equipment_info.unusual_type_detail ? result
.rain_equipment_info.unusual_type_detail.value : ""
that.roadName = result.rain_equipment_info.road ? result.rain_equipment_info that.roadName = result.rain_equipment_info.road ? result.rain_equipment_info
.road.name : "" .road.name : ""
let _files = []; let _files = [];
@ -806,8 +813,26 @@
} }
that.form.files_list = list; that.form.files_list = list;
that.form.files_end_list = deallist; that.form.files_end_list = deallist;
if(that.instype==2){
if(that.form.link_mobile!=""){
let res = /^1[3456789]\d{9}$/
if(!res.test(that.form.link_mobile)){
this.$refs.uToast.show({
title: '请填写正确的11位手机号'
})
return
}
}
if(that.form.name==""||that.form.build_unit==""||that.form.carry_unit==""||that.form.link_name==""||that.form.type==""||that.form.status==""){
this.$refs.uToast.show({
title: '请填写完整信息后提交'
})
return
}
}
console.log(that.form) console.log(that.form)
// return return
let api = ""; let api = "";
if (this.infoId) { if (this.infoId) {
api = this.apis.save[this.instype] api = this.apis.save[this.instype]

Loading…
Cancel
Save