list.vue 8.2 KB

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