|
|
@@ -1,5 +1,5 @@
|
|
|
-const _Http = getApp().globalData.http,
|
|
|
- getTime = require("../../utils/getTime");
|
|
|
+let _Http = getApp().globalData.http,
|
|
|
+ count = null;
|
|
|
|
|
|
Page({
|
|
|
data: {
|
|
|
@@ -13,7 +13,9 @@ Page({
|
|
|
placeholder: "项目名称",
|
|
|
valueName: "projectname",
|
|
|
checking: "base",
|
|
|
- required: true
|
|
|
+ required: true,
|
|
|
+ interrupt: true,
|
|
|
+ permit: true, //无视errMsg 运行提交
|
|
|
}, {
|
|
|
label: "项目类型",
|
|
|
error: false,
|
|
|
@@ -248,59 +250,223 @@ Page({
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+ async interrupt(e) {
|
|
|
+ let {
|
|
|
+ data,
|
|
|
+ form,
|
|
|
+ temporary
|
|
|
+ } = e.detail;
|
|
|
+ if (data.label == "项目名称") {
|
|
|
+ if (data.value) {
|
|
|
+ const result = await this.selectComponent("#projectname").queryList(data.value);
|
|
|
+ if (result) {
|
|
|
+ data.errMsg = '疑似重复';
|
|
|
+ form[0] = data;
|
|
|
+ this.setData({
|
|
|
+ form
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ if (data.errMsg) {
|
|
|
+ data.errMsg = '';
|
|
|
+ form[0] = data;
|
|
|
+ this.setData({
|
|
|
+ form
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (data.errMsg) {
|
|
|
+ data.errMsg = '';
|
|
|
+ form[0] = data;
|
|
|
+ this.setData({
|
|
|
+ form
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
setHY() {
|
|
|
let required = ["预计签约时间", "项目等级", "详细地址", "项目规模"],
|
|
|
remove = ["项目预算(万元)", "总投资额(万元)", "造价(万元)"];
|
|
|
this.setData({
|
|
|
form: this.data.form.filter(v => !remove.includes(v.label)).map(v => {
|
|
|
if (required.includes(v.label)) v.required = true;
|
|
|
+ if (v.valueName == 'projectname') v.interrupt = false;
|
|
|
return v
|
|
|
- })
|
|
|
+ }),
|
|
|
+ siteid: wx.getStorageSync('userMsg').siteid,
|
|
|
})
|
|
|
},
|
|
|
- submit() {
|
|
|
- let content = {
|
|
|
- ...this.data.content,
|
|
|
- ...this.selectComponent("#Form").submit()
|
|
|
- };
|
|
|
- content.sa_brandid = content.sa_brandid ? content.sa_brandid[1][0] : 0;
|
|
|
- content.city = content.region[1] || "";
|
|
|
- content.county = content.region[2] || "";
|
|
|
- content.province = content.region[0] || "";
|
|
|
|
|
|
- if (content.scale.length != 0) {
|
|
|
- if (content.scale == 0) {
|
|
|
+ /* 查询是否重复 */
|
|
|
+ async queryRepetition(e) {
|
|
|
+ let data = this.selectComponent("#Form").query();
|
|
|
+ /* if (data.projectname == '') return wx.showToast({
|
|
|
+ title: `您还未填写项目名称`,
|
|
|
+ icon: "none"
|
|
|
+ }); */
|
|
|
+ data.province = data.region[0] || "";
|
|
|
+ data.city = data.region[1] || "";
|
|
|
+ data.county = data.region[2] || "";
|
|
|
+ let res = await this.handleQueryRepetition({
|
|
|
+ sa_projectid: this.data.sa_projectid,
|
|
|
+ ...data
|
|
|
+ });
|
|
|
+ console.log("查询重复", res)
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ countDown: 6
|
|
|
+ });
|
|
|
+ count = setInterval(() => {
|
|
|
+ let countDown = this.data.countDown;
|
|
|
+ if (countDown == 0) {
|
|
|
+ clearInterval(count);
|
|
|
this.setData({
|
|
|
- loading: false
|
|
|
- })
|
|
|
- wx.showToast({
|
|
|
- title: '项目规模不可为0',
|
|
|
- icon: "none"
|
|
|
+ countDown: ""
|
|
|
})
|
|
|
- return;
|
|
|
- };
|
|
|
-
|
|
|
- if (content.unitname == "") {
|
|
|
+ } else {
|
|
|
+ countDown--;
|
|
|
this.setData({
|
|
|
- loading: false
|
|
|
+ countDown
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
+ if (res.total == 0) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '未查询到疑似重复的项目信息',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ this.data.repetitionShow = false;
|
|
|
+ } else {
|
|
|
+ wx.showToast({
|
|
|
+ title: `查询到${res.total}条疑似重复项目信息`,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ repetitionShow: true,
|
|
|
+ repetitionList: res.data
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ repClose() {
|
|
|
+ if (this.data.isSubmit) {
|
|
|
+ let that = this;
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `是否继续创建项目`,
|
|
|
+ complete: (res) => {
|
|
|
+ if (res.confirm) that.handleSubmit(true);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ repetitionShow: false,
|
|
|
+ isSubmit: false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 处理查重 */
|
|
|
+ handleQueryRepetition(content) {
|
|
|
+ return _Http.basic({
|
|
|
+ "id": 20221208184202,
|
|
|
+ content
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async submit() {
|
|
|
+ let data = this.selectComponent("#Form").submit(),
|
|
|
+ that = this;
|
|
|
+ data.province = data.region[0] || "";
|
|
|
+ data.city = data.region[1] || "";
|
|
|
+ data.county = data.region[2] || "";
|
|
|
+ let query = await this.handleQueryRepetition({
|
|
|
+ sa_projectid: this.data.sa_projectid,
|
|
|
+ ...data
|
|
|
+ });
|
|
|
+ if (query.total != 0) {
|
|
|
+ if (this.data.siteid == 'HY') {
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '该项目疑似重复,是否确认创建项目',
|
|
|
+ complete: (res) => {
|
|
|
+ if (res.confirm) that.handleSubmit(true);
|
|
|
+ }
|
|
|
})
|
|
|
+ } else {
|
|
|
wx.showToast({
|
|
|
- title: '还未选择项目规模单位',
|
|
|
+ title: `查询到${query.total}条疑似重复项目信息`,
|
|
|
icon: "none"
|
|
|
})
|
|
|
- return;
|
|
|
+ this.setData({
|
|
|
+ repetitionShow: true,
|
|
|
+ repetitionList: query.data,
|
|
|
+ isSubmit: true
|
|
|
+ })
|
|
|
}
|
|
|
+ } else {
|
|
|
+ this.handleSubmit();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleSubmit(tag = false) {
|
|
|
+ this.setData({
|
|
|
+ loading: true
|
|
|
+ })
|
|
|
+ let data = {
|
|
|
+ ...this.data.content,
|
|
|
+ ...this.selectComponent("#Form").submit()
|
|
|
+ };
|
|
|
+ data.province = data.region[0] || "";
|
|
|
+ data.city = data.region[1] || "";
|
|
|
+ data.county = data.region[2] || "";
|
|
|
+ data.tradefields = [data.tradefields];
|
|
|
+ data.sa_brandid = data.sa_brandid ? data.sa_brandid[1][0] : 0;
|
|
|
+
|
|
|
+ if (data.scale.length != 0 && data.scale == 0) {
|
|
|
+ this.setData({
|
|
|
+ loading: false
|
|
|
+ })
|
|
|
+ wx.showToast({
|
|
|
+ title: '项目规模不可为0',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (data.unitname == "") {
|
|
|
+ this.setData({
|
|
|
+ loading: false
|
|
|
+ })
|
|
|
+ wx.showToast({
|
|
|
+ title: '还未选择项目规模单位',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ return;
|
|
|
}
|
|
|
+
|
|
|
+ delete(data.region);
|
|
|
_Http.basic({
|
|
|
- "id": "20221124154902",
|
|
|
- content
|
|
|
+ "id": 20221124154902,
|
|
|
+ content: data
|
|
|
}).then(res => {
|
|
|
+ this.setData({
|
|
|
+ loading: false
|
|
|
+ })
|
|
|
console.log("转化", res)
|
|
|
wx.showToast({
|
|
|
title: res.msg != '成功' ? res.msg : '转化成功',
|
|
|
icon: "none"
|
|
|
})
|
|
|
if (res.msg != '成功') return;
|
|
|
+ //绑定疑似重复标签
|
|
|
+ if (tag) _Http.basic({
|
|
|
+ "id": 20220929090901,
|
|
|
+ "content": {
|
|
|
+ "ownertable": "sa_project",
|
|
|
+ "ownerid": res.data.sa_projectid,
|
|
|
+ "datatag": ["疑似重复"]
|
|
|
+ }
|
|
|
+ })
|
|
|
setTimeout(() => {
|
|
|
wx.navigateBack()
|
|
|
getCurrentPages().forEach(item => {
|