Commit 221e16c3 authored by kangzhenfei's avatar kangzhenfei

数据源管理--saas

parent 387c3363
......@@ -3,15 +3,16 @@
<Row>
<Col :span="24">
<FormItem :label="l('hostName')" prop="hostName">
<Select @on-change="onchange_host" v-model="entity.hostId">
<!-- @on-change="onchange_host" -->
<Select v-model="entity.id">
<Option v-for="(item,index) in hostlist" :key="index" :value="item.id">{{item.name}}</Option>
</Select>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('hostsq')" prop="hostId">
<Input v-model="entity.hostId"></Input>
<!-- <Dictionary v-model="entity.hostId"></Dictionary> -->
<!-- <Input v-model="entity.hostId"></Input> -->
<Dictionary code="datasource.type" v-model="entity.hostId" type="select"></Dictionary>
</FormItem>
</Col>
<Col :span="24">
......@@ -43,9 +44,14 @@ export default {
data() {
return {
disabled: false,
entity: {},
entity: {
id: null,
},
rules: {
hostName: [{ required: true, message: "必填", trigger: "blur" }]
// hostName: [{ required: true, message: "必选", type:"number",trigger: "change" }],
// hostName: [{ required: true, message: '单位不能为空', trigger: 'change',type: 'number' }],
// hostId:[{ required: true, message: "必选", type: "number",trigger: "change" }],
},
hostlist: [],
};
......@@ -56,10 +62,12 @@ export default {
mounted() {
Api.bindhostlist()
.then((r) => {
console.log(r)
if (r.success) {
this.hostlist = r.result
} else {
}
// this.hostlist.map(u=>{u.id = u.id+''})
})
.catch((err) => {
console.warn(err)
......@@ -88,8 +96,10 @@ export default {
}
});
},
onchange_host(val) {
this.entity.hostId = val
onchange_host(val) {
// console.log(val)
console.log(typeof(val))
this.entity.id = val
},
handleClose() {
this.$emit("on-close");
......
......@@ -97,6 +97,9 @@ export default {
}
});
},
onchange_host(val) {
this.entity.hostId = val
},
handleClose() {
this.$emit("on-close");
},
......
......@@ -17,6 +17,9 @@
<template slot="buttons">
<Button type="primary" @click="addModal=true">新增</Button>
</template>
<!-- <template slot-scope="{ row, index }" slot="hostId">
<state code="datasource.type" type="text" :value="row.hostId"></state>
</template> -->
</DataGrid>
<Modal v-model="addModal" title="新增" footer-hide>
<Add @on-close="cancel" @on-ok="addOk" />
......@@ -33,13 +36,13 @@
</div>
</template>
<script>
import Api from './api'
import Add from './add'
import Edit from './edit'
import Detail from './detail'
import Search from './search'
import Api from "./api";
import Add from "./add";
import Edit from "./edit";
import Detail from "./detail";
import Search from "./search";
export default {
name: 'list',
name: "list",
components: {
Add,
Edit,
......@@ -50,7 +53,7 @@ export default {
return {
action: Api.index,
easySearch: {
keys: { op: 'userName', value: null }
keys: { op: "userName", value: null }
},
addModal: false,
editModal: false,
......@@ -58,146 +61,156 @@ export default {
deletelModal: false,
curId: 0,
columns: [
{ key: 'id', title: this.l('id'), hide: true, align: 'left' },
{ key: 'hostName', title: this.l('hostName'), align: 'left', high: true },
{ key: 'hostId', title: this.l('hostsq'), align: 'left', high: true },
// { key: 'hostId', title: this.l('hostId'), align: 'left', high: true },
{ key: 'port', title: this.l('port'), align: 'left', high: true },
{ key: "id", title: this.l("id"), hide: true, align: "left" },
{
key: 'userName',
title: this.l('userName'),
align: 'left',
key: "hostName",
title: this.l("hostName"),
align: "left",
high: true
},
{ key: "hostId",
title: this.l("hostsq"),
align: "left",
high: true,
code: "datasource.type",
// slot: "hostId"
},
{ key: "port", title: this.l("port"), align: "left", high: true },
{
key: "userName",
title: this.l("userName"),
align: "left",
easy: true,
high: true
},
{ key: 'password', title: this.l('password'), align: 'left' },
{ key: "password", title: this.l("password"), align: "left" },
{
key: 'creationTime',
title: this.l('creationTime'),
key: "creationTime",
title: this.l("creationTime"),
hide: true,
align: 'left'
align: "left"
},
{
key: 'creatorUserId',
title: this.l('creatorUserId'),
key: "creatorUserId",
title: this.l("creatorUserId"),
hide: true,
align: 'left'
align: "left"
},
{
key: 'lastModificationTime',
title: this.l('lastModificationTime'),
key: "lastModificationTime",
title: this.l("lastModificationTime"),
hide: true,
align: 'left'
align: "left"
},
{
key: 'lastModifierUserId',
title: this.l('lastModifierUserId'),
key: "lastModifierUserId",
title: this.l("lastModifierUserId"),
hide: true,
align: 'left'
align: "left"
},
{
key: 'isDeleted',
title: this.l('isDeleted'),
key: "isDeleted",
title: this.l("isDeleted"),
hide: true,
align: 'left'
align: "left"
},
{
key: 'deletionTime',
title: this.l('deletionTime'),
key: "deletionTime",
title: this.l("deletionTime"),
hide: true,
align: 'left'
align: "left"
},
{
key: 'deleterUserId',
title: this.l('deleterUserId'),
key: "deleterUserId",
title: this.l("deleterUserId"),
hide: true,
align: 'left'
align: "left"
},
{
title: '操作',
key: 'id',
title: "操作",
key: "id",
width: 140,
align: 'center',
align: "center",
render: (h, params) => {
return h('div', { class: 'action' }, [
return h("div", { class: "action" }, [
h(
'op',
"op",
{
attrs: { oprate: 'detail' },
attrs: { oprate: "detail" },
on: { click: () => this.detail(params.row.id) }
},
'查看'
"查看"
),
h(
'op',
"op",
{
attrs: { oprate: 'edit' },
attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row.id) }
},
'编辑'
"编辑"
),
h(
'op',
"op",
{
attrs: { oprate: 'remove' },
attrs: { oprate: "remove" },
on: { click: () => this.remove(params.row.id) }
},
'删除'
"删除"
)
])
]);
}
}
]
}
};
},
mounted() {
console.log(this)
console.log(this);
},
async fetch({ store, params }) {
await store.dispatch('loadDictionary') // 加载数据字典
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
addOk() {
this.$refs.grid.load()
this.addModal = false
this.detailModal = false
this.editModal = false
this.curId = 0
this.$refs.grid.load();
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch)
this.$refs.grid.reload(this.easySearch);
},
detail(id) {
this.detailModal = true
this.curId = id
this.detailModal = true;
this.curId = id;
},
edit(id) {
this.editModal = true
this.curId = id
this.editModal = true;
this.curId = id;
},
remove(id) {
this.deletelModal = true
this.curId = id
this.deletelModal = true;
this.curId = id;
},
removeOk() {
Api.delete({ id: this.curId }).then((r) => {
Api.delete({ id: this.curId }).then(r => {
if (r.success) {
this.$refs.grid.load()
this.deletelModal = false
this.$Message.success('删除成功')
this.$refs.grid.load();
this.deletelModal = false;
this.$Message.success("删除成功");
}
})
});
},
removeCancel() {
this.deletelModal = false
this.deletelModal = false;
},
cancel() {
this.curId = 0
this.addModal = false
this.detailModal = false
this.editModal = false
this.deletedlModal = false
this.curId = 0;
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.deletedlModal = false;
},
l(key) {
/*
......@@ -217,11 +230,11 @@ export default {
deleterUserId:'删除人',
}
*/
let vkey = 'data_source' + '.' + key
return this.$t(vkey) || key
let vkey = "data_source" + "." + key;
return this.$t(vkey) || key;
}
}
}
};
</script>
<style lang="less">
</style>
\ No newline at end of file
......@@ -319,7 +319,7 @@ export default {
getAps(id){
Api.apsList({id:id}).then(r=>{
var d=r.result;
console.log(d)
// console.log(d)
this.aps=d.map(item=>{return item.apsScheduleId+''})
})
},
......
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