list.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" :title="getTitle" @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>
  31. </template>
  32. <script>
  33. import dictMixns from "@/mixins/dictMixins";
  34. import myCard from "./components/myCard.vue";
  35. import workOrderReport from "./components/workOrderReport.vue";
  36. import {
  37. producetaskrulerecordQueryRecordWorkOrderPage
  38. } from "@/api/recordRules/index";
  39. export default {
  40. components: {
  41. myCard,
  42. workOrderReport,
  43. },
  44. mixins: [dictMixns],
  45. props: {
  46. pageName: {
  47. default: "",
  48. },
  49. },
  50. data() {
  51. return {
  52. statusMap: {
  53. 0: "未报工",
  54. 1: "执行中",
  55. 2: "已执行",
  56. },
  57. planTypeList: {
  58. productionRecords: 2,
  59. steamInjectionInspectionRecord: 3,
  60. solidWasteRecord: 4,
  61. qualityTestRecords: 5,
  62. boilerOperationRecord: 6,
  63. },
  64. btnList: [{
  65. name: "报工",
  66. apiName: "edit",
  67. btnType: "primary",
  68. judge: [{
  69. key: "status",
  70. value: [1],
  71. }, ],
  72. }, ],
  73. columns: [
  74. [{
  75. label: "计划单号:",
  76. prop: "planCode",
  77. className: "perce100",
  78. }, ],
  79. [{
  80. label: "记录规则名称:",
  81. prop: "ruleName",
  82. className: "perce100",
  83. }, ],
  84. [{
  85. label: "场站名称:",
  86. className: "perce100",
  87. prop: "productLineName",
  88. }, ],
  89. [{
  90. className: "perce100",
  91. label: "班组:",
  92. prop: "teamName",
  93. }, ],
  94. [{
  95. label: "工单生成时间:",
  96. className: "perce100",
  97. prop: "createTime",
  98. }, ],
  99. [{
  100. label: "检查时间:",
  101. className: "perce100",
  102. prop: "checkStartTime",
  103. }, ],
  104. [{
  105. label: "报工时间:",
  106. className: "perce100",
  107. prop: "checkFinishTime",
  108. }, ],
  109. [{
  110. label: "执行人:",
  111. className: "perce100",
  112. prop: "executeUsers",
  113. formatter: (row) => {
  114. if ((row.type == 2 && row.status == 1) || row.type != 1) {
  115. return row.executeUsers&&row.executeUsers.map((i) => i.userName).join(',');
  116. }
  117. },
  118. }, ],
  119. [{
  120. label: "甲方检查人:",
  121. prop: "contactName",
  122. className: "perce100",
  123. isNone: this.pageName != "steamInjectionInspectionRecord",
  124. },
  125. {
  126. label: "处理方:",
  127. prop: "supplierName",
  128. className: "perce100",
  129. isNone: this.pageName != "solidWasteRecord",
  130. },
  131. {
  132. label: "联合站检查人:",
  133. prop: "contactName",
  134. className: "perce100",
  135. isNone: this.pageName != "qualityTestRecords",
  136. },
  137. ],
  138. [{
  139. label: "操作:",
  140. prop: "action",
  141. type: "action",
  142. className: "perce100",
  143. }, ],
  144. ].filter((item) => !item.isNone),
  145. tableList: [],
  146. page: 1,
  147. size: 10,
  148. isEnd: false,
  149. keyWord: "",
  150. userInfo: {},
  151. };
  152. },
  153. computed: {
  154. getTitle() {
  155. return this.pageName == "productionRecords" ?
  156. "生产记录" :
  157. this.pageName == "steamInjectionInspectionRecord" ?
  158. "注汽检查记录" :
  159. this.pageName == "solidWasteRecord" ?
  160. "固废记录" :
  161. this.pageName == "qualityTestRecords" ?
  162. "质量检查检测记录" :
  163. "锅炉运行记录";
  164. },
  165. },
  166. created() {
  167. this.requestDict("记录规则类型");
  168. },
  169. onLoad() {},
  170. methods: {
  171. goDetail(item, type) {
  172. console.log(item, "item");
  173. this.$refs.workOrderReportRef.open(item, type);
  174. },
  175. successInit() {
  176. uni.showLoading({
  177. title: "加载中",
  178. });
  179. let data = {
  180. pageNum: 1,
  181. size: this.tableList.length,
  182. keyword: this.keyWord,
  183. planType: this.planTypeList[this.pageName],
  184. currentLoginUserId: this.userInfo.userId,
  185. };
  186. producetaskrulerecordQueryRecordWorkOrderPage(data)
  187. .then((res) => {
  188. this.tableList = res.list;
  189. })
  190. .then(() => {
  191. uni.hideLoading();
  192. });
  193. },
  194. doSearch() {
  195. this.isEnd = false;
  196. this.page = 1;
  197. this.getList();
  198. },
  199. //获取列表信息
  200. getList() {
  201. this.userInfo = uni.getStorageSync("userInfo");
  202. if (this.isEnd || !this.userInfo.userId) {
  203. return;
  204. }
  205. uni.showLoading({
  206. title: "加载中",
  207. });
  208. let data = {
  209. pageNum: this.page,
  210. size: this.size,
  211. keyword: this.keyWord,
  212. planType: this.planTypeList[this.pageName],
  213. currentLoginUserId: this.userInfo.userId,
  214. };
  215. producetaskrulerecordQueryRecordWorkOrderPage(data)
  216. .then((res) => {
  217. if (this.page === 1) {
  218. this.tableList = res.list;
  219. } else {
  220. this.tableList.push(...res.list);
  221. }
  222. this.page += 1;
  223. this.isEnd = this.tableList.length >= res.count;
  224. })
  225. .then(() => {
  226. uni.hideLoading();
  227. });
  228. },
  229. scrolltolower() {
  230. if (this.isEnd) {
  231. return;
  232. }
  233. this.getList();
  234. },
  235. },
  236. };
  237. </script>
  238. <style lang="scss" scoped>
  239. .mainBox {
  240. background-color: #f3f8fb;
  241. }
  242. // .wrapper{
  243. // }
  244. .top-wrapper {
  245. background-color: #fff;
  246. display: flex;
  247. width: 750rpx;
  248. height: 88rpx;
  249. padding: 16rpx 32rpx;
  250. align-items: center;
  251. // gap: 16rpx;
  252. position: absolute;
  253. z-index: 999;
  254. // top: 44px;
  255. // // #ifdef APP-PLUS
  256. // top: 140rpx;
  257. // // #endif
  258. /deep/.uni-section {
  259. margin-top: 0px;
  260. }
  261. /deep/.uni-section-header {
  262. padding: 0px;
  263. }
  264. .search_btn {
  265. width: 120rpx;
  266. height: 70rpx;
  267. line-height: 70rpx;
  268. padding: 0 24rpx;
  269. background: $theme-color;
  270. font-size: 32rpx;
  271. color: #fff;
  272. margin: 0;
  273. margin-left: 26rpx;
  274. }
  275. .menu_icon {
  276. width: 44rpx;
  277. height: 44rpx;
  278. margin-left: 14rpx;
  279. }
  280. }
  281. </style>