|
@@ -0,0 +1,171 @@
|
|
|
|
|
+const _Http = getApp().globalData.http;
|
|
|
|
|
+
|
|
|
|
|
+Page({
|
|
|
|
|
+ data: {
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ showAll: false,
|
|
|
|
|
+ disabled: true,
|
|
|
|
|
+ "sa_serviceorderid": "0",
|
|
|
|
|
+ form: []
|
|
|
|
|
+ },
|
|
|
|
|
+ async onLoad(options) {
|
|
|
|
|
+ console.log("options", options)
|
|
|
|
|
+ /* _Http.basic({
|
|
|
|
|
+ id: "20230208140203",
|
|
|
|
|
+ content: {}
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ console.log(res)
|
|
|
|
|
+ }) */
|
|
|
|
|
+ let form = [];
|
|
|
|
|
+ // 服务类型
|
|
|
|
|
+ await _Http.basic({
|
|
|
|
|
+ "id": 20230206155803,
|
|
|
|
|
+ "content": {},
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ if (res.code == 1) {
|
|
|
|
|
+ form.push({
|
|
|
|
|
+ label: "工单模版",
|
|
|
|
|
+ error: false,
|
|
|
|
|
+ errMsg: "",
|
|
|
|
|
+ hint: "",
|
|
|
|
|
+ type: "radio",
|
|
|
|
|
+ value: res.data.length ? res.data[0].sa_workorder_templateid : "",
|
|
|
|
|
+ interrupt: true,
|
|
|
|
|
+ radioList: res.data.map(v => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ id: v.sa_workorder_templateid,
|
|
|
|
|
+ ...v
|
|
|
|
|
+ }
|
|
|
|
|
+ }),
|
|
|
|
|
+ valueName: "sa_workorder_templateid", //绑定的字段名称
|
|
|
|
|
+ required: true, //必填
|
|
|
|
|
+ checking: `base`,
|
|
|
|
|
+ })
|
|
|
|
|
+ form.push({
|
|
|
|
|
+ label: "工单类型",
|
|
|
|
|
+ error: false,
|
|
|
|
|
+ errMsg: "",
|
|
|
|
|
+ hint: "",
|
|
|
|
|
+ type: "radio",
|
|
|
|
|
+ value: res.data.length ? res.data[0].type : "",
|
|
|
|
|
+ interrupt: true,
|
|
|
|
|
+ radioList: res.data.map(v => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...v,
|
|
|
|
|
+ id: v.type,
|
|
|
|
|
+ name: v.type
|
|
|
|
|
+ }
|
|
|
|
|
+ }),
|
|
|
|
|
+ valueName: "type", //绑定的字段名称
|
|
|
|
|
+ required: true, //必填
|
|
|
|
|
+ checking: `base`,
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ await _Http.basic({
|
|
|
|
|
+ "id": "20230213143003",
|
|
|
|
|
+ "version": 1,
|
|
|
|
|
+ "content": {
|
|
|
|
|
+ "where": {
|
|
|
|
|
+ "condition": ""
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ if (res.code == 1) {
|
|
|
|
|
+ form.push({
|
|
|
|
|
+ label: "负责人",
|
|
|
|
|
+ error: false,
|
|
|
|
|
+ errMsg: "",
|
|
|
|
|
+ hint: "",
|
|
|
|
|
+ type: "radio",
|
|
|
|
|
+ value: "",
|
|
|
|
|
+ interrupt: true,
|
|
|
|
|
+ radioList: res.data.map(v => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...v,
|
|
|
|
|
+ id: v.userid,
|
|
|
|
|
+ }
|
|
|
|
|
+ }),
|
|
|
|
|
+ valueName: "userid", //绑定的字段名称
|
|
|
|
|
+ required: true, //必填
|
|
|
|
|
+ checking: `base`,
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ form,
|
|
|
|
|
+ sa_serviceorderid: options.id
|
|
|
|
|
+ })
|
|
|
|
|
+ getApp().globalData.Language.getLanguagePackage(this, '转工单');
|
|
|
|
|
+ },
|
|
|
|
|
+ submit() {
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ loading: true
|
|
|
|
|
+ })
|
|
|
|
|
+ let content = this.selectComponent("#Form").submit();
|
|
|
|
|
+ content.projectlearders = [content.userid]
|
|
|
|
|
+ content.sa_serviceorderid = this.data.sa_serviceorderid;
|
|
|
|
|
+ delete content.userid;
|
|
|
|
|
+ _Http.basic({
|
|
|
|
|
+ "id": "20230207091003",
|
|
|
|
|
+ content
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ loading: false
|
|
|
|
|
+ })
|
|
|
|
|
+ console.log("转工单", res)
|
|
|
|
|
+ if (res.code == 1) {
|
|
|
|
|
+ getCurrentPages().find(v => v.__route__ == 'E-service/serviceBillList/detail').getDetail();
|
|
|
|
|
+ wx.navigateBack({
|
|
|
|
|
+ success() {
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: getApp().globalData.Language.getMapText('操作成功'),
|
|
|
|
|
+ icon: "none",
|
|
|
|
|
+ mask: true
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: res.msg,
|
|
|
|
|
+ icon: "none",
|
|
|
|
|
+ mask: true
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ interrupt({
|
|
|
|
|
+ detail
|
|
|
|
|
+ }) {
|
|
|
|
|
+ if (detail.data.valueName == "sa_workorder_templateid") {
|
|
|
|
|
+ detail.form[detail.form.findIndex(v => v.valueName == 'sa_workorder_templateid')] = detail.data;
|
|
|
|
|
+ detail.form[detail.form.findIndex(v => v.valueName == 'type')].value = detail.data.radioList.find(v => v.id == detail.data.value).type;
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ form: detail.form
|
|
|
|
|
+ })
|
|
|
|
|
+ } else if (detail.data.valueName == "type") {
|
|
|
|
|
+ detail.form[detail.form.findIndex(v => v.valueName == 'type')] = detail.data;
|
|
|
|
|
+ detail.form[detail.form.findIndex(v => v.valueName == 'sa_workorder_templateid')].value = detail.data.radioList.find(v => v.id == detail.data.value).sa_workorder_templateid;
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ form: detail.form
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ this.selectComponent("#Form").confirm()
|
|
|
|
|
+ },
|
|
|
|
|
+ // 是否显示全部
|
|
|
|
|
+ onChange({
|
|
|
|
|
+ detail
|
|
|
|
|
+ }) {
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ showAll: detail
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ /* 表单必填项是否完成 */
|
|
|
|
|
+ onConfirm({
|
|
|
|
|
+ detail
|
|
|
|
|
+ }) {
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ disabled: detail
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+})
|