| | |
| | | <el-select |
| | | :model-value="formatedValue" |
| | | @update:model-value="handleChange" |
| | | placeholder="总任务" |
| | | :placeholder="label" |
| | | style="width: 260px" |
| | | > |
| | | <el-option |
| | | v-for="s in topTasks" |
| | | v-for="s in filtedBeforeTask" |
| | | :key="s.value" |
| | | :label="s.label" |
| | | :value="s.value" |
| | |
| | | type: String, |
| | | default: 'topTaskId' |
| | | }, |
| | | // 选项筛选条件,筛选某任务之前的相同行政区划内的任务 |
| | | beforeTask: { |
| | | type: Object, |
| | | default: () => { |
| | | return {}; |
| | | } |
| | | } |
| | | }, |
| | | emits: ['update:value'], |
| | | data() { |
| | | return { |
| | | selected: {}, |
| | | topTasks: [], |
| | | topTasks: [] |
| | | }; |
| | | }, |
| | | computed: { |
| | | // 选择框中使用顶层任务id作为选项值 |
| | | formatedValue() { |
| | | return this.value.tguid; |
| | | }, |
| | | // 某任务之前的相同行政区划内的任务 |
| | | filtedBeforeTask() { |
| | | const filteredTasks = this.topTasks.filter((t) => { |
| | | return ( |
| | | (!this.beforeTask.provincecode || |
| | | this.beforeTask.provincecode == t.data.provincecode) && |
| | | (!this.beforeTask.citycode || |
| | | this.beforeTask.citycode == t.data.citycode) && |
| | | (!this.beforeTask.districtcode || |
| | | this.beforeTask.districtcode == t.data.districtcode) && |
| | | (!this.beforeTask.starttime || |
| | | t.data.starttime < this.beforeTask.starttime) |
| | | ); |
| | | }); |
| | | if (filteredTasks.length > 0) { |
| | | this.handleChange(filteredTasks[0]?.value); |
| | | } |
| | | return filteredTasks; |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | }, |
| | | //查询子任务统计信息 |
| | | handleChange(value) { |
| | | const task = this.topTasks.find( |
| | | (t) => t.data.tguid == value |
| | | ); |
| | | const param = task ? task.data : {} |
| | | const task = this.topTasks.find((t) => t.data.tguid == value); |
| | | const param = task ? task.data : {}; |
| | | |
| | | this.$emit('update:value', param); |
| | | }, |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.getOptions(); |