Commit 0d1869da by 无尘

feat: 增加接口

parent e55390dc
......@@ -4,7 +4,7 @@
* @Author: 无尘
* @Date: 2020-11-09 11:22:08
* @LastEditors: 无尘
* @LastEditTime: 2020-11-13 15:16:13
* @LastEditTime: 2020-11-13 17:25:39
*/
import getFetch from './get-fetch';
......@@ -36,14 +36,20 @@ let api = {
useFormData: true,
useIntercept: false
},
getAcountList: '/', // 获取试用账号列表
setAcountStatus: {
getAccountList: '/', // 获取试用账号列表
setAccountStatus: {
url: "/", // 结束试用
method: "post",
useFormData: true,
useIntercept: false
},
getEnterpriseList: '/' , // 获取企业列表数据
saveAccount: {
url: "/", // 结束试用
method: "post",
useFormData: true,
useIntercept: false
},
};
api = getFetch(api, '/hb-manage-operation-web');
......
......@@ -4,12 +4,16 @@
* @Author: 无尘
* @Date: 2020-11-13 14:24:53
* @LastEditors: 无尘
* @LastEditTime: 2020-11-13 16:32:30
* @LastEditTime: 2020-11-13 17:25:54
-->
<!--
<edit-account :edit-row="editRow"></edit-account>
import editAccount from '@/components/sql/edit-account.vue';
-->
<template>
<el-dialog :title="!!editRow.id ? '编辑账号':'新增账号'" :visible.sync="dialogVisible" width="600px" :before-close="handleClose">
<div class="">
<el-form :model="ruleForm" ref="ruleForm" label-width="10px" class="demo-ruleForm" @submit.native.prevent>
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="10px" class="demo-ruleForm" @submit.native.prevent>
<el-form-item label="用户姓名" prop="">
<el-input class="w-363" v-model="ruleForm.sqlCheckSql" maxlength="500" show-word-limit></el-input>
</el-form-item>
......@@ -59,6 +63,10 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="cancelEdit">取消</el-button>
<el-button type="primary" :loading="loadBtn" @click="submitForm('ruleForm')">立即创建</el-button>
</el-form-item>
</el-form>
</div>
</el-dialog>
......@@ -67,7 +75,7 @@
<script>
import fetch from '@/api/dictionary';
const { getEnterpriseList } = fetch;
const { getEnterpriseList, saveAccount } = fetch;
export default {
name: 'SqlDetail',
components: {},
......@@ -91,6 +99,23 @@ export default {
sqlCheckIndexType: '',
statusFlag: ''
},
rules: {
name: [
{ required: true, message: '请输入用户姓名', trigger: 'blur' },
],
region: [
{ required: true, message: '请输入用户手机号', trigger: 'blur' }
],
region: [
{ required: true, message: '请输入试用账号', trigger: 'blur' }
],
region: [
{ required: true, message: '请选择账号类型', trigger: 'change' }
],
region: [
{ required: true, message: '请选择试用企业', trigger: 'change' }
],
},
validOptions: [
{
value: '',
......@@ -134,6 +159,7 @@ export default {
},
// methods
methods: {
/**
* 输入
*/
......@@ -172,10 +198,51 @@ export default {
*/
handleClose() {
const that = this;
that.$emit('closeDetail');
that.$emit('closeEdit');
that.$refs['ruleForm'].resetFields();
},
cancelEdit() {
const that = this;
that.$emit('closeEdit');
that.$refs['ruleForm'].resetFields();
},
/**
* 确定保存
*/
submitForm: _debounce(function(form) {
const that = this;
that.loadBtn = true;
that.$refs[form].validate(valid => {
if (valid) {
that.postAdd();
} else {
that.loadBtn = false;
return false;
}
});
}, 300),
postAdd() {
const that = this;
let params = {
staffId: that.departObj.staffId,
clerkId: that.selectId
};
saveAccount(params)
.then(res => {
that.loadBtn = false;
if (res.code == '0000') {
showMsg.showmsg('添加成功', 'success');
that.$emit('refreshData', that.partForm);
return false;
}else {
}
})
.catch(function(error) {
that.loadBtn = false;
});
},
},
watch: {
editRow(newData) {
......
......@@ -4,7 +4,7 @@
* @Author: 无尘
* @Date: 2020-11-13 10:59:31
* @LastEditors: 无尘
* @LastEditTime: 2020-11-13 14:18:37
* @LastEditTime: 2020-11-13 17:26:13
-->
<template>
<div class="common-right">
......@@ -47,17 +47,19 @@
<div class="block common-wrap__page text-right m-t-24" v-if="tableData.length != 0">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[20, 40, 60, 80]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"> </el-pagination>
</div>
<edit-account v-if="showEdit" :edit-row="editRow"></edit-account>
</div>
</template>
<script>
import editAccount from '@/components/sql/edit-account.vue';
import { _debounce } from '@/common/js/public';
import fetch from '@/api/dictionary';
const { getAcountList, setAcountStatus } = fetch;
const { getAccountList, setAccountStatus } = fetch;
export default {
name: 'ProjectSql',
components: {},
components: { editAccount },
data() {
return {
searchInput: '',
......@@ -132,7 +134,7 @@ export default {
pageNum: that.currentPage,
pageSize: that.pageSize
};
getAcountList(param).then(res => {
getAccountList(param).then(res => {
that.loading = false;
that.tableData = res.result.result || [];
that.total = res.result.totalCount || 0;
......@@ -175,7 +177,7 @@ export default {
const param = {
}
setAcountStatus(param).then(res => {
setAccountStatus(param).then(res => {
if (res.code == '0000') {
that.$message({
message: '结束试用成功',
......
......@@ -4,7 +4,7 @@
* @Author: 无尘
* @Date: 2020-11-13 10:59:48
* @LastEditors: 无尘
* @LastEditTime: 2020-11-13 16:39:54
* @LastEditTime: 2020-11-13 17:26:23
-->
<template>
<div class="common-right">
......@@ -53,7 +53,7 @@
import { _debounce } from '@/common/js/public';
import fetch from '@/api/dictionary';
const { getAcountList } = fetch;
const { getAccountList } = fetch;
export default {
name: 'ProjectSql',
components: {},
......@@ -129,7 +129,7 @@ export default {
pageNum: that.currentPage,
pageSize: that.pageSize
};
getAcountList(param).then(res => {
getAccountList(param).then(res => {
that.loading = false;
that.tableData = res.result.result || [];
that.total = res.result.totalCount || 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment