|
@@ -1,136 +1,139 @@
|
|
|
const _Http = getApp().globalData.http;
|
|
|
-
|
|
|
Page({
|
|
|
-
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
+ sat_submiteditmodelid: 0,
|
|
|
detailsData: {}, //详情数据
|
|
|
- butText: "", //底部按钮文本
|
|
|
+
|
|
|
+ startRecord: false,
|
|
|
+ submiteditData: {}, //新建明细
|
|
|
content: "", //提交内容
|
|
|
- loading: false, //按钮加载状态
|
|
|
- recordL: {}, //记录
|
|
|
isCommit: false, //是否提交
|
|
|
+
|
|
|
+
|
|
|
+ CheckTheRecord: false, //查看记录
|
|
|
+ recordL: {}, //记录详情
|
|
|
+
|
|
|
+ done: false, //!是否还可提交明细
|
|
|
+
|
|
|
+ loading: false, //按钮加载状态
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad(options) {
|
|
|
- let detailsData = JSON.parse(options.item);
|
|
|
this.setData({
|
|
|
- detailsData,
|
|
|
- butText: options.type
|
|
|
+ sat_submiteditmodelid: options.id
|
|
|
})
|
|
|
- /* 详情计数 */
|
|
|
- if (options.type == '开始提报') {
|
|
|
- this.select_submitdetailed();
|
|
|
- } else if (options.type == '保存') {
|
|
|
- _Http.basic({
|
|
|
- "classname": "saletool.submitedit.submitedit",
|
|
|
- "method": "insertorupdate",
|
|
|
- "content": {
|
|
|
- "sat_submiteditmodelid": detailsData.sat_submiteditmodelid,
|
|
|
- "content": "",
|
|
|
- "sat_submiteditid": "0"
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- console.log("新增", res)
|
|
|
- })
|
|
|
- } else if (options.type == 'false') {
|
|
|
- /* 查看记录 */
|
|
|
- this.setData({
|
|
|
- recordL: JSON.parse(options.record)
|
|
|
- })
|
|
|
- }
|
|
|
- console.log("是否一事一报", detailsData.oneToOne)
|
|
|
- },
|
|
|
- /* 查询详情 */
|
|
|
- select_submitdetailed() {
|
|
|
+
|
|
|
+ //查询详情
|
|
|
_Http.basic({
|
|
|
"classname": "saletool.submitedit.submitedit",
|
|
|
"method": "select_submitdetailed",
|
|
|
"content": {
|
|
|
- "sat_submiteditmodelid": this.data.detailsData.sat_submiteditmodelid
|
|
|
+ "sat_submiteditmodelid": options.id
|
|
|
}
|
|
|
}).then(res => {
|
|
|
- console.log("提报详情", res)
|
|
|
+ console.log()
|
|
|
+ let submitedit = res.data[0].submitedit,
|
|
|
+ list = [];
|
|
|
+ for (let i = 0; i < submitedit.length; i++) {
|
|
|
+ (submitedit[i].status == '未提报') ? this.delete_submitdetailed(submitedit[i].sat_submiteditid): list.push(submitedit[i]);
|
|
|
+ };
|
|
|
+ res.data[0].submitedit = list;
|
|
|
this.setData({
|
|
|
- 'detailsData.submitedit': res.data[0].submitedit
|
|
|
+ detailsData: res.data[0],
|
|
|
+ done: res.data[0].submitedit.length == 1 && options.oneToOne
|
|
|
})
|
|
|
});
|
|
|
},
|
|
|
- /* 文本域输入 */
|
|
|
- textareaInput(e) {
|
|
|
- this.setData({
|
|
|
- content: e.detail.value.trim()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /* 创建明显 */
|
|
|
+ establish() {
|
|
|
+ _Http.basic({
|
|
|
+ "classname": "saletool.submitedit.submitedit",
|
|
|
+ "method": "insertorupdate",
|
|
|
+ "content": {
|
|
|
+ "sat_submiteditmodelid": this.data.sat_submiteditmodelid,
|
|
|
+ "content": "",
|
|
|
+ "sat_submiteditid": 0
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log("新增", res)
|
|
|
+ this.setData({
|
|
|
+ submiteditData: res.data[0]
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
/* 去详情 */
|
|
|
toDetails() {
|
|
|
- if (this.data.butText == '开始提报') {
|
|
|
- wx.navigateTo({
|
|
|
- url: './details?type=保存&item=' + JSON.stringify(this.data.detailsData),
|
|
|
- })
|
|
|
- } else {
|
|
|
- if (this.data.isCommit) return wx.showToast({
|
|
|
- title: '请勿重新提交',
|
|
|
- icon: "none"
|
|
|
- })
|
|
|
- if (!this.data.content) return wx.showToast({
|
|
|
- title: '您还未输入提报内容',
|
|
|
- icon: "none"
|
|
|
+ if (this.data.isCommit) return wx.showToast({
|
|
|
+ title: '请勿重新提交',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ if (!this.data.content) return wx.showToast({
|
|
|
+ title: '您还未输入提报内容',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ if (this.data.loading) return wx.showToast({
|
|
|
+ title: '正在提交中,请勿重新提交',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ loading: true
|
|
|
+ })
|
|
|
+ _Http.basic({
|
|
|
+ "classname": "saletool.submitedit.submitedit",
|
|
|
+ "method": "sub_submitdetailed",
|
|
|
+ "content": {
|
|
|
+ "sat_submiteditmodelid": this.data.detailsData.sat_submiteditmodelid,
|
|
|
+ "content": this.data.content,
|
|
|
+ "sat_submiteditid": 0
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ this.setData({
|
|
|
+ loading: false
|
|
|
})
|
|
|
- if (this.data.loading) return wx.showToast({
|
|
|
- title: '正在提交中,请勿重新提交',
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.data,
|
|
|
icon: "none"
|
|
|
- })
|
|
|
+ });
|
|
|
this.setData({
|
|
|
- loading: true
|
|
|
+ isCommit: true
|
|
|
})
|
|
|
- _Http.basic({
|
|
|
- "classname": "saletool.submitedit.submitedit",
|
|
|
- "method": "sub_submitdetailed",
|
|
|
- "content": {
|
|
|
- "sat_submiteditmodelid": this.data.detailsData.sat_submiteditmodelid,
|
|
|
- "content": this.data.content,
|
|
|
- "sat_submiteditid": 0
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- this.setData({
|
|
|
- loading: false
|
|
|
- })
|
|
|
- if (res.msg != '成功') return wx.showToast({
|
|
|
- title: res.data,
|
|
|
- icon: "none"
|
|
|
- });
|
|
|
- this.setData({
|
|
|
- isCommit: true
|
|
|
+ let pages = getCurrentPages();
|
|
|
+ let prevPage = pages[pages.length - 2];
|
|
|
+ if (prevPage.data.butText == '开始提报') prevPage.select_submitdetailed();
|
|
|
+ wx.showToast({
|
|
|
+ title: '提交成功',
|
|
|
+ icon: "success"
|
|
|
+ });
|
|
|
+ setTimeout(() => {
|
|
|
+ wx.navigateBack({
|
|
|
+ delta: 0,
|
|
|
})
|
|
|
- let pages = getCurrentPages();
|
|
|
- let prevPage = pages[pages.length - 2];
|
|
|
- if (prevPage.data.butText == '开始提报') prevPage.select_submitdetailed();
|
|
|
- wx.showToast({
|
|
|
- title: '提交成功',
|
|
|
- icon: "success"
|
|
|
- });
|
|
|
- setTimeout(() => {
|
|
|
- wx.navigateBack({
|
|
|
- delta: 0,
|
|
|
- })
|
|
|
- }, 300)
|
|
|
- })
|
|
|
- }
|
|
|
+ }, 300)
|
|
|
+ })
|
|
|
},
|
|
|
/* 查看提报记录 */
|
|
|
seeHistory(e) {
|
|
|
const {
|
|
|
item
|
|
|
} = e.currentTarget.dataset;
|
|
|
- wx.navigateTo({
|
|
|
- url: `./details?type=false&item=${JSON.stringify(this.data.detailsData)}&record=${JSON.stringify(item)}`,
|
|
|
+ this.setData({
|
|
|
+ recordL: item
|
|
|
})
|
|
|
+
|
|
|
+ /* wx.navigateTo({
|
|
|
+ url: `./details?type=false&item=${JSON.stringify(this.data.detailsData)}&record=${JSON.stringify(item)}`,
|
|
|
+ }) */
|
|
|
},
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
@@ -152,6 +155,12 @@ Page({
|
|
|
|
|
|
},
|
|
|
|
|
|
+ /* 文本域输入 */
|
|
|
+ textareaInput(e) {
|
|
|
+ this.setData({
|
|
|
+ content: e.detail.value
|
|
|
+ })
|
|
|
+ },
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
@@ -159,6 +168,19 @@ Page({
|
|
|
|
|
|
},
|
|
|
|
|
|
+ /* 删除未提报数据 */
|
|
|
+ delete_submitdetailed(id) {
|
|
|
+ _Http.basic({
|
|
|
+ "classname": "saletool.submitedit.submitedit",
|
|
|
+ "method": "delete_submitdetailed",
|
|
|
+ "content": {
|
|
|
+ "sat_submiteditid": id
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ if (res.data != "成功") return this.delete_submitdetailed(id);
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|