|
@@ -4,13 +4,13 @@
|
|
<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
|
|
<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
|
|
<el-form :inline="true" :model="filters">
|
|
<el-form :inline="true" :model="filters">
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-input v-model="filters.keyName" placeholder="请输入生产方名称进行搜索" clearable></el-input>
|
|
|
|
|
|
+ <el-input v-model="filters.keyName" size="small" placeholder="请输入机构名称" clearable></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-button type="primary" @click.native="getFactory">查询</el-button>
|
|
|
|
|
|
+ <el-button type="primary" size="small" @click.native="getFactory">查询</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item style="float:right;">
|
|
<el-form-item style="float:right;">
|
|
- <el-button type="primary" @click.native="handleAdd">新增</el-button>
|
|
|
|
|
|
+ <el-button type="primary" size="small" @click.native="handleAdd">新增</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -18,22 +18,11 @@
|
|
<!--列表-->
|
|
<!--列表-->
|
|
<el-table :data="list" highlight-current-row :height="tableHeight" v-loading="listLoading" style="width: 100%;">
|
|
<el-table :data="list" highlight-current-row :height="tableHeight" v-loading="listLoading" style="width: 100%;">
|
|
<el-table-column type="index" width="60"></el-table-column>
|
|
<el-table-column type="index" width="60"></el-table-column>
|
|
- <el-table-column prop="companyName" label="生产方名称" width="250" sortable></el-table-column>
|
|
|
|
- <el-table-column prop="administrator" label="生产方管理员" width="150" sortable>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column prop="relateCompanyList" label="关联资产方" width="400" sortable>
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <span class="info" v-for="(item, index) in scope.row.relateCompanyList">
|
|
|
|
- {{item.companyName}}
|
|
|
|
- <span v-if="index != scope.row.relateCompanyList.length-1">、</span>
|
|
|
|
- </span>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column prop="companyAddress" label="生产方地址" sortable></el-table-column>
|
|
|
|
|
|
+ <el-table-column prop="account" label="账号" sortable></el-table-column>
|
|
|
|
+ <el-table-column prop="roleName" label="机构名称" sortable></el-table-column>
|
|
<el-table-column label="操作" width="150">
|
|
<el-table-column label="操作" width="150">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-button size="small" @click.native="handleEdit(scope.$index, scope.row)">编辑</el-button>
|
|
|
|
- <el-button type="danger" size="small" @click.native.native="handleDel(scope.$index, scope.row)">删除</el-button>
|
|
|
|
|
|
+ <el-button type="danger" size="small" @click.native.native="toDelete(scope.row.id)">删除</el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
@@ -52,91 +41,40 @@
|
|
</el-col>
|
|
</el-col>
|
|
|
|
|
|
<!--新增界面-->
|
|
<!--新增界面-->
|
|
- <el-dialog :title="addTitle" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass='customWidth'>
|
|
|
|
|
|
+ <el-dialog title="新增机构账号" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass='customWidth'>
|
|
<el-form :model="addForm" label-width="100px" :rules="formRules" ref="addForm">
|
|
<el-form :model="addForm" label-width="100px" :rules="formRules" ref="addForm">
|
|
- <el-form-item label="生产方名称" prop="companyName" v-show="addState">
|
|
|
|
- <el-input v-model="addForm.companyName" autocomplete="off" placeholder="请输入生产方名称"></el-input>
|
|
|
|
|
|
+ <el-form-item label="账号" prop="account">
|
|
|
|
+ <el-input v-model="addForm.account" autocomplete="off" placeholder="请输入账号"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="关联资产方" v-show="addState">
|
|
|
|
- <el-select v-model="addForm.companyIds" clearable multiple filterable placeholder="请选择资产方" style="width:533px">
|
|
|
|
- <el-option v-for="item in companys" :key="item.id" :label="item.companyName" :value="item.id">
|
|
|
|
|
|
+ <el-form-item label="教育机构" prop="id">
|
|
|
|
+ <el-select v-model="addForm.id" clearable filterable placeholder="请选择教育机构" style="width:533px">
|
|
|
|
+ <el-option v-for="item in agency" :key="item.id" :label="item.name" :value="item.id">
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="生产方地址" prop="companyAddress" v-show="addState">
|
|
|
|
- <el-input v-model.lazy="addForm.companyAddress" autocomplete="off" @change="changeFactoryArea('addContainer')" placeholder="请输入生产方地址"></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- <div id="addContainer" class="formMap" v-show="addState"></div>
|
|
|
|
- <el-form-item label="姓名" prop="username" v-show="!addState">
|
|
|
|
- <el-input v-model="addForm.username" autocomplete="off" placeholder="请输入姓名"></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="手机号" prop="account" v-show="!addState">
|
|
|
|
- <el-input v-model="addForm.account" autocomplete="off" placeholder="请输入手机号"></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="角色" v-show="!addState">
|
|
|
|
- <el-input v-model="addForm.roleName" autocomplete="off" placeholder="请输入角色名称"></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
</el-form>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
- <span v-if="!addState" style="color:#f00;float:left;margin-left:60px;">初始密码:000000</span>
|
|
|
|
|
|
+ <span style="color:#f00;float:left;margin-left:60px;">初始密码:000000</span>
|
|
<el-button @click.native="addFormVisible = false">取消</el-button>
|
|
<el-button @click.native="addFormVisible = false">取消</el-button>
|
|
- <el-button v-if="addState" type="primary" @click.native="toNext(0)">下一步</el-button>
|
|
|
|
- <el-button v-if="!addState" type="primary" @click.native="toPart(0)">上一步</el-button>
|
|
|
|
- <el-button v-if="!addState" type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button>
|
|
|
|
- </div>
|
|
|
|
- </el-dialog>
|
|
|
|
-
|
|
|
|
- <!--编辑界面-->
|
|
|
|
- <el-dialog title="编辑生产方" v-if="editFormVisible" :visible.sync="editFormVisible" :close-on-click-modal="false" customClass='customWidth'>
|
|
|
|
- <el-form :model="editForm" label-width="100px" :rules="formRules" ref="editForm">
|
|
|
|
- <el-form-item label="生产方名称" prop="companyName">
|
|
|
|
- <el-input v-model="editForm.companyName" autocomplete="off" placeholder="请输入生产方名称"></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="关联资产方">
|
|
|
|
- <el-select v-model="editForm.companyIds" clearable multiple filterable placeholder="请选择资产方" style="width:533px">
|
|
|
|
- <el-option v-for="item in companys" :key="item.id" :label="item.companyName" :value="item.id">
|
|
|
|
- </el-option>
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="生产方地址" prop="companyAddress">
|
|
|
|
- <el-input v-model="editForm.companyAddress" autocomplete="off" :change="changeFactoryArea('editContainer')" placeholder="请输入生产方地址"></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- <div id="editContainer" class="formMap"></div>
|
|
|
|
- </el-form>
|
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
|
- <el-button @click.native="editFormVisible = false">取消</el-button>
|
|
|
|
- <el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button>
|
|
|
|
|
|
+ <el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</section>
|
|
</section>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
- import Vue from 'vue';
|
|
|
|
import util from '../../common/js/util'
|
|
import util from '../../common/js/util'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
- var checkPhone = (rule, value, callback) => {
|
|
|
|
- if (!value) {
|
|
|
|
- return callback(new Error('请输入联系方式'));
|
|
|
|
- } else {
|
|
|
|
- const reg = /^1[0-9]\d{9}$/
|
|
|
|
- if (reg.test(value)) {
|
|
|
|
- callback();
|
|
|
|
- } else {
|
|
|
|
- return callback(new Error('请输入正确的联系方式'));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
return {
|
|
return {
|
|
filters: {
|
|
filters: {
|
|
keyName: ''
|
|
keyName: ''
|
|
},
|
|
},
|
|
-
|
|
|
|
user: JSON.parse(sessionStorage.getItem('user')),
|
|
user: JSON.parse(sessionStorage.getItem('user')),
|
|
- companys:[],
|
|
|
|
- list: [],
|
|
|
|
|
|
+ list: [],
|
|
|
|
+ agency: [],
|
|
|
|
+
|
|
total: 0,
|
|
total: 0,
|
|
page: 1,
|
|
page: 1,
|
|
size: 20,
|
|
size: 20,
|
|
@@ -144,77 +82,45 @@
|
|
tableHeight: 0,
|
|
tableHeight: 0,
|
|
|
|
|
|
formRules: {
|
|
formRules: {
|
|
- companyName: [
|
|
|
|
- { required: true, message: '请输入生产方名称', trigger: 'blur' }
|
|
|
|
|
|
+ account: [
|
|
|
|
+ { required: true, message: '请输入机构账号', trigger: 'blur' }
|
|
],
|
|
],
|
|
- companyAddress: [
|
|
|
|
- { required: true, message: '请输入生产方地址', trigger: 'blur' }
|
|
|
|
- ],
|
|
|
|
- username: [
|
|
|
|
- { required: true, message: '请输入姓名', trigger: 'blur' }
|
|
|
|
- ],
|
|
|
|
- account: [
|
|
|
|
- { required: true, validator: checkPhone, trigger: 'blur'}
|
|
|
|
|
|
+ id: [
|
|
|
|
+ { required: true, message: '请选择所属机构', trigger: ['blur','change'] }
|
|
]
|
|
]
|
|
},
|
|
},
|
|
|
|
|
|
- // 地图
|
|
|
|
- map: '',
|
|
|
|
- marker: '',
|
|
|
|
-
|
|
|
|
// 新增界面
|
|
// 新增界面
|
|
addFormVisible: false,
|
|
addFormVisible: false,
|
|
addLoading: false,
|
|
addLoading: false,
|
|
- addState: true,
|
|
|
|
- addTitle: '新增生产方',
|
|
|
|
addForm: {
|
|
addForm: {
|
|
- companyName: '',
|
|
|
|
- companyType: 1,
|
|
|
|
- companyAddress: '',
|
|
|
|
- yLng: 116.397511,
|
|
|
|
- xLat: 39.907545,
|
|
|
|
- companyIds: [],
|
|
|
|
- username: '',
|
|
|
|
account: '',
|
|
account: '',
|
|
- companyId: '',
|
|
|
|
- roleName: "系统管理员",
|
|
|
|
- flag: 0
|
|
|
|
|
|
+ id: 0,
|
|
},
|
|
},
|
|
-
|
|
|
|
- // 编辑界面
|
|
|
|
- editFormVisible: false,
|
|
|
|
- editLoading: false,
|
|
|
|
- editForm: {
|
|
|
|
- id: 0,
|
|
|
|
- companyName: '',
|
|
|
|
- companyType: 1,
|
|
|
|
- companyAddress: '',
|
|
|
|
- yLng: 0,
|
|
|
|
- xLat: 0,
|
|
|
|
- companyIds: [],
|
|
|
|
- flag: 1
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
// 分页
|
|
// 分页
|
|
handleCurrentChange(val) {
|
|
handleCurrentChange(val) {
|
|
this.page = val;
|
|
this.page = val;
|
|
- this.getFactory();
|
|
|
|
|
|
+ this.getList();
|
|
},
|
|
},
|
|
|
|
|
|
handleSizeChange(val) {
|
|
handleSizeChange(val) {
|
|
this.size = val;
|
|
this.size = val;
|
|
- this.getFactory();
|
|
|
|
|
|
+ this.getList();
|
|
},
|
|
},
|
|
|
|
|
|
//获取基础数据
|
|
//获取基础数据
|
|
- getMsg() {
|
|
|
|
- this.http.post(this.port.base.relationList, {
|
|
|
|
- companyType: 0
|
|
|
|
|
|
+ getList() {
|
|
|
|
+ this.http.post(this.port.system.list, {
|
|
|
|
+ // keyName: this.filters.keyName,
|
|
|
|
+ pageNum: this.page,
|
|
|
|
+ pageSize: this.size,
|
|
}, res => {
|
|
}, res => {
|
|
if (res.code == "ok") {
|
|
if (res.code == "ok") {
|
|
- this.companys = res.data;
|
|
|
|
|
|
+ this.list = res.data.list;
|
|
|
|
+ this.total = res.data.total;
|
|
} else {
|
|
} else {
|
|
this.$message({
|
|
this.$message({
|
|
message: res.msg,
|
|
message: res.msg,
|
|
@@ -229,19 +135,16 @@
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
- //获取列表
|
|
|
|
- getFactory() {
|
|
|
|
- this.listLoading = true;
|
|
|
|
- this.http.post(this.port.base.companyList, {
|
|
|
|
- keyName: this.filters.keyName,
|
|
|
|
- pageNum: this.page,
|
|
|
|
- pageSize: this.size,
|
|
|
|
- companyType: 1
|
|
|
|
- }, res => {
|
|
|
|
- this.listLoading = false;
|
|
|
|
|
|
+ //显示新增界面
|
|
|
|
+ handleAdd() {
|
|
|
|
+ this.http.post(this.port.system.agencyList, {} ,
|
|
|
|
+ res => {
|
|
if (res.code == "ok") {
|
|
if (res.code == "ok") {
|
|
- this.list = res.data.list;
|
|
|
|
- this.total = res.data.total;
|
|
|
|
|
|
+ this.agency = res.data;
|
|
|
|
+ this.addForm = {
|
|
|
|
+ account: '',
|
|
|
|
+ };
|
|
|
|
+ this.addFormVisible = true;
|
|
} else {
|
|
} else {
|
|
this.$message({
|
|
this.$message({
|
|
message: res.msg,
|
|
message: res.msg,
|
|
@@ -249,123 +152,30 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}, error => {
|
|
}, error => {
|
|
- this.listLoading = false;
|
|
|
|
this.$message({
|
|
this.$message({
|
|
message: error,
|
|
message: error,
|
|
type: 'error'
|
|
type: 'error'
|
|
});
|
|
});
|
|
})
|
|
})
|
|
},
|
|
},
|
|
-
|
|
|
|
- //地址输入切换
|
|
|
|
- changeFactoryArea(mapId) {
|
|
|
|
- if(mapId == "addContainer"){
|
|
|
|
- this.markLocation(this.addForm.companyAddress, mapId);
|
|
|
|
- } else {
|
|
|
|
- this.markLocation(this.editForm.companyAddress, mapId);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- toNext(i) {
|
|
|
|
- if(i == 0) {
|
|
|
|
- this.addState = false;
|
|
|
|
- this.addTitle = '新增生产方管理员';
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- toPart(i) {
|
|
|
|
- if(i == 0) {
|
|
|
|
- this.addState = true;
|
|
|
|
- this.addTitle = '新增生产方';
|
|
|
|
- }
|
|
|
|
- var _this = this
|
|
|
|
- setTimeout(function(){ _this.setMap('addContainer'); }, 100);
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- //显示新增界面
|
|
|
|
- handleAdd() {
|
|
|
|
- this.addFormVisible = true;
|
|
|
|
- this.addState = true;
|
|
|
|
- this.addTitle = '新增生产方';
|
|
|
|
- this.addForm = {
|
|
|
|
- companyName: '',
|
|
|
|
- companyAddress: '',
|
|
|
|
- yLng: 116.397511,
|
|
|
|
- xLat: 39.907545,
|
|
|
|
- companyIds: [],
|
|
|
|
- username: '',
|
|
|
|
- account: '',
|
|
|
|
- companyId: '',
|
|
|
|
- roleName: "系统管理员",
|
|
|
|
- flag: 0
|
|
|
|
- };
|
|
|
|
- },
|
|
|
|
|
|
|
|
//新增
|
|
//新增
|
|
addSubmit() {
|
|
addSubmit() {
|
|
this.$refs.addForm.validate((valid) => {
|
|
this.$refs.addForm.validate((valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
this.addLoading = true;
|
|
this.addLoading = true;
|
|
- var str = "";
|
|
|
|
- for(var i in this.addForm.companyIds){
|
|
|
|
- if(i == this.addForm.companyIds.length-1){
|
|
|
|
- str += this.addForm.companyIds
|
|
|
|
- } else {
|
|
|
|
- str += this.addForm.companyIds + ","
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- this.http.post(this.port.base.addCompany, {
|
|
|
|
- companyName: this.addForm.companyName,
|
|
|
|
- companyType: 1,
|
|
|
|
- companyAddress: this.addForm.companyAddress,
|
|
|
|
- yLng: this.addForm.yLng,
|
|
|
|
- xLat: this.addForm.xLat,
|
|
|
|
- companyIds: str,
|
|
|
|
- flag: 0
|
|
|
|
- } , res => {
|
|
|
|
- this.addLoading = false;
|
|
|
|
- if (res.code == "ok") {
|
|
|
|
- this.addPeo(res.data.id);
|
|
|
|
- } else {
|
|
|
|
- this.$message({
|
|
|
|
- message: res.msg,
|
|
|
|
- type: 'error'
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }, error => {
|
|
|
|
- this.addLoading = false;
|
|
|
|
- this.addFormVisible = false;
|
|
|
|
- this.$message({
|
|
|
|
- message: error,
|
|
|
|
- type: 'error'
|
|
|
|
- });
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- //添加人员
|
|
|
|
- addPeo(companyId) {
|
|
|
|
- this.$refs.addForm.validate((valid) => {
|
|
|
|
- if (valid) {
|
|
|
|
- this.http.post(this.port.project.addUser, {
|
|
|
|
- username: this.addForm.username,
|
|
|
|
|
|
+ this.http.post(this.port.system.addAccount, {
|
|
account: this.addForm.account,
|
|
account: this.addForm.account,
|
|
- companyId: companyId,
|
|
|
|
- roleName: this.addForm.roleName,
|
|
|
|
- parentId: this.user.id,
|
|
|
|
- addType: 0,
|
|
|
|
- flag: 0
|
|
|
|
|
|
+ id: this.addForm.id,
|
|
} , res => {
|
|
} , res => {
|
|
this.addLoading = false;
|
|
this.addLoading = false;
|
|
|
|
+ this.addFormVisible = false;
|
|
if (res.code == "ok") {
|
|
if (res.code == "ok") {
|
|
- this.addFormVisible = false;
|
|
|
|
this.$message({
|
|
this.$message({
|
|
- message: '创建成功',
|
|
|
|
- type: 'success'
|
|
|
|
|
|
+ message: "添加成功",
|
|
|
|
+ type: "success"
|
|
});
|
|
});
|
|
- this.getFactory();
|
|
|
|
|
|
+ this.getList();
|
|
} else {
|
|
} else {
|
|
this.$message({
|
|
this.$message({
|
|
message: res.msg,
|
|
message: res.msg,
|
|
@@ -383,21 +193,21 @@
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
-
|
|
|
|
- //删除
|
|
|
|
- handleDel(index, row) {
|
|
|
|
- this.$confirm('确认删除该生产方吗?', '提示', {
|
|
|
|
|
|
+
|
|
|
|
+ //删除
|
|
|
|
+ toDelete(id) {
|
|
|
|
+ this.$confirm('确认删除机构用户?', '提示', {
|
|
type: 'warning'
|
|
type: 'warning'
|
|
}).then(() => {
|
|
}).then(() => {
|
|
- this.http.post(this.port.base.delCompany, {
|
|
|
|
- id: row.id
|
|
|
|
|
|
+ this.http.post(this.port.system.delAccount, {
|
|
|
|
+ id: id
|
|
}, res => {
|
|
}, res => {
|
|
if (res.code == "ok") {
|
|
if (res.code == "ok") {
|
|
this.$message({
|
|
this.$message({
|
|
message: '删除成功',
|
|
message: '删除成功',
|
|
type: 'success'
|
|
type: 'success'
|
|
});
|
|
});
|
|
- this.getFactory();
|
|
|
|
|
|
+ this.getList();
|
|
} else {
|
|
} else {
|
|
this.$message({
|
|
this.$message({
|
|
message: res.msg,
|
|
message: res.msg,
|
|
@@ -412,158 +222,6 @@
|
|
})
|
|
})
|
|
});
|
|
});
|
|
},
|
|
},
|
|
-
|
|
|
|
- //显示编辑界面
|
|
|
|
- handleEdit(index, row) {
|
|
|
|
- this.editFormVisible = true;
|
|
|
|
- var array = [];
|
|
|
|
- for(var i in row.relateCompanyList){
|
|
|
|
- array.push(row.relateCompanyList[i].id)
|
|
|
|
- }
|
|
|
|
- this.editForm = {
|
|
|
|
- id: row.id,
|
|
|
|
- companyName: row.companyName,
|
|
|
|
- companyType: 1,
|
|
|
|
- companyAddress: row.companyAddress,
|
|
|
|
- yLng: row.ylng,
|
|
|
|
- xLat: row.xlat,
|
|
|
|
- companyIds: array,
|
|
|
|
- flag: 1
|
|
|
|
- };
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- //编辑
|
|
|
|
- editSubmit() {
|
|
|
|
- this.$refs.editForm.validate((valid) => {
|
|
|
|
- if (valid) {
|
|
|
|
- this.editLoading = true;
|
|
|
|
- var str = "";
|
|
|
|
- for(var i in this.editForm.companyIds){
|
|
|
|
- if(i == this.editForm.companyIds.length-1){
|
|
|
|
- str += this.editForm.companyIds[i]
|
|
|
|
- } else {
|
|
|
|
- str += this.editForm.companyIds[i] + ","
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- this.http.post(this.port.base.addCompany, {
|
|
|
|
- id: this.editForm.id,
|
|
|
|
- companyName: this.editForm.companyName,
|
|
|
|
- companyType: 1,
|
|
|
|
- companyAddress: this.editForm.companyAddress,
|
|
|
|
- yLng: this.editForm.yLng,
|
|
|
|
- xLat: this.editForm.xLat,
|
|
|
|
- companyIds: str,
|
|
|
|
- flag: 1
|
|
|
|
- } , res => {
|
|
|
|
- this.editLoading = false;
|
|
|
|
- if (res.code == "ok") {
|
|
|
|
- this.editFormVisible = false;
|
|
|
|
- this.$message({
|
|
|
|
- message: '修改成功',
|
|
|
|
- type: 'success'
|
|
|
|
- });
|
|
|
|
- this.getFactory();
|
|
|
|
- } else {
|
|
|
|
- this.$message({
|
|
|
|
- message: res.msg,
|
|
|
|
- type: 'error'
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }, error => {
|
|
|
|
- this.editLoading = false;
|
|
|
|
- this.editFormVisible = false;
|
|
|
|
- this.$message({
|
|
|
|
- message: error,
|
|
|
|
- type: 'error'
|
|
|
|
- });
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- //获取地图
|
|
|
|
- setMap(mapId) {
|
|
|
|
- if(mapId == 'addContainer') {
|
|
|
|
- this.map = new AMap.Map('addContainer', {
|
|
|
|
- resizeEnable: true, // 允许缩放
|
|
|
|
- center:[ this.addForm.yLng , this.addForm.xLat ],
|
|
|
|
- zoom:10
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- this.marker = new AMap.Marker({
|
|
|
|
- map: this.map,
|
|
|
|
- position: new AMap.LngLat(this.addForm.yLng , this.addForm.xLat), // 经纬度
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- this.map = new AMap.Map('editContainer', {
|
|
|
|
- resizeEnable: true, // 允许缩放
|
|
|
|
- center:[this.editForm.yLng , this.editForm.xLat],
|
|
|
|
- zoom:10
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- this.marker = new AMap.Marker({
|
|
|
|
- map: this.map,
|
|
|
|
- position: new AMap.LngLat(this.editForm.yLng , this.editForm.xLat), // 经纬度
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- var _this = this;
|
|
|
|
- this.map.on('click', function(e) {
|
|
|
|
- if(_this.map){
|
|
|
|
- _this.map.remove(_this.marker);
|
|
|
|
- }
|
|
|
|
- var Lng = e.lnglat.getLng(),
|
|
|
|
- Lat = e.lnglat.getLat();
|
|
|
|
- if(mapId == 'addContainer') {
|
|
|
|
- _this.addForm.yLng = Lng;
|
|
|
|
- _this.addForm.xLat = Lat;
|
|
|
|
- } else {
|
|
|
|
- _this.editForm.yLng = Lng;
|
|
|
|
- _this.editForm.xLat = Lat;
|
|
|
|
- }
|
|
|
|
- _this.marker = new AMap.Marker({
|
|
|
|
- map: _this.map,
|
|
|
|
- position: new AMap.LngLat(Lng , Lat), // 经纬度
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- // 获取经纬度
|
|
|
|
- markLocation(address,mapId) {
|
|
|
|
- var _this = this;
|
|
|
|
- AMap.plugin('AMap.Geocoder', function() {
|
|
|
|
- var geocoder = new AMap.Geocoder();
|
|
|
|
- geocoder.getLocation(address, function(status, result) {
|
|
|
|
- if (status === 'complete' && result.info === 'OK') {
|
|
|
|
- // 经纬度
|
|
|
|
- var lng = result.geocodes[0].location.lng;
|
|
|
|
- var lat = result.geocodes[0].location.lat;
|
|
|
|
-
|
|
|
|
- _this.noSub = false;
|
|
|
|
- if(mapId == "addContainer") {
|
|
|
|
- _this.addForm.yLng = lng;
|
|
|
|
- _this.addForm.xLat = lat;
|
|
|
|
- } else {
|
|
|
|
- _this.editForm.yLng = lng;
|
|
|
|
- _this.editForm.xLat = lat;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 添加标记
|
|
|
|
- if(_this.map){
|
|
|
|
- _this.map.remove(_this.marker);
|
|
|
|
- _this.map.setZoomAndCenter(10, [lng, lat]);
|
|
|
|
- _this.marker = new AMap.Marker({
|
|
|
|
- map: _this.map,
|
|
|
|
- position: new AMap.LngLat(lng, lat), // 经纬度
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- //console.log('定位失败!');
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
let height = window.innerHeight;
|
|
let height = window.innerHeight;
|
|
@@ -572,30 +230,12 @@
|
|
window.onresize = function temp() {
|
|
window.onresize = function temp() {
|
|
that.tableHeight = window.innerHeight - 210;
|
|
that.tableHeight = window.innerHeight - 210;
|
|
};
|
|
};
|
|
- },
|
|
|
|
- watch: {
|
|
|
|
- addFormVisible(val) {
|
|
|
|
- if(val){
|
|
|
|
- var _this = this
|
|
|
|
- setTimeout(function(){ _this.setMap('addContainer'); }, 300);
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- editFormVisible(val) {
|
|
|
|
- if(val){
|
|
|
|
- var _this = this
|
|
|
|
- setTimeout(function(){ _this.setMap('editContainer'); }, 300);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
- this.getMsg();
|
|
|
|
- this.getFactory();
|
|
|
|
|
|
+ this.getList();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|
|
- .formMap {
|
|
|
|
- height: 400px;
|
|
|
|
- }
|
|
|
|
</style>
|
|
</style>
|