123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699 |
- <template>
- <div class="bgColor">
- <div slot="content" class="scroll-wrapper">
- <div class="demo">
- <div class="header">耗材列表</div>
- <div class="seatchHeader">
- <div class="search fl">
- <input
- class="searchInp"
- type="text"
- v-model="title"
- placeholder="可通过名称、型号品牌进行检索支持拼音"
- @input="searchData()"
- />
- </div>
- <!-- <button class="selectBtn fr" @click="showPicker">筛选</button> -->
- </div>
- <div class="scroll-list-wrap">
- <cube-scroll
- ref="scroll"
- :data="items"
- :options="options"
- @pulling-down="onPullingDown"
- @pulling-up="onPullingUp"
- >
- <div class="conentBox">
- <div
- class="conent"
- v-for="(item, index) in items"
- @click="showModal(item)"
- :key="index"
- >
- <div class="head">
- <p>
- <span>{{ item.name }}</span>
- <span>{{ item.brandModel }}</span>
- </p>
- </div>
- <div class="center">
- <p>
- <span class="fl"></span>
- <span class="grayFont overflowEllipsis2">{{item.endPrice}}元</span>
- </p>
- </div>
- </div>
- <div class="wushuju" v-show="wushuju">
- <img src="./../../static/images/wushuju.svg" alt />
- <p>暂无数据</p>
- </div>
- </div>
- <template v-if="customPullDown" slot="pulldown" slot-scope="props">
- <div
- v-if="props.pullDownRefresh"
- class="cube-pulldown-wrapper"
- :style="props.pullDownStyle"
- >
- <div
- v-show="props.beforePullDown"
- class="before-trigger"
- :style="{ paddingTop: props.bubbleY + 'px' }"
- >
- <span
- :class="{
- rotate: props.bubbleY > pullDownRefreshThreshold - 40
- }"
- >↓</span
- >
- </div>
- <div class="after-trigger" v-show="!props.beforePullDown">
- <div v-show="props.isPullingDown" class="loading">
- <cube-loading></cube-loading>
- </div>
- <div v-show="!props.isPullingDown" class="text">
- <span class="refresh-text">更新成功</span>
- </div>
- </div>
- </div>
- </template>
- </cube-scroll>
- </div>
- </div>
- </div>
- <load-ing v-if="!items.length && !wushuju"></load-ing>
- <!-- 弹窗 -->
- <showModel
- v-if="models.disjunctor"
- :title="models.title"
- :icon="models.icon"
- :disjunctor="models.disjunctor"
- @ok="ok"
- @cancel="cancel"
- :operate="models.operate"
- selectName="hc_add"
- :data="hcData"
- ></showModel>
- </div>
- </template>
- <script>
- import Vue from "vue";
- import showModel from "../components/showModel/showModel.vue";
- import CubePage from "../components/cube-page.vue";
- import SwitchOption from "../components/switch-option";
- import InputOption from "../components/input-option";
- import SelectOption from "../components/select-option";
- import LoadIng from "./loading.vue";
- export default {
- data() {
- return {
- hcData: {},
- modelsData: {}, //点击弹窗的那一项数据
- // 弹窗model
- models: {
- disjunctor: false
- },
- valConfig: JSON.parse(localStorage.getItem("valConfig")) - 0, //报修主体
- items: [],
- pullDownRefresh: true,
- pullDownRefreshThreshold: 60,
- pullDownRefreshStop: 40,
- pullDownRefreshTxt: "Refresh success",
- pullUpLoad: true,
- pullUpLoadThreshold: 0,
- pullUpLoadMoreTxt: "加载更多",
- pullUpLoadNoMoreTxt: "没有更多数据",
- customPullDown: true,
- wushuju: false,
- title: "", //搜索内容
- // stateData: [
- // {
- // text: "全部",
- // value: "all"
- // },
- // {
- // text: "待处理",
- // value: "todo"
- // },
- // {
- // text: "处理过",
- // value: "done"
- // }
- // ],
- // stateValue: "todo",
- sum: 20,
- idx: 0,
- stateClass: "",
- loadShow: true,
- searching: false
- };
- },
- components: {
- CubePage,
- SwitchOption,
- InputOption,
- SelectOption,
- LoadIng,
- showModel,
- },
- computed: {
- options() {
- return {
- pullDownRefresh: this.pullDownRefreshObj,
- pullUpLoad: this.pullUpLoadObj,
- scrollbar: true
- };
- },
- pullDownRefreshObj: function() {
- return this.pullDownRefresh
- ? {
- threshold: parseInt(this.pullDownRefreshThreshold),
- txt: this.pullDownRefreshTxt
- }
- : false;
- },
- pullUpLoadObj: function() {
- return this.pullUpLoad
- ? {
- threshold: parseInt(this.pullUpLoadThreshold),
- txt: {
- more: this.pullUpLoadMoreTxt,
- noMore: this.pullUpLoadNoMoreTxt
- }
- }
- : false;
- }
- },
- methods: {
- //确定
- ok(data) {
- console.log(data);
- const reg = /(^[1-9][0-9]*$)/;
- if(!reg.test(data.consumablesNum)){
- this.$createDialog({
- type: "alert",
- title: "请输入大于0的正整数!",
- icon: "cubeic-warn"
- }).show();
- return;
- }
- const toast = this.$createToast({
- txt: "Loading...",
- mask: true
- });
- toast.show();
- this.$http
- .post("service/bpm/data/addSummaryDoc", {
- "consumableList": [
- {
- "consumablesId": data.hc.id,
- "consumablesNum": data.consumablesNum
- }
- ],
- "summaryId": this.$route.params.summaryId
- })
- .then(res => {
- toast.hide();
- this.models.disjunctor = false;
- if (res.data.status == 200) {
- this.$createDialog({
- type: "alert",
- title: "操作成功",
- icon: "cubeic-right",
- onConfirm: (e, promptValue) => {
- this.loadShow = false;
- this.items = [];
- this.idx = 0;
- this.$router.push({
- path: `/summaryOrder/${this.$route.params.incidentId}/${this.$route.params.processInstanceId}`
- })
- }
- }).show();
- } else {
- this.$createDialog({
- type: "alert",
- title: "系统错误,请稍后再试!",
- icon: "cubeic-wrong",
- onConfirm: (e, promptValue) => {
- this.loadShow = false;
- this.items = [];
- this.idx = 0;
- this.$router.push({
- path: `/summaryOrder/${this.$route.params.incidentId}/${this.$route.params.processInstanceId}`
- })
- }
- }).show();
- }
- });
- },
- //取消
- cancel() {
- this.models.disjunctor = false;
- },
- // 弹窗
- showModal(item) {
- this.modelsData = item;
- this.hcData = {
- hc: item,
- incidentId: this.$route.params.incidentId,
- summaryId: this.$route.params.summaryId,
- }
- this.models = {
- disjunctor: true,
- title: "提示",
- icon: "warn",
- operate: {
- ok: "确定",
- cancel: "取消"
- }
- };
- },
- getParamsState() {
- console.log(this.$route.params.state)
- if (this.$route.params.state) {
- console.log(this.$route.params.state);
- this.stateValue = this.$route.params.state;
- }
- },
- showPicker() {
- if (!this.picker) {
- this.picker = this.$createPicker({
- title: "",
- data: [this.stateData],
- selectedIndex: [1],
- onSelect: this.selectHandle,
- onCancel: this.cancelHandle
- });
- }
- this.picker.show();
- },
- selectHandle(selectedVal, selectedIndex, selectedText) {
- console.log(selectedVal, selectedIndex, selectedText);
- this.stateValue = selectedVal[0];
- this.items = [];
- this.getData();
- },
- cancelHandle() {},
- // 搜索
- searchData() {
- this.items = [];
- this.searching = true;
- this.getData();
- },
- // 获取列表
- getData() {
- console.log(this.stateValue);
- if (this.searching) {
- this.idx = 0;
- }
- let title = this.title;
- let postData = {
- idx: this.idx,
- sum: this.sum,
- consumable: {
- keyWord: this.title || '',
- }
- };
- this.$http
- .post(
- "service/bpm/data/fetchDataList/consumable",
- postData
- )
- .then((res) => {
- if(res.status == 200){
- if(title == this.title){
- if (res.data.list.length > 0) {
- this.wushuju = false;
- if (this.searching) {
- this.items = res.data.list;
- } else {
- this.items = this.items.concat(res.data.list);
- }
- } else {
- this.wushuju = this.searching;
- }
- }
- }else{
- this.$createDialog({
- type: "alert",
- title: "操作失败",
- content: "请求失败!",
- icon: "cubeic-wrong"
- }).show();
- }
- this.loadShow = false;
- });
- },
- onPullingDown() {
- // 模拟更新数据
- var that = this;
- that.items = [];
- that.idx = 0;
- that.searching = false;
- setTimeout(() => {
- that.getData();
- }, 1000);
- },
- onPullingUp() {
- var that = this;
- that.idx = that.idx + 1;
- that.searching = false;
- that.getData();
- },
- updatePullDownRefresh(val) {
- this.pullDownRefresh = val;
- },
- updatePullDownRefreshThreshold(val) {
- this.pullDownRefreshThreshold = val;
- },
- updatePullDownRefreshTxt(val) {
- this.pullDownRefreshTxt = val;
- },
- updatePullUpLoad(val) {
- this.pullUpLoad = val;
- },
- updatePullUpLoadThreshold(val) {
- this.pullUpLoadThreshold = val;
- },
- updatePullUpLoadMoreTxt(val) {
- this.pullUpLoadMoreTxt = val;
- },
- updatePullUpLoadNoMoreTxt(val) {
- this.pullUpLoadNoMoreTxt = val;
- },
- updateCustomPullDown(val) {
- this.customPullDown = val;
- },
- rebuildScroll() {
- Vue.nextTick(() => {
- this.$refs.scroll.destroy();
- this.$refs.scroll.initScroll();
- });
- }
- },
- created() {
- // this.$route.params.data
- // this.getParamsState();
- this.getData(this.idx, this.sum);
- }
- };
- </script>
- <style lang="stylus" rel="stylesheet/stylus" scoped>
- .scroll-list-wrap {
- /* height: 350px */
- height: 90vh;
- /* border: 1px solid rgba(0, 0, 0, 0.1) */
- border-radius: 5px;
- transform: rotate(0deg); // fix 子元素超出边框圆角部分不隐藏的问题
- // overflow: hidden;
- padding-top: 1.76rem;
- }
- .foods-wrapper {
- .food-item {
- display: flex;
- /* padding: 18px */
- /* border-bottom: 1px solid rgba(7, 17, 27, 0.1) */
- /* border-top: 1px solid rgba(7, 17, 27, 0.1)!important */
- &:last-child {
- border-none();
- margin-bottom: 0;
- }
- .icon {
- flex: 0 0 57px;
- margin-right: 10px;
- }
- .food-content {
- flex: 1;
- .name {
- margin: 2px 0 8px 0;
- height: 14px;
- line-height: 14px;
- font-size: 14px;
- color: rgb(7, 17, 27);
- }
- .description, .extra {
- line-height: 10px;
- font-size: 10px;
- color: rgb(147, 153, 159);
- }
- .description {
- line-height: 12px;
- margin-bottom: 8px;
- }
- .extra {
- .count {
- margin-right: 12px;
- }
- }
- .price {
- font-weight: 700;
- line-height: 24px;
- .now {
- margin-right: 8px;
- font-size: 14px;
- color: rgb(240, 20, 20);
- }
- .old {
- text-decoration: line-through;
- font-size: 10px;
- color: rgb(147, 153, 159);
- }
- }
- .cartcontrol-wrapper {
- position: absolute;
- right: 0;
- bottom: 12px;
- .scroll-wrapper {
- .cube-pulldown-wrapper {
- .before-trigger {
- font-size: 30px;
- line-height: 30px;
- align-self: flex-end;
- span {
- display: inline-block;
- transition: all 0.3s;
- color: #666;
- &.rotate {
- transform: rotate(180deg);
- }
- }
- }
- .after-trigger {
- .refresh-text {
- color: grey;
- }
- }
- }
- }
- }
- }
- }
- }
- </style>
- <style lang="less" scoped>
- .bgColor {
- background-color: white;
- }
- .food-item {
- border-top: 0.16rem rgb(238, 238, 238) solid;
- }
- .food-content {
- border-top: 0.01rem rgb(223, 222, 222) solid;
- border-bottom: 0.01rem rgb(223, 222, 222) solid;
- }
- .title {
- display: flex;
- justify-content: space-between;
- height: 0.7rem;
- line-height: 0.7rem;
- border-top: 0.01rem rgb(223, 222, 222) solid;
- padding: 0 0.24rem;
- border-bottom: 0.01rem rgb(223, 222, 222) solid;
- }
- .title i {
- font-size: 0.32rem;
- color: #005395;
- }
- .title div:nth-child(1) {
- font-size: 0.32rem;
- }
- .title div:nth-child(1) span {
- display: inline-block;
- margin-left: 0.08rem;
- }
- .title div:nth-child(2) {
- padding: 0.05rem 0.3rem;
- /* border: 0.01rem rgb(0,0,255) solid; */
- border-radius: 16px;
- /* color: rgb(0,0,255); */
- height: 0.25rem;
- line-height: 0.25rem;
- margin-top: 0.15rem;
- font-size: 0.24rem;
- }
- .weishouli {
- color: #991f00;
- border: 0.01rem #991f00 solid;
- background-color: #f4e8e5;
- }
- .bushouli {
- color: #666666;
- background-color: #eeeeee;
- border: 0.01rem #666666 solid;
- }
- .chulizhong {
- color: #003057;
- background-color: #e5eaee;
- border: 0.01rem #003057 solid;
- }
- .daipingjia {
- color: #825b00;
- background-color: #f2eee5;
- border: 0.01rem #825b00 solid;
- }
- .yijiejue {
- color: #40a19c;
- background-color: #ebf5f5;
- border: 0.01rem #40a19c solid;
- }
- .yichehui {
- color: #48a843;
- background-color: #ecf6ec;
- border: 0.01rem #48a843 solid;
- }
- .timeBox {
- display: flex;
- justify-content: space-between;
- font-size: 0.24rem;
- color: #999999;
- border-top: 0.01rem rgb(223, 222, 222) solid;
- height: 0.7rem;
- line-height: 0.7rem;
- padding: 0 0.24rem 0 0.64rem;
- }
- .wushuju {
- margin-top: 2.4rem;
- text-align: center;
- color: #999;
- }
- .wushuju img {
- width: 5.12rem;
- height: 2.84rem;
- }
- .demo {
- .header {
- width: 100%;
- height: 0.88rem;
- line-height: 0.88rem;
- text-align: center;
- color: #fff;
- font-size: 0.37rem;
- background: linear-gradient(#2e2f32, #414246);
- position: fixed;
- top: 0;
- z-index: 6;
- }
- .seatchHeader {
- width: 100%;
- background-color: #eee;
- padding: 0.16rem;
- overflow: hidden;
- position: fixed;
- top: 0.88rem;
- z-index: 6;
- box-sizing: border-box;
- .search {
- width: 100%;
- height: 0.56rem;
- font-size: 0.26rem;
- color: #b2b2b2;
- box-sizing: border-box;
- .searchInp {
- text-align: center;
- background-color: #fff;
- width: 100%;
- height: 100%;
- border-radius: 0.09rem;
- border: none;
- &:focus {
- outline: none;
- }
- }
- }
- .selectBtn {
- width: 1.2rem;
- height: 0.56rem;
- font-size: 0.32rem;
- color: #005395;
- border-color: #005395;
- background-color: #fff;
- border-radius: 0.09rem;
- &:focus {
- outline: none;
- }
- }
- }
- }
- .conentBox {
- width: 100%;
- .conent {
- font-size: 0.32rem;
- font-weight: 400;
- line-height: 0.45rem;
- border-bottom: 0.16rem solid #e5e5e5;
- .head {
- border-bottom: 0.01rem solid #e6e6e6;
- p {
- padding: 0.24rem 0.48rem;
- display: flex;
- justify-content: space-between;
- align-items: center;
- i {
- color: #00559d;
- }
- .btn {
- float: right;
- }
- }
- }
- .center {
- color: #333333;
- border-bottom: 0.01rem solid #e6e6e6;
- padding: 0.24rem 0.48rem;
- p {
- display: flex;
- justify-content: space-between;
- align-items: center;
- .grayFont {
- color: #666;
- }
- }
- }
- .bottom {
- overflow: hidden;
- line-height: 0.86rem;
- border-bottom: 0.01rem solid #e6e6e6;
- font-size: 0.24rem;
- color: #999;
- padding: 0 0.24rem 0 0.48rem;
- }
- }
- }
- </style>
|