list.vue 7.6 KB

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