|
@@ -0,0 +1,150 @@
|
|
|
+<template>
|
|
|
+ <div class="common-form-container">
|
|
|
+ <van-form label-width="90" label-align="top" colon @submit="onSubmit">
|
|
|
+ <div class="form-item">
|
|
|
+ <div class="form-header">
|
|
|
+ <div class="form-header-left">
|
|
|
+ <i class="line-icon" />
|
|
|
+ <div class="form-title">工作请示</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="common-form-content">
|
|
|
+ <div class="common-form-item">
|
|
|
+ <van-field
|
|
|
+ v-model="pickerValue[0]"
|
|
|
+ class="common-field"
|
|
|
+ :right-icon="selectIcon"
|
|
|
+ readonly
|
|
|
+ label="领导单位"
|
|
|
+ placeholder="请输入领导单位"
|
|
|
+ :rules="rules.dept"
|
|
|
+ @click="showPicker = true"
|
|
|
+ />
|
|
|
+ <van-field
|
|
|
+ v-model="pickerValue2[0]"
|
|
|
+ class="common-field"
|
|
|
+ :right-icon="selectIcon"
|
|
|
+ readonly
|
|
|
+ label="领导姓名"
|
|
|
+ placeholder="请输入领导姓名"
|
|
|
+ :rules="rules.name"
|
|
|
+ @click="showPicker2 = true"
|
|
|
+ />
|
|
|
+ <van-field
|
|
|
+ v-model="form.info"
|
|
|
+ class="common-field common-textarea"
|
|
|
+ rows="8"
|
|
|
+ type="textarea"
|
|
|
+ label="请示信息"
|
|
|
+ maxlength="300"
|
|
|
+ placeholder="请描述请示信息"
|
|
|
+ show-word-limit
|
|
|
+ :rules="rules.info"
|
|
|
+ />
|
|
|
+ </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>
|
|
|
+ <!--领导单位-->
|
|
|
+ <van-popup v-model:show="showPicker" destroy-on-close round position="bottom">
|
|
|
+ <van-picker
|
|
|
+ :model-value="pickerValue"
|
|
|
+ :columns="options"
|
|
|
+ @cancel="showPicker = false"
|
|
|
+ @confirm="onConfirm"
|
|
|
+ />
|
|
|
+ </van-popup>
|
|
|
+ <!--领导姓名-->
|
|
|
+ <van-popup v-model:show="showPicker2" destroy-on-close round position="bottom">
|
|
|
+ <van-picker
|
|
|
+ :model-value="pickerValue2"
|
|
|
+ :columns="options2"
|
|
|
+ @cancel="showPicker2 = false"
|
|
|
+ @confirm="onConfirm2"
|
|
|
+ />
|
|
|
+ </van-popup>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup name="WorkRequest">
|
|
|
+import {useRoute, useRouter} from "vue-router";
|
|
|
+import {reactive, ref} from "vue";
|
|
|
+import {showSuccessToast} from "vant";
|
|
|
+import selectIcon from "@/assets/images/selectIcon.png";
|
|
|
+import {Numeric} from "vant/es/utils";
|
|
|
+
|
|
|
+const route = useRoute();
|
|
|
+const router = useRouter();
|
|
|
+let id = ref('');
|
|
|
+// 表单数据
|
|
|
+const form = ref({
|
|
|
+ dept: '',
|
|
|
+ name: '',
|
|
|
+ info: ''
|
|
|
+});
|
|
|
+const pickerValue = ref<Numeric[]>([]);
|
|
|
+const pickerValue2 = ref<Numeric[]>([]);
|
|
|
+let uploaderErrors = ref('');
|
|
|
+// 表单校验规则
|
|
|
+const rules = reactive({
|
|
|
+ dept: [{ required: true, message: "请选择领导单位" }],
|
|
|
+ name: [{ required: true, message: "请选择领导姓名" }],
|
|
|
+ info: [{ required: true, message: "请输入请示信息" }],
|
|
|
+});
|
|
|
+let showPicker = ref(false);
|
|
|
+let showPicker2 = ref(false);
|
|
|
+
|
|
|
+const options = [
|
|
|
+ { text: '处理中', value: '处理中' },
|
|
|
+ { text: '已完成', value: '已完成' },
|
|
|
+];
|
|
|
+const options2 = [
|
|
|
+ { text: '处理中2', value: '处理中' },
|
|
|
+ { text: '已完成2', value: '已完成' },
|
|
|
+];
|
|
|
+// 选择
|
|
|
+const onConfirm = ({ selectedValues, selectedOptions }) => {
|
|
|
+ showPicker.value = false;
|
|
|
+ pickerValue.value = selectedValues;
|
|
|
+ form.value.dept = selectedOptions[0].value;
|
|
|
+};
|
|
|
+// 选择
|
|
|
+const onConfirm2 = ({ selectedValues, selectedOptions }) => {
|
|
|
+ showPicker2.value = false;
|
|
|
+ pickerValue2.value = selectedValues;
|
|
|
+ form.value.name = selectedOptions[0].value;
|
|
|
+};
|
|
|
+// 是否在提交
|
|
|
+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);
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ id.value = route.query.id;
|
|
|
+})
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.upload-tip {
|
|
|
+ font-size: 12px;
|
|
|
+ color: rgba(0, 0, 0, 0.45);
|
|
|
+}
|
|
|
+</style>
|