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}}
+
+
+ 工程部位
+
+
+
+
+
+
+ 选择工程计划
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 技术专员
+
+
+
+
+
+
+ 选择工程计划
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 监理员
+
+
+
+
+
+
+ 选择工程计划
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 结果描述
+
+
+
+
+
+
+ 验收时间
+
+
+
+
+
+ 验收照片
+
+
+
+
+
+
+
+
+
+ 取消
+ 确认
+
+
+
+
\ No newline at end of file
diff --git a/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.wxss b/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.wxss
index b8edd84f..c5916259 100644
--- a/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.wxss
+++ b/yanzhu-ui-app/miniprogram/pageage/project_checked/add/index.wxss
@@ -1 +1,39 @@
-/* pageage/project_checked/add/index.wxss */
\ No newline at end of file
+/* 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;
+}
+.project-checked-add .max_content_scroll .mt40 {
+ margin-top: 40rpx;
+}
+.project-checked-add .max_content_scroll .add-info {
+ background-color: #514f4f8a;
+ color: #888;
+ margin-top: 16rpx;
+ line-height: 60rpx;
+ border-radius: 30rpx;
+ padding: 0rpx 30rpx;
+}
+.project-checked-add .max_content_scroll .rectifier_title {
+ position: relative;
+ background: #27304f;
+ border-radius: 15rpx;
+ text-align: center;
+ padding: 20rpx 15rpx;
+}
+.project-checked-add .max_content_scroll .rectifier_close {
+ position: absolute;
+ width: 50rpx;
+ height: 50rpx;
+ right: 20rpx;
+ top: 12rpx;
+ line-height: 60rpx;
+ text-align: center;
+}
+.project-checked-add .max_content_scroll .add_textarea {
+ height: 60rpx;
+}
diff --git a/yanzhu-ui-app/miniprogram/pageage/project_info/index.wxml b/yanzhu-ui-app/miniprogram/pageage/project_info/index.wxml
index 8f92d127..b67b8f85 100644
--- a/yanzhu-ui-app/miniprogram/pageage/project_info/index.wxml
+++ b/yanzhu-ui-app/miniprogram/pageage/project_info/index.wxml
@@ -19,269 +19,298 @@
-
-
-
-
-
-
-
- 项目单位:{{projectInfo.comName}}
-
-
- 所属区域:{{projectInfo.province+' - '+projectInfo.city}}
-
-
- 详细地址:{{projectInfo.projectAddress}}
-
-
- 项目类型:{{projectInfo.projectTypeName}}
-
-
- 总建筑面积:{{projectInfo.totalBuildingArea}}
-
-
- 计划开工日期:{{projectInfo.scheduledStartTime}}
-
-
- 实际开工日期:{{projectInfo.actualOperatingTime}}
-
-
- 计划竣工日期:{{projectInfo.plannedCompletionTime}}
-
-
- 总工期:{{projectInfo.projectTimeLimit + ' 天'}}
-
-
- 项目负责人:{{projectInfo.projectPerson}}
-
-
- 负责人手机号:{{projectInfo.projectPersonPhone}}
-
-
- 项目概述:{{projectInfo.projectSummarize}}
-
-
-
-
-
-
-
-
-
- {{item.deptType}}
- {{item.deptName}}
- {{item.leader}} {{item.phone}}
-
-
-
-
-
-
-
-
-
- 劳务人员
-
-
-
-
-
- {{item.name}}({{item.total}})
-
-
-
-
-
-
-
-
-
-
-
-
- {{ labourTotal }} 人
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ {{item.name}}({{item.total}})
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ labourTotal }} 人
+
+
+
+
+
+
+
+
+
+
-
-
-
- 今日出勤
-
-
-
-
-
-
-
-
-
-
-
-
- {{ labourDaysTotal }} 人
-
-
-
-
-
-
-
-
-
-
-
-
-
- 我的二维码
-
-
-
-
-
-
-
- 项目经理 扫描二维码登记信息,完成安全学习和在线考试,签署安全承诺书后可申请入场。
- 班组组长 扫描二维码登记信息,完成安全学习和在线考试,签署安全承诺书后可申请入场。
- 劳务人员 扫描二维码登记信息,完成安全学习和在线考试,签署安全承诺书后可申请入场。
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+ {{ labourDaysTotal }} 人
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 我的二维码
+
+
+
+
+
+
+
+
+ 项目经理
+ 扫描二维码登记信息,完成安全学习和在线考试,签署安全承诺书后可申请入场。
+ 班组组长
+ 扫描二维码登记信息,完成安全学习和在线考试,签署安全承诺书后可申请入场。
+ 劳务人员
+ 扫描二维码登记信息,完成安全学习和在线考试,签署安全承诺书后可申请入场。
+
+
+
+
+
-
-
-
- 最近出勤
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
- 最近出勤
-
-
-
-
-
- 默认展示近7天考勤数据!
-
-
-
-
-
- {{index < 10 ?'0'+(index+1):(index+1)}}
- 考勤时间:{{format.dateStrEv(item.inTime,item.outTime)}}
-
-
-
-
-
-
-
-
-
- 人员姓名:{{item.userName}}
- 入场时间:
- {{format.timeStr(item.inTime)}}
- 未打卡
-
- 离场时间:
- {{format.timeStr(item.outTime)}}
- 未打卡
-
-
-
-
- 单位名称:{{item.subDeptName}}
-
-
-
-
-
-
-
- 暂无数据
-
-
-
-
-
-
-
+
+
+
+
+ 默认展示近7天考勤数据!
+
+
+
+
+
+ {{index < 10 ?'0'+(index+1):(index+1)}}
+
+ 考勤时间:{{format.dateStrEv(item.inTime,item.outTime)}}
+
+
+
+
+
+
+
+
+
+ 人员姓名:{{item.userName}}
+ 入场时间:
+ {{format.timeStr(item.inTime)}}
+ 未打卡
+
+ 离场时间:
+ {{format.timeStr(item.outTime)}}
+ 未打卡
+
+
+
+
+ 单位名称:{{item.subDeptName}}
+
+
+
+
+
+
+
+
+ 暂无数据
+
+
+
+
+
+
+
-
-
-
-
-
- 项目概况
-
-
-
-
-
- 安全管理
- {{aqglDB}}
-
+
+
+
+
+
+ 项目概况
+
-
-
-
- 质量管理
- {{zlglDB}}
-
+
+
+
+ 安全管理
+ {{aqglDB}}
+
-
-
-
- 进度管理
-
+
+
+
+ 质量管理
+ {{zlglDB}}
+
-
-
-
- 项目管理
- {{todoDb}}
-
-
+
+
+
+ 进度管理
+
-
-
-
-
-
- 项目概况
-
-
-
-
-
- 项目管理
- {{todoDb}}
-
-
\ No newline at end of file
+
+
+
+ 项目管理
+ {{todoDb}}
+
+
+
+
+
+
+
+
+ 项目概况
+
+
+
+
+
+ 项目管理
+ {{todoDb}}
+
+
\ No newline at end of file
diff --git a/yanzhu-ui-app/miniprogram/pages/components/voucher-datetime/index.js b/yanzhu-ui-app/miniprogram/pages/components/voucher-datetime/index.js
index 4bbc863c..0ba8dba3 100644
--- a/yanzhu-ui-app/miniprogram/pages/components/voucher-datetime/index.js
+++ b/yanzhu-ui-app/miniprogram/pages/components/voucher-datetime/index.js
@@ -1,63 +1,64 @@
// pages/components/voucher-select/index.js
+import fmt from '../../../utils/date.js'
Component({
/**
* 组件的属性列表
*/
properties: {
- width:{
- type:String
+ width: {
+ type: String
},
- counts:{
- type:Number
+ counts: {
+ type: Number
},
- placeholder:{
- type:String
+ placeholder: {
+ type: String
},
- time:{
- type:String
+ time: {
+ type: String
},
- maxDate:{
- type:Number,
- value:new Date().getTime()
+ maxDate: {
+ type: Number,
+ value: new Date().getTime()
},
- value:{
- type:String,
- value:''
+ value: {
+ type: String,
+ value: ''
},
- currentDate:{
- type:Number
+ currentDate: {
+ type: Number
}
},
/**数据监听 */
observers: {
counts: function (val) {
this.setData({
- item:val[0],
+ item: val[0],
})
},
- time:function(val){
+ time: function (val) {
var that = this
that.setData({
- value:val,
+ value: val,
// date:val
})
// that.onConfirm()
}
},
lifetimes: {
- created: function(){
+ created: function () {
//在组件实例刚刚被创建时执行,注意此时不能调用 setData
},
attached: function () {
- //在组件实例进入页面节点树时执行
+ //在组件实例进入页面节点树时执行
},
ready: function () {
- // 在组件在视图层布局完成后执行
+ // 在组件在视图层布局完成后执行
},
detached: function () {
- // 在组件实例被从页面节点树移除时执行
+ // 在组件实例被从页面节点树移除时执行
},
-
+
},
/**
@@ -65,9 +66,10 @@ Component({
*/
data: {
show: false,
- date:'',
- minDate: new Date(2022,1,1).getTime(),
- counts:'5',
+ date: '',
+ currDate: 0,
+ minDate: new Date(2022, 1, 1).getTime(),
+ counts: '5',
formatter(type, value) {
if (type === 'year') {
return `${value}`;
@@ -85,51 +87,54 @@ Component({
*/
methods: {
showPopup() {
- this.setData({
- show: true
- });
- },
- onClose() {
- this.setData({
- show: false
- });
- },
- onConfirm() {
- this.setData({
- value: this.data.date
- })
-
- this.triggerEvent('change', this.data.date)
- this.setData({
- show: false
- });
- },
- formatter(type, value) {
- if (type === 'year') {
- return `${value}`;
- }
- if (type === 'month') {
- return `${value}`;
- }
- return value;
- },
- /**
- * 组件的方法列表
- */
- onInput(event) {
- let date = new Date(event.detail)
- let Y = date.getFullYear();
- let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
- let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + '';
- let H = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + '';
- let I = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + '';
- var lot = Y + '-' + M + '-' + D + ' ' + H + ':' + I +':00';
- this.setData({
- date: lot,
- });
- },
-
+ debugger
+ let cDate = this.properties.currentDate ? this.properties.currentDate : this.properties.value ? +fmt(this.properties.value) : +(new Date())
+ this.setData({
+ currDate: cDate,
+ show: true
+ });
+ },
+ onClose() {
+ this.setData({
+ show: false
+ });
+ },
+ onConfirm() {
+ this.setData({
+ value: this.data.date
+ })
+
+ this.triggerEvent('change', this.data.date)
+ this.setData({
+ show: false
+ });
+ },
+ formatter(type, value) {
+ if (type === 'year') {
+ return `${value}`;
+ }
+ if (type === 'month') {
+ return `${value}`;
+ }
+ return value;
+ },
+ /**
+ * 组件的方法列表
+*/
+ onInput(event) {
+ let date = new Date(event.detail)
+ let Y = date.getFullYear();
+ let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
+ let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + '';
+ let H = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + '';
+ let I = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + '';
+ var lot = Y + '-' + M + '-' + D + ' ' + H + ':' + I + ':00';
+ this.setData({
+ date: lot,
+ });
+ },
+
},
-
+
})
diff --git a/yanzhu-ui-app/miniprogram/pages/components/voucher-datetime/index.wxml b/yanzhu-ui-app/miniprogram/pages/components/voucher-datetime/index.wxml
index 50fee916..ca53dc0b 100644
--- a/yanzhu-ui-app/miniprogram/pages/components/voucher-datetime/index.wxml
+++ b/yanzhu-ui-app/miniprogram/pages/components/voucher-datetime/index.wxml
@@ -1,68 +1,24 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
- 取消
- {{placeholder}}
- 确认
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ 取消
+ {{placeholder}}
+ 确认
+
+
+
+
\ No newline at end of file
diff --git a/yanzhu-ui-app/miniprogram/utils/date.js b/yanzhu-ui-app/miniprogram/utils/date.js
new file mode 100644
index 00000000..16ce21fa
--- /dev/null
+++ b/yanzhu-ui-app/miniprogram/utils/date.js
@@ -0,0 +1,2 @@
+var moment = require('./moment.min.js');
+export default moment;
\ No newline at end of file
diff --git a/yanzhu-ui-app/miniprogram/utils/format.wxs b/yanzhu-ui-app/miniprogram/utils/format.wxs
index b7e3adc1..52dbc156 100644
--- a/yanzhu-ui-app/miniprogram/utils/format.wxs
+++ b/yanzhu-ui-app/miniprogram/utils/format.wxs
@@ -3,36 +3,36 @@
* @param num
*/
function indexNumFormat(num) {
- switch (num) {
- case 0:
- num = "Ⅰ";
- break;
- case 1:
- num = "Ⅱ";
- break;
- case 2:
- num = "Ⅲ";
- break;
- case 3:
- num = "Ⅳ";
- break;
- case 4:
- num = "Ⅴ";
- break;
- case 5:
- num = "Ⅵ";
- break;
- case 6:
- num = "Ⅶ";
- break;
- case 7:
- num = "Ⅷ";
- break;
- case 8:
- num = "Ⅸ";
- break;
- }
- return num;
+ switch (num) {
+ case 0:
+ num = "Ⅰ";
+ break;
+ case 1:
+ num = "Ⅱ";
+ break;
+ case 2:
+ num = "Ⅲ";
+ break;
+ case 3:
+ num = "Ⅳ";
+ break;
+ case 4:
+ num = "Ⅴ";
+ break;
+ case 5:
+ num = "Ⅵ";
+ break;
+ case 6:
+ num = "Ⅶ";
+ break;
+ case 7:
+ num = "Ⅷ";
+ break;
+ case 8:
+ num = "Ⅸ";
+ break;
+ }
+ return num;
}
/**
@@ -40,96 +40,96 @@ function indexNumFormat(num) {
* @param val
*/
function findDurationDate(val) {
- // 计算出相差天数
- let days = Math.floor(val / (24 * 3600 * 1000))
- // 计算出小时数
- let leave1 = val % (24 * 3600 * 1000) // 计算天数后剩余的毫秒数
- let hours = Math.floor(leave1 / (3600 * 1000))
- // 计算相差分钟数
- let leave2 = leave1 % (3600 * 1000) // 计算小时数后剩余的毫秒数
- let minutes = Math.floor(leave2 / (60 * 1000))
- // 计算相差秒数
- let leave3 = leave2 % (60 * 1000) // 计算分钟数后剩余的毫秒数
- let seconds = Math.round(leave3 / 1000)
- if (days > 0) {
- if (days < 10) days = "0" + days;
- if (hours < 10) hours = "0" + hours;
- if (minutes < 10) minutes = "0" + minutes;
- if (seconds < 10) seconds = "0" + seconds;
- return days + '天' + hours + '小时' + minutes + '分钟' + seconds + '秒';
- }
- if (hours > 0) {
- if (hours < 10) hours = "0" + hours;
- if (minutes < 10) minutes = "0" + minutes;
- if (seconds < 10) seconds = "0" + seconds;
- return hours + '小时' + minutes + '分钟' + seconds + '秒';
- }
- if (minutes > 0) {
- if (minutes < 10) minutes = "0" + minutes;
- if (seconds < 10) seconds = "0" + seconds;
- return minutes + '分钟' + seconds + '秒';
- }
- if (seconds > 0) {
- if (seconds < 10) seconds = "0" + seconds;
- return seconds + '秒';
- }
+ // 计算出相差天数
+ let days = Math.floor(val / (24 * 3600 * 1000))
+ // 计算出小时数
+ let leave1 = val % (24 * 3600 * 1000) // 计算天数后剩余的毫秒数
+ let hours = Math.floor(leave1 / (3600 * 1000))
+ // 计算相差分钟数
+ let leave2 = leave1 % (3600 * 1000) // 计算小时数后剩余的毫秒数
+ let minutes = Math.floor(leave2 / (60 * 1000))
+ // 计算相差秒数
+ let leave3 = leave2 % (60 * 1000) // 计算分钟数后剩余的毫秒数
+ let seconds = Math.round(leave3 / 1000)
+ if (days > 0) {
+ if (days < 10) days = "0" + days;
+ if (hours < 10) hours = "0" + hours;
+ if (minutes < 10) minutes = "0" + minutes;
+ if (seconds < 10) seconds = "0" + seconds;
+ return days + '天' + hours + '小时' + minutes + '分钟' + seconds + '秒';
+ }
+ if (hours > 0) {
+ if (hours < 10) hours = "0" + hours;
+ if (minutes < 10) minutes = "0" + minutes;
+ if (seconds < 10) seconds = "0" + seconds;
+ return hours + '小时' + minutes + '分钟' + seconds + '秒';
+ }
+ if (minutes > 0) {
+ if (minutes < 10) minutes = "0" + minutes;
+ if (seconds < 10) seconds = "0" + seconds;
+ return minutes + '分钟' + seconds + '秒';
+ }
+ if (seconds > 0) {
+ if (seconds < 10) seconds = "0" + seconds;
+ return seconds + '秒';
+ }
}
module.exports = {
- indexNumFormat: indexNumFormat,
- findDurationDate: findDurationDate,
- split:function(str,sign){
- return str.split(sign);
- },
- parseStr:function(str){
- return JSON.parse(str);
- },
- evalStr:function(str){
- return eval(str);
- },
- dateStrEv:function(startDate,endDate){
- if(startDate){
- return startDate.split(" ")[0];
- }else if(endDate){
- return endDate.split(" ")[0];
- }else{
- return "未找到记录";
- }
- },
- dateStr:function(str){
- if(str){
- return str.split(" ")[0];
- }else{
- return "";
- }
- },
- timeStr:function(str){
- return str.split(" ")[1];
- },
- isHttpImg:function(str){
- if(str.indexOf("http:")>-1 || str.indexOf("https:")>-1){
- return true;
- }else{
- return false;
- }
- },
- httpImg:function(str){
- if(str.indexOf("https:")>-1){
- return str;
- }else{
- return "https://xiangguan.sxyanzhu.com"+str;
- }
- },
- birthDate:function(timestamp){
- var date = getDate(parseInt(timestamp));
- var mm = date.getMonth()+1;
- if(mm<10){
- mm = '0'+mm;
- }
- var dd = date.getDate();
- if(dd<10){
- dd = '0'+dd;
- }
- return date.getFullYear()+"-"+mm+"-"+dd;
- }
+ indexNumFormat: indexNumFormat,
+ findDurationDate: findDurationDate,
+ split: function (str, sign) {
+ return str.split(sign);
+ },
+ parseStr: function (str) {
+ return JSON.parse(str);
+ },
+ evalStr: function (str) {
+ return eval(str);
+ },
+ dateStrEv: function (startDate, endDate) {
+ if (startDate) {
+ return startDate.split(" ")[0];
+ } else if (endDate) {
+ return endDate.split(" ")[0];
+ } else {
+ return "未找到记录";
+ }
+ },
+ dateStr: function (str) {
+ if (str) {
+ return str.split(" ")[0];
+ } else {
+ return "";
+ }
+ },
+ timeStr: function (str) {
+ return str.split(" ")[1];
+ },
+ isHttpImg: function (str) {
+ if (str.indexOf("http:") > -1 || str.indexOf("https:") > -1) {
+ return true;
+ } else {
+ return false;
+ }
+ },
+ httpImg: function (str) {
+ if (str.indexOf("https:") > -1) {
+ return str;
+ } else {
+ return "https://xiangguan.sxyanzhu.com" + str;
+ }
+ },
+ birthDate: function (timestamp) {
+ var date = getDate(parseInt(timestamp));
+ var mm = date.getMonth() + 1;
+ if (mm < 10) {
+ mm = '0' + mm;
+ }
+ var dd = date.getDate();
+ if (dd < 10) {
+ dd = '0' + dd;
+ }
+ return date.getFullYear() + "-" + mm + "-" + dd;
+ }
}
\ No newline at end of file
diff --git a/yanzhu-ui-app/miniprogram/utils/moment.min.js b/yanzhu-ui-app/miniprogram/utils/moment.min.js
new file mode 100644
index 00000000..8b80f200
--- /dev/null
+++ b/yanzhu-ui-app/miniprogram/utils/moment.min.js
@@ -0,0 +1,2 @@
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var H;function _(){return H.apply(null,arguments)}function y(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function F(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function c(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function L(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(var t in e)if(c(e,t))return;return 1}function g(e){return void 0===e}function w(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function V(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function G(e,t){for(var n=[],s=e.length,i=0;i>>0,s=0;sWe(e)?(r=e+1,t-We(e)):(r=e,t);return{year:r,dayOfYear:n}}function Be(e,t,n){var s,i,r=qe(e.year(),t,n),r=Math.floor((e.dayOfYear()-r-1)/7)+1;return r<1?s=r+N(i=e.year()-1,t,n):r>N(e.year(),t,n)?(s=r-N(e.year(),t,n),i=e.year()+1):(i=e.year(),s=r),{week:s,year:i}}function N(e,t,n){var s=qe(e,t,n),t=qe(e+1,t,n);return(We(e)-s+t)/7}s("w",["ww",2],"wo","week"),s("W",["WW",2],"Wo","isoWeek"),h("w",n,u),h("ww",n,t),h("W",n,u),h("WW",n,t),Oe(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=M(e)});function Je(e,t){return e.slice(t,7).concat(e.slice(0,t))}s("d",0,"do","day"),s("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),s("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),s("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),s("e",0,0,"weekday"),s("E",0,0,"isoWeekday"),h("d",n),h("e",n),h("E",n),h("dd",function(e,t){return t.weekdaysMinRegex(e)}),h("ddd",function(e,t){return t.weekdaysShortRegex(e)}),h("dddd",function(e,t){return t.weekdaysRegex(e)}),Oe(["dd","ddd","dddd"],function(e,t,n,s){s=n._locale.weekdaysParse(e,s,n._strict);null!=s?t.d=s:p(n).invalidWeekday=e}),Oe(["d","e","E"],function(e,t,n,s){t[s]=M(e)});var Qe="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Xe="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Ke="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),et=i,tt=i,nt=i;function st(){function e(e,t){return t.length-e.length}for(var t,n,s,i=[],r=[],a=[],o=[],u=0;u<7;u++)s=l([2e3,1]).day(u),t=f(this.weekdaysMin(s,"")),n=f(this.weekdaysShort(s,"")),s=f(this.weekdays(s,"")),i.push(t),r.push(n),a.push(s),o.push(t),o.push(n),o.push(s);i.sort(e),r.sort(e),a.sort(e),o.sort(e),this._weekdaysRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+i.join("|")+")","i")}function it(){return this.hours()%12||12}function rt(e,t){s(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function at(e,t){return t._meridiemParse}s("H",["HH",2],0,"hour"),s("h",["hh",2],0,it),s("k",["kk",2],0,function(){return this.hours()||24}),s("hmm",0,0,function(){return""+it.apply(this)+r(this.minutes(),2)}),s("hmmss",0,0,function(){return""+it.apply(this)+r(this.minutes(),2)+r(this.seconds(),2)}),s("Hmm",0,0,function(){return""+this.hours()+r(this.minutes(),2)}),s("Hmmss",0,0,function(){return""+this.hours()+r(this.minutes(),2)+r(this.seconds(),2)}),rt("a",!0),rt("A",!1),h("a",at),h("A",at),h("H",n,d),h("h",n,u),h("k",n,u),h("HH",n,t),h("hh",n,t),h("kk",n,t),h("hmm",me),h("hmmss",_e),h("Hmm",me),h("Hmmss",_e),v(["H","HH"],O),v(["k","kk"],function(e,t,n){e=M(e);t[O]=24===e?0:e}),v(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),v(["h","hh"],function(e,t,n){t[O]=M(e),p(n).bigHour=!0}),v("hmm",function(e,t,n){var s=e.length-2;t[O]=M(e.substr(0,s)),t[b]=M(e.substr(s)),p(n).bigHour=!0}),v("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[O]=M(e.substr(0,s)),t[b]=M(e.substr(s,2)),t[T]=M(e.substr(i)),p(n).bigHour=!0}),v("Hmm",function(e,t,n){var s=e.length-2;t[O]=M(e.substr(0,s)),t[b]=M(e.substr(s))}),v("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[O]=M(e.substr(0,s)),t[b]=M(e.substr(s,2)),t[T]=M(e.substr(i))});i=Re("Hours",!0);var ot,ut={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Fe,monthsShort:Le,week:{dow:0,doy:6},weekdays:Qe,weekdaysMin:Ke,weekdaysShort:Xe,meridiemParse:/[ap]\.?m?\.?/i},W={},lt={};function dt(e){return e&&e.toLowerCase().replace("_","-")}function ht(e){for(var t,n,s,i,r=0;r=t&&function(e,t){for(var n=Math.min(e.length,t.length),s=0;s=t-1)break;t--}r++}return ot}function ct(t){var e,n;if(void 0===W[t]&&"undefined"!=typeof module&&module&&module.exports&&(n=t)&&n.match("^[^/\\\\]*$"))try{e=ot._abbr,require("./locale/"+t),ft(e)}catch(e){W[t]=null}return W[t]}function ft(e,t){return e&&((t=g(t)?P(e):mt(e,t))?ot=t:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),ot._abbr}function mt(e,t){if(null===t)return delete W[e],null;var n,s=ut;if(t.abbr=e,null!=W[e])Q("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=W[e]._config;else if(null!=t.parentLocale)if(null!=W[t.parentLocale])s=W[t.parentLocale]._config;else{if(null==(n=ct(t.parentLocale)))return lt[t.parentLocale]||(lt[t.parentLocale]=[]),lt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return W[e]=new K(X(s,t)),lt[e]&<[e].forEach(function(e){mt(e.name,e.config)}),ft(e),W[e]}function P(e){var t;if(!(e=e&&e._locale&&e._locale._abbr?e._locale._abbr:e))return ot;if(!y(e)){if(t=ct(e))return t;e=[e]}return ht(e)}function _t(e){var t=e._a;return t&&-2===p(e).overflow&&(t=t[Y]<0||11He(t[D],t[Y])?S:t[O]<0||24N(r,u,l)?p(s)._overflowWeeks=!0:null!=d?p(s)._overflowWeekday=!0:(h=$e(r,a,o,u,l),s._a[D]=h.year,s._dayOfYear=h.dayOfYear)),null!=e._dayOfYear&&(i=bt(e._a[D],n[D]),(e._dayOfYear>We(i)||0===e._dayOfYear)&&(p(e)._overflowDayOfYear=!0),d=ze(i,0,e._dayOfYear),e._a[Y]=d.getUTCMonth(),e._a[S]=d.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=c[t]=n[t];for(;t<7;t++)e._a[t]=c[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[O]&&0===e._a[b]&&0===e._a[T]&&0===e._a[Te]&&(e._nextDay=!0,e._a[O]=0),e._d=(e._useUTC?ze:Ze).apply(null,c),r=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[O]=24),e._w&&void 0!==e._w.d&&e._w.d!==r&&(p(e).weekdayMismatch=!0)}}function xt(e){if(e._f===_.ISO_8601)Yt(e);else if(e._f===_.RFC_2822)Ot(e);else{e._a=[],p(e).empty=!0;for(var t,n,s,i,r,a=""+e._i,o=a.length,u=0,l=ae(e._f,e._locale).match(te)||[],d=l.length,h=0;he.valueOf():e.valueOf()"}),u.toJSON=function(){return this.isValid()?this.toISOString():null},u.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},u.unix=function(){return Math.floor(this.valueOf()/1e3)},u.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},u.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},u.eraName=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},u.isLocal=function(){return!!this.isValid()&&!this._isUTC},u.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},u.isUtc=At,u.isUTC=At,u.zoneAbbr=function(){return this._isUTC?"UTC":""},u.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},u.dates=e("dates accessor is deprecated. Use date instead.",ge),u.months=e("months accessor is deprecated. Use month instead",Ie),u.years=e("years accessor is deprecated. Use year instead",Pe),u.zone=e("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?(this.utcOffset(e="string"!=typeof e?-e:e,t),this):-this.utcOffset()}),u.isDSTShifted=e("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){var e,t;return g(this._isDSTShifted)&&(q(e={},this),(e=Nt(e))._a?(t=(e._isUTC?l:R)(e._a),this._isDSTShifted=this.isValid()&&0