|
@@ -0,0 +1,245 @@
|
|
|
+<template>
|
|
|
+ <div class="common-form-container">
|
|
|
+ <van-form @submit="onSubmit">
|
|
|
+ <div class="form-item">
|
|
|
+ <div class="common-form-content">
|
|
|
+ <div class="common-form-item">
|
|
|
+ <div class="item">
|
|
|
+ <div class="label-box">
|
|
|
+ <i class="icon-name" />
|
|
|
+ <div>姓名:</div>
|
|
|
+ </div>
|
|
|
+ <van-field
|
|
|
+ v-model="form.name"
|
|
|
+ class="common-field"
|
|
|
+ placeholder="请输入姓名"
|
|
|
+ :rules="rules.name"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="item">
|
|
|
+ <div class="label-box">
|
|
|
+ <i class="icon-phone" />
|
|
|
+ <div>手机号码:</div>
|
|
|
+ </div>
|
|
|
+ <van-field
|
|
|
+ v-model="form.phone"
|
|
|
+ class="common-field"
|
|
|
+ placeholder="请输入手机号码"
|
|
|
+ :rules="rules.phone"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="item">
|
|
|
+ <div class="label-box">
|
|
|
+ <i class="icon-area" />
|
|
|
+ <div>行政区划:</div>
|
|
|
+ </div>
|
|
|
+ <van-field
|
|
|
+ v-model="areaText"
|
|
|
+ class="common-field"
|
|
|
+ placeholder="请选择行政区划"
|
|
|
+ :rules="rules.area"
|
|
|
+ :right-icon="selectIcon"
|
|
|
+ readonly
|
|
|
+ @click="showPicker = true"
|
|
|
+ />
|
|
|
+ <RegionSelect v-model="showPicker" @confirm="handleSelect" />
|
|
|
+ </div>
|
|
|
+ <div class="item">
|
|
|
+ <div class="label-box">
|
|
|
+ <i class="icon-dept" />
|
|
|
+ <div>所属单位:</div>
|
|
|
+ </div>
|
|
|
+ <van-field
|
|
|
+ v-model="form.dept"
|
|
|
+ class="common-field"
|
|
|
+ placeholder="请输入所属单位"
|
|
|
+ :rules="rules.dept"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="item">
|
|
|
+ <div class="label-box">
|
|
|
+ <i class="icon-duty" />
|
|
|
+ <div>职务:</div>
|
|
|
+ </div>
|
|
|
+ <van-field
|
|
|
+ v-model="form.duty"
|
|
|
+ class="common-field"
|
|
|
+ placeholder="请输入职务"
|
|
|
+ :rules="rules.duty"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="item">
|
|
|
+ <div class="label-box">
|
|
|
+ <i class="icon-officePhone" />
|
|
|
+ <div>办公电话:</div>
|
|
|
+ </div>
|
|
|
+ <van-field
|
|
|
+ v-model="form.officePhone"
|
|
|
+ class="common-field"
|
|
|
+ placeholder="请输入办公电话"
|
|
|
+ :rules="rules.officePhone"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="item">
|
|
|
+ <div class="label-box">
|
|
|
+ <i class="icon-responsibility" />
|
|
|
+ <div>责任类别:</div>
|
|
|
+ </div>
|
|
|
+ <van-field
|
|
|
+ v-model="responsibilityTypeText"
|
|
|
+ class="common-field"
|
|
|
+ :right-icon="selectIcon"
|
|
|
+ readonly
|
|
|
+ placeholder="请选择行政区划"
|
|
|
+ :rules="rules.responsibilityType"
|
|
|
+ @click="showPicker2 = true"
|
|
|
+ />
|
|
|
+ <van-popup v-model:show="showPicker2" destroy-on-close round position="bottom">
|
|
|
+ <van-picker
|
|
|
+ :model-value="pickerValue2"
|
|
|
+ :columns="region"
|
|
|
+ @cancel="showPicker2 = false"
|
|
|
+ @confirm="onConfirm2"
|
|
|
+ />
|
|
|
+ </van-popup>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="common-form-footer">
|
|
|
+ <van-button class="btn" @click="onCancel">取消</van-button>
|
|
|
+ <van-button class="btn primary-btn" :loading="submitting" type="primary" native-type="submit">提交</van-button>
|
|
|
+ </div>
|
|
|
+ </van-form>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup name="EditPersonInformation">
|
|
|
+import selectIcon from "@/assets/images/selectIcon.png";
|
|
|
+import {showSuccessToast} from "vant";
|
|
|
+import {useRouter} from "vue-router";
|
|
|
+import {Numeric} from "vant/es/utils";
|
|
|
+
|
|
|
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
+const { region } = toRefs<any>(proxy?.useDict('region'));
|
|
|
+const router = useRouter();
|
|
|
+let id = ref('');
|
|
|
+// 表单数据
|
|
|
+const form = ref({
|
|
|
+ name: '',
|
|
|
+ phone: '',
|
|
|
+ area: '',
|
|
|
+ dept: '',
|
|
|
+ duty: '',
|
|
|
+ officePhone: '',
|
|
|
+ responsibilityType: ''
|
|
|
+});
|
|
|
+// 表单校验规则
|
|
|
+const rules = reactive({
|
|
|
+ name: [{ required: true, message: '姓名不能为空' }],
|
|
|
+ phone: [{ required: true, message: '手机号码不能为空' }],
|
|
|
+ area: [{ required: true, message: '请选择行政区划' }],
|
|
|
+ dept: [{ required: true, message: '所属单位不能为空' }],
|
|
|
+ duty: [{ required: true, message: '职务不能为空' }],
|
|
|
+ officePhone: [{ required: true, message: '办公电话不能为空' }],
|
|
|
+ responsibilityType: [{ required: true, message: '请选择责任类别' }]
|
|
|
+});
|
|
|
+
|
|
|
+let showPicker = ref(false);
|
|
|
+let areaText = ref('');
|
|
|
+const handleSelect = (data) => {
|
|
|
+ areaText.value = data.label;
|
|
|
+ form.value.area = data.value;
|
|
|
+}
|
|
|
+let showPicker2 = ref(false);
|
|
|
+let responsibilityTypeText = ref('');
|
|
|
+const pickerValue2 = ref<Numeric[]>([]);
|
|
|
+// 选择任务完成情况
|
|
|
+const onConfirm2 = ({ selectedValues, selectedOptions }) => {
|
|
|
+ showPicker2.value = false;
|
|
|
+ pickerValue2.value = selectedValues;
|
|
|
+ form.value.responsibilityType = selectedOptions[0].value;
|
|
|
+ responsibilityTypeText.value = selectedOptions[0].text;
|
|
|
+};
|
|
|
+// 是否在提交
|
|
|
+let submitting = ref(false);
|
|
|
+// 返回
|
|
|
+const onCancel = () => {
|
|
|
+ router.go(-1);
|
|
|
+};
|
|
|
+
|
|
|
+// 提交表单
|
|
|
+const onSubmit = () => {
|
|
|
+ if (submitting.value) return;
|
|
|
+ submitting.value = true;
|
|
|
+ setTimeout(() => {
|
|
|
+ submitting.value = false;
|
|
|
+ showSuccessToast('提交成功');
|
|
|
+ onCancel();
|
|
|
+ }, 1500);
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.common-form-container {
|
|
|
+ height: 100vh;
|
|
|
+ padding: 0 0 89px 0;
|
|
|
+ .item {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ position: relative;
|
|
|
+ margin-bottom: 24px;
|
|
|
+ .label-box {
|
|
|
+ width: 122px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-right: 9px;
|
|
|
+ .icon-name {
|
|
|
+ background: url('@/assets/images/threePreventionResponsiblePerson/name.png') no-repeat;
|
|
|
+ }
|
|
|
+ .icon-phone {
|
|
|
+ background: url('@/assets/images/threePreventionResponsiblePerson/tel.png') no-repeat;
|
|
|
+ }
|
|
|
+ .icon-area {
|
|
|
+ background: url('@/assets/images/threePreventionResponsiblePerson/area.png') no-repeat;
|
|
|
+ }
|
|
|
+ .icon-dept {
|
|
|
+ background: url('@/assets/images/threePreventionResponsiblePerson/dept.png') no-repeat;
|
|
|
+ }
|
|
|
+ .icon-duty {
|
|
|
+ background: url('@/assets/images/threePreventionResponsiblePerson/duty.png') no-repeat;
|
|
|
+ }
|
|
|
+ .icon-officePhone {
|
|
|
+ background: url('@/assets/images/threePreventionResponsiblePerson/phone.png') no-repeat;
|
|
|
+ }
|
|
|
+ .icon-responsibility {
|
|
|
+ background: url('@/assets/images/threePreventionResponsiblePerson/responsibility.png') no-repeat;
|
|
|
+ }
|
|
|
+ .icon-name,
|
|
|
+ .icon-phone,
|
|
|
+ .icon-area,
|
|
|
+ .icon-dept,
|
|
|
+ .icon-duty,
|
|
|
+ .icon-officePhone,
|
|
|
+ .icon-responsibility {
|
|
|
+ width: 16px;
|
|
|
+ height: 16px;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ margin-right: 3px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .common-field {
|
|
|
+ overflow: unset;
|
|
|
+ }
|
|
|
+ :deep(.van-cell) {
|
|
|
+ padding: 0;
|
|
|
+ }
|
|
|
+ :deep(.van-field__error-message) {
|
|
|
+ position: absolute;
|
|
|
+ bottom: -24px;
|
|
|
+ left: 0;
|
|
|
+ z-index: 10;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|