taskInfo.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <div>
  3. <van-overlay :show="show">
  4. <div class="wrapper">
  5. <div class="block">
  6. <!-- 标题信息 -->
  7. <van-row>
  8. <van-col span="24">
  9. <div class="textTitle">调阅记录</div>
  10. </van-col>
  11. <van-col span="24">
  12. <div class="text">{{videoChannelName}}</div>
  13. </van-col>
  14. </van-row>
  15. <!-- //主体内容 -->
  16. <div class="mainBox">
  17. <van-row class="titleList">
  18. <van-col class="itemCol" span="10"> 类型</van-col>
  19. <van-col class="itemCol" span="7"> 正常</van-col>
  20. <van-col class="itemCol" span="7"> 异常</van-col>
  21. </van-row>
  22. <div class="mainItem">
  23. <van-row class="rowItem" v-for="item in dataList" :key="item.id">
  24. <van-col class="itemCls" span="10"
  25. ><van-checkbox v-model="item.isChecked" @change="checkedFc($event, item)" :disabled="disabled" icon-size="16px" shape="square">{{
  26. item.dictLabel
  27. }}</van-checkbox>
  28. </van-col>
  29. <van-radio-group v-model="item.situation" @change="checkHandler($event, item)">
  30. <van-col class="itemCls" span="7" v-for="itemDict in dictList" :key="itemDict.dictValue">
  31. <van-radio icon-size="16px" :name="itemDict.dictValue">{{
  32. itemDict.dictLabel
  33. }}</van-radio></van-col
  34. >
  35. </van-radio-group>
  36. <van-col span="24" v-if="item.situation == '1'">
  37. <van-field
  38. v-model="item.abnormalIllustrate"
  39. rows="2"
  40. required
  41. autosize
  42. label=""
  43. type="textarea"
  44. maxlength="50"
  45. placeholder="请输入异常原因"
  46. show-word-limit
  47. :rules="[{ required: true, message: '内容不能为空' }]"
  48. /></van-col>
  49. </van-row>
  50. </div>
  51. <!-- 底部按钮 -->
  52. <div>
  53. <van-row>
  54. <van-col span="12">
  55. <van-button class="btn" size="small" @click="show = false" type="default">取消</van-button></van-col
  56. >
  57. <van-col span="12">
  58. <van-button class="btn" size="small" type="info" v-if="!disabled" @click="submitHadnler">{{
  59. '确定'
  60. }}</van-button></van-col
  61. >
  62. </van-row>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. </van-overlay>
  68. </div>
  69. </template>
  70. <script>
  71. import {
  72. updateInfo,
  73. getEditInfo,
  74. } from '@/api/toConsult.js'
  75. import { Toast } from 'vant'
  76. export default {
  77. name: 'SocAppTaskInfo',
  78. data() {
  79. return {
  80. taskId: '', //任务ID
  81. show: false,
  82. host: '',
  83. hostId: '',
  84. videoChannelName: '',
  85. videoChannel: '',
  86. taskRegistrationId: '',
  87. id: '',
  88. falg: false,
  89. checked: '',
  90. message: '',
  91. radio: '0',
  92. dictList: [],
  93. dataList: [] //列表
  94. }
  95. },
  96. created() {
  97. this.disabled = +this.$route.params.id.split('_')[3] ? true : false
  98. },
  99. mounted() {},
  100. methods: {
  101. //组件初始化
  102. init(taskId, videoId, hostId) {
  103. this.taskId = taskId
  104. this.show = true
  105. //获取调阅字典
  106. this.getDictHandler('core_registration_project', res => {
  107. this.dataList = JSON.parse(JSON.stringify(res))
  108. this.dataList.forEach(item => {
  109. this.$set(item, 'situation', '') //异常情况初始化默认值
  110. this.$set(item, 'isChecked', false) //选中初始值
  111. this.$set(item, 'abnormalIllustrate', '') //情况说明初始化默认值
  112. })
  113. //获取异常情况字典
  114. this.getDictHandler('core_check_type', res => {
  115. this.dictList = res
  116. this.dictList.forEach(item => {
  117. item.text = item.dictLabel
  118. item.value = item.dictValue
  119. })
  120. })
  121. this.getInfoHandler(taskId, videoId, hostId) //获取详情
  122. })
  123. },
  124. //复选框选中变化
  125. checkHandler(val, item) {
  126. if (val&&item.situation=='0') {
  127. item.abnormalIllustrate = ''
  128. }
  129. },
  130. checkedFc(val,item){
  131. if(val){
  132. if(!item.situation){
  133. item.situation='0'
  134. }
  135. }else{
  136. item.situation=''
  137. item.abnormalIllustrate=''
  138. }
  139. },
  140. getInfoHandler(id, videoId, hostId) {
  141. //获取卡片详情数据
  142. getEditInfo({ taskId: id+'', videoId: videoId+'', hostId: hostId+'' }).then(res => {
  143. let { data, msg, code } = res
  144. if (code == 200) {
  145. this.dataList.forEach(item => {
  146. data.coreMonitoringTaskMonitorInfoList.forEach(i => {
  147. if (i.project === item.dictValue) {
  148. //查询赋值
  149. this.$set(item, 'isChecked', true)
  150. this.$set(item, 'situation', i.situation)
  151. this.$set(item, 'abnormalIllustrate', i.abnormalIllustrate)
  152. }
  153. })
  154. })
  155. console.log(this.dataList);
  156. //赋值主机&通道名称
  157. this.host = data.hostName
  158. this.hostId = data.host
  159. this.videoChannelName = data.videoChannelName
  160. this.videoChannel = data.videoChannel
  161. this.taskRegistrationId = data.registrationId
  162. this.id = data.id
  163. }
  164. })
  165. },
  166. //表单提交前校验
  167. beforSubmitV() {
  168. this.falg = false
  169. this.dataList.forEach(item => {
  170. if (item.isChecked) {
  171. console.log(item);
  172. if (item.situation == '1' && item.abnormalIllustrate == '') {
  173. Toast(`${item.dictLabel}的异常情况说明不能为空!`)
  174. this.falg = true
  175. }
  176. }
  177. })
  178. },
  179. submitHadnler() {
  180. this.beforSubmitV()
  181. if (this.falg) {
  182. //校验不通过
  183. } else {
  184. let list = []
  185. this.dataList.forEach(item => {
  186. if (item.isChecked) {
  187. item.project=item.dictValue
  188. list.push(item)
  189. }
  190. })
  191. //编辑提交
  192. updateInfo({
  193. host: this.hostId,
  194. videoChannel: this.videoChannel,
  195. taskRegistrationId: this.taskRegistrationId,
  196. id: this.id||'',
  197. coreMonitoringTaskMonitorInfoList: list
  198. }).then(res => {
  199. let { data, msg, code } = res
  200. if (code == 200) {
  201. Toast('编辑成功!')
  202. this.show=false
  203. this.$emit('resetList')
  204. }
  205. this.falg = false
  206. })
  207. }
  208. }
  209. }
  210. }
  211. </script>
  212. <style lang="scss" scoped>
  213. .mainItem {
  214. overflow: scroll;
  215. height: 750px;
  216. }
  217. .rowItem {
  218. margin-bottom: 30px;
  219. }
  220. .block {
  221. width: 85vw;
  222. height: 140vw;
  223. background-color: #fff;
  224. margin: auto;
  225. position: absolute;
  226. top: 7%;
  227. left: 10%;
  228. padding: 20px;
  229. }
  230. .textTitle {
  231. font-size: 30px;
  232. font-weight: bold;
  233. padding: 20px;
  234. color: black;
  235. text-align: center;
  236. padding-bottom: 0px;
  237. }
  238. .text {
  239. text-align: center;
  240. margin-top: 20px;
  241. color: black;
  242. }
  243. .mainBox {
  244. .titleList {
  245. background-color: #e8e8e8;
  246. margin-top: 20px;
  247. font-size: 22px;
  248. text-align: left;
  249. font-weight: bold;
  250. .itemCol {
  251. padding-left: 10px;
  252. color: black;
  253. height: 40px;
  254. line-height: 40px;
  255. }
  256. }
  257. }
  258. .itemCls {
  259. padding-left: 10px;
  260. height: 40px;
  261. line-height: 40px;
  262. }
  263. .btn {
  264. width: 90%;
  265. }
  266. </style>