From 7045ca2f6b6bcbc3987e388bf0b25281c250ccf5 Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期五, 19 四月 2024 18:09:00 +0800 Subject: [PATCH] srm 新增编辑供应商,启用停用创建账号获取和保存企业/信用等级/供货范围 ,等大概7个接口的联调 --- src/views/supplierManage/outsourceSupplier/components/CreateAccount.vue | 199 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 199 insertions(+), 0 deletions(-) diff --git a/src/views/supplierManage/outsourceSupplier/components/CreateAccount.vue b/src/views/supplierManage/outsourceSupplier/components/CreateAccount.vue new file mode 100644 index 0000000..3db1857 --- /dev/null +++ b/src/views/supplierManage/outsourceSupplier/components/CreateAccount.vue @@ -0,0 +1,199 @@ +<template> + <el-dialog + :close-on-click-modal="false" + :visible.sync="islook" + width="35rem" + class="add-event-dialog" + @close="shutdown" + > + <div slot="title" class="tac drawerHeader"> + <span>{{ "鍒涘缓璐﹀彿" }}</span> + </div> + <div class="dialog-content-box"> + <el-form + ref="form" + :rules="rules" + :model="form" + label-width="100px" + label-position="left" + > + <el-form-item label="鐢ㄦ埛鍚�" prop="tel"> + <span v-if="editRow.look == 'look'">{{ form.tel }}</span> + <el-input + v-else + v-model="form.tel" + clearable + placeholder="璇疯緭鍏ユ墜鏈哄彿浣滀负鐢ㄦ埛鍚�" + :disabled="titleName == '缂栬緫' ? true : false" + ></el-input> + </el-form-item> + <el-form-item label="鐧诲綍瀵嗙爜" prop="password"> + <span v-if="editRow.look == 'look'">{{ form.password }}</span> + <div v-else class="login-password-box"> + <el-input + v-model="form.password" + placeholder="璇疯緭鍏ョ櫥褰曞瘑鐮�" + :auto-complete="'new-password'" + type="password" + :disabled="titleName == '缂栬緫' ? true : false" + show-password + ></el-input> + <el-button + v-if="titleName !== '缂栬緫'" + type="text" + style="margin-left: 5px" + @click="generateRandomNumber" + >鐢熸垚闅忔満瀵嗙爜</el-button + > + </div> + </el-form-item> + </el-form> + </div> + <div slot="footer" class="dialog-footer tac"> + <el-button @click="shutdown">鍙栨秷</el-button> + <el-button type="primary" @click="onSubmit(form)">纭畾</el-button> + </div> + </el-dialog> +</template> + +<script> +import { + addOutsideUser, + updateEnterprise, +} from "@/api/supplierManage/outsourceSupplier" +export default { + components: {}, + props: { + titleName: { + type: String, + default: "鏂板", + }, + editRow: { + type: [Object], + default: () => { + return {}; + }, + }, + showList: { + type: [Array], + }, + }, + data() { + return { + islook: false, + form: { + tel: "", + password: "123456", + }, + rules: { + tel: [ + { required: true, message: "璇峰~鍐欒仈绯绘柟寮�", trigger: "blur" }, // 鑱旂郴鏂瑰紡 + ], + password: [ + { required: true, message: "璇峰~鍐欑櫥褰曞瘑鐮�", trigger: "blur" }, // 鐧诲綍瀵嗙爜 + ], + }, + editParams: {}, + }; + }, + mounted() { + // this.handleGetList(5); + // this.handleGetList(6); + // this.handleGetList(7); + }, + watch: { + editRow(val) { + if (val.id && this.islook) { + this.initFormData(val); + } else { + this.$nextTick(() => { + this.$refs.form.resetFields(); + }); + } + }, + islook(val) { + if (val) { + this.form = { + tel: "", + password: "123456", + }; + } + }, + }, + methods: { + initFormData(row) { + if (row.id) { + this.editParams = JSON.parse(JSON.stringify(row)); + // if (this.form.takerId && this.form.takerName) { + // this.form.takerObj = this.form.takerId + "&" + this.form.takerName; + // } + } + }, + onSubmit() { + this.$refs.form.validate((valid) => { + if (valid) { + this.addOutsideUser(this.editRow); + } + }); + }, + // 娣诲姞澶栭儴鐢ㄦ埛 + addOutsideUser(data) { + addOutsideUser({ + companyId: data.id, + companyName: data.name, + companyNumber: data.number, + passWord: this.form.password, + userName: this.form.tel, + }).then((res) => { + console.log(res); + if (res.code == 200) { + this.updateEnterprise(); + this.$message.success("鍒涘缓璐﹀彿鎴愬姛锛�"); + this.shutdown(); + } + }); + }, + updateEnterprise() { + this.editParams.tel = this.form.tel; + updateEnterprise(this.editParams).then((res) => { + if (res.code == 200) { + this.$emit("shutdown"); + } + }); + }, + shutdown() { + this.$refs.form.resetFields(); + this.islook = false; + }, + // 闅忔満鐢熸垚鍏綅鏁板瘑鐮� + generateRandomNumber() { + let passwordStr = Math.floor(100000 + Math.random() * 900000); + console.log(passwordStr); + this.$set(this.form, "password", passwordStr+''); + }, + }, +}; +</script> + +<style lang="scss" scoped> +.dialog-content-box { + padding: 0px 30px; + // overflow-y: auto; + // .el-form { + // overflow: hidden; + // } + .login-password-box { + display: flex; + } +} + +::v-deep { + .el-tabs__content { + height: calc(100% - 55px); + overflow-y: auto; + } + .el-dialog__body{ + padding-top:15px; + } +} +</style> -- Gitblit v1.8.0