Browse Source

init

newStyle
lancer 3 years ago
parent
commit
5f71dcc1b6
4 changed files with 280 additions and 127 deletions
  1. +8
    -0
      src/api/modules/api.js
  2. +151
    -111
      src/views/Equipment/index.vue
  3. +119
    -14
      src/views/admin/user/index.vue
  4. +2
    -2
      vue.config.js

+ 8
- 0
src/api/modules/api.js View File

@@ -74,6 +74,14 @@ export function getUserMsg(query) {
params: query params: query
}) })
} }
// 区域回显
export function userAreaFind(query) {
return request({
url: '/admin/user/areaFind',
method: 'get',
params: query
})
}
// 用户批量删除 // 用户批量删除
export function userDelByIds(query) { export function userDelByIds(query) {
return request({ return request({


+ 151
- 111
src/views/Equipment/index.vue View File

@@ -248,7 +248,15 @@
</el-table-column> </el-table-column>
<el-table-column prop="name" label="开机指示灯" align="center"> <el-table-column prop="name" label="开机指示灯" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="name" label="电池电量" align="center">
<el-table-column
prop="name"
label="电池电量"
width="200"
align="center"
>
<template slot-scope="{ row }">
<el-progress :percentage="80" :color="customColors"></el-progress>
</template>
</el-table-column> </el-table-column>
<el-table-column prop="name" label="信号强度" align="center"> <el-table-column prop="name" label="信号强度" align="center">
</el-table-column> </el-table-column>
@@ -282,16 +290,24 @@
<el-button type="text" @click="toinifodelete()">删除</el-button> --> <el-button type="text" @click="toinifodelete()">删除</el-button> -->


<el-dropdown @command="handleCommand"> <el-dropdown @command="handleCommand">
<span style="color:#409eff; font-size:12px;margin-left:10px;">
<span style="color: #409eff; font-size: 12px; margin-left: 10px">
更多<i class="el-icon-arrow-down el-icon--right"></i> 更多<i class="el-icon-arrow-down el-icon--right"></i>
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item command='toinifoThereturn' >归还</el-dropdown-item>
<el-dropdown-item command='infotranscription' >转写开关</el-dropdown-item>
<el-dropdown-item command="toinifoThereturn"
>归还</el-dropdown-item
>
<el-dropdown-item command="infotranscription"
>转写开关</el-dropdown-item
>
<el-dropdown-item command="acceptance">验收</el-dropdown-item> <el-dropdown-item command="acceptance">验收</el-dropdown-item>
<el-dropdown-item command="toinfobinding">绑定</el-dropdown-item>
<el-dropdown-item command="infoeditor">修改</el-dropdown-item>
<el-dropdown-item command="toinifodelete">删除</el-dropdown-item>
<el-dropdown-item command="toinfobinding"
>绑定</el-dropdown-item
>
<el-dropdown-item command="infoeditor">修改</el-dropdown-item>
<el-dropdown-item command="toinifodelete"
>删除</el-dropdown-item
>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</template> </template>
@@ -313,31 +329,28 @@


<el-dialog title="新增设备" :visible.sync="dialogVisible"> <el-dialog title="新增设备" :visible.sync="dialogVisible">
<el-form <el-form
:model="ruleForm"
:model="addForm"
label-position="labelPosition" label-position="labelPosition"
ref="ruleForm"
label-width="140px"
style="width: 60%; margin: 0 auto"
ref="addForm"
:rules="addRules"
label-width="100px"
> >
<el-form-item label="设备号:" prop="areaName">
<el-input v-model="ruleForm.areaName"></el-input>
<el-form-item label="设备号" prop="imei">
<el-input v-model="addForm.imei" style="width: 80%"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="设备名称:" prop="areaName">
<el-input v-model="ruleForm.areaName"></el-input>
<el-form-item label="转写方式" prop="defaultTransliteration">
<el-radio-group v-model="addForm.defaultTransliteration">
<el-radio label="3">关闭转写</el-radio>
<el-radio label="6">科大讯飞</el-radio>
<el-radio label="9">思必驰</el-radio>
</el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="批次号:" prop="areaName">
<el-select v-model="value" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="楼盘:" prop="areaName">
<el-select v-model="value" placeholder="请选择">
<el-form-item label="批次号" prop="batchId">
<el-select
v-model="addForm.batchId"
style="width: 80%"
placeholder="请选择"
>
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
@@ -347,79 +360,46 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="关联手机号:" prop="areaName">
<el-input v-model="ruleForm.areaName"></el-input>
</el-form-item>
<el-form-item label="设备类型:" prop="areaName">
<el-select v-model="value" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<el-form-item label="备注" prop="remark">
<el-input
type="textarea"
style="width: 80%"
v-model="addForm.remark"
></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button> <el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="add()">保存</el-button>
<el-button type="primary" @click="addEquipment()">保存</el-button>
</div> </div>
</el-dialog> </el-dialog>


<el-dialog title="编辑" :visible.sync="dialogVisible2"> <el-dialog title="编辑" :visible.sync="dialogVisible2">
<el-form <el-form
:model="ruleForm"
:model="editForm"
label-position="labelPosition" label-position="labelPosition"
ref="ruleForm"
ref="editForm"
label-width="140px" label-width="140px"
style="width: 60%; margin: 0 auto"
> >
<el-form-item label="设备号:" prop="areaName">
<el-input v-model="ruleForm.areaName"></el-input>
</el-form-item>
<el-form-item label="设备名称:" prop="areaName">
<el-input v-model="ruleForm.areaName"></el-input>
</el-form-item>
<el-form-item label="批次号:" prop="areaName">
<el-select v-model="value" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="楼盘:" prop="areaName">
<el-select v-model="value" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<el-form-item label="设备号" prop="imei">
<el-input
v-model="editForm.imei"
style="width: 80%"
disabled
></el-input>
</el-form-item> </el-form-item>
<el-form-item label="关联手机号:" prop="areaName">
<el-input v-model="ruleForm.areaName"></el-input>
<el-form-item label="设备状态" prop="acceptanceStatus">
<el-radio-group v-model="editForm.acceptanceStatus">
<el-radio label="0">正常</el-radio>
<el-radio label="1">报损</el-radio>
</el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="设备类型:" prop="areaName">
<el-select v-model="value" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="描述:" prop="areaName">
<el-input type="textarea" v-model="ruleForm.areaName"></el-input>
<el-form-item label="报损原因" prop="desc" v-if="editForm.acceptanceStatus==1">
<el-input
type="textarea"
style="width: 80%"
v-model="editForm.desc"
></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@@ -430,32 +410,39 @@


<el-dialog title="绑定" :visible.sync="dialogVisible3"> <el-dialog title="绑定" :visible.sync="dialogVisible3">
<el-form <el-form
:model="ruleForm"
:model="bindForm"
label-position="labelPosition" label-position="labelPosition"
ref="ruleForm"
label-width="140px"
style="width: 60%; margin: 0 auto"
ref="bindForm"
label-width="100px"
> >
<el-form-item label="用户:" prop="areaName">
<el-select v-model="value" placeholder="请选择">
<el-form-item label="绑定" prop="choic">
<el-radio-group v-model="bindForm.choic">
<el-radio label="3">楼盘</el-radio>
<el-radio label="6">代理商</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="楼盘" prop="houseId">
<el-select
v-model="bindForm.houseId"
style="width: 80%"
placeholder="请选择"
>
<el-option <el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
v-for="item in houseList"
:key="item.id"
:label="item.propertyName"
:value="item.id"
> >
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="设备:" prop="areaName">
<el-input v-model="ruleForm.areaName"></el-input>
</el-form-item>
<el-form-item label="领用时间:" prop="areaName">
<el-date-picker v-model="value" type="date" placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item label="备注:" prop="areaName">
<el-input type="textarea" v-model="ruleForm.areaName"></el-input>

<el-form-item label="备注:" prop="remark">
<el-input
type="textarea"
style="width: 80%"
v-model="bindForm.remark"
></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@@ -617,6 +604,7 @@ export default {
value: "", value: "",
input: "", input: "",
tableData: [], tableData: [],
houseList: [],
dialogVisible: false, dialogVisible: false,
dialogVisible2: false, dialogVisible2: false,
dialogVisible3: false, dialogVisible3: false,
@@ -626,16 +614,45 @@ export default {
areaName: "", areaName: "",
provinceItem: [], provinceItem: [],
}, },
addForm: {
imei: "",
defaultTransliteration: "",
batchId: "",
remark: "",
},
bindForm: {
remark: "",
houseId: "",
choic: "3",
},
editForm: {
imei: "123",
desc: "",
acceptanceStatus: "0",
},
addRules: {
imei: [{ required: true, message: "请填写设备号", trigger: "blur" }],
batchId: { required: true, message: "请选择批次号", trigger: "blur" },
},
multipleSelection: [], multipleSelection: [],
customColors: [
{ color: "#f56c6c", percentage: 20 },
{ color: "#e6a23c", percentage: 40 },
{ color: "#5cb87a", percentage: 60 },
{ color: "#1989fa", percentage: 80 },
{ color: "#6f7ad3", percentage: 100 },
],
}; };
}, },
mounted() { mounted() {
// 获取设备列表 // 获取设备列表
this.equipmentManagement(); this.equipmentManagement();
// 获取楼盘列表
this.zkhousePage();
}, },
methods: { methods: {
handleCommand(e){
this[e]()
handleCommand(e) {
this[e]();
}, },
equipmentManagement() { equipmentManagement() {
this.$api.api this.$api.api
@@ -696,7 +713,12 @@ export default {
}, },
//确认绑定 //确认绑定
binding() { binding() {
this.dialogVisible3 = false;
this.$refs.bindForm.validate((valid) => {
if (valid) {
console.log(this.bindForm);
this.dialogVisible3 = false;
}
});
}, },
//编辑 //编辑
infoeditor() { infoeditor() {
@@ -710,9 +732,27 @@ export default {
infoadd() { infoadd() {
this.dialogVisible = true; this.dialogVisible = true;
}, },
zkhousePage() {
this.$api.api
.findHouseByUser({
orgType: localStorage.getItem("orgType"),
})
.then((res) => {
// console.log(res)
this.houseList = res.data;
// this.searchForm.houseId = res.data[0].id;
// 列表获取
// this.correctFindbypage();
});
},
//确认新增 //确认新增
add() {
this.dialogVisible = false;
addEquipment() {
this.$refs.addForm.validate((valid) => {
if (valid) {
console.log(this.addForm);
// this.dialogVisible = false;
}
});
}, },
//验收 //验收
acceptance() { acceptance() {


+ 119
- 14
src/views/admin/user/index.vue View File

@@ -267,7 +267,7 @@
<el-table-column prop="name" label="用户名"> </el-table-column> <el-table-column prop="name" label="用户名"> </el-table-column>
<el-table-column label="登录手机" prop="username"> </el-table-column> <el-table-column label="登录手机" prop="username"> </el-table-column>
<el-table-column prop="orgName" label="所属组织"> </el-table-column> <el-table-column prop="orgName" label="所属组织"> </el-table-column>
<el-table-column prop="orgType" label="组织类型">
<!-- <el-table-column prop="orgType" label="组织类型">
<template slot-scope="scope"> <template slot-scope="scope">
{{ {{
scope.row.orgType == 0 scope.row.orgType == 0
@@ -276,14 +276,20 @@
? "代理商用户" ? "代理商用户"
: scope.row.orgType == 2 : scope.row.orgType == 2
? "公司用户" ? "公司用户"
: "楼盘用户"
: scope.row.orgType == 3?'楼盘用户'
: ""
}} }}
</template> </template>
</el-table-column>
</el-table-column> -->
<el-table-column prop="orgTypeName" label="组织类型"> </el-table-column>
<el-table-column prop="roleName" label="组织角色"> </el-table-column> <el-table-column prop="roleName" label="组织角色"> </el-table-column>
<el-table-column prop="userRoleTypeName" label="用户身份"> <el-table-column prop="userRoleTypeName" label="用户身份">
</el-table-column> </el-table-column>
<el-table-column prop="createTime" label="状态"> </el-table-column>
<el-table-column label="状态">
<template slot-scope="{ row }">
{{ row.lockFlag == 0 ? "正常" : "禁用" }}
</template>
</el-table-column>
<el-table-column prop="createTime" label="添加时间"> </el-table-column> <el-table-column prop="createTime" label="添加时间"> </el-table-column>
<el-table-column prop="address" label="操作"> <el-table-column prop="address" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
@@ -558,6 +564,7 @@
<div> <div>
<el-table <el-table
:data="housedata" :data="housedata"
ref="multipleTable"
@selection-change="handleSelectionChange1" @selection-change="handleSelectionChange1"
border border
style="width: 100%" style="width: 100%"
@@ -617,7 +624,7 @@
v-for="item1 in managerList" v-for="item1 in managerList"
:key="item1.id" :key="item1.id"
:label="item1.areaName" :label="item1.areaName"
:value="item1.provinceItem"
:value="item1.id"
:disabled="item1.disabled" :disabled="item1.disabled"
> >
</el-option> </el-option>
@@ -704,6 +711,7 @@
<div style="display: flex"> <div style="display: flex">
<div> <div>
<el-select <el-select
v-if="!item.cityAreaList"
v-model="item.areaId" v-model="item.areaId"
clearable clearable
:disabled="item.disabled" :disabled="item.disabled"
@@ -720,6 +728,9 @@
> >
</el-option> </el-option>
</el-select> </el-select>
<div v-else style="line-height: 32px; margin-right: 10px">
{{ item.name }}
</div>
</div> </div>
<el-select <el-select
v-model="item.cityIds" v-model="item.cityIds"
@@ -766,6 +777,7 @@ import { deptRoleList } from "@/api/admin/role";
import { fetchTree } from "@/api/admin/dept"; import { fetchTree } from "@/api/admin/dept";
import { tableOption } from "@/const/crud/admin/user"; import { tableOption } from "@/const/crud/admin/user";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import sidebarItemVue from "../../../page/index/sidebar/sidebarItem.vue";


export default { export default {
name: "SysUser", name: "SysUser",
@@ -895,6 +907,7 @@ export default {
}, },
phoneFlag: false, phoneFlag: false,
rolesOptions: [], rolesOptions: [],
checkHouse: [],
searchMsg: { searchMsg: {
flag: "1", flag: "1",
name: "", //用户名 name: "", //用户名
@@ -1147,6 +1160,8 @@ export default {
this.secondList = []; this.secondList = [];
this.thirdList = []; this.thirdList = [];
this.fourthList = []; this.fourthList = [];
this.bindFlag = "0";
this.provice = [];
this.searchhouseMsg = { this.searchhouseMsg = {
orgName: "", orgName: "",
isSelected: "", isSelected: "",
@@ -1265,6 +1280,7 @@ export default {
this.thirdList = []; this.thirdList = [];
this.fourthList = []; this.fourthList = [];
this.managerStr = []; this.managerStr = [];
this.provice = [];
this.searchhouseMsg = { this.searchhouseMsg = {
propertyName: "", propertyName: "",
isSelected: "", isSelected: "",
@@ -1274,22 +1290,27 @@ export default {
}, },
// 查询楼盘 // 查询楼盘
searchHouse() { searchHouse() {
this.gethouseList()
this.gethouseList();
}, },
// /清空楼盘 // /清空楼盘
resetHouse() { resetHouse() {
this.searchhouseMsg = {
this.searchhouseMsg = {
propertyName: "", propertyName: "",
isSelected: "", isSelected: "",
provinceId: "", provinceId: "",
cityId: "", cityId: "",
}; };
this.gethouseList()
this.provice = [];
this.gethouseList();
}, },
// 绑定楼盘 // 绑定楼盘
addHouse() { addHouse() {
// 楼盘 // 楼盘
if (this.bindFlag == 0) { if (this.bindFlag == 0) {
if (this.checkHouse.length == 0) {
this.houseVisible = false;
return;
}
this.$api.api this.$api.api
.saveHouse({ .saveHouse({
accountId: this.accountId, accountId: this.accountId,
@@ -1298,6 +1319,7 @@ export default {
}) })
.then((res) => { .then((res) => {
console.log(res); console.log(res);
this.houseVisible = false;
}); });
} else { } else {
// 省市json串 // 省市json串
@@ -1337,6 +1359,10 @@ export default {
areaJsonString.push(obj); areaJsonString.push(obj);
}); });
} }
if (areaJsonString.length == 0) {
this.houseVisible = false;
return;
}
// console.log(areaJsonString,areaIds,'数据') // console.log(areaJsonString,areaIds,'数据')
// return // return
this.$api.api this.$api.api
@@ -1348,9 +1374,10 @@ export default {
}) })
.then((res) => { .then((res) => {
console.log(res); console.log(res);
this.houseVisible = false;
}); });
} }
this.houseVisible = false;
this.roleList(); this.roleList();
}, },
// 楼盘绑定解绑 // 楼盘绑定解绑
@@ -1415,6 +1442,17 @@ export default {
this.code = row; this.code = row;
this.accountId = row.accountId; this.accountId = row.accountId;
this.houseVisible = true; this.houseVisible = true;
// 判断是否有绑定以及绑定方式
// console.log(row.selectHouseType)
if (row.selectHouseType == 1) {
console.log("这里是单个楼盘勾选");
this.bindFlag = "0";
}
if (row.selectHouseType == 2) {
this.bindFlag = "1";
console.log("这里是区域选择");
this.userAreaFind(row.accountId, row.username);
}
this.gethouseList(); this.gethouseList();
// 获取区域列表 // 获取区域列表
this.areamanagerList(); this.areamanagerList();
@@ -1422,6 +1460,60 @@ export default {
// console.log(await this.getValueByCondition(0)) // console.log(await this.getValueByCondition(0))
this.allCityList = await this.getValueByCondition(0); this.allCityList = await this.getValueByCondition(0);
}, },
userAreaFind(accountId, username) {
this.$api.api
.userAreaFind({
accountId,
username,
})
.then((res) => {
console.log(res);
if (res.data.flag == "true") {
// 区域
// 给区域多选赋值,同时列表渲染给第一个数组firstList
this.managerStr = [];
res.data.user.areaIds.split(",").map((item) => {
this.managerStr.push(item / 1);
});
this.firstList = res.data.area;
this.firstList.map((item) => {
let arr = [];
if (item.cityIds == "empty") {
return;
} else {
item.cityIds = item.cityIds.split(",").map(Number);
}

// console.log(arr);
});
} else {
// 当不是区域的时候
// 数据由于最后的判断原因应该给fourthlist
this.fourthList = res.data.area;
this.fourthList.map((item) => {
// let arr = [];
item.areaId = item.id;
if (item.cityIds == "empty") {
// 为所有,不做任何操作
} else {
item.cityIds = item.cityIds.split(",").map(Number);
console.log(item.cityIds);
// item.arr = item.cityAreaList;
}
item.arr = item.cityAreaList;
// 再次对数据allCityList数据进行禁用处理
let num = this.allCityList.findIndex(
(item1) => item1.id == item.areaId
);
if (num != -1) {
// this.secondList.splice(num,1)
this.allCityList[num].disabled = true;
}
// console.log(arr);
});
}
});
},
// 获取区域 // 获取区域
areamanagerList() { areamanagerList() {
this.$api.api this.$api.api
@@ -1442,12 +1534,26 @@ export default {
orgCode: this.orgCode, orgCode: this.orgCode,
current: this.page1.current, current: this.page1.current,
pageSize: this.page1.pageSize, pageSize: this.page1.pageSize,
...this.searchhouseMsg
...this.searchhouseMsg,
}) })
.then((res) => { .then((res) => {
// console.log(res) // console.log(res)
this.page1.total = res.data.total; this.page1.total = res.data.total;
this.housedata = res.data.records; this.housedata = res.data.records;
let arr = [];
res.data.records.map((item) => {
if (item.isSelected == 0) {
arr.push(item);
}
});
// console.log(arr,'123');
if (arr.length != 0 && this.bindFlag == 0) {
setTimeout(() => {
arr.map((item) => {
this.$refs.multipleTable.toggleRowSelection(item);
});
}, 50);
}
}); });
}, },
// 获取用户信息 // 获取用户信息
@@ -1515,10 +1621,9 @@ export default {
this.form.houseIdList = this.houseIdList.join(","); this.form.houseIdList = this.houseIdList.join(",");
this.form.userRoleId = res.data.role.roleId; this.form.userRoleId = res.data.role.roleId;
this.form.userRoleType = res.data.user.userRoleType / 1; this.form.userRoleType = res.data.user.userRoleType / 1;
this.form.deptId = res.data.org.id;
this.form.deptId = res.data.user.id;
this.form.deptName = res.data.org.name; this.form.deptName = res.data.org.name;
// this.roleChange(res.data.org.orgCode) // this.roleChange(res.data.org.orgCode)

console.log(this.form); console.log(this.form);
this.roelFlag = true; this.roelFlag = true;
}); });
@@ -1920,8 +2025,8 @@ export default {
locationsChange(e) { locationsChange(e) {
console.log(e); console.log(e);
if (!e) return; if (!e) return;
this.provinceId = e[0];
this.cityId = e[1];
this.searchhouseMsg.provinceId = e[0];
this.searchhouseMsg.cityId = e[1];
}, },
}, },
}; };


+ 2
- 2
vue.config.js View File

@@ -3,9 +3,9 @@
* https://cli.vuejs.org/zh/config/ * https://cli.vuejs.org/zh/config/
*/ */
// const url = 'http://pigx-gateway' // const url = 'http://pigx-gateway'
// const url = 'http://39.97.167.65:9999' //测试
const url = 'http://39.97.167.65:9999' //测试
// const url = 'http://192.168.31.160:9999' //长龙 // const url = 'http://192.168.31.160:9999' //长龙
const url = 'http://192.168.31.129:9999' //嘉豪
// const url = 'http://192.168.31.129:9999' //嘉豪
// const url = 'http://192.168.31.100:9999' //王笑 // const url = 'http://192.168.31.100:9999' //王笑


const CompressionWebpackPlugin = require('compression-webpack-plugin') const CompressionWebpackPlugin = require('compression-webpack-plugin')


Loading…
Cancel
Save