|
@@ -33,7 +33,7 @@
|
|
|
</el-table-column>
|
|
|
<!-- <el-table-column prop="remark" label="备注" width="200">
|
|
|
</el-table-column> -->
|
|
|
- <el-table-column label="操作" width="200">
|
|
|
+ <el-table-column label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button size="mini" @click="upDate(scope.$index, scope.row)">编辑</el-button>
|
|
|
<el-button size="mini" type="danger" @click="del(scope.$index, scope.row)">删除</el-button>
|
|
@@ -51,41 +51,43 @@
|
|
|
<el-dialog title="修改公司信息" :visible.sync="upDataVisible" width="50%" :before-close="handleClose">
|
|
|
<div>
|
|
|
<div>
|
|
|
- <el-input placeholder="请输入内容" v-model="updata.CompanyName" style="width: 50%;">
|
|
|
- <template slot="prepend">公司名称:</template>
|
|
|
- </el-input>
|
|
|
- <el-input placeholder="请输入内容" v-model="updata.CompanyCode" style="width: 40%;">
|
|
|
- <template slot="prepend">公司Codel:</template>
|
|
|
- </el-input>
|
|
|
+ <el-form :model="updata" :rules="rules" ref="updata" label-width="100px" class="demo-ruleForm">
|
|
|
+ <el-form-item label="公司名称" prop="CompanyName">
|
|
|
+ <el-input placeholder="请输入内容" v-model="updata.CompanyName">
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="公司Codel" prop="CompanyCode">
|
|
|
+ <el-input placeholder="请输入内容" v-model="updata.CompanyCode">
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="公司地址" prop="Address">
|
|
|
+ <el-input placeholder="请输入内容" v-model="updata.Address">
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="公司负责人" prop="ParentDepId">
|
|
|
+ <el-select v-model="valueUserValue" placeholder="请选择负责人">
|
|
|
+ <el-option v-for="item in optionsUsers" :key="item.value" :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="负责人电话" prop="Tel">
|
|
|
+ <el-input placeholder="请输入内容" v-model="updata.Tel">
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="上级公司" prop="ParentDepId">
|
|
|
+ <el-select v-model="valueCompanyValue" placeholder="请选择负责人">
|
|
|
+ <el-option v-for="item in optionsCompanys" :key="item.value" :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="备注" prop="Remark">
|
|
|
+ <el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="updata.Remark"
|
|
|
+ style="width: 80%;"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
</div>
|
|
|
- <div style="margin-top: 5px;">
|
|
|
- <el-input placeholder="请输入内容" v-model="updata.Address" style="width: 91%;">
|
|
|
- <template slot="prepend">公司地址:</template>
|
|
|
- </el-input>
|
|
|
- </div>
|
|
|
- <div style="margin-top: 5px;">
|
|
|
- <el-select v-model="valueUserValue" filterable placeholder="请选择负责人">
|
|
|
- <el-option v-for="item in optionsUsers" :key="item.value" :label="item.label"
|
|
|
- :value="item.value">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- <el-input placeholder="请输入内容" v-model="updata.Tel" style="width: 40%;">
|
|
|
- <template slot="prepend">负责人联系方式:</template>
|
|
|
- </el-input>
|
|
|
- </div>
|
|
|
- <div style="margin-top: 5px;">
|
|
|
- <el-select v-model="valueCompanyValue" filterable placeholder="请选择上级公司">
|
|
|
- <el-option v-for="item in optionsCompanys" :key="item.value" :label="item.label"
|
|
|
- :value="item.value">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </div>
|
|
|
- <div style="margin-top: 5px;">
|
|
|
- <div>备注:</div>
|
|
|
- <el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="updata.Remark"
|
|
|
- style="width: 80%;"></el-input>
|
|
|
- </div>
|
|
|
-
|
|
|
</div>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="upDataVisible = false">取 消</el-button>
|
|
@@ -96,41 +98,43 @@
|
|
|
<el-dialog title="添加公司" :visible.sync="addDataVisible" width="50%" :before-close="handleClose">
|
|
|
<div>
|
|
|
<div>
|
|
|
- <el-input placeholder="请输入内容" v-model="adddata.CompanyName" style="width: 50%;">
|
|
|
- <template slot="prepend">公司名称:</template>
|
|
|
- </el-input>
|
|
|
- <el-input placeholder="请输入内容" v-model="adddata.CompanyCode" style="width: 40%;">
|
|
|
- <template slot="prepend">公司Codel:</template>
|
|
|
- </el-input>
|
|
|
- </div>
|
|
|
- <div style="margin-top: 5px;">
|
|
|
- <el-input placeholder="请输入内容" v-model="adddata.Address" style="width: 91%;">
|
|
|
- <template slot="prepend">公司地址:</template>
|
|
|
- </el-input>
|
|
|
- </div>
|
|
|
- <div style="margin-top: 5px;">
|
|
|
- <el-select v-model="valueUserValue" filterable placeholder="请选择负责人">
|
|
|
- <el-option v-for="item in optionsUsers" :key="item.value" :label="item.label"
|
|
|
- :value="item.value">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- <el-input placeholder="请输入内容" v-model="adddata.Tel" style="width: 40%;">
|
|
|
- <template slot="prepend">负责人联系方式:</template>
|
|
|
- </el-input>
|
|
|
- </div>
|
|
|
- <div style="margin-top: 5px;">
|
|
|
- <el-select v-model="valueCompanyValue" filterable placeholder="请选择上级公司">
|
|
|
- <el-option v-for="item in optionsCompanys" :key="item.value" :label="item.label"
|
|
|
- :value="item.value">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </div>
|
|
|
- <div style="margin-top: 5px;">
|
|
|
- <div>备注:</div>
|
|
|
- <el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="adddata.Remark"
|
|
|
- style="width: 80%;"></el-input>
|
|
|
+ <el-form :model="adddata" :rules="rules" ref="adddata" label-width="100px" class="demo-ruleForm">
|
|
|
+ <el-form-item label="公司名称" prop="CompanyName">
|
|
|
+ <el-input placeholder="请输入内容" v-model="adddata.CompanyName">
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="公司Codel" prop="CompanyCode">
|
|
|
+ <el-input placeholder="请输入内容" v-model="adddata.CompanyCode">
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="公司地址" prop="Address">
|
|
|
+ <el-input placeholder="请输入内容" v-model="adddata.Address">
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="公司负责人" prop="ParentDepId">
|
|
|
+ <el-select v-model="valueUserValue" placeholder="请选择负责人">
|
|
|
+ <el-option v-for="item in optionsUsers" :key="item.value" :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="负责人电话" prop="Tel">
|
|
|
+ <el-input placeholder="请输入内容" v-model="adddata.Tel">
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="上级公司" prop="ParentDepId">
|
|
|
+ <el-select v-model="valueCompanyValue" placeholder="请选择负责人">
|
|
|
+ <el-option v-for="item in optionsCompanys" :key="item.value" :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="备注" prop="Remark">
|
|
|
+ <el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="adddata.Remark"
|
|
|
+ style="width: 80%;"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="addDataVisible = false">取 消</el-button>
|
|
@@ -146,6 +150,16 @@ import { co, el } from '@fullcalendar/core/internal-common';
|
|
|
import { del } from 'vue';
|
|
|
export default {
|
|
|
data() {
|
|
|
+ var isnumber = (rule, value, callback) => {
|
|
|
+ debugger
|
|
|
+ var reg = /^1[3456789]\d{9}$/;//小数点左边最高16位,小数点右边最多4位
|
|
|
+ if (reg.test(value)) {
|
|
|
+ callback();
|
|
|
+ } else
|
|
|
+ callback(new Error("请输入正确的手机号"));
|
|
|
+
|
|
|
+
|
|
|
+ };
|
|
|
return {
|
|
|
|
|
|
tableDatas: [],
|
|
@@ -186,7 +200,26 @@ export default {
|
|
|
value: 0,
|
|
|
label: '请选择上级公司'
|
|
|
}],
|
|
|
- valueCompanyValue: 0
|
|
|
+ valueCompanyValue: 0,
|
|
|
+ //验证
|
|
|
+
|
|
|
+ rules: {
|
|
|
+ CompanyName: [
|
|
|
+ { required: true, message: '请输入公司名称', trigger: 'blur' },
|
|
|
+ ],
|
|
|
+ CompanyCode: [
|
|
|
+ { required: true, message: '请输入公司Code', trigger: 'blur' },
|
|
|
+ ],
|
|
|
+ Address: [
|
|
|
+ { required: true, message: '公司地址不能为空', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ ContactUserId: [
|
|
|
+ { required: true, message: '负责人不能为空', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ Tel: [
|
|
|
+ { validator: isnumber, message: '请输入正确的手机号', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ },
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -225,7 +258,9 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
- })
|
|
|
+ }).catch(function (error) {
|
|
|
+ that.$message.error("网络错误,请稍后重试");
|
|
|
+ });
|
|
|
},
|
|
|
Inquireclick() {
|
|
|
var newarr = [];
|
|
@@ -260,49 +295,59 @@ export default {
|
|
|
upDateBtn() {
|
|
|
debugger
|
|
|
var that = this
|
|
|
- if (that.updata.Id != 0) {
|
|
|
- if (that.updata.CompanyName == "" || that.updata.CompanyName == undefined) {
|
|
|
- that.$message.error("公司名称不能为空");
|
|
|
- return
|
|
|
- }
|
|
|
- if (that.updata.CompanyCode == "") {
|
|
|
- that.$message.error("公司code不能为空");
|
|
|
- return
|
|
|
- }
|
|
|
- if (that.updata.Address == "") {
|
|
|
- that.$message.error("公司地址不能为空");
|
|
|
- return
|
|
|
- }
|
|
|
- if (that.updata.ContactUserId == 0) {
|
|
|
- that.$message.error("请选择公司负责人");
|
|
|
- return
|
|
|
- }
|
|
|
+ that.$refs.updata.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
|
|
|
- debugger;
|
|
|
- var url = "http://localhost:5256/api/System/EditCompany"
|
|
|
- var that = this
|
|
|
- that.$axios({
|
|
|
- method: 'post',
|
|
|
- url: url,
|
|
|
- headers: {
|
|
|
- Authorization: 'Bearer ' + that.token
|
|
|
- },
|
|
|
- data: that.updata
|
|
|
- }).then(function (res) {
|
|
|
- console.log(res)
|
|
|
- debugger
|
|
|
- if (res.data.code == 200) {
|
|
|
- that.$message({
|
|
|
- message: '修改成功!',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
- that.upDataVisible = false
|
|
|
- } else {
|
|
|
- that.$message.error('保修改失败!');
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ if (that.updata.Id != 0) {
|
|
|
+ if (that.updata.CompanyName == "" || that.updata.CompanyName == undefined) {
|
|
|
+ that.$message.error("公司名称不能为空");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (that.updata.CompanyCode == "") {
|
|
|
+ that.$message.error("公司code不能为空");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (that.updata.Address == "") {
|
|
|
+ that.$message.error("公司地址不能为空");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (that.updata.ContactUserId == 0) {
|
|
|
+ that.$message.error("请选择公司负责人");
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
+ debugger;
|
|
|
+ var url = "http://localhost:5256/api/System/EditCompany"
|
|
|
+ var that = this
|
|
|
+ that.$axios({
|
|
|
+ method: 'post',
|
|
|
+ url: url,
|
|
|
+ headers: {
|
|
|
+ Authorization: 'Bearer ' + that.token
|
|
|
+ },
|
|
|
+ data: that.updata
|
|
|
+ }).then(function (res) {
|
|
|
+ console.log(res)
|
|
|
+ debugger
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ that.$message({
|
|
|
+ message: '修改成功!',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ that.upDataVisible = false
|
|
|
+ that.company();
|
|
|
+ } else {
|
|
|
+ that.$message.error('保修改失败!');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message.error('请完善信息在保存!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }).catch(function (error) {
|
|
|
+ that.$message.error("网络错误,请稍后重试");
|
|
|
+ });
|
|
|
},
|
|
|
//关闭修改框
|
|
|
handleClose(done) {
|
|
@@ -354,72 +399,83 @@ export default {
|
|
|
this.addDataVisible = true
|
|
|
|
|
|
},
|
|
|
+
|
|
|
addDateBtn() {
|
|
|
debugger
|
|
|
- var that = this
|
|
|
- this.adddata.ContactUserId = this.valueUserValue
|
|
|
- this.adddata.ParentCompanyId = this.valueCompanyValue
|
|
|
- this.adddata.CreateUserId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
|
|
|
- if (that.adddata.CompanyName == "" || that.updata.CompanyName == undefined) {
|
|
|
- that.$message.error("公司名称不能为空");
|
|
|
- return
|
|
|
- }
|
|
|
- if (that.adddata.CompanyCode == "") {
|
|
|
- that.$message.error("公司code不能为空");
|
|
|
- return
|
|
|
- }
|
|
|
- if (that.adddata.Address == "") {
|
|
|
- that.$message.error("公司地址不能为空");
|
|
|
- return
|
|
|
- }
|
|
|
- if (that.adddata.ContactUserId == 0) {
|
|
|
- that.$message.error("请选择公司负责人");
|
|
|
- return
|
|
|
- }
|
|
|
- if (that.adddata.Tel == "") {
|
|
|
- that.$message.error("请输入手机号");
|
|
|
- return
|
|
|
- } else {
|
|
|
- var reg = /^1[3456789]\d{9}$/;
|
|
|
- if (!reg.test(that.adddata.Tel)) {
|
|
|
- that.$message.error("请输入有效的手机号");
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
+ this.$refs.adddata.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ var that = this
|
|
|
+ this.adddata.ContactUserId = this.valueUserValue
|
|
|
+ this.adddata.ParentCompanyId = this.valueCompanyValue
|
|
|
+ this.adddata.CreateUserId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
|
|
|
+ if (that.adddata.CompanyName == "" || that.updata.CompanyName == undefined) {
|
|
|
+ that.$message.error("公司名称不能为空");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (that.adddata.CompanyCode == "") {
|
|
|
+ that.$message.error("公司code不能为空");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (that.adddata.Address == "") {
|
|
|
+ that.$message.error("公司地址不能为空");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (that.adddata.ContactUserId == 0) {
|
|
|
+ that.$message.error("请选择公司负责人");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (that.adddata.Tel == "") {
|
|
|
+ that.$message.error("请输入手机号");
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ var reg = /^1[3456789]\d{9}$/;
|
|
|
+ if (!reg.test(that.adddata.Tel)) {
|
|
|
+ that.$message.error("请输入有效的手机号");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- var url = "http://localhost:5256/api/System/AddCompany"
|
|
|
+ var url = "http://localhost:5256/api/System/AddCompany"
|
|
|
|
|
|
- that.$axios({
|
|
|
- method: 'post',
|
|
|
- url: url,
|
|
|
- headers: {
|
|
|
- Authorization: 'Bearer ' + that.token
|
|
|
- },
|
|
|
- data: that.adddata
|
|
|
- }).then(function (res) {
|
|
|
- console.log(res)
|
|
|
- debugger
|
|
|
- if (res.data.code == 200) {
|
|
|
- that.$message({
|
|
|
- message: '添加成功!',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
- that.addDataVisible = false;
|
|
|
- this.adddata.CreateUserId = 0
|
|
|
- this.adddata.CompanyCode = ""
|
|
|
- this.adddata.CompanyName = ""
|
|
|
- this.adddata.Address = ""
|
|
|
- this.adddata.ContactUserId = 0
|
|
|
- this.adddata.Tel = ""
|
|
|
- this.adddata.ParentCompanyId = 0
|
|
|
- this.adddata.Remark = ""
|
|
|
- this.valueUserValue = 0
|
|
|
- this.valueCompanyValue = 0
|
|
|
- that.company();
|
|
|
+ that.$axios({
|
|
|
+ method: 'post',
|
|
|
+ url: url,
|
|
|
+ headers: {
|
|
|
+ Authorization: 'Bearer ' + that.token
|
|
|
+ },
|
|
|
+ data: that.adddata
|
|
|
+ }).then(function (res) {
|
|
|
+ console.log(res)
|
|
|
+ debugger
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ that.$message({
|
|
|
+ message: '添加成功!',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ debugger
|
|
|
+ that.addDataVisible = false;
|
|
|
+ that.adddata.CreateUserId = 0
|
|
|
+ that.adddata.CompanyCode = ""
|
|
|
+ that.adddata.CompanyName = ""
|
|
|
+ that.adddata.Address = ""
|
|
|
+ that.adddata.ContactUserId = 0
|
|
|
+ that.adddata.Tel = ""
|
|
|
+ that.adddata.ParentCompanyId = 0
|
|
|
+ that.adddata.Remark = ""
|
|
|
+ that.valueUserValue = 0
|
|
|
+ that.valueCompanyValue = 0
|
|
|
+ that.company();
|
|
|
+ } else {
|
|
|
+ that.$message.error('添加失败!');
|
|
|
+ }
|
|
|
+ })
|
|
|
} else {
|
|
|
- that.$message.error('添加失败!');
|
|
|
+ this.$message.error('请完善信息在保存!');
|
|
|
+ return false;
|
|
|
}
|
|
|
- })
|
|
|
+ }).catch(function (error) {
|
|
|
+ that.$message.error("网络错误,请稍后重试");
|
|
|
+ });
|
|
|
},
|
|
|
//#endregion
|
|
|
//绑定负责人下拉框
|