|
|
@@ -1,24 +1,31 @@
|
|
|
<template>
|
|
|
- <div class='flex flex-justify-start flex-align-center flex-col'>
|
|
|
- <span class='bold full-width text-left mt-20'>{{ info.dictValue }}</span>
|
|
|
- <div style='width: 95%;' class='mt-20'>
|
|
|
+ <div class="flex flex-justify-start flex-align-center flex-col">
|
|
|
+ <span class="bold full-width text-left mt-20">{{ info.dictValue }}</span>
|
|
|
+ <div style="width: 95%" class="mt-20">
|
|
|
<avue-crud
|
|
|
- :option="option"
|
|
|
- :data="data"
|
|
|
- ref="crud"
|
|
|
- v-model="form"
|
|
|
- v-model:page='page'
|
|
|
- :table-loading="loading"
|
|
|
- :before-open="beforeOpen"
|
|
|
- @current-change="currentChange"
|
|
|
- @size-change="sizeChange"
|
|
|
- @refresh-change="refreshChange"
|
|
|
- @row-del="rowDel"
|
|
|
- @row-save="rowSave"
|
|
|
- @row-update="rowUpdate">
|
|
|
- <template #menu="{row}">
|
|
|
- <el-button v-if='row.hasReport' text type='primary' icon='el-icon-plus' @click='report(row)'>
|
|
|
- {{ row.isReport === 1 ? "已上报" : "上报" }}
|
|
|
+ :option="option"
|
|
|
+ :data="data"
|
|
|
+ ref="crud"
|
|
|
+ v-model="form"
|
|
|
+ v-model:page="page"
|
|
|
+ :table-loading="loading"
|
|
|
+ :before-open="beforeOpen"
|
|
|
+ @current-change="currentChange"
|
|
|
+ @size-change="sizeChange"
|
|
|
+ @refresh-change="refreshChange"
|
|
|
+ @row-del="rowDel"
|
|
|
+ @row-save="rowSave"
|
|
|
+ @row-update="rowUpdate"
|
|
|
+ >
|
|
|
+ <template #menu="{ row }">
|
|
|
+ <el-button
|
|
|
+ v-if="row.hasReport"
|
|
|
+ text
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ @click="report(row)"
|
|
|
+ >
|
|
|
+ {{ row.isReport === 1 ? '已上报' : '上报' }}
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</avue-crud>
|
|
|
@@ -43,7 +50,7 @@ export default {
|
|
|
},
|
|
|
watch: {
|
|
|
info: {
|
|
|
- handler (val) {
|
|
|
+ handler(val) {
|
|
|
if (val) {
|
|
|
this.changeColum(val.dictKey)
|
|
|
}
|
|
|
@@ -51,7 +58,7 @@ export default {
|
|
|
immediate: true
|
|
|
}
|
|
|
},
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
loading: false,
|
|
|
form: {},
|
|
|
@@ -106,12 +113,12 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- created () {
|
|
|
+ created() {
|
|
|
this.projectId = this.$route.query.id
|
|
|
this.onLoad()
|
|
|
},
|
|
|
methods: {
|
|
|
- changeColum (key) {
|
|
|
+ changeColum(key) {
|
|
|
if (key === '1') {
|
|
|
this.option = option1
|
|
|
} else if (key === '2') {
|
|
|
@@ -124,10 +131,10 @@ export default {
|
|
|
this.option = option5
|
|
|
}
|
|
|
},
|
|
|
- add () {
|
|
|
+ add() {
|
|
|
this.$refs.crud.rowAdd()
|
|
|
},
|
|
|
- report (row) {
|
|
|
+ report(row) {
|
|
|
if (row.isReport === 1) {
|
|
|
this.$message.error('该记录已经上报')
|
|
|
return
|
|
|
@@ -148,119 +155,135 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
- onLoad () {
|
|
|
+ onLoad() {
|
|
|
const data = {
|
|
|
projectId: this.projectId,
|
|
|
status: this.info.dictKey
|
|
|
}
|
|
|
this.loading = true
|
|
|
- this.$api.inspect.list(Object.assign(this.page, data)).then(res => {
|
|
|
- this.data = res.data.records
|
|
|
- this.page.total = res.data.total
|
|
|
- if (this.data.length > 0) {
|
|
|
- const hasReport = this.data[0].hasReport
|
|
|
- if (!hasReport) {
|
|
|
- // hasReport === false 表示未最后一级,不需要上报或者其他操作
|
|
|
- const index = this.option.column.findIndex(e => e.prop === 'reportTime')
|
|
|
- this.option.column[index].hide = true
|
|
|
+ this.$api.inspect
|
|
|
+ .list(Object.assign(this.page, data))
|
|
|
+ .then(res => {
|
|
|
+ this.data = res.data.records
|
|
|
+ this.page.total = res.data.total
|
|
|
+ if (this.data.length > 0) {
|
|
|
+ const hasReport = this.data[0].hasReport
|
|
|
+ if (!hasReport) {
|
|
|
+ // hasReport === false 表示未最后一级,不需要上报或者其他操作
|
|
|
+ const index = this.option.column.findIndex(
|
|
|
+ e => e.prop === 'reportTime'
|
|
|
+ )
|
|
|
+ this.option.column[index].hide = true
|
|
|
+ }
|
|
|
+ const sort = this.data[0].sort
|
|
|
+ if (sort !== 0) {
|
|
|
+ // sort ===0 第一级,填报内容的第一级用户
|
|
|
+ this.option.delBtn = false
|
|
|
+ this.option.editBtn = false
|
|
|
+ const index = this.option.column.findIndex(
|
|
|
+ e => e.prop === 'reportDeptName'
|
|
|
+ )
|
|
|
+ this.option.column[index].hide = false
|
|
|
+ } else {
|
|
|
+ // 第一级部门,不显示上报部门
|
|
|
+ const index = this.option.column.findIndex(
|
|
|
+ e => e.prop === 'reportDeptName'
|
|
|
+ )
|
|
|
+ this.option.column[index].hide = true
|
|
|
+ }
|
|
|
}
|
|
|
- const sort = this.data[0].sort
|
|
|
- if (sort !== 0) { // sort ===0 第一级,填报内容的第一级用户
|
|
|
- this.option.delBtn = false
|
|
|
- this.option.editBtn = false
|
|
|
- const index = this.option.column.findIndex(e => e.prop === 'reportDeptName')
|
|
|
- this.option.column[index].hide = false
|
|
|
- } else { // 第一级部门,不显示上报部门
|
|
|
- const index = this.option.column.findIndex(e => e.prop === 'reportDeptName')
|
|
|
- this.option.column[index].hide = true
|
|
|
- }
|
|
|
- }
|
|
|
- }).finally(() => {
|
|
|
- this.loading = false
|
|
|
- })
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
},
|
|
|
- beforeOpen (done, type) {
|
|
|
+ beforeOpen(done, type) {
|
|
|
if (['view', 'edit'].includes(type)) {
|
|
|
-
|
|
|
}
|
|
|
done()
|
|
|
},
|
|
|
- getDetail (res) {
|
|
|
+ getDetail(res) {
|
|
|
this.$api.inspect.detail({ id: res.id }).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
this.form = res.data
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- currentChange (currentPage) {
|
|
|
+ currentChange(currentPage) {
|
|
|
console.log(currentPage)
|
|
|
this.page.current = currentPage
|
|
|
this.refreshChange()
|
|
|
},
|
|
|
- sizeChange (pageSize) {
|
|
|
+ sizeChange(pageSize) {
|
|
|
this.page.size = pageSize
|
|
|
this.refreshChange()
|
|
|
},
|
|
|
- refreshChange () {
|
|
|
+ refreshChange() {
|
|
|
this.onLoad()
|
|
|
},
|
|
|
- rowSave (row, done, loading) {
|
|
|
+ rowSave(row, done, loading) {
|
|
|
const data = {
|
|
|
projectId: this.projectId,
|
|
|
status: this.info.dictKey
|
|
|
}
|
|
|
- this.$api.inspect.submint(Object.assign(row, data)).then((res) => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.$message.success(res.msg)
|
|
|
- } else {
|
|
|
- this.$message.error(res.msg)
|
|
|
+ this.$api.inspect.submint(Object.assign(row, data)).then(
|
|
|
+ res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success(res.msg)
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ done(row)
|
|
|
+ this.onLoad()
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ window.console.log(error)
|
|
|
+ loading()
|
|
|
}
|
|
|
- done(row)
|
|
|
- this.onLoad()
|
|
|
- }, error => {
|
|
|
- window.console.log(error)
|
|
|
- loading()
|
|
|
- })
|
|
|
+ )
|
|
|
},
|
|
|
- rowUpdate (row, index, done, loading) {
|
|
|
+ rowUpdate(row, index, done, loading) {
|
|
|
const data = {
|
|
|
projectId: this.projectId
|
|
|
}
|
|
|
- this.$api.inspect.update(Object.assign(row, data)).then((res) => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.$message.success(res.msg)
|
|
|
- } else {
|
|
|
- this.$message.error(res.msg)
|
|
|
+ this.$api.inspect.update(Object.assign(row, data)).then(
|
|
|
+ res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success(res.msg)
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ done(row)
|
|
|
+ this.onLoad()
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ window.console.log(error)
|
|
|
+ loading()
|
|
|
}
|
|
|
- done(row)
|
|
|
- this.onLoad()
|
|
|
- }, error => {
|
|
|
- window.console.log(error)
|
|
|
- loading()
|
|
|
- })
|
|
|
+ )
|
|
|
},
|
|
|
- rowDel (row, index, done) {
|
|
|
+ rowDel(row, index, done) {
|
|
|
this.$confirm('确定将选择数据删除?', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- return this.$api.inspect.remove({ ids: row.id })
|
|
|
- }).then(() => {
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '操作成功!'
|
|
|
- })
|
|
|
- // 数据回调进行刷新
|
|
|
- done(row)
|
|
|
- this.onLoad()
|
|
|
- }).catch(() => {
|
|
|
})
|
|
|
+ .then(() => {
|
|
|
+ return this.$api.inspect.remove({ ids: row.id })
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '操作成功!'
|
|
|
+ })
|
|
|
+ // 数据回调进行刷新
|
|
|
+ done(row)
|
|
|
+ this.onLoad()
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style scoped>
|
|
|
-
|
|
|
-</style>
|
|
|
+<style scoped></style>
|