|
@@ -55,13 +55,29 @@
|
|
|
<TitleInfo :title="'报工'"></TitleInfo>
|
|
|
<van-cell-group inset>
|
|
|
<van-field v-model="formData.finishQuantity" readonly label="已报工数量" />
|
|
|
- <van-field v-model="submitData.productionProcessesIdName" is-link label="工序" :placeholder="'请选择工序'" @click="showPicker = true"
|
|
|
+ <van-field v-model="submitData.productionProcessesIdName" is-link label="工序" readonly :placeholder="'请选择工序'" @click="showPicker = true"
|
|
|
:rules="[{ required: true, message: '请选择工序'}]" required />
|
|
|
- <van-field v-model="submitData.quantity" label="数量" :type="'digit'" />
|
|
|
+ <van-field v-model="submitData.quantity" label="数量" :type="'digit'" :rules="[{ required: true, message: '请输入数量'}]" required />
|
|
|
+ <van-field v-model="submitData.userSetName" is-link label="报工人" readonly :placeholder="'请选择报工人'" @click="showPickerOne = true"
|
|
|
+ :rules="[{ required: true, message: '请选择报工人'}]" required />
|
|
|
</van-cell-group>
|
|
|
<van-popup v-model:show="showPicker" round position="bottom">
|
|
|
<van-picker :columns="columns" @cancel="showPicker = false" @confirm="onConfirm" />
|
|
|
</van-popup>
|
|
|
+ <van-popup v-model:show="showPickerOne" round position="bottom" :style="{ height: '60%' }">
|
|
|
+ <div style="padding: 10px; height: calc(100% - 40px)">
|
|
|
+ <div style="display: flex; justify-content: space-between">
|
|
|
+ <van-button plain type="primary" @click="showPickerOne = false" style="border: none">关闭</van-button>
|
|
|
+ <van-button plain type="primary" style="border: none" @click="showPickerOne = false">确定</van-button>
|
|
|
+ </div>
|
|
|
+ <div style="height: calc(100% - 30px); overflow: auto">
|
|
|
+ <van-checkbox-group v-model="submitData.userSet" @change="(val) => handleSelectPeople(val)">
|
|
|
+ <van-checkbox :name="item.value" v-for="(item, index) in userList" :key="item.value" style="margin-top: 5px">
|
|
|
+ {{ item.label }}</van-checkbox>
|
|
|
+ </van-checkbox-group>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </van-popup>
|
|
|
<div style="margin: 16px">
|
|
|
<van-button round block type="primary" native-type="submit">
|
|
|
提交
|
|
@@ -76,10 +92,13 @@ import { ref, getCurrentInstance, onMounted } from "vue";
|
|
|
import { showSuccessToast, showFailToast } from "vant";
|
|
|
import { useRoute } from "vue-router";
|
|
|
import TitleInfo from "@/components/TitleInfo/index.vue";
|
|
|
+import { getUserInfo, getToken } from "@/utils/auth";
|
|
|
+import { showConfirmDialog } from "vant";
|
|
|
|
|
|
const proxy = getCurrentInstance().proxy;
|
|
|
const route = useRoute();
|
|
|
const showPicker = ref(false);
|
|
|
+const showPickerOne = ref(false);
|
|
|
const formData = ref({
|
|
|
productName: "",
|
|
|
waitQuantity: "",
|
|
@@ -94,8 +113,29 @@ const formData = ref({
|
|
|
const submitData = ref({});
|
|
|
|
|
|
const columns = ref([]);
|
|
|
-
|
|
|
-const getDict = () => {};
|
|
|
+const userList = ref([]);
|
|
|
+const getDict = () => {
|
|
|
+ proxy
|
|
|
+ .get("/tenantUser/list", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 9999,
|
|
|
+ keyword: "",
|
|
|
+ tenantId: getUserInfo().tenantId,
|
|
|
+ companyId: getUserInfo().companyId,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ userList.value = res.rows.map((item) => {
|
|
|
+ return {
|
|
|
+ label: item.nickName,
|
|
|
+ value: item.userId,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ if (userList.value.length > 0) {
|
|
|
+ submitData.value.userSet = [userList.value[0].value];
|
|
|
+ handleSelectPeople(submitData.value.userSet);
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
const onConfirm = ({ selectedOptions }) => {
|
|
|
formData.value.finishQuantity = selectedOptions[0].finishQuantity;
|
|
@@ -116,69 +156,90 @@ const onSubmit = () => {
|
|
|
) {
|
|
|
return showFailToast("已报工数量加报工数量不可大于生产数量");
|
|
|
} else {
|
|
|
- proxy.post("/productionReportingDetail/add", submitData.value).then(
|
|
|
+ showConfirmDialog({
|
|
|
+ title: "提示",
|
|
|
+ message: `请核实人员名单:${submitData.value.userSetName},您确认提交吗?`,
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ submitData.value.userSet = submitData.value.userSet.join(",");
|
|
|
+ proxy.post("/productionReporting/add", submitData.value).then(
|
|
|
+ (res) => {
|
|
|
+ setTimeout(() => {
|
|
|
+ showSuccessToast("报工成功");
|
|
|
+ proxy.$router.push("/main/working");
|
|
|
+ }, 500);
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ return showFailToast(err.message);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ return;
|
|
|
+ });
|
|
|
+ }
|
|
|
+};
|
|
|
+const getDetail = () => {
|
|
|
+ proxy
|
|
|
+ .post("/produceOrderDetail/detail", {
|
|
|
+ id: route.query.id,
|
|
|
+ })
|
|
|
+ .then(
|
|
|
(res) => {
|
|
|
- setTimeout(() => {
|
|
|
- showSuccessToast("报工成功");
|
|
|
- proxy.$router.push("/main/working");
|
|
|
- }, 500);
|
|
|
+ submitData.value.productionTaskId = route.query.id;
|
|
|
+ // submitData.value = {
|
|
|
+ // productionTaskId: route.query.id,
|
|
|
+ // productionProcessesId: "",
|
|
|
+ // quantity: "",
|
|
|
+ // };
|
|
|
+ columns.value = res.data.productionTaskProgressList.map((x) => ({
|
|
|
+ ...x,
|
|
|
+ text: x.progressName,
|
|
|
+ value: x.processesId,
|
|
|
+ }));
|
|
|
+ formData.value = res.data;
|
|
|
+ formData.value.productSize = `${res.data.productLength} * ${res.data.productWidth} * ${res.data.productHeight}`;
|
|
|
+ formData.value.materialSize = `${res.data.rawMaterialLength} * ${res.data.rawMaterialWidth} * ${res.data.rawMaterialHeight}`;
|
|
|
+ let ids = [formData.value.productId];
|
|
|
+ let idsOne = [formData.value.contractDetailId];
|
|
|
+
|
|
|
+ proxy
|
|
|
+ .post("/fileInfo/getList", {
|
|
|
+ businessIdList: ids,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.data && res.data[formData.value.productId]) {
|
|
|
+ let list = res.data[formData.value.productId].filter(
|
|
|
+ (x) => x.businessType == "0"
|
|
|
+ );
|
|
|
+ if (list && list.length > 0) {
|
|
|
+ formData.value.productUrl = list[0].fileUrl;
|
|
|
+ formData.value.productImgName = list[0].fileName;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ proxy
|
|
|
+ .post("/fileInfo/getList", {
|
|
|
+ businessIdList: idsOne,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.data && res.data[formData.value.contractDetailId]) {
|
|
|
+ formData.value.productUrlOne =
|
|
|
+ res.data[formData.value.contractDetailId][0].fileUrl;
|
|
|
+ formData.value.productImgNameOne =
|
|
|
+ res.data[formData.value.contractDetailId][0].fileName;
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
(err) => {
|
|
|
- return showFailToast(err.message);
|
|
|
+ setTimeout(() => {
|
|
|
+ onClickLeft();
|
|
|
+ }, 1000);
|
|
|
}
|
|
|
);
|
|
|
- }
|
|
|
-};
|
|
|
-const getDetail = () => {
|
|
|
- proxy.post("/produceOrderDetail/detail", { id: route.query.id }).then(
|
|
|
- (res) => {
|
|
|
- submitData.value = {
|
|
|
- productionTaskId: route.query.id,
|
|
|
- productionProcessesId: "",
|
|
|
- quantity: "",
|
|
|
- };
|
|
|
- columns.value = res.data.productionTaskProgressList.map((x) => ({
|
|
|
- ...x,
|
|
|
- text: x.progressName,
|
|
|
- value: x.processesId,
|
|
|
- }));
|
|
|
- formData.value = res.data;
|
|
|
- formData.value.productSize = `${res.data.productLength} * ${res.data.productWidth} * ${res.data.productHeight}`;
|
|
|
- formData.value.materialSize = `${res.data.rawMaterialLength} * ${res.data.rawMaterialWidth} * ${res.data.rawMaterialHeight}`;
|
|
|
- let ids = [formData.value.productId];
|
|
|
- let idsOne = [formData.value.contractDetailId];
|
|
|
-
|
|
|
- proxy
|
|
|
- .post("/fileInfo/getList", {
|
|
|
- businessIdList: ids,
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- if (res.data && res.data[formData.value.productId]) {
|
|
|
- formData.value.productUrl =
|
|
|
- res.data[formData.value.productId][0].fileUrl;
|
|
|
- formData.value.productImgName =
|
|
|
- res.data[formData.value.productId][0].fileName;
|
|
|
- }
|
|
|
- });
|
|
|
- proxy
|
|
|
- .post("/fileInfo/getList", {
|
|
|
- businessIdList: idsOne,
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- if (res.data && res.data[formData.value.contractDetailId]) {
|
|
|
- formData.value.productUrlOne =
|
|
|
- res.data[formData.value.contractDetailId][0].fileUrl;
|
|
|
- formData.value.productImgNameOne =
|
|
|
- res.data[formData.value.contractDetailId][0].fileName;
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- onClickLeft();
|
|
|
- }
|
|
|
- );
|
|
|
};
|
|
|
onMounted(() => {
|
|
|
+ // getDetail();
|
|
|
if (route.query && route.query.id) {
|
|
|
getDetail();
|
|
|
}
|
|
@@ -194,6 +255,18 @@ const onPreviewFile = (name, url) => {
|
|
|
},
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
+const handleSelectPeople = (val) => {
|
|
|
+ let currentUser = "";
|
|
|
+ for (let i = 0; i < val.length; i++) {
|
|
|
+ let userId = val[i];
|
|
|
+ const current = userList.value.find((x) => x.value === userId);
|
|
|
+ if (current && current.label) {
|
|
|
+ currentUser += current.label + " ";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ submitData.value.userSetName = currentUser;
|
|
|
+};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
.row {
|