Commit 3c2161cd authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents e1ec0ff8 fd656d5a
......@@ -138,8 +138,16 @@ export default {
data.hotWords = data.hotWords.map((v) => v.hotwords);
this.homeInfo = data;
this.SET_homeInfo(data);
this.SET_datumList(data.datumList);
this.SET_matterList(data.matterList);
let datumList = this.removeDuplication(
[...data.hotDatumList, ...data.datumList],
"id"
).slice(0, 7);
let matterList = this.removeDuplication(
[...data.hotMatterList, ...data.matterList],
"id"
).slice(0, 5);
this.SET_datumList(datumList);
this.SET_matterList(matterList);
}
},
// 换肤
......@@ -172,6 +180,15 @@ export default {
this.enabled = data.enabled;
}
},
// 去重
removeDuplication(arr = [], field) {
const res = new Map();
return arr.filter((v) => {
return !res.has(v[field]) && res.set(v[field], 1);
});
},
// 轮询设备状态
getDevInfo() {
this.timer = setInterval(() => {
......
......@@ -7,11 +7,13 @@ let PHP_URL = process.env.VUE_APP_API_PHP_URL;
export const getHomeInfo = (data) => {
let baseUrl = local.getLocal("serverUrl");
let siteId = local.getLocal("siteId");
let deviceCode = local.getLocal("devicenum");
return request({
url: `${baseUrl}sampleform/home/info`,
method: "post",
data: {
siteId,
deviceCode,
...data,
},
});
......
......@@ -202,6 +202,7 @@ export default {
matterId: this.matterId,
});
let { data } = res.data.data;
if (!data.length) return;
data.forEach((v) => {
let image = new Image();
image.src = this.api + v.preViewPath;
......
......@@ -20,11 +20,38 @@
>
<div class="flex aic jcb">
<el-tooltip :content="v.matterName" placement="top">
<p class="matter-item-title">
<p class="matter-item-title flex1">
{{ v.matterName }}
</p>
</el-tooltip>
<i class="el-icon-delete delete" @click="handleDel(v.id)"></i>
<div>
<span
class="primary pointer"
v-if="!v.isRecommend"
@click="changeRecommend(v.id, 1)"
>
推荐
</span>
<span
class="green pointer"
v-else
@click="changeRecommend(v.id, 0)"
>
取消推荐
</span>
<el-tooltip
class="item"
effect="dark"
content="删除"
placement="top"
>
<i
class="el-icon-delete delete"
@click="handleDel(v.id)"
></i>
</el-tooltip>
</div>
</div>
<div class="matter-item-count">
材料数量:{{ v.matterDatumList && v.matterDatumList.length }}
......@@ -319,6 +346,19 @@ export default {
this.getDeviceMatterList(this.devInfo.id);
}
},
// 切换推荐
async changeRecommend(id, isRecommend) {
let obj = {
id,
isRecommend,
};
let res = await saveDeviceMatter(obj);
let { code, msg } = res.data;
if (code == 1) {
this.$message.success(msg);
this.getDeviceMatterList(this.devInfo.id);
}
},
// 删除设备事项
handleDel(id) {
this.$confirm("此操作将删除该关联事项,是否继续?", "系统提示", {
......@@ -417,4 +457,4 @@ export default {
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
\ No newline at end of file
</style>
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