Vue.component('doctor-select', { template: '
医生列表
\ \
无号源
\
', props: ['doctors', 'doctortime', 'iswuhaoyuan'], data: function () { return { keyword: '', doctorList: [], docName: [], selIndex: [] } }, mounted: function () {}, methods: { seldetailTime: function (list, index, ind) { $.extend(list, { 'index': index, 'ind': ind }) this.$emit('seldetail', list) }, handteTime: function (data) { var dateTime = data.date + '' var date = dateTime.split(' ')[0] var week = getWeek(date) var riqi = date.split('/') riqi = this.add0(riqi[1]) + '-' + this.add0(riqi[2]) var isMo = data.time if (isMo == 'a') { isMo = '上午' } else { isMo = '下午' } return ' ' + riqi + ' ' + week + isMo + ' ' }, add0: function (num) { if (num < 10) { return '0' + num } else { return num } }, selDoc: function () { var len = this.doctorList.length if (this.keyword.length < 1) { for (var i = 0; i < len; i++) { this.$set(this.doctorList, i, $.extend({}, this.doctorList[i], { 'isShow': false })) } return } var reg = new RegExp(this.keyword) for (var i = 0; i < len; i++) { if (this.docName[i].match(reg)) { this.$set(this.doctorList, i, $.extend({}, this.doctorList[i], { 'isShow': false })) } else { this.$set(this.doctorList, i, $.extend({}, this.doctorList[i], { 'isShow': true })) } } }, handleFee: function (arr) { if (arr && arr.length > 0) { return arr[0].fee } else { return '' } } }, watch: { doctors: function (list) { this.doctorList = list for (var i = 0, len = list.length; i < len; i++) { this.docName[i] = list[i].name } } } })