zhouwx
2025-04-18 39868da3de6192d19dfd316c8be1c080b2d3ebe7
src/views/hazardousChemicals/systemManage/config/components/configDialog.vue
@@ -3,7 +3,7 @@
    <el-dialog
        v-model="dialogVisible"
        :title="title"
        width="500px"
        width="600px"
        :before-close="handleClose"
        :close-on-press-escape="false"
        :close-on-click-modal="false"
@@ -44,7 +44,21 @@
            </template>
          </el-upload>
        </el-form-item>
        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="经度:" prop="longitude" label-width="90px">
              <el-input v-model="state.form.longitude"  style="width:165px" />
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="纬度:" prop="latitude" label-width="60px">
              <el-input v-model="state.form.latitude"  style="width:165px"/>
            </el-form-item>
          </el-col>
          <el-col :span="1">
            <img :src="mapPng" class="enterpriseBasicInformation_image" @click="showMapLocation" />
          </el-col>
        </el-row>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
@@ -53,14 +67,18 @@
        </span>
      </template>
    </el-dialog>
    <mapLo ref="mapLocationRef" @giveLatLng="achieveLatLng"></mapLo>
  </div>
</template>
<script setup>
import {reactive, ref, toRefs} from 'vue'
import {ElMessage} from "element-plus";
import mapLo from './mapLocation.vue'
import {addWarehouse, checkName, editWarehouse} from "@/api/hazardousChemicals/warehouse";
import {verifyPhone} from "@/utils/validate";
import {checkBasicName} from "@/api/hazardousChemicals/basicInfo";
import mapPng from '@/assets/images/map.png'
const mapLocationRef = ref()
import {addConfig, editConfig} from "@/api/hazardousChemicals/config";
import {getCompany} from "@/api/hazardousChemicals/company";
import {getToken} from "@/utils/auth";
@@ -77,13 +95,16 @@
    companyId: null,
    companyName: '',
    logoPath: '',
    useProd: 0
    useProd: 0,
    longitude:'',
    latitude: ''
  },
  companyList: [],
  formRules:{
    companyName: [{ required: true, message: '请选择企业', trigger: 'blur' }],
    useProd: [{ required: true, message: '请选择是否使用成品', trigger: 'blur' }],
    longitude:[{ required: true, message: '请填写经度', trigger: 'blur' }],
    latitude:[{ required: true, message: '请填写纬度', trigger: 'blur' }],
  },
  uploadUrl: import.meta.env.VITE_APP_BASE_API + '/system/common/uploadFile',
  header: {
@@ -214,6 +235,9 @@
    })
  }
}
const showMapLocation = () => {
  mapLocationRef.value.openMapLocation(state.form.longitude,state.form.latitude)
}
const handleRemove = async (file, uploadFiles) => {
  let path = state.form.logoPath;
  await delPic({path: path}).then(res => {
@@ -233,11 +257,24 @@
    state.form.logoPath = ''
  });
}
const achieveLatLng=(lng,lat)=>{
  if(lng && lat){
    state.form.longitude = lng
    state.form.latitude = lat
  }else {
    ElMessage.warning('请选择公司经纬度')
  }
}
const reset = () => {
  state.form = {
    id: '',
    name: '',
    remark: '',
    companyId: null,
    companyName: '',
    logoPath: '',
    useProd: 0,
    longitude:'',
    latitude: ''
  }
}
defineExpose({
@@ -256,5 +293,14 @@
    flex-direction: column;
    align-items: flex-start;
  }
  .enterpriseBasicInformation_image{
    cursor: pointer;
    width:30px;
    height:30px;
    margin-left: -35px;
  }
  .enterpriseBasicInformation_input{
    width:100%;
  }
}
</style>