|
@@ -6,6 +6,8 @@
|
|
|
|
|
|
<!-- First Section: 巡视工单 to 联系方式 -->
|
|
|
<view class="form-section">
|
|
|
+ <!-- 遮罩层 -->
|
|
|
+ <view v-if="isProcessing" class="mask"></view>
|
|
|
<u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules" ref="inputForm" v-if="!nodeFlag">
|
|
|
|
|
|
<u-form-item label="清运编号" prop="no">
|
|
@@ -103,7 +105,7 @@
|
|
|
:disabled="true"
|
|
|
placeholder="请选择巡视工单编号">
|
|
|
</u--input>
|
|
|
- <u-button type="primary" style="width: 20%" text="处理" @click="disposeWorkOver(inputForm.workOverNoList[index_workOver].id)"></u-button>
|
|
|
+ <u-button type="primary" style="width: 20%" text="处理" @click="disposeWorkOver(inputForm.workOverNoList[index_workOver].id)" v-if="!weighFlag"></u-button>
|
|
|
</u-form-item>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -120,7 +122,6 @@
|
|
|
:disabled="true"
|
|
|
:fileList="fileList1"
|
|
|
@afterRead="afterRead"
|
|
|
- @delete="deletePic"
|
|
|
name="1"
|
|
|
multiple
|
|
|
:maxCount="10"
|
|
@@ -136,7 +137,6 @@
|
|
|
:disabled="true"
|
|
|
:fileList="fileList2"
|
|
|
@afterRead="afterRead"
|
|
|
- @delete="deletePic"
|
|
|
name="2"
|
|
|
multiple
|
|
|
:maxCount="10"
|
|
@@ -152,7 +152,6 @@
|
|
|
:disabled="true"
|
|
|
:fileList="fileList3"
|
|
|
@afterRead="afterRead"
|
|
|
- @delete="deletePic"
|
|
|
name="3"
|
|
|
multiple
|
|
|
:maxCount="10"
|
|
@@ -161,8 +160,8 @@
|
|
|
</view>
|
|
|
|
|
|
<!-- Third Section: 备注 -->
|
|
|
- <view class="form-section">
|
|
|
- <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules" ref="inputForm" v-if="!nodeFlag">
|
|
|
+ <view class="form-section" v-if="!nodeFlag">
|
|
|
+ <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules" ref="inputForm" >
|
|
|
<u-form-item label="备注" borderBottom prop="remarks">
|
|
|
<u--textarea placeholder='请填写备注' :maxlength="500" v-model="inputForm.remarks"></u--textarea>
|
|
|
</u-form-item>
|
|
@@ -177,6 +176,62 @@
|
|
|
</view>-->
|
|
|
</u--form>
|
|
|
</view>
|
|
|
+ <!-- Third Section: 备注 -->
|
|
|
+ <view class="form-section" v-if="nodeFlag || weighFlag">
|
|
|
+ <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules" ref="inputForm" >
|
|
|
+ <u-form-item label="备注" borderBottom prop="remarks">
|
|
|
+ <u--textarea placeholder='请填写备注' :disabled="true" :maxlength="500" v-model="inputForm.remarks"></u--textarea>
|
|
|
+ </u-form-item>
|
|
|
+ </u--form>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="form-section" v-if="weighFlag">
|
|
|
+ <span style="color: #4396fd;">现场信息登记</span>
|
|
|
+ <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules" ref="inputForm">
|
|
|
+
|
|
|
+ <u-form-item label="重量(t)" prop="weight" :required="true">
|
|
|
+ <u--input
|
|
|
+ v-model="inputForm.weight"
|
|
|
+ @input="handleInput('weight', $event)"
|
|
|
+ placeholder="重量"
|
|
|
+ clearable
|
|
|
+ ></u--input>
|
|
|
+ </u-form-item>
|
|
|
+
|
|
|
+ <u-form-item label="运输里程(km)" prop="transportMileage" :required="true">
|
|
|
+ <u--input
|
|
|
+ v-model="inputForm.transportMileage"
|
|
|
+ @input="handleInput('transportMileage', $event)"
|
|
|
+ placeholder="运输里程"
|
|
|
+ clearable
|
|
|
+ ></u--input>
|
|
|
+ </u-form-item>
|
|
|
+
|
|
|
+ <u-form-item label="补贴(元)" prop="subsidy" :required="true">
|
|
|
+ <u--input
|
|
|
+ v-model="inputForm.subsidy"
|
|
|
+ @input="handleInput('subsidy', $event)"
|
|
|
+ placeholder="补贴"
|
|
|
+ clearable
|
|
|
+ ></u--input>
|
|
|
+ </u-form-item>
|
|
|
+ </u--form>
|
|
|
+ </view>
|
|
|
+ <!-- Second Section: 上传图片 -->
|
|
|
+ <view class="form-section" v-if="weighFlag">
|
|
|
+ <text style="color: black">过磅现场照片</text>
|
|
|
+ <view class="u-page__upload-item" >
|
|
|
+ <text class="u-demo-block__title">照片上传</text>
|
|
|
+ <u-upload
|
|
|
+ :fileList="fileList4"
|
|
|
+ @afterRead="afterRead"
|
|
|
+ @delete="deletePic"
|
|
|
+ name="4"
|
|
|
+ multiple
|
|
|
+ :maxCount="10"
|
|
|
+ ></u-upload>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
<WorkOverChoose ref="workOverChoose" @input="selectWorkOverChange" title="报告项目选择"/>
|
|
|
</view>
|
|
|
</template>
|
|
@@ -200,11 +255,15 @@
|
|
|
data () {
|
|
|
return {
|
|
|
disFlag: true, // 启用动态获取处理单位则设置为false
|
|
|
+ isProcessing: false, // 遮罩层
|
|
|
processingUnits: [],
|
|
|
+ taskName: '', //当前节点处理人节点名称
|
|
|
fileList1: [],
|
|
|
fileList2: [],
|
|
|
fileList3: [],
|
|
|
+ fileList4: [],
|
|
|
nodeFlag: false,
|
|
|
+ weighFlag: false, // 过磅管理员看到的信息
|
|
|
inputForm: {
|
|
|
programId: '',
|
|
|
programIds: [],
|
|
@@ -219,6 +278,9 @@
|
|
|
workOverNoList: [],
|
|
|
disposeType: '',
|
|
|
rubbishStation: '',
|
|
|
+ weight: '',
|
|
|
+ transportMileage: '',
|
|
|
+ subsidy: '',
|
|
|
},
|
|
|
rules: {
|
|
|
'processingUnit': [
|
|
@@ -296,78 +358,83 @@
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
- async init (id) {
|
|
|
- this.nodeFlag = true
|
|
|
- this.inputForm.id = id
|
|
|
+ handleInput(field, value) {
|
|
|
+ // Ensure value is a string and sanitize input
|
|
|
+ value = value.toString();
|
|
|
+
|
|
|
+ // Regular expression to match numbers with up to 2 decimal places and ensure positive value
|
|
|
+ const regex = /^(?!.*[a-zA-Z])\-?\d+(\.\d{0,2})?$/;
|
|
|
+
|
|
|
+ // Format the value based on regex
|
|
|
+ const match = value.match(regex);
|
|
|
+ console.log(match)
|
|
|
+ let formattedValue = (match && match[0]) || '';
|
|
|
+
|
|
|
+ // Ensure the value is positive
|
|
|
+ if (parseFloat(formattedValue) < 0) {
|
|
|
+ formattedValue = '';
|
|
|
+ }
|
|
|
+
|
|
|
+ // Update input form based on the field
|
|
|
+ this.inputForm[field] = formattedValue;
|
|
|
+ },
|
|
|
+ async init(id) {
|
|
|
+ this.nodeFlag = true;
|
|
|
+ this.inputForm.id = id;
|
|
|
+
|
|
|
if (id) {
|
|
|
- await disposeRubbishService.queryById(id).then((data) => {
|
|
|
- /*if (this.status === 'testSee') {
|
|
|
- this.nodeFlag = true
|
|
|
- } else {
|
|
|
- this.taskService.getTaskNameByProcInsId(data.procInsId).then((data) => {
|
|
|
- if (this.isNotEmpty(data)) {
|
|
|
- if (data === '发起人重新申请' || this.isEmpty(data)) {
|
|
|
- this.nodeFlag = false
|
|
|
- } else if (data === '发票管理员审核'){
|
|
|
- this.nodeFlag = true
|
|
|
- this.addFlag = true
|
|
|
- }
|
|
|
- }else {
|
|
|
- this.testFlag = true
|
|
|
- this.addFlag = true
|
|
|
- console.log('没有')
|
|
|
- }
|
|
|
- })
|
|
|
- }*/
|
|
|
-
|
|
|
-
|
|
|
- this.inputForm = this.recover(this.inputForm, data)
|
|
|
-
|
|
|
- if (data.fileList1) {
|
|
|
- this.fileList1 = []
|
|
|
- data.fileList1.forEach(
|
|
|
- (item) => {
|
|
|
- const newItem = {
|
|
|
- attachmentName: item.name,
|
|
|
- fileSize: item.size,
|
|
|
- url: item.temporaryUrl,
|
|
|
- type: item.type, // 如果不需要,可以不写
|
|
|
- };
|
|
|
- this.fileList1.push(newItem);
|
|
|
- }
|
|
|
- );
|
|
|
- }
|
|
|
- if (data.fileList2) {
|
|
|
- this.fileList2 = []
|
|
|
- data.fileList2.forEach(
|
|
|
- (item) => {
|
|
|
- const newItem = {
|
|
|
- attachmentName: item.name,
|
|
|
- fileSize: item.size,
|
|
|
- url: item.temporaryUrl,
|
|
|
- type: item.type, // 如果不需要,可以不写
|
|
|
- };
|
|
|
- this.fileList2.push(newItem);
|
|
|
- }
|
|
|
- );
|
|
|
- }
|
|
|
- if (data.fileList3) {
|
|
|
- this.fileList3 = []
|
|
|
- data.fileList3.forEach(
|
|
|
- (item) => {
|
|
|
- const newItem = {
|
|
|
- attachmentName: item.name,
|
|
|
- fileSize: item.size,
|
|
|
- url: item.temporaryUrl,
|
|
|
- type: item.type, // 如果不需要,可以不写
|
|
|
- };
|
|
|
- this.fileList3.push(newItem);
|
|
|
- }
|
|
|
- );
|
|
|
+ // 使用 await 等待查询结果
|
|
|
+ const data = await disposeRubbishService.queryById(id);
|
|
|
+ console.log('查询当前信息', data);
|
|
|
+
|
|
|
+ // 获取当前节点流程信息,并等待其执行完成
|
|
|
+ const taskName = await taskService.getTaskNameByProcInsId(data.procInsId);
|
|
|
+ this.taskName = taskName
|
|
|
+ console.log('查询当前节点流程信息', taskName);
|
|
|
+
|
|
|
+ // 根据任务名称处理逻辑
|
|
|
+ if (this.isNotEmpty(taskName)) {
|
|
|
+ if (taskName === '发起人重新申请' || this.isEmpty(taskName)) {
|
|
|
+ this.nodeFlag = false;
|
|
|
+ } else if (taskName === '过磅专员处理') {
|
|
|
+ this.nodeFlag = true;
|
|
|
+ this.weighFlag = true;
|
|
|
}
|
|
|
- })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 恢复表单数据
|
|
|
+ this.inputForm = this.recover(this.inputForm, data);
|
|
|
+
|
|
|
+ // 处理文件列表
|
|
|
+ if (data.fileList1) {
|
|
|
+ this.fileList1 = data.fileList1.map(item => ({
|
|
|
+ attachmentName: item.name,
|
|
|
+ fileSize: item.size,
|
|
|
+ url: item.temporaryUrl,
|
|
|
+ type: item.type // 如果不需要,可以不写
|
|
|
+ }));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (data.fileList2) {
|
|
|
+ this.fileList2 = data.fileList2.map(item => ({
|
|
|
+ attachmentName: item.name,
|
|
|
+ fileSize: item.size,
|
|
|
+ url: item.temporaryUrl,
|
|
|
+ type: item.type // 如果不需要,可以不写
|
|
|
+ }));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (data.fileList3) {
|
|
|
+ this.fileList3 = data.fileList3.map(item => ({
|
|
|
+ attachmentName: item.name,
|
|
|
+ fileSize: item.size,
|
|
|
+ url: item.temporaryUrl,
|
|
|
+ type: item.type // 如果不需要,可以不写
|
|
|
+ }));
|
|
|
+ }
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
+ ,
|
|
|
async selectWorkOverChange(rows, index) {
|
|
|
if (rows.length > 0) {
|
|
|
rows.forEach((item, rowIndex) => {
|
|
@@ -437,6 +504,7 @@
|
|
|
|
|
|
// 显示 项目选择器
|
|
|
disposeWorkOver(id) {
|
|
|
+ console.log(this.inputForm.status)
|
|
|
if(this.inputForm.status === '2'){
|
|
|
uni.navigateTo({
|
|
|
url: '/pages/edt/PatrolWorkOrderForm?id='+id
|
|
@@ -558,6 +626,7 @@
|
|
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
|
},
|
|
|
saveForm(callback) {
|
|
|
+ this.isProcessing = true; // 显示遮罩层
|
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
// 表单规则验证
|
|
@@ -580,10 +649,22 @@
|
|
|
if(this.inputForm.programIds.length == 0){
|
|
|
errors.push("请选择巡视工单")
|
|
|
}
|
|
|
+ if(this.weighFlag){
|
|
|
+ if(!this.inputForm.weight){
|
|
|
+ errors.push("请填写重量")
|
|
|
+ }
|
|
|
+ if(!this.inputForm.transportMileage){
|
|
|
+ errors.push("请填写运输里程")
|
|
|
+ }
|
|
|
+ if(!this.inputForm.subsidy){
|
|
|
+ errors.push("请填写补贴金额")
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
if (errors.length > 0) {
|
|
|
// 存在错误,显示提示信息
|
|
|
errors.forEach(error => {
|
|
|
+ this.isProcessing = false; // 显示遮罩层
|
|
|
uni.showToast({
|
|
|
title: error,
|
|
|
icon: 'none',
|
|
@@ -595,14 +676,38 @@
|
|
|
// 所有验证通过,执行保存操作
|
|
|
this.$refs.inputForm.validate().then(() => {
|
|
|
uni.showLoading();
|
|
|
- this.inputForm.status = '2'
|
|
|
+ if(this.weighFlag){
|
|
|
+ this.inputForm.status = '5'
|
|
|
+ }else{
|
|
|
+ if(this.inputForm.disposeType === '1'){
|
|
|
+ this.inputForm.status = '2'
|
|
|
+ }else if(this.inputForm.disposeType === '2'){
|
|
|
+ if(this.taskName){
|
|
|
+ this.inputForm.status = '5'
|
|
|
+ }else{
|
|
|
+ this.inputForm.status = '2'
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.inputForm.status = '2'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.inputForm.fileList4 = this.fileList4
|
|
|
disposeRubbishService.save(this.inputForm).then(data => {
|
|
|
- callback(data.businessTable, data.businessId,this.inputForm.disposeType);
|
|
|
- uni.showToast({title:"提交成功", icon:"success"});
|
|
|
- // 返回上一页
|
|
|
- uni.navigateBack({
|
|
|
- delta: 1
|
|
|
+ console.log('提交成功拉')
|
|
|
+ uni.showToast({
|
|
|
+ title: "提交成功",
|
|
|
+ icon: "success",
|
|
|
+ duration: 1000 // 提示持续时间为1秒(1000毫秒)
|
|
|
});
|
|
|
+
|
|
|
+ // 延迟1秒后再跳转到上一页
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isProcessing = false; // 显示遮罩层
|
|
|
+ callback(data.businessTable, data.businessId,this.inputForm.disposeType);
|
|
|
+ uni.navigateBack({
|
|
|
+ delta: 1
|
|
|
+ });
|
|
|
+ }, 1000);
|
|
|
resolve('Form saved successfully');
|
|
|
}).catch(error => {
|
|
|
reject('Save operation failed');
|
|
@@ -707,4 +812,14 @@
|
|
|
.cu-form-group .title {
|
|
|
min-width: 100px;
|
|
|
}
|
|
|
+ /* 遮罩层样式 */
|
|
|
+ .mask {
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ background-color: rgba(0, 0, 0, 0.05); /* 半透明遮罩 */
|
|
|
+ z-index: 9999; /* 确保遮罩层在最顶层 */
|
|
|
+ }
|
|
|
</style>
|