update code
parent
40616deade
commit
ecf31c36e3
|
@ -45,3 +45,14 @@ export function delPitConfig(id) {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function findByProjIdDeptId(prjId,deptId){
|
||||||
|
|
||||||
|
let where={
|
||||||
|
projectId:prjId,
|
||||||
|
subDeptId:deptId
|
||||||
|
}
|
||||||
|
return listPitConfig(where);
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container prj-pit-config">
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-form-item label="项目名称" prop="projectId">
|
<el-form-item label="项目名称" prop="projectId">
|
||||||
<el-select v-model="queryParams.projectId" filterable placeholder="请选择项目" clearable
|
<el-select v-model="queryParams.projectId" filterable placeholder="请选择项目" clearable
|
||||||
|
@ -70,13 +70,15 @@
|
||||||
<el-drawer v-if="open" :visible.sync="open" direction="rtl" size="60%" :title="title">
|
<el-drawer v-if="open" :visible.sync="open" direction="rtl" size="60%" :title="title">
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px" style="padding:0px 20px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px" style="padding:0px 20px">
|
||||||
<el-form-item label="项目名称" prop="projectId">
|
<el-form-item label="项目名称" prop="projectId">
|
||||||
<el-select v-model="form.projectId" filterable placeholder="请选择项目" style="width:300px;" clearable @change="doQuerySub('dlg')">
|
<el-select v-model="form.projectId" filterable placeholder="请选择项目" style="width:300px;" clearable
|
||||||
|
@change="doQuerySub('dlg')">
|
||||||
<el-option v-for="(item, index) in projectOptions" :key="index" :label="item.projectName" :value="item.id">
|
<el-option v-for="(item, index) in projectOptions" :key="index" :label="item.projectName" :value="item.id">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="总包单位" prop="subDeptId">
|
<el-form-item label="总包单位" prop="subDeptId">
|
||||||
<el-select v-model="form.subDeptId" filterable placeholder="请选择总包单位" style="width:300px;" clearable>
|
<el-select v-model="form.subDeptId" filterable placeholder="请选择总包单位" style="width:300px;" clearable
|
||||||
|
@change="doQueryCfg">
|
||||||
<el-option v-for="(item, index) in dlgDepts" :key="index" :label="item.deptName" :value="item.deptId">
|
<el-option v-for="(item, index) in dlgDepts" :key="index" :label="item.deptName" :value="item.deptId">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
@ -90,7 +92,7 @@
|
||||||
<el-input v-model="form.identifier" auto-complete="off"></el-input>
|
<el-input v-model="form.identifier" auto-complete="off"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="密码" prop="credential">
|
<el-form-item label="密码" prop="credential">
|
||||||
<el-input v-model="form.credential" ></el-input>
|
<el-input v-model="form.credential"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
@ -99,7 +101,7 @@
|
||||||
</el-switch>
|
</el-switch>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -108,7 +110,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listPitConfig, getPitConfig, delPitConfig, addPitConfig, updatePitConfig } from "@/api/device/pitConfig";
|
import { listPitConfig, getPitConfig, delPitConfig, addPitConfig, updatePitConfig, findByProjIdDeptId } from "@/api/device/pitConfig";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "PitConfig",
|
name: "PitConfig",
|
||||||
|
@ -146,9 +148,21 @@ export default {
|
||||||
isDel: null,
|
isDel: null,
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {
|
||||||
|
projectId:null,
|
||||||
|
subDeptId:null,
|
||||||
|
orgId:'',
|
||||||
|
identifier:'',
|
||||||
|
credential:'',
|
||||||
|
enabled:true
|
||||||
|
},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
|
projectId: [{ required: true, message: "请输入工程编号", trigger: "blur" }],
|
||||||
|
subDeptId: [{ required: true, message: "请输入工程编号", trigger: "blur" }],
|
||||||
|
orgId: [{ required: true, message: "请输入工程编号", trigger: "blur" }],
|
||||||
|
identifier: [{ required: true, message: "请输入用户名", trigger: "blur" }],
|
||||||
|
credential: [{ required: true, message: "请输入密码", trigger: "blur" }],
|
||||||
},
|
},
|
||||||
projectOptions: [],
|
projectOptions: [],
|
||||||
depts: [],
|
depts: [],
|
||||||
|
@ -160,7 +174,17 @@ export default {
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
doQuerySub(type) {
|
doQueryCfg() {
|
||||||
|
if (this.form.projectId && this.form.subDeptId) {
|
||||||
|
findByProjIdDeptId(this.form.projectId, this.form.subDeptId).then(d => {
|
||||||
|
let row = d.rows && d.rows.length > 0 ? d.rows[0] : null;
|
||||||
|
if (row) {
|
||||||
|
this.handleUpdate(row, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
doQuerySub(type, cb) {
|
||||||
let prjId = type == "query" ? this.queryParams.projectId : this.form.projectId;
|
let prjId = type == "query" ? this.queryParams.projectId : this.form.projectId;
|
||||||
if (!prjId) {
|
if (!prjId) {
|
||||||
if (type == "query") {
|
if (type == "query") {
|
||||||
|
@ -170,6 +194,7 @@ export default {
|
||||||
this.dlgDepts = [];
|
this.dlgDepts = [];
|
||||||
this.form.subDeptId = ""
|
this.form.subDeptId = ""
|
||||||
}
|
}
|
||||||
|
if (cb) cb();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let tmps = this.prjDept2 && this.prjDept2[prjId] ? this.prjDept2[prjId] || [] : [];
|
let tmps = this.prjDept2 && this.prjDept2[prjId] ? this.prjDept2[prjId] || [] : [];
|
||||||
|
@ -180,7 +205,9 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.dlgDepts = tmps;
|
this.dlgDepts = tmps;
|
||||||
this.form.subDeptId = tmps.length == 1 ? tmps[0].deptId : '';
|
this.form.subDeptId = tmps.length == 1 ? tmps[0].deptId : '';
|
||||||
|
this.doQueryCfg();
|
||||||
}
|
}
|
||||||
|
if (cb) cb();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$api.publics.queryUnitList({
|
this.$api.publics.queryUnitList({
|
||||||
|
@ -199,7 +226,9 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.dlgDepts = tmps;
|
this.dlgDepts = tmps;
|
||||||
this.form.subDeptId = tmps.length == 1 ? tmps[0].deptId : '';
|
this.form.subDeptId = tmps.length == 1 ? tmps[0].deptId : '';
|
||||||
|
this.doQueryCfg();
|
||||||
}
|
}
|
||||||
|
if (cb) cb();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
init() {
|
init() {
|
||||||
|
@ -232,6 +261,9 @@ export default {
|
||||||
subDeptId: null,
|
subDeptId: null,
|
||||||
vendorCode: null,
|
vendorCode: null,
|
||||||
vendorParamter: null,
|
vendorParamter: null,
|
||||||
|
orgId:'',
|
||||||
|
identifier:'',
|
||||||
|
credential:'',
|
||||||
enabled: true,
|
enabled: true,
|
||||||
state: null,
|
state: null,
|
||||||
remark: null,
|
remark: null,
|
||||||
|
@ -263,32 +295,56 @@ export default {
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "添加项目基坑监测配置";
|
this.title = "添加项目基坑监测配置";
|
||||||
this.form.vendorCode = this.dict.type.pitmonit_vendors[0].value;
|
this.form.vendorCode = this.dict.type.pitmonit_vendors[0].value;
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row, fromAdd) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const id = row.id || this.ids
|
this.form = {...row,orgId:'',
|
||||||
getPitConfig(id).then(response => {
|
identifier:'',
|
||||||
this.form = response.data;
|
credential:'',};
|
||||||
this.open = true;
|
let oldDeptId = this.form.subDeptId;
|
||||||
this.title = "修改项目基坑监测配置";
|
if (!fromAdd) {
|
||||||
});
|
this.doQuerySub("dlg", () => {
|
||||||
|
this.form.subDeptId = oldDeptId;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
let param = this.$tryToJson(this.form.vendorParamter, {});
|
||||||
|
this.form.orgId = param.orgId || "";
|
||||||
|
this.form.identifier = param.identifier || "";
|
||||||
|
this.form.credential = param.credential || "";
|
||||||
|
this.form.enabled=row.enabled==1;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改项目基坑监测配置";
|
||||||
|
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
let param = {
|
||||||
|
orgId: this.form.orgId,
|
||||||
|
identifier: this.form.identifier,
|
||||||
|
credential: this.form.credential
|
||||||
|
};
|
||||||
|
var postData = {
|
||||||
|
projectId: this.form.projectId,
|
||||||
|
subDeptId: this.form.subDeptId,
|
||||||
|
vendorCode: this.form.vendorCode,
|
||||||
|
enabled: this.form.enabled ? 1 : 0,
|
||||||
|
vendorParamter: JSON.stringify(param)
|
||||||
|
};
|
||||||
if (this.form.id != null) {
|
if (this.form.id != null) {
|
||||||
updatePitConfig(this.form).then(response => {
|
postData.id = this.form.id;
|
||||||
this.$modal.msgSuccess("修改成功");
|
updatePitConfig(postData).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改配置成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addPitConfig(this.form).then(response => {
|
addPitConfig(postData).then(response => {
|
||||||
this.$modal.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增配置成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
|
@ -315,3 +371,18 @@ export default {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.prj-pit-config {
|
||||||
|
.el-drawer {
|
||||||
|
.el-drawer__body {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.dialog-footer {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0px;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -5,13 +5,7 @@ import java.util.List;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
@ -81,7 +75,7 @@ public class ProjectPitMonitCfgController extends BaseController
|
||||||
@PreAuthorize("@ss.hasPermi('device:pitConfig:add')")
|
@PreAuthorize("@ss.hasPermi('device:pitConfig:add')")
|
||||||
@Log(title = "项目基坑监测配置", businessType = BusinessType.INSERT)
|
@Log(title = "项目基坑监测配置", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(ProjectPitMonitCfg surProjectPitMonitCfg)
|
public AjaxResult add(@RequestBody ProjectPitMonitCfg surProjectPitMonitCfg)
|
||||||
{
|
{
|
||||||
return toAjax(surProjectPitMonitCfgService.insertSurProjectPitMonitCfg(surProjectPitMonitCfg));
|
return toAjax(surProjectPitMonitCfgService.insertSurProjectPitMonitCfg(surProjectPitMonitCfg));
|
||||||
}
|
}
|
||||||
|
@ -93,7 +87,7 @@ public class ProjectPitMonitCfgController extends BaseController
|
||||||
@PreAuthorize("@ss.hasPermi('device:pitConfig:edit')")
|
@PreAuthorize("@ss.hasPermi('device:pitConfig:edit')")
|
||||||
@Log(title = "项目基坑监测配置", businessType = BusinessType.UPDATE)
|
@Log(title = "项目基坑监测配置", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(ProjectPitMonitCfg surProjectPitMonitCfg)
|
public AjaxResult edit(@RequestBody ProjectPitMonitCfg surProjectPitMonitCfg)
|
||||||
{
|
{
|
||||||
return toAjax(surProjectPitMonitCfgService.updateSurProjectPitMonitCfg(surProjectPitMonitCfg));
|
return toAjax(surProjectPitMonitCfgService.updateSurProjectPitMonitCfg(surProjectPitMonitCfg));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue