Commit a4fc00eb by 史敦盼

收集资料配置修改

1 parent 7e8a916e
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Autor: pan * @Autor: pan
* @Date: 2024-03-11 14:53:40 * @Date: 2024-03-11 14:53:40
* @LastEditors: pan * @LastEditors: pan
* @LastEditTime: 2024-06-19 17:25:07 * @LastEditTime: 2024-06-24 09:39:43
--> -->
<!-- 示例 <!-- 示例
columns: [{ label: '头像', prop: 'avatar', align: 'center', __slotName: 'avatar',callback: (row, title) => { columns: [{ label: '头像', prop: 'avatar', align: 'center', __slotName: 'avatar',callback: (row, title) => {
...@@ -81,18 +81,28 @@ ...@@ -81,18 +81,28 @@
v-for="items in item.actionButtons" v-for="items in item.actionButtons"
:key="items.title" :key="items.title"
v-bind="items" v-bind="items"
:icon="typeof items.icon == 'function' ? items.icon(scope.row) : items.icon" :icon="
typeof items.icon == 'function'
? items.icon(scope.row)
: items.icon
"
:disabled=" :disabled="
items.disabledCallback items.disabledCallback
? items.disabledCallback(scope.row, items.title) ? items.disabledCallback(scope.row, items.title)
: false : false
" "
@click="item.callback(scope.row, items.title ? items.title : 'titleChange')" @click="
> item.callback(
<span v-if="items.titleChange">{{items.titleChange(scope.row, items)}}</span> scope.row,
<span v-else-if="!items.circle">{{ items.title }}</span> items.title ? items.title : 'titleChange',
</el-button )
"
> >
<span v-if="items.titleChange">{{
items.titleChange(scope.row, items)
}}</span>
<span v-else-if="!items.circle">{{ items.title }}</span>
</el-button>
</template> </template>
</el-table-column> </el-table-column>
<!-- 普通渲染 --> <!-- 普通渲染 -->
...@@ -206,9 +216,13 @@ export default { ...@@ -206,9 +216,13 @@ export default {
return [10, 20, 50, 100, 200] return [10, 20, 50, 100, 200]
}, },
}, },
queryImmediate: {
type: Boolean,
default: true,
},
}, },
components: { components: {
Functional Functional,
}, },
data() { data() {
return { return {
...@@ -235,7 +249,9 @@ export default { ...@@ -235,7 +249,9 @@ export default {
}, },
}, },
created() { created() {
this.queryData() if (this.queryImmediate) {
this.queryData()
}
}, },
methods: { methods: {
indexMethod(index) { indexMethod(index) {
......
<template> <template>
<el-dialog <el-dialog
:title="title" :title="title"
:visible.sync="showDialog" :visible.sync="showDialog"
width="80%" width="80%"
@close="handleClose()" @close="handleClose()"
> @open="handleOpen()"
>
<table-config <table-config
ref="searchTable" ref="searchTable"
:query="query" :query="query"
:columns="columns" :columns="columns"
id-key="elementId" id-key="elementId"
@selection-change="selectionChange" @selection-change="selectionChange"
:query-immediate="false"
> >
</table-config> </table-config>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button v-if="title == '督查清单'" type="primary" @click="handleSubmit" size="mini" >保 存</el-button > <el-button
v-if="title == '督查清单'"
type="primary"
@click="handleSubmit"
size="mini"
>保 存</el-button
>
<el-button @click="handleClose()" size="mini">取 消</el-button> <el-button @click="handleClose()" size="mini">取 消</el-button>
</span> </span>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
...@@ -25,98 +33,100 @@ import { collectDataConfiguration } from '@/api/architectureInspection' ...@@ -25,98 +33,100 @@ import { collectDataConfiguration } from '@/api/architectureInspection'
import TableConfig from './TableConfig.vue' import TableConfig from './TableConfig.vue'
export default { export default {
components: { TableConfig }, components: { TableConfig },
props: { props: {
prjCodeDetail: { prjCodeDetail: {
type: String, type: String,
default: '', default: '',
},
title: {
type: String,
default: '',
},
visible: {
type: Boolean,
default: false,
},
}, },
watch: { title: {
prjCodeDetail(v){ type: String,
this.query.queryParam.prjCode = v default: '',
this.search()
},
}, },
data(){ visible: {
return { type: Boolean,
query: { default: false,
url: collectDataConfiguration,
method: 'post',
queryParam: {
prjCode: ''
},
},
selectId: ''
}
}, },
computed: { },
columns() { watch: {
let arr = [ // prjCodeDetail(v){
{ label: '序号', type: 'index', prop: '序号',width: '80px' }, // this.query.queryParam.prjCode = v
{ label: '单位', prop: 'manageDeptName', width: '150px' }, // this.search()
{ label: '项目名称', prop: 'prjName', }, // },
{ label: '项目经理', prop: 'projectManager', width: '200px' }, },
] data() {
if(this.title != '督查清单'){ return {
arr = [ query: {
{ label: '序号', type: 'index',prop: '序号', width: '80px' }, url: collectDataConfiguration,
{ label: '单位', prop: 'manageDeptName', width: '150px' }, method: 'post',
{ label: '项目名称', prop: 'prjName', }, queryParam: {
{ label: '项目经理', prop: 'projectManager', width: '200px' }, prjCode: '',
]
}else{
arr = [
{ type: 'selection',prop: 'selection', width: '55px' },
...arr,
]
}
return [...arr]
},
showDialog: {
get() {
return this.visible
},
set(value) {
this.$emit('update:visible', value)
},
}
},
methods: {
handleClose() {
this.showDialog = false
},
async search(){
this.$nextTick(() => {
this.$refs.searchTable.queryData()
})
},
selectionChange(data) {
let idArr = []
data.forEach(item => {
idArr.push(item.prjCode)
})
this.selectId = idArr.join(',')
}, },
handleSubmit(){ },
this.$emit('selectTabel', this.selectId) selectId: '',
this.handleClose()
}
} }
},
computed: {
columns() {
let arr = [
{ label: '序号', type: 'index', prop: '序号', width: '80px' },
{ label: '单位', prop: 'manageDeptName', width: '150px' },
{ label: '项目名称', prop: 'prjName' },
{ label: '项目经理', prop: 'projectManager', width: '200px' },
]
if (this.title != '督查清单') {
arr = [
{ label: '序号', type: 'index', prop: '序号', width: '80px' },
{ label: '单位', prop: 'manageDeptName', width: '150px' },
{ label: '项目名称', prop: 'prjName' },
{ label: '项目经理', prop: 'projectManager', width: '200px' },
]
} else {
arr = [{ type: 'selection', prop: 'selection', width: '55px' }, ...arr]
}
return [...arr]
},
showDialog: {
get() {
return this.visible
},
set(value) {
this.$emit('update:visible', value)
},
},
},
methods: {
handleClose() {
this.showDialog = false
this.query.queryParam.prjCode = ''
},
handleOpen() {
this.query.queryParam.prjCode = this.prjCodeDetail
this.search()
},
async search() {
this.$nextTick(() => {
this.$refs.searchTable.queryData()
})
},
selectionChange(data) {
let idArr = []
data.forEach((item) => {
idArr.push(item.prjCode)
})
this.selectId = idArr.join(',')
},
handleSubmit() {
this.$emit('selectTabel', this.selectId)
this.handleClose()
},
},
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/styles/elementui.scss'; @import '@/styles/elementui.scss';
::v-deep .el-dialog__body{ ::v-deep .el-dialog__body {
height: 36vh; height: 36vh;
} }
</style> </style>
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Autor: pan * @Autor: pan
* @Date: 2024-03-11 14:53:40 * @Date: 2024-03-11 14:53:40
* @LastEditors: pan * @LastEditors: pan
* @LastEditTime: 2024-03-22 17:17:18 * @LastEditTime: 2024-06-24 09:40:41
--> -->
<!-- 示例 <!-- 示例
columns: [{ label: '头像', prop: 'avatar', align: 'center', __slotName: 'avatar',callback: (row, title) => { columns: [{ label: '头像', prop: 'avatar', align: 'center', __slotName: 'avatar',callback: (row, title) => {
...@@ -87,12 +87,18 @@ ...@@ -87,12 +87,18 @@
? items.disabledCallback(scope.row, items.title) ? items.disabledCallback(scope.row, items.title)
: false : false
" "
@click="item.callback(scope.row, items.title ? items.title : 'titleChange')" @click="
> item.callback(
<span v-if="items.titleChange">{{items.titleChange(scope.row, items.title)}}</span> scope.row,
<span v-else-if="!items.circle">{{ items.title }}</span> items.title ? items.title : 'titleChange',
</el-button )
"
> >
<span v-if="items.titleChange">{{
items.titleChange(scope.row, items.title)
}}</span>
<span v-else-if="!items.circle">{{ items.title }}</span>
</el-button>
</template> </template>
</el-table-column> </el-table-column>
<!-- 普通渲染 --> <!-- 普通渲染 -->
...@@ -196,6 +202,10 @@ export default { ...@@ -196,6 +202,10 @@ export default {
return [10, 20, 50, 100, 200] return [10, 20, 50, 100, 200]
}, },
}, },
queryImmediate: {
type: Boolean,
default: true,
},
}, },
data() { data() {
return { return {
...@@ -222,7 +232,9 @@ export default { ...@@ -222,7 +232,9 @@ export default {
}, },
}, },
created() { created() {
this.queryData() if (this.queryImmediate) {
this.queryData()
}
}, },
methods: { methods: {
indexMethod(index) { indexMethod(index) {
...@@ -233,24 +245,25 @@ export default { ...@@ -233,24 +245,25 @@ export default {
clearSelection() { clearSelection() {
this.$refs.tableConfig.clearSelection() this.$refs.tableConfig.clearSelection()
}, },
handleToText(item, state='') { handleToText(item, state = '') {
if(!state && typeof state != 'number') return if (!state && typeof state != 'number') return
if(typeof state != 'number' && state.indexOf(',') > -1){ if (typeof state != 'number' && state.indexOf(',') > -1) {
let stateVal = state.split(',') let stateVal = state.split(',')
let labelValue = '' let labelValue = ''
stateVal.forEach(valItem => { stateVal.forEach((valItem) => {
const arr = item.options.find((v) => v.value == valItem) || {} const arr = item.options.find((v) => v.value == valItem) || {}
labelValue += `,${arr.label}` labelValue += `,${arr.label}`
}); })
return labelValue.slice(1, labelValue.length) return labelValue.slice(1, labelValue.length)
}{ }
let val = state {
// if (!val) { let val = state
// val = item.emptyToNum || 0 // if (!val) {
// } // val = item.emptyToNum || 0
// let obj = item.options.find(item => item.value == val) // }
const obj = item.options.find((v) => v.value == val) || {} // let obj = item.options.find(item => item.value == val)
return obj['label'] const obj = item.options.find((v) => v.value == val) || {}
return obj['label']
} }
}, },
/** /**
...@@ -301,17 +314,17 @@ export default { ...@@ -301,17 +314,17 @@ export default {
} finally { } finally {
this.loading = false this.loading = false
// console.log('result', result) // console.log('result', result)
if(result.data){ if (result.data) {
const { data } = result const { data } = result
if (result && result.code === 200) { if (result && result.code === 200) {
if(data instanceof Array){ if (data instanceof Array) {
// this.pagination.totalRow = data.total // this.pagination.totalRow = data.total
this.tableData = data this.tableData = data
}else{ } else {
this.pagination.totalRow = data.total this.pagination.totalRow = data.total
this.tableData = data.records this.tableData = data.records
} }
this.$emit('fetchData', data) this.$emit('fetchData', data)
} else { } else {
this.$message({ this.$message({
type: 'warning', type: 'warning',
...@@ -321,7 +334,7 @@ export default { ...@@ -321,7 +334,7 @@ export default {
this.pagination.current = 1 this.pagination.current = 1
this.pagination.totalRow = 0 this.pagination.totalRow = 0
} }
}else{ } else {
const data = result const data = result
this.pagination.totalRow = data.total this.pagination.totalRow = data.total
this.tableData = data.records this.tableData = data.records
...@@ -344,9 +357,9 @@ export default { ...@@ -344,9 +357,9 @@ export default {
} }
} }
}, },
tableRowClass(val){ tableRowClass(val) {
// console.log(val, 'tableRowClass'); // console.log(val, 'tableRowClass');
if(val.row.remind && val.row.remind == '1'){ if (val.row.remind && val.row.remind == '1') {
return 'remindRed' return 'remindRed'
} }
}, },
...@@ -366,7 +379,7 @@ export default { ...@@ -366,7 +379,7 @@ export default {
margin-top: 20px; margin-top: 20px;
margin-bottom: 30px; margin-bottom: 30px;
} }
/deep/ .remindRed{ /deep/ .remindRed {
color: red !important; color: red !important;
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!