XLandMine 3 år sedan
förälder
incheckning
a317b47098

+ 361 - 0
components/cuihai-combox/cuihai-combox.vue

@@ -0,0 +1,361 @@
+<template>
+	<view class="uni-combox">
+		<view v-if="label" class="uni-combox__label" :style="labelStyle">
+			<text>{{label}}</text>
+		</view>
+		<view class="uni-combox__input-box">
+			<input class="uni-combox__input" type="text" :placeholder="placeholder" :disabled="isDisabled" v-model="inputVal"
+			 @input="onInput" @focus="onFocus" @blur="onBlur" />
+			<icon type="clear" size="16" @tap="clearInputValue" v-show="!!inputVal" v-if="!isDisabled" />
+			<image class="uni-combox__input-arrow" src="../../static/icon-arr.png" @click="toggleSelector"></image>
+			<!-- <uni-icons class="uni-combox__input-arrow" type="arrowdown" size="14" @click="toggleSelector"></uni-icons> -->
+			<view class="uni-combox__selector" v-if="showSelector">
+				<scroll-view scroll-y="true" class="uni-combox__selector-scroll">
+					<view class="uni-combox__selector-empty" v-if="filterCandidatesLength === 0">
+						<text>{{emptyTips}}</text>
+					</view>
+					<view class="uni-combox__selector-item" v-for="(item,index) in filterCandidates" :key="index" @click="onSelectorClick(index)"
+					 :style="isCheck(index)?'color:'+selectColor+';background-color:'+selectBgColor+';':'color:'+color+';'">
+						<text>{{isJSON?item[keyName]:item}}</text>
+					</view>
+				</scroll-view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	/**
+	 * Combox 组合输入框
+	 * @description 组合输入框一般用于既可以输入也可以选择的场景
+	 * @property {String} label 左侧文字
+	 * @property {String} labelWidth 左侧内容宽度
+	 * @property {String} placeholder 输入框占位符
+	 * @property {Array} candidates 候选项列表
+	 * @property {String} emptyTips 筛选结果为空时显示的文字
+	 * @property {String} value 单选时组合框的初始值
+	 * @property {Array} initValue 多选时组合框的初始值(下标集合)
+	 * @property {String} keyName json数组显示的字段值
+	 * @property {Boolean} isJSON 是否是json数组,默认不是
+	 * @property {Boolean} isDisabled 是否是禁用输入,默认不禁用
+	 * @property {Boolean} isCheckBox 是否是多选,默认不是,多选时不能输入查询
+	 * @property {String} color 默认字体颜色,默认#000000
+	 * @property {String} selectColor 选中字体颜色,默认#0081ff
+	 * @property {String} selectBgColor 选中背景颜色,默认#e8e8e8
+	 */
+	export default {
+		name: 'comboxSearch',
+		props: {
+			label: {
+				type: String,
+				default: ''
+			},
+			labelWidth: {
+				type: String,
+				default: 'auto'
+			},
+			placeholder: {
+				type: String,
+				default: ''
+			},
+			candidates: {
+				type: Array,
+				default () {
+					return []
+				}
+			},
+			emptyTips: {
+				type: String,
+				default: '无匹配项'
+			},
+			value: {
+				type: String,
+				default: ''
+			},
+			initValue: {
+				type: Array,
+				default: null
+			},
+			keyName: {
+				type: String,
+				default: ''
+			},
+			isJSON: {
+				type: Boolean,
+				default: false
+			},
+			isDisabled: {
+				type: Boolean,
+				default: false
+			},
+			isCheckBox: {
+				type: Boolean,
+				default: false
+			},
+			color: {
+				default: "#000000",
+				type: String
+			},
+			selectColor: {
+				default: "#0081ff",
+				type: String
+			},
+			selectBgColor: {
+				default: "#e8e8e8",
+				type: String
+			}
+		},
+		data() {
+			return {
+				showSelector: false,
+				inputVal: '',
+				arrays: [],
+				gid: `sm-org-dropDown-${(new Date()).getTime()}${Math.random()}`
+			}
+		},
+		computed: {
+			labelStyle() {
+				if (this.labelWidth === 'auto') {
+					return {}
+				}
+				return {
+					width: this.labelWidth
+				}
+			},
+			filterCandidates() {
+				if (!this.isDisabled) {
+					if (this.isJSON) {
+						let index = 0;
+						return this.candidates.filter((item) => {
+							item.index = index;
+							index++;
+							return item[this.keyName].indexOf(this.inputVal) > -1
+						})
+					} else {
+						return this.candidates.filter((item) => {
+							return item.indexOf(this.inputVal) > -1
+						})
+					}
+				} else {
+					if (this.isJSON) {
+						let index = 0;
+						return this.candidates.filter((item) => {
+							item.index = index;
+							index++;
+							return item[this.keyName] != undefined;
+						})
+					} else {
+						return this.candidates
+					}
+				}
+			},
+			filterCandidatesLength() {
+				return this.filterCandidates.length
+			}
+		},
+		created() {
+			if (this.initValue != null) {
+				this.arrays = this.initValue;
+				this.inputVal = this.getInpuevals();
+			}
+			//在created的时候,给子组件放置一个监听,这个时候只是监听器被建立,此时这段代码不会生效
+			//uni.$on接收一个sm-org-dropDown-show的广播
+			uni.$on('sm-org-dropDown-show', (targetId) => {
+				//接收广播,当该组件处于下拉框被打开的状态,并且跟下一个被点击的下拉框的gid不同时,将该组件的下拉框关闭,产生一个互斥效果。
+				if (this.showSelector && this.gid != targetId) {
+					this.showSelector = false
+				}
+			})
+		},
+		//当子组件销毁的时候,将建立的监听销毁,这里不会影响代码效果,但是在多次反复引用组件时,会在根节点定义越来越多的监听,长此以往影响性能,所以在不用的时候及时销毁,养成好习惯
+		beforeDestroy() {
+			uni.$off('sm-org-dropDown-show')
+		},
+		watch: {
+			value: {
+				handler(newVal) {
+					this.inputVal = newVal
+				},
+				immediate: true
+			}
+		},
+		methods: {
+			toggleSelector() {
+				this.showSelector = !this.showSelector
+				if (this.showSelector) {
+					uni.$emit('sm-org-dropDown-show', this.gid)
+				}
+			},
+			onFocus() {
+				this.showSelector = true;
+				uni.$emit('sm-org-dropDown-show', this.gid)
+			},
+			onBlur() {
+				/* setTimeout(() => {
+					this.showSelector = false;
+				}, 50) */
+			},
+			onSelectorClick(index) {
+				if (this.isCheckBox) {
+					let flag = this.arrays.indexOf(index);
+					if (flag != -1) {
+						let x = (this.arrays || []).findIndex((item) => item === index)
+						this.arrays.splice(x, 1);
+					} else {
+						this.arrays.push(index);
+					}
+					this.inputVal = this.getInpuevals();
+					if (this.isJSON) {
+						this.$emit('getValue', this.arrays);
+					} else {
+						this.$emit('getValue', this.trimSpace(this.inputVal.split(" ")));
+					}
+				} else {
+					this.showSelector = false
+					if (this.isJSON) {
+						this.$emit('getValue', this.filterCandidates[index].index);
+						this.inputVal = this.filterCandidates[index][this.keyName];
+					} else {
+						this.$emit('getValue', this.filterCandidates[index]);
+						this.inputVal = this.filterCandidates[index]
+					}
+				}
+			},
+			trimSpace(array) {
+				for (var i = 0; i < array.length; i++) {
+					if (array[i] == "") {
+						array.splice(i, 1);
+						i = i - 1;
+					}
+				}
+				return array;
+			},
+			onInput() {
+				setTimeout(() => {
+					this.$emit('input', this.inputVal)
+				})
+			},
+			clearInputValue() {
+				this.inputVal = "";
+				this.showSelector = false;
+			},
+			getInpuevals() {
+				if (this.arrays.length == 0) {
+					this.inputVal = "";
+				} else {
+					this.arrays.sort(function(a, b) {
+						return a - b
+					})
+					this.inputVal = "";
+					if (this.isJSON) {
+						this.arrays.forEach(v => {
+							this.inputVal += this.candidates[v][this.keyName] + " ";
+						});
+					} else {
+						this.arrays.forEach(v => {
+							this.inputVal += this.candidates[v] + " ";
+						});
+					}
+				}
+				return this.inputVal;
+			},
+			isCheck(index) {
+				return this.arrays.indexOf(index) != -1;
+			}
+		}
+	}
+</script>
+
+<style scoped>
+	.uni-combox {
+		/* #ifndef APP-NVUE */
+		display: flex;
+		/* #endif */
+		height: 40px;
+		flex-direction: row;
+		align-items: center;
+    border-bottom: 1px solid #333;
+		/* border-bottom: solid 1px #DDDDDD; */
+	}
+
+	.uni-combox__label {
+		font-size: 14px;
+		line-height: 22px;
+		padding-right: 10px;
+		color: #999999;
+	}
+
+	.uni-combox__input-box {
+		position: relative;
+		/* #ifndef APP-NVUE */
+		display: flex;
+		/* #endif */
+		flex: 1;
+		flex-direction: row;
+		align-items: center;
+		padding-left: 40rpx;
+		padding-right: 20rpx;
+	}
+
+	.uni-combox__input {
+		flex: 1;
+		font-size: 14px;
+		height: 22px;
+		line-height: 22px;
+		padding-right: 20rpx;
+	}
+
+	.uni-combox__input-arrow {
+		width: 24rpx;
+		height: 24rpx;
+		opacity: 1;
+		margin-left: 6rpx;
+	}
+
+	.uni-combox__selector {
+		box-sizing: border-box;
+		position: absolute;
+		top: 42px;
+		left: 0;
+		width: 100%;
+		background-color: #FFFFFF;
+		border-radius: 6px;
+		box-shadow: #DDDDDD 4px 4px 8px, #DDDDDD -4px -4px 8px;
+		z-index: 2;
+	}
+
+	.uni-combox__selector-scroll {
+		max-height: 200px;
+		box-sizing: border-box;
+	}
+
+	.uni-combox__selector::before {
+		content: '';
+		position: absolute;
+		width: 0;
+		height: 0;
+		border-bottom: solid 6px #FFFFFF;
+		border-right: solid 6px transparent;
+		border-left: solid 6px transparent;
+		left: 50%;
+		top: -6px;
+		margin-left: -6px;
+	}
+
+	.uni-combox__selector-empty,
+	.uni-combox__selector-item {
+		/* #ifdef APP-NVUE */
+		display: flex;
+		/* #endif */
+		line-height: 36px;
+		font-size: 14px;
+		text-align: center;
+		border-bottom: solid 1px #DDDDDD;
+		/* margin: 0px 10px; */
+	}
+
+	.uni-combox__selector-empty:last-child,
+	.uni-combox__selector-item:last-child {
+		border-bottom: none;
+	}
+</style>

+ 13 - 7
pages.json

@@ -1,12 +1,5 @@
 {
   "pages": [
-    {
-      "path": "pages/login/login",
-      "style": {
-        "navigationBarTitleText": "",
-        "navigationBarBackgroundColor": "#7399DB"
-      }
-    },
     {
       "path": "pages/index/index",
       "style": {
@@ -24,6 +17,19 @@
         }
       }
     },
+    {
+      "path": "pages/login/login",
+      "style": {
+        "navigationBarTitleText": "",
+        "navigationBarBackgroundColor": "#7399DB"
+      }
+    },
+    {
+      "path": "pages/index/add",
+      "style": {
+        "navigationBarTitleText": "新增工时"
+      }
+    },
     {
       "path": "pages/audit/index",
       "style": {

+ 201 - 0
pages/index/add.vue

@@ -0,0 +1,201 @@
+<template>
+  <view class="content">
+    <view class="popup-content">
+      <uni-forms ref="baseForm" :modelValue="formData">
+        <uni-forms-item label="分类">
+          <ld-select
+            :list="typeList"
+            placeholder="请选择分类"
+            class="select"
+            v-model="formData.typeId"
+            labelKey="name"
+            valueKey="id"
+            @change="onChangeType"
+          />
+        </uni-forms-item>
+        <uni-forms-item
+          v-show="currentType.id === 2 || currentType.id === 3"
+          label="项目"
+        >
+          <comboxSearch
+            emptyTips="无匹配项"
+            placeholder="请选择项目"
+            keyName="fullName"
+            :isJSON="true"
+						:candidates="projectList"
+            @getValue="onChangeProject"
+          />
+          <!-- <ld-select
+            :list="projectList"
+            placeholder="请选择项目"
+            class="select"
+            v-model="formData.projectId"
+            labelKey="fullName"
+            valueKey="ID"
+            @change="onChangeProject"
+          /> -->
+        </uni-forms-item>
+        <uni-forms-item label="子类">
+          <ld-select
+            :list="currentType.children"
+            placeholder="请选择子类"
+            class="select"
+            v-model="formData.subTypeId"
+            labelKey="name"
+            valueKey="id"
+						:disabled="currentType == 2"
+            @change="onChangeSubType"
+          />
+        </uni-forms-item>
+        <uni-forms-item label="日期">
+          <view class="date">{{ this.day }}</view>
+        </uni-forms-item>
+      </uni-forms>
+    </view>
+    <view class="group">
+      <button @click="close" class="button">取消</button>
+      <button @click="submit" type="primary">保存</button>
+    </view>
+  </view>
+</template>
+<script>
+import comboxSearch from "@/components/cuihai-combox/cuihai-combox";
+import { addWorkHours, queryProject } from "@/services/workload";
+import { mapState } from "vuex";
+export default {
+  components: { comboxSearch },
+  computed: {
+    ...mapState(["typeList"]),
+    projectList() {
+      let list = [];
+      let type = this.currentType;
+      if (type.id == 2) {
+        list.push({
+          fullName: "售前支持(10100)",
+          ID: "0",
+        });
+        return list.concat(this.allProjectList["0"]);
+      }
+      return this.allProjectList["1"];
+    },
+  },
+  data() {
+    return {
+      formData: {},
+      currentType: {},
+      currentSubType: {},
+      allProjectList: [],
+      day: "",
+    };
+  },
+  onLoad(options) {
+    this.day = options.day;
+    this.getProject();
+  },
+  methods: {
+    async getProject() {
+      let data = {};
+      data["0"] = await queryProject({ stage: 0 });
+      data["1"] = await queryProject({ stage: 1 });
+      this.allProjectList = data;
+    },
+    async submit() {
+      let type = this.currentType;
+      let subType = this.currentSubType;
+      let formData = this.formData;
+      if (type.type == 0 || subType.type == 0) {
+        if (!formData.projectId) {
+          uni.showToast({
+            title: "请选择项目",
+            icon: "none",
+          });
+          return;
+        }
+      } else {
+        formData.projectId = "0";
+      }
+      let params = [
+        {
+          type_id: Number(formData.subTypeId),
+          comment: "",
+          data: [
+            {
+              project_id: Number(formData.projectId),
+              workload: 0,
+              day: this.day,
+            },
+          ],
+        },
+      ];
+      // 新增
+      await addWorkHours(params);
+      this.close();
+    },
+    close() {
+      uni.navigateBack();
+    },
+    onChangeType(value) {
+      this.formData = {
+        typeId: value,
+        projectId: null,
+        subTypeId: null,
+      };
+      this.currentType = this.typeList.find((item) => item.id == value) || {};
+      this.currentSubType = {};
+    },
+    onChangeProject(index) {
+			let project = this.projectList[index]
+      this.formData.projectId = project.ID;
+			if(this.currentType.id == 2) {
+				let subList = this.currentType.children;
+				if(project.ID == '0') {
+					this.onChangeSubType(subList[0].id)
+				} else {
+					this.onChangeSubType(subList[1].id)
+				}
+			}
+    },
+    onChangeSubType(value) {
+      this.formData.subTypeId = value;
+      this.currentSubType =
+        this.currentType.children.find((item) => item.id == value) || {};
+    },
+  },
+};
+</script>
+<style lang="less" scoped>
+.content {
+  height: 80vh;
+  width: 90%;
+  margin: 0 auto;
+  background: #fff;
+}
+.date {
+  line-height: 70rpx;
+}
+.popup-content {
+  padding: 40rpx;
+}
+.group {
+  width: 100%;
+  display: flex;
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  button {
+    width: 50%;
+    border-radius: 0;
+  }
+}
+.select {
+  width: 100%;
+  margin-bottom: 25rpx;
+  background: #fff;
+  height: 70rpx;
+  color: #777777;
+  padding-left: 20rpx;
+  font-size: 24rpx;
+  border-radius: 0px;
+  border-bottom: 1px solid #333;
+}
+</style>

+ 167 - 81
pages/index/index.vue

@@ -1,12 +1,16 @@
 <template>
   <view class="content">
+    <!-- <button class="btn-add" @click="toAdd" type="primary">新增</button> -->
     <uni-calendar
       class="uni-calendar--hook"
       :selected="info.selected"
       :showMonth="false"
       @change="change"
-    />
-    <button @click="showModal" type="primary">新增</button>
+      @monthSwitch="monthSwitch"
+    >
+      <text @click="toAdd">新增工时</text>
+    </uni-calendar>
+    <!-- <button @click="showModal" type="primary">新增</button> -->
     <uni-collapse ref="collapse">
       <uni-collapse-item
         v-for="collapse in collapseList"
@@ -14,54 +18,53 @@
         :title="collapse.name"
       >
         <view class="content">
-          <template v-for="(item, index) in collapse.children">
-            <uni-card
-              :key="index"
-              :title="allType[item.type_id] && allType[item.type_id].name"
-            >
-              <view class="uni-body">
-                <view class="detail-item" v-if="item.project_id != '0'">
-                  <view class="detail-label">所属项目</view>
-                  <view class="detail-value">
-                    {{ getProject(item.project_id) }}
-                  </view>
-                </view>
-                <view class="detail-item">
-                  <view class="detail-label">审核状态</view>
-                  <view
-                    class="detail-value"
-                    :style="{ color: stateColor[item.audit_state] }"
-                  >
-                    {{ auditState[item.audit_state] }}
-                  </view>
-                </view>
-                <view class="detail-item" v-if="item.audit_state == 3">
-                  <view class="detail-label">拒绝原因</view>
-                  <view class="detail-value">
-                    {{ item.audit_desc }}
-                  </view>
+          <uni-card
+            v-for="(item, index) in collapse.children"
+            :key="index"
+            :title="allType[item.type_id] && allType[item.type_id].name"
+          >
+            <view class="uni-body">
+              <view class="detail-item" v-if="item.project_id != '0'">
+                <view class="detail-label">所属项目</view>
+                <view class="detail-value">
+                  {{ getProject(item.project_id) }}
                 </view>
-                <view class="detail-item">
-                  <view class="detail-label">工时</view>
-                  <view class="detail-value">
-                    {{ item.workload }}
-                  </view>
+              </view>
+              <view class="detail-item">
+                <view class="detail-label">审核状态</view>
+                <view
+                  class="detail-value"
+                  :style="{ color: stateColor[item.audit_state] }"
+                >
+                  {{ auditState[item.audit_state] }}
                 </view>
               </view>
-              <view
-                v-if="item.audit_state == 0 || item.audit_state == 3"
-                slot="actions"
-                class="card-actions"
-              >
-                <view class="card-actions-item" @click="onHandleSave(item)">
-                  <text class="card-actions-item-text">修改工时</text>
+              <view class="detail-item" v-if="item.audit_state == 3">
+                <view class="detail-label">拒绝原因</view>
+                <view class="detail-value">
+                  {{ item.audit_desc }}
                 </view>
-                <view class="card-actions-item" @click="onHandleAudit(item)">
-                  <text class="card-actions-item-text">上报审批</text>
+              </view>
+              <view class="detail-item">
+                <view class="detail-label">工时</view>
+                <view class="detail-value">
+                  {{ item.workload }}
                 </view>
               </view>
-            </uni-card>
-          </template>
+            </view>
+            <view
+              v-if="item.audit_state == 0 || item.audit_state == 3"
+              slot="actions"
+              class="card-actions"
+            >
+              <view class="card-actions-item" @click="onHandleSave(item)">
+                <text class="card-actions-item-text">修改工时</text>
+              </view>
+              <view class="card-actions-item" @click="onHandleAudit(item, 0)">
+                <text class="card-actions-item-text">上报审批</text>
+              </view>
+            </view>
+          </uni-card>
         </view>
       </uni-collapse-item>
     </uni-collapse>
@@ -83,12 +86,22 @@
         @confirm="auditConfirm"
       ></uni-popup-dialog>
     </uni-popup>
-    <AddModal
+    <!-- <AddModal
       ref="addModal"
       @submit="onSubmit"
       :projectList="projectList"
       :typeList="typeList"
-    />
+    /> -->
+    <view class="group">
+      <button @click="onHandleAudit({}, 2)" type="primary">上报本月工时</button>
+      <button
+        v-show="collapseList.length > 0"
+        @click="onHandleAudit({}, 1)"
+        class="button"
+      >
+        上报今日工时
+      </button>
+    </view>
   </view>
 </template>
 
@@ -128,7 +141,9 @@ export default {
         2: "已通过",
         3: "已拒绝",
       },
+      auditType: 0,
       day: moment().format("YYYY-MM-DD"),
+      monthDate: moment(),
     };
   },
   onNavigationBarButtonTap(e) {
@@ -136,9 +151,12 @@ export default {
       url: "../audit/index",
     });
   },
-  onReady() {
+  onLoad() {
     this.init();
   },
+  onShow() {
+    this.queryWorkHours();
+  },
   computed: {
     ...mapState(["allType", "typeList"]),
     collapseList() {
@@ -158,14 +176,22 @@ export default {
   methods: {
     async init() {
       await this.$store.dispatch("getType");
-
       this.projectList = await queryProject();
-      await this.queryWorkHours();
+      this.queryWorkHours();
     },
     change(e) {
+      console.log(e);
       this.day = e.fulldate;
       this.currentList = e.extraInfo.list || [];
     },
+    monthSwitch(e) {
+      console.log(e);
+      this.monthDate = moment(`${e.year}-${e.month}-01`, "YYYY-MM-DD");
+      console.log(this.monthDate);
+      this.queryWorkHours();
+      // this.day = e.fulldate;
+      // this.currentList = e.extraInfo.list || [];
+    },
     getProject(id) {
       let p = this.projectList.find((p) => p.ID == id);
       if (!p) return "";
@@ -175,8 +201,9 @@ export default {
       this.currentItem = item;
       this.$refs.inputDialog.open();
     },
-    onHandleAudit(item) {
+    onHandleAudit(item, type) {
       this.currentItem = item;
+      this.auditType = type;
       this.$refs.auditDialog.open();
     },
     async dialogInputConfirm(workload) {
@@ -226,28 +253,68 @@ export default {
       await this.queryWorkHours();
     },
     async auditConfirm() {
-      let item = this.currentItem;
-      let params = [
-        {
+      let type = this.auditType;
+      let params;
+      const getData = (item) => {
+        return {
           type_id: Number(item.type_id),
           data: [
             {
               id: item.id,
               project_id: item.project_id,
               workload: item.workload,
-              day: item.time,
+              day: item.day,
             },
           ],
-        },
-      ];
-
+        };
+      };
+      if (type == 0) {
+        params = [getData(this.currentItem)];
+      } else if (type == 1) {
+        let auditList = this.currentList.filter(
+          (item) => item.audit_state == 0 || item.audit_state == 3
+        );
+        if (auditList.length == 0) {
+          uni.showToast({
+            title: "本日没有待上报工时!",
+            icon: "none",
+          });
+          return;
+        }
+        params = auditList.map((item) => getData(item));
+      } else {
+        let auditList = [];
+        this.info.selected.forEach((s) => {
+          if (s.list) {
+            auditList = auditList.concat(
+              s.list.filter(
+                (item) => item.audit_state == 0 || item.audit_state == 3
+              )
+            );
+          }
+        });
+        if (auditList.length == 0) {
+          uni.showToast({
+            title: "本月没有待上报工时!",
+            icon: "none",
+          });
+          return;
+        }
+        params = auditList.map((item) => getData(item));
+      }
       await addAuthWorkHours(params);
       this.queryWorkHours();
       this.$refs.auditDialog.close();
     },
     async queryWorkHours() {
+      let date = this.monthDate;
+      let s_time = date.format("YYYY-MM-01 00:00:00");
+      let e_time = moment(s_time)
+        .add("month", 1)
+        .add("days", -1)
+        .format("YYYY-MM-DD 23:59:59");
       const user = uni.getStorageSync("user");
-      const data = await queryWorkHours({ user_id: user.ID });
+      const data = await queryWorkHours({ user_id: user.ID, s_time, e_time });
       let selected = [];
       Object.keys(data).map((day) => {
         let list = data[day];
@@ -271,27 +338,32 @@ export default {
       });
       this.info.selected = selected;
     },
-    async onSubmit(values) {
-      let params = [
-        {
-          type_id: Number(values.subTypeId),
-          comment: "",
-          data: [
-            {
-              project_id: Number(values.projectId),
-              workload: 0,
-              day: this.day,
-            },
-          ],
-        },
-      ];
-      // 新增
-      await addWorkHours(params);
-      this.queryWorkHours();
-    },
-    showModal() {
-      this.$refs.addModal.open();
+    toAdd() {
+      uni.navigateTo({
+        url: `./add?day=${this.day}`,
+      });
     },
+    // async onSubmit(values) {
+    //   let params = [
+    //     {
+    //       type_id: Number(values.subTypeId),
+    //       comment: "",
+    //       data: [
+    //         {
+    //           project_id: Number(values.projectId),
+    //           workload: 0,
+    //           day: this.day,
+    //         },
+    //       ],
+    //     },
+    //   ];
+    //   // 新增
+    //   await addWorkHours(params);
+    //   this.queryWorkHours();
+    // },
+    // showModal() {
+    //   this.$refs.addModal.open();
+    // },
   },
 };
 </script>
@@ -300,10 +372,11 @@ export default {
 .content {
   padding: 30rpx;
   padding-top: 0;
+  padding-bottom: 60px;
 }
-.button {
-  margin-right: 20rpx;
-}
+// .button {
+//   margin-right: 20rpx;
+// }
 .card-actions {
   display: flex;
   flex-direction: row;
@@ -322,4 +395,17 @@ export default {
     text-align: right;
   }
 }
+.group {
+  width: 100%;
+  display: flex;
+  position: fixed;
+  justify-content: flex-start;
+  bottom: 0;
+  left: 0;
+  button {
+    width: 50%;
+    border-radius: 0;
+    margin: inherit;
+  }
+}
 </style>

+ 6 - 3
services/workload.js

@@ -69,9 +69,12 @@ export async function queryAuthWorkHours(params = {}) {
   return data;
 }
 
-export async function queryProject() {
-  const res = await request(`v2/workload/project`, "GET", {});
-  return res.data.list;
+export async function queryProject(data) {
+  const res = await request(`v2/workload/project`, "GET", data);
+  return res.data.list.map(item => ({
+    ...item,
+    fullName: `${item.Name}(${item.Code})`
+  }));
 }
 /** id,status,desc */
 export async function authWorkload(data) {

BIN
static/cuihai-combox/arrow_down.png


+ 5 - 1
uni_modules/uni-calendar/components/uni-calendar/uni-calendar.vue

@@ -20,7 +20,10 @@
 				<view class="uni-calendar__header-btn-box" @click.stop="next">
 					<view class="uni-calendar__header-btn uni-calendar--right"></view>
 				</view>
-				<text class="uni-calendar__backtoday" @click="backtoday">{{todayText}}</text>
+				<!-- <text class="uni-calendar__backtoday" @click="backtoday">{{todayText}}</text> -->
+				<text class="uni-calendar__backtoday">
+					<slot></slot>
+				</text>
 
 			</view>
 			<view class="uni-calendar__box">
@@ -215,6 +218,7 @@
 				const value = e.detail.value + '-1'
 				console.log(this.cale.getDate(value));
 				this.init(value)
+				this.monthSwitch()
 			},
 			/**
 			 * 初始化日期显示