From 4839c693c09fabc13c10d3e9d281917f0a1462d6 Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期三, 24 十二月 2025 16:15:39 +0800
Subject: [PATCH] 添加 模具选择 组件
---
components/BillListPopup/BillListPopup_Mould.vue | 364 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 364 insertions(+), 0 deletions(-)
diff --git a/components/BillListPopup/BillListPopup_Mould.vue b/components/BillListPopup/BillListPopup_Mould.vue
new file mode 100644
index 0000000..b95b5a2
--- /dev/null
+++ b/components/BillListPopup/BillListPopup_Mould.vue
@@ -0,0 +1,364 @@
+<template>
+ <view>
+ <uni-popup ref="popup" type="bottom" @change="popupChangeHandler">
+ <view class="content">
+ <!-- <view class="search-condition">
+ <view class="title"><text>婧愬崟鍗曞彿: </text></view>
+ <view class="right"><input type="text" v-model="HSourceBillNo" @confirm="getBillList" /></view>
+ </view> -->
+ <view class="search-condition">
+ <view class="title"><text>妯″叿: </text></view>
+ <view class="right"><input type="text" :focus="enablefocus" v-model="HMould"
+ @confirm="getBillList" /></view>
+ </view>
+ <!-- <view class="search-condition">
+ <view class="title"><text>鍏宠仈椤�: </text></view>
+ <view class="right"><input type="text" v-model="HCustom" @confirm="getBillList" /></view>
+ </view> -->
+ <view class="buttons">
+ <view style="flex: 1;"></view>
+ <button size="mini" type="primary" @click="search">鎼滅储</button>
+ <button v-if="MultiSourceBill" size="mini" type="primary" @click="ret">杩斿洖</button>
+ <button size="mini" type="primary" @click="exit">閫�鍑�</button>
+ </view>
+ <scroll-view id="#BillListPanel" scroll-y="true" style="height: 55vh;">
+ <view class="options-wrapper" v-show="HBillList.length != 0">
+ <uni-card
+ v-for="(bill, index) in HBillList" :key="index" :title="bill['妯″叿鍚嶇О']" @tap="clickCard(bill, index)">
+ <view class="card-detail" v-for="(HBillField, index) in CommonUtils.emptyValueFilter(bill,HFieldList).slice(0,10)" :key="index">
+ <template v-if="HBillField.ColmType == 'DateTime'"><text>{{ HBillField.ColmCols }}锛�</text>{{ bill[HBillField.ColmCols] ? dayjs(bill[HBillField.ColmCols]).format("YYYY-MM-DD HH:mm:ss") : "" }} </template>
+ <template v-else><text>{{ HBillField.ColmCols }}锛�</text>{{ bill[HBillField.ColmCols] }}</template>
+ </view>
+ <view class="card-detail" v-if="showDetail == index">
+ <view class="card-detail" v-for="(HBillField, index) in CommonUtils.emptyValueFilter(bill,HFieldList).slice(10,-1)" :key="index">
+ <template v-if="HBillField.ColmType == 'DateTime'"><text>{{ HBillField.ColmCols }}锛�</text>{{ bill[HBillField.ColmCols] ? dayjs(bill[HBillField.ColmCols]).format("YYYY-MM-DD HH:mm:ss") : "" }} </template>
+ <template v-else><text>{{ HBillField.ColmCols }}锛�</text>{{ bill[HBillField.ColmCols] }}</template>
+ </view>
+ </view>
+ <view class="more" v-if="showDetail == index && operations != index">
+ <view class="part" style="border-right: 1px solid #eee;" @tap.stop="showDetail = -1">
+ <uni-icons type="top" style="color: #888;margin-right: 10rpx;" size="14" ></uni-icons>鏀惰捣
+ </view>
+ <!-- <view class="part" @tap.stop="operations = operations==index?-1:index">
+ <uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;"
+ size="14"></uni-icons>鎿嶄綔
+ </view> -->
+ </view>
+ <view class="more" v-if="showDetail != index && operations != index">
+ <view class="part" style="border-right: 1px solid #eee;" @tap.stop="showDetail = index">
+ <uni-icons type="bottom" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>鏇村淇℃伅
+ </view>
+ <!-- <view class="part" @tap.stop="operations = operations==index?-1:index">
+ <uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;"
+ size="14"></uni-icons>鎿嶄綔
+ </view> -->
+ </view>
+ </uni-card>
+ </view>
+ <view class="over" v-show="HBillList.length == 0">鏆傛棤鏁版嵁</view>
+ </scroll-view>
+ <uni-pagination id="#pagination" title="鏍囬鏂囧瓧" v-model="curPage" :pageSize="size"
+ :total="length"></uni-pagination>
+ </view>
+
+ </uni-popup>
+ </view>
+</template>
+
+<script>
+ import { getUserInfo } from '../../utils/auth';
+import {
+ CommonUtils
+ } from '../../utils/common';
+ import dayjs from 'dayjs';
+ export default {
+ name: "BillListPopup",
+ data() {
+ return {
+ showDetail: -1,
+ operations: -1,
+ CommonUtils,
+ dayjs,
+ enablefocus: false,
+ size: 20,
+ curPage: 1,
+ length: 0,
+ page: 0,
+ HSourceBillNo: '',
+ HMould: '',
+ HCustom: '',
+ HBillList: [],
+ HFieldList: [], // 琛ㄥ崟瀵瑰簲瀛楁
+ panelHeight: 0,
+
+ multiSouceBillList: []
+ };
+ },
+ props: {
+ MultiSourceBill: {
+ type: Boolean,
+ default: false,
+ required: false
+ },
+ },
+ model: {
+ prop: "HSourceBill",
+ event: 'change'
+ },
+ methods: {
+ popupChangeHandler(e) {
+ if (e.show === true) {
+ this.getBillList()
+ }
+ },
+ async exit() {
+ this.size = 20
+ this.curPage = 1
+ this.length = 0
+ this.page = 0
+ this.HSourceBillNo = ''
+ this.HMould = ''
+ this.HCustom = ''
+ this.HBillList = []
+ this.HFieldList = []
+ this.enablefocus = false
+ this.multiSouceBillList = []
+ // 闇�瑕佺瓑寰呴〉闈㈠唴鐨勬暟鎹祴鍊煎畬姣�
+ await this.$nextTick()
+ this.$refs.popup.close();
+ },
+ search() {
+ this.getBillList()
+ },
+ ret() {
+ console.log('this.MultiSourceBill: ', this.MultiSourceBill);
+ uni.$emit('BillSelectComplete', {
+ HInterID: 0,
+ HBillNo: 0,
+ enableMultiSourceBill: this.MultiSourceBill,
+ MultiSourceBillList: this.multiSouceBillList
+ })
+ },
+ showPopup() {
+ this.$refs.popup.open();
+ },
+ clickCard(val, index) {
+ if (this.MultiSourceBill == false) { // 闈炲婧愬崟妯″紡
+ // 鐖跺瓙缁勪欢涔嬮棿浼犻�掓暟鎹�
+ this.$emit("BillSelectComplete", {
+ val: [val],
+ enableMultiSourceBill: this.MultiSourceBill,
+ })
+ } else {
+ this.$set(this.HBillList[this.curPage - 1][index], 'isActive', !this.HBillList[this.curPage - 1][
+ index
+ ]['isActive'])
+ console.log(this.HBillList[this.curPage - 1][index])
+ // 璁剧疆浜嗗婧愬崟妯″紡
+ this.setMultiSourceBillList({
+ HInterID: interid,
+ HBillNo: billno,
+ HIsActive: this.HBillList[this.curPage - 1][index]['isActive']
+ })
+ }
+
+ // this.exit()
+ },
+ setMultiSourceBillList(billInfo) {
+ let index = this.multiSouceBillList.findIndex(item => item.HInterID == billInfo.HInterID)
+ if (index == -1) {
+ billInfo['count'] = 1
+ this.multiSouceBillList.push(billInfo)
+ } else {
+ if (billInfo.HIsActive) {
+ // 濡傛灉瀵瑰簲鍗曟嵁浼犲叆鐨勬槸鍚︽縺娲绘暟鏄痶rue锛屽垯璁℃暟鍣�+1
+ this.multiSouceBillList[index]['count']++;
+ } else {
+ // 濡傛灉瀵瑰簲鍗曟嵁浼犲叆鐨勬槸鍚︽縺娲绘暟鏄痜alse锛屽垯璁℃暟鍣�-1
+ this.multiSouceBillList[index]['count']--;
+ }
+ if (this.multiSouceBillList[index]['count'] == 0) {
+ // 娌℃湁閫変腑鐨勫崟鎹紝鍒欑Щ闄ょ紦瀛樹腑鐨勬暟鎹�
+ this.multiSouceBillList.splice(index, 1)
+ }
+ }
+ console.log('this.multiSouceBillList: ', this.multiSouceBillList);
+ },
+ getBillList() {
+ this.HBillList = []
+ this.length = 0
+ this.page = 0
+ this.curPage = 1
+
+ CommonUtils.doRequest(
+ "/Gy_Mould/page", {
+ sWhere: `
+ and HUSEORGID = ${uni.getStorageSync('OrganizationID')}
+ and (isnull(妯″叿缂栧彿,'') like '%${this.HMould}%' or isnull(妯″叿鍚嶇О,'') like '%${this.HMould}%')
+ and 鏉$爜缂栧彿 != ''
+ `,
+ ModRightNameSelect: 'Gy_MouldFileList',
+ user: getUserInfo()['Czymc'],
+ page: this.curPage,
+ size: this.size
+ },
+ (res) => {
+ let {
+ data,
+ count,
+ Message,
+ list
+ } = res.data
+ if (count > 0) {
+ this.length = count
+ const result = [];
+
+ let fieldList = CommonUtils.fieldListFilterRole({
+ ExcludeKeys: ['妯″叿鍚嶇О'],
+ FieldList: list
+ })
+
+ if (fieldList.status == false) {
+ CommonUtils.showTips({
+ title: '娓╅Θ鎻愮ず',
+ message: `鑾峰彇琛ㄥ崟缁撴瀯澶辫触: ${fieldList.Message}`
+ })
+ }
+
+ this.HFieldList = fieldList.data
+
+ // for (let i = 0; i < data.length; i += this.size) {
+ // result.push(data.slice(i, i + this.size));
+ // }
+ this.HBillList = data
+ console.log("HBillList", this.HBillList)
+ this.page = count
+ setTimeout(() => {
+ this.enablefocus = true
+ }, 500)
+ } else {
+ setTimeout(() => {
+ this.enablefocus = true
+ }, 500)
+ uni.showToast({
+ icon: 'none',
+ title: Message
+ })
+ }
+ }
+ )
+ },
+ },
+ }
+</script>
+
+<style lang="scss">
+ .content {
+ box-sizing: border-box;
+ border-radius: 15rpx 15rpx 0 0;
+ padding: 20rpx 20rpx 40rpx 20rpx;
+ background-color: #fff;
+ display: flex;
+ flex-direction: column;
+ gap: 10rpx;
+
+ .search-condition {
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ gap: 20rpx;
+
+ .title {
+ width: 5rem;
+ text-align: right;
+ }
+
+ .right {
+ flex: 1;
+ border-radius: 22rpx;
+ border: 1px solid #acacac;
+ height: auto;
+
+ input {
+ width: 100%;
+ padding: 8rpx 20rpx;
+ font-size: 24rpx;
+ }
+ }
+ }
+
+ .buttons {
+ display: flex;
+ flex-direction: row;
+ gap: 20rpx;
+ justify-content: flex-end;
+
+ >button {
+ display: inline-flex;
+ width: 4rem;
+ }
+ }
+
+ .options-wrapper {
+ padding: 20rpx;
+ display: grid;
+ grid-template-columns: repeat(1, 1fr);
+ gap: 20rpx;
+
+ >view {
+ margin: 0 !important;
+ box-sizing: border-box;
+
+ }
+
+ .item {
+ .left {
+ display: inline-block;
+ width: 6rem;
+ }
+
+ .right {
+ display: inline-block;
+ }
+ }
+
+ .card-detail {
+ width: 100%;
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: space-between;
+ line-height: 120%;
+
+ .detail {
+ // width: 50%;
+ font-size: 26rpx;
+ margin-bottom: 12rpx;
+ color: #555;
+ margin-right: 20rpx;
+
+ text {
+ color: #999;
+ font-size: 26rpx;
+ }
+ }
+ }
+ }
+
+ .uni-card--is-active {
+ background-color: rgba(0, 122, 255, 0.2);
+ }
+ }
+
+ .more {
+ color: #888;
+ font-size: 24rpx;
+ display: flex;
+ border-top: 1px solid #eee;
+ padding-top: 20rpx;
+
+ .part {
+ width: 50%;
+ text-align: center;
+ }
+ }
+</style>
\ No newline at end of file
--
Gitblit v1.9.1