list.vue 8.0 KB

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