From daf407f5af4bcea4b9984c0f0b742cfa36181733 Mon Sep 17 00:00:00 2001 From: "lj7788@126.com" Date: Sat, 2 Aug 2025 15:44:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yanzhu-ui-app/.vscode/settings.json | 2 +- yanzhu-ui-app/miniprogram/app.json | 242 ++++---- .../components/safety-bar-chart/index.wxml | 4 +- .../components/select-group-plan/index.js | 455 +++++++-------- .../components/select-group-plan/index.wxml | 44 +- .../pageage/project_checked/add/index.js | 261 +++++++-- .../pageage/project_checked/add/index.json | 3 +- .../pageage/project_checked/add/index.less | 47 ++ .../pageage/project_checked/add/index.wxml | 126 ++++- .../pageage/project_checked/add/index.wxss | 40 +- .../pageage/project_info/index.wxml | 529 +++++++++--------- .../components/voucher-datetime/index.js | 149 ++--- .../components/voucher-datetime/index.wxml | 78 +-- yanzhu-ui-app/miniprogram/utils/date.js | 2 + yanzhu-ui-app/miniprogram/utils/format.wxs | 238 ++++---- yanzhu-ui-app/miniprogram/utils/moment.min.js | 2 + 16 files changed, 1293 insertions(+), 929 deletions(-) create mode 100644 yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.less create mode 100644 yanzhu-ui-app/miniprogram/utils/date.js create mode 100644 yanzhu-ui-app/miniprogram/utils/moment.min.js diff --git a/yanzhu-ui-app/.vscode/settings.json b/yanzhu-ui-app/.vscode/settings.json index f0d65a8c..a76fba2d 100644 --- a/yanzhu-ui-app/.vscode/settings.json +++ b/yanzhu-ui-app/.vscode/settings.json @@ -1,6 +1,6 @@ { "files.associations": { - "*.wxml": "xml", + "*.wxml": "html", "*.wxss": "css", "*.wxs": "javascript" }, diff --git a/yanzhu-ui-app/miniprogram/app.json b/yanzhu-ui-app/miniprogram/app.json index 0d048308..4dc7375f 100644 --- a/yanzhu-ui-app/miniprogram/app.json +++ b/yanzhu-ui-app/miniprogram/app.json @@ -1,123 +1,123 @@ { - "pages": [ - "pages/login/login", - "pages/project_qr/index" - ], - "subpackages": [ - { - "root": "pageage", - "name": "pageage", - "pages": [ - "project_flowable/approveTask/index", - "project_flowable/detailTask/index", - "project_flowable/subDepts/index", - "project_flowable/subDeptsUsers/index", - "project_video/list/index", - "project_video/info/index", - "project_list/index", - "project_info/index", - "project_more/index", - "project_safety/index", - "project_quality/index", - "sign_mags/index", - "project_problemmodify/list/index", - "project_problemmodify/info/index", - "project_problemmodify/modify/index", - "project_problemmodify/check/index", - "project_problemmodify/add/index", - "project_problemmodify/draft/index", - "project_subdepts/list/index", - "project_subdepts/add/index", - "project_subdepts/info/index", - "project_subgroups/list/index", - "project_subgroups/add/index", - "project_subgroups/info/index", - "project_subusers/list/index", - "project_subusers/add/index", - "project_subusers/info/index", - "project_magusers/list/index", - "project_magusers/add/index", - "project_magusers/info/index", - "project_schedule/list/index", - "project_schedule/add/index", - "project_schedule/info/index", - "project_checked/list/index", - "project_checked/add/index", - "project_checked/info/index", - "project_checked/handle/index" - ], - "independent": false - } - ], - "usingComponents": { - "van-row": "@vant/weapp/row", - "van-col": "@vant/weapp/col", - "van-popup": "@vant/weapp/popup/index", - "van-picker": "@vant/weapp/picker/index", - "van-datetime-picker": "@vant/weapp/datetime-picker/index", - "van-radio": "@vant/weapp/radio/index", - "van-radio-group": "@vant/weapp/radio-group/index", - "van-toast": "@vant/weapp/toast/index", - "ec-canvas": "ec-canvas/ec-canvas", - "van-sticky": "@vant/weapp/sticky", - "van-calendar": "@vant/weapp/calendar/index", - "van-icon": "@vant/weapp/icon/index", - "van-image": "@vant/weapp/image/index", - "pie-chart": "pages/components/pie-chart/index", - "deep-select": "pages/components/deep-select/index", - "select-btn": "pages/components/select-btn/index", - "bar-chart": "pages/components/bar-chart/index", - "bar-chart-warning": "pages/components/bar-chart-warning/index", - "pz-screen": "pages/components/pz-screen/index", - "pz-screen-training": "pages/components/pz-screen-training/index", - "pz-screen-training-index": "pages/components/pz-screen-training-index/index", - "select-date": "pages/components/select-date/index", - "voucher-select": "pages/components/voucher-select/index", - "voucher-selects": "pages/components/voucher-selects/index", - "voucher-selected": "pages/components/voucher-selected/index", - "voucher-date": "pages/components/voucher-date/index", - "voucher-datetime": "pages/components/voucher-datetime/index", - "file-uploader": "pages/components/file-uploader/index", - "file-uploader-all": "pages/components/file-uploader-all/index", - "project-select": "pages/components/project-select/index", - "safety-pie-chart": "./components/safety-pie-chart/index", - "safety-pie-charts": "./components/safety-pie-charts/index", - "safety-bar-chart": "./components/safety-bar-chart/index", - "safety-bar-charts": "./components/safety-bar-charts/index", - "safety-bar-chartss": "./components/safety-bar-chartss/index", - "voucher-many-select": "pages/components/voucher-many-select/index", - "sign": "pages/components/sign/sign", - "jyq-result": "pages/components/jyq-result/index", - "safety-number": "./components/number/index", - "select-person": "./components/select-person/index", - "select-roles": "./components/select-roles/index", - "select-group-person": "./components/select-group-person/index", - "select-group-position": "./components/select-group-position/index", - "select-group-plan": "./components/select-group-plan/index", - "van-dropdown-menu": "@vant/weapp/dropdown-menu/index", - "van-dropdown-item": "@vant/weapp/dropdown-item/index", - "curve-echarts": "pages/components/curve-echarts/index", - "user-infos": "pages/components/user-infos/index" - }, - "plugins": { - "ezplayer": { - "version": "1.0.9", - "provider": "wxf2b3a0262975d8c2" - } - }, - "window": { - "backgroundTextStyle": "light", - "navigationBarBackgroundColor": "#191d28", - "navigationBarTextStyle": "white" - }, - "style": "v2", - "sitemapLocation": "sitemap.json", - "permission": { - "scope.userLocation": { - "desc": "你的位置信息将用于小程序位置接口的效果展示" - } - }, - "requiredPrivateInfos": [ - "getLocation" - ] + "pages": [ + "pages/login/login", + "pages/project_qr/index" + ], + "subpackages": [ + { + "root": "pageage", + "name": "pageage", + "pages": [ + "project_flowable/approveTask/index", + "project_flowable/detailTask/index", + "project_flowable/subDepts/index", + "project_flowable/subDeptsUsers/index", + "project_video/list/index", + "project_video/info/index", + "project_list/index", + "project_info/index", + "project_more/index", + "project_safety/index", + "project_quality/index", + "sign_mags/index", + "project_problemmodify/list/index", + "project_problemmodify/info/index", + "project_problemmodify/modify/index", + "project_problemmodify/check/index", + "project_problemmodify/add/index", + "project_problemmodify/draft/index", + "project_subdepts/list/index", + "project_subdepts/add/index", + "project_subdepts/info/index", + "project_subgroups/list/index", + "project_subgroups/add/index", + "project_subgroups/info/index", + "project_subusers/list/index", + "project_subusers/add/index", + "project_subusers/info/index", + "project_magusers/list/index", + "project_magusers/add/index", + "project_magusers/info/index", + "project_schedule/list/index", + "project_schedule/add/index", + "project_schedule/info/index", + "project_checked/list/index", + "project_checked/add/index", + "project_checked/info/index", + "project_checked/handle/index" + ], + "independent": false + } + ], + "usingComponents": { + "van-row": "@vant/weapp/row", + "van-col": "@vant/weapp/col", + "van-popup": "@vant/weapp/popup/index", + "van-picker": "@vant/weapp/picker/index", + "van-datetime-picker": "@vant/weapp/datetime-picker/index", + "van-radio": "@vant/weapp/radio/index", + "van-radio-group": "@vant/weapp/radio-group/index", + "van-toast": "@vant/weapp/toast/index", + "ec-canvas": "ec-canvas/ec-canvas", + "van-sticky": "@vant/weapp/sticky", + "van-calendar": "@vant/weapp/calendar/index", + "van-icon": "@vant/weapp/icon/index", + "van-image": "@vant/weapp/image/index", + "pie-chart": "pages/components/pie-chart/index", + "deep-select": "pages/components/deep-select/index", + "select-btn": "pages/components/select-btn/index", + "bar-chart": "pages/components/bar-chart/index", + "bar-chart-warning": "pages/components/bar-chart-warning/index", + "pz-screen": "pages/components/pz-screen/index", + "pz-screen-training": "pages/components/pz-screen-training/index", + "pz-screen-training-index": "pages/components/pz-screen-training-index/index", + "select-date": "pages/components/select-date/index", + "voucher-select": "pages/components/voucher-select/index", + "voucher-selects": "pages/components/voucher-selects/index", + "voucher-selected": "pages/components/voucher-selected/index", + "voucher-date": "pages/components/voucher-date/index", + "voucher-datetime": "pages/components/voucher-datetime/index", + "file-uploader": "pages/components/file-uploader/index", + "file-uploader-all": "pages/components/file-uploader-all/index", + "project-select": "pages/components/project-select/index", + "safety-pie-chart": "./components/safety-pie-chart/index", + "safety-pie-charts": "./components/safety-pie-charts/index", + "safety-bar-chart": "./components/safety-bar-chart/index", + "safety-bar-charts": "./components/safety-bar-charts/index", + "safety-bar-chartss": "./components/safety-bar-chartss/index", + "voucher-many-select": "pages/components/voucher-many-select/index", + "sign": "pages/components/sign/sign", + "jyq-result": "pages/components/jyq-result/index", + "safety-number": "./components/number/index", + "select-person": "./components/select-person/index", + "select-roles": "./components/select-roles/index", + "select-group-person": "./components/select-group-person/index", + "select-group-position": "./components/select-group-position/index", + "select-group-plan": "./components/select-group-plan/index", + "van-dropdown-menu": "@vant/weapp/dropdown-menu/index", + "van-dropdown-item": "@vant/weapp/dropdown-item/index", + "curve-echarts": "pages/components/curve-echarts/index", + "user-infos": "pages/components/user-infos/index" + }, + "plugins": { + "ezplayer": { + "version": "1.0.9", + "provider": "wxf2b3a0262975d8c2" + } + }, + "window": { + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#191d28", + "navigationBarTextStyle": "white" + }, + "style": "v2", + "sitemapLocation": "sitemap.json", + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于小程序位置接口的效果展示" + } + }, + "requiredPrivateInfos": [ + "getLocation" + ] } \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/components/safety-bar-chart/index.wxml b/yanzhu-ui-app/miniprogram/components/safety-bar-chart/index.wxml index d56ac15d..0b02ab36 100644 --- a/yanzhu-ui-app/miniprogram/components/safety-bar-chart/index.wxml +++ b/yanzhu-ui-app/miniprogram/components/safety-bar-chart/index.wxml @@ -1,4 +1,4 @@ - - + + \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/components/select-group-plan/index.js b/yanzhu-ui-app/miniprogram/components/select-group-plan/index.js index 802f35f9..c2473b80 100644 --- a/yanzhu-ui-app/miniprogram/components/select-group-plan/index.js +++ b/yanzhu-ui-app/miniprogram/components/select-group-plan/index.js @@ -1,227 +1,240 @@ Component({ - /** - * 组件的属性列表 - */ - properties: { - dataTree: { - type: Array, - value: [] - }, - treeListIndex: { // 当期树形列表的索引 - type: Number, - value: 1 - }, - isOpenAll: { // 是否展开全部节点 - type: Boolean, - value: false - }, - showCheckBox: { // 是否显示选择框 - type: Boolean, - value: true - } + /** + * 组件的属性列表 + */ + properties: { + dataTree: { + type: Array, + value: [] }, - observers: { - 'dataTree': function (params) { - this.setData({ - tree: this._initSourceData(params) - }) - } + treeListIndex: { // 当期树形列表的索引 + type: Number, + value: 1 }, - /** - * 组件的初始数据 - */ - data: { - tree: [], - allChoiceIdList: [] // 所有选中的id数组 + isOpenAll: { // 是否展开全部节点 + type: Boolean, + value: false }, - /** - * 组件的方法列表 - */ - methods: { - isOpen(e) { - const open = 'tree[' + e.currentTarget.dataset.index + '].open' - this.setData({ - [open]: !this.data.tree[e.currentTarget.dataset.index].open - }) - }, - _initSourceData(nodes) { - nodes.forEach(element => { - if (element.checked === undefined) element.checked = 0 - element.open = this.properties.isOpenAll // 是否展开 - if (element.children && element.children.length > 0) element.children = this._initSourceData(element.children) - }) - return nodes - }, - /** - * 选择节点 - * @param {*} e - */ - select(e) { - this._initSourceData(this.data.tree); - let item = e.currentTarget.dataset.item - if(item.children && item.children.length>0){ - wx.showToast({ - title: "请选择进度计划任务!", - icon: 'none', - duration: 600, - mask: true - }); - return false; - } - item = this._handleClickItem(item) - this.data.tree = this._updateTree(this.data.tree, item) - this.setData({ - tree: this.data.tree - }) - this.data.allChoiceIdList = this.getAllChoiceId(this.data.tree) - this.triggerEvent('select', { - item: item, - idList: this.data.allChoiceIdList - }, { - bubbles: true, - composed: true - }) - this.triggerEvent('clickItem', { - item: item - }, { - bubbles: true, - composed: true - }) - }, - // 选择冒泡事件 - handleSelect(e) { - let parent = e.currentTarget.dataset.parent - let currentTap = e.detail.item - console.log('parent节点:', parent) - console.log('currentTap节点:', currentTap) - // 修正它的父节点 - parent.children = this._updateTree(parent.children, currentTap) - const { - half, - all, - none - } = this.getChildState(parent.children) - // console.log(`half:${half},all:${all},none:${none}`) - if (half) parent.checked = -1 - if (all) parent.checked = 1 - if (none) parent.checked = 0 - // 修正整个tree - this.data.tree = this._updateTree(this.data.tree, parent) - this.setData({ - tree: this.data.tree - }) - this.data.allChoiceIdList = this.getAllChoiceId(this.data.tree) - this.triggerEvent('select', { - item: parent, - idList: this.data.allChoiceIdList - }, { - bubbles: true, - composed: true - }) - }, - /** - * @method 处理点击选择 - * @param {Object} node 节点对象 - * @returns {Object} node 处理完毕的节点 - * @description 有子节点则全选中或全取消,当前为最底层单节点则选中或单取消 - */ - _handleClickItem(node) { - switch (node.checked) { - case 0: - node.checked = 1 - if (node.children && node.children.length > 0) node.children = this._allChoice(node.children) - break; - case 1: - node.checked = 0 - if (node.children && node.children.length > 0) node.children = this._allCancel(node.children) - break; - default: - node.checked = 1 - if (node.children && node.children.length > 0) node.children = this._allChoice(node.children) - break; - } - return node - }, - /** - * @method 全选 - * @param {Array} nodes 节点数组 - * @returns {Array} nodes 处理完毕的节点数组 - */ - _allChoice(nodes) { - if (nodes.length <= 0) return - for (let i = 0; i < nodes.length; i++) { - nodes[i].checked = 1 - if (nodes[i].children && nodes[i].children.length > 0) nodes[i].children = this._allChoice(nodes[i].children) - } - return nodes - }, - /** - * @method 全取消 - * @param {Array} nodes 节点数组 - * @returns {Array} nodes 处理完毕的节点数组 - */ - _allCancel(nodes) { - if (nodes.length <= 0) return - for (let i = 0; i < nodes.length; i++) { - nodes[i].checked = 0 - if (nodes[i].children && nodes[i].children.length > 0) nodes[i].children = this._allCancel(nodes[i].children) - } - return nodes - }, - /** - * @method 更新tree - * @param {Array} tree 节点树 - * @param {Object} newItem 需要替换新节点 - * @description 找到tree中目标进行替换 - */ - _updateTree(tree, newItem) { - if (!tree || tree.length <= 0) return - for (let i = 0; i < tree.length; i++) { - if (tree[i].id === newItem.id) { - tree[i] = newItem - break - } else { - if (tree[i].children && tree[i].children.length > 0) { - tree[i].children = this._updateTree(tree[i].children, newItem) - } - } - } - return tree - }, - /** - * @method 获取子节点的状态 - * @param {Array} node 节点数组 - */ - getChildState(node) { - let all = true; - let none = true; - for (let i = 0, j = node.length; i < j; i++) { - const n = node[i]; - if (n.checked === 1 || n.checked === -1) { - none = none && false; - } - if (n.checked === 0 || n.checked === -1) { - all = all && false - } - } - return { - all, - none, - half: !all && !none - }; - }, - // 获取所有选中的节点id - getAllChoiceId(nodes, res = []) { - for (let i = 0; i < nodes.length; i++) { - if (nodes[i].checked === 1) { - var obj = {} - obj.planId = nodes[i].id - obj.planName = nodes[i].taskName - res.push(obj) - } - if (nodes[i].children && nodes[i].children.length > 0) this.getAllChoiceId(nodes[i].children, res) - } - return res - } + showCheckBox: { // 是否显示选择框 + type: Boolean, + value: true + }, + multiple: { // 是否多选 + type: Boolean, + value: true } + }, + observers: { + 'dataTree': function (params) { + this.setData({ + tree: this._initSourceData(params) + }) + } + }, + /** + * 组件的初始数据 + */ + data: { + tree: [], + allChoiceIdList: [] // 所有选中的id数组 + }, + /** + * 组件的方法列表 + */ + methods: { + isOpen(e) { + const open = 'tree[' + e.currentTarget.dataset.index + '].open' + this.setData({ + [open]: !this.data.tree[e.currentTarget.dataset.index].open + }) + }, + _initSourceData(nodes) { + nodes.forEach(element => { + if (element.checked === undefined) element.checked = 0 + element.open = this.properties.isOpenAll // 是否展开 + if (element.children && element.children.length > 0) element.children = this._initSourceData(element.children) + }) + return nodes + }, + /** + * 选择节点 + * @param {*} e + */ + select(e) { + this._initSourceData(this.data.tree); + let item = e.currentTarget.dataset.item + if (item.children && item.children.length > 0) { + wx.showToast({ + title: "请选择进度计划任务!", + icon: 'none', + duration: 600, + mask: true + }); + return false; + } + item = this._handleClickItem(item) + this.data.tree = this._updateTree(this.data.tree, item) + this.setData({ + tree: this.data.tree + }) + this.data.allChoiceIdList = this.getAllChoiceId(this.data.tree) + this.triggerEvent('select', { + item: item, + idList: this.data.allChoiceIdList + }, { + bubbles: true, + composed: true + }) + this.triggerEvent('clickItem', { + item: item + }, { + bubbles: true, + composed: true + }) + }, + // 选择冒泡事件 + handleSelect(e) { + let parent = e.currentTarget.dataset.parent + let currentTap = e.detail.item + console.log('parent节点:', parent) + console.log('currentTap节点:', currentTap) + // 修正它的父节点 + parent.children = this._updateTree(parent.children, currentTap) + const { + half, + all, + none + } = this.getChildState(parent.children) + // console.log(`half:${half},all:${all},none:${none}`) + if (half) parent.checked = -1 + if (all) parent.checked = 1 + if (none) parent.checked = 0 + // 修正整个tree + this.data.tree = this._updateTree(this.data.tree, parent) + this.setData({ + tree: this.data.tree + }) + this.data.allChoiceIdList = this.getAllChoiceId(this.data.tree) + this.triggerEvent('select', { + item: parent, + idList: this.data.allChoiceIdList + }, { + bubbles: true, + composed: true + }) + }, + handleClickItem(e) { + let item = e.detail.item; + this.triggerEvent('clickItem', { + item: item + }, { + bubbles: true, + composed: true + }) + }, + /** + * @method 处理点击选择 + * @param {Object} node 节点对象 + * @returns {Object} node 处理完毕的节点 + * @description 有子节点则全选中或全取消,当前为最底层单节点则选中或单取消 + */ + _handleClickItem(node) { + switch (node.checked) { + case 0: + node.checked = 1 + if (node.children && node.children.length > 0) node.children = this._allChoice(node.children) + break; + case 1: + node.checked = 0 + if (node.children && node.children.length > 0) node.children = this._allCancel(node.children) + break; + default: + node.checked = 1 + if (node.children && node.children.length > 0) node.children = this._allChoice(node.children) + break; + } + return node + }, + /** + * @method 全选 + * @param {Array} nodes 节点数组 + * @returns {Array} nodes 处理完毕的节点数组 + */ + _allChoice(nodes) { + if (nodes.length <= 0) return + for (let i = 0; i < nodes.length; i++) { + nodes[i].checked = 1 + if (nodes[i].children && nodes[i].children.length > 0) nodes[i].children = this._allChoice(nodes[i].children) + } + return nodes + }, + /** + * @method 全取消 + * @param {Array} nodes 节点数组 + * @returns {Array} nodes 处理完毕的节点数组 + */ + _allCancel(nodes) { + if (nodes.length <= 0) return + for (let i = 0; i < nodes.length; i++) { + nodes[i].checked = 0 + if (nodes[i].children && nodes[i].children.length > 0) nodes[i].children = this._allCancel(nodes[i].children) + } + return nodes + }, + /** + * @method 更新tree + * @param {Array} tree 节点树 + * @param {Object} newItem 需要替换新节点 + * @description 找到tree中目标进行替换 + */ + _updateTree(tree, newItem) { + if (!tree || tree.length <= 0) return + for (let i = 0; i < tree.length; i++) { + if (tree[i].id === newItem.id) { + tree[i] = newItem + break + } else { + if (tree[i].children && tree[i].children.length > 0) { + tree[i].children = this._updateTree(tree[i].children, newItem) + } + } + } + return tree + }, + /** + * @method 获取子节点的状态 + * @param {Array} node 节点数组 + */ + getChildState(node) { + let all = true; + let none = true; + for (let i = 0, j = node.length; i < j; i++) { + const n = node[i]; + if (n.checked === 1 || n.checked === -1) { + none = none && false; + } + if (n.checked === 0 || n.checked === -1) { + all = all && false + } + } + return { + all, + none, + half: !all && !none + }; + }, + // 获取所有选中的节点id + getAllChoiceId(nodes, res = []) { + for (let i = 0; i < nodes.length; i++) { + if (nodes[i].checked === 1) { + var obj = {} + obj.planId = nodes[i].id + obj.planName = nodes[i].taskName + res.push(obj) + } + if (nodes[i].children && nodes[i].children.length > 0) this.getAllChoiceId(nodes[i].children, res) + } + return res + } + } }) \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/components/select-group-plan/index.wxml b/yanzhu-ui-app/miniprogram/components/select-group-plan/index.wxml index 7438e0f2..d1a2fda1 100644 --- a/yanzhu-ui-app/miniprogram/components/select-group-plan/index.wxml +++ b/yanzhu-ui-app/miniprogram/components/select-group-plan/index.wxml @@ -1,22 +1,28 @@ - - - - - - - - - - - - - - {{item.taskName}} ( {{item.scheduleNode}} % ) - - - + + + + - - + + + + + + + + + {{item.taskName}} ( {{item.scheduleNode}} % ) + + + + + + \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.js b/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.js index 42dd5dd0..441f5b41 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.js +++ b/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.js @@ -1,66 +1,209 @@ // pageage/project_checked/add/index.js +import config from '../../../config' +import fmt from '../../../utils/date.js' +import { + getToken, + getUserInfo +} from '../../../utils/auth' +import { + projectCheckedList, + projectCheckedListCount +} from '../../../api/project' + +import { + findPlanDatas, + findRecursionPlan, + findPreviousSchedule, + submitPlanSchedule +} from '../../../api/project' + +const app = getApp() Page({ - /** - * 页面的初始数据 - */ - data: { - + /** + * 页面的初始数据 + */ + data: { + maxDate: new Date(2088, 1, 1).getTime(), + minDate: new Date().getTime() + (3600 * 48 * 1000), + form: { + taskName: '', + task: null, + intro: '',//验收描述 + imageUrls: [], + groupDeptUser: '',//班组长 + checkingDate: '',//验收时间 + technicianUser: '',//技术专员 + superviseUser: '',//监理专员 }, + projectUserInfo: {}, + projectId: "", + projectName: "", + initData: {}, + pageNum: 1, + pageSize: 10, + total: 0, + listData: [], + //任务计划 + picker: false, + planOptions: [], + }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { - + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + if (!getToken()) { + wx.redirectTo({ + url: '../../../pages/login/login', + }) } + const proUserInfo = getUserInfo(); + this.setData({ + projectUserInfo: proUserInfo.projectUserInfo, + projectId: app.globalData.useProjectId, + projectName: app.globalData.useProjectName, + initData: { + id: app.globalData.useProjectId, + text: app.globalData.useProjectName, + }, + pageNum: 1, + pageSize: 10, + listData: [], + total: 0, + form: { + taskName: '', + task: null, + intro: '', + checkingDate: fmt(new Date()).format("YYYY-MM-DD HH:mm:ss"), + } + }); + this.initPlanDatas(); + }, + //项目切换 返回值 + onProjectSelect(e) { + let projectId = e.detail.id; + let projectName = e.detail.text; + app.globalData.useProjectId = projectId; + app.globalData.useProjectName = projectName; + this.onLoad(); + }, + + /** + * 初始化计划 + */ + initPlanDatas() { + findPlanDatas(app.globalData.useProjectId).then((res) => { + let treeDatas = this.buildTree(res.data, 1, ""); + this.setData({ + planOptions: treeDatas + }) + }); + }, + closePicker() { + this.setData({ + picker: false + }) + }, + /** + * 打开选择窗 + */ + openPicker() { + this.setData({ + picker: true + }) + }, + /** + * 构建树结构 + * @param {*} all + * @param {*} id + */ + buildTree(all, id, path) { + let tmps = all.filter((d) => d.parentId == id); + if (tmps.length > 0) { + tmps.forEach((it) => { + it.fullPath = path ? path + "/" + it.taskName : it.taskName; + it.children = this.buildTree(all, it.taskId, it.fullPath); + }); + } + return tmps; + }, + handleClick: function (e) { + let item = e.detail.item; + if (item) { + this.setData({ + form: { + task: item, + taskName: item.fullPath + }, + picker: false + }) + } + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + }, + returnToPage: function () { + /*关闭当前页面,跳转到其它页面。*/ + wx.redirectTo({ + url: '../list/index', + }) + }, + onScrollToLower() { + let nal = Math.ceil(this.data.total / this.data.pageSize); + if (this.data.pageNum < nal) { + this.setData({ + //pageNum: this.data.pageNum + 1 + }); + //this.getListData(this.data.activeState); + } else { + console.log("已经到底了,没有数据可加载!!!"); + } + }, + }) \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.json b/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.json index 3928faa4..965b8e80 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.json +++ b/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.json @@ -1,3 +1,4 @@ { - "usingComponents": {} + "usingComponents": {}, + "navigationStyle": "custom" } \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.less b/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.less new file mode 100644 index 00000000..a6b31fdb --- /dev/null +++ b/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.less @@ -0,0 +1,47 @@ +/* pageage/project_checked/add/index.wxss */ +.project-checked-add { + .max_content_scroll { + color: #89a4eb; + font-size: 28rpx; + padding: 60rpx 30rpx 30rpx; + width: calc(100% - 60rpx); + position: relative; + top: 140rpx; + + .mt40 { + margin-top: 40rpx; + } + + .add-info { + background-color: #514f4f8a; + color: #888; + margin-top: 16rpx; + line-height: 60rpx; + border-radius: 30rpx; + padding: 0rpx 30rpx; + } + + .rectifier_title { + position: relative; + background: #27304f; + border-radius: 15rpx; + text-align: center; + padding: 20rpx 15rpx; + } + + .rectifier_close { + position: absolute; + width: 50rpx; + height: 50rpx; + right: 20rpx; + top: 12rpx; + line-height: 60rpx; + text-align: center; + } + + .add_textarea { + height: 60rpx; + } + + } +} \ No newline at end of file diff --git a/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.wxml b/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.wxml index e2312f5f..bb567664 100644 --- a/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.wxml +++ b/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.wxml @@ -1,2 +1,124 @@ - -pageage/project_checked/add/index.wxml \ No newline at end of file + + + + + + + + + + + + 增加项目举牌验收 + + + + + + + 分包单位 + {{projectUserInfo.subDeptName}} + + + 工程部位 + + +