1266 lines
34 KiB
Vue
1266 lines
34 KiB
Vue
<template>
|
||
<view>
|
||
<view class="topTab">
|
||
<view class="tab-header">
|
||
<view class="left" >
|
||
<image @click="customNavigateBack" src="@/static/img/back.png" mode=""></image>收样
|
||
</view>
|
||
<view class="right" style="justify-content: flex-end;width: 45%;">
|
||
<!-- 搜索 -->
|
||
<!-- <view class="text-btn">
|
||
<image src="@/static/images/search1.png" style="width: 40rpx;height: 40rpx;" mode=""></image>
|
||
</view> -->
|
||
<!-- 筛选 -->
|
||
<view class="text-btn" @click="filter">
|
||
<image src="@/static/images/filter.png" style="width: 50rpx;height: 50rpx;" mode=""></image>
|
||
<u-badge v-if="sampleTools!=''" :isDot="true" type="primary" style="position: absolute;top: 10rpx;right: 0;"></u-badge>
|
||
</view>
|
||
<!-- 收样 -->
|
||
<view class="add-btn" @click="addCollect">
|
||
<u-icon name="plus" color="#FFF" size="24"></u-icon>
|
||
<text>收样</text>
|
||
<!-- <image src="@/static/img/addIcon.png" mode=""></image> -->
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
</view>
|
||
|
||
<view class="page-content">
|
||
<view class="search">
|
||
<u-search :showAction="true" style="width: 80%;margin: 0 auto;" :input-style="inputStyle" bgColor='#F3F3F3' :searchIconSize="36" v-model="searchValue" actionText="搜索" :animation="false" @custom="searchList" ></u-search>
|
||
</view>
|
||
<view class="main-box">
|
||
<view class="tab-box">
|
||
<view class="tab-item" :class="currentTabIndex == 0 ? 'active' : ''" @click="currentTabIndex = 0">
|
||
未派工
|
||
<view class="activeLine" v-if="currentTabIndex == 0"></view>
|
||
</view>
|
||
<view class="tab-item" :class="currentTabIndex == 1 ? 'active' : ''" @click="currentTabIndex = 1">
|
||
已派工
|
||
<view class="activeLine" v-if="currentTabIndex == 1"></view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 列表 -->
|
||
<view class="list-box" v-if="currentTabIndex == 0">
|
||
<u-list @scrolltolower="scrolltolower" height="75vh">
|
||
<u-list-item v-for="(item, index) in listData" :key="index">
|
||
<view class="list-item" >
|
||
<view class="item-header" @click="goCollectDetail(item)">
|
||
<view class="header-name">
|
||
{{item.customName}}
|
||
</view>
|
||
</view>
|
||
<view class="item-content" >
|
||
<view class="content-box">
|
||
<view class="item-text" @click="goCollectDetail(item)">
|
||
<image class="iconImg" src="../../static/images/time.png" alt="">
|
||
<text class="label">送样时间:</text>
|
||
<text class="info">{{item.sampleTime}}</text>
|
||
</view>
|
||
<view class="item-text" @click="goCollectDetail(item)">
|
||
<image class="iconImg" src="../../static/images/device.png" alt="">
|
||
<text class="label">送样样品:</text>
|
||
<text class="info">{{item.sampleTools}}</text>
|
||
</view>
|
||
|
||
<view class="item-text" style="display: block;">
|
||
<image class="iconImg" src="../../static/images/number.png" alt="">
|
||
<text class="label">批次编号:</text>
|
||
<text class="info">{{item.batchCode}}</text>
|
||
<image src="../../static/images/del.png" @click="delSamples(item)" style="width: 30rpx;height: 30rpx;float: right;margin-right: 20rpx;" alt="">
|
||
<image src="../../static/images/download.png" @click="downloadSamples(item)" style="width: 30rpx;height: 30rpx;float: right;margin-right: 20rpx;" alt="">
|
||
</view>
|
||
<view class="item-text" @click="goCollectDetail(item)">
|
||
<u-icon class="iconImg" name="rmb-circle" color="#2979ff" size="30"></u-icon>
|
||
<text class="label">金额:</text>
|
||
<text class="info">{{item.totalAmount}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="item-footer">
|
||
<view class="foot-status" v-if="!item.teamName">未派工</view>
|
||
<view class="foot-btn" v-if="!item.teamName&&(roleCode=='administrators'||roleCode=='integratedTeamLeader')" @click="sentTeam(item)">派工</view>
|
||
|
||
</view>
|
||
</view>
|
||
</u-list-item>
|
||
</u-list>
|
||
</view>
|
||
<!-- 列表 -->
|
||
<view class="list-box" v-if="currentTabIndex == 1">
|
||
<u-list @scrolltolower="scrolltolower1" height="75vh">
|
||
<u-list-item v-for="(item, index) in listData1" :key="index">
|
||
<view class="list-item" >
|
||
<view class="item-header" @click="goCollectDetail(item)">
|
||
<view class="header-name">
|
||
{{item.customName}}
|
||
</view>
|
||
</view>
|
||
<view class="item-content" >
|
||
<view class="content-box">
|
||
<view class="item-text" @click="goCollectDetail(item)">
|
||
<image class="iconImg" src="../../static/images/time.png" alt="">
|
||
<text class="label">送样时间:</text>
|
||
<text class="info">{{item.sampleTime}}</text>
|
||
</view>
|
||
<view class="item-text" @click="goCollectDetail(item)">
|
||
<image class="iconImg" src="../../static/images/device.png" alt="">
|
||
<text class="label">送样样品:</text>
|
||
<text class="info">{{item.sampleTools}}</text>
|
||
</view>
|
||
<view class="item-text" style="display: block;">
|
||
<image class="iconImg" src="../../static/images/number.png" alt="">
|
||
<text class="label">批次编号:</text>
|
||
<text class="info">{{item.batchCode}}</text>
|
||
<image src="../../static/images/download.png" @click="downloadSamples(item)" style="width: 30rpx;height: 30rpx;float: right;margin-right: 20rpx;" alt="">
|
||
</view>
|
||
<view class="item-text" @click="goCollectDetail(item)">
|
||
<u-icon class="iconImg" name="rmb-circle" color="#2979ff" size="30"></u-icon>
|
||
<text class="label">金额:</text>
|
||
<text class="info">{{item.totalAmount}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="item-footer">
|
||
<view class="foot-status2" v-if="item.teamName">已派工</view>
|
||
</view>
|
||
</view>
|
||
</u-list-item>
|
||
</u-list>
|
||
</view>
|
||
|
||
</view>
|
||
|
||
|
||
<!-- 新增收样表单 -->
|
||
<u-popup :show="addPopup" mode="bottom" @close="closeAdd" >
|
||
<view style="width: 100%;height: 100%;position: relative;background-color: #fff;">
|
||
<view class="add-header">
|
||
<view style="width: 10%;height: 80rpx;"></view>
|
||
<view style="width: 80%;height: 80rpx;line-height: 80rpx;text-align: center;font-weight: bold;">选择送样单位</view>
|
||
<u-icon style="width: 10%;" name="close" color="#000" size="32" @click="closeAdd"></u-icon>
|
||
</view>
|
||
<view class="add-form">
|
||
<u--form ref="uForm" labelPosition="left" labelWidth="80px" style="margin: 40rpx;80rpx" :model="addForm" :rules="rules" >
|
||
<u-form-item label="送样单位" prop="customName" borderBottom required @click="showDept=true">
|
||
<u--input v-model="addForm.customName" suffixIcon="arrow-right" readonly suffixIconStyle="color: #909399;fontSize:24px;" border="none"></u--input>
|
||
</u-form-item>
|
||
<u-form-item label="送样人" prop="sampleUser" borderBottom>
|
||
<u--input v-model="addForm.sampleUser" border="none" maxlength="20"></u--input>
|
||
</u-form-item>
|
||
<u-form-item label="送样日期" prop="sampleTime" borderBottom required @click="openTimePick">
|
||
<u--input v-model="addForm.sampleTime" suffixIcon="calendar" readonly suffixIconStyle="color: #909399;fontSize:24px;" border="none"></u--input>
|
||
</u-form-item>
|
||
|
||
</u--form>
|
||
|
||
<u-datetime-picker
|
||
:show="showDate"
|
||
mode="date" ref="picker"
|
||
@confirm="dateTimeConfirm"
|
||
@cancel="showDate = false"
|
||
></u-datetime-picker>
|
||
|
||
<u-picker :show="showDept" :columns="customerList" keyName="name"
|
||
@confirm="deptConfirm" title="送样单位"
|
||
@cancel="showDept = false"
|
||
></u-picker>
|
||
</view>
|
||
|
||
<view class="submit-box">
|
||
<u-button type="primary" shape="square" class="submit-add" @click="addConfirm">确 认</u-button>
|
||
</view>
|
||
</view>
|
||
</u-popup>
|
||
|
||
<!-- 修改收样表单 -->
|
||
<u-popup :show="editPopup" mode="bottom" @close="closeEdit" >
|
||
<view style="width: 100%;height: 100%;position: relative;background-color: #fff;">
|
||
<view class="add-header">
|
||
<view style="width: 10%;height: 80rpx;"></view>
|
||
<view style="width: 80%;height: 80rpx;line-height: 80rpx;text-align: center;font-weight: bold;">修改送样批次信息</view>
|
||
<u-icon style="width: 10%;" name="close" color="#000" size="32" @click="closeAdd"></u-icon>
|
||
</view>
|
||
<view class="add-form">
|
||
<u--form ref="eForm" labelPosition="left" labelWidth="80px" style="margin: 40rpx;80rpx" :model="editForm" :rules="eRules" >
|
||
<u-form-item label="送样单位" prop="customName" borderBottom required>
|
||
<u--input v-model="editForm.customName" suffixIcon="arrow-right" readonly suffixIconStyle="color: #909399;fontSize:24px;" border="none"></u--input>
|
||
</u-form-item>
|
||
<u-form-item label="送样人" prop="sampleUser" borderBottom>
|
||
<u--input v-model="editForm.sampleUser" border="none" maxlength="20"></u--input>
|
||
</u-form-item>
|
||
<u-form-item label="送样日期" prop="sampleTime" borderBottom required @click="showDate2=true">
|
||
<u--input v-model="editForm.sampleTime" suffixIcon="calendar" readonly suffixIconStyle="color: #909399;fontSize:24px;" border="none"></u--input>
|
||
</u-form-item>
|
||
|
||
</u--form>
|
||
|
||
<u-datetime-picker
|
||
:show="showDate2"
|
||
mode="date"
|
||
@confirm="dateTimeConfirm2"
|
||
@cancel="showDate2 = false"
|
||
></u-datetime-picker>
|
||
|
||
<u-picker :show="showDept2" :columns="customerList" keyName="name"
|
||
@confirm="deptConfirm2" title="送样单位"
|
||
@cancel="showDept2 = false"
|
||
></u-picker>
|
||
</view>
|
||
|
||
<view class="submit-box">
|
||
<u-button type="primary" shape="square" class="submit-add" @click="editConfirm">确 认</u-button>
|
||
</view>
|
||
</view>
|
||
</u-popup>
|
||
|
||
<!-- 筛选表单 -->
|
||
<u-popup :show="showFilter" mode="right" @close="closeFilter" >
|
||
<view style="width: 100%;height: 96vh;position: relative;background-color: #eee;top: 4vh;">
|
||
<view class="search-box">
|
||
<view style="margin: 0 20rpx;"><u-icon name="arrow-left" size="36" @click="closeFilter"></u-icon></view>
|
||
<u-search style="margin-right:20rpx;" :showAction="true" :input-style="inputStyle" :searchIconSize="36" v-model="filterSearch" actionText="搜索" :animation="false" @custom="searchDevices" ></u-search>
|
||
</view>
|
||
<view class="filter-content">
|
||
<!-- 左侧:一级分类 -->
|
||
<scroll-view class="primary" scroll-y>
|
||
<view class="item active">
|
||
<text class="name"> 样品类别 </text>
|
||
</view>
|
||
</scroll-view>
|
||
<!-- 右侧:二级分类 -->
|
||
<scroll-view class="secondary" scroll-y>
|
||
<view v-for="(item, index) in toolsList"
|
||
:key="item.id" class="item" @click="sampleTools = item.name">
|
||
<text class="name"> {{item.name}} </text>
|
||
<u-icon name="checkmark" color="#2979ff" size="32" v-if="sampleTools == item.name"></u-icon>
|
||
</view>
|
||
</scroll-view>
|
||
|
||
|
||
|
||
</view>
|
||
<view class="submit-box">
|
||
<u-button type="primary" shape="circle" class="submit-btn" @click="handleSearch">查 询</u-button>
|
||
<u-button shape="circle" class="submit-btn" @click="handleReset">重置</u-button>
|
||
</view>
|
||
</view>
|
||
</u-popup>
|
||
|
||
<!-- 派工班组 -->
|
||
<u-picker :show="showTeam" :columns="teamList" keyName="name"
|
||
@confirm="teamConfirm" title="班组选择"
|
||
@cancel="showTeam = false"
|
||
></u-picker>
|
||
|
||
</view>
|
||
</view>
|
||
|
||
</template>
|
||
|
||
<script>
|
||
import { getSamplesList,delSamplesList,updateSamplesList,getSamplesAuthority,getToolsSelect,getTestTeamSelected,dispatchWork,getCustomNameSelected,downloadEntrustContract } from '@/service/url.js';
|
||
import tabHeader from '@/components/tab-Header.vue';
|
||
import eselect from '@/components/eselect.vue';
|
||
import searchSelect from '@/components/search-select.vue';
|
||
import AES from "@/utils/cryptoJs/aes.js";
|
||
import CONFIG from '../../service/config.js'
|
||
export default {
|
||
components: {
|
||
tabHeader,
|
||
eselect,
|
||
searchSelect
|
||
},
|
||
data() {
|
||
return {
|
||
roleCode:uni.getStorageSync('roleCode'),
|
||
currentTabIndex:0,
|
||
searchValue:'',
|
||
filterSearch:'',//筛选弹框-搜索样品类别
|
||
inputStyle:{
|
||
fontSize:'24rpx',//修改搜索框里面的文字大小
|
||
height:'60rpx',
|
||
},
|
||
sampleTools:'',
|
||
toolsList:[],
|
||
item:{
|
||
id:'111111122222222',
|
||
name1:"国网安徽省电力公司宿州市埇桥区供电公司解集供电所",
|
||
name2:"2024-7-10",
|
||
name3:"安全帽、白棕绳、测距杆、登高板、安全带",
|
||
name4:"P20240730-01",
|
||
name5:"人脸验证已通过!",
|
||
state:'1'
|
||
},
|
||
options: [{
|
||
value: "1",
|
||
label: "国网1111"
|
||
}, {
|
||
value: "2",
|
||
label: "国网2222",
|
||
}, {
|
||
value: "3",
|
||
label: "国网3333",
|
||
}, {
|
||
value: "4",
|
||
label: "国网4444",
|
||
}],
|
||
showFilter: false,
|
||
// 新增收样
|
||
addPopup: false,
|
||
customerList:[],
|
||
addForm:{
|
||
customName:'',
|
||
customId:'',
|
||
sampleUser:'',
|
||
sampleTime:""
|
||
},
|
||
showDate: false,
|
||
showDept: false,
|
||
rules: {
|
||
'customName': {
|
||
type: 'string',
|
||
required: true,
|
||
message: '请选择单位',
|
||
trigger: ['blur', 'change']
|
||
},
|
||
'sampleTime': {
|
||
type: 'string',
|
||
required: true,
|
||
message: '请选择日期',
|
||
trigger: ['blur', 'change']
|
||
},
|
||
},
|
||
// 修改收样
|
||
editPopup: false,
|
||
editForm:{
|
||
customName:'',
|
||
customId:'',
|
||
sampleUser:'',
|
||
sampleTime:''
|
||
},
|
||
showDate2: false,
|
||
showDept2: false,
|
||
eRules: {
|
||
'customName': {
|
||
type: 'string',
|
||
required: true,
|
||
message: '请选择单位',
|
||
trigger: ['blur', 'change']
|
||
},
|
||
'sampleTime': {
|
||
type: 'string',
|
||
required: true,
|
||
message: '请选择日期',
|
||
trigger: ['blur', 'change']
|
||
},
|
||
},
|
||
page:1,
|
||
page1:1,
|
||
listData:[],
|
||
listData1:[],
|
||
showTeam: false,//派工班组picked组件
|
||
teamList:[],//班组下拉数据
|
||
sentData:{},//派工数据对象
|
||
editData:{},//修改数据对象
|
||
downloadUlr:'',
|
||
};
|
||
},
|
||
watch: {
|
||
currentTabIndex: function(newVal, oldVal) {
|
||
this.currentTabIndex = newVal;
|
||
this.handleSearch();
|
||
}
|
||
|
||
},
|
||
onLoad() {
|
||
this.getToolsSelect()
|
||
this.getTestTeamSelected()
|
||
this.getCustomNameSelected()
|
||
},
|
||
onShow() {
|
||
this.page = 1;
|
||
this.listData=[]
|
||
this.page1 = 1;
|
||
this.listData1=[]
|
||
this.loadmore()
|
||
},
|
||
methods: {
|
||
//返回
|
||
customNavigateBack() {
|
||
// 自定义返回逻辑
|
||
const pages = getCurrentPages(); // 获取页面栈
|
||
const len = pages.length;
|
||
let backPage = ''; // 要返回的页面路径
|
||
for (let i = len - 2; i >= 0; i--) {
|
||
// 从倒数第二个页面开始遍历,找到第一个不是当前页面的页面
|
||
if (pages[i].route !== 'pages/A/A') {
|
||
backPage = pages[i].route;
|
||
break;
|
||
}
|
||
}
|
||
if (backPage) {
|
||
uni.navigateBack({
|
||
delta: len - 1 - pages.findIndex(page => page.route === backPage) // 返回到已存在的页面
|
||
});
|
||
}
|
||
},
|
||
//跳转搜索
|
||
searchList(value){//搜索收样记录
|
||
this.page = 1;
|
||
this.listData=[]
|
||
this.page1 = 1;
|
||
this.listData1=[]
|
||
this.loadmore()
|
||
},
|
||
//筛选弹框-搜索样品类别
|
||
searchDevices(value){
|
||
this.getToolsSelect()
|
||
},
|
||
//样品类型下拉数据
|
||
getToolsSelect(){
|
||
let obj = {
|
||
"keyWord":this.filterSearch,
|
||
}
|
||
let param = {
|
||
encryptedData: AES.encrypt(JSON.stringify(obj))
|
||
// encryptedData: JSON.stringify(obj)
|
||
}
|
||
this.$http.post(getToolsSelect,param).then(res => {
|
||
if (res) {
|
||
if(res.code == '200'){
|
||
this.toolsList=res.data
|
||
}else{
|
||
this.toolsList=[]
|
||
}
|
||
}
|
||
}).catch(error => {
|
||
console.log(error)
|
||
})
|
||
},
|
||
//筛选确定按钮-开始筛选
|
||
handleSearch(){
|
||
//分页
|
||
this.page = 1;
|
||
this.listData=[]
|
||
this.page1 = 1;
|
||
this.listData1=[]
|
||
this.showFilter=false
|
||
this.loadmore()
|
||
},
|
||
//筛选重置按钮
|
||
handleReset(){
|
||
this.sampleTools = ''
|
||
this.handleSearch()
|
||
},
|
||
//滚动下拉1
|
||
scrolltolower() {
|
||
this.page += 1;
|
||
this.loadmore()
|
||
},
|
||
//滚动下拉2
|
||
scrolltolower1() {
|
||
this.page1 += 1;
|
||
this.loadmore()
|
||
},
|
||
//列表数据
|
||
loadmore() {
|
||
var pageNum;
|
||
if(this.currentTabIndex==0){pageNum=this.page}else{pageNum=this.page1};
|
||
let obj = {
|
||
"type":this.currentTabIndex,
|
||
"keyWord":this.searchValue,
|
||
"sampleTools":this.sampleTools,
|
||
"page":pageNum,
|
||
"limit":"10"
|
||
}
|
||
let param = {
|
||
encryptedData: AES.encrypt(JSON.stringify(obj))
|
||
// encryptedData: JSON.stringify(obj)
|
||
}
|
||
this.$http.post(getSamplesList,param).then(res => {
|
||
if (res) {
|
||
console.log(res)
|
||
if(res.code == 200){
|
||
if(this.currentTabIndex==0){
|
||
if(res.data?.length>0){
|
||
if(this.page == 1){
|
||
this.listData = res.data;
|
||
}else{
|
||
this.listData = [...this.listData, ...res.data];
|
||
}
|
||
}else{
|
||
console.log("没有更多了")
|
||
}
|
||
}else{
|
||
if(res.data?.length>0){
|
||
if(this.page1 == 1){
|
||
this.listData1 = res.data;
|
||
}else{
|
||
this.listData1 = [...this.listData1, ...res.data];
|
||
}
|
||
}else{
|
||
console.log("没有更多了")
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
}).catch(error => {
|
||
console.log(error)
|
||
})
|
||
// for (let i = 0; i < 15; i++) {
|
||
// this.listData.push(
|
||
// this.item
|
||
// )
|
||
// }
|
||
// console.log(this.listData)
|
||
},
|
||
//进入收样批次样品列表
|
||
goCollectDetail(item){
|
||
if(item.teamName&&item.teamName!=""){//已派工
|
||
uni.navigateTo({
|
||
url: `/pages/samples/samplesDetail?id=${item.id}&customName=${item.customName}&customId=${item.customId}&batchCode=${item.batchCode}&hasTeam=${item.teamName}`
|
||
})
|
||
}else{//未派工
|
||
uni.navigateTo({
|
||
url: `/pages/samples/samplesDetail?id=${item.id}&customName=${item.customName}&customId=${item.customId}&batchCode=${item.batchCode}`
|
||
})
|
||
}
|
||
|
||
},
|
||
//新增收样-关闭
|
||
closeAdd() {
|
||
this.addPopup = false
|
||
},
|
||
// 获取送样单位
|
||
getCustomNameSelected(){
|
||
let obj = {}
|
||
this.$http.post(getCustomNameSelected,{}).then(res => {
|
||
if (res) {
|
||
if(res.code == '200'){
|
||
this.customerList.push(res.data);
|
||
}else{
|
||
this.customerList=[]
|
||
}
|
||
}
|
||
}).catch(error => {
|
||
console.log(error)
|
||
})
|
||
},
|
||
//新增收样-打开
|
||
addCollect(){
|
||
let obj = {"name":"收样",}
|
||
let param = {
|
||
encryptedData: AES.encrypt(JSON.stringify(obj))
|
||
// encryptedData: JSON.stringify(obj)
|
||
}
|
||
//确定权限
|
||
this.$http.post(getSamplesAuthority,param).then(res => {
|
||
if (res) {
|
||
if(res.code == 200){
|
||
if(res.data){
|
||
this.addForm.customName="";
|
||
this.addForm.customId="";
|
||
this.addForm.sampleUser="";
|
||
this.addForm.sampleTime="";
|
||
this.addPopup = true
|
||
}else{
|
||
uni.showToast({
|
||
title: '暂无收样权限',
|
||
icon: 'none'
|
||
});
|
||
}
|
||
}else{
|
||
uni.showToast({
|
||
title: '权限接口错误',
|
||
icon: 'none'
|
||
});
|
||
return false
|
||
}
|
||
}
|
||
}).catch(error => {
|
||
console.log(error)
|
||
})
|
||
},
|
||
openTimePick(){
|
||
this.showDate=true;
|
||
this.$refs.picker.innerValue=new Date().getTime()
|
||
},
|
||
//日期确认
|
||
dateTimeConfirm(e){
|
||
this.showDate = false;
|
||
this.addForm.sampleTime = this.$u.date(e.value,'yyyy-mm-dd')
|
||
this.$refs.uForm.validateField('sampleTime')
|
||
},
|
||
//单位确认
|
||
deptConfirm(e){
|
||
this.showDept = false;
|
||
this.addForm.customName = e.value[0].name;
|
||
this.addForm.customId = e.value[0].id;
|
||
this.$refs.uForm.validateField('customName')
|
||
},
|
||
// 新增-批次
|
||
addConfirm(){
|
||
this.$refs.uForm.validate().then(validate => {
|
||
uni.navigateTo({
|
||
url: `/pages/samples/samplesDetail?addData=${JSON.stringify(this.addForm)}`
|
||
})
|
||
this.addPopup = false
|
||
}).catch(errors => {
|
||
|
||
})
|
||
},
|
||
//侧边筛选Popup-关闭
|
||
closeFilter() {
|
||
this.showFilter = false
|
||
console.log('closeFilter');
|
||
},
|
||
//侧边筛选Popup-打开
|
||
filter(){
|
||
this.showFilter = true;
|
||
console.log("筛选打开")
|
||
},
|
||
|
||
//删除收样批次
|
||
delSamples(chosen){
|
||
uni.showModal({
|
||
title: '确认',
|
||
content: '请确认是否删除收样批次!',
|
||
showCancel: true,
|
||
cancelText: '取消',
|
||
confirmText: '确认',
|
||
success: res => {
|
||
if (res.confirm) {
|
||
let obj = {
|
||
"id":chosen.id,
|
||
}
|
||
let param = {
|
||
encryptedData: AES.encrypt(JSON.stringify(obj))
|
||
// encryptedData: JSON.stringify(obj)
|
||
}
|
||
this.$http.post(delSamplesList,param).then(response => {
|
||
if (response) {
|
||
if(response.code == '200'){
|
||
uni.showToast({
|
||
title: "删除成功",
|
||
icon: "none"
|
||
})
|
||
this.page = 1;
|
||
this.listData=[];
|
||
this.loadmore()
|
||
}else{
|
||
uni.showToast({
|
||
title: "删除失败",
|
||
icon: "none"
|
||
})
|
||
}
|
||
}
|
||
}).catch(error => {
|
||
console.log(error)
|
||
})
|
||
} else if (res.cancel) {}
|
||
}
|
||
});
|
||
},
|
||
|
||
// 修改收样批次
|
||
downloadSamples(chosen){
|
||
uni.showModal({
|
||
title: '确认',
|
||
content: '请确认是否下载收样委托书!',
|
||
showCancel: true,
|
||
cancelText: '取消',
|
||
confirmText: '确认',
|
||
success: res => {
|
||
if (res.confirm) {
|
||
let obj = {
|
||
"id":chosen.id,
|
||
}
|
||
let param = {
|
||
encryptedData: AES.encrypt(JSON.stringify(obj))
|
||
// encryptedData: JSON.stringify(obj)
|
||
}
|
||
let option = {
|
||
contentType: 'application/json',
|
||
};
|
||
this.$http.post(downloadEntrustContract, param, false, option).then(res => {
|
||
// console.log(res)
|
||
if (res.code == '200') {
|
||
const fileData = res.data; // 假设返回的数据是文件路径
|
||
|
||
const fileUrl = CONFIG.TEST_URL+'/szgqj/' + fileData; // 拼接 URL
|
||
this.downloadUlr = CONFIG.TEST_URL+'/szgqj/' + fileData; // 拼接 URL
|
||
//下载文件
|
||
let _this = this;
|
||
const downloadTask = uni.downloadFile({
|
||
url: fileUrl,
|
||
success: (downloadResult) => {
|
||
console.log(downloadResult)
|
||
// 下载成功,获取本地临时文件路径
|
||
var filePath = downloadResult.tempFilePath;
|
||
var sFilePath = downloadResult.tempFilePath;
|
||
//文件保存到本地
|
||
uni.saveFile({
|
||
tempFilePath: downloadResult.tempFilePath,//临时路径
|
||
success:function(res){
|
||
var savedFilePath = res.savedFilePath;
|
||
let osname = plus.os.name;
|
||
//ios手机直接打开文件,手动存储文件到手机,Android手机从根目录创建文件夹,保存文件并改名
|
||
if (osname == 'Android') {
|
||
uni.showToast({
|
||
icon:'none',
|
||
mask:true,
|
||
title:'保存成功',
|
||
duration:1000,
|
||
});
|
||
_this.fSetFileName(res.savedFilePath, sFilePath);
|
||
}
|
||
setTimeout(() => {
|
||
// 打开文件查看
|
||
if (plus.runtime.openFile) {
|
||
plus.runtime.openFile(filePath, {}, function(e) {
|
||
}, function(e) {
|
||
});
|
||
}
|
||
},1000)
|
||
},
|
||
fail:function(res){
|
||
|
||
}
|
||
});
|
||
|
||
},
|
||
fail: (error) => {
|
||
// 下载失败的处理
|
||
console.error('下载失败:', error);
|
||
}
|
||
});
|
||
// 打开文件
|
||
if (plus.runtime.openFile) {
|
||
plus.runtime.openFile(filePath, {}, function(e) {
|
||
}, function(e) {
|
||
});
|
||
}
|
||
}
|
||
}).catch(error => {
|
||
console.log(error);
|
||
});
|
||
|
||
|
||
} else if (res.cancel) {}
|
||
}
|
||
});
|
||
},
|
||
// 给下载的文件重命名
|
||
fSetFileName(sFilePath, sFileName) {
|
||
var sFileName = sFileName.split('/')[sFileName.split('/').length - 1];//原来的文件名
|
||
|
||
var aFileUrl = sFilePath.split('/').splice(0, sFilePath.split('/').length - 1);//saveFile API保存的本地地址
|
||
|
||
var url = this.downloadUlr;//下载地址
|
||
// 'url下载地址(和上面的一样)'
|
||
let dtask = plus.downloader.createDownload(url, {
|
||
filename: "file://storage/emulated/0/安全工机具下载/" + sFileName //在手机存储更目录创建一个叫AAA的文件夹,把文件存储进去,并更改会原名
|
||
},
|
||
(d, status) => {
|
||
if (status == 200) {
|
||
let fileSaveUrl = plus.io.convertLocalFileSystemURL(d.filename);
|
||
} else {
|
||
//下载失败
|
||
plus.downloader.clear(); //清除下载任务
|
||
}
|
||
})
|
||
dtask.start();
|
||
},
|
||
//日期确认
|
||
dateTimeConfirm2(e){
|
||
this.showDate2 = false;
|
||
this.editForm.sampleTime = this.$u.date(e.value,'yyyy-mm-dd')
|
||
this.$refs.eForm.validateField('sampleTime')
|
||
},
|
||
//单位确认
|
||
deptConfirm2(e){
|
||
this.showDept2 = false;
|
||
this.editForm.customName = e.value[0].name;
|
||
this.editForm.customId = e.value[0].id;
|
||
this.$refs.eForm.validateField('customName')
|
||
},
|
||
//关闭编辑
|
||
closeEdit() {
|
||
this.editPopup = false
|
||
},
|
||
// 修改-批次
|
||
editConfirm(){
|
||
this.$refs.eForm.validate().then(validate => {
|
||
let obj = {
|
||
"id":this.editData.id,
|
||
"customId":this.editForm.customId,
|
||
"customName":this.editForm.customName,
|
||
"sampleUser":this.editForm.sampleUser,
|
||
"sampleTime":this.editForm.sampleTime,
|
||
}
|
||
let param = {
|
||
encryptedData: AES.encrypt(JSON.stringify(obj))
|
||
// encryptedData: JSON.stringify(obj)
|
||
}
|
||
this.$http.post(updateSamplesList,param).then(response => {
|
||
if (response) {
|
||
if(response.code == '200'){
|
||
uni.showToast({
|
||
title: "修改成功",
|
||
icon: "none"
|
||
})
|
||
this.page = 1;
|
||
this.listData=[];
|
||
this.loadmore()
|
||
}else{
|
||
uni.showToast({
|
||
title: "修改失败",
|
||
icon: "none"
|
||
})
|
||
}
|
||
}
|
||
}).catch(error => {
|
||
console.log(error)
|
||
})
|
||
this.editPopup = false
|
||
}).catch(errors => {
|
||
|
||
})
|
||
},
|
||
|
||
//派工-下拉
|
||
getTestTeamSelected(){
|
||
let obj = {}
|
||
this.$http.post(getTestTeamSelected,{}).then(res => {
|
||
if (res) {
|
||
if(res.code == '200'){
|
||
this.teamList.push(res.data);
|
||
}else{
|
||
this.teamList=[]
|
||
}
|
||
}
|
||
}).catch(error => {
|
||
console.log(error)
|
||
})
|
||
},
|
||
//派工-打开
|
||
sentTeam(chosen){
|
||
let obj = {"name":"派工"}
|
||
let param = {
|
||
encryptedData: AES.encrypt(JSON.stringify(obj))
|
||
// encryptedData: JSON.stringify(obj)
|
||
}
|
||
//确定权限
|
||
this.$http.post(getSamplesAuthority,param).then(res => {
|
||
// console.log(res)
|
||
if (res) {
|
||
if(res.code == 200){
|
||
if(res.data){
|
||
this.sentData=chosen;
|
||
this.showTeam = true;
|
||
}else{
|
||
uni.showToast({
|
||
title: '暂无收样权限',
|
||
icon: 'none'
|
||
});
|
||
}
|
||
}else{
|
||
uni.showToast({
|
||
title: '权限接口错误',
|
||
icon: 'none'
|
||
});
|
||
return false
|
||
}
|
||
}
|
||
}).catch(error => {
|
||
console.log(error)
|
||
})
|
||
},
|
||
//派工-确定
|
||
teamConfirm(e){
|
||
// console.log('teamConfirm', e)
|
||
// console.log('teamConfirm', this.sentData)
|
||
let obj = {
|
||
"ids":this.sentData.id,
|
||
"teamId":e.value[0].id
|
||
}
|
||
let param = {
|
||
encryptedData: AES.encrypt(JSON.stringify(obj))
|
||
// encryptedData: JSON.stringify(obj)
|
||
}
|
||
this.$http.post(dispatchWork,param).then(res => {
|
||
if (res) {
|
||
if(res.code == '200'){
|
||
this.handleSearch();
|
||
uni.showToast({
|
||
title: '派工完成',
|
||
icon: 'none'
|
||
});
|
||
}else{
|
||
// this.toolsList=[]
|
||
}
|
||
}
|
||
}).catch(error => {
|
||
console.log(error)
|
||
})
|
||
this.showTeam = false;
|
||
},
|
||
// 收样权限
|
||
getSamplesAuthority(name){
|
||
let obj = {
|
||
"name":name,
|
||
}
|
||
let param = {
|
||
encryptedData: AES.encrypt(JSON.stringify(obj))
|
||
// encryptedData: JSON.stringify(obj)
|
||
}
|
||
this.$http.post(getSamplesAuthority,param).then(res => {
|
||
console.log(res)
|
||
if (res) {
|
||
if(res.code == 200){
|
||
return res.data
|
||
}else{
|
||
uni.showToast({
|
||
title: '权限接口错误',
|
||
icon: 'none'
|
||
});
|
||
return false
|
||
}
|
||
}
|
||
}).catch(error => {
|
||
console.log(error)
|
||
})
|
||
},
|
||
},
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
/deep/.u-popup .u-slide-right-enter-active{
|
||
left: 0;
|
||
}
|
||
|
||
|
||
.searchInput{
|
||
height: 100%;
|
||
}
|
||
.page-content{
|
||
width: 100%;
|
||
height: 90vh;
|
||
position: absolute;
|
||
top:8vh;
|
||
padding: 0rpx 0;
|
||
background-color: #F3F3F3;
|
||
.search{
|
||
width: 90%;
|
||
height: 100rpx;
|
||
padding: 0 5%;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
background-color: #FFF;
|
||
}
|
||
.main-box{
|
||
width: 100%;
|
||
height: auto;
|
||
}
|
||
.tab-box {
|
||
overflow: hidden;
|
||
height: 100upx;
|
||
background-color: #FFF;
|
||
.tab-item {
|
||
float: left;
|
||
height: 70upx;
|
||
width: 48%;
|
||
font-size: 30upx;
|
||
line-height: 70upx;
|
||
text-align: center;
|
||
}
|
||
.active {
|
||
color: #0052D9;
|
||
border-radius: 10upx 10upx 0 0;
|
||
font-weight: bold;
|
||
}
|
||
.activeLine{
|
||
background: #0052D9;
|
||
border-radius: 10upx;
|
||
width: 50upx;
|
||
height: 10upx;
|
||
margin: 0 auto;
|
||
}
|
||
}
|
||
|
||
.list-box{
|
||
width: 94%;
|
||
height: auto;
|
||
// border: 1px solid #000;
|
||
margin: 20rpx auto;
|
||
|
||
.list-item{
|
||
width: 100%;
|
||
height: auto;
|
||
background-color: #fff;
|
||
border-radius: 10rpx;
|
||
margin: 20rpx 0;
|
||
|
||
.item-header{
|
||
width: 100%;
|
||
height: auto;
|
||
line-height: 72rpx;
|
||
font-size: 28rpx;
|
||
border: 1px dashed #E3E9FA;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
}
|
||
.header-name{
|
||
padding:20rpx;
|
||
// word-wrap: break-word;
|
||
line-height: 40rpx;
|
||
font-weight: bold;
|
||
|
||
}
|
||
|
||
.item-content{
|
||
width: 100%;
|
||
height: auto;
|
||
border: 1px dashed #E3E9FA;
|
||
font-size: 24rpx;
|
||
|
||
.content-box{
|
||
width: 94%;
|
||
height: auto;
|
||
margin: 20rpx;
|
||
// background-color: #F8F9FC;
|
||
padding: 20rpx 0;
|
||
// border-radius: 10rpx;
|
||
.item-text{
|
||
width: 95%;
|
||
margin-left: 20rpx;
|
||
margin-top: 15rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
.iconImg{
|
||
width: 28rpx;
|
||
height: 28rpx;
|
||
margin-right: 8rpx;
|
||
}
|
||
|
||
.label{
|
||
color: #3A3A3A;
|
||
font-weight: 500;
|
||
}
|
||
.info{
|
||
color: #6F6F6F;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
.item-footer{
|
||
width: 100%;
|
||
height: 72rpx;
|
||
position: relative;
|
||
.foot-status{
|
||
width: 80rpx;
|
||
height: 40rpx;
|
||
line-height: 40rpx;
|
||
text-align: center;
|
||
position: absolute;
|
||
left: 5%;
|
||
top: 20%;
|
||
background: #DDEFFF;
|
||
border-radius: 10rpx;
|
||
color: #007DEB;
|
||
font-size: 20rpx;
|
||
}
|
||
.foot-status2{
|
||
width: 80rpx;
|
||
height: 40rpx;
|
||
line-height: 40rpx;
|
||
text-align: center;
|
||
position: absolute;
|
||
right: 5%;
|
||
top: 20%;
|
||
background: #DDEFFF;
|
||
border-radius: 10rpx;
|
||
color: #007DEB;
|
||
font-size: 20rpx;
|
||
}
|
||
.foot-btn{
|
||
width: 100rpx;
|
||
height: 50rpx;
|
||
line-height: 50rpx;
|
||
text-align: center;
|
||
position: absolute;
|
||
right: 5%;
|
||
top: 20%;
|
||
background: #F2F3FF;
|
||
border-radius: 10rpx;
|
||
color: #0052D9;
|
||
font-weight: bold;
|
||
font-size: 20rpx;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
.visitor-form{
|
||
width: auto;
|
||
padding: 80rpx 20rpx;
|
||
}
|
||
.visitor-input-box{
|
||
|
||
}
|
||
.search-box{
|
||
width: 100%;
|
||
height: 100rpx;
|
||
position: fixed;
|
||
top: 4vh;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
background-color: #FFF;
|
||
}
|
||
.filter-content{
|
||
width: 100%;
|
||
height: 87%;
|
||
position: absolute;
|
||
top: 100rpx;
|
||
flex: 1;
|
||
display: flex;
|
||
}
|
||
.submit-box {
|
||
width: 100%;
|
||
height: 100rpx;
|
||
position: fixed;
|
||
bottom: 0;
|
||
display: flex;
|
||
padding-bottom: 20rpx;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
background-color: #FFF;
|
||
.submit-btn {
|
||
width: 40%;
|
||
margin: 0 auto;
|
||
height: 65rpx;
|
||
font-size: 26rpx;
|
||
// background: linear-gradient( 90deg, #5193FE 0%, #00EEF0 100%);
|
||
box-shadow: 0px 4px 2px 0px rgba(81,147,254,0.15);
|
||
border-radius: 32rpx;
|
||
}
|
||
.submit-add{
|
||
width: 80%;
|
||
margin: 0 auto;
|
||
height: 65rpx;
|
||
font-size: 26rpx;
|
||
background: #0052D9;
|
||
box-shadow: 0px 4px 2px 0px rgba(81,147,254,0.15);
|
||
}
|
||
}
|
||
/* 一级分类 */
|
||
.primary {
|
||
overflow: hidden;
|
||
height: 100%;
|
||
width: 24%;
|
||
flex: none;
|
||
background-color: #f6f6f6;
|
||
|
||
.item {
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
height: 96rpx;
|
||
font-size: 26rpx;
|
||
color: #0052D9;
|
||
font-weight: 600;
|
||
position: relative;
|
||
background-color: #FFF;
|
||
&::after {
|
||
content: '';
|
||
position: absolute;
|
||
left: 42rpx;
|
||
bottom: 0;
|
||
width: 96rpx;
|
||
border-top: 1rpx solid #e3e4e7;
|
||
}
|
||
}
|
||
.active {
|
||
background-color: #fff;
|
||
&::before {
|
||
content: '';
|
||
position: absolute;
|
||
left: 0;
|
||
top: 24rpx;
|
||
width: 10rpx;
|
||
height: 50%;
|
||
background-color: #0052D9;
|
||
border-radius: 10rpx;
|
||
}
|
||
}
|
||
}
|
||
.primary .item:last-child::after,
|
||
.primary .active::after {
|
||
display: none;
|
||
}
|
||
.secondary{
|
||
overflow: hidden;
|
||
height: 100%;
|
||
width: 80%;
|
||
background-color: #fff;
|
||
.item {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
height: 96rpx;
|
||
font-size: 26rpx;
|
||
padding: 0 50rpx;
|
||
position: relative;
|
||
|
||
&::after {
|
||
content: '';
|
||
position: absolute;
|
||
left: 42rpx;
|
||
bottom: 0;
|
||
width: 96rpx;
|
||
// border-top: 1rpx solid #e3e4e7;
|
||
}
|
||
}
|
||
.active {
|
||
background-color: #fff;
|
||
&::before {
|
||
content: '';
|
||
position: absolute;
|
||
left: 0;
|
||
top: 0;
|
||
width: 8rpx;
|
||
height: 50%;
|
||
// background-color: #27ba9b;
|
||
}
|
||
}
|
||
}
|
||
|
||
.add-header{
|
||
width: 100%;
|
||
height: 80rpx;
|
||
margin: 0 auto;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
background-color: #fff;
|
||
}
|
||
.add-form{
|
||
width: 100%;
|
||
height: 26vh;
|
||
background-color: #fff;
|
||
}
|
||
|
||
</style>
|