index.vue 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014
  1. <template>
  2. <div class="app-container">
  3. <div class="table" >
  4. <el-table
  5. :key="table.tableKey"
  6. v-loading="table.listLoading"
  7. element-loading-text="给我一点时间"
  8. :data="table.list"
  9. border
  10. fit
  11. highlight-current-row
  12. style="width: 100%;"
  13. :row-style="rowStyle"
  14. :cell-style="cellStyle"
  15. class="elTable table-fixed"
  16. :max-height="myHeight"
  17. >
  18. <el-table-column label="消息名称" min-width="130px" align="center" prop="message" />
  19. <el-table-column label="触发条件" min-width="130px" align="center" prop="trigger" />
  20. <el-table-column label="发送方式" min-width="130px" align="center">
  21. <template slot-scope="scope">
  22. <span>{{ scope.row.data.remind_type }}</span>
  23. </template>
  24. </el-table-column>
  25. <el-table-column label="详细配置" min-width="130px" align="center">
  26. <template slot-scope="{row}">
  27. <a class="correcting" size="mini" style="width: 80px;" @click="handleSee(row)">查看</a>
  28. </template>
  29. </el-table-column>
  30. <el-table-column label="提醒对象" min-width="130px" align="center" prop="user" />
  31. <el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width" fixed="right">
  32. <template slot-scope="{row}">
  33. <a class="correcting" size="mini" style="width: 80px;" @click="handleSetUp(row)">设置</a>
  34. </template>
  35. </el-table-column>
  36. </el-table>
  37. </div>
  38. <!-- 设置 -->
  39. <el-dialog :title="textMap[setUp.dialogStatus]" :visible.sync="setUp.dialogFormVisible" :close-on-click-modal="false" width="70%">
  40. <div class="setup">
  41. <div style="height: 500px;">
  42. <el-row :gutter="20">
  43. <el-col :span="8">
  44. <el-form ref="temp" :rules="temp.rules" :model="temp" label-position="right" label-width="110px" style="width: 100%;margin:0 auto">
  45. <el-row>
  46. <el-col :span="24">
  47. <el-form-item label="消息名称:" prop="messageName">
  48. <span>{{temp.messageName}}</span>
  49. </el-form-item>
  50. </el-col>
  51. </el-row>
  52. <el-row>
  53. <el-col :span="24">
  54. <el-form-item label="触发条件:" prop="triggerCondition">
  55. <span>{{temp.triggerCondition}}</span>
  56. </el-form-item>
  57. </el-col>
  58. </el-row>
  59. <el-row>
  60. <el-col :span="24">
  61. <el-form-item label="发送方式:" prop="sendingMethod">
  62. <el-select v-model="temp.sendingMethod" style="width: 100%;" placeholder="发送方式">
  63. <el-option v-for="item in modeList" :key="item.id" :label="item.name" :value="item.id" />
  64. </el-select>
  65. </el-form-item>
  66. </el-col>
  67. </el-row>
  68. <div v-if="temp.sendingMethod == '1'">
  69. <el-row :gutter="5">
  70. <el-col :span="18">
  71. <el-form-item label="发送机制">
  72. <el-select v-model="temp.sendingMechanism" style="width: 100%;" placeholder="发送机制">
  73. <el-option v-for="item in mechanismList" :key="item.id" :label="item.name" :value="item.id" />
  74. </el-select>
  75. </el-form-item>
  76. </el-col>
  77. <el-col :span="6" v-if="temp.sendingMechanism == '2'">
  78. <el-input ref="numberCycles" v-model="temp.numberCycles" style="width: 100%;" placeholder="循环次数" type="text" />
  79. </el-col>
  80. </el-row>
  81. <el-row v-if="temp.sendingMechanism !== '1' && temp.sendingMechanism !== ''">
  82. <el-col :span="24">
  83. <el-form-item label="间隔周期:">
  84. <el-input ref="intervalPeriod1" v-model="temp.intervalPeriod1" style="width: 33%;margin-right:1%" placeholder="天" type="text" />
  85. <el-input ref="intervalPeriod2" v-model="temp.intervalPeriod2" style="width: 33%;margin-right:1%" placeholder="小时" type="text" />
  86. <el-input ref="intervalPeriod3" v-model="temp.intervalPeriod3" style="width: 32%;" placeholder="分钟" type="text" />
  87. </el-form-item>
  88. </el-col>
  89. </el-row>
  90. </div>
  91. <div v-if="temp.sendingMethod == '2'">
  92. <el-row>
  93. <el-col :span="24">
  94. <el-form-item label="延时:">
  95. <el-input ref="delayed1" v-model="temp.delayed1" style="width: 33%;margin-right:1%" placeholder="天" type="text" />
  96. <el-input ref="delayed2" v-model="temp.delayed2" style="width: 33%;margin-right:1%" placeholder="小时" type="text" />
  97. <el-input ref="delayed3" v-model="temp.delayed3" style="width: 32%;" placeholder="分钟" type="text" />
  98. </el-form-item>
  99. </el-col>
  100. </el-row>
  101. <el-row>
  102. <el-col :span="24">
  103. <el-form-item label="发送时间">
  104. <el-time-select placeholder="发送时间" :clearable="false" style="width: 100%;" v-model="temp.sendTime" :picker-options="{ start: '00:00', step: '00:05', end: '23:59' }" />
  105. </el-form-item>
  106. </el-col>
  107. </el-row>
  108. <el-row :gutter="5">
  109. <el-col :span="18">
  110. <el-form-item label="发送机制">
  111. <el-select v-model="temp.sendingMechanism" style="width: 100%;" placeholder="发送机制">
  112. <el-option v-for="item in mechanismList" :key="item.id" :label="item.name" :value="item.id" />
  113. </el-select>
  114. </el-form-item>
  115. </el-col>
  116. <el-col :span="6" v-if="temp.sendingMechanism == '2'">
  117. <el-input ref="numberCycles" v-model="temp.numberCycles" style="width: 100%;" placeholder="循环次数" type="text" />
  118. </el-col>
  119. </el-row>
  120. <el-row v-if="temp.sendingMechanism !== '1' && temp.sendingMechanism !== ''">
  121. <el-col :span="24">
  122. <el-form-item label="间隔周期:">
  123. <el-input ref="intervalPeriod1" v-model="temp.intervalPeriod1" style="width: 33%;margin-right:1%" placeholder="天" type="text" />
  124. <el-input ref="intervalPeriod2" v-model="temp.intervalPeriod2" style="width: 33%;margin-right:1%" placeholder="小时" type="text" />
  125. <el-input ref="intervalPeriod3" v-model="temp.intervalPeriod3" style="width: 32%;" placeholder="分钟" type="text" />
  126. </el-form-item>
  127. </el-col>
  128. </el-row>
  129. </div>
  130. <div v-if="temp.sendingMethod == '3'">
  131. <el-row>
  132. <el-col :span="24">
  133. <el-form-item label="发送机制:">
  134. <span>持续循环</span>
  135. </el-form-item>
  136. </el-col>
  137. </el-row>
  138. <el-row :gutter="5">
  139. <el-col :span="18">
  140. <el-form-item label="周期类型">
  141. <el-select v-model="temp.cycleType" style="width: 100%;" placeholder="周期类型">
  142. <el-option v-for="item in cycleTypeList" :key="item.id" :label="item.name" :value="item.id" />
  143. </el-select>
  144. </el-form-item>
  145. </el-col>
  146. <el-col :span="6" v-if="temp.cycleType == '2'">
  147. <el-select v-model="temp.week" style="width: 100%;" placeholder="每周">
  148. <el-option v-for="item in weekList" :key="item.id" :label="item.name" :value="item.id" />
  149. </el-select>
  150. </el-col>
  151. <el-col :span="6" v-if="temp.cycleType == 3">
  152. <el-select v-model="temp.month" style="width: 100%;" placeholder="每月">
  153. <el-option v-for="item in monthList" :key="item.id" :label="item.name" :value="item.id" />
  154. </el-select>
  155. </el-col>
  156. </el-row>
  157. <el-row>
  158. <el-col :span="24">
  159. <el-form-item label="发送时间">
  160. <el-time-select placeholder="发送时间" :clearable="false" style="width: 100%;" v-model="temp.sendTime" :picker-options="{ start: '00:00', step: '00:05', end: '23:59' }" />
  161. </el-form-item>
  162. </el-col>
  163. </el-row>
  164. </div>
  165. </el-form>
  166. </el-col>
  167. <el-col :span="16">
  168. <b>提醒对象:</b>
  169. <div class="search">
  170. <div style="margin-bottom: 20px;">
  171. <el-checkbox-group v-model="typeIdsArr">
  172. <el-checkbox v-for="(item,index) in typeNameList" :key="index" :label="item.id" border>{{ item.name }}</el-checkbox>
  173. </el-checkbox-group>
  174. </div>
  175. <el-input v-model="setUp.roleName" placeholder="角色名称" style="width: 180px;" class="filter-item" clearable />
  176. <el-input v-model="setUp.empCode" placeholder="用户名称" style="width: 180px;" class="filter-item" clearable />
  177. <el-input v-model="setUp.empName" placeholder="员工姓名" style="width: 180px;" class="filter-item" clearable />
  178. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  179. </div>
  180. <el-row :gutter="5">
  181. <el-col :span="6">
  182. <el-table
  183. ref="setUpTable1"
  184. :key="setUp.tableKey1"
  185. v-loading="setUp.listLoading1"
  186. element-loading-text="给我一点时间"
  187. :data="setUp.list1"
  188. border
  189. fit
  190. highlight-current-row
  191. style="width: 100%;"
  192. :row-style="rowStyle"
  193. :cell-style="cellStyle"
  194. class="elTable table-fixed"
  195. @selection-change="handleSelectionChange1"
  196. :height="350"
  197. >
  198. <el-table-column type="selection" align="center" width="50" />
  199. <el-table-column label="角色名" min-width="100px" align="center" prop="rolename" />
  200. </el-table>
  201. </el-col>
  202. <el-col :span="18">
  203. <el-table
  204. ref="setUpTable2"
  205. :key="setUp.tableKey2"
  206. v-loading="setUp.listLoading2"
  207. element-loading-text="给我一点时间"
  208. :data="setUp.list2"
  209. border
  210. fit
  211. highlight-current-row
  212. style="width: 100%;"
  213. :row-style="rowStyle"
  214. :cell-style="cellStyle"
  215. class="elTable table-fixed"
  216. @selection-change="handleSelectionChange2"
  217. :height="350"
  218. >
  219. <el-table-column type="selection" align="center" width="50" />
  220. <el-table-column label="用户名称" min-width="130px" align="center" prop="userName" />
  221. <el-table-column label="员工姓名" min-width="130px" align="center" prop="empName" />
  222. <el-table-column label="角色" min-width="130px" align="center" prop="roleName" />
  223. </el-table>
  224. </el-col>
  225. </el-row>
  226. </el-col>
  227. </el-row>
  228. </div>
  229. <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom: 0px;">
  230. <el-button class="cancelClose" @click="setUp.dialogFormVisible = false;getList(); ">取消</el-button>
  231. <el-button class="cancelClose" :disabled="isokDisable" @click="setData()">确认</el-button>
  232. </div>
  233. </div>
  234. </el-dialog>
  235. <!-- 查看 -->
  236. <el-dialog :title="textMap[see.dialogStatus]" :visible.sync="see.dialogFormVisible" :close-on-click-modal="false" width="40%">
  237. <div class="setup">
  238. <div style="height: 500px;">
  239. <el-form ref="temp" :rules="temp.rules" :model="temp" label-position="right" label-width="110px" style="width: 100%;margin:0 auto">
  240. <el-row>
  241. <el-col :span="24">
  242. <el-form-item label="消息名称:" prop="messageName">
  243. <span>{{temp.messageName}}</span>
  244. </el-form-item>
  245. </el-col>
  246. </el-row>
  247. <el-row>
  248. <el-col :span="24">
  249. <el-form-item label="触发条件:" prop="triggerCondition">
  250. <span>{{temp.triggerCondition}}</span>
  251. </el-form-item>
  252. </el-col>
  253. </el-row>
  254. <el-row>
  255. <el-col :span="24">
  256. <el-form-item label="发送方式:" prop="sendingMethod">
  257. <el-select disabled v-model="temp.sendingMethod" style="width: 100%;" placeholder="发送方式">
  258. <el-option v-for="item in modeList" :key="item.id" :label="item.name" :value="item.id" />
  259. </el-select>
  260. </el-form-item>
  261. </el-col>
  262. </el-row>
  263. <div v-if="temp.sendingMethod == '1'">
  264. <el-row :gutter="5">
  265. <el-col :span="18">
  266. <el-form-item label="发送机制">
  267. <el-select disabled v-model="temp.sendingMechanism" style="width: 100%;" placeholder="发送机制">
  268. <el-option v-for="item in mechanismList" :key="item.id" :label="item.name" :value="item.id" />
  269. </el-select>
  270. </el-form-item>
  271. </el-col>
  272. <el-col :span="6" v-if="temp.sendingMechanism == '2'">
  273. <el-input disabled ref="numberCycles" v-model="temp.numberCycles" style="width: 100%;" placeholder="循环次数" type="text" />
  274. </el-col>
  275. </el-row>
  276. <el-row v-if="temp.sendingMechanism !== '1' && temp.sendingMechanism !== ''">
  277. <el-col :span="24">
  278. <el-form-item label="间隔周期:">
  279. <el-input disabled ref="intervalPeriod1" v-model="temp.intervalPeriod1" style="width: 33%;margin-right:1%" placeholder="天" type="text" />
  280. <el-input disabled ref="intervalPeriod2" v-model="temp.intervalPeriod2" style="width: 33%;margin-right:1%" placeholder="小时" type="text" />
  281. <el-input disabled ref="intervalPeriod3" v-model="temp.intervalPeriod3" style="width: 32%;" placeholder="分钟" type="text" />
  282. </el-form-item>
  283. </el-col>
  284. </el-row>
  285. </div>
  286. <div v-if="temp.sendingMethod == '2'">
  287. <el-row>
  288. <el-col :span="24">
  289. <el-form-item label="延时:">
  290. <el-input disabled ref="delayed1" v-model="temp.delayed1" style="width: 33%;margin-right:1%" placeholder="天" type="text" />
  291. <el-input disabled ref="delayed2" v-model="temp.delayed2" style="width: 33%;margin-right:1%" placeholder="小时" type="text" />
  292. <el-input disabled ref="delayed3" v-model="temp.delayed3" style="width: 32%;" placeholder="分钟" type="text" />
  293. </el-form-item>
  294. </el-col>
  295. </el-row>
  296. <el-row>
  297. <el-col :span="24">
  298. <el-form-item label="发送时间">
  299. <el-time-select disabled placeholder="发送时间" :clearable="false" style="width: 100%;" v-model="temp.sendTime" :picker-options="{ start: '00:00', step: '00:05', end: '23:59' }" />
  300. </el-form-item>
  301. </el-col>
  302. </el-row>
  303. <el-row :gutter="5">
  304. <el-col :span="18">
  305. <el-form-item label="发送机制">
  306. <el-select disabled v-model="temp.sendingMechanism" style="width: 100%;" placeholder="发送机制">
  307. <el-option v-for="item in mechanismList" :key="item.id" :label="item.name" :value="item.id" />
  308. </el-select>
  309. </el-form-item>
  310. </el-col>
  311. <el-col :span="6" v-if="temp.sendingMechanism == '2'">
  312. <el-input disabled ref="numberCycles" v-model="temp.numberCycles" style="width: 100%;" placeholder="循环次数" type="text" />
  313. </el-col>
  314. </el-row>
  315. <el-row v-if="temp.sendingMechanism !== '1' && temp.sendingMechanism !== ''">
  316. <el-col :span="24">
  317. <el-form-item label="间隔周期:">
  318. <el-input disabled ref="intervalPeriod1" v-model="temp.intervalPeriod1" style="width: 33%;margin-right:1%" placeholder="天" type="text" />
  319. <el-input disabled ref="intervalPeriod2" v-model="temp.intervalPeriod2" style="width: 33%;margin-right:1%" placeholder="小时" type="text" />
  320. <el-input disabled ref="intervalPeriod3" v-model="temp.intervalPeriod3" style="width: 32%;" placeholder="分钟" type="text" />
  321. </el-form-item>
  322. </el-col>
  323. </el-row>
  324. </div>
  325. <div v-if="temp.sendingMethod == '3'">
  326. <el-row>
  327. <el-col :span="24">
  328. <el-form-item label="发送机制:">
  329. <span>持续循环</span>
  330. </el-form-item>
  331. </el-col>
  332. </el-row>
  333. <el-row :gutter="5">
  334. <el-col :span="18">
  335. <el-form-item label="周期类型">
  336. <el-select disabled v-model="temp.cycleType" style="width: 100%;" placeholder="周期类型">
  337. <el-option v-for="item in cycleTypeList" :key="item.id" :label="item.name" :value="item.id" />
  338. </el-select>
  339. </el-form-item>
  340. </el-col>
  341. <el-col :span="6" v-if="temp.cycleType == '2'">
  342. <el-select disabled v-model="temp.week" style="width: 100%;" placeholder="每周">
  343. <el-option v-for="item in weekList" :key="item.id" :label="item.name" :value="item.id" />
  344. </el-select>
  345. </el-col>
  346. <el-col :span="6" v-if="temp.cycleType == 3">
  347. <el-select disabled v-model="temp.month" style="width: 100%;" placeholder="每月">
  348. <el-option v-for="item in monthList" :key="item.id" :label="item.name" :value="item.id" />
  349. </el-select>
  350. </el-col>
  351. </el-row>
  352. <el-row>
  353. <el-col :span="24">
  354. <el-form-item label="发送时间">
  355. <el-time-select disabled placeholder="发送时间" :clearable="false" style="width: 100%;" v-model="temp.sendTime" :picker-options="{ start: '00:00', step: '00:05', end: '23:59' }" />
  356. </el-form-item>
  357. </el-col>
  358. </el-row>
  359. </div>
  360. </el-form>
  361. </div>
  362. <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom: 40px;">
  363. <el-button class="cancelClose1" @click="see.dialogFormVisible = false;getList(); ">取消</el-button>
  364. </div>
  365. </div>
  366. </el-dialog>
  367. <!-- 扫码 -->
  368. <el-dialog :title="textMap[QRcode.dialogStatus]" :visible.sync="QRcode.dialogFormVisible" :close-on-click-modal="false" width="50%">
  369. <div class="QRcode">
  370. <div class="content">
  371. <div class="title">
  372. <p>微信接收系统待办、预警等消息,必须先扫码关注公众号;</p>
  373. <p>请将下方二维码分享给需要接收信息的用户扫码</p>
  374. </div>
  375. <div style="font-weight: 600;">关注微信:</div>
  376. <img src="https://img2.baidu.com/it/u=1151188475,1753963046&fm=253&fmt=auto&app=138&f=JPEG?w=504&h=300" alt="">
  377. </div>
  378. <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom: 40px;">
  379. <el-button class="save" :disabled="isokDisable" @click="QRcode.dialogFormVisible = false;">确认</el-button>
  380. </div>
  381. </div>
  382. </el-dialog>
  383. </div>
  384. </template>
  385. <script>
  386. import { GetDataByName,postJson2,postJson, PostDataByName } from '@/api/common'
  387. import Cookies from 'js-cookie'
  388. export default {
  389. name: 'NoticeRemind',
  390. data() {
  391. return {
  392. temp:{
  393. rules:{},
  394. messageName:'',//消息名称
  395. triggerCondition:'',//触发条件,
  396. sendingMethod:'1',//发送方式
  397. delayed1:'',//延时
  398. delayed2:'',//延时
  399. delayed3:'',//延时,
  400. sendTime:'',//发送时间,
  401. sendingMechanism:'1',// 发送机制
  402. numberCycles:'',//循环次数
  403. intervalPeriod1:'',//间隔周期
  404. intervalPeriod2:'',//间隔周期
  405. intervalPeriod3:'',//间隔周期
  406. cycleType:'1',
  407. },
  408. typeIdsArr:[],
  409. typeNameList: [
  410. { id: 1, name: '是否通知创建人' },
  411. { id: 2, name: '是否通知部门主管' },
  412. { id: 3, name: '是否通知部门总监' },
  413. ],
  414. modeList: [
  415. { id: '1', name: '立即' },
  416. { id: '2', name: '延时' },
  417. { id: '3', name: '指定周期' },
  418. ],
  419. mode: '0',
  420. mechanismList: [
  421. { id: '1', name: '单次' },
  422. { id: '2', name: '指定循环次数' },
  423. { id: '3', name: '循环至任务结束' },
  424. ],
  425. cycleTypeList:[
  426. { id: '1', name: '每天' },
  427. { id: '2', name: '每周' },
  428. { id: '3', name: '每月' },
  429. ],//周期类型
  430. weekList:[
  431. { id: '1', name: '周一' },
  432. { id: '2', name: '周二' },
  433. { id: '3', name: '周三' },
  434. { id: '4', name: '周四' },
  435. { id: '5', name: '周五' },
  436. { id: '6', name: '周六' },
  437. { id: '7', name: '周日' },
  438. ],//周
  439. monthList:[],//月
  440. mechanism: '0',
  441. activeName:'first',
  442. table: {
  443. tableKey: 0,
  444. list: [],
  445. total: 0,
  446. listLoading: false
  447. },
  448. setUp:{
  449. dialogStatus: '',
  450. dialogFormVisible:false,
  451. // 角色
  452. tableKey1: 0,
  453. list1: [],
  454. total1: 0,
  455. listLoading1: false,
  456. data1:{
  457. name: 'getRoleList', page: 1, offset: 1, pagecount:'',returntype: 'Map',
  458. parammaps: {
  459. pastureid: Cookies.get('pastureid')
  460. }
  461. },
  462. // 用户
  463. tableKey2: 0,
  464. list2: [],
  465. total2: 0,
  466. listLoading2: false,
  467. data2:{
  468. name: 'userallL', page: 1, offset: 1, pagecount:'',returntype: 'Map',
  469. parammaps: {
  470. pastureid: Cookies.get('pastureid'),
  471. roleid:''
  472. }
  473. },
  474. temp:{}
  475. },
  476. see:{
  477. dialogStatus: '',
  478. dialogFormVisible:false,
  479. temp:{}
  480. },
  481. QRcode:{
  482. dialogStatus: '',
  483. dialogFormVisible:false,
  484. },
  485. myHeight:document.documentElement.clientHeight - 85- 150 - 45,
  486. textMap: {
  487. setup: '设置',
  488. QRcode:'提示',
  489. add:'新增',
  490. see:'查看'
  491. },
  492. selectList1:[],
  493. selectList2:[],
  494. isokDisable:false,
  495. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  496. cellStyle: { padding: 0 + 'px' }
  497. }
  498. },
  499. created() {
  500. this.monthList = []
  501. for(let i=1;i<=31;i++){
  502. let obj = {}
  503. obj.id = String(i)
  504. obj.name = i+'日'
  505. this.monthList.push(obj)
  506. }
  507. this.getList()
  508. },
  509. methods: {
  510. getList() {
  511. this.table.listLoading = true
  512. let url = 'authdata/remind/list'
  513. let data = {
  514. parammaps:{
  515. pastureid:Cookies.get('pastureid')
  516. }
  517. }
  518. postJson(url,data).then(response => {
  519. if (response.data !== null) {
  520. console.log('table数据', response.data)
  521. this.table.list = response.data
  522. this.table.pageNum = response.data.pageNum
  523. this.table.pageSize = response.data.pageSize
  524. } else {
  525. this.table.list = []
  526. }
  527. this.table.total = response.data.total
  528. setTimeout(() => {
  529. this.table.listLoading = false
  530. }, 100)
  531. })
  532. },
  533. handleSetUp(row){
  534. console.log(row,'row')
  535. this.setUp.dialogStatus = 'setup'
  536. this.activeName = 'first'
  537. this.setUp.temp = Object.assign({}, row)
  538. this.temp.messageName = row.message //消息名称
  539. this.temp.triggerCondition = row.trigger //触发条件
  540. this.temp.sendTime = row.data.push_time //发送时间
  541. if(row.toCreater == 0 && row.toSupervisor == 0 && row.toChiefInspector == 0){
  542. this.typeIdsArr = []
  543. } else {
  544. if(row.toCreater == 1){ this.typeIdsArr.push(1) }
  545. if(row.toSupervisor == 1){ this.typeIdsArr.push(2) }
  546. if(row.toChiefInspector == 1){ this.typeIdsArr.push(3) }
  547. }
  548. this.selectList1 = []
  549. this.setUp.dialogFormVisible = true
  550. if(row.user){
  551. this.selectList2 = row.user.split(',')
  552. }
  553. console.log(this.selectList2,'this.selectList211')
  554. // 立即
  555. this.temp.sendingMethod = String(row.data.remind_type) //发送方式
  556. if(this.temp.sendingMethod == '1'){
  557. this.temp.sendingMechanism = String(row.data.cycle_type) //发送机制
  558. if(this.temp.sendingMechanism == '2'){
  559. this.temp.numberCycles = row.data.push_limit //循环次数
  560. if(this.temp.sendingMechanism !== '1' && this.temp.sendingMechanism !== ''){
  561. //间隔周期
  562. var minutes = row.data.interval_time
  563. var day = parseInt(Math.floor(minutes / 1440));
  564. var hour = day > 0 ? Math.floor((minutes - day * 1440) / 60) : Math.floor(minutes / 60);
  565. var minute = hour > 0 ? Math.floor(minutes - day * 1440 - hour * 60) : minutes;
  566. this.temp.intervalPeriod1 = day;
  567. this.temp.intervalPeriod2 = hour;
  568. this.temp.intervalPeriod3 = minute;
  569. }
  570. }
  571. if(this.temp.sendingMechanism == '3'){
  572. if(this.temp.sendingMechanism !== '1' && this.temp.sendingMechanism !== ''){
  573. //间隔周期
  574. var minutes = row.data.interval_time
  575. var day = parseInt(Math.floor(minutes / 1440));
  576. var hour = day > 0 ? Math.floor((minutes - day * 1440) / 60) : Math.floor(minutes / 60);
  577. var minute = hour > 0 ? Math.floor(minutes - day * 1440 - hour * 60) : minutes;
  578. this.temp.intervalPeriod1 = day;
  579. this.temp.intervalPeriod2 = hour;
  580. this.temp.intervalPeriod3 = minute;
  581. }
  582. }
  583. }
  584. // 延时
  585. if(this.temp.sendingMethod == '2'){
  586. this.temp.sendingMethod = String(row.data.remind_type) //发送方式
  587. if(this.temp.sendingMethod == '2'){
  588. //延时
  589. var minutes = row.data.delay_time
  590. var day = parseInt(Math.floor(minutes / 1440));
  591. var hour = day > 0 ? Math.floor((minutes - day * 1440) / 60) : Math.floor(minutes / 60);
  592. var minute = hour > 0 ? Math.floor(minutes - day * 1440 - hour * 60) : minutes;
  593. this.temp.delayed1 = day;
  594. this.temp.delayed2 = hour;
  595. this.temp.delayed3 = minute;
  596. }
  597. this.temp.sendTime = row.data.push_time //发送时间
  598. this.temp.sendingMechanism = String(row.data.cycle_type) //发送机制
  599. if(this.temp.sendingMechanism == '2'){
  600. this.temp.numberCycles = row.data.push_limit //循环次数
  601. if(this.temp.sendingMechanism !== '1' && this.temp.sendingMechanism !== ''){
  602. //间隔周期
  603. var minutes = row.data.interval_time
  604. var day = parseInt(Math.floor(minutes / 1440));
  605. var hour = day > 0 ? Math.floor((minutes - day * 1440) / 60) : Math.floor(minutes / 60);
  606. var minute = hour > 0 ? Math.floor(minutes - day * 1440 - hour * 60) : minutes;
  607. this.temp.intervalPeriod1 = day;
  608. this.temp.intervalPeriod2 = hour;
  609. this.temp.intervalPeriod3 = minute;
  610. }
  611. }
  612. if(this.temp.sendingMechanism == '3'){
  613. if(this.temp.sendingMechanism !== '1' && this.temp.sendingMechanism !== ''){
  614. var minutes = row.data.interval_time
  615. var day = parseInt(Math.floor(minutes / 1440));
  616. var hour = day > 0 ? Math.floor((minutes - day * 1440) / 60) : Math.floor(minutes / 60);
  617. var minute = hour > 0 ? Math.floor(minutes - day * 1440 - hour * 60) : minutes;
  618. this.temp.intervalPeriod1 = day;
  619. this.temp.intervalPeriod2 = hour;
  620. this.temp.intervalPeriod3 = minute;
  621. }
  622. }
  623. }
  624. // 指定周期
  625. if(this.temp.sendingMethod == '3'){
  626. this.temp.cycleType = String(row.data.date_type) //周期类型
  627. if(this.temp.cycleType == '2'){
  628. this.temp.week = String(row.data.push_date)
  629. }
  630. if(this.temp.cycleType == '3'){
  631. this.temp.month = String(row.data.push_date)
  632. }
  633. }
  634. this.getList1()
  635. },
  636. handleSee(row){
  637. this.see.dialogStatus = 'see'
  638. this.see.dialogFormVisible = true
  639. this.setUp.temp = Object.assign({}, row)
  640. this.temp.messageName = row.message //消息名称
  641. this.temp.triggerCondition = row.trigger //触发条件
  642. this.temp.sendTime = row.data.push_time //发送时间
  643. // 立即
  644. this.temp.sendingMethod = String(row.data.remind_type) //发送方式
  645. if(this.temp.sendingMethod == '1'){
  646. this.temp.sendingMechanism = String(row.data.cycle_type) //发送机制
  647. if(this.temp.sendingMechanism == '2'){
  648. this.temp.numberCycles = row.data.push_limit //循环次数
  649. if(this.temp.sendingMechanism !== '1' && this.temp.sendingMechanism !== ''){
  650. //间隔周期
  651. var minutes = row.data.interval_time
  652. var day = parseInt(Math.floor(minutes / 1440));
  653. var hour = day > 0 ? Math.floor((minutes - day * 1440) / 60) : Math.floor(minutes / 60);
  654. var minute = hour > 0 ? Math.floor(minutes - day * 1440 - hour * 60) : minutes;
  655. this.temp.intervalPeriod1 = day;
  656. this.temp.intervalPeriod2 = hour;
  657. this.temp.intervalPeriod3 = minute;
  658. }
  659. }
  660. if(this.temp.sendingMechanism == '3'){
  661. if(this.temp.sendingMechanism !== '1' && this.temp.sendingMechanism !== ''){
  662. //间隔周期
  663. var minutes = row.data.interval_time
  664. var day = parseInt(Math.floor(minutes / 1440));
  665. var hour = day > 0 ? Math.floor((minutes - day * 1440) / 60) : Math.floor(minutes / 60);
  666. var minute = hour > 0 ? Math.floor(minutes - day * 1440 - hour * 60) : minutes;
  667. this.temp.intervalPeriod1 = day;
  668. this.temp.intervalPeriod2 = hour;
  669. this.temp.intervalPeriod3 = minute;
  670. }
  671. }
  672. }
  673. // 延时
  674. if(this.temp.sendingMethod == '2'){
  675. this.temp.sendingMethod = String(row.data.remind_type) //发送方式
  676. if(this.temp.sendingMethod == '2'){
  677. //延时
  678. var minutes = row.data.delay_time
  679. var day = parseInt(Math.floor(minutes / 1440));
  680. var hour = day > 0 ? Math.floor((minutes - day * 1440) / 60) : Math.floor(minutes / 60);
  681. var minute = hour > 0 ? Math.floor(minutes - day * 1440 - hour * 60) : minutes;
  682. this.temp.delayed1 = day;
  683. this.temp.delayed2 = hour;
  684. this.temp.delayed3 = minute;
  685. }
  686. this.temp.sendTime = row.data.push_time //发送时间
  687. this.temp.sendingMechanism = String(row.data.cycle_type) //发送机制
  688. if(this.temp.sendingMechanism == '2'){
  689. this.temp.numberCycles = row.data.push_limit //循环次数
  690. if(this.temp.sendingMechanism !== '1' && this.temp.sendingMechanism !== ''){
  691. //间隔周期
  692. var minutes = row.data.interval_time
  693. var day = parseInt(Math.floor(minutes / 1440));
  694. var hour = day > 0 ? Math.floor((minutes - day * 1440) / 60) : Math.floor(minutes / 60);
  695. var minute = hour > 0 ? Math.floor(minutes - day * 1440 - hour * 60) : minutes;
  696. this.temp.intervalPeriod1 = day;
  697. this.temp.intervalPeriod2 = hour;
  698. this.temp.intervalPeriod3 = minute;
  699. }
  700. }
  701. if(this.temp.sendingMechanism == '3'){
  702. if(this.temp.sendingMechanism !== '1' && this.temp.sendingMechanism !== ''){
  703. var minutes = row.data.interval_time
  704. var day = parseInt(Math.floor(minutes / 1440));
  705. var hour = day > 0 ? Math.floor((minutes - day * 1440) / 60) : Math.floor(minutes / 60);
  706. var minute = hour > 0 ? Math.floor(minutes - day * 1440 - hour * 60) : minutes;
  707. this.temp.intervalPeriod1 = day;
  708. this.temp.intervalPeriod2 = hour;
  709. this.temp.intervalPeriod3 = minute;
  710. }
  711. }
  712. }
  713. // 指定周期
  714. if(this.temp.sendingMethod == '3'){
  715. this.temp.cycleType = String(row.data.date_type) //周期类型
  716. if(this.temp.cycleType == '2'){
  717. this.temp.week = String(row.data.push_date)
  718. }
  719. if(this.temp.cycleType == '3'){
  720. this.temp.month = String(row.data.push_date)
  721. }
  722. }
  723. },
  724. handleClick(item){
  725. if(item == 'first'){
  726. this.getList1()
  727. }else{
  728. this.getList2()
  729. }
  730. },
  731. handleSelectionChange1(val) {
  732. console.log('勾选数据', val)
  733. this.selectList1 = []
  734. for(let i=0;i<val.length;i++){
  735. this.selectList1.push(val[i].id)
  736. }
  737. this.setUp.data2.parammaps.roleid = this.selectList1.join(',')
  738. this.getList2()
  739. },
  740. handleSelectionChange2(val) {
  741. this.selectList2 = val.map(item=>item.userName)
  742. console.log('勾选数据', this.selectList2)
  743. },
  744. handleGenerateQRcode(){
  745. this.QRcode.dialogStatus = 'QRcode'
  746. this.QRcode.dialogFormVisible = true
  747. },
  748. handleSearch(){
  749. this.getList2()
  750. },
  751. getList1() {
  752. this.setUp.listLoading1 = true
  753. let url = "authdata/GetDataByName"
  754. postJson(url,this.setUp.data1).then(response => {
  755. if (response.data.list !== null) {
  756. this.setUp.list1 = response.data.list
  757. if(this.selectList1.length== 0){
  758. this.setUp.data2.parammaps.roleid = ''
  759. }
  760. this.selectList1.forEach(key => {
  761. this.setUp.list1.forEach(row => {
  762. if (row.id == key) {
  763. this.$nextTick(() => {
  764. this.$refs.setUpTable1.toggleRowSelection(row, true);
  765. })
  766. }
  767. })
  768. })
  769. this.getList2()
  770. } else {
  771. this.setUp.list1 = []
  772. }
  773. setTimeout(() => {
  774. this.setUp.listLoading1 = false
  775. }, 100)
  776. })
  777. },
  778. getList2() {
  779. this.setUp.listLoading2 = true
  780. let url = "authdata/userallL"
  781. postJson(url,this.setUp.data2).then(response => {
  782. if (response.data.list !== null) {
  783. this.setUp.list2 = response.data.list
  784. if(this.selectList1.length !== 0){
  785. this.selectList2 = []
  786. response.data.list.forEach(key => {
  787. this.selectList2.push(key.userName)
  788. })
  789. }
  790. this.selectList2.forEach(key => {
  791. console.log(key,'key')
  792. this.setUp.list2.forEach(row => {
  793. if (row.userName == key) {
  794. this.$nextTick(() => {
  795. this.$refs.setUpTable2.toggleRowSelection(row, true);
  796. })
  797. }
  798. })
  799. })
  800. } else {
  801. this.setUp.list2 = []
  802. }
  803. console.log(this.selectList2,'this.selectList2')
  804. setTimeout(() => {
  805. this.setUp.listLoading2 = false
  806. }, 100)
  807. })
  808. },
  809. setData(){
  810. let url = 'authdata/remind/edit'
  811. let data = {}
  812. let delayedTime = 0
  813. let delayed1 = 0
  814. let delayed2 = 0
  815. let delayed3 = 0
  816. if(this.temp.sendTime == null){
  817. this.temp.sendTime = ''
  818. }
  819. if(this.temp.delayed1 !== ''){
  820. delayed1 = parseInt(this.temp.delayed1)*24*60
  821. }else {
  822. delayed1 = 0
  823. }
  824. if(this.temp.delayed2 !== ''){
  825. delayed2 = parseInt(this.temp.delayed2)*60
  826. }else {
  827. delayed2 = 0
  828. }
  829. if(this.temp.delayed3 !== ''){
  830. delayed3 = parseInt(this.temp.delayed3)
  831. }else{
  832. delayed3 = 0
  833. }
  834. delayedTime = delayed1 + delayed2 + delayed3
  835. let intervalPeriodTime = 0
  836. let intervalPeriod1 = 0
  837. let intervalPeriod2 = 0
  838. let intervalPeriod3 = 0
  839. if(this.temp.intervalPeriod1 !== ''){
  840. intervalPeriod1 = parseInt(this.temp.intervalPeriod1)*24*60
  841. }else {
  842. intervalPeriod1 = 0
  843. }
  844. if(this.temp.intervalPeriod2 !== ''){
  845. intervalPeriod2 = parseInt(this.temp.intervalPeriod2)*60
  846. }else {
  847. intervalPeriod2 = 0
  848. }
  849. if(this.temp.intervalPeriod3 !== ''){
  850. intervalPeriod3 = parseInt(this.temp.intervalPeriod3)
  851. }else{
  852. intervalPeriod3 = 0
  853. }
  854. intervalPeriodTime = intervalPeriod1+ intervalPeriod2 + intervalPeriod3
  855. // sendingMethod 发送方式
  856. // sendingMechanism 发送机制
  857. // intervalPeriod1 间隔周期
  858. // delayed1 延时
  859. // sendTime 发送时间
  860. // numberCycles 循环次数
  861. // 发送方式-立即
  862. if(this.temp.sendingMethod == '1'){
  863. data.sys_name = 'tmrWatch'
  864. data.pastureid = this.setUp.temp.pastureid
  865. // data.service_id = this.setUp.temp.service_id
  866. data.type_name = this.temp.messageName
  867. data.template_id = 'Z_6JHoSH344pVGNaaYM31bOAFYo69w63LdlfLBp3m0k'
  868. data.id = this.setUp.temp.id
  869. data.user = this.selectList2
  870. data.remind_type = parseInt(this.temp.sendingMethod) //发送方式123
  871. data.cycle_type = parseInt(this.temp.sendingMechanism) //发送机制123
  872. if(this.temp.sendingMechanism == 2){
  873. data.push_limit = this.temp.numberCycles //循环次数
  874. data.interval_time = intervalPeriodTime //间隔周期
  875. }
  876. if(this.temp.sendingMechanism == 3){
  877. data.interval_time = intervalPeriodTime //间隔周期
  878. }
  879. }
  880. // 发送方式-延时
  881. if(this.temp.sendingMethod == '2'){
  882. data.id = this.setUp.temp.id
  883. data.user = this.selectList2
  884. data.sys_name = 'tmrWatch'
  885. data.type_name = this.temp.messageName
  886. data.template_id = 'Z_6JHoSH344pVGNaaYM31bOAFYo69w63LdlfLBp3m0k'
  887. data.pastureid = Cookies.get('pastureid')
  888. data.remind_type = parseInt(this.temp.sendingMethod) //发送方式123
  889. data.delay_time = delayedTime //延时
  890. data.push_time = this.temp.sendTime //发送时间
  891. data.cycle_type = parseInt(this.temp.sendingMechanism) //发送机制123
  892. if(this.temp.sendingMechanism == 2){
  893. data.push_limit = this.temp.numberCycles //循环次数
  894. data.interval_time = intervalPeriodTime
  895. }
  896. if(this.temp.sendingMechanism == 3){
  897. data.interval_time = intervalPeriodTime //间隔周期
  898. }
  899. }
  900. // 发送方式-指定周期
  901. if(this.temp.sendingMethod == '3'){
  902. data.id = this.setUp.temp.id
  903. data.user = this.selectList2
  904. data.sys_name = 'tmrWatch'
  905. data.type_name = this.temp.messageName
  906. data.template_id = 'Z_6JHoSH344pVGNaaYM31bOAFYo69w63LdlfLBp3m0k'
  907. data.pastureid = Cookies.get('pastureid')
  908. data.remind_type = parseInt(this.temp.sendingMethod) //发送方式123
  909. data.cycle_type = '4'//发送机制
  910. data.date_type = parseInt(this.temp.cycleType) //周期类型
  911. data.push_time = this.temp.sendTime //发送时间
  912. if(this.temp.cycleType == 2){
  913. data.push_date = this.temp.week
  914. }else{
  915. data.push_date = this.temp.month
  916. }
  917. }
  918. console.log("typeIdsArr",this.typeIdsArr)
  919. var typeIdsArr = this.typeIdsArr
  920. var toCreater = 0
  921. var toSupervisor = 0
  922. var toChiefInspector = 0
  923. if(typeIdsArr.length == 0){
  924. } else {
  925. typeIdsArr.forEach(function(item){
  926. console.log('item',item)
  927. if(item == 1){ toCreater = 1 }
  928. if(item == 2){ toSupervisor = 1 }
  929. if(item == 3){ toChiefInspector = 1 }
  930. })
  931. }
  932. var send_data3 = {
  933. "name":"updateRemindById",
  934. "parammaps":{
  935. "id": this.setUp.temp.id,
  936. "toCreater":toCreater,"toSupervisor":toSupervisor,"toChiefInspector":toChiefInspector}
  937. }
  938. postJson(url,data).then(response => {
  939. if(response.code == 200){
  940. console.log('成功')
  941. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  942. PostDataByName(send_data3).then(response => {
  943. if (response.msg !== 'fail') {
  944. this.$notify({ title: '成功', message: '通知成功', type: 'success', duration: 2000 })
  945. } else {
  946. this.$notify({ title: '失败', message: '通知失败' + response.data, type: 'error', duration: 2000 })
  947. }
  948. })
  949. this.setUp.dialogFormVisible = false
  950. this.getList()
  951. }else{
  952. this.$notify({ title: '失败', message: response.message, type: 'warning', duration: 2000 })
  953. console.log('失败')
  954. }
  955. })
  956. }
  957. }
  958. }
  959. </script>
  960. <style scoped>
  961. .app-container{
  962. padding: 20px 20px;
  963. }
  964. .content-left{padding: 5px 5px;}
  965. .content-left b{padding-right: 10px;}
  966. .QRcode{display:flex;justify-content: center; align-items:center;}
  967. .content{
  968. /* margin-top: 100px; */
  969. width: 500px;
  970. }
  971. .content img{
  972. max-width:300px;
  973. }
  974. </style>