| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- const _Http = getApp().globalData.http;
- Component({
- properties: {
- idname: {
- type: [String, Number]
- }
- },
- options: {
- addGlobalClass: true
- },
- lifetimes: {
- attached: function () {
- getApp().globalData.Language.getLanguagePackage(this)
- }
- },
- data: {
- sa_workorderid: 0,
- content: {
- nocache: true,
- pageNumber: 1,
- pageSize: 10,
- pageTotal: 1,
- total: null,
- where: {
- condition: ""
- }
- },
- list: [],
- showSearch: false,
- focus: false,
- condition: "",
- tabColorS: {
- 有效: {
- bgColor: "#E1EAFE",
- color: "#3874F6"
- },
- 无效: {
- bgColor: "#FDE4E3",
- color: "#ED4949"
- },
- },
- },
- methods: {
- getList(id, init = false) {
- console.log("getList", id)
- let content = {
- ...this.data.content,
- sa_workorderid: id || this.data.sa_workorderid,
- sa_serviceorderid: id || this.data.sa_workorderid,
- };
- content.where.sa_workorderid = content.sa_workorderid
- if (init) {
- content.pageNumber = 1
- content.pageTotal = 1
- }
- _Http.basic({
- "id": this.data.idname,
- content
- }).then(res => {
- console.log("服务确认单", res)
- if (res.code != '1') return wx.showToast({
- title: res.data,
- icon: "none"
- });
- this.setData({
- "content.pageNumber": res.pageNumber + 1,
- "content.pageTotal": res.pageTotal,
- "content.total": res.total,
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
- sa_workorderid: content.sa_workorderid
- })
- })
- },
- toSearch() {
- if (this.data.showSearch && this.data.content.where.condition) {
- this.data.content.where.condition = '';
- this.getList("", true);
- } else if (this.data.condition) {
- this.data.content.where.condition = this.data.condition;
- this.setData({
- condition: this.data.condition
- })
- this.getList("", true);
- }
- this.setData({
- showSearch: !this.data.showSearch
- })
- setTimeout(() => {
- this.setData({
- focus: this.data.showSearch
- })
- }, 300)
- },
- onChange({
- detail
- }) {
- this.data.condition = detail;
- },
- onSearch({
- detail
- }) {
- this.data.content.where.condition = detail;
- this.getList("", true)
- },
- }
- })
|