| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- const _Http = getApp().globalData.http;
- Page({
- data: {
- loading: false,
- record: "",
- sa_service_improvementid: 0,
- sa_service_improvement_planid: 0,
- sa_service_improvement_recordid: 0
- },
- onLoad(options) {
- getApp().globalData.Language.getLanguagePackage(this, '改善记录');
- this.setData({
- sa_service_improvementid: options.sa_service_improvementid || 0,
- sa_service_improvement_planid: options.sa_service_improvement_planid || 0,
- sa_service_improvement_recordid: options.sa_service_improvement_recordid || 0,
- record: options.record || ""
- })
- if (_Http.basic.attinfos.length) this.selectComponent("#Yl_Files").handleFiles(_Http.basic.attinfos);
- },
- changeState({
- detail
- }) {
- this.setData({
- loading: detail
- })
- },
- /* 绑定媒体 */
- insertImgEdit({
- detail
- }) {
- this.handleFileLink(detail)
- },
- handleFileLink(attachmentids = []) {
- if (attachmentids.length) _Http.basic({
- "classname": "system.attachment.Attachment",
- "method": "createFileLink",
- "content": {
- ownertable: "sa_service_improvement_record",
- ownerid: this.data.sa_service_improvement_recordid || 0,
- usetype: 'default',
- attachmentids
- }
- }).then(res => {
- console.log('跟进记录绑定附件', res)
- if (res.code != '1') return wx.showToast({
- title: res.msg,
- icon: "none"
- })
- this.selectComponent("#Yl_Files").handleFiles(res.data)
- })
- },
- areaInput(e) {
- this.setData({
- record: e.detail.value
- })
- },
- submit() {
- let record = this.data.record;
- if (record == '') return wx.showToast({
- title: getApp().globalData.Language.getMapText("请填写改善记录"),
- icon: "none"
- })
- this.setData({
- loading: true
- })
- _Http.basic({
- "content": {
- "sa_service_improvementid": this.data.sa_service_improvementid,
- "sa_service_improvement_planid": this.data.sa_service_improvement_planid,
- "sa_service_improvement_recordid": this.data.sa_service_improvement_recordid,
- record
- },
- "id": 2026020210270102,
- }).then(res => {
- this.setData({
- loading: false
- })
- getApp().globalData.Language.showToast(res.code == '1' ? "保存成功" : res.msg)
- if (res.code == 1) {
- this.setData({
- sa_service_improvement_recordid: res.data.sa_service_improvement_recordid
- })
- this.handleFileLink(this.selectComponent("#Yl_Files").getFiles().attachmentids)
- setTimeout(() => {
- _Http.basic.updateExe && _Http.basic.updateExe('', true)
- wx.navigateBack()
- }, 300);
- }
- })
- },
- onUnload() {
- // 返回时刷新列表
- let pages = getCurrentPages();
- if (pages.length > 1) {
- let page = pages[pages.length - 2];
- if (page && page.getList) {
- page.getList('', true);
- }
- }
- }
- })
|