123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560 |
- <template>
- <view class="content">
- <view class="top-fixed">
- <view class="search-cont">
- <view class="inner2">
- <image class="icon-search" src="/static/images/search.png" mode=""></image>
- <input type="text" v-model="keyword" placeholder="请输入想要搜索的指标" confirm-type="search" @confirm="doSearch" placeholder-style="font-size:28rpx;color:#BBBBBB;font-family: PingFang SC;" />
- </view>
- </view>
- <!-- <u-search bgColor="#F5F7FA" placeholder="请输入想要搜索的指标" v-model="keyword" :showAction="false" @c></u-search> -->
- </view>
- <view class="inner">
- <view class="title-box align-center justify-between">
- 已添加指标(按住左侧按钮拖动排序)
- </view>
- <view class="form-box">
- <drag-sorts :listData="listData" :itemHeight="100" :scrollBoxHeight="600" :isAdd="false" @draged="ed"
- @itemDisabledClick='onDisabledClick'/>
- </view>
- <view class="title-box">
- 用户自设(长按制除)
- </view>
- <view class="form-box">
- <drag-sorts :showDragCtrl="false" :listData="dataList" :itemHeight="100" :scrollBoxHeight="800"
- :isRemove="false" @draged="ed2" @itemAddClick='onAddClick' @itemRemoveClick="onRemove" @navClick='navTo'/>
- </view>
- </view>
- <view class="h20"></view>
- <view class="btn-box2">
- <view class="sub-btn2" @click="navgetTo(orderStatusValue)">
- <image src="/static/images/health/nav_add_icon24.png" class="w48 h48"></image>
- <text>新增自定义指标</text>
- </view>
- <!-- <view class="sub-btn" @click="navgetTo(orderStatusValue)">
- <text>保存</text>
- </view> -->
- </view>
- </view>
- </template>
- <script>
- import dragSorts from '@/components/w-drag-sorts/w-drag-sorts.vue'
- import {
- getPage,
- updateIndicator,
- deleteIndicator,
- listEnabled,
- listByReport,
- listAllEnabledByReportId,
- addResult,
- deleteResult
- } from '@/api/companyUser.js'
- export default {
- components: {
- dragSorts
- },
- data() {
- return {
- curDate: '',
- markDays: [],
- type: null,
- keyword: '',
- patientId: null,
- famaleurl: "/static/images/health/female_profile.png",
- maleurl: "/static/images/health/my_heads.png",
- checked: 1,
- dataList: [],
- listData: [
- // {
- // id:1,
- // icon: '/static/images/苹果.png', //不传该属性,则不显示也不占位
- // text: '大血小板比率(P-LCR)'
- // },
- // {
- // id:2,
- // icon: '/static/images/雪梨.png',
- // text: '血小板体积分布宽度(PDW)'
- // },
- // {
- // id:6,
- // icon: '/static/images/橙子.png',
- // text: '平均血小板体积(MPV)'
- // },
- // {
- // id:5,
- // icon: '/static/images/香蕉.png',
- // text: '血小板压积(PCT)'
- // },
- // {
- // id:4,
- // icon: '/static/images/香蕉.png',
- // text: '血小板压积(PCT)'
- // },
- // {
- // id:3,
- // icon: '/static/images/香蕉.png',
- // text: '血小板压积(PCT)'
- // },
- ],
- form: {
- "abnormalType": "",
- "indicatorCateId": 0,
- "indicatorId": 0,
- "indicatorName": "",
- "isAbnormal": 0,
- "refRange": "",
- "remarks": "",
- // "reportId": 0,
- // "resultId": 0,
- "testResult": "",
- // "testValue": 0,
- "unitName": "",
-
- },
- reportId:null,
- };
- },
- onLoad(options) {
- console.log(options,'o')
- if(options.id){
- this.reportId=options.id
- this.listAllEnabledByReportId()
- this.listByReport()
- }
- uni.$on('refreshEditIndicator', () => {
- this.listAllEnabledByReportId()
- this.listByReport()
- // this.getPage()
- })
- // this.getPage()
- },
- onShow() {
- },
- methods: {
- doSearch(){
- // this.getPage()
- },
- //日历
- onDayClick(data) {
- this.curDate = data.date;
- },
- navgetTo() {
- uni.navigateTo({
- url: '/pages_user/user/addIndicator?type=add'
- })
- },
- navTo(index,item){
- uni.navigateTo({
- url: '/pages_user/user/addIndicator?type=edit&id='+item.indicatorId
- })
- },
- listByReport() {
- listByReport(this.reportId).then(
- res => {
- if (res.code == 200) {
- this.listData = res.data;
- // uni.$emit('refreshInformation');
- } else {
- uni.showToast({
- title: res.msg,
- });
- }
- },
- rej => {}
- );
- },
- listAllEnabledByReportId() {
- var data={
- reportId:this.reportId
- }
- listAllEnabledByReportId(data).then(
- res => {
- if (res.code == 200) {
- this.dataList = res.data
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg,
- });
- }
- },
- rej => {}
- );
- },
- // getPage() {
- // var data = {
- // indicatorName:this.keyword,
- // pageNum: 1,
- // pageSize: 100
- // }
- // getPage(data).then(
- // res => {
- // if (res.code == 200) {
- // this.dataList = res.data.list
- // } else {
- // uni.showToast({
- // icon: 'none',
- // title: res.msg,
- // });
- // }
- // },
- // rej => {}
- // );
- // },
- //排序后的数组
- ed(list) {
- if (list) {
- this.listData = list
- }
- },
- ed2(list) {
- if (list) {
- this.listData = list
- }
- },
- onItemIconClick(index, item) {
- },
- onDisabledClick(index, item) {
- this.listData = this.listData.filter(it => it.indicatorId !== item.indicatorId)
- this.updateResult(item.resultId)
- },
- onAddClick(index, item) {
- this.dataList = this.dataList.filter(it => it.indicatorId !== item.indicatorId)
- // 遍历item的属性,赋值到form(而非遍历form的属性)
- // for(var key in this.form){
- // this.form[key]=item[key]
- // }
- const data = {
- ...this.form, // 保留表单默认值
- indicatorId: item.indicatorId || 0,
- indicatorName: item.indicatorName || "",
- indicatorCateId: Number(item.indicatorCategory) || 0, // 转换为数字类型
- "remarks": "",
- unitId: item.unitId,
- "abnormalType": "",
- // 处理参考范围(合并min和max为refRange)
- refRange: item.referenceMin !== null && item.referenceMax !== null ? `${item.referenceMin}-${item.referenceMax}` : (item.referenceText || ""),
- // 其他字段保持表单默认值或根据需要映射
- isAbnormal: 0, // 异常状态需要根据测量值和参考范围计算
- reportId: this.reportId // 添加reportId
- };
- this.addResult(data)
- },
- addResult(data) {
- addResult(data).then(
- res => {
- if (res.code == 200) {
- uni.showToast({
- icon: 'success',
- title: "操作成功",
- });
- // this.getPage();
- this.listByReport();
- this.listAllEnabledByReportId()
- // setTimeout(function() {
- // uni.$emit('refreshEditIndicator');
- // uni.navigateBack({
- // delta: 1
- // })
- // }, 500);
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg,
- });
- }
- },
- rej => {}
- );
- },
- updateResult(id) {
- deleteResult(id).then(
- res => {
- if (res.code == 200) {
- uni.showToast({
- icon: 'success',
- title: "操作成功",
- });
- this.listByReport();
- this.listAllEnabledByReportId()
- // this.getPage();
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg,
- });
- }
- },
- rej => {}
- );
- },
- onRemove(index,item) {
- console.log(item,'item')
- var that = this
- uni.showModal({
- title: '提示',
- content: '确定删除指标吗',
- success: function(res) {
- if (res.confirm) {
- deleteIndicator(item.indicatorId).then(res => {
- if (res.code == 200) {
- uni.showToast({
- icon: 'success',
- title: '删除成功!',
- });
- // that.listEnabled()
- that.listAllEnabledByReportId()
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg,
- });
- }
- });
- } else if (res.cancel) {
- }
- }
- });
- },
- // 出生日期选择
- bindDateChange: function(e) {
- this.form.birthday = e.target.value
- },
- }
- }
- </script>
- <style lang="scss">
- page {
- height: 100%;
- background: #F5F7FA;
- }
- .content {
- height: 100%;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .top-fixed {
- position: fixed;
- top: 0;
- background: #FFFFFF;
- padding: 20rpx;
- width: 100%;
- box-sizing: border-box;
- z-index: 999;
- }
- .search-cont{
- // padding: 16upx 30upx;
- .inner2{
- box-sizing: border-box;
- width: 100%;
- height: 72upx;
- background: #F5F7FA;
- border-radius: 36upx;
- display: flex;
- align-items: center;
- padding: 0 30upx;
- .icon-search{
- width: 28upx;
- height: 28upx;
- margin-right: 20upx;
- }
- input{
- height: 60upx;
- line-height: 60upx;
- flex: 1;
- }
- }
- }
- .inner {
- // height: calc(100% - 120upx);
- padding: 0 20upx;
- padding-top: 110rpx;
- padding-bottom: 200rpx;
- .title-box {
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #898E91;
- text-align: left;
- padding: 24rpx 0;
- .select-box {
- display: flex;
- align-items: center;
- justify-content: center;
- text {
- font-family: PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #626468;
- margin-left: 8rpx;
- }
- }
- .select-box2 {
- width: 216rpx;
- height: 64rpx;
- background: #FFFFFF;
- border-radius: 32rpx 32rpx 32rpx 32rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- text {
- font-family: PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #626468;
- margin-left: 5rpx;
- }
- }
- }
- .form-box {
- // padding: 0 30upx;
- background: #FFFFFF;
- border-radius: 16upx;
- overflow: hidden;
- // margin-bottom: 20upx;
- .form-title {
- font-family: PingFang SC;
- font-weight: 500;
- font-size: 32rpx;
- color: #626468;
- text-align: left;
- padding: 30rpx 0;
- display: block;
- }
- .form-item {
- padding: 30upx 0;
- display: flex;
- align-items: center;
- justify-content: space-between;
- border-bottom: 1px solid #F1F1F1;
- &:last-child {
- border-bottom: none;
- }
- .left {
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- .time {
- font-family: PingFang SC;
- font-weight: 400;
- font-size: 28rpx;
- color: #898E91;
- text-align: left;
- }
- }
- .check {
- display: flex;
- align-items: center;
- justify-content: center;
- text {
- // font-family: PingFang SC;
- font-weight: 400;
- font-size: 24rpx;
- color: #008FD3;
- margin-left: 16rpx;
- }
- }
- .label {
- // width: 150upx;
- text-align: left;
- font-weight: 500;
- font-size: 32rpx;
- color: #222426;
- text-align: left;
- }
- .num {
- font-family: PingFang SC;
- font-weight: 400;
- font-size: 32rpx;
- color: #222426;
- line-height: 34rpx;
- display: flex;
- align-items: center;
- }
- }
- }
- }
- .btn-box2 {
- z-index: 9999;
- width: 100%;
- padding: 30upx;
- position: fixed;
- bottom: 0;
- left: 0;
- box-sizing: border-box;
- background: #FFFFFF;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding-bottom: 40rpx;
- .sub-btn {
- flex: 1;
- // width: 100%;
- height: 88upx;
- line-height: 88upx;
- text-align: center;
- font-size: 32upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FFFFFF;
- background: #008FD3;
- border-radius: 44upx;
- display: flex;
- align-items: center;
- border: 2rpx solid #008FD3;
- justify-content: center;
- }
- .sub-btn2 {
- flex: auto;
- height: 88upx;
- line-height: 88upx;
- display: flex;
- align-items: center;
- justify-content: center;
- text-align: center;
- font-size: 32rpx;
- color: #fff;
- font-family: PingFang SC;
- font-weight: bold;
- background: #FF5030;
- border-radius: 44rpx 44rpx 44rpx 44rpx;
- margin-right: 20rpx;
- image {
- margin-right: 16rpx;
- }
- }
- }
- }
- </style>
|