123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <template>
- <view>
- <uni-list>
- <uni-list-item>
- <view slot="body" class="slot-box">
- <view class="row">
- <view class="column-left">当前检查项:</view>
- <view class="column-right section-title">{{listData.entity!=null?listData.entity.projectName:""}}</view>
- </view>
- </view>
- </uni-list-item>
- </uni-list>
- <uni-list>
- <uni-list-item v-for="(item, index) in listData.list" :key="index" >
- <view slot="body" class="slot-box">
- <view class="row">
- <view class="column-left">编号:</view>
- <view class="column-right section-title">{{item.id}}</view>
- </view>
- <view class="row">
- <view class="column-left">材料名:</view>
- <view class="column-right">{{item.materialName}}</view>
- </view>
- <view class="row">
- <view class="column-left">单位:</view>
- <view class="column-right">{{item.unit}}</view>
- </view>
-
- <view class="row">
- <view class="column-left">操作:</view>
- <view class="column-right"><a href="javascript:;" @click="deleteMaterial(item.id)"><i class="fa fa-times" aria-hidden="true"></i></a></view>
- </view>
- </view>
- </uni-list-item>
- </uni-list>
- <view style="bottom: 15px;right:10px;position: fixed;z-index: 50;">
- <router-link :to="'/pages/template/relationMaterialAdd/relationMaterialAdd?SafeQualityCheckCode=' + this.$util.getQuery('id')" style="text-decoration: none;" title="材料添加">
- <uni-icons type="plus-filled" size="80" color="#5678FE"></uni-icons>
- </router-link>
- </view>
- <page-foot :isShow="true" :showIndex="2"></page-foot>
- <uni-load-more :status="status" :icon-size="16" :content-text="contentText" />
-
- </view>
- </template>
- <script>
- import {
- GetZRelationSafeQualityCheckMaterialDTOs,DeleteZRelationSafeQualityCheckMaterial
- } from "@/common/api/SafeQualityCheckApi.js";
- import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
-
- export default {
- components: {
- uniLoadMore
- },
- data() {
- return {
- listData: [],
- last_id: '',
- reload: false,
- status: 'more',
-
- contentText: {
- contentdown: '上拉加载更多',
- contentrefresh: '加载中',
- contentnomore: '没有更多'
- }
- };
- },
- onLoad() {
- console.info("当前登录状态:" + this.$store.state.isLogin);
- //console.info(this);
- this.$util.persistLogin(this);
- },
- onPullDownRefresh() {
- this.reload = true;
- this.last_id = '';
- this.getList();
- },
- onReachBottom() {
- this.status = 'more';
- this.getList();
- },
- created: function() {
- this.getList();
- },
- methods: {
- getList() {
- let that = this;
-
- let id = that.$util.getQuery("id");
-
- GetZRelationSafeQualityCheckMaterialDTOs(id).then((res) => {
- console.info('GetZRelationSafeQualityCheckMaterialDTOs',res);
- that.listData=res;
- console.info(that.listData);
- });
- },
-
- // 删除材料
- deleteMaterial:function(id){
- let that = this;
- uni.showModal({
- title:'提示',
- content:'确定要删除吗,删除后不能恢复!',
- success: function (res) {
- if (res.confirm) {
- console.log('用户点击确定');
- //删除操作
- DeleteZRelationSafeQualityCheckMaterial(id).then((res)=>{
- console.info('DeleteZRelationSafeQualityCheckMaterial',res);
- if(res>0){
- uni.showToast({
- title:'删除成功',
- duration:3000,
- icon:'none'
- });
- let thisid = that.$util.getQuery("id");
- //重新加载数据,以实现刷新
- GetZRelationSafeQualityCheckMaterialDTOs(thisid).then((res) => {
- console.info('GetZRelationSafeQualityCheckMaterialDTOs',res);
- that.listData=res;
- console.info(that.listData);
- });
- }
- else{
- uni.showToast({
- title:'删除失败',
- duration:3000,
- icon:'none'
- });
- }
- });
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- })
-
- }
- }
- };
- </script>
- <style scoped lang="scss">
- .uni-list-item{
- border-bottom: $BgColorBlue;
- }
-
- </style>
|