| | |
| | | <el-form-item label="场景名称" prop="name"> |
| | | <el-input clearable show-word-limit v-model="formObj.name" placeholder="场景名称" /> |
| | | </el-form-item> |
| | | <el-form-item label="场景类型" prop="_typeObj"> |
| | | <el-select v-model="formObj._typeObj" placeholder="场景类型"> |
| | | <!-- <el-form-item label="场景类型" prop="_scenetype"> |
| | | <el-select v-model="formObj._scenetype" placeholder="场景类型"> |
| | | <el-option v-for="s in sceneTypes" :key="s.value" :label="s.label" :value="s" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="省/市/区/镇" prop="_locations"> |
| | | <el-cascader |
| | | v-model="formObj._locations" |
| | | :options="locations" |
| | | placeholder="省/市/区/镇" |
| | | style="width: 300px" |
| | | :props="cascaderProps" |
| | | /> |
| | | </el-form-item> |
| | | </el-form-item> --> |
| | | <!-- 场景类型 --> |
| | | <FYOptionScene |
| | | :allOption="false" |
| | | :type="2" |
| | | v-model:value="formObj._scenetype" |
| | | ></FYOptionScene> |
| | | <!-- 区县 --> |
| | | <FYOptionLocation |
| | | :allOption="false" |
| | | :level="4" |
| | | :initValue="false" |
| | | :checkStrictly="true" |
| | | v-model:value="formObj._locations" |
| | | ></FYOptionLocation> |
| | | <el-form-item label="地址" prop="location"> |
| | | <el-input show-word-limit clearable v-model="formObj.location" placeholder="地址" /> |
| | | </el-form-item> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { defineProps, defineEmits, reactive, ref, watch, computed } from 'vue'; |
| | | import { defineProps, defineEmits, reactive, ref, unref, watch, computed } from 'vue'; |
| | | import { enumScene } from '@/enum/scene'; |
| | | import { enumLocation } from '@/enum/location'; |
| | | import sceneApi from '@/api/fysp/sceneApi'; |
| | | |
| | | const props = defineProps({ |
| | |
| | | |
| | | const emit = defineEmits(['onSubmit', 'onCancel']); |
| | | |
| | | const sceneTypes = reactive(enumScene(2, false)); |
| | | const locations = reactive(enumLocation(false)); |
| | | const cascaderProps = reactive({ |
| | | checkStrictly: true |
| | | }); |
| | | const sceneTypes = ref(enumScene(2, false)); |
| | | const rules = reactive({ |
| | | name: [ |
| | | { |
| | |
| | | trigger: 'blur' |
| | | } |
| | | ], |
| | | _typeObj: [ |
| | | _scenetype: [ |
| | | { |
| | | required: true, |
| | | message: '场景类型不能为空', |
| | |
| | | * 对场景类型、场景行政区划和场景可用状态进行格式化 |
| | | * @param {*} s 场景信息 |
| | | */ |
| | | function parseSceneBaseInfo(s) { |
| | | s._typeObj = { |
| | | function parseSceneBaseInfo(param) { |
| | | const s = unref(param); |
| | | s._scenetype = { |
| | | label: s.type, |
| | | value: s.typeid + '' |
| | | }; |
| | | |
| | | s._locations = []; |
| | | if (s.provincecode && s.provincecode.length > 0) |
| | | s._locations.push([s.provincecode, s.provincename]); |
| | | if (s.citycode && s.citycode.length > 0) s._locations.push([s.citycode, s.cityname]); |
| | | if (s.districtcode && s.districtcode.length > 0) |
| | | s._locations.push([s.districtcode, s.districtname]); |
| | | if (s.towncode && s.towncode.length > 0) s._locations.push([s.towncode, s.townname]); |
| | | s._locations = { |
| | | pCode: s.provincecode, |
| | | pName: s.provincename, |
| | | cCode: s.citycode, |
| | | cName: s.cityname, |
| | | dCode: s.districtcode, |
| | | dName: s.districtname, |
| | | tCode: s.towncode, |
| | | tName: s.townname |
| | | }; |
| | | |
| | | s.online = s.extension1 != '0'; |
| | | |
| | |
| | | function submit(v, success, fail) { |
| | | // 行政区划信息填充 |
| | | const a = v.value._locations; |
| | | if (a[0]) { |
| | | v.value.provincecode = a[0][0]; |
| | | v.value.provincename = a[0][1]; |
| | | } |
| | | if (a[1]) { |
| | | v.value.citycode = a[1][0]; |
| | | v.value.cityname = a[1][1]; |
| | | } |
| | | if (a[2]) { |
| | | v.value.districtcode = a[2][0]; |
| | | v.value.districtname = a[2][1]; |
| | | } |
| | | if (a[3]) { |
| | | v.value.towncode = a[3][0]; |
| | | v.value.townname = a[3][1]; |
| | | } |
| | | v.value.provincecode = a.pCode; |
| | | v.value.provincename = a.pName; |
| | | v.value.citycode = a.cCode; |
| | | v.value.cityname = a.cName; |
| | | v.value.districtcode = a.dCode; |
| | | v.value.districtname = a.dName; |
| | | v.value.towncode = a.tCode; |
| | | v.value.townname = a.tName; |
| | | |
| | | // 场景类型信息填充 |
| | | const b = v.value._typeObj; |
| | | const b = v.value._scenetype; |
| | | v.value.typeid = b.value; |
| | | v.value.type = b.label; |
| | | |