Przeglądaj źródła

竞争对手添加优势劣势

xiaohaizhao 1 rok temu
rodzic
commit
86bba33500

+ 2 - 1
app.json

@@ -169,7 +169,8 @@
                 "expenseBreakdown/index",
                 "expenseBreakdown/insertion",
                 "expenseBreakdown/edit",
-                "contract/modules/contacts/quickly"
+                "contract/modules/contacts/quickly",
+                "opponent/modules/aAD/insert"
             ]
         }
     ],

+ 3 - 3
packageA/opponent/add.js

@@ -68,11 +68,11 @@ Page({
     onLoad(options) {
         if (options.data) {
             let data = JSON.parse(options.data);
-            console.log("data",data)
+            let form = this.data.form.filter(v => !["advantage", "inferiority"].includes(v.valueName))
             this.setData({
                 disabled: false,
-                form: this.data.form.map(v => {
-                    v.value = data[v.valueName] ||''
+                form: form.map(v => {
+                    v.value = data[v.valueName] || ''
                     return v
                 }),
                 "content.sa_competitorid": data.sa_competitorid,

+ 6 - 0
packageA/opponent/detail.js

@@ -16,6 +16,9 @@ Page({
         let tabsList = [{
             label: "详细信息",
             icon: "icon-tabxiangxixinxi1"
+        }, {
+            label: "优势劣势",
+            icon: "icon-youshilieshi"
         }, {
             label: "参与项目",
             icon: "icon-tabxiangmu"
@@ -217,6 +220,9 @@ Page({
             case "任务":
                 model = "#Work"
                 break;
+            case "优势劣势":
+                model = "#AAD"
+                break;
             case "参与项目":
                 model = "#Project"
                 break;

+ 1 - 0
packageA/opponent/detail.json

@@ -2,6 +2,7 @@
     "usingComponents": {
         "Preview": "../setclient/modules/preview/index",
         "Trace": "../setclient/modules/trace/index",
+        "AAD": "./modules/aAD/index",
         "Record": "/packageA/public/record/index",
         "Files": "/packageA/public/files/index",
         "Project": "./modules/project/index",

+ 1 - 0
packageA/opponent/detail.wxml

@@ -21,6 +21,7 @@
 <!-- 功能 -->
 <Yl_FunTabs list='{{tabsList}}' active='{{tabsActive}}' bind:onChenge="tabsChange">
     <Preview slot='详细信息' list1='{{list1}}' list2='{{list2}}' />
+    <AAD slot='优势劣势' id='AAD' />
     <Project slot='参与项目' id='Project' />
     <Address slot='地址管理' id='Address' type='竞争对手' disabled="{{per.query(options,'address')||isShowTabbar}}" />
     <Contacts slot='联系人' id='Contacts' disabled="{{per.query(options,'contact')||isShowTabbar}}" path='/packageA/setclient/modules/contacts/add/index' />

+ 192 - 0
packageA/opponent/modules/aAD/index.js

@@ -0,0 +1,192 @@
+const _Http = getApp().globalData.http;
+Component({
+    options: {
+        addGlobalClass: true
+    },
+    properties: {
+        disabled: {
+            type: Boolean,
+            value: true
+        }
+    },
+    lifetimes: {
+        attached: function () {
+            getApp().globalData.Language.getLanguagePackage(this)
+        },
+    },
+    data: {
+        content: {
+            nocache: true,
+            pageNumber: 1,
+            pageSize: 10,
+            pageTotal: 1,
+            total: null,
+            where: {
+                condition: ""
+            }
+        },
+        list: [],
+        showSearch: false,
+        focus: false,
+        condition: "",
+        sa_competitor_advid: 0
+    },
+    methods: {
+        toSearch() {
+            if (this.data.showSearch && this.data.content.where.condition) {
+                this.data.content.where.condition = '';
+                this.getList("", true);
+            } else if (this.data.condition) {
+                this.data.content.where.condition = this.data.condition;
+                this.setData({
+                    condition: this.data.condition
+                })
+                this.getList("", true);
+            }
+            this.setData({
+                showSearch: !this.data.showSearch
+            })
+            setTimeout(() => {
+                this.setData({
+                    focus: this.data.showSearch
+                })
+            }, 300)
+        },
+        onChange({
+            detail
+        }) {
+            this.data.condition = detail;
+        },
+        onSearch({
+            detail
+        }) {
+            this.data.content.where.condition = detail;
+            this.getList("", true)
+        },
+        getList(id, init = false) {
+            let content = this.data.content
+            content.sa_competitorid = id || content.sa_competitorid;
+            if (init) {
+                content.pageNumber = 1
+                content.pageTotal = 1
+            }
+            _Http.basic({
+                "id": 2025031809222102,
+                content
+            }).then(res => {
+                console.log("优劣势列表", res)
+                if (res.code != '1') return wx.showToast({
+                    title: res.data,
+                    icon: "none"
+                });
+                content.pageNumber = res.pageNumber + 1
+                content.pageTotal = res.pageTotal
+                content.total = res.total
+                let defaultItem = res.data.find(v => v.isdefault)
+                if (defaultItem) this.setData({
+                    sa_competitor_advid: defaultItem.sa_competitor_advid
+                })
+                this.setData({
+                    list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
+                    content
+                })
+            })
+        },
+        /* 去添加 */
+        toAdd() {
+            wx.navigateTo({
+                url: `/packageA/opponent/modules/aAD/insert?id=` + this.data.content.sa_competitorid,
+            })
+        },
+        handleDelete(item) {
+            let that = this;
+            return new Promise((resolve) => {
+                wx.showModal({
+                    title: getApp().globalData.Language.getMapText('提示'),
+                    content: getApp().globalData.Language.getMapText('是否确定删除该跟进动态'),
+                    complete: ({
+                        confirm
+                    }) => {
+                        if (confirm) {
+                            _Http.basic({
+                                "id": 20220930121701,
+                                "content": {
+                                    "sys_datafollowupid": item.sys_datafollowupid,
+                                    "ownertable": that.data.ownertable,
+                                    "ownerid": that.data.ownerid,
+                                    deletereason: ""
+                                }
+                            }).then(res => {
+                                console.log("删除", res);
+                                getApp().globalData.Language.showToast(res.code != 1 ? res.msg : "删除成功")
+                                resolve(res.code)
+                                if (res.msg != '成功') return;
+                                that.setData({
+                                    list: that.data.list.filter(v => v.sys_datafollowupid != item.sys_datafollowupid),
+                                    'content.total': that.data.content.total - 1
+                                })
+                            })
+                        } else {
+                            resolve(0)
+                        }
+                    }
+                })
+            })
+        },
+        changeDefault({
+            detail
+        }) {
+            _Http.basic({
+                "content": {
+                    "sa_competitor_advid": detail
+                },
+                "id": 2025031809224302,
+            }).then(res => {
+                console.log("切换默认", res)
+                this.updataDetail()
+            })
+        },
+        handleItem(e) {
+            console.log(e)
+            const {
+                item,
+                name
+            } = e.target.dataset,
+                that = this;
+            if (name == 'delete') {
+                wx.showModal({
+                    content: getApp().globalData.Language.getMapText('是否确定删除') + '?',
+                    cancelText: getApp().globalData.Language.getMapText('取消'),
+                    confirmText: getApp().globalData.Language.getMapText('确定'),
+                    complete: ({
+                        confirm
+                    }) => {
+                        if (confirm) _Http.basic({
+                            "content": {
+                                "sa_competitor_advid": item.sa_competitor_advid
+                            },
+                            "id": 2025031809214002,
+                        }).then(res => {
+                            console.log("删除", res)
+                            getApp().globalData.Language.showToast(res.code != 1 ? res.msg : "删除成功")
+                            if (res.code == 1) {
+                                that.setData({
+                                    list: that.data.list.filter(v => v.sa_competitor_advid != item.sa_competitor_advid),
+                                    "content.total": that.data.content.total - 1
+                                })
+                                if (item.isdefault) this.updataDetail()
+                            }
+                        })
+                    }
+                })
+            } else {
+                wx.navigateTo({
+                    url: `/packageA/opponent/modules/aAD/insert?id=` + that.data.content.sa_competitorid + '&data=' + JSON.stringify(item),
+                })
+            }
+        },
+        updataDetail() {
+            getCurrentPages().find(v => v.__route__ == 'packageA/opponent/detail').getDetail()
+        }
+    }
+})

+ 7 - 0
packageA/opponent/modules/aAD/index.json

@@ -0,0 +1,7 @@
+{
+    "component": true,
+    "usingComponents": {
+        "van-radio": "@vant/weapp/radio/index",
+        "van-radio-group": "@vant/weapp/radio-group/index"
+    }
+}

+ 77 - 0
packageA/opponent/modules/aAD/index.scss

@@ -0,0 +1,77 @@
+@import "../../../setclient/modules/address/head.scss";
+
+.exp {
+    margin-top: 8rpx;
+    font-size: 24rpx;
+    font-family: PingFang SC-Regular, PingFang SC;
+    color: #333333;
+}
+
+.custom-class {
+    --search-background-color: #fff !important;
+    padding-right: 10rpx !important;
+}
+
+.global-card {
+    padding-bottom: 0;
+
+    .advid-head {
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        box-sizing: border-box;
+        width: 100%;
+
+        .title {
+            font-family: Microsoft YaHei, Microsoft YaHei;
+            font-weight: bold;
+            font-size: 28rpx;
+            color: #333333;
+        }
+
+        .date {
+            font-family: Microsoft YaHei, Microsoft YaHei;
+            font-size: 20rpx;
+            color: #999999;
+        }
+    }
+
+    .exp {
+        font-family: Microsoft YaHei, Microsoft YaHei;
+        font-size: 20rpx;
+        color: #999999;
+        margin-top: 16rpx;
+    }
+
+    .editor {
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        width: 100%;
+        height: 74rpx;
+        border-top: 1px solid #DDDDDD;
+        margin-top: 16rpx;
+
+
+        .radio {
+            font-size: 24rpx;
+            font-family: PingFang SC-Regular, PingFang SC;
+            color: #666666;
+            margin-left: -10rpx;
+        }
+
+        .icon-but {
+
+            navigator {
+                display: inline-block;
+                width: 60rpx;
+                height: 60rpx;
+                line-height: 60rpx;
+                text-align: center;
+                margin-left: 30rpx;
+                width: 32px;
+                color: #707070;
+            }
+        }
+    }
+}

+ 34 - 0
packageA/opponent/modules/aAD/index.wxml

@@ -0,0 +1,34 @@
+<view class="head">
+	<view class="count">
+		<text wx:if="{{language['总共']}}">{{language['总共']}}:{{content.total}}</text>
+		<text wx:else>总共{{content.total}}个</text>
+	</view>
+	<view class="expand">
+		<van-search wx:if="{{showSearch}}" custom-class='custom-class' focus='{{focus}}' value="{{ condition }}" shape="round" bind:change='onChange' bind:search='onSearch' bind:clear='onSearch' placeholder="{{language['请输入搜索关键字']||'请输入搜索关键字'}}" background='#F4F5F7' />
+		<navigator url="#" class="but" bindtap="toSearch">
+			<van-icon name="search" />
+		</navigator>
+		<navigator wx:if="{{disabled}}" url="#" class="but" bindtap="toAdd">
+			<van-icon name="plus" />
+		</navigator>
+	</view>
+</view>
+<van-radio-group value="{{ sa_competitor_advid }}" bind:change="changeDefault">
+	<view class="global-card" wx:for="{{list}}" wx:key="sa_competitor_advid">
+		<view class="advid-head">
+			<view class="title">{{item.createby}}</view>
+			<view class="date">{{item.createdate}}</view>
+		</view>
+		<view class="exp">{{language['优势信息']||'优势信息'}}:{{item.advantage||' --'}}</view>
+		<view class="exp">{{language['劣势信息']||'劣势信息'}}:{{item.inferiority||' --'}}</view>
+
+		<view class="editor">
+			<van-radio icon-size='16' label-class='radio' name="{{item.sa_competitor_advid}}">{{language['设为默认']||'设为默认'}}</van-radio>
+			<view class="icon-but" bindtap="handleItem">
+				<navigator url="#" data-item="{{item}}" wx:if="{{disabled}}" data-name="edit" class="iconfont icon-bianji" />
+				<navigator url="#" data-item="{{item}}" wx:if="{{disabled}}" data-name="delete" class="iconfont icon-shanchu" />
+			</view>
+		</view>
+	</view>
+</van-radio-group>
+<My_empty wx:if="{{!list.length}}" />

+ 86 - 0
packageA/opponent/modules/aAD/insert.js

@@ -0,0 +1,86 @@
+let _Http = getApp().globalData.http;
+Page({
+    data: {
+        form: [{
+            label: "优势信息",
+            error: false,
+            errMsg: "",
+            type: "textarea",
+            value: "",
+            placeholder: "优势信息",
+            valueName: "advantage",
+            checking: "base",
+            required: true
+        }, {
+            label: "劣势信息",
+            error: false,
+            errMsg: "",
+            type: "textarea",
+            value: "",
+            placeholder: "劣势信息",
+            valueName: "inferiority",
+            checking: "base",
+            required: true
+        }],
+        "content": {
+            "sa_competitorid": 0,
+            "isdefault": 0,
+            sa_competitor_advid: 0
+        },
+        disabled: true
+    },
+    onLoad(options) {
+        this.data.content.sa_competitorid = options.id;
+        if (options.data) {
+            let data = JSON.parse(options.data),
+                content = {
+                    "sa_competitorid": data.sa_competitorid,
+                    "isdefault": data.isdefault,
+                    sa_competitor_advid: data.sa_competitor_advid
+                };
+            this.setData({
+                content,
+                'form[0].value': data.advantage,
+                'form[1].value': data.inferiority,
+                disabled: false
+            })
+        }
+        getApp().globalData.Language.getLanguagePackage(this, (options.data ? '编辑' : '添加') + '优势劣势');
+    },
+    /* 表单必填项是否完成 */
+    onConfirm({
+        detail
+    }) {
+        this.setData({
+            disabled: detail
+        })
+    },
+    // 是否显示全部
+    onChange({
+        detail
+    }) {
+        this.setData({
+            showAll: detail
+        })
+    },
+    submit() {
+        let content = {
+            ...this.data.content,
+            ...this.selectComponent("#Form").submit()
+        };
+        _Http.basic({
+            "id": 2025031809205102,
+            content
+        }).then(res => {
+            console.log("新建或保存优劣势", res)
+            getApp().globalData.Language.showToast(res.code != 1 ? res.msg : "保存成功", res.code == 1)
+            if (res.code == 1) {
+                getCurrentPages().find(v => v.__route__ == 'packageA/opponent/detail').selectComponent("#AAD").getList(0, true)
+                if (content.isdefault) getCurrentPages().find(v => v.__route__ == 'packageA/opponent/detail').getDetail()
+                setTimeout(() => {
+                    wx.navigateBack()
+                }, 300)
+            }
+        })
+    },
+})

+ 4 - 0
packageA/opponent/modules/aAD/insert.json

@@ -0,0 +1,4 @@
+{
+    "usingComponents": {},
+    "navigationBarTitleText": "优势劣势"
+}

+ 91 - 0
packageA/opponent/modules/aAD/insert.scss

@@ -0,0 +1,91 @@
+.new-footer {
+	display: flex;
+	justify-content: flex-end;
+	position: fixed;
+	width: 100vw;
+	height: 130rpx;
+	background: #FFFFFF;
+	box-shadow: 0px -4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+	bottom: 0;
+	padding-top: 10rpx;
+	box-sizing: border-box;
+
+	.new-submit {
+			width: 156rpx;
+			height: 90rpx;
+			background: #3874F6;
+			border-radius: 8rpx;
+			font-size: 28rpx;
+			font-family: PingFang SC-Bold, PingFang SC;
+			font-weight: bold;
+			color: #FFFFFF;
+			margin-right: 30rpx;
+	}
+
+	.query {
+			border: 1rpx solid #CCCCCC !important;
+			background-color: #fff !important;
+			color: #666666 !important;
+	}
+}
+
+
+.popup {
+	.title {
+			position: sticky;
+			height: 80rpx;
+			line-height: 80rpx;
+			width: 100%;
+			text-align: center;
+			border-bottom: 1rpx solid #ddd;
+			font-weight: 600;
+			color: #333;
+			top: 0;
+			background-color: #fff;
+
+			.icon {
+					position: absolute;
+					right: 28rpx;
+					top: 22rpx;
+					color: #999;
+			}
+	}
+
+	.enterprise {
+			width: 100%;
+			box-sizing: border-box;
+			padding-left: 30rpx;
+			padding-right: 10rpx;
+			padding-bottom: 10rpx;
+			border-bottom: 1rpx solid #ddd;
+			margin-top: 10rpx;
+
+			&_title {
+					line-height: 40rpx;
+					font-size: 28rpx;
+					font-family: PingFang SC-Bold, PingFang SC;
+					font-weight: bold;
+					color: #333333;
+			}
+
+			.tag-box {
+					margin-top: 10rpx;
+
+					.tag {
+							height: 40rpx;
+							font-size: 20rpx;
+							font-family: PingFang SC-Regular, PingFang SC;
+							padding: 0 12rpx;
+							margin-right: 8rpx;
+					}
+			}
+
+			.exp {
+					line-height: 34rpx;
+					font-size: 24rpx;
+					font-family: PingFang SC-Regular, PingFang SC;
+					color: #666666;
+					margin-top: 8rpx;
+			}
+	}
+}

+ 6 - 0
packageA/opponent/modules/aAD/insert.wxml

@@ -0,0 +1,6 @@
+<Yl_Headline title='基本信息' type='switch' switchLabel='仅显示必填信息' switch='{{showAll}}' bind:callBack='onChange' />
+<Yl_field id='Form' form='{{form}}' showAll='{{!showAll}}' bind:onConfirm='onConfirm' />
+<view style="height: 100rpx;" />
+<view class="new-footer">
+	<van-button custom-class='new-submit' disabled='{{disabled}}' loading='{{loading}}' bindclick='submit'>{{language['提交']||'提交'}}</van-button>
+</view>

+ 4 - 0
static/font-icon.wxss

@@ -9,6 +9,10 @@
     -webkit-font-smoothing: antialiased;
     -moz-osx-font-smoothing: grayscale;
 }
+.icon-youshilieshi:before {
+  content: "\e70d";
+}
+
 .icon-yutijiao:before {
   content: "\e70c";
 }

Plik diff jest za duży
+ 0 - 0
static/stylesheet.wxss


+ 3 - 2
utils/language.js

@@ -48,10 +48,11 @@ class Language {
 			title: this.getMapText(title)
 		})
 	}
-	showToast(list) {
+	showToast(list, mask = false) {
 		if (list.length) wx.showToast({
 			title: this.joint(list),
-			icon: "none"
+			icon: "none",
+			mask: mask
 		})
 	}
 	modeBoxPrompts(list = [], title = '提示', confirmText = '确定') {

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików