修改完成

This commit is contained in:
ljx120 2025-01-01 16:59:55 +08:00
parent facb66b99b
commit 8559019904
7 changed files with 768 additions and 250 deletions

View File

@ -255,6 +255,18 @@
"bounce": "none"
}
}
},
{
"path" : "pages/maintenance/m-flow",
"style" :
{
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"disableScroll": true,
"app-plus": {
"bounce": "none"
}
}
}
],
"globalStyle": {

View File

@ -4,7 +4,6 @@
import { getAction } from '../../common/http';
import { showToast } from 'vant';
const showDialog = ref(false)
const formList = ref([] as any[])
const otherList = ref([] as any[])
onMounted(() => {
@ -62,18 +61,14 @@
})
const onClickLeft = () => {
history.back()
uni.navigateBack()
}
//
const confirmSecond = () => {
}
const onSubmit = () => {
}
const form = ref({ processes: [{}] } as any)
const form = ref({ fabrics: [{processes:[{}]}] } as any)
const showPicker = ref(false)
const typeData = ref()
const popuList = ref([] as any[])
@ -208,19 +203,19 @@
:rules="[{ required: true, message: '请填写' }]" label-width="5em" readonly class="bor"
@click="choosePic('')" />
<view class="a-b">
<van-button type="primary" @click="showDialog=true">面料添加</van-button>
<van-button type="primary" @click="form.fabrics.push({})">面料添加</van-button>
</view>
<view class="card">
<view class="card" v-for="(item,index) in form.fabrics" :key="index">
<view style="text-align: end;">
<van-icon name="cross" />
<van-icon name="cross" @click="form.fabrics.splice(index,1)"/>
</view>
<van-field v-model="form.fabricName" name="颜色色号" label="颜色色号" colon
:rules="[{ required: true, message: '请填写' }]" label-width="5em" />
<van-field v-model="form.fabricName" name="工艺名称" label="工艺名称" colon
:rules="[{ required: true, message: '请填写' }]" label-width="5em" readonly class="bor"
@click="choosePic('')" />
<view v-for="(item,index) in form.processes" :key="index">
<view v-for="(itemSecond,indexSecond) in item.processes" :key="index">
<view class="a-c">
<van-icon name="add" color="red" size="25" v-if="index===0"
@click="form.processes.push({})" />
@ -246,7 +241,7 @@
:rules="item.necessary?[{ required: true, message: '请填写' }]:[]" label-width="5em"
readonly class="bor" @click="choosePic('')" />
</view>
<p style="text-align: center;margin: 10rpx 0;color: #02a7f0;">复制新增</p>
<p style="text-align: center;margin: 10rpx 0;color: #02a7f0;" @click="form.fabrics.push({})">复制新增</p>
</view>
<van-field v-model="form.supplier" name="总米数" label="总米数" colon label-width="5em"

View File

@ -15,6 +15,11 @@ const ListData =ref([
name: '工艺维护',
type:'',
},
{
path:'../maintenance/m-flow',
name:'工艺流程维护',
type:''
},
{
path: '../maintenance/m-process',
name: '工序项维护',

View File

@ -6,6 +6,7 @@
const showPop = ref(false)
const list = ref([] as any[])
const form = ref({} as any)
const processList = ref([] as any[])
onMounted(() => {
init()
@ -16,17 +17,22 @@
list.value = res.data
}
})
getAction('/process').then((res:any)=>{
if(res.code===200){
processList.value=res.data.map((l:any)=>({value:l.id,text:l.name}))
}
})
}
const onClickLeft = () => {
history.back()
}
const onClickRight = () => {
form.value={}
form.value = {availableProcess:[{}]}
showPop.value = true
}
const edit = (item : any) => {
console.log(item)
form.value=JSON.parse(JSON.stringify(item))
showPop.value = true
}
const onSubmit = () => {
@ -66,6 +72,29 @@
// on cancel
});
}
const showPicker = ref(false)
const indexType = ref()
const popuList = ref([])
//
const choosePic = (index : any) => {
showPicker.value = true
indexType.value = index
}
//
const pickerConfirm = (val : any) => {
// form.value.content[indexType.value].id = val.selectedOptions[0].value
form.value.availableProcess[indexType.value].name = val.selectedOptions[0].text
showPickerCancel()
}
//
const showPickerCancel = () => {
showPicker.value = false
}
//
const handleOpen = () => {
popuList.value = processList.value
}
</script>
<template>
@ -79,8 +108,8 @@
<view class="grid-item">操作</view>
</view>
<view class="grid-container" v-for="(item,index) in list" :key="index">
<view class="grid-item">{{item.code}}</view>
<view class="grid-item">{{item.name}}</view>
<view class="grid-item">{{item.id}}</view>
<view class="grid-item"><span style="color: #35a5f7" @click="edit(item)">编辑</span> &nbsp;&nbsp; <span
style="color: red" @click="del(item)">删除
</span></view>
@ -95,11 +124,13 @@
<van-cell-group inset>
<van-field v-model="form.name" name="工厂名称" label="工厂名称" colon label-width="5em"
:rules="[{ required: true, message: '请填写' }]" />
<van-field v-model="form.factoryNo" name="工厂编号" label="工厂编号" type="number" colon label-width="5em"
<van-field v-model="form.code" name="工厂编号" label="工厂编号" type="number" colon label-width="5em"
:rules="[{ required: true, message: '请填写' }]" />
<van-field v-model="form.cylinderName" name="染缸名称" label="染缸名称" colon label-width="5em" />
<van-field v-model="form.cylinderNumber" name="染缸数量" label="染缸数量" type="number" colon label-width="5em" />
<van-field v-model="form.maximumProcess" name="最大可染" label="最大可染" type="number" colon label-width="5em" />
<van-field v-model="form.cylinderNum" name="染缸数量" label="染缸数量" type="number" colon
label-width="5em" />
<van-field v-model="form.maxProcessCount" name="最大可染" label="最大可染" type="number" colon
label-width="5em" />
<van-field name="类型" label="类型" colon label-width="5em" class="b-a"
:rules="[{ required: true, message: '请填写' }]">
<template #input>
@ -109,6 +140,18 @@
</van-radio-group>
</template>
</van-field>
<view class="a-b">
<van-button type="primary" @click="form.availableProcess.push({})">可做工序</van-button>
</view>
<view class="grid-container1">
<view class="grid-item">工序名称</view>
<view class="grid-item">操作</view>
</view>
<view class="grid-container1" v-for="(item,index) in form.availableProcess" :key="index">
<view class="grid-item" @click="choosePic(index)">{{item.name}}</view>
<view class="grid-item" style="color: red" @click="form.availableProcess.splice(index,1)">删除</view>
</view>
</van-cell-group>
<view class="a-c">
<van-button type="danger" @click="showPop=false">取消</van-button>
@ -117,6 +160,12 @@
</van-form>
</view>
</van-popup>
<!--选择框-->
<van-popup v-model:show="showPicker" round position="bottom" @open="handleOpen">
<van-picker show-toolbar :columns="popuList" @confirm="pickerConfirm" @cancel="showPickerCancel"
ref="pickerRef" />
</van-popup>
</template>
<style scoped lang="scss">
@ -157,12 +206,23 @@
}
}
.a-b {
display: flex;
align-items: center;
.grid-container1 {
display: grid;
grid-template-columns: 2fr 1fr;
::v-deep .van-cell {
padding: 0;
.grid-item {
border: 1rpx solid #f2f2f2;
text-align: center;
padding: 10rpx 0;
}
}
.a-b {
margin: 10rpx;
::v-deep .van-button--normal {
padding: 5px 8px;
height: 30px;
}
}

View File

@ -0,0 +1,254 @@
<script lang="ts" setup>
import { showConfirmDialog, showToast } from 'vant';
import { onMounted, ref } from 'vue'
import { deleteAction, getAction, postAction, putAction } from '../../common/http';
const showPop = ref(false)
const list = ref([] as any[])
const form = ref({} as any)
const processList = ref([] as any[])
onMounted(() => {
init()
getAction('/process').then((res : any) => {
if (res.code === 200) {
processList.value = res.data.map((l : any) => ({ text: l.name, value: l.id }))
}
})
})
const init = () => {
getAction('/craftFlows').then((res : any) => {
if (res.code === 200) {
list.value = res.data
}
})
}
const onClickLeft = () => {
history.back()
}
const onClickRight = () => {
form.value = {processes: [{}]}
showPop.value = true
}
const edit = (item : any) => {
form.value=JSON.parse(JSON.stringify(item))
showPop.value = true
}
const onSubmit = () => {
if (form.value.id) {
putAction('/craftFlows', form.value).then((res : any) => {
if (res.code === 200) {
init()
showPop.value = false
showToast('提交成功!')
}
})
} else {
postAction('/craftFlows', form.value).then((res : any) => {
if (res.code === 200) {
init()
showPop.value = false
showToast('提交成功!')
}
})
}
}
const del = (item : any) => {
showConfirmDialog({
title: '提示',
message: '是否确认删除?',
}).then(() => {
let url = '/craftFlows/' + item.id
deleteAction(url).then((res : any) => {
if (res.code === 200) {
init()
showToast('删除成功!')
}
})
})
.catch(() => {
// on cancel
});
}
const showPicker = ref(false)
const indexType = ref()
const popuList = ref([])
//
const choosePic = (index : any) => {
showPicker.value = true
indexType.value = index
}
//
const pickerConfirm = (val : any) => {
form.value.processes[indexType.value].id = val.selectedOptions[0].value
form.value.processes[indexType.value].name = val.selectedOptions[0].text
showPickerCancel()
}
//
const showPickerCancel = () => {
showPicker.value = false
}
//
const handleOpen = () => {
popuList.value = processList.value
}
</script>
<template>
<view class="flex">
<van-nav-bar title="工艺流程维护" left-text="返回" left-arrow right-text="新增" @click-left="onClickLeft"
@click-right="onClickRight" />
<view class="content">
<view class="grid-container">
<view class="grid-item">工艺流程名称</view>
<view class="grid-item">操作</view>
</view>
<view class="grid-container" v-for="(item,index) in list" :key="index">
<view class="grid-item">{{item.name}}</view>
<view class="grid-item"><span style="color: #35a5f7" @click="edit(item)">编辑</span> &nbsp;&nbsp; <span
style="color: red" @click="del(item)">删除
</span></view>
</view>
</view>
</view>
<van-popup v-model:show="showPop" style="width: 90%" round>
<view>
<h3 style="text-align: center">新增工艺流程</h3>
<van-form @submit="onSubmit">
<van-cell-group inset>
<van-field v-model="form.name" name="工艺流程名称" label="工艺流程名称" colon label-width="7em"
:rules="[{ required: true, message: '请填写' }]" />
<van-field name="工序流程类型" label="工序流程类型" colon label-width="7em" class="b-a"
:rules="[{ required: true, message: '请填写' }]">
<template #input>
<van-radio-group v-model="form.type" direction="horizontal">
<van-radio name="常规">常规</van-radio>
<van-radio name="回修">回修</van-radio>
</van-radio-group>
</template>
</van-field>
<p>请选择对应工序</p>
<view v-for="(item,index) in form.processes" :key="index" class="a-b">
<van-icon name="add" color="red" size="25" v-if="index===0" @click="form.processes.push({})" />
<van-icon name="clear" color="red" size="25" v-if="index!=0"
@click="form.processes.splice(index,1)" />
<van-field v-model="item.name" name="工序" label="工序" label-align="right" readonly colon
label-width="2.5em" class="bor" @click="choosePic(index)"
:rules="[{ required: true, message: '请填写' }]">
</van-field>
<van-checkbox v-model="item.necessary" :name="false" style="margin-left: 15rpx;">不可跳过</van-checkbox>
</view>
</van-cell-group>
<view class="a-c">
<van-button type="danger" @click="showPop=false">取消</van-button>
<van-button type="primary" native-type="submit">确认</van-button>
</view>
</van-form>
</view>
</van-popup>
<!--选择框-->
<van-popup v-model:show="showPicker" round position="bottom" @open="handleOpen">
<van-picker show-toolbar :columns="popuList" @confirm="pickerConfirm" @cancel="showPickerCancel"
ref="pickerRef" />
</van-popup>
</template>
<style scoped lang="scss">
.flex {
display: flex;
flex-direction: column;
height: 100vh;
width: 100vw;
.van-nav-bar {
width: 100%;
}
.content {
flex: 1;
padding: 0 20rpx;
.grid-container {
display: grid;
grid-template-columns: 3fr 1fr;
.grid-item {
border: 1rpx solid #f2f2f2;
text-align: center;
::v-deep(.van-cell) {
padding: 0 10rpx;
}
}
}
.card {
margin: 20rpx 30rpx;
padding: 10rpx;
border: 1rpx solid #02a7f0;
border-radius: 20rpx;
}
}
}
.a-b {
display: flex;
align-items: center;
::v-deep .van-cell {
padding: 0;
}
}
::v-deep .van-field {
font-size: 16px;
}
::v-deep .van-field__control {
border-bottom: 1rpx solid #d7d7d7;
text-align: center;
}
::v-deep .van-field__label {
text-align: end !important;
}
.b-a {
::v-deep .van-field__control {
border-bottom: none;
}
}
.a-b {
display: flex;
align-items: center;
padding: 10rpx 0;
::v-deep .van-field__control {
border: 1rpx solid #d7d7d7;
text-align: center;
}
::v-deep .van-field {
width: 62% !important;
}
}
.a-c {
display: flex;
align-items: center;
justify-content: space-around;
margin: 30rpx;
::v-deep .van-button--normal {
padding: 0 30rpx !important;
height: 60rpx;
}
}
</style>

View File

@ -1,18 +1,21 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue'
import { getAction, postAction, putAction } from '../../common/http';
import { showToast } from 'vant';
import { deleteAction, getAction, postAction, putAction } from '../../common/http';
import { showConfirmDialog, showToast } from 'vant';
const showPop = ref(false)
const list = ref([] as any[])
const list = ref([{}] as any[])
const listItem = ref({} as any)
const form = ref({} as any)
const form1 = ref({} as any)
const showSecond = ref(false)
onMounted(() => {
init()
})
function init() {
getAction('/craftRequire').then((res : any) => {
getAction('/craftCommentCategory').then((res : any) => {
if (res.code === 200) {
list.value = res.data
}
@ -22,24 +25,43 @@
const onClickLeft = () => {
history.back()
}
const poClickLeft = () => {
showSecond.value = false
}
const onClickRight = () => {
showPop.value = true
form.value = { requirements: [{}] }
form1.value = {}
}
const addLittle = (item : any) => {
form.value.id = item.id
form.value.craft = item.craft
form.value.requirements = item.requirements.map((l : any) => ({type:l}))
const showLit = ref(false)
const poClickRight = () => {
showLit.value = true
form.value = { content: [{}] }
}
//
const onChange = (item : any) => {
if (item.type === 'Select') {
item.chooses = [{ value: '' }]
} else {
item.chooses = null
}
}
//
const toShowLit = (item : any) => {
listItem.value = item
showSecond.value = true
}
//
const EditCate = (item : any) => {
showPop.value = true
form1.value = JSON.parse(JSON.stringify(item))
}
const submit = () => {
let requirements = form.value.requirements.map((l : any) => (l.type))
let param = {
craft: form.value.craft,
requirements: requirements
}
if (form.value.id) {
putAction('/craftRequire', { id: form.value.id, ...param }).then((res : any) => {
if (form1.value.categoryId) {
putAction('/craftCommentCategory', { id: form1.value.categoryId, category: form1.value.category }).then((res : any) => {
if (res.code === 200) {
init()
showPop.value = false
@ -47,7 +69,7 @@
}
})
} else {
postAction('/craftRequire', param).then((res : any) => {
postAction('/craftCommentCategory', { category: form1.value.category }).then((res : any) => {
if (res.code === 200) {
init()
showPop.value = false
@ -56,48 +78,174 @@
})
}
}
const onSubmit = () => {
postAction('/craftComment', { categoryId: listItem.value.categoryId, ...form.value }).then((res : any) => {
if (res.code === 200) {
init()
listItem.value.subCategory.push(form.value)
showLit.value = false
showToast('提交成功!')
}
})
}
const del = (item : any) => {
showConfirmDialog({
title: '提示',
message: '是否确认删除?',
}).then(() => {
let url = '/craftCommentCategory/' + item.categoryId
deleteAction(url).then((res : any) => {
if (res.code === 200) {
init()
showToast('删除成功!')
}else{
showToast(res.msg)
}
})
})
.catch(() => {
// on cancel
});
}
const delSecond = (item : any,index:any) =>{
showConfirmDialog({
title: '提示',
message: '是否确认删除?',
}).then(() => {
let url = '/craftComment/' + item.id
deleteAction(url).then((res : any) => {
if (res.code === 200) {
init()
listItem.value.subCategory.splice(index,1)
showToast('删除成功!')
}
})
})
.catch(() => {
// on cancel
});
}
</script>
<template>
<view class="flex">
<van-nav-bar title="工艺要求维护" left-text="返回" left-arrow right-text="新增" @click-left="onClickLeft"
@click-right="onClickRight" />
<view class="grid-container">
<view class="grid-item">大类</view>
<view class="grid-item">操作</view>
</view>
<view class="content">
<view class="card" v-for="(item,index) in list" :key="index">
<view
style="display: flex;align-items: center;justify-content: space-between;border-bottom: 1px solid #d7d7d7;padding: 5px">
<p>{{item.craft}}</p>
<p style="display: flex;align-items: center"> <van-icon name="add" color="red" size="25"
@click="addLittle(item)" /> 编辑</p>
</view>
<view class="grid-container">
<view class="grid-item" v-for="(itemSecond,indexSecond) in item.requirements" :key="indexSecond">
<span>{{itemSecond}}</span>
<!-- <van-icon name="clear" color="red" size="25" @click="list.splice(indexSecond,1)" /> -->
</view>
<view class="grid-container" v-for="(item,index) in list" :key="index">
<view class="grid-item">{{item.category}}</view>
<view class="grid-item" style="display: flex;align-items: center;justify-content: space-between;">
<text @click="EditCate(item)">编辑</text>
<text @click="toShowLit(item)">查看</text>
<text style="color: red;" @click="del(item)">删除</text>
</view>
</view>
</view>
</view>
<van-popup v-model:show="showSecond" style="width: 100%">
<view class="flex">
<van-nav-bar title="工艺要求维护" left-text="返回" left-arrow @click-left="poClickLeft" right-text="新增"
@click-right="poClickRight" />
<h3>{{listItem.category}}</h3>
<view class="grid-container">
<view class="grid-item">小类</view>
<view class="grid-item">操作</view>
</view>
<view class="content">
<view class="grid-container" v-for="(item,index) in listItem.subCategory" :key="index">
<view class="grid-item">{{item.subCategory}}</view>
<view class="grid-item">
<text style="color: red;" @click="delSecond(item,index)">删除</text>
</view>
</view>
</view>
</view>
</van-popup>
<van-popup v-model:show="showPop" style="width: 80%" round>
<view>
<h3 style="text-align: center">新增</h3>
<van-cell-group inset>
<van-field v-model="form.craft" name="大类" label="大类" colon label-width="4em"
:rules="[{ required: true, message: '请填写' }]" />
<view v-for="(item,index) in form.requirements" :key="index" class="a-b">
<van-icon name="add" color="red" size="25" v-if="index===0" @click="form.requirements.push({})" />
<van-icon name="clear" color="red" size="25" v-if="index!=0"
@click="form.requirements.splice(index,1)" />
<van-field v-model="item.type" name="小类" label="小类" colon label-width="2.5em"
<van-form @submit="submit">
<van-cell-group inset>
<van-field v-model="form1.category" name="大类" label="大类" colon label-width="4em"
:rules="[{ required: true, message: '请填写' }]" />
</van-cell-group>
<view class="a-c">
<van-button type="danger" @click="showPop=false">取消</van-button>
<van-button type="primary" native-type="submit">确认</van-button>
</view>
</van-cell-group>
<view class="a-c">
<van-button type="danger" @click="showPop=false">取消</van-button>
<van-button type="primary" @click="submit">确认</van-button>
</view>
</van-form>
</view>
</van-popup>
<van-popup v-model:show="showLit" style="width: 80%" round>
<view>
<van-form @submit="onSubmit">
<van-cell-group inset>
<van-field v-model="form.subCategory" name="小类名称" label="小类名称" colon label-width="5em"
:rules="[{ required: true, message: '请填写' }]" />
<view class="a-b">
<van-button type="primary" @click="form.content.push({})">出厂需上传</van-button>
</view>
<view v-for="(item,index) in form.content" :key="index">
<view class="a-d">
<van-icon name="clear" color="red" size="25" @click="form.content.splice(index,1)" />
<van-field v-model="item.name" name="上传项名称" label="上传项名称" colon label-width="6em"
:rules="[{ required: true, message: '请填写' }]" />
</view>
<van-field name="上传项类型" label="上传项类型" type="number" colon label-width="6.5em" class="bor-n"
:rules="[{ required: true, message: '请填写' }]">
<template #input>
<van-radio-group v-model="item.type" direction="horizontal" @change="onChange(item)">
<van-radio name="Input">填空</van-radio>
<van-radio name="Select">选择</van-radio>
</van-radio-group>
</template>
</van-field>
<template v-if="item.type=='Input'">
<van-field name="填写内容" label="填写内容" colon label-width="6.5em" class="bor-n">
<template #input>
<van-checkbox-group v-model="item.blank" direction="horizontal" shape="square">
<van-checkbox name="Text">文字</van-checkbox>
<van-checkbox name="File">图片</van-checkbox>
</van-checkbox-group>
</template>
</van-field>
</template>
<template v-for="(itemSecond,indexSecond) in item.chooses" :key="indexSecond"
v-if="item.type=='Select'">
<view class="a-d-1">
<van-icon name="add" color="red" size="25" v-if="indexSecond===0"
@click="item.chooses.push({})" />
<van-icon name="clear" color="red" size="25" v-if="indexSecond!=0"
@click="item.chooses.splice(indexSecond,1)" />
<van-field v-model="itemSecond.value" name="选项内容" label="选项内容" colon label-width="5em"
:rules="[{ required: true, message: '请填写' }]" />
</view>
</template>
<van-field name="是否必填" label="是否必填" colon label-width="6.5em" class="bor-n"
:rules="[{ required: true, message: '请填写' }]">
<template #input>
<van-radio-group v-model="item.necessary" direction="horizontal">
<van-radio name="true">必填</van-radio>
<van-radio name="false">选填</van-radio>
</van-radio-group>
</template>
</van-field>
</view>
</van-cell-group>
<view class="a-c">
<van-button type="danger" @click="showPop=false">取消</van-button>
<van-button type="primary" native-type="submit">确认</van-button>
</view>
</van-form>
</view>
</van-popup>
</template>
@ -107,41 +255,45 @@
display: flex;
flex-direction: column;
height: 100vh;
width: 100vw;
overflow: hidden;
margin: 0 15rpx;
.van-nav-bar {
width: 100%;
}
.grid-container {
display: grid;
grid-template-columns: 2fr 1fr;
.grid-item {
border: 1rpx solid #f2f2f2;
text-align: center;
padding: 5rpx;
}
}
.content {
flex: 1;
padding: 0 20rpx;
.grid-container {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
.grid-item {
text-align: center;
display: flex;
align-items: center;
justify-content: center;
padding: 10rpx 0;
}
}
.card {
margin: 20rpx 30rpx;
padding: 10rpx;
border: 1rpx solid #02a7f0;
border-radius: 20rpx;
}
overflow-y: scroll;
}
}
::v-deep .van-cell-group--inset {
margin: 0;
}
::v-deep .van-popup--center {
max-width: 100vw !important;
}
.a-b {
display: flex;
align-items: center;
margin: 10rpx;
::v-deep .van-button--normal {
padding: 5px 8px;
height: 30px;
}
}
::v-deep .van-field {
@ -149,7 +301,13 @@
}
::v-deep .van-field__body {
border-bottom: 1rpx solid #d7d7d7 !important;
border-bottom: 1rpx solid #d7d7d7;
}
.bor-n {
::v-deep .van-field__body {
border: none;
}
}
::v-deep .van-field__label {
@ -163,8 +321,39 @@
margin: 30rpx;
::v-deep .van-button--normal {
padding: 10rpx !important;
padding: 0 15rpx !important;
height: 60rpx !important;
}
}
.a-d-1 {
display: flex;
align-items: center;
margin-left: 30rpx;
::v-deep .van-button--normal {
padding: 8rpx;
height: 50rpx;
width: 7em;
}
::v-deep .van-cell {
padding: 10rpx 0;
}
}
.a-d {
display: flex;
align-items: center;
::v-deep .van-button--normal {
padding: 8rpx;
height: 50rpx;
width: 7em;
}
::v-deep .van-cell {
padding: 10rpx 0;
}
}
</style>

View File

@ -1,7 +1,6 @@
<template>
<view class="flex">
<van-nav-bar title="工艺维护" left-text="返回" left-arrow right-text="新增" @click-left="onClickLeft"
@click-right="onClickRight" />
<van-nav-bar title="工艺维护" left-text="返回" left-arrow @click-left="onClickLeft" @click-right="onClickRight" />
<view class="grid-container">
<view class="grid-item">工艺名称</view>
<view class="grid-item">操作</view>
@ -9,7 +8,7 @@
<view class="content">
<view class="grid-container" v-for="(item,index) in formList" :key=index>
<view class="grid-item">{{item.name}}</view>
<view class="grid-item" @click="edit(item)">编辑</view>
<view class="grid-item" @click="edit(item)" style="color: #02a7f0;">编辑</view>
</view>
</view>
</view>
@ -19,7 +18,7 @@
<view class="content">
<van-form ref="formRef" required="auto">
<van-cell-group>
<van-field label-width="7rem" label-align="right" v-model.number="form.name" type="text"
<!-- <van-field label-width="7rem" label-align="right" v-model.number="form.name" type="text"
label="工艺名称:" placeholder="请输入"
:rules="[{ required: true, message: '请输入正确内容', validator}]" />
<van-field label-width="7rem" label-align="right" required readonly type="text"
@ -44,9 +43,23 @@
</view>
</VueDraggable>
<van-button type="danger" size="mini" class="remove-btn" @click="listCBJ=[]">清空</van-button>
</view> -->
<p>绑定工序流程</p>
<view v-for="(item,index) in form.flows" :key="index" class="a-b">
<van-icon name="add" color="red" size="25" v-if="index===0" @click="form.flows.push({bind:'通用',})" />
<van-icon name="clear" color="red" size="25" v-if="index!=0"
@click="form.flows.splice(index,1)" />
<van-field v-model="item.name" name="工序流程" label="工序流程" label-align="right" readonly colon
label-width="5em" class="bor" @click="choosePic(index)">
</van-field>
<van-radio-group v-model="item.bind" @click="changeRad(index)">
<van-radio name="仅现货">现货单使用</van-radio>
</van-radio-group>
</view>
</van-cell-group>
<p>基础块</p>
<!-- <p>基础块</p>
<VueDraggable class="table-box" v-model="BaseBlock"
:group="{ name: 'people', pull: 'clone', put: false }">
<view v-for="item in BaseBlock" :key="item.name" class="table-item">
@ -75,29 +88,9 @@
style="background-color: #82d588">
{{ item.name}}
</view>
</VueDraggable>
</VueDraggable> -->
<p>请选择对应工序</p>
<view v-for="(item,index) in form.processes" :key="index" class="a-b">
<van-icon name="add" color="red" size="25" v-if="index===0" @click="form.processes.push({})" />
<van-icon name="clear" color="red" size="25" v-if="index!=0"
@click="form.processes.splice(index,1)" />
<van-field v-model="item.name" name="工序" label="工序" label-align="right" readonly colon
label-width="2.5em" class="bor" @click="choosePic(index)">
</van-field>
<van-checkbox-group v-model="item.canSkip" style="margin-left: 20rpx;">
<van-checkbox :name="false">不可跳过</van-checkbox>
</van-checkbox-group>
</view>
<van-field name="出厂前是否需要填写缩率" label="出厂前是否需要填写缩率" label-align="right" readonly colon
label-width="12em">
<template #input>
<van-radio-group v-model="form.needShrinkage" direction="horizontal">
<van-radio :name="true"></van-radio>
<van-radio :name="false"></van-radio>
</van-radio-group>
</template>
</van-field>
</van-form>
</view>
<view style="display: flex;justify-content: space-between; padding: 0 30px;margin-top: 15px;">
@ -114,101 +107,102 @@
</template>
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import { VueDraggable } from "vue-draggable-plus";
// import { VueDraggable } from "vue-draggable-plus";
import { getAction, postAction, putAction } from '../../common/http';
import { showToast } from 'vant';
const show = ref(false)
const formList = ref([])
const showPicker = ref(false)
const form = ref({ requirements: [{}] } as any)
const form = ref({ flows: [{}] } as any)
const formRef = ref();
const listDHJ = ref([])
const listCBJ = ref([])
const BaseBlock = ref([
{ name: '基础大货价', value: '$基础大货价$' },
{ name: '基础成本价', value: '$基础成本价$' },
{ name: '缩率', value: '$缩率$' },
{ name: '姆米', value: '$姆米$' },
{ name: '门幅', value: '$门幅$' }
])
const sign = ref([
{ name: '+', value: '+' },
{ name: '-', value: '-' },
{ name: '*', value: '*' },
{ name: '/', value: '/' },
{ name: '(', value: '(' },
{ name: ')', value: ')' },
{ name: '=', value: '=' },
{ name: '>', value: '>' },
{ name: '<', value: '<' },
{ name: '?', value: '?' },
{ name: ':', value: ':' },
])
const ProcessPrice = ref([
{ name: '印花价', value: '#印花价#' },
{ name: '砂洗', value: '#砂洗#' },
{ name: '水洗', value: '#水洗#' },
{ name: '印花砂洗', value: '#印花砂洗#' },
{ name: '印花水洗', value: '#印花水洗#' },
{ name: '胚布', value: '#胚布#' },
{ name: '预缩(半)', value: '#预缩(半)#' },
{ name: '预缩(全)', value: '#预缩(全)#' },
{ name: '印花预缩(半)', value: '#印花预缩(半)#' },
{ name: '印花预缩(全)', value: '#印花预缩(全)#' },
])
const numList = ref([
{ name: '1', value: '1' },
{ name: '2', value: '2' },
{ name: '3', value: '3' },
{ name: '4', value: '4' },
{ name: '5', value: '5' },
{ name: '6', value: '6' },
{ name: '7', value: '7' },
{ name: '8', value: '8' },
{ name: '9', value: '9' },
{ name: '0', value: '0' },
{ name: '.', value: '.' },
])
const validator = (val : any) => {
return !/\s/g.test(val)
// const BaseBlock = ref([
// { name: '', value: '$$' },
// { name: '', value: '$$' },
// { name: '', value: '$$' },
// { name: '', value: '$$' },
// { name: '', value: '$$' }
// ])
// const sign = ref([
// { name: '+', value: '+' },
// { name: '-', value: '-' },
// { name: '*', value: '*' },
// { name: '/', value: '/' },
// { name: '(', value: '(' },
// { name: ')', value: ')' },
// { name: '=', value: '=' },
// { name: '>', value: '>' },
// { name: '<', value: '<' },
// { name: '?', value: '?' },
// { name: ':', value: ':' },
// ])
// const ProcessPrice = ref([
// { name: '', value: '##' },
// { name: '', value: '##' },
// { name: '', value: '##' },
// { name: '', value: '##' },
// { name: '', value: '##' },
// { name: '', value: '##' },
// { name: '', value: '##' },
// { name: '', value: '##' },
// { name: '', value: '##' },
// { name: '', value: '##' },
// ])
// const numList = ref([
// { name: '1', value: '1' },
// { name: '2', value: '2' },
// { name: '3', value: '3' },
// { name: '4', value: '4' },
// { name: '5', value: '5' },
// { name: '6', value: '6' },
// { name: '7', value: '7' },
// { name: '8', value: '8' },
// { name: '9', value: '9' },
// { name: '0', value: '0' },
// { name: '.', value: '.' },
// ])
// const validator = (val : any) => {
// return !/\s/g.test(val)
// }
// const broadHeadingExpression = ref('')
// const costExpression = ref('')
const changeRad = (index:any) =>{
form.value.flows.forEach((l:any,j:any)=>{
if(j!=index){
l.bind='通用'
}else{
l.bind='仅现货'
}
})
}
const broadHeadingExpression = ref('')
const costExpression = ref('')
const onSubmit = () => {
broadHeadingExpression.value = addTransformation(listDHJ.value)
costExpression.value = addTransformation(listCBJ.value)
let processes = form.value.processes.map((l : any) => ({
name: l.name,
canSkip: l.canSkip ? l.canSkip[0] : true
}))
if (form.value.id) {
let data = {
id: form.value.id,
name: form.value.name,
broadHeadingExpression: broadHeadingExpression.value,
costExpression: costExpression.value,
processes: processes,
needShrinkage: form.value.needShrinkage
id:form.value.id,
craftName: form.value.name,
flows: form.value.flows,
}
putAction('/fabric/craft/update', data).then((res : any) => {
putAction('/flowBind', data).then((res : any) => {
if (res.code === 200) {
initData()
show.value = false
showToast('修改成功!')
}
})
} else {
}else{
let data = {
name: form.value.name,
broadHeadingExpression: broadHeadingExpression.value,
costExpression: costExpression.value
craftName: form.value.name,
flows: form.value.flows,
}
postAction('/fabric/craft/add', data).then((res : any) => {
postAction('/flowBind', data).then((res : any) => {
if (res.code === 200) {
initData()
show.value = false
showToast('提交成功!')
showToast('修改成功!')
}
})
}
@ -222,27 +216,36 @@
}
const onClickRight = () => {
show.value = true
form.value.processes = [{}]
}
const initData = () => {
formList.value=[]
getAction('/fabric/craft/info').then((res : any) => {
if (res.code === 200) {
formList.value = res.data
getAction('/flowBind').then((res1 : any) => {
if (res1.code === 200) {
res.data.forEach((l : any) => {
let item = res1.data.find((m : any) => m.craftName === l.name)
if (item) {
formList.value.push({
id: item.id,
name: item.craftName,
flows:item.flows
})
} else {
formList.value.push({
name: l.name,
flows:[{bind:'通用',}]
})
}
})
}
})
}
})
}
const edit = (item : any) => {
handlEdit(item)
form.value = item
if (item.processes) {
form.value.processes = item.processes.map((l : any) => ({
name: l.name,
canSkip: l.canSkip ? [l.canSkip] : [l.canSkip]
}))
} else {
form.value.processes = [{}]
}
show.value = true
}
@ -255,8 +258,8 @@
}
//
const pickerConfirm = (val : any) => {
form.value.processes[indexType.value].id = val.selectedOptions[0].value
form.value.processes[indexType.value].name = val.selectedOptions[0].text
form.value.flows[indexType.value].id = val.selectedOptions[0].value
form.value.flows[indexType.value].name = val.selectedOptions[0].text
showPickerCancel()
}
//
@ -271,61 +274,61 @@
const processList = ref([])
onMounted(() => {
initData()
getAction('/process').then((res : any) => {
getAction('/craftFlows').then((res : any) => {
if (res.code === 200) {
processList.value = res.data.map((l : any) => ({ text: l.name, value: l.id }))
}
})
})
const handlEdit = (item : any) => {
//
const regex = /([()+-=><?:*/])|(\$[\w\u4e00-\u9fa5]+\$)|(#[\w\u4e00-\u9fa5]+#)|([\+\*])|(\d+)/g;
// const handlEdit = (item : any) => {
// //
// const regex = /([()+-=><?:*/])|(\$[\w\u4e00-\u9fa5]+\$)|(#[\w\u4e00-\u9fa5]+#)|([\+\*])|(\d+)/g;
// 使 match
const matches = item.broadHeadingExpression.match(regex);
const matches1 = item.costExpression.match(regex);
listDHJ.value = []
listCBJ.value = []
matches.forEach((l : any) => {
// 使
const regex = /\$([\u4e00-\u9fa5]+)\$/;
const match = l.match(regex);
const regex1 = /#(.+)#/;
const match1 = l.match(regex1);
if (match) {
listDHJ.value.push({ name: match[1], value: l })
} else {
if (match1) {
listDHJ.value.push({ name: match1[1], value: l })
} else {
listDHJ.value.push({ name: l, value: l })
}
}
})
matches1.forEach((l : any) => {
// 使
const regex = /\$([\u4e00-\u9fa5]+)\$/;
const match = l.match(regex);
const regex2 = /#(.+)#/;
const match2 = l.match(regex2);
if (match) {
listCBJ.value.push({ name: match[1], value: l })
} else {
if (match2) {
listCBJ.value.push({ name: match2[1], value: l })
} else {
listCBJ.value.push({ name: l, value: l })
}
}
})
}
const addTransformation = (list : any) => {
let str = ''
list.forEach((element : any) => {
str += element.value
});
return str
}
// // 使 match
// const matches = item.broadHeadingExpression.match(regex);
// const matches1 = item.costExpression.match(regex);
// listDHJ.value = []
// listCBJ.value = []
// matches.forEach((l : any) => {
// // 使
// const regex = /\$([\u4e00-\u9fa5]+)\$/;
// const match = l.match(regex);
// const regex1 = /#(.+)#/;
// const match1 = l.match(regex1);
// if (match) {
// listDHJ.value.push({ name: match[1], value: l })
// } else {
// if (match1) {
// listDHJ.value.push({ name: match1[1], value: l })
// } else {
// listDHJ.value.push({ name: l, value: l })
// }
// }
// })
// matches1.forEach((l : any) => {
// // 使
// const regex = /\$([\u4e00-\u9fa5]+)\$/;
// const match = l.match(regex);
// const regex2 = /#(.+)#/;
// const match2 = l.match(regex2);
// if (match) {
// listCBJ.value.push({ name: match[1], value: l })
// } else {
// if (match2) {
// listCBJ.value.push({ name: match2[1], value: l })
// } else {
// listCBJ.value.push({ name: l, value: l })
// }
// }
// })
// }
// const addTransformation = (list : any) => {
// let str = ''
// list.forEach((element : any) => {
// str += element.value
// });
// return str
// }
</script>
<style scoped lang="scss">
.flex {