update code
parent
40616deade
commit
ecf31c36e3
|
@ -45,3 +45,14 @@ export function delPitConfig(id) {
|
|||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function findByProjIdDeptId(prjId,deptId){
|
||||
|
||||
let where={
|
||||
projectId:prjId,
|
||||
subDeptId:deptId
|
||||
}
|
||||
return listPitConfig(where);
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
<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-item label="项目名称" prop="projectId">
|
||||
<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-form ref="form" :model="form" :rules="rules" label-width="80px" style="padding:0px 20px">
|
||||
<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>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<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>
|
||||
</el-select>
|
||||
|
@ -90,7 +92,7 @@
|
|||
<el-input v-model="form.identifier" auto-complete="off"></el-input>
|
||||
</el-form-item>
|
||||
<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-tab-pane>
|
||||
</el-tabs>
|
||||
|
@ -99,7 +101,7 @@
|
|||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
|
@ -108,7 +110,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { listPitConfig, getPitConfig, delPitConfig, addPitConfig, updatePitConfig } from "@/api/device/pitConfig";
|
||||
import { listPitConfig, getPitConfig, delPitConfig, addPitConfig, updatePitConfig, findByProjIdDeptId } from "@/api/device/pitConfig";
|
||||
|
||||
export default {
|
||||
name: "PitConfig",
|
||||
|
@ -146,9 +148,21 @@ export default {
|
|||
isDel: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
form: {
|
||||
projectId:null,
|
||||
subDeptId:null,
|
||||
orgId:'',
|
||||
identifier:'',
|
||||
credential:'',
|
||||
enabled:true
|
||||
},
|
||||
// 表单校验
|
||||
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: [],
|
||||
depts: [],
|
||||
|
@ -160,7 +174,17 @@ export default {
|
|||
this.init();
|
||||
},
|
||||
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;
|
||||
if (!prjId) {
|
||||
if (type == "query") {
|
||||
|
@ -170,6 +194,7 @@ export default {
|
|||
this.dlgDepts = [];
|
||||
this.form.subDeptId = ""
|
||||
}
|
||||
if (cb) cb();
|
||||
return;
|
||||
}
|
||||
let tmps = this.prjDept2 && this.prjDept2[prjId] ? this.prjDept2[prjId] || [] : [];
|
||||
|
@ -180,7 +205,9 @@ export default {
|
|||
} else {
|
||||
this.dlgDepts = tmps;
|
||||
this.form.subDeptId = tmps.length == 1 ? tmps[0].deptId : '';
|
||||
this.doQueryCfg();
|
||||
}
|
||||
if (cb) cb();
|
||||
return;
|
||||
}
|
||||
this.$api.publics.queryUnitList({
|
||||
|
@ -199,7 +226,9 @@ export default {
|
|||
} else {
|
||||
this.dlgDepts = tmps;
|
||||
this.form.subDeptId = tmps.length == 1 ? tmps[0].deptId : '';
|
||||
this.doQueryCfg();
|
||||
}
|
||||
if (cb) cb();
|
||||
});
|
||||
},
|
||||
init() {
|
||||
|
@ -232,6 +261,9 @@ export default {
|
|||
subDeptId: null,
|
||||
vendorCode: null,
|
||||
vendorParamter: null,
|
||||
orgId:'',
|
||||
identifier:'',
|
||||
credential:'',
|
||||
enabled: true,
|
||||
state: null,
|
||||
remark: null,
|
||||
|
@ -263,32 +295,56 @@ export default {
|
|||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加项目基坑监测配置";
|
||||
this.title = "添加项目基坑监测配置";
|
||||
this.form.vendorCode = this.dict.type.pitmonit_vendors[0].value;
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
handleUpdate(row, fromAdd) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getPitConfig(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改项目基坑监测配置";
|
||||
});
|
||||
this.form = {...row,orgId:'',
|
||||
identifier:'',
|
||||
credential:'',};
|
||||
let oldDeptId = this.form.subDeptId;
|
||||
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() {
|
||||
this.$refs["form"].validate(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) {
|
||||
updatePitConfig(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
postData.id = this.form.id;
|
||||
updatePitConfig(postData).then(response => {
|
||||
this.$modal.msgSuccess("修改配置成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addPitConfig(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
addPitConfig(postData).then(response => {
|
||||
this.$modal.msgSuccess("新增配置成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
|
@ -315,3 +371,18 @@ export default {
|
|||
}
|
||||
};
|
||||
</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 org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
@ -81,7 +75,7 @@ public class ProjectPitMonitCfgController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('device:pitConfig:add')")
|
||||
@Log(title = "项目基坑监测配置", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(ProjectPitMonitCfg surProjectPitMonitCfg)
|
||||
public AjaxResult add(@RequestBody ProjectPitMonitCfg surProjectPitMonitCfg)
|
||||
{
|
||||
return toAjax(surProjectPitMonitCfgService.insertSurProjectPitMonitCfg(surProjectPitMonitCfg));
|
||||
}
|
||||
|
@ -93,7 +87,7 @@ public class ProjectPitMonitCfgController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('device:pitConfig:edit')")
|
||||
@Log(title = "项目基坑监测配置", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(ProjectPitMonitCfg surProjectPitMonitCfg)
|
||||
public AjaxResult edit(@RequestBody ProjectPitMonitCfg surProjectPitMonitCfg)
|
||||
{
|
||||
return toAjax(surProjectPitMonitCfgService.updateSurProjectPitMonitCfg(surProjectPitMonitCfg));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue