Merge remote-tracking branch 'origin/dev' into dev
| | |
| | | format: 'YYYY-MM-DD HH:mm:ss', |
| | | |
| | | }, |
| | | { |
| | | label: '行政区划', |
| | | prop: 'area_code', |
| | | type: 'cascader', |
| | | labelWidth: 130, |
| | | hide: true, |
| | | editDisplay: true, |
| | | viewDisplay: false, |
| | | props: { |
| | | label: 'title', |
| | | value: 'value', |
| | | emitPath: false, |
| | | checkStrictly: true, |
| | | multiple: false, |
| | | expandTrigger: 'hover', |
| | | }, |
| | | dataType: 'string', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请选择行政区划', |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | lazy: true, |
| | | lazyLoad (node, resolve) { |
| | | let level = node.level |
| | | let list = [] |
| | | let callback = () => { |
| | | resolve( |
| | | (list || []).map(ele => ({ |
| | | ...ele, |
| | | value: ele.value, |
| | | leaf: level >= 2, |
| | | })) |
| | | ) |
| | | } |
| | | |
| | | if (level === 0) { |
| | | getLazyTree('000000000000').then(res => { |
| | | list = res.data.data |
| | | callback() |
| | | }) |
| | | } else if (level === 1) { |
| | | getLazyTree(node.value).then(res => { |
| | | list = res.data.data |
| | | callback() |
| | | }) |
| | | } else if (level === 2) { |
| | | getLazyTree(node.value).then(res => { |
| | | list = res.data.data |
| | | callback() |
| | | }) |
| | | } else { |
| | | callback() |
| | | } |
| | | }, |
| | | }, |
| | | |
| | | ], |
| | | }, |
| | |
| | | }, |
| | | |
| | | rowSave (row, done, loading) { |
| | | let areaCode = row.area_code |
| | | if (Array.isArray(areaCode)) { |
| | | areaCode = areaCode[areaCode.length - 1] |
| | | } else if (typeof areaCode === 'string' && areaCode.includes(',')) { |
| | | const codes = areaCode.split(',') |
| | | areaCode = codes[codes.length - 1] |
| | | } |
| | | row.area_code = areaCode || null |
| | | add(row).then( |
| | | () => { |
| | | this.onLoad(this.page) |
| | |
| | | ) |
| | | }, |
| | | rowUpdate (row, index, done, loading) { |
| | | update(row).then( |
| | | const submitData = { |
| | | ...row, |
| | | area_code: row.area_code.split(',').pop(), |
| | | } |
| | | update(submitData).then( |
| | | () => { |
| | | this.onLoad(this.page) |
| | | this.$message({ |
| | |
| | | this.$refs.crud.toggleSelection() |
| | | }) |
| | | }, |
| | | async getFullAreaCode (areaCode) { |
| | | if (!areaCode) return '' |
| | | |
| | | const code = areaCode.toString() |
| | | |
| | | if (code.includes(',')) return code |
| | | |
| | | if (code.endsWith('0000000000')) { |
| | | return code |
| | | } else if (code.endsWith('00000000') && !code.endsWith('0000000000')) { |
| | | const provinceCode = code.substring(0, 2) + '0000000000' |
| | | return `${provinceCode},${code}` |
| | | } else { |
| | | const provinceCode = code.substring(0, 2) + '0000000000' |
| | | const cityCode = code.substring(0, 4) + '00000000' |
| | | return `${provinceCode},${cityCode},${code}` |
| | | } |
| | | }, |
| | | beforeOpen (done, type) { |
| | | if (['edit', 'view'].includes(type)) { |
| | | getDetail(this.form.id).then(res => { |
| | | this.form = res.data.data |
| | | getDetail(this.form.id).then(async res => { |
| | | const data = res.data.data |
| | | this.form = { |
| | | ...data, |
| | | area_code: await this.getFullAreaCode(data.area_code), |
| | | } |
| | | }) |
| | | } |
| | | done() |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="工单类型" prop="type"> |
| | | <el-select v-model="form.type" placeholder="请选择工单类型" class="full-width"> |
| | | |
| | | <el-select @change="handleTypeChange" v-model="form.type" placeholder="请选择工单类型" class="full-width" > |
| | | <el-option |
| | | v-for="item in types" |
| | | :key="item.value" |
| | |
| | | multiple |
| | | placeholder="请选择关联算法" |
| | | class="full-width" |
| | | :disabled="!form.type" |
| | | > |
| | | <el-option |
| | | v-for="item in algorithms" |
| | |
| | | <el-button type="infoprimary" plain :loading="draftLoading" @click="saveDraft" |
| | | >存草稿</el-button |
| | | > |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | |
| | | |
| | | <el-button @click="handleCancel">取 消</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | |
| | | }, |
| | | departments: [], |
| | | types: [], |
| | | allAlgorithms: [], |
| | | handlers: [ |
| | | { label: '处理人A', value: 'handlerA' }, |
| | | { label: '处理人B', value: 'handlerB' }, |
| | |
| | | const subAreaCode = areaCode ? areaCode.substring(0, 6) : ''; |
| | | const adcodeObj = getAdcodeObj(geoJson, 'adcode', subAreaCode); |
| | | |
| | | console.log('区域代码:', subAreaCode); |
| | | // console.log('区域代码:', subAreaCode); |
| | | |
| | | // 直接从返回对象中获取正确的路径 |
| | | const center = adcodeObj?.payload?.objects?.collection?.geometries?.[0]?.properties?.center; |
| | |
| | | async fetchDropdownData() { |
| | | try { |
| | | const response = await getTicketInfo(); |
| | | const { dept_data, event_type, ai_type } = response.data.data; |
| | | |
| | | const { dept_data, event_type, ai_type,info } = response.data.data; |
| | | |
| | | this.departments = dept_data.map(item => ({ |
| | | label: item.dept_name, |
| | |
| | | |
| | | const columnType = this.findObject(this.option.column, 'type'); |
| | | columnType.dicData = this.types; |
| | | this.allAlgorithms = info |
| | | |
| | | // console.log('工单类型',this.types); |
| | | // console.log('关联算法',this.allAlgorithms ); |
| | | // 确保算法数据的映射一致 |
| | | this.algorithms = |
| | | ai_type?.map(item => ({ |
| | | dict_key: item.dict_key, |
| | | dict_value: item.dict_value, |
| | | // 同时添加 label 和 value 以兼容两处使用 |
| | | label: item.dict_value, |
| | | value: item.dict_key, |
| | | })) || []; |
| | | // this.algorithms = |
| | | // ai_type?.map(item => ({ |
| | | // dict_key: item.dict_key, |
| | | // dict_value: item.dict_value, |
| | | // // 同时添加 label 和 value 以兼容两处使用 |
| | | // label: item.dict_value, |
| | | // value: item.dict_key, |
| | | // })) || []; |
| | | |
| | | // 构建用户ID和名称的映射关系 |
| | | this.userNameToIdMap = {}; |
| | |
| | | } catch (error) { |
| | | this.$message.error('加载下拉框数据失败'); |
| | | } |
| | | }, |
| | | // 工单类型变化时触发 |
| | | handleTypeChange(typeValue) { |
| | | if (!typeValue) { |
| | | // 未选择类型时清空算法列表 |
| | | this.algorithms = []; |
| | | return; |
| | | } |
| | | |
| | | const matchedCategory = this.allAlgorithms.find( |
| | | category => category.dict_key === typeValue |
| | | ); |
| | | |
| | | if (!matchedCategory || !matchedCategory.algorithms || matchedCategory.algorithms.length === 0) { |
| | | // 无匹配的算法时清空 |
| | | this.algorithms = []; |
| | | this.$message.info('该工单类型暂无关联算法'); |
| | | return; |
| | | } |
| | | |
| | | this.algorithms = matchedCategory.algorithms.map(algo => ({ |
| | | label: algo.dict_value, |
| | | value: algo.dict_key, |
| | | dict_key: algo.dict_key, |
| | | dict_value: algo.dict_value |
| | | })); |
| | | |
| | | }, |
| | | |
| | | async fetchTableData() { |
| | |
| | | this.draftLoading = false; |
| | | } |
| | | }, |
| | | |
| | | handleCancel (){ |
| | | this.resetForm(); |
| | | this.dialogVisible = false; |
| | | }, |
| | | handleLocationChange(val) { |
| | | let locationValue = val.value; |
| | | if (locationValue && locationValue.length >= 2) { |
| | |
| | | |
| | | // 获取工单类型值 - 从types中找到匹配的值 |
| | | const typeValue = |
| | | this.types.find(t => t.label === row.type)?.value || row.work_order_type_dict_key; |
| | | |
| | | this.types.find(t => t.value === row.type)?.value || row.work_order_type_dict_key; |
| | | // 获取处理人ID - 使用userNameToIdMap映射 |
| | | const handlerId = this.userNameToIdMap[row.handler] || row.handler; |
| | | |