init project

This commit is contained in:
tao
2025-11-17 10:01:33 +08:00
commit 77c123408d
1018 changed files with 136951 additions and 0 deletions

View File

@@ -0,0 +1,115 @@
<template>
<uni-easyinput v-model="inputNumber" placeholder="请输入数量" @change="change" :disabled="disabled" type="number" />
</template>
<script>
import {
listUnit,
getUnit,
delUnit,
addUnit,
updateUnit,
listUnitConvertible,
convertBySecondUnitOrNum,
} from "@/api/basic/unit";
export default {
name: "secondNumberChangeToConvert",
props: {
materialCode: String,
number: Number,
unitId: Number,
secondNumber: Number,
secondUnitId: Number,
disabled: Boolean,
},
watch: {
// materialCode: {
// handler(newVal) {
// this.secondNumberChange();
// },
// },
secondNumber: {
handler(newVal) {
// 去重,防止重复请求
if (Number(newVal) != this.inputNumber) {
this.inputNumber = Number(newVal);
if (this.inputNumber == null || this.inputNumber == "") {
this.inputNumber = this.number;
this.$emit("update:secondNumber", Number(this.inputNumber));
}
this.secondNumberChange();
}
},
immediate: true,
},
},
data() {
return {
unitOptions: [],
inputNumber: null,
};
},
methods: {
change(data) {
console.log(data)
this.$emit('change', data);
this.onIuputChange()
},
onIuputChange() {
// setTimeout(() => {
// 需要延迟执行的代码
this.$emit("update:secondNumber", Number(this.inputNumber));
this.$emit("change", Number(this.inputNumber));
this.secondNumberChange();
// }, 200); // 0.2秒延迟
},
/**第二数量(数量改变)
* 要求基本单位和数量不为空
* */
secondNumberChange() {
//设置父组件的第一数量
// console.log(
// "convertParams",
// this.materialCode,
// this.inputNumber,
// this.unitId,
// this.secondUnitId
// );
console.log(this.inputNumber)
if (this.inputNumber == null || this.inputNumber == "") {
this.$emit("update:number", 0);
}
if (this.unitId == null || this.unitId == "") {
this.$emit("update:number", this.inputNumber);
} else if (
this.inputNumber &&
this.materialCode &&
this.materialCode != "" &&
this.unitId &&
this.secondUnitId
) {
console.log(this.inputNumber)
let params = {
materialCode: this.materialCode,
number: null,
unitId: this.unitId,
secondUnitId: this.secondUnitId,
secondNumber: this.inputNumber,
};
console.log(params)
convertBySecondUnitOrNum(params).then((response) => {
console.log(response.data.number)
this.$emit("update:number", response.data.number);
});
} else { //其它所有异常情况,都将第二数量同步传给第一数量
this.$emit("update:number", this.inputNumber);
}
},
},
};
</script>
<style>
</style>

View File

@@ -0,0 +1,125 @@
<template>
<view>
<view v-if="copyContent.length > 0" class="ranking">
<view class="ranking-item" v-for="(content,index) in copyContent" :key="index" :style="{padding:progressPadding+'rpx'}">
<view class="name">{{content.name}}</view>
<view class="progress" >
<text :style="{background:content.background,width:content.width + '%',height:progressWidth+'rpx'}"></text>
</view>
<view class="num">{{content.num}}</view>
</view>
</view>
</view>
</template>
<script>
export default{
name:'ranking-list',
props:{
content:{
type: Array,
default() {
return []
}
},
isPC:{
type:Boolean,
default:false
},
isRank:{
type:Boolean,
default:false
}
},
data(){
return{
progressWidth:24,
progressPadding:10,
maxNumber:0,
culCount:0,
copyContent:[]
}
},
watch:{
content(newV){
this.init()
}
},
methods:{
init(){
this.copyContent = this.deepClone(this.content)
if(this.copyContent && this.copyContent.length >0){
if(this.isRank){
this.copyContent = this.copyContent.sort((a,b) => b.num - a.num);
this.maxNumber = this.copyContent[0].num;
}else{
this.maxNumber = Math.max.apply(Math,this.copyContent.map(item => { return item.num }));
}
this.copyContent.map((item,index) =>{
item.width = this.computeWidth(this.maxNumber,item.num);
});
}
},
computeWidth(max,current){
let num = (current / max) * 100;
return num.toFixed(2);
},
deepClone(obj) {
var cloneObj = new obj.constructor()
if(obj === null) return obj
if(obj instanceof Date) return new Date(obj)
if(obj instanceof RegExp) return new RegExp(obj)
if (typeof obj !== 'object') return obj
for (var i in obj) {
if (obj.hasOwnProperty(i)) {
cloneObj[i] = this.deepClone(obj[i])
}
}
return cloneObj
}
},
mounted() {
if(this.isPC){
this.progressWidth = 40;
this.progressPadding = 30;
}
this.init();
}
}
</script>
<style scoped lang="scss">
.ranking-item{
display: flex;
margin-bottom: 13rpx;
align-content: center;
height: 28rpx;
.name{
padding-right: 10rpx;
color: #868688;
font-size: 20rpx;
flex: 1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.progress{
flex:5;
text-align: left;
padding-right: 10rpx;
text{
display: inline-block;
border-radius: 30rpx;
vertical-align:top;
}
}
.num{
font-size: 26rpx;
color: #3EB2F5;
flex: 1;
}
}
</style>

View File

@@ -0,0 +1,122 @@
<template>
<uni-data-select v-model="secondUnitId" :localdata="unitOptions" @change="secondUnitChange" style="z-index: 100;">
</uni-data-select>
</template>
<script>
import {
listUnitConvertible,
convertBySecondUnitOrNum,
} from "@/api/basic/unit";
export default {
name: "selectUnitConvertible",
props: {
materialCode: {
type: String,
default: "",
},
// secondUnitId
value: {
type: Number,
default: null,
},
secondNumber: {
type: Number,
default: null,
},
number: {
type: Number,
default: null,
},
unitId: {
type: Number,
default: null,
},
disabled: Boolean,
},
watch: {
materialCode: {
handler(newVal, oldVal) {
console.log(newVal)
this.selectConvertibleUnitList();
},
immediate: true,
},
value: {
handler(newVal) {
console.log(newVal)
this.secondUnitId = newVal;
this.selectConvertibleUnitList();
},
immediate: true,
},
},
created() {
this.selectConvertibleUnitList();
},
data() {
return {
secondUnitId: null,
unitOptions: [],
};
},
methods: {
//单位下拉框点击事件
selectConvertibleUnitList() {
let query = {
materialCode: this.materialCode,
id: this.value,
};
listUnitConvertible(query).then((response) => {
this.unitOptions = response.rows.map(item => {
let obj = {
text: item.unitCode + ":" + item.unitName,
value: item.id
}
return obj
});
});
},
/**第二单位(显示单位改变)
* 要求基本单位和数量不为空
* */
secondUnitChange(e) {
console.log(e, this.secondUnitId)
// 给单位赋值
this.$emit("input", e);
// console.log(
// "unitParams",
// this.materialCode,
// this.number,
// this.unitId,
// this.secondNumber,
// this.secondUnitId
// );
if (
this.number &&
this.unitId &&
this.materialCode &&
this.materialCode != "" &&
e
) {
let params = {
materialCode: this.materialCode,
number: this.number,
unitId: this.unitId,
secondUnitId: e,
secondNumber: null,
};
// 修改第二数量
convertBySecondUnitOrNum(params).then((response) => {
this.$emit("update:secondNumber", response.data.secondNumber);
});
}
},
},
};
</script>
<style>
</style>

View File

@@ -0,0 +1,8 @@
<template>
</template>
<script>
</script>
<style>
</style>

View File

@@ -0,0 +1,231 @@
<template>
<view class="text_block">
<template v-for="(item,index) in content">
<view v-if="item.kind == 1" :key="index"
:style="{backgroundImage:'linear-gradient(to top right,'+item.background[0]+','+item.background[1]+')'}"
:class="[(index+1)%3==0 ? '':'marginRight','kind','kind_one','breathe-blue']">
<view class="view_100" :style="{fontSize:item.content[0].size,color:item.content[0].colorvalue}">
{{item.content[0].value}}
</view>
<view class="view_100" :style="{fontSize:item.content[1].size,color:item.content[1].colortext}">
{{item.content[1].text}}
</view>
</view>
<view v-else-if="item.kind == 2" :key="index"
:class="[(index+1)%3==0 ? '':'marginRight','kind','kind_two','breathe-blue']"
:style="{backgroundImage:'linear-gradient(to top right,'+item.background[0]+','+item.background+')' ,marginRight:(index+1)%3==0?'0rpx':'40rpx'}">
<view v-for="(content,i) in item.content" :key="i" class="two_1">
<text :style="{fontSize:content.size,color:content.colortext}">{{content.text}}:</text>
<text :style="{fontSize:content.size,color:content.colorvalue}">{{content.value}}</text>
</view>
</view>
<view v-else-if="item.kind == 3" :key="index" class="kind kind_three breathe-blue"
:style="{backgroundImage:'linear-gradient(to top right,'+item.background[0]+','+item.background+')'}">
<view class="view_100" :style="{fontSize:item.content[0].size,color:item.content[0].colorvalue}">
{{item.content[0].value}}
</view>
<view class="view_100" :style="{fontSize:item.content[1].size,color:item.content[1].colortext}">
{{item.content[1].text}}
</view>
<view class="three_3 view_100">
<view v-for="(j,i) in 2" :key="i">
<text
:style="{fontSize:item.content[i+2].size,color:item.content[i+2].colortext}">{{item.content[i+2].text}}:</text>
<text
:style="{fontSize:item.content[i+2].size,color:item.content[i+2].colorvalue}">{{item.content[i+2].value}}</text>
</view>
</view>
</view>
<view v-else-if="item.kind == 4" :key="index"
:class="[(index+1)%4==0 ? '':'marginRight','kind','kind_four','breathe-blue']"
:style="{backgroundImage:'linear-gradient(to top right,'+item.background[0]+','+item.background[1]+')',marginRight:(index+1)%4==0?'0rpx':'40px'}">
<view class="view_100" :style="{fontSize:item.content[0].size,color:item.content[0].colortext}">
{{item.content[0].text}}
</view>
<view class="view_100" :style="{fontSize:item.content[1].size,color:item.content[1].colorvalue}">
{{item.content[1].value}}
</view>
<!-- <view class="four_3" :style="{fontSize:item.content[2].size,color:item.content[2].colorvalue}">
<text :style="{fontSize:item.content[3].size,color:item.content[3].colorvalue}">{{item.content[2].text}}</text>
<li v-if="item.content[3].text == 'up'" class="iconfont icon-up icon" :style="{color:item.content[3].colortext}"></li>
<li v-else class="iconfont icon-down icon" :style="{color:item.content[3].colortext}"></li>
<text :style="{fontSize:item.content[3].size,color:item.content[3].colorvalue}">{{item.content[3].value}}</text>
</view> -->
</view>
<view v-else-if="item.kind == 5" :key="index"
:class="[(index+1)%3==0 ? '':'marginRight','kind','kind_five','breathe-red']"
:style="{backgroundImage:'linear-gradient(to top right,'+item.background[0]+','+item.background[1]+')',marginRight:(index+1)%3==0?'0rpx':'40rpx'}">
<view class="view_100" :style="{fontSize:item.content[0].size,color:item.content[0].colortext}">
{{item.content[0].text}}
</view>
<view class="view_100" :style="{fontSize:item.content[1].size,color:item.content[1].colorvalue}">
{{item.content[1].value}}
</view>
<view class="five_3 view_100">
<view v-for="(j,i) in 2" :key="i">
<text
:style="{fontSize:item.content[j+2].size,color:item.content[j+2].colortext}">{{item.content[j+2].text}}</text>
<text
:style="{fontSize:item.content[j+2].size,color:item.content[j+2].colorvalue}">{{item.content[j+2].value}}</text>
</view>
</view>
<view class="five_4">
<text
:style="{fontSize:item.content[4].size,color:item.content[4].colortext}">{{item.content[4].text}}</text>
<text
:style="{fontSize:item.content[4].size,color:item.content[4].colorvalue}">{{item.content[4].value}}</text>
</view>
</view>
</template>
</view>
</template>
<script>
export default {
props: {
content: {
type: Array,
default: []
},
},
data() {
return {}
},
methods: {
},
mounted() {
uni.onWindowResize((res) => {
console.log('变化后的窗口宽度=' + res.size.windowWidth)
console.log('变化后的窗口高度=' + res.size.windowHeight)
})
}
}
</script>
<style lang="scss">
.text_block {
display: flex;
width: 100%;
flex-wrap: wrap;
.marginRight {
margin-right: 36rpx !important;
}
.view_100 {
width: 100%;
}
.CPT_DYBG {
overflow: hidden;
position: relative;
}
.kind {
width: 40%;
padding: 10rpx;
margin-bottom: 40rpx;
display: flex;
justify-content: center;
flex-wrap: wrap;
border-radius: 16rpx;
margin-left: 4.5%;
box-shadow: -4px 4px 4px #ccc;
position: relative;
}
.kind_one {
border-radius: 10rpx;
}
.kind_two {
border-radius: 10rpx;
}
.kind_three {
border-radius: 16rpx;
width: 300rpx;
margin: 0 auto;
.three_3 {
display: flex;
justify-content: space-around;
}
}
.kind_four {
border-radius: 10rpx;
.four_3 {
display: flex;
li {
list-style-type: none;
}
.icon {
margin-top: -8rpx;
transform: scale(0.8);
}
}
}
.kind_five {
border-radius: 20rpx;
.five_3 {
view {
width: 100%;
}
}
}
}
// .breathe-blue {
// position:relative;
// color:#fff;
// text-align:center;
// cursor:pointer;
// box-shadow:0 1px 2px rgba(0,0,0,.3);
// overflow:hidden;
// -webkit-animation-timing-function:ease-in-out;
// -webkit-animation-name:breatheblue;
// -webkit-animation-duration:2000ms;
// -webkit-animation-iteration-count:infinite;
// -webkit-animation-direction:alternate;
// }
// @keyframes breatheblue {
// 0% {
// opacity:.8;
// box-shadow:0 1px 2px rgba(62,178,245,0.5);
// }
// 100% {
// opacity:1;
// box-shadow:0 1px 30px rgba(147,116,247,0.6);
// }
// }
// .breathe-red {
// position:relative;
// color:#fff;
// text-align:center;
// cursor:pointer;
// box-shadow:0 1px 2px rgba(0,0,0,.3);
// overflow:hidden;
// -webkit-animation-timing-function:ease-in-out;
// -webkit-animation-name:breathered;
// -webkit-animation-duration:2000ms;
// -webkit-animation-iteration-count:infinite;
// -webkit-animation-direction:alternate;
// }
// @keyframes breathered {
// 0% {
// opacity:.8;
// box-shadow:0 1px 2px rgba(247,126,137,0.5);
// }
// 100% {
// opacity:1;
// box-shadow:0 1px 30px rgba(247,149,59,0.9);
// }
// }
</style>

View File

@@ -0,0 +1,167 @@
<template>
<view class="uni-section">
<view class="uni-section-header" @click="onClick">
<view class="uni-section-header__decoration" v-if="type" :class="type" />
<slot v-else name="decoration"></slot>
<view class="uni-section-header__content">
<text :style="{'font-size':titleFontSize,'color':titleColor}" class="uni-section__content-title" :class="{'distraction':!subTitle}">{{ title }}</text>
<text v-if="subTitle" :style="{'font-size':subTitleFontSize,'color':subTitleColor}" class="uni-section-header__content-sub">{{ subTitle }}</text>
</view>
<view class="uni-section-header__slot-right">
<slot name="right"></slot>
</view>
</view>
<view class="uni-section-content" :style="{padding: _padding}">
<slot />
</view>
</view>
</template>
<script>
/**
* Section 标题栏
* @description 标题栏
* @property {String} type = [line|circle|square] 标题装饰类型
* @value line 竖线
* @value circle 圆形
* @value square 正方形
* @property {String} title 主标题
* @property {String} titleFontSize 主标题字体大小
* @property {String} titleColor 主标题字体颜色
* @property {String} subTitle 副标题
* @property {String} subTitleFontSize 副标题字体大小
* @property {String} subTitleColor 副标题字体颜色
* @property {String} padding 默认插槽 padding
*/
export default {
name: 'UniSection',
emits:['click'],
props: {
type: {
type: String,
default: ''
},
title: {
type: String,
required: true,
default: ''
},
titleFontSize: {
type: String,
default: '14px'
},
titleColor:{
type: String,
default: '#333'
},
subTitle: {
type: String,
default: ''
},
subTitleFontSize: {
type: String,
default: '12px'
},
subTitleColor: {
type: String,
default: '#999'
},
padding: {
type: [Boolean, String],
default: false
}
},
computed:{
_padding(){
if(typeof this.padding === 'string'){
return this.padding
}
return this.padding?'10px':''
}
},
watch: {
title(newVal) {
if (uni.report && newVal !== '') {
uni.report('title', newVal)
}
}
},
methods: {
onClick() {
this.$emit('click')
}
}
}
</script>
<style lang="scss" >
$uni-primary: #2979ff !default;
.uni-section {
background-color: #fff;
.uni-section-header {
position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
padding: 12px 10px;
font-weight: normal;
&__decoration{
margin-right: 6px;
background-color: $uni-primary;
&.line {
width: 4px;
height: 12px;
border-radius: 10px;
}
&.circle {
width: 8px;
height: 8px;
border-top-right-radius: 50px;
border-top-left-radius: 50px;
border-bottom-left-radius: 50px;
border-bottom-right-radius: 50px;
}
&.square {
width: 8px;
height: 8px;
}
}
&__content {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
flex: 1;
color: #333;
.distraction {
flex-direction: row;
align-items: center;
}
&-sub {
margin-top: 2px;
}
}
&__slot-right{
font-size: 14px;
}
}
.uni-section-content{
font-size: 14px;
}
}
</style>