superviseAdminDetails.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. <!-- -->
  2. <template>
  3. <div class="superviseAdminDetails_box">
  4. <el-card :style="'height:' + fullHeight + 'px'" v-loading="loading">
  5. <el-row v-if="taskObj.task_id">
  6. <!-- 任务信息 -->
  7. <el-col :span="24">
  8. <div class="list_box">
  9. <div class="list_tlt">
  10. <span>任务信息</span>
  11. <el-button type="primary" size="mini" @click="overseer"
  12. >监督</el-button
  13. >
  14. </div>
  15. <ul class="list_ul">
  16. <li class="list_li">
  17. <div class="list_div">
  18. <span class="list_div_tlt">任务类型:</span>
  19. <span class="list_div_val">{{ taskObj.task_type }}</span>
  20. </div>
  21. <div class="list_div">
  22. <span class="list_div_tlt">任务监督人:</span>
  23. <span class="list_div_val">{{
  24. taskObj.supervisor_user
  25. }}</span>
  26. </div>
  27. <div class="list_div">
  28. <span class="list_div_tlt">任务时间:</span>
  29. <span class="list_div_val">{{ taskObj.start_time }}</span>
  30. </div>
  31. <div class="list_div">
  32. <span class="list_div_tlt">任务发布人:</span>
  33. <span class="list_div_val">{{ taskObj.owner_user }}</span>
  34. </div>
  35. <div class="list_div">
  36. <span class="list_div_tlt">任务处理人:</span>
  37. <span class="list_div_val">{{ taskObj.operator_user }}</span>
  38. </div>
  39. <div class="list_div">
  40. <span class="list_div_tlt">任务状态:</span>
  41. <span class="list_div_val">{{ taskObj.task_status }}</span>
  42. </div>
  43. <div class="list_div">
  44. <span class="list_div_tlt">任务描述:</span>
  45. <span class="list_div_val">{{ taskObj.tesk_msg }}</span>
  46. </div>
  47. </li>
  48. </ul>
  49. </div>
  50. </el-col>
  51. <!-- 签到信息 -->
  52. <el-col :span="24">
  53. <div class="list_box">
  54. <div class="list_tlt">签到信息</div>
  55. <ul class="list_ul">
  56. <li class="list_sing_li">
  57. <div class="list_sing_div">
  58. <span class="list_div_tlt">签到图片:</span>
  59. <p v-if="taskObj.img_list.length !== 0" style="display: flex">
  60. <span
  61. class="list_div_img"
  62. v-for="(item, index) in taskObj.img_list"
  63. :key="index"
  64. >
  65. <img v-viewer :src="item" alt="" />
  66. </span>
  67. </p>
  68. <span v-else>暂无签到图片</span>
  69. </div>
  70. <div class="list_sing_div">
  71. <span class="list_div_tlt">签到时间:</span>
  72. <span class="list_div_val">{{
  73. taskObj.end_time || "暂无"
  74. }}</span>
  75. </div>
  76. </li>
  77. </ul>
  78. </div>
  79. </el-col>
  80. <!-- 任务填报信息 -->
  81. <el-col :span="24" v-if="taskObj.task_type == '有害生物监测'">
  82. <div class="list_box">
  83. <div class="list_tlt">任务填报信息</div>
  84. <ul class="list_table_ul">
  85. <li class="list_li">
  86. <el-table :data="tableData" stripe style="width: 100%">
  87. <el-table-column prop="trap_number" label="设备编号">
  88. </el-table-column>
  89. <el-table-column prop="monitor_point" label="监测点">
  90. </el-table-column>
  91. <el-table-column prop="inducer_type" label="诱剂">
  92. </el-table-column>
  93. <el-table-column prop="report_status" label="有害生物登记">
  94. <template slot-scope="scope">
  95. <span
  96. v-if="scope.row.report_status == '已登记'"
  97. @click="examine(scope.row)"
  98. style="color: #409eff; cursor: pointer"
  99. >查看</span
  100. >
  101. <span v-else>{{ scope.row.report_status || "无" }}</span>
  102. </template>
  103. </el-table-column>
  104. <el-table-column prop="report_time" label="录入时间">
  105. <template slot-scope="scope">
  106. <span>{{ scope.row.report_time || "无" }}</span>
  107. </template>
  108. </el-table-column>
  109. </el-table>
  110. </li>
  111. </ul>
  112. </div>
  113. </el-col>
  114. <!-- 任务汇报 -->
  115. <el-col :span="24">
  116. <div class="list_box">
  117. <div class="list_tlt">任务汇报</div>
  118. <ul class="list_report_ul">
  119. <li class="list_report_li">
  120. {{ taskObj.report_msg || "暂无任务汇报" }}
  121. </li>
  122. </ul>
  123. </div>
  124. </el-col>
  125. </el-row>
  126. </el-card>
  127. <!-- 填报信息弹框 -->
  128. <el-dialog
  129. :title="titleData"
  130. :visible.sync="dialogVisible"
  131. :close-on-click-modal="false"
  132. :close-on-press-escape="false"
  133. width="30%"
  134. >
  135. <ul class="insect_ul">
  136. <li
  137. class="insect_list"
  138. v-for="(item, index) in insectList"
  139. :key="index"
  140. >
  141. <div>{{ item.pest_name + ":" }}</div>
  142. <div style="margin: 0 0 0 20px">{{ item.pest_number }}</div>
  143. </li>
  144. </ul>
  145. </el-dialog>
  146. <!-- 监督弹框 -->
  147. <el-dialog
  148. title="监督"
  149. :visible.sync="superviseVisible"
  150. :close-on-click-modal="false"
  151. :close-on-press-escape="false"
  152. width="30%"
  153. >
  154. <el-form
  155. v-loading="loading2"
  156. :model="ruleForm2"
  157. :rules="rules2"
  158. ref="ruleForm2"
  159. label-width="100px"
  160. class="demo-ruleForm"
  161. >
  162. <el-form-item label="监督形式" prop="resource">
  163. <el-radio-group v-model="ruleForm2.resource">
  164. <el-radio label="现场监督"></el-radio>
  165. <el-radio label="远程监督"></el-radio>
  166. </el-radio-group>
  167. </el-form-item>
  168. <el-form-item label="监督单位" prop="region">
  169. <el-input v-model="ruleForm2.region" size="mini"></el-input>
  170. </el-form-item>
  171. <el-form-item label="监督情况" prop="desc">
  172. <el-input type="textarea" v-model="ruleForm2.desc"></el-input>
  173. </el-form-item>
  174. <el-form-item>
  175. <el-button @click="superviseSubmitForm('ruleForm2')">取 消</el-button>
  176. <el-button
  177. :disabled="submitBtn"
  178. type="primary"
  179. @click="superviseAxiso('ruleForm2')"
  180. >{{ submitBtn == true ? "发布中..." : "发布" }}</el-button
  181. >
  182. </el-form-item>
  183. </el-form>
  184. </el-dialog>
  185. </div>
  186. </template>
  187. <script>
  188. export default {
  189. components: {},
  190. data() {
  191. //这里存放数据
  192. return {
  193. fullHeight: document.documentElement.clientHeight - 116, //
  194. loading: true, // 加载
  195. // 详情总数据
  196. taskObj: {},
  197. // 任务填报信息
  198. tableData: [],
  199. dialogVisible: false, // 弹框
  200. titleData: "", // 弹框标题
  201. insectList: [], //害虫列表
  202. // 任务汇报
  203. reportList: [],
  204. // 监督弹框
  205. superviseVisible: false,
  206. // 监督弹框
  207. ruleForm2: {
  208. resource: "", // 监督形式
  209. region: "", // 监督单位
  210. desc: "", // 监督情况
  211. },
  212. rules2: {
  213. region: [
  214. { required: true, message: "请选择活动区域", trigger: "change" },
  215. ],
  216. resource: [
  217. { required: true, message: "请选择活动资源", trigger: "change" },
  218. ],
  219. desc: [{ required: true, message: "请填写活动形式", trigger: "blur" }],
  220. },
  221. loading2: false, //加载
  222. isClick: true, // 防止重复弹框
  223. submitBtn: false, // 防止弹框确定按钮重复请求
  224. };
  225. },
  226. //监听属性 类似于data概念
  227. computed: {},
  228. //监控data中的数据变化
  229. watch: {
  230. fullHeight(val) {
  231. //监控浏览器高度变化
  232. if (!this.timer) {
  233. this.fullHeight = val;
  234. this.timer = true;
  235. let that = this;
  236. setTimeout(function () {
  237. //防止过度调用监测事件,导致卡顿
  238. that.timer = false;
  239. }, 400);
  240. }
  241. },
  242. superviseVisible(val) {
  243. if (val == false) {
  244. this.superviseSubmitForm("ruleForm2");
  245. }
  246. },
  247. },
  248. //方法集合
  249. methods: {
  250. //动态获取浏览器高度
  251. get_boderHeight() {
  252. const that = this;
  253. window.onresize = () => {
  254. return (() => {
  255. window.fullHeight = document.documentElement.clientHeight;
  256. that.fullHeight = window.fullHeight;
  257. })();
  258. };
  259. },
  260. // 详情界面数据
  261. detailsData() {
  262. this.$axios({
  263. method: "POST",
  264. url: "/api/api_gateway?method=control_center.task.task_info",
  265. data: this.qs.stringify({
  266. task_id: this.$route.query.id,
  267. }),
  268. })
  269. .then((res) => {
  270. if (res.data.data) {
  271. var data = res.data.data;
  272. data.img_list = JSON.parse(data.img_list);
  273. this.taskObj = data;
  274. this.tableData = data.trap_record_list;
  275. }
  276. this.loading = false;
  277. })
  278. .catch((err) => {
  279. this.loading = false;
  280. });
  281. },
  282. // 查看
  283. examine(data) {
  284. this.titleData = "设备编号:" + data.trap_number;
  285. this.insectList = data.pest_list;
  286. this.dialogVisible = true;
  287. },
  288. // 监督
  289. superviseAxiso(formName) {
  290. this.loading2 = true;
  291. this.$refs[formName].validate((valid) => {
  292. if (valid) {
  293. this.submitBtn = true;
  294. this.$axios({
  295. method: "POST",
  296. url: "/api/api_gateway?method=control_center.task.supervisor_add",
  297. data: this.qs.stringify({
  298. task_id: this.$route.query.id, //任务id
  299. supervisor_type: this.ruleForm2.resource, // 监督类型
  300. supervisor_depa: this.ruleForm2.region, // 监督部门
  301. supervisor_msg: this.ruleForm2.desc, // 监督内容
  302. }),
  303. })
  304. .then((res) => {
  305. if (res.data.data == true) {
  306. this.$message({
  307. message: "成功!",
  308. type: "success",
  309. duration: 1500,
  310. });
  311. this.superviseVisible = false;
  312. // this.$router.push({
  313. // path: "/index/superviserec",
  314. // });
  315. }
  316. this.loading2 = false;
  317. this.submitBtn = false;
  318. })
  319. .catch((err) => {
  320. this.loading2 = false;
  321. this.submitBtn = false;
  322. });
  323. // this.loading2 = false;
  324. // this.submitBtn = false;
  325. } else {
  326. this.loading2 = false;
  327. return false;
  328. }
  329. });
  330. },
  331. // 监督 - 取消
  332. superviseSubmitForm(formName) {
  333. this.superviseVisible = false;
  334. this.$refs[formName].resetFields();
  335. },
  336. // 监督 - 弹框
  337. overseer() {
  338. this.superviseVisible = true;
  339. },
  340. },
  341. //生命周期 - 创建完成(可以访问当前this实例)
  342. created() {},
  343. //生命周期 - 挂载完成(可以访问DOM元素)
  344. mounted() {
  345. this.loading = true; // 加载
  346. this.get_boderHeight(); // 动态获取浏览器高度
  347. this.detailsData(); //详情界面数据
  348. },
  349. beforeCreate() {}, //生命周期 - 创建之前
  350. beforeMount() {}, //生命周期 - 挂载之前
  351. beforeUpdate() {}, //生命周期 - 更新之前
  352. updated() {}, //生命周期 - 更新之后
  353. beforeDestroy() {}, //生命周期 - 销毁之前
  354. destroyed() {}, //生命周期 - 销毁完成
  355. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  356. };
  357. </script>
  358. <style lang="less" scoped>
  359. .superviseAdminDetails_box {
  360. // 任务信息
  361. .list_box {
  362. margin: 0 0 20px 0;
  363. .list_tlt {
  364. display: flex;
  365. justify-content: space-between;
  366. width: 95%;
  367. margin: 0 auto;
  368. font-size: 20px;
  369. }
  370. .list_ul {
  371. margin: 20px 0 0 0;
  372. padding: 20px 40px 20px 40px;
  373. background: #f6f8fa;
  374. .list_li {
  375. display: flex;
  376. flex-wrap: wrap;
  377. .list_div {
  378. margin: 0 0 25px 0;
  379. width: 33%;
  380. font-size: 14px;
  381. color: #333333;
  382. }
  383. }
  384. .list_sing_li {
  385. display: flex;
  386. justify-content: space-between;
  387. .list_sing_div {
  388. margin: 0 0 25px 0;
  389. width: 33%;
  390. font-size: 14px;
  391. display: flex;
  392. color: #333333;
  393. .list_div_img {
  394. width: 113px;
  395. margin: 0 15px 0 0;
  396. display: flex;
  397. img {
  398. width: 100%;
  399. height: 100%;
  400. }
  401. }
  402. }
  403. }
  404. }
  405. // 任务填报信息
  406. .list_table_ul {
  407. margin: 20px 0 0 0;
  408. padding: 20px 40px 20px 40px;
  409. // background: #f6f8fa;
  410. .list_li {
  411. display: flex;
  412. flex-wrap: wrap;
  413. .list_div {
  414. margin: 0 0 25px 0;
  415. width: 33%;
  416. font-size: 14px;
  417. color: #333333;
  418. }
  419. }
  420. }
  421. // 任务汇报
  422. .list_report_ul {
  423. margin: 20px 0 0 0;
  424. padding: 20px 40px 20px 40px;
  425. background: #f6f8fa;
  426. .list_report_li {
  427. font-size: 14px;
  428. margin: 0 0 10px 0;
  429. color: #333333;
  430. }
  431. }
  432. }
  433. /deep/.el-table th.el-table__cell {
  434. background-color: #f6f8fa;
  435. }
  436. /deep/.el-card {
  437. overflow: hidden;
  438. overflow-y: auto;
  439. }
  440. // 害虫弹框
  441. .insect_ul {
  442. .insect_list {
  443. display: flex;
  444. margin: 0 0 20px 0;
  445. div {
  446. font-size: 18px;
  447. width: 20%;
  448. text-align: right;
  449. margin: 0px 0 0 -35px;
  450. }
  451. }
  452. }
  453. }
  454. </style>