index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <template>
  2. <u-sticky bgColor="#fff" style="box-shadow: 1px 1px 4px rgb(26 26 26 / 10%)">
  3. <u-tabs :list="list" @click="tabsClick" :current="current"></u-tabs>
  4. </u-sticky>
  5. <view class="needMatter" @touchstart="fingerstart" @touchend="fingerend">
  6. <u-empty v-if="classifyData.length <= 0" text="暂无数据" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"> </u-empty>
  7. <view class="content" v-else>
  8. <u-collapse>
  9. <u-collapse-item v-for="(cl, index) in classifyData" :key="index">
  10. <template #title>
  11. <view style="display: flex; line-height: 25px">
  12. <view style="padding-top: 4px">
  13. <u--image src="/static/images/needMatter/icon1.png" width="14px" height="15px"></u--image>
  14. </view>
  15. <view style="padding: 0 10px; white-space: nowrap; font-size: 16px">
  16. <view>待办通知</view>
  17. <view>建议完成限期:</view>
  18. <view style="font-size: 14px; color: #666666">{{ cl.reformId }}</view>
  19. </view>
  20. <view style="width: 100%; text-align: center; font-size: 16px">
  21. <view
  22. :style="{
  23. color:
  24. cl.reformStatus == 1 ? '#0887F8' : cl.reformStatus == 2 ? '#23DEDC' : cl.reformStatus == 3 ? '#16BF00' : cl.reformStatus == 4 ? '#F94343' : cl.reformStatus == 5 ? '#9D40F3' : '',
  25. }"
  26. >
  27. {{
  28. cl.reformStatus == 1 ? "已接收" : cl.reformStatus == 2 ? "进行中" : cl.reformStatus == 3 ? "待办完成" : cl.reformStatus == 4 ? "审核不通过" : cl.reformStatus == 5 ? "审核通过" : ""
  29. }}
  30. </view>
  31. <view style="text-align: left">{{ cl.limitTime }}</view>
  32. <view style="font-size: 14px; color: #666666">{{ cl.sendTime }}</view>
  33. </view>
  34. </view>
  35. </template>
  36. <view class="u-collapse-content">
  37. <view class="tableType1" style="margin-bottom: 10px">
  38. <u-row>
  39. <u-col span="2">
  40. <view>序号</view>
  41. </u-col>
  42. <u-col span="5.5">
  43. <view>待办项</view>
  44. </u-col>
  45. <u-col span="4.5">
  46. <view>原因</view>
  47. </u-col>
  48. </u-row>
  49. <u-row v-for="(co, index) in cl.reformPart.data" :key="index">
  50. <u-col span="2">
  51. <view>{{ index + 1 }}</view>
  52. </u-col>
  53. <u-col span="5.5">
  54. <view>{{ co.item }}</view>
  55. </u-col>
  56. <u-col span="4.5">
  57. <view>{{ co.reason }}</view>
  58. </u-col>
  59. </u-row>
  60. </view>
  61. <view v-if="cl.reformStatus == 1">
  62. <u-steps current="0" dot>
  63. <u-steps-item style="text-align: center" title="已接收" :desc="cl.sendTime ? cl.sendTime.replace(' ', '\n') : ''"> </u-steps-item>
  64. <u-steps-item style="text-align: center" title="进行中" :desc="cl.reformTime ? cl.reformTime.replace(' ', '\n') : ''"></u-steps-item>
  65. <u-steps-item style="text-align: center" title="待审核" :desc="cl.reviewTime ? cl.reviewTime.replace(' ', '\n') : ''"></u-steps-item>
  66. </u-steps>
  67. <view style="font-size: 14px; line-height: 20px; margin-top: 10px">
  68. <u-button style="width: 60px; height: 23px" type="primary" text="去整改" shape="circle" @click="handleSubmit(cl, '去整改')"></u-button>
  69. </view>
  70. </view>
  71. <view v-if="cl.reformStatus == 2">
  72. <u-steps current="1" dot>
  73. <u-steps-item style="text-align: center" title="已接收" :desc="cl.sendTime ? cl.sendTime.replace(' ', '\n') : ''"> </u-steps-item>
  74. <u-steps-item style="text-align: center" title="进行中" :desc="cl.reformTime ? cl.reformTime.replace(' ', '\n') : ''"></u-steps-item>
  75. <u-steps-item style="text-align: center" title="待审核" :desc="cl.reviewTime ? cl.reviewTime.replace(' ', '\n') : ''"></u-steps-item>
  76. </u-steps>
  77. <view style="font-size: 14px; line-height: 20px; margin-top: 10px">
  78. <u-button style="width: 60px; height: 23px" type="primary" text="填报" shape="circle" @click="handleSubmit(cl, '填报')"></u-button>
  79. </view>
  80. </view>
  81. <view v-if="cl.reformStatus == 3">
  82. <u-steps current="1" dot>
  83. <u-steps-item style="text-align: center" title="已接收" :desc="cl.sendTime ? cl.sendTime.replace(' ', '\n') : ''"> </u-steps-item>
  84. <u-steps-item style="text-align: center" title="待办完成" :desc="cl.reformTime ? cl.reformTime.replace(' ', '\n') : ''"></u-steps-item>
  85. <u-steps-item style="text-align: center" title="待审核" :desc="cl.reviewTime ? cl.reviewTime.replace(' ', '\n') : ''"></u-steps-item>
  86. </u-steps>
  87. </view>
  88. <view v-if="cl.reformStatus == 4">
  89. <u-steps current="2" dot>
  90. <u-steps-item style="text-align: center" title="已接收" :desc="cl.sendTime ? cl.sendTime.replace(' ', '\n') : ''"> </u-steps-item>
  91. <u-steps-item style="text-align: center" title="待办完成" :desc="cl.reformTime ? cl.reformTime.replace(' ', '\n') : ''"></u-steps-item>
  92. <u-steps-item style="text-align: center" title="审核不通过" :desc="cl.reviewTime ? cl.reviewTime.replace(' ', '\n') : ''" error></u-steps-item>
  93. </u-steps>
  94. <view style="font-size: 14px; line-height: 20px; margin-top: 10px">
  95. <view>备注:{{ cl.reviewRemark ? cl.reviewRemark : "无" }}</view>
  96. </view>
  97. <view style="font-size: 14px; line-height: 20px; margin-top: 10px">
  98. <u-button style="width: 60px; height: 23px" type="primary" text="去整改" shape="circle" @click="handleSubmit(cl, '去整改')"></u-button>
  99. </view>
  100. </view>
  101. <view v-if="cl.reformStatus == 5">
  102. <u-steps current="2" dot>
  103. <u-steps-item style="text-align: center" title="已接收" :desc="cl.sendTime ? cl.sendTime.replace(' ', '\n') : ''"> </u-steps-item>
  104. <u-steps-item style="text-align: center" title="待办完成" :desc="cl.reformTime ? cl.reformTime.replace(' ', '\n') : ''"></u-steps-item>
  105. <u-steps-item style="text-align: center" title="审核通过" :desc="cl.reviewTime ? cl.reviewTime.replace(' ', '\n') : ''"></u-steps-item>
  106. </u-steps>
  107. <view style="font-size: 14px; line-height: 20px; margin-top: 10px">
  108. <view style="display: flex">
  109. <view style="white-space: nowrap">整改资料:</view>
  110. <view style="width: 100%">
  111. <view style="display: flex" v-for="(i, index) in 5" :key="index">
  112. <view>{{ cl["reformPathName" + (index + 1)] }}</view>
  113. <!-- <view style="margin: auto 0 auto auto">
  114. <u--image src="/static/images/needMatter/icon2.png" width="15px" height="15px"></u--image>
  115. </view> -->
  116. </view>
  117. </view>
  118. </view>
  119. <u-line style="margin: 5px 0" color="#E5E5E5"></u-line>
  120. <view>备注:{{ cl.reviewRemark ? cl.reviewRemark : "无" }}</view>
  121. </view>
  122. </view>
  123. </view>
  124. </u-collapse-item>
  125. </u-collapse>
  126. <view>
  127. <u-modal
  128. :show="modalShow"
  129. title="填报(火灾报警系统)"
  130. :showCancelButton="true"
  131. :showConfirmButton="true"
  132. :closeOnClickOverlay="true"
  133. @close="modalShow = false"
  134. @cancel="modalShow = false"
  135. @confirm="handleConfirm"
  136. >
  137. <view style="width: 100%">
  138. <uni-section title="图片上传:" type="line">
  139. <u-upload :fileList="fileList" name="6" @afterRead="afterRead" multiple :maxCount="5" width="80" height="80"> </u-upload>
  140. </uni-section>
  141. <uni-section title="备注:" type="line">
  142. <u--textarea v-model="textValue" placeholder="请输入内容"></u--textarea>
  143. </uni-section>
  144. </view>
  145. </u-modal>
  146. </view>
  147. </view>
  148. </view>
  149. </template>
  150. <script setup>
  151. import { onReady, onLoad, onShow, onNavigationBarButtonTap } from "@dcloudio/uni-app";
  152. import { ref, onMounted, inject, shallowRef, reactive, watchEffect, getCurrentInstance } from "vue";
  153. import useStores from "@/store/modules/user.js";
  154. import publicStore from "@/store/modules/public";
  155. import { mobileScheduleList, updateMobileReformStatus, uploadAvatar, addReformMaterial } from "@/api/business/mhxf/needMatter";
  156. const { proxy } = getCurrentInstance();
  157. const useStore = useStores();
  158. const publicStores = publicStore(); //全局公共Store
  159. const current = ref(0);
  160. const classifyData = ref([]);
  161. const modalShow = ref(false);
  162. const arrayList = ref({});
  163. const fileList = ref([]);
  164. const textValue = ref("");
  165. const list = ref([
  166. {
  167. id: 0,
  168. name: "全部",
  169. },
  170. {
  171. id: 1,
  172. name: "已接收",
  173. },
  174. {
  175. id: 2,
  176. name: "进行中",
  177. badge: {
  178. // isDot: true,
  179. // value: 5,
  180. },
  181. },
  182. {
  183. id: 3,
  184. name: "待办完成",
  185. badge: {
  186. // value: 5,
  187. },
  188. },
  189. {
  190. id: 4,
  191. name: "审核不通过",
  192. badge: {
  193. // value: 5,
  194. },
  195. },
  196. {
  197. id: 5,
  198. name: "审核通过",
  199. badge: {
  200. // value: 5,
  201. },
  202. },
  203. ]);
  204. const startData = ref({
  205. clientX: "",
  206. clientY: "",
  207. });
  208. const updDistance = ref(100);
  209. const lrDistance = ref(50);
  210. const topMed = ref("");
  211. const bottomMed = ref("");
  212. const leftMed = ref("");
  213. const rightMed = ref("");
  214. /**
  215. * @填报
  216. * @去整改
  217. */
  218. function handleSubmit(el, type) {
  219. if (type === "去整改") {
  220. proxy.$modal.loading("加载中");
  221. updateMobileReformStatus({ reformId: el.reformId }).then((res) => {
  222. if (res.status === "SUCCESS") {
  223. goSearch();
  224. proxy.$modal.closeLoading();
  225. }
  226. });
  227. } else if (type === "填报") {
  228. arrayList.value = el;
  229. fileList.value = [];
  230. textValue.value = "";
  231. modalShow.value = true;
  232. }
  233. }
  234. /**
  235. * @填报
  236. * @提交按钮点击事件
  237. */
  238. function handleConfirm() {
  239. proxy.$modal.loading("加载中");
  240. let params = {
  241. reformId: arrayList.value.reformId, //整改单编号
  242. reformPerson: useStore.$state.name, //整改提交人
  243. reformRemark: textValue.value, //整改备注
  244. reformPath1: "", //整改相关图片或文件路径1
  245. reformPath2: "", //整改相关图片或文件路径2
  246. reformPath3: "", //整改相关图片或文件路径3
  247. reformPath4: "", //整改相关图片或文件路径4
  248. reformPath5: "", //整改相关图片或文件路径5
  249. };
  250. fileList.value.forEach((el, index) => {
  251. params[`reformPath${index + 1}`] = el.url;
  252. });
  253. addReformMaterial(params).then((res) => {
  254. if (res.status === "SUCCESS") {
  255. proxy.$modal.closeLoading();
  256. proxy.$modal.msgSuccess("提交成功");
  257. modalShow.value = false;
  258. goSearch();
  259. }
  260. });
  261. }
  262. /**
  263. * @图片上传成功回调
  264. */
  265. function afterRead(event) {
  266. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  267. let lists = [].concat(event.file);
  268. let fileListLen = [`fileList${event.name}`].length;
  269. lists.map((item) => {
  270. [`fileList${event.name}`].push({
  271. ...item,
  272. status: "uploading",
  273. message: "上传中",
  274. });
  275. });
  276. for (let i = 0; i < lists.length; i++) {
  277. const result = uploadFilePromise(lists[i]);
  278. let item = [`fileList${event.name}`][fileListLen];
  279. [`fileList${event.name}`].splice(
  280. fileListLen,
  281. 1,
  282. Object.assign(item, {
  283. status: "success",
  284. message: "",
  285. url: result,
  286. })
  287. );
  288. fileListLen++;
  289. }
  290. }
  291. /**
  292. * @调用上传图片接口
  293. */
  294. function uploadFilePromise(el) {
  295. let data = { name: "file", filePath: el.url };
  296. uploadAvatar(data).then((res) => {
  297. fileList.value.push(res.data);
  298. });
  299. }
  300. /**
  301. * @当按下去的时候
  302. */
  303. function fingerstart(e) {
  304. // 记录 距离可视区域左上角 左边距 和 上边距
  305. startData.value.clientX = e.changedTouches[0].clientX;
  306. startData.value.clientY = e.changedTouches[0].clientY;
  307. }
  308. /**
  309. * @当抬起来的时候
  310. */
  311. function fingerend(e) {
  312. // 当前位置 减去 按下位置 计算 距离
  313. const subX = e.changedTouches[0].clientX - startData.value.clientX;
  314. const subY = e.changedTouches[0].clientY - startData.value.clientY;
  315. if (subY > updDistance.value || subY < -updDistance.value) {
  316. if (subY > updDistance.value) {
  317. bottomscroll(subY);
  318. } else if (subY < -updDistance.value) {
  319. topscroll(subY);
  320. }
  321. } else {
  322. if (subX > lrDistance.value) {
  323. rightscroll(subX);
  324. } else if (subX < -lrDistance.value) {
  325. leftscroll(subX);
  326. } else {
  327. console.log("无效操作");
  328. }
  329. }
  330. }
  331. /**
  332. * @上滑触发
  333. */
  334. function topscroll(dista) {
  335. topMed.value ? (topMed.value = dista) : (topMed.value = null);
  336. console.log("触发了上滑方法!");
  337. }
  338. /**
  339. * @下滑触发
  340. */
  341. function bottomscroll(dista) {
  342. bottomMed.value ? (bottomMed.value = dista) : (bottomMed.value = null);
  343. console.log("触发了下滑方法!");
  344. }
  345. /**
  346. * @右滑触发
  347. */
  348. function rightscroll(dista) {
  349. rightMed.value ? (rightMed.value = dista) : (rightMed.value = null);
  350. console.log("触发了右滑方法!");
  351. if (current.value >= 1) {
  352. current.value--;
  353. } else {
  354. current.value = list.value.length - 1;
  355. }
  356. }
  357. /**
  358. * @左滑触发
  359. */
  360. function leftscroll(dista) {
  361. leftMed.value ? (leftMed.value = dista) : (leftMed.value = null);
  362. console.log("触发了左滑方法!");
  363. if (current.value < list.value.length - 1) {
  364. current.value++;
  365. } else {
  366. current.value = 0;
  367. }
  368. }
  369. /**
  370. * @tabs点击事件
  371. */
  372. function tabsClick(e) {
  373. current.value = e.index;
  374. }
  375. /**
  376. * @列表查询
  377. */
  378. function goSearch() {
  379. if (current.value == 0) {
  380. classifySearch({
  381. companyId: "", // 单位Id
  382. reformId: "", //整改单编号
  383. reformStatus: undefined, //整改状态(1 已接收、2 整改中、3 整改完成、4 审核不通过、5 审核通过)
  384. pageNum: 1, //当前页
  385. pageSize: 20, //每页条数
  386. });
  387. } else {
  388. classifySearch({
  389. companyId: "", // 单位Id
  390. reformId: "", //整改单编号
  391. reformStatus: current.value, //整改状态(1 已接收、2 整改中、3 整改完成、4 审核不通过、5 审核通过)
  392. pageNum: 1, //当前页
  393. pageSize: 20, //每页条数
  394. });
  395. }
  396. }
  397. /**
  398. * @列表查询
  399. */
  400. async function classifySearch(params) {
  401. proxy.$modal.loading("加载中");
  402. classifyData.value = [];
  403. mobileScheduleList(params).then((res) => {
  404. if (res.status === "SUCCESS") {
  405. res.data.records.forEach((el) => {
  406. el.reformPart = JSON.parse(el.reformPart);
  407. el.limitTime = el.limitTime ? el.limitTime.split("T")[0] : "";
  408. el.reviewTime = el.reviewTime ? el.reviewTime.replace("T", " ") : "";
  409. el.reformTime = el.reformTime ? el.reformTime.replace("T", " ") : "";
  410. for (let i = 1; i <= 5; i++) {
  411. el["reformPathName" + i] =
  412. el["reformPath" + i] && el["reformPath" + i].indexOf("/") != -1 ? el["reformPath" + i].split("/")[el["reformPath" + i].split("/").length - 1] : el["reformPath" + i];
  413. }
  414. classifyData.value.push(el);
  415. });
  416. proxy.$modal.closeLoading();
  417. }
  418. });
  419. }
  420. watchEffect(() => {
  421. goSearch();
  422. });
  423. // 自定义导航事件
  424. onNavigationBarButtonTap((e) => {
  425. if (e.float == "right") {
  426. uni.navigateTo({
  427. url: "/pages/business/mhxf/xunJian/collect/components/collectRecord",
  428. });
  429. } else {
  430. }
  431. });
  432. onLoad((options) => {});
  433. onShow(() => {
  434. //调用系统主题颜色
  435. proxy.$settingStore.systemThemeColor([1]);
  436. });
  437. onReady(() => {});
  438. onMounted(() => {});
  439. </script>
  440. <style lang="scss">
  441. .uni-swipe {
  442. overflow: visible;
  443. }
  444. .is-selected {
  445. color: #1989fa;
  446. }
  447. .needMatter {
  448. height: calc(100vh - 88px);
  449. .content {
  450. // padding: 10px;
  451. .u-collapse {
  452. .u-collapse-item {
  453. background: #ffffff;
  454. margin-bottom: 10px;
  455. }
  456. }
  457. }
  458. .uni-section {
  459. :deep(.uni-section-header) {
  460. padding: 12px 0px;
  461. }
  462. }
  463. }
  464. </style>