|
@@ -2,10 +2,36 @@
|
|
<my-dialog
|
|
<my-dialog
|
|
:visible="visible"
|
|
:visible="visible"
|
|
:header="`追加工时`"
|
|
:header="`追加工时`"
|
|
- :width="600"
|
|
|
|
|
|
+ :width="500"
|
|
:closeOnOverlayClick="false"
|
|
:closeOnOverlayClick="false"
|
|
@close="emit('update:visible', false)"
|
|
@close="emit('update:visible', false)"
|
|
>
|
|
>
|
|
|
|
+ <t-form ref="formRef" :data="params" :rules="rules" :labelWidth="80">
|
|
|
|
+ <t-form-item name="type" :label="'增加类别'">
|
|
|
|
+ <t-select
|
|
|
|
+ v-model="params.type"
|
|
|
|
+ @change="params.addTime = ''"
|
|
|
|
+ :options="[
|
|
|
|
+ { value: '1', label: '天' },
|
|
|
|
+ { value: '2', label: '小时' },
|
|
|
|
+ ]"
|
|
|
|
+ ></t-select>
|
|
|
|
+ </t-form-item>
|
|
|
|
+ <t-form-item name="addTime" :label="'时长'">
|
|
|
|
+ <t-input-number
|
|
|
|
+ v-model="params.addTime"
|
|
|
|
+ theme="column"
|
|
|
|
+ :step="0.1"
|
|
|
|
+ :decimalPlaces="1"
|
|
|
|
+ ></t-input-number>
|
|
|
|
+ <span style="margin-left: 4px">{{
|
|
|
|
+ params.type == '1' ? '天' : '小时'
|
|
|
|
+ }}</span>
|
|
|
|
+ </t-form-item>
|
|
|
|
+ <t-form-item name="sopNo" :label="'sop'" v-if="needChoose">
|
|
|
|
+ <t-select v-model="params.sopNo" :options="sopOptions"></t-select>
|
|
|
|
+ </t-form-item>
|
|
|
|
+ </t-form>
|
|
<template #foot>
|
|
<template #foot>
|
|
<t-button theme="default" @click="emit('update:visible', false)"
|
|
<t-button theme="default" @click="emit('update:visible', false)"
|
|
>取消</t-button
|
|
>取消</t-button
|
|
@@ -14,12 +40,11 @@
|
|
</template>
|
|
</template>
|
|
</my-dialog>
|
|
</my-dialog>
|
|
</template>
|
|
</template>
|
|
-<script setup name="AddUserDialog">
|
|
|
|
|
|
+<script setup name="AppendHoursDialog">
|
|
import useClearDialog from '@/hooks/useClearDialog';
|
|
import useClearDialog from '@/hooks/useClearDialog';
|
|
-import { ref, computed, reactive } from 'vue';
|
|
|
|
-import { getOrgStructList, getRoleList, addUser } from '@/api/user';
|
|
|
|
-import { useRequest } from 'vue-request';
|
|
|
|
-import { GENDER_TYPE } from '@/config/constants';
|
|
|
|
|
|
+import { ref, computed, reactive, watch } from 'vue';
|
|
|
|
+import { findSopList, appendHoursSave } from '@/api/work-hours';
|
|
|
|
+import { MessagePlugin } from 'tdesign-vue-next';
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
visible: Boolean,
|
|
visible: Boolean,
|
|
@@ -27,79 +52,70 @@ const props = defineProps({
|
|
});
|
|
});
|
|
const emit = defineEmits(['close', 'success']);
|
|
const emit = defineEmits(['close', 'success']);
|
|
const formRef = ref(null);
|
|
const formRef = ref(null);
|
|
-let formData = reactive({
|
|
|
|
- addDays: '', // 增加天数
|
|
|
|
- addHours: '', // 增加工时
|
|
|
|
|
|
+let params = reactive({
|
|
|
|
+ type: '1',
|
|
|
|
+ addTime: '',
|
|
serviceId: '',
|
|
serviceId: '',
|
|
sopNo: null, // sopNo 区协不传其他必传
|
|
sopNo: null, // sopNo 区协不传其他必传
|
|
- userId: '', // 要增加工时所选择的人的id
|
|
|
|
});
|
|
});
|
|
-
|
|
|
|
|
|
+const needChoose = ref(false);
|
|
|
|
+const sopOptions = ref([]);
|
|
const rules = {
|
|
const rules = {
|
|
- loginName: [
|
|
|
|
- {
|
|
|
|
- required: true,
|
|
|
|
- message: '请填写登录名',
|
|
|
|
- type: 'error',
|
|
|
|
- trigger: 'blur',
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- realName: [
|
|
|
|
|
|
+ addTime: [
|
|
{
|
|
{
|
|
required: true,
|
|
required: true,
|
|
- message: '请填写真实姓名',
|
|
|
|
|
|
+ message: '请填写时长',
|
|
type: 'error',
|
|
type: 'error',
|
|
- trigger: 'blur',
|
|
|
|
},
|
|
},
|
|
],
|
|
],
|
|
- mobileNumber: [
|
|
|
|
|
|
+ sopNo: [
|
|
{
|
|
{
|
|
required: true,
|
|
required: true,
|
|
- message: '请填写手机号',
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- orgId: [
|
|
|
|
- {
|
|
|
|
- required: true,
|
|
|
|
- message: '请选择机构',
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- gender: [
|
|
|
|
- {
|
|
|
|
- required: true,
|
|
|
|
- message: '请选择性别',
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- roleIds: [
|
|
|
|
- {
|
|
|
|
- required: true,
|
|
|
|
- message: '请选择角色',
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- validator: (val) => {
|
|
|
|
- if (!val?.length) {
|
|
|
|
- return {
|
|
|
|
- result: false,
|
|
|
|
- message: '请选择角色',
|
|
|
|
- };
|
|
|
|
- }
|
|
|
|
- return {
|
|
|
|
- result: true,
|
|
|
|
- type: 'success',
|
|
|
|
- };
|
|
|
|
- },
|
|
|
|
|
|
+ message: '请选择sop',
|
|
},
|
|
},
|
|
],
|
|
],
|
|
};
|
|
};
|
|
-const addHandler = () => {
|
|
|
|
- addUser({ ...formData, id: props.curRow?.id || undefined }).then(() => {
|
|
|
|
- emit('success');
|
|
|
|
|
|
+const getSopList = () => {
|
|
|
|
+ const { serviceId, userId } = props.curRow;
|
|
|
|
+ findSopList({ serviceId, userId }).then((res) => {
|
|
|
|
+ sopOptions.value = (res?.sopNoList || []).map((item) => ({
|
|
|
|
+ value: item,
|
|
|
|
+ label: item,
|
|
|
|
+ }));
|
|
|
|
+ needChoose.value = res?.needChoose || false;
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
+watch(
|
|
|
|
+ () => props.visible,
|
|
|
|
+ (val) => {
|
|
|
|
+ if (val) {
|
|
|
|
+ getSopList();
|
|
|
|
+ params.type = '1';
|
|
|
|
+ params.addTime = '';
|
|
|
|
+ params.serviceId = '';
|
|
|
|
+ params.sopNo = null; // sopNo 区协不传其他必传
|
|
|
|
+ needChoose.value = false;
|
|
|
|
+ sopOptions.value = [];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+);
|
|
const save = () => {
|
|
const save = () => {
|
|
formRef.value.validate().then(async (result) => {
|
|
formRef.value.validate().then(async (result) => {
|
|
if (result === true) {
|
|
if (result === true) {
|
|
- addHandler();
|
|
|
|
|
|
+ const { serviceId, userId } = props.curRow;
|
|
|
|
+ let p = { serviceId, userId };
|
|
|
|
+ if (params.type == '1') {
|
|
|
|
+ p.addDays = params.addTime;
|
|
|
|
+ } else {
|
|
|
|
+ p.addHours = params.addTime;
|
|
|
|
+ }
|
|
|
|
+ if (needChoose.value) {
|
|
|
|
+ p.sopNo = params.sopNo;
|
|
|
|
+ }
|
|
|
|
+ appendHoursSave(p).then((res) => {
|
|
|
|
+ MessagePlugin.success('操作成功');
|
|
|
|
+ emit('success');
|
|
|
|
+ });
|
|
}
|
|
}
|
|
});
|
|
});
|
|
};
|
|
};
|