|
|
@@ -1,12 +1,16 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <el-card class="box-card" style="height: 700px;">
|
|
|
+ <el-card class="box-card" :style="DivStyle">
|
|
|
<div slot="header">
|
|
|
<span>
|
|
|
<i class="icon icon-table2">位置树</i>
|
|
|
</span>
|
|
|
<span style="float: right;">
|
|
|
- <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @click="opendatadialog(1,null,-1)">新增位置</el-button>
|
|
|
+ <el-select ref="refQueryProjectType" style="margin-right:10px; margin-top: -4px;" size="mini" v-model="QueryProjectTypeId" clearable filterable placeholder="按检测项目查询" @change="ProjectTypeChangeHandler" @clear="ProjectTypeClearHandler">
|
|
|
+ <el-option v-for="item in projectTypeList" :key="item.id" :label="item.FullName" :value="item.Id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ <el-button type="primary" size="mini" style="margin-right:10px; margin-top: -4px;" @click="newEntity">新增检测地点</el-button>
|
|
|
+ <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @click="newPositionEntity">新增安装位置</el-button>
|
|
|
</span>
|
|
|
<!--<el-form ref="form" :inline="true" style="float: right; margin-top: -10px;">
|
|
|
<el-form-item label="样品名称">
|
|
|
@@ -24,12 +28,12 @@
|
|
|
</el-tree>
|
|
|
</el-col>
|
|
|
<el-col :span="18">
|
|
|
- <el-table :data="entityList" border style="height: 570px; overflow: auto;">
|
|
|
+ <el-table :data="entityList" border style="height: 570px; overflow: auto;" size="small">
|
|
|
<el-table-column label="操作" width="150" align="center" fixed>
|
|
|
<template slot-scope="scope" v-if="scope.row.Parentid !== 0">
|
|
|
- <el-button type="primary" plain size="mini" @click="opendatadialog(2,scope.row,scope.$index)"
|
|
|
+ <el-button type="primary" plain size="mini" @click="editEntity(scope.row)"
|
|
|
title="编辑">编辑</el-button>
|
|
|
- <el-button type="primary" plain size="mini" @click="deleteEntity(scope.row)" title="删除"
|
|
|
+ <el-button plain size="mini" @click="deleteConfirm(scope.row)" title="删除"
|
|
|
style="margin-left: 3px">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -50,7 +54,49 @@
|
|
|
</el-pagination>
|
|
|
</el-card>
|
|
|
<!--新增、编辑样品类型-->
|
|
|
- <el-dialog title="编辑" :visible.sync="dialogVisible" width="720px" size="small">
|
|
|
+ <el-dialog title="检测地点信息" :visible.sync="dialogVisible" width="720px" size="small">
|
|
|
+ <el-form :model="formData" ref="EntityForm" label-width="120px" label-position="top">
|
|
|
+ <el-form-item label="检测地点名称" required>
|
|
|
+ <el-input v-model="formData.PositionName" placeholder="请输入" style="width: 100%"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogVisible = false" size="small">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="saveEntity()" size="small">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog title="安装位置信息" :visible.sync="positionDialogVisible" width="720px" size="small">
|
|
|
+ <el-form :model="formData" ref="EntityForm2" label-width="120px">
|
|
|
+
|
|
|
+ <el-form-item label="检测地点">
|
|
|
+ <el-select v-model="formData.ParentId" style="width:100%" placeholder="请选择" filterable required>
|
|
|
+ <el-option v-for="item in customerOrigList" :key="item.Id" :label="item.PositionName" :value="item.Id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="检测报告" prop="ProjectTypeId" required>
|
|
|
+ <el-select ref="refProjectTypeId" v-model="formData.ProjectTypeId" style="width:100%" filterable placeholder="请选择">
|
|
|
+ <el-option v-for="item in projectTypeList" :key="item.id" :label="item.FullName" :value="item.Id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="位置名称" required>
|
|
|
+ <el-input v-model="formData.PositionName" placeholder="请输入" style="width: 100%"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="排序码" required>
|
|
|
+ <el-input-number v-model="formData.SortCode" :step="1" :min="0" label="排序码"></el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="positionDialogVisible = false" size="small">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="savePositionEntity()" size="small">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!--<el-dialog title="编辑" :visible.sync="dialogVisible" width="720px" size="small">
|
|
|
<el-form :model="formData" ref="EntityForm" label-width="120px">
|
|
|
|
|
|
<el-form-item label="上级位置">
|
|
|
@@ -88,16 +134,16 @@
|
|
|
<el-input v-model="formData.PositionName" placeholder="请输入" style="width: 100%"></el-input>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="位置类型">
|
|
|
+ <!–<el-form-item label="位置类型">
|
|
|
<el-input v-model="formData.PositionTypeId" placeholder="请输入" style="width: 100%"></el-input>
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item>–>
|
|
|
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
<el-button type="primary" @click="saveEntity()">确 定</el-button>
|
|
|
</div>
|
|
|
- </el-dialog>
|
|
|
+ </el-dialog>-->
|
|
|
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -115,15 +161,19 @@
|
|
|
name: 'customerposition',
|
|
|
props: {
|
|
|
CustomerId: Number,
|
|
|
+ DivStyle: String,
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
return {
|
|
|
+ QueryProjectTypeId: null,
|
|
|
otherNodeVisible: false,
|
|
|
dialogVisible: false,
|
|
|
+ positionDialogVisible: false,
|
|
|
defaultSelect: [],
|
|
|
customerTreeList: [],
|
|
|
customerOrigList: [],
|
|
|
+ projectTypeList: [],
|
|
|
selectedorg: [],
|
|
|
selectNodeId: '0',
|
|
|
selectNodeName: '根节点',
|
|
|
@@ -145,16 +195,19 @@
|
|
|
Prop: ''
|
|
|
},
|
|
|
formDataReset: {
|
|
|
- Id: '',
|
|
|
- CustomerId: '',
|
|
|
- ParentId: '',
|
|
|
+ Id: 0,
|
|
|
+ CustomerId: 0,
|
|
|
+ ParentId: 0,
|
|
|
AuthCode: '',
|
|
|
PositionName: '',
|
|
|
PositionCode: '',
|
|
|
PositionType: '',
|
|
|
- PositionTypeId: '',
|
|
|
+ PositionTypeId: 1,
|
|
|
+ ProjectType: '',
|
|
|
+ ProjectTypeId: 0,
|
|
|
+ SortCode: 0,
|
|
|
CreateOn: '',
|
|
|
- CreateUserId: '',
|
|
|
+ CreateUserId: 0,
|
|
|
CreateBy: '',
|
|
|
ModifiedOn: '',
|
|
|
ModifiedUserId: '',
|
|
|
@@ -162,16 +215,19 @@
|
|
|
|
|
|
},
|
|
|
formData: {
|
|
|
- Id: '',
|
|
|
- CustomerId: '',
|
|
|
- ParentId: '',
|
|
|
+ Id: 0,
|
|
|
+ CustomerId: 0,
|
|
|
+ ParentId: 0,
|
|
|
AuthCode: '',
|
|
|
PositionName: '',
|
|
|
PositionCode: '',
|
|
|
PositionType: '',
|
|
|
- PositionTypeId: '',
|
|
|
+ PositionTypeId: 0,
|
|
|
+ ProjectType: '',
|
|
|
+ ProjectTypeId: 0,
|
|
|
+ SortCode: 0,
|
|
|
CreateOn: '',
|
|
|
- CreateUserId: '',
|
|
|
+ CreateUserId: 0,
|
|
|
CreateBy: '',
|
|
|
ModifiedOn: '',
|
|
|
ModifiedUserId: '',
|
|
|
@@ -188,19 +244,27 @@
|
|
|
sort: true
|
|
|
},
|
|
|
|
|
|
- /*{
|
|
|
- prop: "PositionCode",
|
|
|
- label: '客户位置码',
|
|
|
+ {
|
|
|
+ prop: "PositionTypeId",
|
|
|
+ label: '位置类型',
|
|
|
width: 100,
|
|
|
sort: true
|
|
|
},
|
|
|
|
|
|
{
|
|
|
- prop: "PositionType",
|
|
|
- label: '位置类型',
|
|
|
- width: 100,
|
|
|
+ prop: "ProjectType",
|
|
|
+ label: '检测项目',
|
|
|
+ sort: true
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ prop: "SortCode",
|
|
|
+ label: '排序码',
|
|
|
+ width: 80,
|
|
|
sort: true
|
|
|
- },*/
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
|
|
|
// {
|
|
|
// prop: "CreateOn",
|
|
|
@@ -221,21 +285,31 @@
|
|
|
},
|
|
|
created() {
|
|
|
//查询列表
|
|
|
- this.gettreelist();
|
|
|
- this.initDatas();
|
|
|
+ this.customerCheckBuildList()
|
|
|
+ this.gettreelist()
|
|
|
+ this.initDatas()
|
|
|
//this.getDictOptions()
|
|
|
+ this.getProjectType()
|
|
|
},
|
|
|
methods: {
|
|
|
- initEntity() {
|
|
|
- if(this.formData.Id) {
|
|
|
- api.getEntity(this.formData.Id, this.$axios).then(res => {
|
|
|
- this.formData = res.data;
|
|
|
+ initEntity (id) {
|
|
|
+ if (id) {
|
|
|
+ api.getEntity(id, this.$axios).then(res => {
|
|
|
+ this.formData = res.data
|
|
|
}).catch(err => {
|
|
|
console.error(err)
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ ProjectTypeChangeHandler() {
|
|
|
+ this.initDatas()
|
|
|
+ },
|
|
|
+
|
|
|
+ ProjectTypeClearHandler() {
|
|
|
+ this.initDatas()
|
|
|
+ },
|
|
|
+
|
|
|
initDatas() {
|
|
|
//分页及列表条件
|
|
|
let params = {
|
|
|
@@ -245,6 +319,7 @@
|
|
|
Prop: this.Column.Prop,
|
|
|
ParentId: this.selectNodeId + "",
|
|
|
CustomerId: this.CustomerId + "",
|
|
|
+ ProjectTypeId: this.QueryProjectTypeId + '',
|
|
|
};
|
|
|
|
|
|
//访问接口
|
|
|
@@ -260,20 +335,54 @@
|
|
|
saveEntity() {
|
|
|
this.$refs['EntityForm'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- this.formData.CustomerId = this.CustomerId;
|
|
|
- this.formData.ParentId = parseInt(this.formData.ParentId);
|
|
|
- if(this.formData.Id !=0 && this.formData.Id == this.formData.ParentId) {
|
|
|
- this.$message({
|
|
|
- type: 'error',
|
|
|
- message: '父节点不能选自己'
|
|
|
- });
|
|
|
- return false;
|
|
|
+ this.formData.CustomerId = this.CustomerId
|
|
|
+ this.formData.ParentId = 0
|
|
|
+ this.formData.PositionType = '检测地点'
|
|
|
+ this.formData.PositionTypeId = '1'
|
|
|
+ if (!this.formData.Id) {
|
|
|
+ this.addEntity()
|
|
|
+ } else {
|
|
|
+ this.updateEntity()
|
|
|
}
|
|
|
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ savePositionEntity () {
|
|
|
+ if (!this.formData.ParentId) {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '检测地点不能为空'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.formData.ProjectTypeId) {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '检测项目不能为空'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.formData.PositionName) {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '位置名称不能为空'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$refs['EntityForm2'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.formData.CustomerId = this.CustomerId
|
|
|
+ this.formData.PositionType = '安装位置'
|
|
|
+ this.formData.PositionTypeId = '2'
|
|
|
+ this.formData.ProjectType = this.$refs['refProjectTypeId'].selectedLabel
|
|
|
if (!this.formData.Id) {
|
|
|
- this.addEntity();
|
|
|
+ this.addEntity()
|
|
|
} else {
|
|
|
- this.updateEntity();
|
|
|
+ this.updateEntity()
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
@@ -289,11 +398,13 @@
|
|
|
this.formData.Id = res.data.item;
|
|
|
this.initDatas();
|
|
|
this.gettreelist();
|
|
|
+ this.customerCheckBuildList();
|
|
|
this.$message({
|
|
|
type: 'success',
|
|
|
message: res.data.message
|
|
|
});
|
|
|
- this.dialogVisible = false;
|
|
|
+ this.dialogVisible = false
|
|
|
+ this.positionDialogVisible = false
|
|
|
|
|
|
} else {
|
|
|
this.$message({
|
|
|
@@ -312,11 +423,13 @@
|
|
|
//保存成功后,初始化数据,变成修改
|
|
|
this.initDatas();
|
|
|
this.gettreelist();
|
|
|
+ this.customerCheckBuildList();
|
|
|
this.$message({
|
|
|
type: 'success',
|
|
|
message: res.data.message
|
|
|
});
|
|
|
- this.dialogVisible = false;
|
|
|
+ this.dialogVisible = false
|
|
|
+ this.positionDialogVisible = false
|
|
|
|
|
|
} else {
|
|
|
this.$message({
|
|
|
@@ -339,19 +452,6 @@
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- getProject() {
|
|
|
- let tmpValue = 0;
|
|
|
- if(this.selectedorg.length > 0) {
|
|
|
- tmpValue = this.selectedorg[this.selectedorg.length-1];
|
|
|
- }
|
|
|
-
|
|
|
- for (var i = 0; i < this.customerOrigList.length; i++) {
|
|
|
- if (tmpValue == this.customerOrigList[i].Id) {
|
|
|
- this.formData.ParentId = this.customerOrigList[i].Id;
|
|
|
- this.tmpShowSelectNodeName = this.customerOrigList[i].PositionName;
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
|
|
|
setNodeParentZero() {
|
|
|
this.formData.ParentId = 0;
|
|
|
@@ -397,6 +497,15 @@
|
|
|
this.currentPage = 1
|
|
|
this.initDatas()
|
|
|
},
|
|
|
+ deleteConfirm(row) {
|
|
|
+ this.$confirm('此操作将永久删除该位置, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.deleteEntity(row)
|
|
|
+ })
|
|
|
+ },
|
|
|
deleteEntity(row) {
|
|
|
row.deleteConfirmFlag = false;
|
|
|
api.deleteEntity(row.Id, this.$axios).then(res => {
|
|
|
@@ -419,13 +528,25 @@
|
|
|
});
|
|
|
},
|
|
|
|
|
|
+ customerCheckBuildList() {
|
|
|
+ let params = {
|
|
|
+ CustomerId: this.CustomerId + "",
|
|
|
+ }
|
|
|
+ api.customerCheckBuildList(params, this.$axios).then(res => {
|
|
|
+ this.customerOrigList = res.data.items
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
gettreelist() {
|
|
|
let params = {
|
|
|
CustomerId: this.CustomerId + "",
|
|
|
};
|
|
|
|
|
|
api.customerPositionTree(params, this.$axios).then(res => {
|
|
|
- this.customerOrigList = res.data.items;
|
|
|
this.customerTreeList = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId',
|
|
|
'Id,CustomerId,ParentId,PositionName,PositionCode,PositionType,PositionTypeId');
|
|
|
})
|
|
|
@@ -434,21 +555,51 @@
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
- opendatadialog(item, v, index) {
|
|
|
- Object.assign(this.formData, this.formDataReset);
|
|
|
- if(item == 1) {
|
|
|
- this.formData.Id = 0;
|
|
|
- this.formData.ParentId = this.selectNodeId;
|
|
|
- this.tmpShowSelectNodeName = this.selectNodeName;
|
|
|
+
|
|
|
+ editEntity (row) {
|
|
|
+ this.initEntity(row.Id)
|
|
|
+ if (row.PositionTypeId === '1') {
|
|
|
+ this.dialogVisible = true
|
|
|
} else {
|
|
|
- this.formData.Id = v.Id;
|
|
|
- this.formData.ParentId = v.ParentId;
|
|
|
- this.getParentNode(this.formData.ParentId);
|
|
|
- this.initEntity();
|
|
|
+ this.positionDialogVisible = true
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ formReset () {
|
|
|
+ this.formData.Id = 0
|
|
|
+ this.formData.CustomerId = 0
|
|
|
+ this.formData.ParentId = 0
|
|
|
+ this.formData.AuthCode = ''
|
|
|
+ this.formData.PositionName = ''
|
|
|
+ this.formData.PositionCode = ''
|
|
|
+ this.formData.PositionType = ''
|
|
|
+ this.formData.PositionTypeId = 0
|
|
|
+ this.formData.ProjectType = ''
|
|
|
+ this.formData.ProjectTypeId = 0
|
|
|
+ this.formData.SortCode = 0
|
|
|
+ this.formData.CreateOn = ''
|
|
|
+ this.formData.CreateUserId = 0
|
|
|
+ this.formData.CreateBy = ''
|
|
|
+ this.formData.ModifiedOn = ''
|
|
|
+ this.formData.ModifiedUserId = ''
|
|
|
+ this.formData.ModifiedBy = ''
|
|
|
+ },
|
|
|
+
|
|
|
+ newEntity () {
|
|
|
+ this.formReset()
|
|
|
+ this.dialogVisible = true
|
|
|
+ },
|
|
|
|
|
|
+ newPositionEntity () {
|
|
|
+ this.formReset()
|
|
|
+ if (this.selectNodeId) {
|
|
|
+ this.formData.ParentId = parseInt(this.selectNodeId)
|
|
|
+ } else {
|
|
|
+ this.formData.ParentId = null
|
|
|
}
|
|
|
- this.dialogVisible = true;
|
|
|
+ this.positionDialogVisible = true
|
|
|
},
|
|
|
+
|
|
|
getParentNode(parentId) {
|
|
|
api.getEntity(parentId, this.$axios).then(res => {
|
|
|
this.tmpShowSelectNodeName = res.data.PositionName;
|
|
|
@@ -481,7 +632,29 @@
|
|
|
var minute = date.getMinutes();
|
|
|
minute = minute < 10 ? ('0' + minute) : minute;
|
|
|
return y + '-' + m + '-' + d + ' ' + h + ':' + minute;
|
|
|
- }
|
|
|
+ },
|
|
|
+
|
|
|
+ //检测报告
|
|
|
+ getProjectType() {
|
|
|
+ let _this = this
|
|
|
+ _this.$axios.get('/testtype/testypetreeall', {})
|
|
|
+ .then(res => {
|
|
|
+ _this.testTypeList = res.data.items
|
|
|
+ if (!_this.testTypeList) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ for (var i = 0; i < _this.testTypeList.length; i++) {
|
|
|
+ if (_this.testTypeList[i].ParentId == 0) {
|
|
|
+ _this.projectTypeList.push(_this.testTypeList[i])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|