|
@@ -1,4 +1,5 @@
|
|
|
<template>
|
|
|
+<div>
|
|
|
<ele-form-dialog
|
|
|
v-bind="formConfig"
|
|
|
v-model="formFieldsData"
|
|
@@ -11,41 +12,24 @@
|
|
|
label-position="left"
|
|
|
:dialogAttrs="{ 'close-on-click-modal': false,'top':'8vh'}"
|
|
|
v-if="fresh"
|
|
|
- />
|
|
|
+ >
|
|
|
+ </ele-form-dialog>
|
|
|
+ <bmapModel @sendVal="closeBmapDialog" :bmapModelVisible="bmapVisible" :bmapModelData="bmapModelData" />
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { array } from 'jszip/lib/support';
|
|
|
+import bmapModel from './bmapModel.vue'
|
|
|
export default {
|
|
|
props: ["formModelVisible", "title"],
|
|
|
+ components:{
|
|
|
+ bmapModel
|
|
|
+ },
|
|
|
data() {
|
|
|
- // var validateMaxPressure = (rule, value, callback) => {
|
|
|
- // if ( (value !== '') && (this.formFieldsData.min_pressure !=='')) {
|
|
|
- // var min_pressure = this.formFieldsData.min_pressure - 0;
|
|
|
- // var max_pressure = value - 0;
|
|
|
- // if (min_pressure > max_pressure) {
|
|
|
- // callback(new Error('不能小于最小压力'))
|
|
|
- // } else {
|
|
|
- // callback()
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // callback()
|
|
|
- // }
|
|
|
- // };
|
|
|
- // var validateMinPressure = (rule, value, callback) => {
|
|
|
- // if ( (value !== '') && (this.formFieldsData.max_pressure !=='')) {
|
|
|
- // var max_pressure = this.formFieldsData.max_pressure - 0;
|
|
|
- // var min_pressure = value - 0;
|
|
|
- // if (min_pressure > max_pressure) {
|
|
|
- // callback(new Error('不能大于最大压力'))
|
|
|
- // } else {
|
|
|
- // callback()
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // callback()
|
|
|
- // }
|
|
|
- // };
|
|
|
return {
|
|
|
+ bmapVisible:false,
|
|
|
+ bmapModelData:{},
|
|
|
+ location:{},
|
|
|
formData: {},
|
|
|
fresh:true,
|
|
|
deviceTypes:[],
|
|
@@ -65,6 +49,9 @@ export default {
|
|
|
check_status:"",
|
|
|
status:"",
|
|
|
list:"",
|
|
|
+ address:'',
|
|
|
+ longitude:"",
|
|
|
+ latitude:''
|
|
|
},
|
|
|
url: "hydEquipment",
|
|
|
formConfig: {
|
|
@@ -152,169 +139,31 @@ export default {
|
|
|
options:[],
|
|
|
|
|
|
},
|
|
|
-
|
|
|
- department_id: {
|
|
|
- layout: 12,
|
|
|
- type: "cascader",
|
|
|
- label: "所属部门",
|
|
|
- isOptions: true,
|
|
|
- options: [],
|
|
|
- required: true,
|
|
|
- attrs: {
|
|
|
- props: {
|
|
|
- label: "department_name",
|
|
|
- value: "id",
|
|
|
- emitPath: false,
|
|
|
- checkStrictly: true
|
|
|
- }
|
|
|
- },
|
|
|
- vif(data)
|
|
|
- {
|
|
|
- if(data.equipment_type&&data.equipment_type<5)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- },
|
|
|
- number:{
|
|
|
- layout: 12,
|
|
|
- type: "input",
|
|
|
- label: "编号",
|
|
|
- required:true,
|
|
|
- vif(data)
|
|
|
- {
|
|
|
- if(data.equipment_type&&data.equipment_type<5)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- },
|
|
|
- imei: {
|
|
|
- layout: 12,
|
|
|
- type: "input",
|
|
|
- label: "IMEI号",
|
|
|
- required:true,
|
|
|
- vif(data)
|
|
|
- {
|
|
|
- if(data.equipment_type&&data.equipment_type==2)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- angle_sensor:{
|
|
|
- type: 'switch',
|
|
|
- label: "角度传感器",
|
|
|
- vif(data)
|
|
|
- {
|
|
|
- if(data.equipment_type==3||data.equipment_type==4)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- },
|
|
|
- pressure:{
|
|
|
- layout: 12,
|
|
|
- type: "input",
|
|
|
- label: "压力",
|
|
|
- vif(data)
|
|
|
- {
|
|
|
- if(data.equipment_type==3||data.equipment_type==4)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- },
|
|
|
- torque:{
|
|
|
- layout: 12,
|
|
|
- type: "input",
|
|
|
- label: "扭矩",
|
|
|
- vif(data)
|
|
|
- {
|
|
|
- if(data.equipment_type==3||data.equipment_type==4)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- },
|
|
|
- max_pressure: {
|
|
|
- layout: 12,
|
|
|
- type: "input",
|
|
|
- required: true,
|
|
|
- label: "最大压力",
|
|
|
- vif(data)
|
|
|
- {
|
|
|
- if(data.equipment_type&&data.equipment_type==2)
|
|
|
- {
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- min_pressure: {
|
|
|
- layout: 12,
|
|
|
- type: "input",
|
|
|
- required: true,
|
|
|
- label: "最小压力",
|
|
|
- vif(data)
|
|
|
- {
|
|
|
- if(data.equipment_type&&data.equipment_type==2)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- },
|
|
|
- effective_period: {
|
|
|
+ address:{
|
|
|
layout: 12,
|
|
|
- type: "input",
|
|
|
- required: true,
|
|
|
- label: "有效周期",
|
|
|
- vif(data)
|
|
|
- {
|
|
|
- if(data.equipment_type&&data.equipment_type==2)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
+ type: "input",
|
|
|
+ label: "地址",
|
|
|
+ on:{
|
|
|
+ input: (val) => {
|
|
|
+ this.openBmap();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ vif(data)
|
|
|
+ {
|
|
|
+ if(data.equipment_type&&data.equipment_type==6)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
},
|
|
|
-
|
|
|
- remark: {
|
|
|
- type: "textarea",
|
|
|
- label: "显示信息",
|
|
|
- attrs: {
|
|
|
- autosizeType: "switch",
|
|
|
- autosize: false,
|
|
|
- rows: 2
|
|
|
- },
|
|
|
- vif(data)
|
|
|
- {
|
|
|
- if(data.equipment_type&&data.equipment_type<5)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
},
|
|
|
- order: ['equipment_type','equipment_model',"name","material_number",'issue_unit','fixed_asset_number','fixed_asset_number2',"serial_number",'factory_number','check_last_time','check_next_time','check_status','status',"number","department_id","pressure","pressure","torque",'angle_sensor',"imei","min_pressure","max_pressure", "effective_period","remark"]
|
|
|
+ order: ['equipment_type','equipment_model',"name","material_number",'issue_unit','fixed_asset_number','fixed_asset_number2',"serial_number",'factory_number','check_last_time','check_next_time','check_status','status','address']
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
- this.$http.get("departments").then(response => {
|
|
|
- this.formConfig.formDesc.department_id.options = response.data;
|
|
|
- });
|
|
|
this.$http.get("getHydEquipmentType",{ params: {code:'ToolStatus'} }).then(response => {
|
|
|
this.formConfig.formDesc.status.options = response.data;
|
|
|
});
|
|
@@ -331,36 +180,26 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
|
- //更新内容
|
|
|
- update()
|
|
|
+ openBmap()
|
|
|
+ {
|
|
|
+ if(this.formFieldsData.longitude)
|
|
|
{
|
|
|
- // this.formFieldsData.equipment_type=this.formFieldsData.equipment_type;
|
|
|
-
|
|
|
- if(this.formFieldsData.list)
|
|
|
+ this.bmapModelData={address:this.formFieldsData.address,longitude:this.formFieldsData.longitude,latitude:this.formFieldsData.latitude};
|
|
|
+ }
|
|
|
+ this.bmapVisible = true;
|
|
|
+ },
|
|
|
+ //关闭地图弹窗
|
|
|
+ closeBmapDialog()
|
|
|
+ {
|
|
|
+ if(this.location.lng)
|
|
|
{
|
|
|
- this.formFieldsData.number = this.formFieldsData.list.number;
|
|
|
- this.formFieldsData.remark = this.formFieldsData.list.remark;
|
|
|
- this.formFieldsData.department_id = this.formFieldsData.list.department_id;
|
|
|
- if(this.formFieldsData.equipment_type==2)
|
|
|
- {
|
|
|
- //泵
|
|
|
- this.formFieldsData.imei = this.formFieldsData.list.imei;
|
|
|
- this.formFieldsData.max_pressure= this.formFieldsData.list.max_pressure;
|
|
|
- this.formFieldsData.min_pressure= this.formFieldsData.list.min_pressure;
|
|
|
- this.formFieldsData.effective_period = this.formFieldsData.list.effective_period
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //扳手
|
|
|
- this.formFieldsData.angle_sensor = this.formFieldsData.list.angle_sensor;
|
|
|
- this.formFieldsData.pressure= this.formFieldsData.list.pressure;
|
|
|
- this.formFieldsData.torque= this.formFieldsData.list.torque;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+ this.formFieldsData.address=this.location.address;
|
|
|
+ this.formFieldsData.longitude = this.location.lng;
|
|
|
+ this.formFieldsData.latitude = this.location.lat;
|
|
|
}
|
|
|
-
|
|
|
- },
|
|
|
+ this.bmapVisible = false;
|
|
|
+ },
|
|
|
+ //更新内容
|
|
|
handleFormSubmit(data) {
|
|
|
this.$parent.handleSubmit();
|
|
|
},
|
|
@@ -381,13 +220,7 @@ export default {
|
|
|
this.$emit("sendVal", val); // 表示将子组件改变的值传递给父组件
|
|
|
},
|
|
|
get() {
|
|
|
-
|
|
|
- if(this.formModelVisible)
|
|
|
- {
|
|
|
- this.update();
|
|
|
-
|
|
|
- }
|
|
|
- return this.formModelVisible; // 表示获取父组件的值
|
|
|
+ return this.formModelVisible; // 表示获取父组件的值
|
|
|
}
|
|
|
}
|
|
|
}
|