修复bug

This commit is contained in:
weipengfei 2023-08-15 12:34:16 +08:00
parent 92f508ca77
commit 6f68e558cf
4 changed files with 211 additions and 175 deletions

View File

@ -366,9 +366,9 @@
</el-form-item> -->
</el-form>
</el-card>
<el-card v-if="isshow">
<el-form label>
<el-form-item label="合同上传" label-width="100px" prop="field127">
<el-card>
<el-form label-width="100px">
<el-form-item v-if="isshow" label="合同上传" prop="field127">
<el-upload
:headers="{ Token: userStore.token }"
v-model:file-list="fileList"
@ -377,16 +377,30 @@
:on-success="handleAvatarSuccess_four"
multiple
:limit="1"
v-if="+formData?.check_status < 3"
>
<el-button type="primary">上传</el-button>
<el-button type="primary">{{
formData.file ? "重新上传" : "上传"
}}</el-button>
</el-upload>
<a
v-if="formData.file"
style="margin-left: 10px; color: #4a5dff; align-self: flex-start"
:href="formData.file"
target="_blank"
>合同已上传,点击查看</a
>
</el-form-item>
<el-form-item>
<el-button
style="margin-left: 100px"
type="primary"
@click="submitContract"
>确定</el-button
<el-form-item v-if="isshow">
<el-button type="primary" @click="submitContract">确定</el-button>
</el-form-item>
<el-form-item v-else-if="formData.file">
<a
v-if="formData.file"
style="margin-left: 10px; color: #4a5dff"
:href="formData.file"
target="_blank"
>查看合同</a
>
</el-form-item>
</el-form>
@ -418,6 +432,7 @@ const formData = reactive({
contract_no: "",
file: "",
status: "",
check_status: "",
party_a: "",
party_a_name: "",
party_b: "",
@ -445,6 +460,9 @@ const userStore = useUserStore();
async function render() {
//
const res = await apiContractDetail({ id: query.id });
Object.keys(formData).forEach((key: any) => {
if (res[key] != null && res[key] != undefined) formData[key] = res[key];
});
compeny.value = res.party_a_info;
basicdata.value = res;
if (basicdata.value.status == 1) {
@ -461,7 +479,6 @@ async function render() {
compenyBimg.value = res.party_b_info.qualification;
} catch (error) {}
compenyimg.value = res.party_a_info.qualification;
console.log(compenyimg.value);
if (res.type == 2) {
show.value = false;
res.party_b_info.sex == 1

View File

@ -8,6 +8,7 @@
:item-content-height="themeOptions.height"
:item-border-height="themeOptions.border"
@click-item="clickItems"
@click-date="clickDate"
:items="taskList"
:current-period-label="'今日'"
>
@ -63,6 +64,10 @@ const clickItems = (e) => {
emits("clickItem", e.id);
};
const clickDate = (e) => {
console.log(e);
};
const themeOptions = computed((): any => {
return {
top: "2.6em",
@ -105,6 +110,11 @@ const themeOptions = computed((): any => {
color: #fff;
cursor: pointer;
}
/* #example-simple .cv-day {
&:hover {
background-color: rgba($color: #000000, $alpha: 0.1);
}
} */
#example-simple .cv-item.custom-date-class-red {
background-color: #f66;

View File

@ -1,204 +1,213 @@
<template>
<div class="edit-popup">
<popup
ref="popupRef"
:title="title"
:async="true"
width="800px"
@confirm="handleSubmit"
@close="handleClose"
:clickModalClose="mode == 'show'"
:button="mode != 'show'"
>
<el-form
ref="formRef"
:rules="rules"
class="formdata"
:model="formData"
label-width="120px"
>
<el-form-item v-if="formData.id" required label="任务ID" prop="id">
<el-input
:disabled="true"
v-model="formData.id"
clearable
placeholder="请输入任务模板"
/>
</el-form-item>
<el-form-item required label="任务日期" prop="datetime">
<el-date-picker
:disabled="isDisabled"
v-model="formData.datetime"
name="datetime"
type="daterange"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
@change="changeDateTime"
/>
</el-form-item>
<el-form-item required label="任务模板" prop="template_id">
<el-input
:disabled="isDisabled"
v-model="formData.template_name"
@click="isShow = true"
name="template_id"
clearable
placeholder="请输入任务模板"
/>
</el-form-item>
<el-form-item v-if="mode == 'show'" label="">
<el-button type="primary" @click="clickUpdate"> 修改 </el-button>
<el-button type="danger" @click="clickDelete"> 删除 </el-button>
</el-form-item>
</el-form>
</popup>
<el-dialog v-model="isShow" title="选择任务" width="60%">
<DialogIndex @customEvent="customEvent" />
</el-dialog>
</div>
<div class="edit-popup">
<popup
ref="popupRef"
:title="title"
:async="true"
width="800px"
@confirm="handleSubmit"
@close="handleClose"
:clickModalClose="mode == 'show'"
:button="mode != 'show'"
>
<el-form
ref="formRef"
:rules="rules"
class="formdata"
:model="formData"
label-width="120px"
>
<el-form-item v-if="formData.id" label="任务ID" prop="id">
<el-input
:disabled="true"
v-model="formData.id"
clearable
placeholder="请输入任务模板"
/>
</el-form-item>
<el-form-item label="任务日期" prop="datetime">
<el-date-picker
:disabled="isDisabled"
v-model="formData.datetime"
name="datetime"
type="daterange"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
@change="changeDateTime"
/>
</el-form-item>
<el-form-item label="任务模板" prop="template_id">
<el-input
:disabled="isDisabled"
v-model="formData.template_name"
@click="isShow = true"
name="template_id"
clearable
placeholder="请输入任务模板"
/>
</el-form-item>
<el-form-item v-if="mode == 'show'" label="">
<el-button type="primary" @click="clickUpdate"> 修改 </el-button>
<el-button type="danger" @click="clickDelete"> 删除 </el-button>
</el-form-item>
</el-form>
</popup>
<el-dialog v-model="isShow" title="选择任务模板" width="60%">
<DialogIndex @customEvent="customEvent" />
</el-dialog>
</div>
</template>
<script lang="ts" setup name="taskEidt">
import type { FormInstance, FormRules } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiTaskAdd, apiTaskEdit, apiTaskDelete } from '@/api/task'
import { reactive, onUpdated, type PropType } from 'vue'
import DialogIndex from '@/views/task_template/list_two.vue'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
const route = useRoute()
import type { FormInstance, FormRules } from "element-plus";
import Popup from "@/components/popup/index.vue";
import { apiTaskAdd, apiTaskEdit, apiTaskDelete } from "@/api/task";
import { reactive, onUpdated, type PropType } from "vue";
import DialogIndex from "@/views/task_template/list_two.vue";
import { timeFormat } from "@/utils/util";
import feedback from "@/utils/feedback";
const route = useRoute();
const emit = defineEmits(['success', 'close'])
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
const detailsdt = ref({})
const isShow = ref(false)
const title = ref('创建日程安排')
const emit = defineEmits(["success", "close"]);
const popupRef = shallowRef<InstanceType<typeof Popup>>();
const mode = ref("add");
const detailsdt = ref({});
const isShow = ref(false);
const title = ref("创建日程安排");
const changeDateTime = (e: any) => {
formData.start_time = timeFormat(e[0])
formData.end_time = timeFormat(e[1])
}
formData.start_time = timeFormat(e[0]).split(" ")[0];
formData.end_time = timeFormat(e[1]).split(" ")[0];
};
//
const formData = reactive({
id: '',
create_user_id: '',
status: '',
template_id: '',
scheduling_id: '',
template_name: '',
start_time: '',
end_time: '',
datetime: ''
})
id: "",
create_user_id: "",
status: "",
template_id: "",
scheduling_id: "",
template_name: "",
start_time: "",
end_time: "",
datetime: "",
});
interface RuleForm {
datetime: Date | string
template_id: string
datetime: Date | string;
template_id: string;
}
const rules = reactive<FormRules<RuleForm>>({
datetime: { required: true, message: '请选择时间范围', trigger: 'blur' },
template_id: {
required: true,
message: '请选择任务模板',
trigger: 'change'
}
})
datetime: { required: true, message: "请选择时间范围", trigger: "blur" },
template_id: {
required: true,
message: "请选择任务模板",
trigger: "change",
},
});
function customEvent(data: any) {
isShow.value = false
formData.template_id = data.id
formData.template_name = data.title
isShow.value = false;
formData.template_id = data.id;
formData.template_name = data.title;
}
const formRef = ref(null)
const formRef = ref(null);
const props = defineProps({
task: {
type: Object,
defualt: () => {
null
}
}
})
const isDisabled = ref(false)
task: {
type: Object,
defualt: () => {
null;
},
},
});
const isDisabled = ref(false);
const updatedForm = async () => {
if (mode.value == 'show') {
title.value = '查看日程安排'
isDisabled.value = true
Object.keys(formData).forEach((key: any) => {
if (props.task[key] != null && props.task[key] != undefined)
formData[key] = props.task[key]
})
formData.datetime = [formData.start_time.split(' ')[0], formData.end_time.split(' ')[0]]
} else {
isDisabled.value = false
Object.keys(formData).forEach((key: any) => {
formData[key] = ''
})
}
await nextTick()
formRef.value.resetFields()
}
const updatedForm = async (task: any = null) => {
try {
formRef.value.clearValidate && formRef.value?.clearValidate();
} catch (error) {
console.log(error);
}
if (mode.value == "show") {
title.value = "查看日程安排";
isDisabled.value = true;
Object.keys(formData).forEach((key: any) => {
if (task[key] != null && task[key] != undefined)
formData[key] = task[key];
});
formData.datetime = [
formData.start_time.split(" ")[0],
formData.end_time.split(" ")[0],
];
} else {
isDisabled.value = false;
Object.keys(formData).forEach((key: any) => {
formData[key] = "";
});
}
};
const clickUpdate = () => {
mode.value = 'edit'
isDisabled.value = false
}
mode.value = "edit";
isDisabled.value = false;
};
//
const clickDelete = () => {
feedback.confirm('确定要删除吗?').then(async (e) => {
if (e == 'confirm') {
await apiTaskDelete({ id: formData.id })
popupRef.value?.close()
emit('success')
}
})
}
feedback.confirm("确定要删除吗?").then(async (e) => {
if (e == "confirm") {
await apiTaskDelete({ id: formData.id });
popupRef.value?.close();
emit("success");
}
});
};
//
const handleSubmit = () => {
if (mode.value == 'show') return popupRef.value?.close()
else
formRef.value.validate(async (e: boolean) => {
if (e) {
const data = { ...formData }
if (route.query.id) {
data.scheduling_id = route.query.id.toString()
}
mode.value == 'edit' ? await apiTaskEdit(data) : await apiTaskAdd(data)
popupRef.value?.close()
emit('success')
}
})
}
if (mode.value == "show") return popupRef.value?.close();
else {
formRef.value.validate(async (e: boolean) => {
if (e) {
const data = { ...formData };
if (route.query.id) {
data.scheduling_id = route.query.id.toString();
}
data.start_time = data.start_time.split(" ")[0];
data.end_time = data.end_time.split(" ")[0];
mode.value == "edit" ? await apiTaskEdit(data) : await apiTaskAdd(data);
popupRef.value?.close();
emit("success");
}
});
}
};
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
const open = (type = "add") => {
mode.value = type;
popupRef.value?.open();
};
//
const handleClose = () => {
emit('close')
}
emit("close");
};
defineExpose({
open,
updatedForm
})
open,
updatedForm,
});
</script>
<style lang="scss" scoped>
.formdata {
.el-form-item {
.el-date-picker {
width: 100%;
}
.el-form-item {
.el-date-picker {
width: 100%;
}
}
}
</style>

View File

@ -84,7 +84,7 @@ const popupType = ref("add");
const clickTask = (e: any) => {
popupType.value = "show";
// task.value = e;
task.value = taskList.value.find((item: any) => item.id == e);
task.value = taskList.value.find((item: any) => item.id == e) || null;
handleSelect();
};
@ -170,7 +170,7 @@ const handleSelect = async () => {
showEditTow.value = true;
await nextTick();
editTowRef.value?.open("show");
editTowRef.value?.updatedForm();
editTowRef.value?.updatedForm(task.value);
};
//