|
@@ -0,0 +1,101 @@
|
|
|
|
|
+const _Http = getApp().globalData.http;
|
|
|
|
|
+Component({
|
|
|
|
|
+ options: {
|
|
|
|
|
+ addGlobalClass: true
|
|
|
|
|
+ },
|
|
|
|
|
+ properties: {
|
|
|
|
|
+ sa_projectid: String,
|
|
|
|
|
+ sa_projstagetempid: String,
|
|
|
|
|
+ changeCallBack: Function
|
|
|
|
|
+ },
|
|
|
|
|
+ data: {
|
|
|
|
|
+ active: null, //现在阶段
|
|
|
|
|
+ viewIndex: 0, //查看阶段
|
|
|
|
|
+ range: [],
|
|
|
|
|
+ content: {
|
|
|
|
|
+ total: null
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ getList(change = false) {
|
|
|
|
|
+ _Http.basic({
|
|
|
|
|
+ "id": 20221024102402,
|
|
|
|
|
+ "content": {
|
|
|
|
|
+ "nacache": true,
|
|
|
|
|
+ "sa_projectid": this.data.sa_projectid,
|
|
|
|
|
+ "sa_projstagetempid": this.data.sa_projstagetempid
|
|
|
|
|
+ }
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
|
|
+ title: res.data,
|
|
|
|
|
+ icon: "none"
|
|
|
|
|
+ });
|
|
|
|
|
+ const active = res.data.findIndex(v => v.active == 1);
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ list: res.data,
|
|
|
|
|
+ active,
|
|
|
|
|
+ viewIndex: active,
|
|
|
|
|
+ range: res.data.map(v => v.stagename),
|
|
|
|
|
+ "content.total": res.total
|
|
|
|
|
+ });
|
|
|
|
|
+ this.viewData(change);
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ /* 设置阶段 */
|
|
|
|
|
+ bindPickerChange(e) {
|
|
|
|
|
+ let {
|
|
|
|
|
+ value
|
|
|
|
|
+ } = e.detail, {
|
|
|
|
|
+ stagename,
|
|
|
|
|
+ sa_projectid,
|
|
|
|
|
+ sa_projstagetempid,
|
|
|
|
|
+ sa_project_stageid
|
|
|
|
|
+ } = this.data.list[value],
|
|
|
|
|
+ that = this;
|
|
|
|
|
+ if (value == this.data.active) return wx.showToast({
|
|
|
|
|
+ title: `当前已在${stagename}阶段`,
|
|
|
|
|
+ icon: "none"
|
|
|
|
|
+ })
|
|
|
|
|
+ wx.showModal({
|
|
|
|
|
+ title: '提示',
|
|
|
|
|
+ content: `是否进入${stagename} 阶段?`,
|
|
|
|
|
+ complete: ({
|
|
|
|
|
+ confirm
|
|
|
|
|
+ }) => {
|
|
|
|
|
+ if (confirm) _Http.basic({
|
|
|
|
|
+ "id": 20221024160102,
|
|
|
|
|
+ "content": {
|
|
|
|
|
+ sa_projectid,
|
|
|
|
|
+ sa_projstagetempid,
|
|
|
|
|
+ sa_project_stageid
|
|
|
|
|
+ }
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ if (res.msg == '成功') that.getList(true);
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: res.msg == '成功' ? `已进入${stagename} 阶段` : res.data,
|
|
|
|
|
+ icon: "none"
|
|
|
|
|
+ });
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ /* 切换查看 */
|
|
|
|
|
+ changeViewItem(e) {
|
|
|
|
|
+ const {
|
|
|
|
|
+ index
|
|
|
|
|
+ } = e.currentTarget.dataset;
|
|
|
|
|
+ // if (this.data.viewIndex == index) return;
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ viewIndex: index
|
|
|
|
|
+ });
|
|
|
|
|
+ this.viewData(true);
|
|
|
|
|
+ },
|
|
|
|
|
+ viewData(change = false) {
|
|
|
|
|
+ this.triggerEvent("changeCallBack", {
|
|
|
|
|
+ list: this.data.list[this.data.viewIndex].work,
|
|
|
|
|
+ isFollow: this.data.viewIndex === this.data.active,
|
|
|
|
|
+ change
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ }
|
|
|
|
|
+})
|