index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <template>
  2. <view>
  3. <uni-nav-bar fixed="true" statusBar="true" title="工作台" right-icon="scan"
  4. @clickRight="HandlScanCode"></uni-nav-bar>
  5. <view v-if="internalManagementList.length > 0">
  6. <CellTip title="协同办公"></CellTip>
  7. <view class="nav">
  8. <view class="nav-content">
  9. <view class="nav-item" v-for="(item, index) in internalManagementList" @click="toNav(item.path)">
  10. <span :class="'iconfont ' + item.icon"></span>
  11. <i class="badge" v-if="item.badge">{{ item.badge }}</i>
  12. <label>{{ item.name }}</label>
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. <view v-if="productionList.length > 0">
  18. <CellTip title="生产管理"></CellTip>
  19. <view class="nav">
  20. <view class="nav-content">
  21. <view class="nav-item" v-for="item in productionList" :key="item.link_url"
  22. @click="toNav(item.path)">
  23. <span :class="'iconfont ' + item.icon"></span>
  24. <label>{{ item.title }}</label>
  25. <label>{{ item.num }}</label>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <!-- <view>
  31. <CellTip title="生产执行"></CellTip>
  32. <view class="nav">
  33. <view class="nav-content">
  34. <view
  35. class="nav-item"
  36. v-for="(item, index) in executeList"
  37. @click="toNav(item.link_url)"
  38. >
  39. <span :class="item.class"></span>
  40. <label>{{ item.title }}</label>
  41. <label>{{ item.num }}</label>
  42. </view>
  43. </view>
  44. </view>
  45. </view> -->
  46. <view v-if="operationsList.length > 0">
  47. <CellTip title="运维管理"></CellTip>
  48. <view class="nav">
  49. <view class="nav-content">
  50. <view class="nav-item" v-for="(item, index) in operationsList" @click="toNav(item.path)">
  51. <span :class="'iconfont ' + item.icon"></span>
  52. <i class="badge" v-if="item.badge">{{ item.badge }}</i>
  53. <label>{{ item.name }}</label>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view v-if="serviceList.length > 0">
  59. <CellTip title="售后服务管理"></CellTip>
  60. <view class="nav">
  61. <view class="nav-content">
  62. <view class="nav-item" v-for="(item, index) in serviceList" @click="toNav(item.path)">
  63. <span :class="'iconfont ' + item.icon"></span>
  64. <i class="badge" v-if="item.badge">{{ item.badge }}</i>
  65. <label>{{ item.name }}</label>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. <view v-if="warehousingList.length > 0">
  71. <CellTip title="仓储管理"></CellTip>
  72. <view class="nav">
  73. <view class="nav-content">
  74. <view class="nav-item" v-for="(item, index) in warehousingList" @click="toNav(item.path)">
  75. <span :class="'iconfont ' + item.icon"></span>
  76. <label>{{ item.title }}</label>
  77. <!-- <label>{{ item.num }}</label> -->
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. <view v-if="dispatchList.length > 0">
  83. <CellTip title="运输管理"></CellTip>
  84. <view class="nav">
  85. <view class="nav-content">
  86. <view class="nav-item" v-for="(item, index) in dispatchList" @click="toNav(item.path)">
  87. <span :class="'iconfont ' + item.icon"></span>
  88. <i class="badge" v-if="item.badge">{{ item.badge }}</i>
  89. <label>{{ item.name }}</label>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. <view v-if="saleManageList.length > 0">
  95. <CellTip title="营销管理"></CellTip>
  96. <view class="nav">
  97. <view class="nav-content">
  98. <view class="nav-item" v-for="(item, index) in saleManageList" @click="toNav(item.path)">
  99. <span :class="'iconfont ' + item.icon"></span>
  100. <i class="badge" v-if="item.badge">{{ item.badge }}</i>
  101. <label>{{ item.name }}</label>
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. <view v-if="purchaseManageList.length > 0">
  107. <CellTip title="采购管理"></CellTip>
  108. <view class="nav">
  109. <view class="nav-content">
  110. <view class="nav-item" v-for="(item, index) in purchaseManageList" @click="toNav(item.path)">
  111. <span :class="'iconfont ' + item.icon"></span>
  112. <i class="badge" v-if="item.badge">{{ item.badge }}</i>
  113. <label>{{ item.name }}</label>
  114. </view>
  115. </view>
  116. </view>
  117. </view>
  118. <view v-if="pcsList.length > 0">
  119. <CellTip title="生产管控"></CellTip>
  120. <view class="nav">
  121. <view class="nav-content">
  122. <view class="nav-item" v-for="(item, index) in pcsList" @click="toNav(item.path)">
  123. <span :class="'iconfont ' + item.icon"></span>
  124. <i class="badge" v-if="item.badge">{{ item.badge }}</i>
  125. <label>{{ item.name }}</label>
  126. </view>
  127. </view>
  128. </view>
  129. </view>
  130. <view v-if="qmsList.length > 0">
  131. <CellTip title="质量管理"></CellTip>
  132. <view class="nav">
  133. <view class="nav-content">
  134. <view class="nav-item" v-for="(item, index) in qmsList" @click="toNav(item.path)">
  135. <span :class="'iconfont ' + item.icon"></span>
  136. <i class="badge" v-if="item.badge">{{ item.badge }}</i>
  137. <label>{{ item.name }}</label>
  138. </view>
  139. </view>
  140. </view>
  141. </view>
  142. <view v-if="traceabilityList.length > 0">
  143. <CellTip title="溯源管理"></CellTip>
  144. <view class="nav">
  145. <view class="nav-content">
  146. <view class="nav-item" v-for="(item, index) in traceabilityList" @click="toNav(item.path)">
  147. <span :class="'iconfont ' + item.icon"></span>
  148. <i class="badge" v-if="item.badge">{{ item.badge }}</i>
  149. <label>{{ item.name }}</label>
  150. </view>
  151. </view>
  152. </view>
  153. </view>
  154. <!-- <view>
  155. <CellTip title="生产类"></CellTip>
  156. <view class="nav">
  157. <view class="nav-content">
  158. <view
  159. class="nav-item"
  160. v-for="(item, index) in productionList"
  161. @click="toNav(item.link_url)"
  162. >
  163. <span :class="item.class"></span>
  164. <label>{{ item.title }}</label>
  165. <label>{{ item.num }}</label>
  166. </view>
  167. </view>
  168. </view>
  169. </view> -->
  170. </view>
  171. </template>
  172. <script>
  173. import CellTip from "@/components/CellTip.vue";
  174. import {
  175. statistics,
  176. qualityTodoByPda
  177. } from "@/api/myTicket";
  178. export default {
  179. components: {
  180. CellTip,
  181. },
  182. data() {
  183. return {
  184. timer: null,
  185. src1: "https://cdn.uviewui.com/uview/album/1.jpg",
  186. workOrder: {}, // 工单统计数据
  187. qmsList: [],
  188. //生产类
  189. productionList: [],
  190. // executeList: [
  191. // {
  192. // class: "iconfont icon-gongdanguanli",
  193. // title: "成型",
  194. // link_url: "/pages/production/execute/extrusion/index",
  195. // // "num": 1
  196. // },
  197. // {
  198. // class: "iconfont icon-gongdanguanli",
  199. // title: "自然干燥",
  200. // link_url: "/pages/production/execute/drying/index",
  201. // // "num": 1
  202. // },
  203. // {
  204. // class: "iconfont icon-gongdanguanli",
  205. // title: "升温干燥",
  206. // link_url: "/pages/production/execute/heating/index",
  207. // // "num": 1
  208. // },
  209. // {
  210. // class: "iconfont icon-gongdanguanli",
  211. // title: "半加定长",
  212. // link_url: "/pages/production/execute/halfAdded/index",
  213. // // "num": 1
  214. // },
  215. // // {
  216. // // class: "iconfont icon-gongdanguanli",
  217. // // title: "领料",
  218. // // link_url: "/pages/production/execute/picking/index",
  219. // // // "num": 1
  220. // // },
  221. // ],
  222. //仓储管理
  223. warehousingList: [],
  224. //运维类
  225. operationsList: [],
  226. dispatchList: [],
  227. internalManagementList: [],
  228. treeList: [],
  229. saleManageList: [],
  230. // 售后服务
  231. serviceList: [],
  232. // 溯源管理
  233. traceabilityList: [],
  234. // 采购管理
  235. purchaseManageList: [],
  236. pcsList: []
  237. };
  238. },
  239. created() {
  240. this.getTree();
  241. },
  242. onShow() {
  243. this.getStatistics();
  244. },
  245. onHide() {
  246. clearTimeout(this.timer);
  247. },
  248. onUnload() {
  249. clearTimeout(this.timer);
  250. },
  251. methods: {
  252. getStatistics() {
  253. // 获取工单统计数
  254. statistics()
  255. .then((res) => {
  256. this.workOrder = res;
  257. // console.log("this.operationsList---", this.operationsList);
  258. // console.log("res", res);
  259. this.operationsList.forEach((item) => {
  260. if (item.name == "保养工单") item.badge = res.maintenanceNum;
  261. if (item.name == "巡点检工单") item.badge = res.patrolInspection;
  262. if (item.name == "维修工单") item.badge = res.repairsNum;
  263. });
  264. })
  265. .finally(() => {
  266. this.timer = setTimeout(() => {
  267. this.getStatistics();
  268. }, 12000);
  269. });
  270. },
  271. getTree() {
  272. let _list = uni.getStorageSync("treeList");
  273. let list = JSON.parse(_list) || [];
  274. console.log("-----------list--------------");
  275. console.log(list);
  276. if (list[0] && list[0].children.length > 0) {
  277. // console.log(list[0].children, "list[0].children ----");
  278. list[0].children.forEach((f) => {
  279. if (f.path == "productionManage") {
  280. this.productionList = f.children;
  281. } else if (f.path == "operationsList") {
  282. statistics().then((res) => {
  283. this.workOrder = res;
  284. // console.log("this.operationsList---", this.operationsList);
  285. // console.log("res", res);
  286. f.children.forEach((item) => {
  287. if (item.name == "保养工单") item.badge = res.maintenanceNum;
  288. if (item.name == "巡点检工单")
  289. item.badge = res.patrolInspection;
  290. if (item.name == "维修工单") item.badge = res.repairsNum;
  291. });
  292. this.operationsList = f.children;
  293. });
  294. } else if (f.path == "warehouseManagement") {
  295. this.warehousingList = f.children;
  296. } else if (f.path == "saleManageList") {
  297. this.saleManageList = f.children;
  298. this.saleManageList.forEach((item) => {
  299. item.name = item.name.replace("员工", "");
  300. item.name = item.name.replace("管理员", "");
  301. });
  302. } else if (f.path == "internalManagement") {
  303. // console.log(f, "f");
  304. this.internalManagementList = f.children;
  305. } else if (f.path == "serviceList") {
  306. this.serviceList = f.children;
  307. } else if (f.path == "traceability") {
  308. this.traceabilityList = f.children;
  309. } else if (f.path == "purchasingManage") {
  310. this.purchaseManageList = f.children;
  311. } else if (f.path == "qualityManage") {
  312. qualityTodoByPda().then((res) => {
  313. // console.log("this.operationsList---", this.operationsList);
  314. // console.log("res", res);
  315. f.children.forEach((item) => {
  316. if (item.name == "质检工单") item.badge = res.workOrderNum;
  317. if (item.name == "我的质检工单") item.badge = res.myWorkOrderNum;
  318. if (item.name == "我的任务单") item.badge = res.myTaskMonadNum;
  319. if (item.name == "我的受托单") item.badge = res.myRequestEntrustNum;
  320. });
  321. this.qmsList = f.children;
  322. });
  323. } else if (f.path == "productionControlManagement") {
  324. this.pcsList = f.children;
  325. } else if (f.path == 'dispatchManage') {
  326. this.dispatchList = f.children;
  327. }
  328. });
  329. }
  330. },
  331. toNav(url) {
  332. // console.log(url);
  333. uni.navigateTo({
  334. url: url,
  335. });
  336. },
  337. HandlScanCode() {
  338. let _this = this;
  339. uni.scanCode({
  340. success: function(res) {
  341. console.log(res);
  342. // 获取扫描结果中的URL
  343. const scanResult = res.result;
  344. // 检查URL是否包含traceability
  345. if (scanResult && scanResult.includes("/traceability")) {
  346. // 从扫描结果中提取id参数
  347. let id = "";
  348. if (scanResult.includes("id=")) {
  349. // 分割URL获取id参数值
  350. const idPart = scanResult.split("id=")[1];
  351. // 如果id后面还有其他参数,只取到第一个&之前的部分
  352. if (idPart.includes("&")) {
  353. id = idPart.split("&")[0];
  354. } else {
  355. id = idPart;
  356. }
  357. }
  358. // 跳转到溯源页面并传递id
  359. uni.navigateTo({
  360. url: `/pages/traceability/scanCode/index?id=${id}`,
  361. });
  362. return;
  363. }
  364. _this.scantoRouter(scanResult);
  365. },
  366. });
  367. },
  368. scantoRouter(result) {
  369. uni.navigateTo({
  370. url: `/pages/pda/workOrder/extrusionMolding/index?id=${result}`,
  371. });
  372. },
  373. },
  374. };
  375. </script>
  376. <style lang="scss" scoped>
  377. @import "index.scss";
  378. </style>