| | |
| | | <el-dialog |
| | | :close-on-click-modal="false" |
| | | :visible.sync="islook" |
| | | width="35rem" |
| | | width="38rem" |
| | | class="add-event-dialog" |
| | | @close="shutdown" |
| | | > |
| | |
| | | <span>{{ titleName }}企业</span> |
| | | </div> |
| | | <div class="dialog-content-box"> |
| | | <el-form ref="form" :rules="rules" :model="form" label-width="100px" label-position="left"> |
| | | <div class="basic-info-title">基本信息</div> |
| | | <el-form |
| | | ref="form" |
| | | :rules="rules" |
| | | :model="form" |
| | | label-width="100px" |
| | | label-position="left" |
| | | > |
| | | <el-form-item label="企业编码" prop="number"> |
| | | <span v-if="editRow.look == 'look'">{{ form.number }}</span> |
| | | <el-input v-else v-model="form.number" clearable placeholder="请输入"></el-input> |
| | | <el-input |
| | | v-else |
| | | v-model="form.number" |
| | | clearable |
| | | placeholder="请输入" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="企业名称" prop="name"> |
| | | <span v-if="editRow.look == 'look'">{{ form.name }}</span> |
| | | <el-input v-else v-model="form.name" clearable placeholder="请输入"></el-input> |
| | | <el-input |
| | | v-else |
| | | v-model="form.name" |
| | | clearable |
| | | placeholder="请输入" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="企业类型" prop="enterpriseType"> |
| | | <span v-if="editRow.look == 'look'">{{ form.enterpriseType }}</span> |
| | | <el-select v-model="form.enterpriseType" placeholder="企业类型" filterable style="width: calc(100% - 30px)"> |
| | | <el-option v-for="ele in enterpriseTypeList" :key="ele.id" :label="ele.name" :value="ele.name"></el-option> |
| | | <el-select |
| | | v-model="form.enterpriseType" |
| | | placeholder="企业类型" |
| | | filterable |
| | | style="width: calc(100% - 30px)" |
| | | > |
| | | <el-option |
| | | v-for="ele in enterpriseTypeList" |
| | | :key="ele.id" |
| | | :label="ele.name" |
| | | :value="ele.name" |
| | | ></el-option> |
| | | </el-select> |
| | | <i |
| | | class="el-icon-setting margin_left_10px cursor_pointer" |
| | |
| | | </el-form-item> |
| | | <el-form-item label="联系人" prop="contact"> |
| | | <span v-if="editRow.look == 'look'">{{ form.contact }}</span> |
| | | <el-input v-else v-model="form.contact" clearable placeholder="请输入"></el-input> |
| | | <el-input |
| | | v-else |
| | | v-model="form.contact" |
| | | clearable |
| | | placeholder="请输入" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="联系方式" prop="tel"> |
| | | <el-form-item v-if="titleName == '编辑'" label="联系方式" prop="tel"> |
| | | <span v-if="editRow.look == 'look'">{{ form.tel }}</span> |
| | | <el-input |
| | | v-else |
| | |
| | | :disabled="titleName == '编辑' ? true : false" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="登录密码" prop="password"> |
| | | <el-form-item |
| | | v-if="titleName == '编辑'" |
| | | label="登录密码" |
| | | prop="password" |
| | | > |
| | | <span v-if="editRow.look == 'look'">{{ form.password }}</span> |
| | | <div v-else class="login-password-box"> |
| | | <el-input |
| | |
| | | :disabled="titleName == '编辑' ? true : false" |
| | | show-password |
| | | ></el-input> |
| | | <el-button v-if="titleName !== '编辑'" type="text" style="margin-left: 5px" @click="generateRandomNumber" |
| | | <el-button |
| | | v-if="titleName !== '编辑'" |
| | | type="text" |
| | | style="margin-left: 5px" |
| | | @click="generateRandomNumber" |
| | | >生成随机密码</el-button |
| | | > |
| | | </div> |
| | |
| | | filterable |
| | | style="width: calc(100% - 30px)" |
| | | > |
| | | <el-option v-for="item in creditGradeList" :key="item.id" :label="item.name" :value="item.name"> |
| | | <el-option |
| | | v-for="item in creditGradeList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.name" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | <i |
| | |
| | | </el-form-item> |
| | | <el-form-item label="详细地址" prop="address"> |
| | | <span v-if="editRow.look == 'look'">{{ form.address }}</span> |
| | | <el-input v-else v-model="form.address" clearable placeholder="请输入"></el-input> |
| | | <el-input |
| | | v-else |
| | | v-model="form.address" |
| | | clearable |
| | | placeholder="请输入" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="供货能力" prop="supplyCapacity"> |
| | | <span v-if="editRow.look == 'look'">{{ form.supplyCapacity }}</span> |
| | | <el-input v-else v-model="form.supplyCapacity" clearable placeholder="请输入"></el-input> |
| | | <el-input |
| | | v-else |
| | | v-model="form.supplyCapacity" |
| | | clearable |
| | | placeholder="请输入" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="组织机构代码" prop="organizationCode"> |
| | | <span v-if="editRow.look == 'look'">{{ form.organizationCode }}</span> |
| | | <el-input v-else v-model="form.organizationCode" clearable placeholder="请输入"></el-input> |
| | | <el-input |
| | | v-else |
| | | v-model="form.organizationCode" |
| | | clearable |
| | | placeholder="请输入" |
| | | ></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="供货范围" prop="supplyRange"> |
| | | <span v-if="editRow.look == 'look'">{{ form.supplyRange }}</span> |
| | |
| | | filterable |
| | | style="width: calc(100% - 30px)" |
| | | > |
| | | <el-option v-for="item in supplyRangeList" :key="item.id" :label="item.name" :value="item.name"> |
| | | <el-option |
| | | v-for="item in supplyRangeList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.name" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | <i |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { addEnterprise, updateEnterprise, addOutsideUser } from "@/api/supplierManage/outsourceSupplier" |
| | | import { getMiniDictList, saveMiniDict } from "@/api/common/other" // 质检方式 |
| | | import VersionType from "@/views/supplierManage/outsourceSupplier/components/VersionType" |
| | | import { |
| | | addEnterprise, |
| | | updateEnterprise, |
| | | addOutsideUser, |
| | | } from "@/api/supplierManage/outsourceSupplier" |
| | | import { getMiniDictList, saveMiniDict } from "@/api/common/other"; // 质检方式 |
| | | import VersionType from "@/views/supplierManage/outsourceSupplier/components/VersionType"; |
| | | export default { |
| | | components: { |
| | | VersionType |
| | | VersionType, |
| | | }, |
| | | props: { |
| | | titleName: { |
| | | type: String, |
| | | default: "新增" |
| | | default: "新增", |
| | | }, |
| | | editRow: { |
| | | type: [Object], |
| | | default: () => { |
| | | return {} |
| | | } |
| | | return {}; |
| | | }, |
| | | }, |
| | | showList: { |
| | | type: [Array] |
| | | } |
| | | type: [Array], |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | organizationCode: "", |
| | | supplyRange: "", |
| | | status: 0, |
| | | password: "123456" |
| | | password: "123456", |
| | | }, |
| | | rules: { |
| | | number: [ |
| | | { required: true, message: "请填写企业编码", trigger: "blur" } // 企业编码 |
| | | { required: true, message: "请填写企业编码", trigger: "blur" }, // 企业编码 |
| | | ], |
| | | name: [ |
| | | { required: true, message: "请填写企业名称", trigger: "blur" } // 企业名称 |
| | | { required: true, message: "请填写企业名称", trigger: "blur" }, // 企业名称 |
| | | ], |
| | | enterpriseType: [ |
| | | { required: true, message: "请选择企业类型", trigger: "change" } // 企业类型 |
| | | { required: true, message: "请选择企业类型", trigger: "change" }, // 企业类型 |
| | | ], |
| | | tel: [ |
| | | { required: true, message: "请填写联系方式", trigger: "blur" } // 联系方式 |
| | | { required: true, message: "请填写联系方式", trigger: "blur" }, // 联系方式 |
| | | ], |
| | | password: [ |
| | | { required: true, message: "请填写登录密码", trigger: "blur" } // 登录密码 |
| | | ] |
| | | { required: true, message: "请填写登录密码", trigger: "blur" }, // 登录密码 |
| | | ], |
| | | }, |
| | | editDropdownList: [], |
| | | enterpriseTypeList: [], // 企业类型列表 |
| | | creditGradeList: [], // 信用等级 |
| | | supplyRangeList: [], // 供货范围 |
| | | currentType: 0, |
| | | editDropdownTitle: "" |
| | | } |
| | | editDropdownTitle: "", |
| | | }; |
| | | }, |
| | | mounted() { |
| | | this.handleGetList(5) |
| | | this.handleGetList(6) |
| | | this.handleGetList(7) |
| | | this.handleGetList(5); |
| | | this.handleGetList(6); |
| | | this.handleGetList(7); |
| | | }, |
| | | watch: { |
| | | editRow(val) { |
| | | if (val.id && this.islook) { |
| | | this.initFormData(val) |
| | | this.initFormData(val); |
| | | } else { |
| | | this.$nextTick(() => { |
| | | this.$refs.form.resetFields() |
| | | }) |
| | | this.$refs.form.resetFields(); |
| | | }); |
| | | } |
| | | }, |
| | | islook(val) { |
| | | if (val) { |
| | | debugger |
| | | this.form = { |
| | | number: "", |
| | | name: "", |
| | |
| | | supplyCapacity: "", |
| | | organizationCode: "", |
| | | supplyRange: "", |
| | | status: 0 |
| | | } |
| | | status: 0, |
| | | }; |
| | | if (this.editRow && this.editRow.id) { |
| | | this.initFormData(this.editRow) |
| | | this.initFormData(this.editRow); |
| | | } else { |
| | | this.$nextTick(() => { |
| | | this.$refs.form.resetFields() |
| | | }) |
| | | this.$refs.form.resetFields(); |
| | | this.$forceUpdate() |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | methods: { |
| | | addPreProduction() { |
| | | this.$refs.add.materialVisible = true |
| | | this.$refs.add.materialVisible = true; |
| | | }, |
| | | initFormData(row) { |
| | | if (row.id) { |
| | | this.form = JSON.parse(JSON.stringify(row)) |
| | | this.form = 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) { |
| | | let params = JSON.parse(JSON.stringify(this.form)) |
| | | let params = JSON.parse(JSON.stringify(this.form)); |
| | | // params.takerId = params.takerObj.split("&")[0]; |
| | | // params.takerName = params.takerObj.split("&")[1]; |
| | | if (this.editRow && this.editRow.id) { |
| | | params.id = this.editRow.id |
| | | params.id = this.editRow.id; |
| | | updateEnterprise(params).then((res) => { |
| | | if (res.code == 200) { |
| | | this.$message.success("编辑成功!") |
| | | this.$emit("shutdown", this.form) |
| | | this.shutdown() |
| | | this.$message.success("编辑企业成功!"); |
| | | this.$emit("shutdown", this.form); |
| | | this.shutdown(); |
| | | } |
| | | }) |
| | | }); |
| | | } else { |
| | | addEnterprise(params).then((res) => { |
| | | if (res.code == 200) { |
| | | console.log(res, "5555") |
| | | this.addOutsideUser(res.data) |
| | | this.$message.success("新增企业成功!"); |
| | | this.$emit("shutdown", this.form); |
| | | this.shutdown(); |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | }, |
| | | // 添加外部用户 |
| | | addOutsideUser(data) { |
| | |
| | | companyName: data.name, |
| | | companyNumber: data.number, |
| | | passWord: this.form.password, |
| | | userName: data.tel |
| | | userName: data.tel, |
| | | }).then((res) => { |
| | | console.log(res) |
| | | console.log(res); |
| | | if (res.code == 200) { |
| | | this.$message.success("添加成功!") |
| | | this.$emit("shutdown", this.form) |
| | | this.shutdown() |
| | | this.$message.success("添加成功!"); |
| | | this.$emit("shutdown", this.form); |
| | | this.shutdown(); |
| | | } |
| | | }) |
| | | }); |
| | | }, |
| | | // 企业类型?信用等级/供货范围点击 |
| | | handleCommonShow(type) { |
| | | this.currentType = type |
| | | this.editDropdownTitle = type == 5 ? "企业类型" : type == 6 ? "信用等级" : type == 7 ? "供货范围" : "" |
| | | this.editDropdownList = [] |
| | | this.handleGetList(type) |
| | | this.$refs.editDialog.isvisible = true |
| | | this.currentType = type; |
| | | this.editDropdownTitle = |
| | | type == 5 |
| | | ? "企业类型" |
| | | : type == 6 |
| | | ? "信用等级" |
| | | : type == 7 |
| | | ? "供货范围" |
| | | : ""; |
| | | this.editDropdownList = []; |
| | | this.handleGetList(type); |
| | | this.$refs.editDialog.isvisible = true; |
| | | }, |
| | | // 获取企业类型?信用等级/供货范围 |
| | | handleGetList(type) { |
| | | this.currentType = type |
| | | this.currentType = type; |
| | | getMiniDictList({ type: type }).then((res) => { |
| | | this.editDropdownList = res.data |
| | | this.editDropdownList = res.data; |
| | | if (type == 5) { |
| | | this.enterpriseTypeList = res.data |
| | | this.enterpriseTypeList = res.data; |
| | | } else if (type == 6) { |
| | | this.creditGradeList = res.data |
| | | this.creditGradeList = res.data; |
| | | } else if (type == 7) { |
| | | this.supplyRangeList = res.data |
| | | this.supplyRangeList = res.data; |
| | | } |
| | | }) |
| | | }); |
| | | }, |
| | | // 保存企业类型?信用等级/供货范围 |
| | | handleConfirmSave(data) { |
| | |
| | | if (res.code == 200) { |
| | | this.$message({ |
| | | message: "操作成功!", |
| | | type: "success" |
| | | }) |
| | | this.$refs.editDialog.isvisible = false |
| | | this.handleGetList(this.currentType) |
| | | type: "success", |
| | | }); |
| | | this.$refs.editDialog.isvisible = false; |
| | | this.handleGetList(this.currentType); |
| | | } |
| | | }) |
| | | }); |
| | | }, |
| | | shutdown() { |
| | | this.$refs.form.resetFields() |
| | | this.islook = false |
| | | 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) |
| | | } |
| | | } |
| | | } |
| | | 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; |
| | | height:380px; |
| | | height:480px; |
| | | overflow-y:auto; |
| | | // overflow-y: auto; |
| | | // .el-form { |
| | |
| | | .login-password-box { |
| | | display: flex; |
| | | } |
| | | .basic-info-title { |
| | | background-color: #f4f8fe; |
| | | padding-left: 10px; |
| | | font-size: 15px; |
| | | font-weight: bold; |
| | | color: #666; |
| | | height: 42px; |
| | | line-height: 42px; |
| | | margin-bottom:15px; |
| | | } |
| | | .el-form{ |
| | | padding: 0px 30px; |
| | | } |
| | | } |
| | | |
| | | ::v-deep { |
| | | .el-tabs__content { |
| | | height: calc(100% - 55px); |
| | | overflow-y: auto; |
| | | } |
| | | .el-dialog__body{ |
| | | padding-top:15px; |
| | | } |
| | | } |
| | | </style> |