Commit 0d1869da by 无尘

feat: 增加接口

parent e55390dc
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: 无尘 * @Author: 无尘
* @Date: 2020-11-09 11:22:08 * @Date: 2020-11-09 11:22:08
* @LastEditors: 无尘 * @LastEditors: 无尘
* @LastEditTime: 2020-11-13 15:16:13 * @LastEditTime: 2020-11-13 17:25:39
*/ */
import getFetch from './get-fetch'; import getFetch from './get-fetch';
...@@ -36,14 +36,20 @@ let api = { ...@@ -36,14 +36,20 @@ let api = {
useFormData: true, useFormData: true,
useIntercept: false useIntercept: false
}, },
getAcountList: '/', // 获取试用账号列表 getAccountList: '/', // 获取试用账号列表
setAcountStatus: { setAccountStatus: {
url: "/", // 结束试用 url: "/", // 结束试用
method: "post", method: "post",
useFormData: true, useFormData: true,
useIntercept: false useIntercept: false
}, },
getEnterpriseList: '/' , // 获取企业列表数据 getEnterpriseList: '/' , // 获取企业列表数据
saveAccount: {
url: "/", // 结束试用
method: "post",
useFormData: true,
useIntercept: false
},
}; };
api = getFetch(api, '/hb-manage-operation-web'); api = getFetch(api, '/hb-manage-operation-web');
......
...@@ -4,12 +4,16 @@ ...@@ -4,12 +4,16 @@
* @Author: 无尘 * @Author: 无尘
* @Date: 2020-11-13 14:24:53 * @Date: 2020-11-13 14:24:53
* @LastEditors: 无尘 * @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> <template>
<el-dialog :title="!!editRow.id ? '编辑账号':'新增账号'" :visible.sync="dialogVisible" width="600px" :before-close="handleClose"> <el-dialog :title="!!editRow.id ? '编辑账号':'新增账号'" :visible.sync="dialogVisible" width="600px" :before-close="handleClose">
<div class=""> <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-form-item label="用户姓名" prop="">
<el-input class="w-363" v-model="ruleForm.sqlCheckSql" maxlength="500" show-word-limit></el-input> <el-input class="w-363" v-model="ruleForm.sqlCheckSql" maxlength="500" show-word-limit></el-input>
</el-form-item> </el-form-item>
...@@ -59,6 +63,10 @@ ...@@ -59,6 +63,10 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </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> </el-form>
</div> </div>
</el-dialog> </el-dialog>
...@@ -67,7 +75,7 @@ ...@@ -67,7 +75,7 @@
<script> <script>
import fetch from '@/api/dictionary'; import fetch from '@/api/dictionary';
const { getEnterpriseList } = fetch; const { getEnterpriseList, saveAccount } = fetch;
export default { export default {
name: 'SqlDetail', name: 'SqlDetail',
components: {}, components: {},
...@@ -91,6 +99,23 @@ export default { ...@@ -91,6 +99,23 @@ export default {
sqlCheckIndexType: '', sqlCheckIndexType: '',
statusFlag: '' 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: [ validOptions: [
{ {
value: '', value: '',
...@@ -134,6 +159,7 @@ export default { ...@@ -134,6 +159,7 @@ export default {
}, },
// methods // methods
methods: { methods: {
/** /**
* 输入 * 输入
*/ */
...@@ -172,10 +198,51 @@ export default { ...@@ -172,10 +198,51 @@ export default {
*/ */
handleClose() { handleClose() {
const that = this; const that = this;
that.$emit('closeDetail'); that.$emit('closeEdit');
that.$refs['ruleForm'].resetFields(); 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: { watch: {
editRow(newData) { editRow(newData) {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: 无尘 * @Author: 无尘
* @Date: 2020-11-13 10:59:31 * @Date: 2020-11-13 10:59:31
* @LastEditors: 无尘 * @LastEditors: 无尘
* @LastEditTime: 2020-11-13 14:18:37 * @LastEditTime: 2020-11-13 17:26:13
--> -->
<template> <template>
<div class="common-right"> <div class="common-right">
...@@ -47,17 +47,19 @@ ...@@ -47,17 +47,19 @@
<div class="block common-wrap__page text-right m-t-24" v-if="tableData.length != 0"> <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> <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> </div>
<edit-account v-if="showEdit" :edit-row="editRow"></edit-account>
</div> </div>
</template> </template>
<script> <script>
import editAccount from '@/components/sql/edit-account.vue';
import { _debounce } from '@/common/js/public'; import { _debounce } from '@/common/js/public';
import fetch from '@/api/dictionary'; import fetch from '@/api/dictionary';
const { getAcountList, setAcountStatus } = fetch; const { getAccountList, setAccountStatus } = fetch;
export default { export default {
name: 'ProjectSql', name: 'ProjectSql',
components: {}, components: { editAccount },
data() { data() {
return { return {
searchInput: '', searchInput: '',
...@@ -132,7 +134,7 @@ export default { ...@@ -132,7 +134,7 @@ export default {
pageNum: that.currentPage, pageNum: that.currentPage,
pageSize: that.pageSize pageSize: that.pageSize
}; };
getAcountList(param).then(res => { getAccountList(param).then(res => {
that.loading = false; that.loading = false;
that.tableData = res.result.result || []; that.tableData = res.result.result || [];
that.total = res.result.totalCount || 0; that.total = res.result.totalCount || 0;
...@@ -175,7 +177,7 @@ export default { ...@@ -175,7 +177,7 @@ export default {
const param = { const param = {
} }
setAcountStatus(param).then(res => { setAccountStatus(param).then(res => {
if (res.code == '0000') { if (res.code == '0000') {
that.$message({ that.$message({
message: '结束试用成功', message: '结束试用成功',
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: 无尘 * @Author: 无尘
* @Date: 2020-11-13 10:59:48 * @Date: 2020-11-13 10:59:48
* @LastEditors: 无尘 * @LastEditors: 无尘
* @LastEditTime: 2020-11-13 16:39:54 * @LastEditTime: 2020-11-13 17:26:23
--> -->
<template> <template>
<div class="common-right"> <div class="common-right">
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
import { _debounce } from '@/common/js/public'; import { _debounce } from '@/common/js/public';
import fetch from '@/api/dictionary'; import fetch from '@/api/dictionary';
const { getAcountList } = fetch; const { getAccountList } = fetch;
export default { export default {
name: 'ProjectSql', name: 'ProjectSql',
components: {}, components: {},
...@@ -129,7 +129,7 @@ export default { ...@@ -129,7 +129,7 @@ export default {
pageNum: that.currentPage, pageNum: that.currentPage,
pageSize: that.pageSize pageSize: that.pageSize
}; };
getAcountList(param).then(res => { getAccountList(param).then(res => {
that.loading = false; that.loading = false;
that.tableData = res.result.result || []; that.tableData = res.result.result || [];
that.total = res.result.totalCount || 0; 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