|
|
@@ -170,7 +170,7 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
- <el-form-item label="备注" prop="assistEnable" required>
|
|
|
+ <el-form-item label="备注" prop="assistEnable">
|
|
|
<el-input
|
|
|
type="textarea"
|
|
|
placeholder="请输入"
|
|
|
@@ -335,12 +335,14 @@
|
|
|
getUserList,
|
|
|
getInstrAppointInfo,
|
|
|
getSettingDetail,
|
|
|
+ appointUpdate,
|
|
|
+ appointAdd,
|
|
|
} from "@/api/instr/index";
|
|
|
+ import { mapGetters } from "vuex";
|
|
|
export default {
|
|
|
name: "FrontendWebTest",
|
|
|
data() {
|
|
|
return {
|
|
|
- userInfos: {},
|
|
|
title: "预约信息",
|
|
|
visible: false,
|
|
|
InstCfgCharge: {},
|
|
|
@@ -397,10 +399,13 @@
|
|
|
},
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(["userInfo"]),
|
|
|
+ },
|
|
|
methods: {
|
|
|
// 获取课题组和服务信息
|
|
|
async getProData() {
|
|
|
- const [err, res] = await to(getMySelfProjectGroup({}));
|
|
|
+ const [err, res] = await to(getMySelfProjectGroup());
|
|
|
if (err) return;
|
|
|
this.projectOptions = [
|
|
|
{
|
|
|
@@ -409,7 +414,7 @@
|
|
|
},
|
|
|
];
|
|
|
if (res.data.id) {
|
|
|
- changeProject(res.data.id);
|
|
|
+ this.changeProject(res.data.id);
|
|
|
}
|
|
|
const [serErr, serRes] = await to(getTechList({ noPage: true }));
|
|
|
if (serErr) return;
|
|
|
@@ -518,9 +523,10 @@
|
|
|
} else {
|
|
|
const dynamicForm = row.createForm ? JSON.parse(row.createForm) : [];
|
|
|
this.form = Object.assign(this.form, { ...row });
|
|
|
- this.form.userContact = this.userInfos.phone || "";
|
|
|
- this.form.userName = this.userInfos.nickName || "";
|
|
|
- this.form.userId = this.userInfos.id || null;
|
|
|
+ console.log(this.userInfo);
|
|
|
+ this.form.userContact = this.userInfo.phone || "";
|
|
|
+ this.form.userName = this.userInfo.nickName || "";
|
|
|
+ this.form.userId = this.userInfo.id || null;
|
|
|
this.form.expenseCardId = row.expenseCardId || null;
|
|
|
this.state.dynamicForm = dynamicForm;
|
|
|
}
|
|
|
@@ -540,11 +546,102 @@
|
|
|
this.state.isShowDialog = true;
|
|
|
},
|
|
|
onCancel() {
|
|
|
- this.editFormRef.clearValidate();
|
|
|
- this.editFormRef.resetFields();
|
|
|
+ this.$refs.editFormRef.clearValidate();
|
|
|
+ this.$refs.editFormRef.resetFields();
|
|
|
this.state.isShowDialog = false;
|
|
|
},
|
|
|
- subAdd() {},
|
|
|
+ subAdd() {
|
|
|
+ this.$refs.editFormRef.validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.form.projectType == "project" && !this.form.projectId) {
|
|
|
+ this.$message.warning("请选择课题组");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ this.InstCfgCharge &&
|
|
|
+ this.form.projectType == "project" &&
|
|
|
+ !this.form.expenseCardId
|
|
|
+ ) {
|
|
|
+ this.$message.warning("请选择经费卡");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.form.projectType == "service" && !this.form.serviceId) {
|
|
|
+ this.$message.warning("请选择服务");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let hasEmpty = false;
|
|
|
+ for (let i in this.state.dynamicForm) {
|
|
|
+ for (let item of this.state.dynamicForm[i].formItemList) {
|
|
|
+ console.log(item);
|
|
|
+ if (
|
|
|
+ item.tagIcon !== "multiple-select" &&
|
|
|
+ item.required &&
|
|
|
+ !item.defaultValue
|
|
|
+ ) {
|
|
|
+ hasEmpty = true;
|
|
|
+ this.$message.warning(
|
|
|
+ `请填写${this.state.dynamicForm[i].formTitle}表单下的${item.label}`
|
|
|
+ );
|
|
|
+ break;
|
|
|
+ } else if (
|
|
|
+ item.tagIcon == "multiple-select" &&
|
|
|
+ item.required &&
|
|
|
+ item.defaultValue.length == 0
|
|
|
+ ) {
|
|
|
+ hasEmpty = true;
|
|
|
+ this.$message.warning(
|
|
|
+ `请填写${this.state.dynamicForm[i].formTitle}表单下的${item.label}`
|
|
|
+ );
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (hasEmpty) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (hasEmpty) return;
|
|
|
+ let params = Object.assign({ ...this.form });
|
|
|
+ params.expenseCardName = this.fundsList
|
|
|
+ ? this.fundsList.find((item) => item.id == params.expenseCardId)
|
|
|
+ .finAccount
|
|
|
+ : "";
|
|
|
+ params.createForm = JSON.stringify(this.state.dynamicForm);
|
|
|
+ console.log(params.createForm);
|
|
|
+ this.state.loading = true;
|
|
|
+ const post = params.id ? appointUpdate : appointAdd;
|
|
|
+ const [err] = await to(post({ ...params }));
|
|
|
+ this.state.loading = false;
|
|
|
+ if (err) return;
|
|
|
+ this.$message.success("预约成功");
|
|
|
+ // 外部页面预约
|
|
|
+ if (this.form.appointJump && this.form.appointJumpLink) {
|
|
|
+ this.$confirm(
|
|
|
+ "除了在当前系统预约,此仪器也必须在其他仪器共享平台进行预约,仪器在其他仪器共享平台编号为:" +
|
|
|
+ this.form.assetNumber,
|
|
|
+ "提示",
|
|
|
+ {
|
|
|
+ confirmButtonText: "确认",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(() => {
|
|
|
+ this.$emit("refresh");
|
|
|
+ this.closeDialog();
|
|
|
+ window.open(this.form.appointJumpLink, "_blank");
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.$emit("refresh");
|
|
|
+
|
|
|
+ this.closeDialog();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$emit("refresh");
|
|
|
+ this.closeDialog();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|