|
@@ -1,58 +1,49 @@
|
|
Component({
|
|
Component({
|
|
- props: {
|
|
|
|
- show: false,
|
|
|
|
- dateList: [],
|
|
|
|
- onChange: () => null
|
|
|
|
- },
|
|
|
|
- data: {
|
|
|
|
- activeIndex: -1,
|
|
|
|
- scrollLeft: 0
|
|
|
|
- },
|
|
|
|
|
|
+ props: {
|
|
|
|
+ show: false,
|
|
|
|
+ dateList: [],
|
|
|
|
+ onChange: () => null,
|
|
|
|
+ },
|
|
|
|
+ data: {
|
|
|
|
+ activeIndex: -1,
|
|
|
|
+ scrollLeft: 0,
|
|
|
|
+ },
|
|
|
|
|
|
- didMount() {},
|
|
|
|
|
|
+ didMount() {},
|
|
|
|
|
|
- methods: {
|
|
|
|
- updateState(state) {
|
|
|
|
- return new Promise(resolve => this.setData(state, resolve));
|
|
|
|
- },
|
|
|
|
|
|
+ methods: {
|
|
|
|
+ updateState(state) {
|
|
|
|
+ return new Promise((resolve) => this.setData(state, resolve));
|
|
|
|
+ },
|
|
|
|
|
|
- async onScroll(e) {
|
|
|
|
- const {
|
|
|
|
- scrollLeft
|
|
|
|
- } = e.detail;
|
|
|
|
- await this.updateState({
|
|
|
|
- scrollLeft
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
|
|
+ async onScroll(e) {
|
|
|
|
+ const { scrollLeft } = e.detail;
|
|
|
|
+ await this.updateState({
|
|
|
|
+ scrollLeft,
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
|
|
- async onSelectAll() {
|
|
|
|
- const {
|
|
|
|
- activeIndex
|
|
|
|
- } = this.data;
|
|
|
|
- if (activeIndex === -1) return;
|
|
|
|
- await this.updateState({
|
|
|
|
- scrollLeft: 0,
|
|
|
|
- activeIndex: -1
|
|
|
|
- });
|
|
|
|
- this.props.onChange('');
|
|
|
|
- },
|
|
|
|
|
|
+ async onSelectAll() {
|
|
|
|
+ const { activeIndex } = this.data;
|
|
|
|
+ if (activeIndex === -1) return;
|
|
|
|
+ await this.updateState({
|
|
|
|
+ scrollLeft: 0,
|
|
|
|
+ activeIndex: -1,
|
|
|
|
+ });
|
|
|
|
+ this.props.onChange("");
|
|
|
|
+ },
|
|
|
|
|
|
- async onSelectOne(e) {
|
|
|
|
- const {
|
|
|
|
- dateList
|
|
|
|
- } = this.props;
|
|
|
|
- const {
|
|
|
|
- activeIndex
|
|
|
|
- } = this.data;
|
|
|
|
- const {
|
|
|
|
- index
|
|
|
|
- } = e.target.dataset;
|
|
|
|
- if (index === activeIndex) return;
|
|
|
|
- this.props.onChange(dateList[index] || '');
|
|
|
|
- await this.updateState({
|
|
|
|
- activeIndex: index
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-});
|
|
|
|
|
|
+ async onSelectOne(e) {
|
|
|
|
+ const { dateList } = this.props;
|
|
|
|
+ const { activeIndex } = this.data;
|
|
|
|
+ const { index } = e.target.dataset;
|
|
|
|
+ if (index === activeIndex) return;
|
|
|
|
+ // 当日HIS显示无号,但是又传递日期进行排号请求时,HIS会返回错误数据,所以需要阻止发起请求
|
|
|
|
+ if (dateList[index].remain <= 0) return;
|
|
|
|
+ this.props.onChange(dateList[index] || "");
|
|
|
|
+ await this.updateState({
|
|
|
|
+ activeIndex: index,
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+});
|