Commit da39bd78 authored by 姬鋆屾's avatar 姬鋆屾

tui

parent 66e4fed7
<template> <template>
<div class="page"> <div class="page">
<LayoutTable :data="tableData" :config="tableConfig"> <LayoutTable :data="tableData" :config="tableConfig">
<el-button <el-button
slot="table-head-left2" slot="table-head-left2"
style="margin-left: 10px" style="margin-left: 10px"
...@@ -11,8 +10,6 @@ ...@@ -11,8 +10,6 @@
@click="cloneAppBySite" @click="cloneAppBySite"
>复制资源 >复制资源
</el-button> </el-button>
</LayoutTable> </LayoutTable>
<dialog-show ref="dialogform" @ok="getData" /> <dialog-show ref="dialogform" @ok="getData" />
...@@ -33,7 +30,7 @@ export default { ...@@ -33,7 +30,7 @@ export default {
mixins: [table], mixins: [table],
created() { created() {
const siteid = session.getSession("siteid"); const siteid = session.getSession("siteid");
this.query["siteId"]=siteid?siteid:1; this.query["siteId"] = siteid ? siteid : 1;
}, },
methods: { methods: {
cloneAppBySite(row) { cloneAppBySite(row) {
...@@ -53,7 +50,7 @@ export default { ...@@ -53,7 +50,7 @@ export default {
}, },
/** 重写新增方法 */ /** 重写新增方法 */
toAdd(row) { toAdd(row) {
row.siteId=session.getSession("siteid") row.siteId = session.getSession("siteid");
this.$refs.dialogform.add(row); this.$refs.dialogform.add(row);
}, },
/** 重写编辑方法 */ /** 重写编辑方法 */
...@@ -73,12 +70,21 @@ export default { ...@@ -73,12 +70,21 @@ export default {
}); });
}, },
handleSwitch(row){ handleSwitch(row) {
this.loading = true console.log(row);
if(row.selected==1){ this.loading = true;
this.$post("/device/module/distribute/selected", {id:row.id,selected:0}) if (row.selected == 1) {
.then(res => { this.$post("/device/module/distribute/selected", {
row.selected=1 id: row.id,
selected: 0,
})
.then((res) => {
if (res && res.code && res.code == 1) {
row.selected = 0;
}
// console.log(res);
// this.getData();
// console.log(row) // console.log(row)
// if (res && res.code && res.code == 1) { // if (res && res.code && res.code == 1) {
// this.getData(); // this.getData();
...@@ -87,14 +93,20 @@ export default { ...@@ -87,14 +93,20 @@ export default {
// this.$message.error(res.msg); // this.$message.error(res.msg);
// } // }
}) })
.catch(error => { .catch((error) => {
this.$message.error(error.message); this.$message.error(error.message);
});
} else {
this.$post("/device/module/distribute/selected", {
id: row.id,
selected: 1,
}) })
}else{ .then((res) => {
this.$post("/device/module/distribute/selected", {id:row.id,selected:1}) if (res && res.code && res.code == 1) {
.then(res => { row.selected = 1;
row.selected=0 }
// console.log(row)
// this.getData();
// if (res && res.code && res.code == 1) { // if (res && res.code && res.code == 1) {
// this.getData(); // this.getData();
// this.loading = false; // this.loading = false;
...@@ -102,11 +114,10 @@ export default { ...@@ -102,11 +114,10 @@ export default {
// this.$message.error(res.msg); // this.$message.error(res.msg);
// } // }
}) })
.catch(error => { .catch((error) => {
this.$message.error(error.message); this.$message.error(error.message);
}) });
} }
}, },
distribute(row) { distribute(row) {
...@@ -131,7 +142,8 @@ export default { ...@@ -131,7 +142,8 @@ export default {
type: "text", type: "text",
label: "产品", label: "产品",
fuzzy: true, fuzzy: true,
},], },
],
columns: [ columns: [
{ type: "selection", align: "center", width: 60 }, { type: "selection", align: "center", width: 60 },
{ type: "index", align: "center", label: "序号", width: 50 }, { type: "index", align: "center", label: "序号", width: 50 },
...@@ -155,21 +167,20 @@ export default { ...@@ -155,21 +167,20 @@ export default {
label: "默认选择", label: "默认选择",
align: "center", align: "center",
prop: "selected", prop: "selected",
formatter: row => { formatter: (row) => {
return ( return (
<el-switch <el-switch
value={row.selected+""} value={row.selected + ""}
active-color="#13ce66" active-color="#13ce66"
inactive-color="#ff4949" inactive-color="#ff4949"
active-value='1' active-value="1"
inactive-value='0' inactive-value="0"
onChange={() => { onChange={() => {
this.handleSwitch(row); this.handleSwitch(row);
}} }}
> ></el-switch>
</el-switch>
); );
} },
}, },
{ {
label: "是否部署", label: "是否部署",
......
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