19 changed files with 1170 additions and 39 deletions
@ -1,25 +1,42 @@ |
|||||
import Vue from "vue"; |
import Vue from "vue"; |
||||
import { getDicts } from "@/api/system/dict/data"; |
import { getDicts } from "@/api/system/dict/data"; |
||||
export default function(){ |
export default function () { |
||||
|
|
||||
|
|
||||
return Promise.all([ |
|
||||
getDicts('iot_device_font_type'), |
|
||||
// getDicts('iot_devices_font_color'),
|
|
||||
// getDicts('iot_device_font_inScreen_mode'),
|
|
||||
// getDicts('iot_template_category'),
|
|
||||
// getDicts('iot_device_font_size'),
|
|
||||
]).then(resArr=>{ |
|
||||
initFontType(resArr[0]); |
|
||||
|
|
||||
function initFontType(res){ |
|
||||
let dic = {}; |
return Promise.all([ |
||||
res.data.forEach(item => { |
getDicts('iot_device_font_type'), |
||||
dic[item.dictValue] = item.cssClass; |
getDicts('iot_board_pixel'), |
||||
|
// getDicts('iot_devices_font_color'),
|
||||
|
// getDicts('iot_device_font_inScreen_mode'),
|
||||
|
// getDicts('iot_template_category'),
|
||||
|
// getDicts('iot_device_font_size'),
|
||||
|
]).then(resArr => { |
||||
|
initFontType(resArr[0]); |
||||
|
initListAndDic(1, "boardPixel", "dictLabel"); |
||||
|
|
||||
|
function initFontType(res) { //历史原因,情报板字体类型单独一个方法
|
||||
|
let dic = {}; |
||||
|
res.data.forEach(item => { |
||||
|
dic[item.dictValue] = item.cssClass; |
||||
|
}); |
||||
|
Vue.prototype.fontTypeDic = dic; |
||||
|
Vue.prototype.fontTypeList = res.data; |
||||
|
} |
||||
|
|
||||
|
function initListAndDic(idx, namePrefix, labelField) { |
||||
|
let dic = {}; |
||||
|
let list = []; |
||||
|
resArr[idx].data.forEach(item => { |
||||
|
dic[item.dictValue] = item[labelField]; |
||||
|
list.push({ |
||||
|
label: item[labelField], |
||||
|
value: item.dictValue |
||||
}); |
}); |
||||
Vue.prototype.fontTypeDic = dic; |
}); |
||||
Vue.prototype.fontTypeList = res.data; |
Vue.prototype[namePrefix + "Dic"] = dic; |
||||
} |
Vue.prototype[namePrefix + "Options"] = list; |
||||
}); |
} |
||||
|
|
||||
|
}); |
||||
|
|
||||
} |
} |
@ -0,0 +1,224 @@ |
|||||
|
<template> |
||||
|
<Dialog v-model="modelVisible" :title="data ? '修改' : '新增'" width="900px"> |
||||
|
<div class="AddNEditDialog"> |
||||
|
<!-- <Form :value="formData" class="form" ref="FormConfigRef" :formList="formList" column="1" labelWidth="80px" /> --> |
||||
|
<el-form ref="form" :model="formStrategy" label-width="80px"> |
||||
|
<el-form-item label="名称"> |
||||
|
<el-input v-model="formData.groupName"></el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="描述"> |
||||
|
<el-input v-model="formData.remark"></el-input> |
||||
|
</el-form-item> |
||||
|
<div class="task" v-for="task,index in formStrategy"> |
||||
|
<div class="fl-around task_info"> |
||||
|
<el-input v-model="task.time"></el-input> |
||||
|
<div class="fl-around task_op"> |
||||
|
<el-button size="mini" type="primary">新增</el-button> |
||||
|
<el-button size="mini" type="primary">删除</el-button> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div> |
||||
|
<TaskItem v-for="item, index in task.content" :data="item" @onModify="newV=>onModifyItem(newV, item)"> |
||||
|
</TaskItem> |
||||
|
</div> |
||||
|
</div> |
||||
|
</el-form> |
||||
|
</div> |
||||
|
|
||||
|
<template #footer> |
||||
|
<Button style="background-color: rgba(0, 179, 204, 0.3)" |
||||
|
@click.native="(modelVisible = false), (submitting = false)"> |
||||
|
取消 |
||||
|
</Button> |
||||
|
<Button @click.native="handleSubmit" :loading="submitting"> 确定 </Button> |
||||
|
</template> |
||||
|
</Dialog> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import Dialog from "@screen/components/Dialog/index.vue"; |
||||
|
import Button from "@screen/components/Buttons/Button.vue"; |
||||
|
import Form from "@screen/components/FormConfig"; |
||||
|
|
||||
|
import request from "@/utils/request"; |
||||
|
import { Message } from "element-ui"; |
||||
|
import { addEditFormList } from "./../data"; |
||||
|
import { stakeMarkToArray, findPathIdByTreeId } from "@screen/utils/index.js"; |
||||
|
|
||||
|
import TaskItem from "./TaskItem.vue"; |
||||
|
|
||||
|
export default { |
||||
|
name: "AddNEditDialog", |
||||
|
components: { |
||||
|
Dialog, |
||||
|
Button, |
||||
|
Form, |
||||
|
TaskItem |
||||
|
}, |
||||
|
model: { |
||||
|
prop: "visible", |
||||
|
event: "update:value", |
||||
|
}, |
||||
|
props: { |
||||
|
visible: Boolean, |
||||
|
data: Object, |
||||
|
dataAll: Array, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
submitting: false, |
||||
|
formData: {}, |
||||
|
formList: addEditFormList, |
||||
|
formStrategy:[ |
||||
|
|
||||
|
{ |
||||
|
time:"gdfsfds", |
||||
|
content:[ |
||||
|
{ |
||||
|
type:"5", |
||||
|
devices:[""], |
||||
|
options:{ |
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
type: "2", |
||||
|
devices: [""], |
||||
|
options: { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
|
||||
|
] |
||||
|
}; |
||||
|
}, |
||||
|
computed: { |
||||
|
modelVisible: { |
||||
|
get() { |
||||
|
return this.visible; |
||||
|
}, |
||||
|
set(val) { |
||||
|
this.$emit("update:value", val); |
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
watch: { |
||||
|
modelVisible: { |
||||
|
immediate: true, |
||||
|
handler(bool) { |
||||
|
if (!bool) return; |
||||
|
|
||||
|
this.formData = !this.data |
||||
|
? {} |
||||
|
: { |
||||
|
...this.data, |
||||
|
}; |
||||
|
this.testGetData(); |
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
mounted() { |
||||
|
|
||||
|
// "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".split('').forEach(item => { |
||||
|
// request({ |
||||
|
// url: `/business/dcInfoBoardVocabulary`, |
||||
|
// method: 'POST', |
||||
|
// data:{ |
||||
|
// word:"测试"+item |
||||
|
// } |
||||
|
// }) |
||||
|
// }); |
||||
|
}, |
||||
|
methods: { |
||||
|
onModifyItem(newV , oldV){ |
||||
|
console.log(newV, oldV , "修改条目》》》") |
||||
|
// oldV.devices |
||||
|
}, |
||||
|
testGetData(){ |
||||
|
request({ |
||||
|
url: `/business/dcBatchFunctionsJob/query`, |
||||
|
method: "GET", |
||||
|
params: { |
||||
|
jobGroup: 0 |
||||
|
}, |
||||
|
}) |
||||
|
.then((result) => { |
||||
|
if (result.code != 200) return; |
||||
|
console.log(result.data, "接口数据"); |
||||
|
}) |
||||
|
}, |
||||
|
checkRepeat(word) { |
||||
|
let temp = _.find(this.dataAll, { word: word }); |
||||
|
if ( |
||||
|
temp && |
||||
|
Object.keys(temp).length > 0 && |
||||
|
!(this.data && this.data.id == temp.id) |
||||
|
) { |
||||
|
this.$message.error("该关键词已存在。"); |
||||
|
return false; |
||||
|
} else { |
||||
|
return true; |
||||
|
} |
||||
|
}, |
||||
|
handleSubmit() { |
||||
|
this.$refs.FormConfigRef.validate().then((data) => { |
||||
|
data.word = data.word.trim(); |
||||
|
|
||||
|
this.submitting = true; |
||||
|
if (this.data) data.id = this.data.id; |
||||
|
|
||||
|
// if (!this.checkRepeat(data.word)) { |
||||
|
// return; |
||||
|
// } |
||||
|
|
||||
|
request({ |
||||
|
url: `/business/dcInfoBoardVocabulary`, |
||||
|
method: this.data ? "PUT" : "POST", |
||||
|
data, |
||||
|
}) |
||||
|
.then((result) => { |
||||
|
if (result.code != 200) return; |
||||
|
|
||||
|
Message.success(`提交成功!`); |
||||
|
this.$emit("onSuccess"); |
||||
|
|
||||
|
this.modelVisible = false; |
||||
|
}) |
||||
|
.catch((err) => { |
||||
|
console.log( |
||||
|
"%c [ err ]-110-「DeviceControlDialog.vue」", |
||||
|
"font-size:15px; background:#547bf2; color:#98bfff;", |
||||
|
err |
||||
|
); |
||||
|
// Message.error(`提交失败!`); |
||||
|
}) |
||||
|
.finally(() => { |
||||
|
this.submitting = false; |
||||
|
}); |
||||
|
}); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
.AddNEditDialog { |
||||
|
width: 100%; |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
gap: 15px; |
||||
|
|
||||
|
.tips { |
||||
|
font-size: 12px; |
||||
|
} |
||||
|
} |
||||
|
.task{ |
||||
|
border: 1px solid #FFF; |
||||
|
.task_info{ |
||||
|
} |
||||
|
.task_op{ |
||||
|
} |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,84 @@ |
|||||
|
<template> |
||||
|
<div class="task_editor_box"> |
||||
|
|
||||
|
<div class="flex"> |
||||
|
<div> |
||||
|
{{ data }} |
||||
|
</div> |
||||
|
<el-form-item> |
||||
|
<el-button size="mini" type="primary" @click="onModify">修改</el-button> |
||||
|
<el-button size="mini" type="danger" @click="onDelete">删除</el-button> |
||||
|
</el-form-item> |
||||
|
</div> |
||||
|
|
||||
|
<taskEditDialog v-model="isEditing" :data="data" @onSubmit="onSubmit" /> |
||||
|
|
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { deviceTypeOptions } from "@screen/utils/enum.js" |
||||
|
import { getDeviceList } from "@screen/utils/api/device.js" |
||||
|
import taskEditDialog from "./taskEditDialog.vue"; |
||||
|
export default { |
||||
|
name: "TaskEditor", |
||||
|
components: { |
||||
|
taskEditDialog |
||||
|
}, |
||||
|
props: { |
||||
|
data:Object |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
editData:{}, |
||||
|
isEditing: false, |
||||
|
selectedType:"", |
||||
|
deviceTypeOptions:"", |
||||
|
deviceOptions:"" |
||||
|
}; |
||||
|
}, |
||||
|
computed: { |
||||
|
|
||||
|
}, |
||||
|
watch: { |
||||
|
|
||||
|
}, |
||||
|
mounted() { |
||||
|
this.deviceTypeOptions = deviceTypeOptions; |
||||
|
}, |
||||
|
methods: { |
||||
|
onModify(){ |
||||
|
this.isEditing = true; |
||||
|
}, |
||||
|
onSubmit(){ |
||||
|
this.isEditing = false; |
||||
|
let devices = _.filter(this.deviceOptions, item=>{ |
||||
|
this.editData.devices.includes(item.id); |
||||
|
}) |
||||
|
console.log(devices, "选中的设备") |
||||
|
this.$emit("onModify", {devices}); |
||||
|
}, |
||||
|
onDelete(){ |
||||
|
|
||||
|
}, |
||||
|
onChange(val){ |
||||
|
|
||||
|
this.deviceOptions = []; |
||||
|
getDeviceList({ deviceType :val}).then(res=>{ |
||||
|
res.data.forEach(item=>{ |
||||
|
this.deviceOptions.push({ |
||||
|
label: item.deviceName, |
||||
|
value: item.id |
||||
|
}) |
||||
|
}) |
||||
|
}).catch(err=>{}) |
||||
|
} |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
.task_editor_box{ |
||||
|
|
||||
|
} |
||||
|
</style> |
@ -0,0 +1,338 @@ |
|||||
|
<template> |
||||
|
<Dialog v-model="modelVisible" title="修改" width="600px"> |
||||
|
<el-form-item label="设备类型"> |
||||
|
<!-- <el-radio-group v-model="searchData.deviceType" @input="onChange"> |
||||
|
<el-radio-button v-for="item in deviceTypeOptions" :key="item.value" :label="item.label" :value="item.value" |
||||
|
v-if="item.timingControl"></el-radio-button> |
||||
|
</el-radio-group> --> |
||||
|
<el-select v-model="searchData.deviceType" placeholder="请选择设备类型" @change="onChange"> |
||||
|
<el-option v-for="item in deviceTypeOptions" :key="item.value" :label="item.label" :value="item.value" |
||||
|
v-if="item.timingControl"> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
|
||||
|
<el-form-item label="方向"> |
||||
|
<el-select v-model="searchData.direction" placeholder="请选择方向" @change="onChange" clearable> |
||||
|
<el-option v-for="item in directionOptions" :key="item.value" :label="item.label" :value="item.value"> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
|
||||
|
<el-form-item label="选择设备" v-if="searchData.deviceType != '2'"> |
||||
|
<el-select v-model="editData.devices" multiple placeholder="请选择设备" filterable> |
||||
|
<el-option v-for="item in deviceOptions" :key="item.value" :label="item.label" :value="item.value"> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
|
||||
|
<template v-if="searchData.deviceType=='2'"> |
||||
|
|
||||
|
<el-form-item label="屏幕像素"> |
||||
|
<el-select v-model="filterData.pixelSize" placeholder="请选择" clearable @change="resetEditData"> |
||||
|
<el-option v-for="item in boardPixelOptions" :key="item.value" :label="item.label" :value="item.value"> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
|
||||
|
<el-form-item label="选择设备"> |
||||
|
<el-select v-model="editData.devices" multiple placeholder="请选择设备" filterable> |
||||
|
<el-option v-for="item in deviceOptions" :key="item.value" :label="item.label" :value="item.value" |
||||
|
v-if="item.pixelSize == filterData.pixelSize"> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
|
||||
|
<el-form-item label="预览" v-if="filterData.pixelSize"> |
||||
|
<div class="tplItem"> |
||||
|
<!-- 模板内容 --> |
||||
|
<BoardPreview class="boardPreview" :boardWH="filterData.pixelSize" :tpl="editData.type2" /> |
||||
|
<!-- 操作按钮 --> |
||||
|
<div class="infoBtnBox"> |
||||
|
<el-tooltip content="编辑" placement="top"> |
||||
|
<p @click="onEditBoard" class="btn btnEdit"></p> |
||||
|
</el-tooltip> |
||||
|
</div> |
||||
|
</div> |
||||
|
</el-form-item> |
||||
|
</template> |
||||
|
|
||||
|
<template v-else-if="searchData.deviceType == '5'"> |
||||
|
<!-- 语音广播 --> |
||||
|
<el-form-item label="广播内容"> |
||||
|
<el-input type="textarea" v-model="editData.type5.content"></el-input> |
||||
|
</el-form-item> |
||||
|
</template> |
||||
|
|
||||
|
<template v-else-if="searchData.deviceType == '10'"> |
||||
|
<!-- 激光疲劳唤醒 --> |
||||
|
<el-form-item label="工作模式"> |
||||
|
<el-select v-model="editData.type10.mode" placeholder="请选择"> |
||||
|
<el-option v-for="key,value in gzmsMap" :key="key" :label="value" :value="key" /> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="工作时长"> |
||||
|
<el-col :span="8"> |
||||
|
<el-input-number v-model="editData.type10.timeLength" :min="1" :max="600" label="描述文字" /> |
||||
|
</el-col> |
||||
|
<!-- <el-col :span="4" style="margin-left: 10px;">分钟</el-col> --> |
||||
|
</el-form-item> |
||||
|
</template> |
||||
|
|
||||
|
<template v-else-if="searchData.deviceType == '12'"> |
||||
|
<!-- 行车诱导 --> |
||||
|
<el-form-item label="工作状态"> |
||||
|
<el-select v-model="editData.type12.mode" placeholder="请选择"> |
||||
|
<el-option v-for="key, value in gzztMap" :key="key" :label="value" :value="key" /> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="工作时长"> |
||||
|
<el-col :span="8"> |
||||
|
<el-input-number v-model="editData.type12.timeLength" :min="1" :max="600" label="描述文字" /> |
||||
|
</el-col> |
||||
|
<!-- <el-col :span="4" style="margin-left: 10px;">分钟</el-col> --> |
||||
|
</el-form-item> |
||||
|
</template> |
||||
|
|
||||
|
<template v-else-if="searchData.deviceType == '13'"> |
||||
|
<!-- 智能设备箱 --> |
||||
|
<el-form-item label="开启"> |
||||
|
<el-switch v-model="editData.type13.open"> |
||||
|
<!-- active-color="#13ce66" inactive-color="#ff4949" --> |
||||
|
</el-switch> |
||||
|
</el-form-item> |
||||
|
</template> |
||||
|
|
||||
|
<el-form-item> |
||||
|
<el-button size="mini" type="primary" @click="onSubmit">确定</el-button> |
||||
|
</el-form-item> |
||||
|
|
||||
|
<BoardInfoEditor @afterSubmit="____onEditSubmit" :mode="editDialog.mode" :type="editDialog.type" |
||||
|
:visible.sync="editDialog.visible" :screenSize="'768*60'" :tpl="editDialog.tpl"></BoardInfoEditor> |
||||
|
</Dialog> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import Dialog from "@screen/components/Dialog/index.vue"; |
||||
|
import { deviceTypeOptions, directionOptions, gzmsMap, gzztMap } from "@screen/utils/enum.js" |
||||
|
import { getDeviceList } from "@screen/utils/api/device.js" |
||||
|
import BoardPreview from "@screen/components/infoBoard/BoardPreview.vue"; |
||||
|
import BoardInfoEditor from "@screen/components/infoBoard/BoardInfoEditor"; |
||||
|
export default { |
||||
|
name: "taskEditDialog", |
||||
|
components: { |
||||
|
Dialog, BoardInfoEditor, BoardPreview |
||||
|
}, |
||||
|
model: { |
||||
|
prop: "visible", |
||||
|
event: "update:value", |
||||
|
}, |
||||
|
props: { |
||||
|
visible: Boolean, |
||||
|
data: Object |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
deviceTypeOptions, |
||||
|
directionOptions, |
||||
|
gzmsMap, |
||||
|
deviceOptions:[], |
||||
|
searchData: { |
||||
|
deviceType: "", |
||||
|
direction: "" |
||||
|
}, |
||||
|
filterData:{ |
||||
|
pixelSize:"" |
||||
|
}, |
||||
|
editData:{ |
||||
|
devices:[], |
||||
|
type2:{}, |
||||
|
type5:{}, |
||||
|
type10:{}, |
||||
|
type12:{}, |
||||
|
type13:{} |
||||
|
}, |
||||
|
editDialog:{} |
||||
|
}; |
||||
|
}, |
||||
|
computed: { |
||||
|
modelVisible: { |
||||
|
get() { |
||||
|
return this.visible; |
||||
|
}, |
||||
|
set(val) { |
||||
|
this.$emit("update:value", val); |
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
watch: { |
||||
|
modelVisible: { |
||||
|
immediate: true, |
||||
|
handler(bool) { |
||||
|
if (!bool) return; |
||||
|
}, |
||||
|
}, |
||||
|
}, |
||||
|
mounted() { |
||||
|
// this.deviceTypeOptions = deviceTypeOptions; |
||||
|
// this.directionOptions = directionOptions; |
||||
|
}, |
||||
|
methods: { |
||||
|
onEditBoard(){ |
||||
|
this.editDialog = { |
||||
|
visible: true, |
||||
|
mode: "edit", |
||||
|
type: "device", |
||||
|
tpl: { |
||||
|
"residenceTime": "90", |
||||
|
"intonation": "0", |
||||
|
"fontSpacing": "0", |
||||
|
"screenEntryMethod": "1", |
||||
|
"screenOutputMethod": "1", |
||||
|
"lineSpacing": "0", |
||||
|
"yCoordinate": "0", |
||||
|
"whetherToSynchronizePlayback": "0", |
||||
|
"whetherToPlayText": "0", |
||||
|
"playbackCount": "1", |
||||
|
"flashingFrequency": "5", |
||||
|
"backgroundColor": "8", |
||||
|
"foregroundColor": "ffff00", |
||||
|
"textContent": "长清收费站\\\\n出入口封闭", |
||||
|
"fontStyle": "0", |
||||
|
"displayAreaWidth": "160", |
||||
|
"playbackDuration": "90", |
||||
|
"displayAreaHeight": "80", |
||||
|
"volume": "0", |
||||
|
"xCoordinate": "0", |
||||
|
"screenEntrySpeed": "1", |
||||
|
"horizontalAlignment": "2", |
||||
|
"playSpecialEffects": "0", |
||||
|
"setUpTheSpeaker": "0", |
||||
|
"flickerSpeed": "0", |
||||
|
"specialEffectsSpeed": "1", |
||||
|
"fontSize": "24", |
||||
|
"verticalAlignment": "2", |
||||
|
"speechSpeed": "0", |
||||
|
"font": "3" |
||||
|
}, |
||||
|
}; |
||||
|
}, |
||||
|
____onEditSubmit(data){ |
||||
|
console.log(data.data); |
||||
|
this.editDialog.visible = false; |
||||
|
this.editData.type2 = data.data; |
||||
|
}, |
||||
|
onSubmit(){ |
||||
|
let this.boardDataTransform(); |
||||
|
let devices = |
||||
|
let data = {devices, functions } |
||||
|
console.log(this.editData , "编辑出来的数据"); |
||||
|
}, |
||||
|
onChange() { |
||||
|
this.resetEditData(); |
||||
|
this.deviceOptions = []; |
||||
|
getDeviceList(this.searchData).then(res => { |
||||
|
res.data.forEach(item => { |
||||
|
this.deviceOptions.push({ |
||||
|
label: item.deviceName, |
||||
|
value: item.id, |
||||
|
pixelSize: JSON.parse(item.otherConfig).screenSize |
||||
|
}) |
||||
|
}) |
||||
|
}).catch(err => { }) |
||||
|
}, |
||||
|
resetEditData(){ |
||||
|
this.editData.devices = []; |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
.AddNEditDialog { |
||||
|
width: 100%; |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
gap: 15px; |
||||
|
|
||||
|
.tips { |
||||
|
font-size: 12px; |
||||
|
} |
||||
|
} |
||||
|
.task{ |
||||
|
border: 1px solid #FFF; |
||||
|
.task_info{ |
||||
|
} |
||||
|
.task_op{ |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.tplItem { |
||||
|
margin-right: 14px; |
||||
|
display: flex; |
||||
|
align-items: stretch; |
||||
|
padding-bottom: 10px; |
||||
|
|
||||
|
.boardPreview { |
||||
|
border: 1px solid rgba(61, 232, 255, 0.5); |
||||
|
// width: 560px; |
||||
|
// height:80px; |
||||
|
flex: 1; |
||||
|
} |
||||
|
|
||||
|
.infoBtnBox { |
||||
|
&.infoBtnBoxSm { |
||||
|
width: 60px; |
||||
|
} |
||||
|
|
||||
|
width: 110px; |
||||
|
height: 80px; |
||||
|
display: flex; |
||||
|
margin-left: 10px; |
||||
|
/* // border: solid 1px #05afe3; */ |
||||
|
border: 1px solid rgba(61, 232, 255, 0.5); |
||||
|
display: flex; |
||||
|
justify-content: space-around; |
||||
|
align-items: center; |
||||
|
|
||||
|
.btn { |
||||
|
background-repeat: no-repeat; |
||||
|
background-size: 100% 100%; |
||||
|
width: 30px; |
||||
|
height: 30px; |
||||
|
|
||||
|
&.btnApply { |
||||
|
background-image: url(~@/assets/jihe/images/button/toLeft.svg); |
||||
|
} |
||||
|
|
||||
|
&.btnEdit { |
||||
|
background-image: url(~@/assets/jihe/images/button/edit.svg); |
||||
|
} |
||||
|
|
||||
|
&.btnDelete { |
||||
|
background-image: url(~@/assets/jihe/images/button/delete.svg); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
i { |
||||
|
font-size: 24px; |
||||
|
color: #666; |
||||
|
padding-left: 4px; |
||||
|
cursor: pointer; |
||||
|
caret-color: rgba(0, 0, 0, 0); |
||||
|
user-select: none; |
||||
|
} |
||||
|
|
||||
|
i:hover { |
||||
|
color: #05afe3; |
||||
|
} |
||||
|
|
||||
|
.disabledClass { |
||||
|
pointer-events: none; |
||||
|
cursor: auto !important; |
||||
|
color: #ccc; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
</style> |
@ -0,0 +1,38 @@ |
|||||
|
import { cloneDeep, merge } from "lodash"; |
||||
|
import * as PresetFormItems from "@screen/pages/control/event/event/FormEvent/PresetFormItems.js"; |
||||
|
|
||||
|
export const searchFormList = [ |
||||
|
{ |
||||
|
label: "关键词:", |
||||
|
key: "word", |
||||
|
} |
||||
|
]; |
||||
|
|
||||
|
export const addEditFormList = [ |
||||
|
{ |
||||
|
label: "关键词:", |
||||
|
key: "word", |
||||
|
required: true, |
||||
|
isAlone:true, |
||||
|
options: { |
||||
|
type: "text", |
||||
|
autosize: true, |
||||
|
// maxlength: 50,
|
||||
|
autosize: { minRows: 1, maxRows: 20 }, |
||||
|
showWordLimit: true, |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
label: "关键词2:", |
||||
|
key: "word2", |
||||
|
isAlone: false, |
||||
|
required: true, |
||||
|
options: { |
||||
|
type: "textarea", |
||||
|
autosize: true, |
||||
|
// maxlength: 50,
|
||||
|
autosize: { minRows: 2, maxRows: 20 }, |
||||
|
showWordLimit: true, |
||||
|
} |
||||
|
} |
||||
|
]; |
@ -0,0 +1,281 @@ |
|||||
|
<template> |
||||
|
<div class="sensitiveWord" v-loading="isLoading" element-loading-text="数据加载中" |
||||
|
element-loading-background="rgba(0, 0, 0, 0.3)"> |
||||
|
<div class="filter"> |
||||
|
<div> |
||||
|
<ButtonGradient @click.native="handleAddEdit(true)"> |
||||
|
<template #prefix> |
||||
|
<img src="@screen/images/insert.svg" /> |
||||
|
</template> |
||||
|
新增 |
||||
|
</ButtonGradient> |
||||
|
<ButtonGradient @click.native="handleExport"> |
||||
|
<template #prefix> |
||||
|
<img src="@screen/images/export.svg" /> |
||||
|
</template> |
||||
|
导出 |
||||
|
</ButtonGradient> |
||||
|
<ButtonGradient @click.native="onReset"> |
||||
|
<template #prefix> |
||||
|
<img src="@screen/images/refresh.svg" /> |
||||
|
</template> |
||||
|
刷新 |
||||
|
</ButtonGradient> |
||||
|
</div> |
||||
|
|
||||
|
<InputSearch style="width: 402px" type="input" params="word" :disable="true" placeholder="请输入敏感词,回车搜索" |
||||
|
@handleSearch="handleSearch" ref="form" /> |
||||
|
</div> |
||||
|
|
||||
|
<div class="body"> |
||||
|
<Empty v-if="!data.length && !isFirst" class="no-data" style="position: absolute">暂无数据</Empty> |
||||
|
<template v-else> |
||||
|
<div class="cardBox" v-for="(item, index) in data" :key="index"> |
||||
|
<Card :buttonIcon="null" :keyMap="keyMap" :cardData="item" class="card" buttonText="详情"> |
||||
|
<template #form-remark="{ data }"> |
||||
|
<div class="remark"> |
||||
|
{{ data.remark }} |
||||
|
</div> |
||||
|
</template> |
||||
|
<template #button> |
||||
|
<Switcher class="switcher" :activeOption="activeOption" :value="item.status!='0'" |
||||
|
@change="(value) => handleSwitcherChange(value, item) " /> |
||||
|
<Button @click.native="() => handleAddEdit(true, item)"> |
||||
|
编辑 |
||||
|
</Button> |
||||
|
<Button style="background-color: #ff5f5f" @click.native="handleDelete(item)"> |
||||
|
删除 |
||||
|
</Button> |
||||
|
</template> |
||||
|
</Card> |
||||
|
</div> |
||||
|
</template> |
||||
|
</div> |
||||
|
|
||||
|
<!-- 分页 --> |
||||
|
<div class="footer" v-if="numTotal > 0"> |
||||
|
<Pagination :total="numTotal" :current-page.sync="currentPage" :page-sizes="[35, 70, 105, 140, 175]" |
||||
|
:page-size="pageSize" layout="total,sizes,prev, pager, next, jumper" @size-change="handleSizeChange" |
||||
|
@current-change="handleCurrentChange" /> |
||||
|
</div> |
||||
|
|
||||
|
<AddNEditDialog v-model="isShowDialog" :data="dialogData" @onSuccess="getData" :dataAll="data" /> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import Card from "@screen/components/Card1/index.vue"; |
||||
|
import AddNEditDialog from "./components/AddNEditDialog.vue"; |
||||
|
import InputSearch from "@screen/components/InputSearch/index.vue"; |
||||
|
import ButtonGradient from "@screen/components/Buttons/ButtonGradient.vue"; |
||||
|
import Button from "@screen/components/Buttons/Button.vue"; |
||||
|
import Pagination from "@screen/components/Pagination.vue"; |
||||
|
|
||||
|
import { searchFormList } from "./data"; |
||||
|
import request from "@/utils/request"; |
||||
|
// import { setLoading } from "@screen/utils/index.js" |
||||
|
import { delay, exportFile, confirm } from "@screen/utils/common"; |
||||
|
import { Message } from "element-ui"; |
||||
|
|
||||
|
import Switcher from '@screen/pages/service/PublishingChannelManagement/components/Switcher.vue'; |
||||
|
|
||||
|
// 辖段管理 |
||||
|
export default { |
||||
|
name: "sensitiveWord", |
||||
|
components: { |
||||
|
Switcher, |
||||
|
Pagination, |
||||
|
Card, |
||||
|
ButtonGradient, |
||||
|
InputSearch, |
||||
|
AddNEditDialog, |
||||
|
Button, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
activeOption: { |
||||
|
active: { |
||||
|
text: "开" |
||||
|
}, |
||||
|
unActive: { |
||||
|
text: "关" |
||||
|
} |
||||
|
}, |
||||
|
isLoading: false, |
||||
|
searchText: "请输入敏感词,回车搜索", |
||||
|
searchFormList, |
||||
|
|
||||
|
numTotal: 0, |
||||
|
pageSize: 42, |
||||
|
currentPage: 1, |
||||
|
|
||||
|
keyMap: [ |
||||
|
{ |
||||
|
key: "groupName", |
||||
|
label: "标题", |
||||
|
}, |
||||
|
{ |
||||
|
key: "remark", |
||||
|
label: "描述", |
||||
|
}, |
||||
|
], |
||||
|
data: [], |
||||
|
dialogData: null, |
||||
|
isShowDialog: false, |
||||
|
isFirst: true, |
||||
|
}; |
||||
|
}, |
||||
|
created() { |
||||
|
this.getData(); |
||||
|
// this.getSearchOptions(); |
||||
|
}, |
||||
|
methods: { |
||||
|
async handleSwitcherChange(value, item) { |
||||
|
item.status == "1" ? item.status = "0" : item.status = "1" ; |
||||
|
}, |
||||
|
getSearchData() { |
||||
|
let params = { |
||||
|
word: this.searchData?.word, |
||||
|
pageSize: this.pageSize, |
||||
|
pageNum: this.currentPage, |
||||
|
}; |
||||
|
// params = { |
||||
|
// pageSize: 1000000, |
||||
|
// pageNum: 1 |
||||
|
// }; |
||||
|
return params; |
||||
|
}, |
||||
|
async handleDelete(data) { |
||||
|
await confirm({ message: "是否要删除该敏感词?" }); |
||||
|
|
||||
|
request({ |
||||
|
url: `/business/dcInfoBoardVocabulary/${data.id}`, |
||||
|
method: "DELETE", |
||||
|
data: {}, |
||||
|
}) |
||||
|
.then((result) => { |
||||
|
if (result.code != 200) return Message.error("删除失败"); |
||||
|
Message.success("删除成功"); |
||||
|
this.getData(); |
||||
|
}) |
||||
|
.catch(() => { |
||||
|
Message.error("删除失败"); |
||||
|
}); |
||||
|
}, |
||||
|
handleAddEdit(bool, data) { |
||||
|
this.isShowDialog = bool; |
||||
|
this.dialogData = data; |
||||
|
}, |
||||
|
handleExport() { |
||||
|
exportFile({ |
||||
|
url: "/business/dcInfoBoardVocabulary/export", |
||||
|
filename: "情报板敏感词", |
||||
|
data: this.getSearchData(), |
||||
|
}); |
||||
|
}, |
||||
|
handleSearch(data) { |
||||
|
this.searchData = data; |
||||
|
this.getData(); |
||||
|
}, |
||||
|
onReset(){ |
||||
|
this.searchData.word = undefined; |
||||
|
// console.log(this.$refs["form"] , "__-========="); |
||||
|
this.$refs["form"].handleResetForm(); |
||||
|
this.getData(); |
||||
|
}, |
||||
|
async getData() { |
||||
|
// const closeLoading = setLoading(); |
||||
|
this.isLoading = true; |
||||
|
|
||||
|
await delay(100); |
||||
|
|
||||
|
// 测试代码开始 |
||||
|
this.data = [{ |
||||
|
groupName : "任务组一", |
||||
|
remark : "每天早7点关闭激光唤醒设备,晚7点打开激光唤醒设备。每天早7点关闭激光唤醒设备,晚7点打开激光唤醒设备。" |
||||
|
}] |
||||
|
this.isLoading = false; |
||||
|
return; |
||||
|
// 测试代码结束 |
||||
|
|
||||
|
request({ |
||||
|
url: `/business/dcBatchFunctionsJobGroup/list`, |
||||
|
method: "get", |
||||
|
params: this.getSearchData(), |
||||
|
}) |
||||
|
.then((result) => { |
||||
|
this.searchText = this.searchData?.word || "请输入敏感词,回车搜索"; |
||||
|
if (result.code != 200) return; |
||||
|
this.data = result.rows; |
||||
|
this.data.map(item=>{ |
||||
|
item.remark = "每天早7点关闭激光唤醒设备,晚7点打开激光唤醒设备。每天早7点关闭激光唤醒设备,晚7点打开激光唤醒设备。" |
||||
|
}); |
||||
|
this.numTotal = result.total; |
||||
|
// this.pageTotal = Math.ceil(result.total/this.pageSize); |
||||
|
}) |
||||
|
.finally(() => { |
||||
|
this.isFirst = false; |
||||
|
// closeLoading(); |
||||
|
this.isLoading = false; |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
handleSizeChange(size) { |
||||
|
this.pageSize = size; |
||||
|
this.getData(); |
||||
|
}, |
||||
|
handleCurrentChange(currentPage) { |
||||
|
this.currentPage = currentPage; |
||||
|
this.getData(); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
.sensitiveWord { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
padding: 20px; |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
.filter { |
||||
|
height: 60px; |
||||
|
display: flex; |
||||
|
justify-content: space-between; |
||||
|
align-items: center; |
||||
|
|
||||
|
div { |
||||
|
display: flex; |
||||
|
gap: 6px; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.body { |
||||
|
height: 0; |
||||
|
flex: 1; |
||||
|
overflow: hidden; |
||||
|
display: flex; |
||||
|
flex-wrap: wrap; |
||||
|
align-content: flex-start; |
||||
|
.cardBox { |
||||
|
flex-basis: percentage(1/5); |
||||
|
width: 0; |
||||
|
padding-right: 10px; |
||||
|
padding-bottom: 10px; |
||||
|
} |
||||
|
.remark { |
||||
|
font-size: 14px; line-height: 20px; height: 40px; overflow: hidden; |
||||
|
color: #00b3cc; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.footer { |
||||
|
margin-top: 15px; |
||||
|
height: 36px; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
} |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,11 @@ |
|||||
|
|
||||
|
import request from '@/utils/request' |
||||
|
|
||||
|
// 查询设备列表
|
||||
|
export function getDeviceList(query){ |
||||
|
return request({ |
||||
|
url: '/business/device/query', |
||||
|
method: 'get', |
||||
|
params: query |
||||
|
}) |
||||
|
} |
Loading…
Reference in new issue