|
|
@@ -0,0 +1,245 @@
|
|
|
+<template>
|
|
|
+ <ContentWrap>
|
|
|
+ <div class="tab-header">
|
|
|
+ <span class="tab-title">添加规则</span>
|
|
|
+ </div>
|
|
|
+ <div class="checkContent">
|
|
|
+ <section>
|
|
|
+ <span>通知规则种类:</span>
|
|
|
+ <el-select v-model="noticeData.type" placeholder="请选择" style="width: 260px">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in getStrDictOptions(DICT_TYPE.NOTICE_RULES_TYPE)"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </section>
|
|
|
+ <section>
|
|
|
+ <span>规则:</span>
|
|
|
+ <el-select v-model="noticeData.rule" placeholder="请选择" style="width: 260px">
|
|
|
+<!-- 作业通知-->
|
|
|
+ <el-option
|
|
|
+ v-show="noticeData.type==1"
|
|
|
+ v-for="dict in getStrDictOptions(DICT_TYPE.JOB_NOTICE_RULES)"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+<!-- 操作通知-->
|
|
|
+ <el-option
|
|
|
+ v-show="noticeData.type==3"
|
|
|
+ v-for="dict in getStrDictOptions(DICT_TYPE. ACTION_NOTICE_RULES)"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+<!-- 提前通知-->
|
|
|
+ <el-option
|
|
|
+ v-show="noticeData.type==0"
|
|
|
+ v-for="dict in getStrDictOptions(DICT_TYPE.ADVANCE_NOTICE_RULES)"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+<!-- 步骤通知-->
|
|
|
+ <el-option label="Restaurant" value="1" v-show="noticeData.type==2"/>
|
|
|
+ </el-select>
|
|
|
+ </section>
|
|
|
+ <section>
|
|
|
+ <span>通知时间:</span>
|
|
|
+ <el-select v-model="noticeData.notifyTimeType" placeholder="请选择" style="width: 260px">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in getStrDictOptions(DICT_TYPE.NOTICE_TIME_TYPE)"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <span v-if="noticeData.notifyTimeType !== undefined &&
|
|
|
+ noticeData.notifyTimeType !== null &&
|
|
|
+ (noticeData.notifyTimeType == 0 || noticeData.notifyTimeType == 2)">
|
|
|
+ <el-input-number
|
|
|
+ v-model="noticeData.notifyTime"
|
|
|
+ :min="1"
|
|
|
+ :max="10"
|
|
|
+ class="mx-4"
|
|
|
+ controls-position="right"
|
|
|
+ />天
|
|
|
+ <el-input-number
|
|
|
+ v-model="num1"
|
|
|
+ :min="1"
|
|
|
+ :max="10"
|
|
|
+ class="mx-4"
|
|
|
+ controls-position="right"
|
|
|
+ />时
|
|
|
+ <el-input-number
|
|
|
+ v-model="num1"
|
|
|
+ :min="1"
|
|
|
+ :max="10"
|
|
|
+ class="mx-4"
|
|
|
+ controls-position="right"
|
|
|
+ />分
|
|
|
+ <el-input-number
|
|
|
+ v-model="num1"
|
|
|
+ :min="1"
|
|
|
+ :max="10"
|
|
|
+ class="mx-4"
|
|
|
+ controls-position="right"
|
|
|
+ />秒
|
|
|
+ </span>
|
|
|
+ </section>
|
|
|
+ <section>
|
|
|
+ <span>通知区域:</span>
|
|
|
+ <el-select v-model="noticeData.workstationId" placeholder="请选择" style="width: 260px">
|
|
|
+ <el-option label="Restaurant" value="1" />
|
|
|
+ <el-option label="Order No." value="2" />
|
|
|
+ <el-option label="Tel" value="3" />
|
|
|
+ </el-select>
|
|
|
+ </section>
|
|
|
+ </div>
|
|
|
+ </ContentWrap>
|
|
|
+<!-- 通知角色与通知模板-->
|
|
|
+ <ContentWrap>
|
|
|
+ <div class="tab-header">
|
|
|
+ <span class="tab-title">通知角色与通知模板</span>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="tableCon">
|
|
|
+ <p>
|
|
|
+ <span>显示:</span>
|
|
|
+ <el-radio-group v-model="noticeData.status">
|
|
|
+ <el-radio label="showAll" :value="0">显示全部</el-radio>
|
|
|
+ <el-radio label="showNotice" :value="1">仅显示通知</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </p>
|
|
|
+ <el-table :data="tableData" border style="width: 80%">
|
|
|
+ <el-table-column prop="planDay" label="角色" width="180" />
|
|
|
+ <el-table-column label="是否通知" align="center" width="100">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-switch
|
|
|
+ :model-value="scope.row.enableNotifications"
|
|
|
+ :active-value="1"
|
|
|
+ :inactive-value="0"
|
|
|
+ @update:modelValue="(val) => handleNotificationsChange(scope.row, val)"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="仅通知当事人" align="center" width="110">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-switch
|
|
|
+ :model-value="scope.row.enableNotifications"
|
|
|
+ :active-value="1"
|
|
|
+ :inactive-value="0"
|
|
|
+ @update:modelValue="(val) => handleNotificationsChange(scope.row, val)"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="通知模板" align="center">
|
|
|
+ <template #default="scope">
|
|
|
+ <span>{{scope.row.enableNotifications}}</span>
|
|
|
+ <i>更换</i>
|
|
|
+ <i>选择</i>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <div class="btnstyle">
|
|
|
+ <el-button type="primary" plain @click="submit"
|
|
|
+ >确认</el-button
|
|
|
+ >
|
|
|
+ <el-button plain @click="goBack">取消</el-button>
|
|
|
+ </div>
|
|
|
+ </ContentWrap>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup lang="ts">
|
|
|
+import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
|
|
|
+const router = useRouter()
|
|
|
+const route = useRoute()
|
|
|
+const noticeData=reactive({
|
|
|
+ type:'',
|
|
|
+ rule:'',
|
|
|
+ notifyTimeType:'',
|
|
|
+ notifyTime:'',
|
|
|
+ workstationId:'',
|
|
|
+ status:1,
|
|
|
+})
|
|
|
+const isVisible=ref(2)
|
|
|
+const num1 = 5
|
|
|
+const tableData=ref([])
|
|
|
+
|
|
|
+
|
|
|
+// 返回
|
|
|
+const goBack=()=>{
|
|
|
+ router.go(-1)
|
|
|
+}
|
|
|
+
|
|
|
+const submit=()=>{
|
|
|
+ console.log('hhh')
|
|
|
+}
|
|
|
+// 是否开启通知
|
|
|
+const handleNotificationsChange = async (row, val) => {
|
|
|
+ console.log(val,row)
|
|
|
+ // if (!isInitialized.value) return
|
|
|
+ //
|
|
|
+ // const originalValue = row.enableNotifications
|
|
|
+ //
|
|
|
+ // try {
|
|
|
+ // // const data = {
|
|
|
+ // // ...row,
|
|
|
+ // // enableNotifications: val
|
|
|
+ // // }
|
|
|
+ // const data = {
|
|
|
+ // id: row.id,
|
|
|
+ // enableNotifications: val
|
|
|
+ // }
|
|
|
+ // console.log(data,'是什么数据')
|
|
|
+ // await SopApi.updateSopEnableNotification(data)
|
|
|
+ // ElMessage.success(val == 1 ? '已开启' : '已关闭')
|
|
|
+ //
|
|
|
+ // // 成功后更新值(防止 UI 不更新)
|
|
|
+ // row.enableNotifications = val
|
|
|
+ // } catch (err) {
|
|
|
+ // // 接口失败,回滚原始值
|
|
|
+ // row.enableNotifications = originalValue
|
|
|
+ //
|
|
|
+ // // 强制刷新 UI
|
|
|
+ // await nextTick()
|
|
|
+
|
|
|
+ // 提示错误
|
|
|
+ // ElMessage.error('状态更新失败,请重试')
|
|
|
+ // }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+.tab-header {
|
|
|
+ background-color: #f5f7fa;
|
|
|
+ border-bottom: 1px solid #dcdfe6;
|
|
|
+ padding: 12px 20px;
|
|
|
+ border-radius: 4px 4px 0 0;
|
|
|
+}
|
|
|
+.checkContent{
|
|
|
+ width: 95%;
|
|
|
+ height: 200px;
|
|
|
+ margin: 10px auto;
|
|
|
+ section{
|
|
|
+ width: 100%;
|
|
|
+ height: 49px;
|
|
|
+ }
|
|
|
+}
|
|
|
+.tableCon{
|
|
|
+ width: 95%;
|
|
|
+ min-height:300px;
|
|
|
+ margin:auto;
|
|
|
+ p{
|
|
|
+ margin: 20px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+.btnstyle {
|
|
|
+ text-align: right;
|
|
|
+}
|
|
|
+</style>
|