Commit 221e16c3 authored by kangzhenfei's avatar kangzhenfei

数据源管理--saas

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