|
|
@@ -22,8 +22,9 @@
|
|
|
</div>
|
|
|
|
|
|
<el-table :data="list"
|
|
|
+ size="mini"
|
|
|
border
|
|
|
- style="width: 100%">
|
|
|
+ style="width: 100%" height="calc(100vh - 260px)">
|
|
|
<el-table-column label="操作"
|
|
|
width="65">
|
|
|
<template slot-scope="scope">
|
|
|
@@ -45,27 +46,36 @@
|
|
|
show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column label="检测周期"
|
|
|
show-overflow-tooltip>
|
|
|
- <template slot-scope="scope">
|
|
|
- {{scope.row.DetectionNum+scope.row.DetectionUnit}}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{scope.row.DetectionNum+scope.row.DetectionUnit}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
+
|
|
|
+ <el-pagination @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ :current-page="currentPage"
|
|
|
+ :page-sizes="[10, 20, 30]"
|
|
|
+ :page-size="size"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total="currentItemCount">
|
|
|
+ </el-pagination>
|
|
|
</el-card>
|
|
|
|
|
|
<el-dialog :title="dialogtitle"
|
|
|
:visible.sync="datadialogVisible">
|
|
|
<el-form :model="itemsdetailinfoform"
|
|
|
-
|
|
|
ref="itemsdetailinfoform">
|
|
|
<el-form-item label="设备分类"
|
|
|
- label-width="120px" required>
|
|
|
- <el-select v-model="projectTypeId"
|
|
|
+ label-width="120px"
|
|
|
+ required>
|
|
|
+ <el-select v-model="itemsdetailinfoform.Pid"
|
|
|
:disabled="disableFlag"
|
|
|
@change="projectTypeChange"
|
|
|
style="width:100%"
|
|
|
clearable
|
|
|
filterable
|
|
|
- placeholder="请选择设备分类" >
|
|
|
+ placeholder="请选择设备分类">
|
|
|
<el-option v-for="item in projectTypeList"
|
|
|
:key="item.Id"
|
|
|
:label="item.FullName"
|
|
|
@@ -74,16 +84,17 @@
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="检测周期数值"
|
|
|
- label-width="120px" required>
|
|
|
+ label-width="120px"
|
|
|
+ required>
|
|
|
<el-input-number v-model="itemsdetailinfoform.DetectionNum"
|
|
|
:min="1"
|
|
|
style="width:100%"></el-input-number>
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="检测周期单位"
|
|
|
- label-width="120px" required>
|
|
|
- <el-select v-model="detectionUnit"
|
|
|
- @change="detectionUnitChange"
|
|
|
+ label-width="120px"
|
|
|
+ required>
|
|
|
+ <el-select v-model="itemsdetailinfoform.DetectionUnit"
|
|
|
style="width:100%"
|
|
|
placeholder="请选择">
|
|
|
<el-option v-for="item in detectionUnitOptions"
|
|
|
@@ -111,7 +122,6 @@ export default {
|
|
|
name: 'itemsdetail',
|
|
|
data () {
|
|
|
return {
|
|
|
- projectTypeId: '',
|
|
|
Id: 0,
|
|
|
testTypeList: [],
|
|
|
projectTypeList: [],
|
|
|
@@ -120,7 +130,6 @@ export default {
|
|
|
currentItemCount: 0,
|
|
|
currentPage: 1,
|
|
|
size: 10,
|
|
|
- detectionUnit: '天',
|
|
|
|
|
|
detectionUnitOptions: [{
|
|
|
value: '天',
|
|
|
@@ -136,16 +145,13 @@ export default {
|
|
|
dialogtitle: '',
|
|
|
itemsdetailinfoform: {
|
|
|
Name: '',
|
|
|
- pid: 0,
|
|
|
+ Pid: '',
|
|
|
DetectionNum: 1,
|
|
|
- DetectionUnit: ''
|
|
|
+ DetectionUnit: '天'
|
|
|
|
|
|
},
|
|
|
list: [],
|
|
|
datadialogVisible: false
|
|
|
- // rulesitemsdetailinfoform: {
|
|
|
-
|
|
|
- // }
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
|
@@ -158,19 +164,25 @@ export default {
|
|
|
_this.getProjectType()
|
|
|
},
|
|
|
methods: {
|
|
|
+
|
|
|
+ handleSizeChange (value) {
|
|
|
+ this.size = value
|
|
|
+ this.currentPage = 1
|
|
|
+ this.initData()
|
|
|
+ },
|
|
|
+ handleCurrentChange (value) {
|
|
|
+ this.currentPage = value
|
|
|
+ this.initData()
|
|
|
+ },
|
|
|
projectTypeChange (val) {
|
|
|
let _this = this
|
|
|
- _this.itemsdetailinfoform.pid = val
|
|
|
let obj = {}
|
|
|
obj = _this.projectTypeList.find((item) => {
|
|
|
return item.Id === val
|
|
|
})
|
|
|
_this.itemsdetailinfoform.Name = obj.FullName
|
|
|
},
|
|
|
- detectionUnitChange (val) {
|
|
|
- let _this = this
|
|
|
- _this.itemsdetailinfoform.DetectionUnit = val
|
|
|
- },
|
|
|
+
|
|
|
getProjectType () {
|
|
|
let _this = this
|
|
|
_this.$axios.get('/testtype/testypetreeall', {})
|
|
|
@@ -195,7 +207,6 @@ export default {
|
|
|
|
|
|
_this.$axios.get('/items/getdetectionmodel/', { params })
|
|
|
.then(res => {
|
|
|
- console.log(res)
|
|
|
_this.list = res.data.items
|
|
|
_this.currentItemCount = res.data.currentItemCount
|
|
|
})
|
|
|
@@ -205,8 +216,8 @@ export default {
|
|
|
},
|
|
|
clearitemsdetailinfoform () {
|
|
|
let _this = this
|
|
|
- _this.projectTypeId = ''
|
|
|
- _this.detectionUnit = '天'
|
|
|
+ _this.itemsdetailinfoform.Pid = ''
|
|
|
+ _this.itemsdetailinfoform.DetectionUnit = '天'
|
|
|
_this.itemsdetailinfoform.DetectionNum = 1
|
|
|
},
|
|
|
deletedata (val) {
|
|
|
@@ -245,63 +256,62 @@ export default {
|
|
|
} else if (item === 2) {
|
|
|
_this.dialogtitle = `编辑`
|
|
|
_this.Id = v.Id
|
|
|
- _this.projectTypeId = v.Pid
|
|
|
+ _this.itemsdetailinfoform.Pid = v.Pid
|
|
|
_this.disableFlag = true
|
|
|
- _this.detectionUnit = v.DetectionUnit
|
|
|
-
|
|
|
_this.itemsdetailinfoform.DetectionUnit = v.DetectionUnit
|
|
|
_this.itemsdetailinfoform.DetectionNum = v.DetectionNum
|
|
|
}
|
|
|
},
|
|
|
savedata (formName) {
|
|
|
let _this = this
|
|
|
- this.$refs[formName].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- if (_this.operatingitem === 1) {
|
|
|
- this.$axios.post('/items/adddetectionmodel', _this.itemsdetailinfoform)
|
|
|
- .then(res => {
|
|
|
- if (res.data.code === 0) {
|
|
|
- _this.$message({
|
|
|
- type: 'success',
|
|
|
- message: res.data.message
|
|
|
- })
|
|
|
- _this.datadialogVisible = false
|
|
|
- this.initData()
|
|
|
- } else {
|
|
|
- _this.$message({
|
|
|
- type: 'warning',
|
|
|
- message: res.data.message
|
|
|
- })
|
|
|
- }
|
|
|
+
|
|
|
+ if (_this.itemsdetailinfoform.Pid === '') {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请选择设备分类'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (_this.operatingitem === 1) {
|
|
|
+ this.$axios.post('/items/adddetectionmodel', _this.itemsdetailinfoform)
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ _this.datadialogVisible = false
|
|
|
+ this.initData()
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
})
|
|
|
- .catch(err => {
|
|
|
- console.error(err)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ } else if (_this.operatingitem === 2) {
|
|
|
+ _this.$axios.post('items/editdetectionmodel/' + _this.Id, _this.itemsdetailinfoform)
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
})
|
|
|
- } else if (_this.operatingitem === 2) {
|
|
|
- _this.$axios.post('items/editdetectionmodel/' + _this.Id, _this.itemsdetailinfoform)
|
|
|
- .then(res => {
|
|
|
- if (res.data.code === 0) {
|
|
|
- _this.$message({
|
|
|
- type: 'success',
|
|
|
- message: res.data.message
|
|
|
- })
|
|
|
- _this.datadialogVisible = false
|
|
|
- this.initData()
|
|
|
- } else {
|
|
|
- _this.$message({
|
|
|
- type: 'warning',
|
|
|
- message: res.data.message
|
|
|
- })
|
|
|
- }
|
|
|
+ _this.datadialogVisible = false
|
|
|
+ this.initData()
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
})
|
|
|
- .catch(() => { })
|
|
|
- }
|
|
|
- } else {
|
|
|
- return false
|
|
|
- }
|
|
|
- })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => { })
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
</script>
|