From c216b78be4f9c2628333980ece55b1c135e1602a Mon Sep 17 00:00:00 2001 From: zenglf <18502938215@163.com> Date: 星期五, 10 十一月 2023 11:29:13 +0800 Subject: [PATCH] 修改Trre.js的请求头header信息 --- src/views/eam/modules/team/TeamForm.vue | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 170 insertions(+), 0 deletions(-) diff --git a/src/views/eam/modules/team/TeamForm.vue b/src/views/eam/modules/team/TeamForm.vue new file mode 100644 index 0000000..b2a0a3c --- /dev/null +++ b/src/views/eam/modules/team/TeamForm.vue @@ -0,0 +1,170 @@ +<template> + <a-spin :spinning="confirmLoading"> + <j-form-container :disabled="formDisabled"> + <a-form-model + ref="form" + :model="model" + :rules="validatorRules" + slot="detail" + > + <a-row> + <a-col :span="24"> + <a-form-model-item + label="閮ㄩ棬" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + prop="departId" + > + <j-dict-select-tag + type="list" + v-model="model.departId" + dictCode="sys_depart,depart_name,id, del_flag!='1'" + placeholder="璇烽�夋嫨閮ㄩ棬" + /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item + label="鐝粍缂栫爜" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + prop="num" + > + <a-input + v-model="model.num" + placeholder="璇疯緭鍏ョ彮缁勭紪鐮�" + ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item + label="鐝粍鍚嶇О" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + prop="name" + > + <a-input + v-model="model.name" + placeholder="璇疯緭鍏ョ彮缁勫悕绉�" + ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item + label="澶囨敞" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + prop="remark" + > + <a-input + v-model="model.remark" + placeholder="璇疯緭鍏ュ娉�" + ></a-input> + </a-form-model-item> + </a-col> + + </a-row> + </a-form-model> + </j-form-container> + </a-spin> +</template> + +<script> + +import { httpAction, getAction } from '@/api/manage' +import { validateDuplicateValue } from '@/utils/util' + +export default { + name: 'TeamForm', + components: { + }, + props: { + //琛ㄥ崟绂佺敤 + disabled: { + type: Boolean, + default: false, + required: false + } + }, + data() { + return { + model: { + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + confirmLoading: false, + validatorRules: { + departId: [ + { required: true, message: '璇烽�夋嫨閮ㄩ棬!' }, + + ], + num: [ + { required: true, message: '璇疯緭鍏ョ彮缁勭紪鐮�!' }, + + ], + name: [ + { required: true, message: '璇疯緭鍏ョ彮缁勫悕绉�!' }, + ], + }, + url: { + add: "/base/team/add", + edit: "/base/team/edit", + queryById: "/base/team/queryById" + } + } + }, + computed: { + formDisabled() { + return this.disabled + }, + }, + created() { + //澶囦唤model鍘熷鍊� + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add() { + this.edit(this.modelDefault); + }, + edit(record) { + this.model = Object.assign({}, record); + this.visible = true; + }, + submitForm() { + const that = this; + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + let httpurl = ''; + let method = ''; + if (!this.model.id) { + httpurl += this.url.add; + method = 'post'; + } else { + httpurl += this.url.edit; + method = 'put'; + } + httpAction(httpurl, this.model, method).then((res) => { + if (res.success) { + that.$message.success(res.message); + that.$emit('ok'); + } else { + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + }) + } + + }) + }, + } +} +</script> \ No newline at end of file -- Gitblit v1.9.3