123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <template>
- <view class="container">
- <cu-custom id="custom"
- bgImage="https://yostest175549.obs.cn-east-2.myhuaweicloud.com:443/202306151686796745663B52544232.png"
- :isBack="true">
- <block slot="backText">返回</block>
- <block slot="content">
- 工单
- </block>
- </cu-custom>
- <My_search ref="My_search" @onFilter="onFilter" @startSearch="startSearch" dateRange />
- <My_listbox ref="List" @getlist="getlist" :empty='empty'>
- <work-order-list :list1="list" />
- <view style="height: 30px;" />
- </My_listbox>
- </view>
- </template>
- <script>
- import workOrderList from "../../pages/index/modules/workorderList.vue"
- export default {
- components: { workOrderList },
- name: "workOrder",
- data() {
- return {
- empty: true,
- "content": {
- "pageNumber": 1,
- "pageSize": 20,
- "pageTotal": 1,
- "where": {
- "condition": "",
- "begindate": "",
- "enddate": ""
- }
- },
- list: []
- }
- },
- onLoad(options) {
- if (options.date) {
- this.$refs.My_search.viewDateCycle(1)
- } else {
- this.getlist(true);
- }
- this.$Http.updateWorkorder = this.updete.bind(this)
- },
- onUnload() {
- delete this.$Http.updateWorkorder;
- },
- methods: {
- getlist(init = false) {
- let content = this.content;
- if (init) content.pageNumber = 1;
- if (content.pageNumber > content.pageTotal) return;
- this.$Http.basic({
- "id": "20231007095502",
- content
- }).then(res => {
- console.log("获取工单列表", res)
- if (this.cutoff(res.msg)) return;
- this.$refs.List.RefreshToComplete();
- this.$refs.List.setHeight();
- this.$refs.My_search.onFinish()
- this.empty = !res.data.length;
- content.pageNumber = res.pageNumber + 1;
- content.pageTotal = res.pageTotal;
- let list = res.data.map(v => {
- switch (v.sourcetable) {
- case "sa_patrolplan":
- v.source = "巡检:" + (v.planno || ' --')
- break;
- case "w_event_log":
- v.source = "告警:" + (v.eventname || ' --')
- break;
- default:
- v.source = "现场"
- break;
- }
- v.users = v.teamRows.map(u => u.name).join(",")
- return v
- })
- this.list = res.pageNumber == 1 ? list : this.list.concat(list)
- this.content = content;
- })
- },
- updete() {
- let content = JSON.parse(JSON.stringify(this.content));
- content.pageSize = content.pageNumber - 1 * content.pageSize;
- content.pageNumber = 1;
- this.$Http.basic({
- "id": "20231007095502",
- content
- }).then(res => {
- console.log("更新工单列表", res)
- if (this.cutoff(res.msg)) return;
- this.$refs.List.RefreshToComplete();
- this.$refs.List.setHeight();
- this.$refs.My_search.onFinish()
- this.empty = !res.data.length;
- let list = res.data.map(v => {
- switch (v.sourcetable) {
- case "sa_patrolplan":
- v.source = "巡检:" + (v.planno || ' --')
- break;
- case "w_event_log":
- v.source = "告警:" + (v.eventname || ' --')
- break;
- default:
- v.source = "现场"
- break;
- }
- v.users = v.teamRows.map(u => u.name).join(",")
- return v
- })
- this.list = list;
- })
- },
- startSearch(e) {
- this.content.where.condition = e;
- this.getlist(true)
- },
- onFilter(e) {
- let where = this.content.where,
- condition = where.condition;
- where = e;
- where.condition = condition;
- this.content.where = where;
- this.getlist(true)
- }
- }
- }
- </script>
- <style lang="scss" scoped></style>
|