八项作业企业端-相关方端逻辑统一

八项作业
liujun 2024-09-23 16:23:19 +08:00
parent 97be0753ce
commit 8ac1c0d027
8 changed files with 249 additions and 29 deletions

View File

@ -226,6 +226,12 @@
"navigationBarTitleText": "动火作业申请" "navigationBarTitleText": "动火作业申请"
} }
}, },
{
"path": "pages/eight_assignments/hot_work/select_operator",
"style": {
"navigationBarTitleText": "动火作业申请"
}
},
{ {
"path": "pages/eight_assignments/hot_work/gas/name", "path": "pages/eight_assignments/hot_work/gas/name",
"style": { "style": {

View File

@ -8,6 +8,9 @@
<u-form-item label="申请办理人" prop="APPLY_USER_NAME" borderBottom required> <u-form-item label="申请办理人" prop="APPLY_USER_NAME" borderBottom required>
<u-input v-model="form.APPLY_USER_NAME" border="none" readonly /> <u-input v-model="form.APPLY_USER_NAME" border="none" readonly />
</u-form-item> </u-form-item>
<u-form-item label="作业分公司" prop="CORP_NAME" borderBottom required>
<u-input v-model="form.CORP_NAME" border="none" readonly />
</u-form-item>
<u-form-item v-if="false" label="作业编号" prop="JOB_NUMBER" borderBottom> <u-form-item v-if="false" label="作业编号" prop="JOB_NUMBER" borderBottom>
<u-input v-model="form.JOB_NUMBER" border="none" placeholder="请输入作业编号" /> <u-input v-model="form.JOB_NUMBER" border="none" placeholder="请输入作业编号" />
</u-form-item> </u-form-item>
@ -64,7 +67,7 @@
</u-radio-group> </u-radio-group>
</u-form-item> </u-form-item>
<u-form-item label="是否需要气体检测" props="IS_GAS_TESTING" borderBottom required> <u-form-item label="是否需要气体检测" props="IS_GAS_TESTING" borderBottom required>
<u-radio-group v-model="form.IS_GAS_TESTING" :customStyle="{ 'justify-content': 'flex-end' }"> <u-radio-group v-model="form.IS_GAS_TESTING" :customStyle="{ 'justify-content': 'flex-end' }" @change="fnRadioChange($event, 'IS_GAS_TESTING_NAME')">
<u-radio label="是" name="1" /> <u-radio label="是" name="1" />
<u-radio :customStyle="{ marginLeft: '8px' }" label="否" name="0" /> <u-radio :customStyle="{ marginLeft: '8px' }" label="否" name="0" />
</u-radio-group> </u-radio-group>
@ -87,7 +90,7 @@
<script> <script>
import OtherSelect from '@/components/other-select/index.vue'; import OtherSelect from '@/components/other-select/index.vue';
import {getData, setSubmitForm} from "@/utils/submitHomeworkProcess"; import {getData, setSubmitForm} from "@/utils/submitHomeworkProcess";
import useFormValidate from "@/utils/useFormValidate";
export default { export default {
components: { OtherSelect }, components: { OtherSelect },
@ -95,21 +98,30 @@ export default {
return { return {
type: '', type: '',
formItems: [ formItems: [
{ name: '申请单位', key_name: 'APPLY_DEPARTMENT_NAME', key_id: 'APPLY_DEPARTMENT_ID', type: 0 }, {name: '申请单位', key_name: 'APPLY_DEPARTMENT_NAME', key_id: 'APPLY_DEPARTMENT_ID', type: 0},
{ name: '申请办理人', key_name: 'APPLY_USER_NAME', key_id: 'APPLY_USER_ID', type: 0 }, {name: '申请办理人', key_name: 'APPLY_USER_NAME', key_id: 'APPLY_USER_ID', type: 0},
{ name: '作业编号', key_name: 'JOB_NUMBER', key_id: 'JOB_NUMBER_ID', type: 0 }, {name: "作业分公司", key_name: "CORP_NAME", key_id: "CORP_ID", type: 0},
{ name: '申请日期', key_name: 'APPLICATION_DATE', type: 0 }, {name: '作业编号', key_name: 'JOB_NUMBER', key_id: 'JOB_NUMBER_ID', type: 0},
{ name: '作业类型', key_name: 'JOB_TYPE_NAME', key_id: 'JOB_TYPE_ID', type: 0 }, {name: '申请日期', key_name: 'APPLICATION_DATE', type: 0},
{ name: '动火部位', key_name: 'HOT_WORK_POSITION', type: 0 }, {name: '作业类型', key_name: 'JOB_TYPE_NAME', key_id: 'JOB_TYPE_INDEX', type: 0},
{ name: '动火方法', key_name: 'HOT_WORK_METHOD_ID', type: 0 }, {name: '动火部位', key_name: 'HOT_WORK_POSITION', type: 0},
{ name: '动火等级', key_name: 'HOT_WORK_LEVEL_INDEX', key_id: 'HOT_WORK_LEVEL_ID', type: 0 }, {name: '动火方法', key_id: "HOT_WORK_METHOD_ID", key_name: "HOT_WORK_METHOD_NAME", type: 0},
{ name: '动火开始时间', key_name: 'HOT_WORK_TIME_START', type: 0 }, {name: '动火等级', key_name: 'HOT_WORK_LEVEL_INDEX', key_id: 'HOT_WORK_LEVEL_NAME', type: 0},
{ name: '动火结束时间', key_name: 'HOT_WORK_TIME_END', type: 0 }, {name: '动火开始时间', key_name: 'HOT_WORK_TIME_START', type: 0},
{ name: '作业内容', key_name: 'JOB_CONTENT', type: 0 }, {name: '动火结束时间', key_name: 'HOT_WORK_TIME_END', type: 0},
{ name: '动火操作人', key_name: 'USER_NAME', type: 0 }, {name: '作业内容', key_name: 'JOB_CONTENT', type: 0},
{ name: '动火操作人', key_name: 'SUPERVISOR_OF_HOT_WORK_UNIT', type: 0 }, {
{ name: '是否安全总监审批', key_name: 'IS_SAFETY_DIRECTOR', type: 0 }, key_name: "hotWorkOperatorList",
{ name: '是否需要气体检测', key_name: 'IS_GAS_TESTING', type: 0 }, type: 4,
listStructure: [
{name: "动火操作人部门", key_name: "DEPARTMENT_NAME", key_id: "DEPARTMENT_ID", type: 0},
{name: "动火操作人", key_name: "USER_NAME", key_id: "USER_ID", type: 0},
{name: "所属端", key_name: "TYPE", type: 0, IS_NOT_SHOW: "1"},
],
},
{name: '动火操作人', key_name: 'SUPERVISOR_OF_HOT_WORK_UNIT', type: 0},
{name: "是否安全总监审批", key_name: "IS_SAFETY_DIRECTOR_NAME", key_id: "IS_SAFETY_DIRECTOR", type: 0},
{name: "是否需要气体检测", key_name: "IS_GAS_TESTING_NAME", key_id: "IS_GAS_TESTING", type: 0},
], ],
form: { form: {
// //
@ -146,6 +158,7 @@ export default {
IS_SAFETY_DIRECTOR: '', IS_SAFETY_DIRECTOR: '',
/** 是否需要气体检测 */ /** 是否需要气体检测 */
IS_GAS_TESTING: '', IS_GAS_TESTING: '',
hotWorkOperatorList: []
}, },
rules: { rules: {
APPLY_DEPARTMENT_NAME: [{ type: 'string', required: true, message: '请选择申请单位', trigger: ['blur', 'change'] }], APPLY_DEPARTMENT_NAME: [{ type: 'string', required: true, message: '请选择申请单位', trigger: ['blur', 'change'] }],
@ -233,24 +246,28 @@ export default {
fnDateTimePickerCancel() { fnDateTimePickerCancel() {
this.dateTimePicker.show = false this.dateTimePicker.show = false
}, },
fnRadioChange(event, key){
if (event === "1") {
this.form[key] = "是";
} else {
this.form[key] = "否";
}
},
/** /**
* 下一步所触发的按钮事件 * 下一步所触发的按钮事件
*/ */
async fnSubmit() { async fnSubmit() {
try { await this.$refs.formRef.validate()
await this.$refs.formRef.validate() uni.navigateTo({
try { url: "/pages/eight_assignments/hot_work/select_operator",
await setSubmitForm({ success: ({ eventChannel }) => {
eventChannel.emit("data", {
form: this.form, form: this.form,
formItems: this.formItems, formItems: this.formItems,
TYPE: this.type,
CORP_ID: this.form.CORP_ID,
EW_RU_TASK_ID: this.taskId EW_RU_TASK_ID: this.taskId
}) });
} catch { } },
} catch (err) { });
uni.$u.toast('请补全必填项')
}
} }
} }
} }

View File

@ -0,0 +1,174 @@
<template>
<view class="container">
<view class="card">
<view class="card">
<u-form label-position="left" label-width="auto">
<view class="mt-10 flex-end">
<u-button custom-style="width: 100rpx;margin:0" type="primary" size="mini" text="添加" @click="fnAddHotWorkOperatorList()"/>
</view>
<view v-for="(item, index) in hotWorkOperatorList" :key="item.id" style="position: relative;border: 1px dashed #ccc;padding: 20rpx 20rpx 20rpx 40rpx;" class="mt-10">
<u-form-item label="动火操作人部门" prop="DEPARTMENT_NAME" required @click="fnSelectDepartment(index)">
<view class="select_content">
<u-input v-model="item.DEPARTMENT_NAME || ''" border="none" input-align="right" readonly />
<u-icon name="arrow-right"></u-icon>
</view>
</u-form-item>
<u-line/>
<u-form-item label="动火操作人" prop="USER_NAME" required @click="fnSelectUser(index)">
<view class="select_content">
<u-input v-model="item.USER_NAME || ''" border="none" input-align="right" readonly/>
<u-icon name="arrow-right"></u-icon>
</view>
</u-form-item>
<u-line/>
<u-icon v-if="index !== 0" name="close-circle-fill" color="#ff2929" size="20" custom-style="position: absolute;right: -20rpx;top: -20rpx" @click="hotWorkOperatorList.splice(index, 1)"/>
</view>
<view class="mt-10 flex-between">
<u-button type="primary" shape="circle" text="下一步" :throttle-time="1000" @click="fnSubmit()"/>
</view>
</u-form>
</view>
</view>
<u-picker
:key="picker.key"
:show="picker.show"
:columns="picker.columns"
:default-index="picker.defaultIndex"
key-name="NAME"
@confirm="fnPickerConfirm"
@cancel="fnPickerCancel"
/>
</view>
</template>
<script>
import { setSubmitForm} from "@/utils/submitHomeworkProcess";
import {getUserList} from "@/api";
export default {
components: { setSubmitForm },
data() {
return {
form: {},
formItems: {},
taskId: '',
hotWorkOperatorList: [],
picker: {
show: false,
columns: [],
key: "",
defaultIndex: [0]
}
}
},
mounted() {
const eventChannel = this.getOpenerEventChannel();
eventChannel.on('data', (data) => {
console.log(data)
this.form = data.form;
this.formItems = data.formItems;
this.taskId = data.taskId;
this.hotWorkOperatorList = uni.$u.deepClone(data.form.hotWorkOperatorList);
if (this.hotWorkOperatorList.length === 0) this.fnAddHotWorkOperatorList();
else {
for (let i = 0; i < this.hotWorkOperatorList.length; i++) {
for (let i = 0; i < this.hotWorkOperatorList.length; i++) {
fnGetUserList(this.hotWorkOperatorList.value[i], i);
}
}
}
})
},
methods: {
fnAddHotWorkOperatorList() {
this.hotWorkOperatorList.push({
DEPARTMENT_NAME: "",
DEPARTMENT_ID: "",
USER_NAME: "",
USER_ID: "",
TYPE: "",
id: uni.$u.guid(),
columns: [],
});
},
fnSelectDepartment(index) {
uni.navigateTo({
url: "/pages/eight_assignments/select_department",
events: {
confirm: (event) => {
this.hotWorkOperatorList[index].DEPARTMENT_NAME = event.DEPARTMENT_NAME;
this.hotWorkOperatorList[index].DEPARTMENT_ID = event.DEPARTMENT_ID;
this.hotWorkOperatorList[index].USER_NAME = "";
this.hotWorkOperatorList[index].USER_ID = "";
this.hotWorkOperatorList[index].TYPE = event.TYPE;
this.fnGetUserList(event, index);
},
},
});
},
fnSelectUser(index) {
this.picker.key = index;
this.picker.columns = this.hotWorkOperatorList[index].columns;
this.picker.defaultIndex = [0];
if (this.picker.columns[0].length === 0) {
uni.$u.toast("没有选择部门或当前部门没有人员");
return;
}
for (let i = 0; i < this.picker.columns[0].length; i++) {
if (
this.picker.columns[0][i].USER_ID ===
this.hotWorkOperatorList[index].USER_ID
) {
this.picker.defaultIndex = [i];
break;
}
}
this.picker.show = true;
},
async fnSubmit() {
for (let i = 0; i < this.hotWorkOperatorList.length; i++) {
if (
!this.hotWorkOperatorList[i].DEPARTMENT_ID ||
!this.hotWorkOperatorList[i].USER_ID
) {
uni.$u.toast("请完善动火操作人信息");
return;
}
}
await setSubmitForm({
form: {...this.form, hotWorkOperatorList: this.hotWorkOperatorList},
formItems: this.formItems,
TYPE: "hotWork",
EW_RU_TASK_ID: this.taskId,
});
},
async fnGetUserList({DEPARTMENT_ID, TYPE}, index) {
const resData = await getUserList({DEPARTMENT_ID, TYPE});
for (let i = 0; i < resData.list.list.length; i++) {
resData.list.list[i].NAME = resData.list.list[i].name || resData.list.list[i].NAME;
resData.list.list[i].USER_ID = resData.list.list[i].user_ID || resData.list.list[i].USER_ID;
}
this.hotWorkOperatorList[index].columns = [resData.list.list];
},
fnPickerConfirm(event){
this.hotWorkOperatorList[this.picker.key].USER_ID = event.value[0].USER_ID;
this.hotWorkOperatorList[this.picker.key].USER_NAME = event.value[0].NAME;
this.fnPickerCancel();
},
fnPickerCancel(){
this.picker.show = false;
}
},
}
</script>
<style scoped lang="scss">
.select_content{
display: flex;
align-items: center;
}
</style>

View File

@ -21,7 +21,7 @@
<view></view> <view></view>
<view class="flex-between"> <view class="flex-between">
<u-button type="primary" text="修改" size="mini" class="bth-mini" v-if="item.canEditFlag === '1'" @click="handleEditTask(item)" /> <u-button type="primary" text="修改" size="mini" class="bth-mini" v-if="item.canEditFlag === '1'" @click="handleEditTask(item)" />
<u-button type="primary" text="流程" size="mini" class="bth-mini ml-10" <u-button v-if="false" type="primary" text="流程" size="mini" class="bth-mini ml-10"
@click="$u.route({ @click="$u.route({
url: '/pages/eight_assignments/technological_process', url: '/pages/eight_assignments/technological_process',
params: {taskId:item.taskId,type,title} params: {taskId:item.taskId,type,title}
@ -32,6 +32,14 @@
params: {taskId:item.taskId,jobId:item.jobId,type,title} params: {taskId:item.taskId,jobId:item.jobId,type,title}
})"/> })"/>
</view> </view>
<view class="ml-10" v-for="(item1, index1) in item.buttons" :key="index1">
<up-button type="primary" size="mini" shape="circle" :text="item1.name"
@click="$u.route({
url: item1.route,
params: {taskId: item.taskId,EW_RU_JOB_ID: item.jobId,isView: '1'},
})"
/>
</view>
</view> </view>
</u-list-item> </u-list-item>
</u-list> </u-list>

BIN
static/icon-apps/i13.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

BIN
static/icon-apps/i14.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
static/icon-apps/i15.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

15
utils/useFormValidate.js Normal file
View File

@ -0,0 +1,15 @@
const useFormValidate = (ref, message = "请补全必填项!") => {
return new Promise((resolve) => {
ref.value
.validate()
.then(() => {
resolve(true);
})
.catch(() => {
// eslint-disable-next-line prefer-promise-reject-errors
resolve(false);
uni.$u.toast(message);
});
});
};
export default useFormValidate;