list.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="手动集抄" @clickLeft="back">
  4. </uni-nav-bar>
  5. <view class="top-wrapper">
  6. <uni-section>
  7. <uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="keyWord"
  8. placeholder="工单单号,计划单号,记录规则名称">
  9. </uni-easyinput>
  10. </uni-section>
  11. <button class="search_btn" @click="doSearch">搜索</button>
  12. </view>
  13. <div style="height: 100rpx; width: 475rpx"></div>
  14. <view class="wrapper">
  15. <u-list @scrolltolower="scrolltolower" class="listContent">
  16. <view v-for="(item, index) in tableList" :key="index" style="position: relative">
  17. <myCard :item="item" :index="index + 1" :btnList="btnList" :columns="columns" :title="item.code"
  18. :status="statusMap[item.status]" @goDetail="goDetail(item, 'view')"
  19. @edit="goDetail(item, 'edit')">
  20. </myCard>
  21. </view>
  22. <view style="width: 100%; height: 40rpx"></view>
  23. <view style="margin-top: 20vh" v-if="tableList.length == 0">
  24. <u-empty iconSize="150" textSize="32" text="暂无数据"> </u-empty>
  25. </view>
  26. </u-list>
  27. </view>
  28. <u-toast ref="uToast"></u-toast>
  29. <workOrderReport ref="workOrderReportRef" :pageName="pageName" @refresh="successInit"></workOrderReport>
  30. <view class="add" @click="add">
  31. <u-icon name="plus" color="#fff"></u-icon>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import dictMixns from "@/mixins/dictMixins";
  37. import myCard from "./components/myCard.vue";
  38. import workOrderReport from "./components/workOrderReport.vue";
  39. import {
  40. page
  41. } from "@/api/recordRules/index";
  42. export default {
  43. components: {
  44. myCard,
  45. workOrderReport,
  46. },
  47. mixins: [dictMixns],
  48. props: {
  49. pageName: {
  50. default: "",
  51. },
  52. },
  53. data() {
  54. return {
  55. statusMap: {
  56. 0: "未报工",
  57. 1: "执行中",
  58. 2: "已执行",
  59. },
  60. planTypeList: {
  61. productionRecords: 2,
  62. steamInjectionInspectionRecord: 3,
  63. solidWasteRecord: 4,
  64. qualityTestRecords: 5,
  65. boilerOperationRecord: 6,
  66. },
  67. columns: [
  68. [{
  69. prop: "substanceName",
  70. label: "表计设备名称",
  71. className: "perce100",
  72. }, ],
  73. [{
  74. prop: "currentMeterReadingTime",
  75. label: "本期抄表时间",
  76. className: "perce100",
  77. }, ],
  78. [{
  79. prop: "currentMeterReadingNum",
  80. label: "本期抄表数",
  81. className: "perce50",
  82. },
  83. {
  84. prop: "unit",
  85. label: "单位",
  86. className: "perce50",
  87. },
  88. ],
  89. [{
  90. prop: "meterReadingName",
  91. label: "抄表人",
  92. className: "perce100",
  93. }, ],
  94. [{
  95. prop: "meterEquipmentNumber",
  96. label: "表计设备编号",
  97. className: "perce100",
  98. }, ],
  99. [{
  100. prop: "meterType",
  101. label: "表计类型",
  102. className: "perce100",
  103. formatter: (row) => {
  104. return this.getDictValue("表计类型", _row.meterType);
  105. },
  106. }, ],
  107. [{
  108. prop: "correlationSubstanceName",
  109. label: "关联设备",
  110. className: "perce100",
  111. }, ],
  112. [{
  113. prop: "areaName",
  114. label: "区域",
  115. className: "perce100",
  116. }, ],
  117. [{
  118. prop: "energyClassificationName",
  119. label: "用能分类",
  120. className: "perce100",
  121. }, ],
  122. [{
  123. prop: "energyTypeName",
  124. label: "能源名称",
  125. className: "perce100",
  126. }, ],
  127. [{
  128. prop: "approvalStatus",
  129. label: "审核状态",
  130. className: "perce50",
  131. formatter: (_row, _column, cellValue) => {
  132. return reviewStatus[_row.approvalStatus] || "-";
  133. },
  134. },
  135. {
  136. prop: "publishStatus",
  137. label: "发布状态",
  138. className: "perce50",
  139. formatter: (_row, _column, cellValue) => {
  140. return _row.publishStatus == 1 ?
  141. "已发布" :
  142. _row.publishStatus == 2 ?
  143. "已撤销" :
  144. "未发布";
  145. },
  146. },
  147. ],
  148. [{
  149. label: "操作:",
  150. prop: "action",
  151. type: "action",
  152. className: "perce100",
  153. }, ],
  154. ].filter((item) => !item.isNone),
  155. tableList: [],
  156. page: 1,
  157. size: 10,
  158. isEnd: false,
  159. keyWord: "",
  160. userInfo: {},
  161. };
  162. },
  163. computed: {
  164. btnList() {
  165. return [{
  166. name: "编辑",
  167. apiName: "edit",
  168. btnType: "primary",
  169. judge: [{
  170. fn: (item) => {
  171. return (
  172. [0, 3].includes(item.approvalStatus) &&
  173. item.publishStatus != 1
  174. );
  175. },
  176. }, ],
  177. },
  178. {
  179. name: "提交",
  180. apiName: "handleSubmit",
  181. btnType: "primary",
  182. judge: [{
  183. fn: (item) => {
  184. return (
  185. this.approval == 1 && [0, 3].includes(row.approvalStatus)
  186. );
  187. },
  188. }, ],
  189. },
  190. {
  191. name: "删除",
  192. apiName: "handleDelete",
  193. btnType: "danger",
  194. judge: [{
  195. fn: (item) => {
  196. return (
  197. row.publishStatus != 1 && [0].includes(row.approvalStatus)
  198. );
  199. },
  200. }, ],
  201. },
  202. {
  203. name: "发布",
  204. apiName: "handlePublish",
  205. btnType: "primary",
  206. judge: [{
  207. fn: (item) => {
  208. return row.publishStatus == 0 && this.approval != 1;
  209. },
  210. }, ],
  211. },
  212. ];
  213. },
  214. },
  215. created() {
  216. this.requestDict("表计类型");
  217. },
  218. onLoad() {},
  219. methods: {
  220. goDetail(item, type) {
  221. this.$refs.workOrderReportRef.open(item, type);
  222. },
  223. successInit() {
  224. uni.showLoading({
  225. title: "加载中",
  226. });
  227. let data = {
  228. pageNum: 1,
  229. size: this.tableList.length,
  230. keyword: this.keyWord,
  231. areaId: "",
  232. categoryLevelId: "",
  233. meterReadingMethod: 1,
  234. currentLoginUserId: this.userInfo.userId,
  235. };
  236. page(data)
  237. .then((res) => {
  238. this.tableList = res.list;
  239. })
  240. .then(() => {
  241. uni.hideLoading();
  242. });
  243. },
  244. doSearch() {
  245. this.isEnd = false;
  246. this.page = 1;
  247. this.getList();
  248. },
  249. //获取列表信息
  250. getList() {
  251. this.userInfo = uni.getStorageSync("userInfo");
  252. if (this.isEnd || !this.userInfo.userId) {
  253. return;
  254. }
  255. uni.showLoading({
  256. title: "加载中",
  257. });
  258. let data = {
  259. pageNum: this.page,
  260. size: this.size,
  261. keyword: this.keyWord,
  262. areaId: "",
  263. categoryLevelId: "",
  264. meterReadingMethod: 1,
  265. currentLoginUserId: this.userInfo.userId,
  266. };
  267. page(data)
  268. .then((res) => {
  269. if (this.page === 1) {
  270. this.tableList = res.list;
  271. } else {
  272. this.tableList.push(...res.list);
  273. }
  274. this.page += 1;
  275. this.isEnd = this.tableList.length >= res.count;
  276. })
  277. .then(() => {
  278. uni.hideLoading();
  279. });
  280. },
  281. scrolltolower() {
  282. if (this.isEnd) {
  283. return;
  284. }
  285. this.getList();
  286. },
  287. },
  288. };
  289. </script>
  290. <style lang="scss" scoped>
  291. .mainBox {
  292. background-color: #f3f8fb;
  293. }
  294. // .wrapper{
  295. // }
  296. .top-wrapper {
  297. background-color: #fff;
  298. display: flex;
  299. width: 750rpx;
  300. height: 88rpx;
  301. padding: 16rpx 32rpx;
  302. align-items: center;
  303. // gap: 16rpx;
  304. position: absolute;
  305. z-index: 999;
  306. // top: 44px;
  307. // // #ifdef APP-PLUS
  308. // top: 140rpx;
  309. // // #endif
  310. /deep/.uni-section {
  311. margin-top: 0px;
  312. }
  313. /deep/.uni-section-header {
  314. padding: 0px;
  315. }
  316. .search_btn {
  317. width: 120rpx;
  318. height: 70rpx;
  319. line-height: 70rpx;
  320. padding: 0 24rpx;
  321. background: $theme-color;
  322. font-size: 32rpx;
  323. color: #fff;
  324. margin: 0;
  325. margin-left: 26rpx;
  326. }
  327. .menu_icon {
  328. width: 44rpx;
  329. height: 44rpx;
  330. margin-left: 14rpx;
  331. }
  332. }
  333. </style>