|
@@ -14,7 +14,66 @@
|
|
|
:rules="rules"
|
|
|
@onSubmit="onSubmit"
|
|
|
ref="formDom"
|
|
|
- ></testForm>
|
|
|
+ >
|
|
|
+ <template
|
|
|
+ v-for="(cur, index) in productionProcessesList"
|
|
|
+ :key="cur.id"
|
|
|
+ v-slot:[cur.id]="{ item }"
|
|
|
+ >
|
|
|
+ <div style="width: 100%; display: flex">
|
|
|
+ <div style="width: calc(100vw - 100px)">{{ cur.currentUser }}</div>
|
|
|
+ <div style="width: 100px; float: right; margin-top: -20px">
|
|
|
+ <van-button
|
|
|
+ plain
|
|
|
+ type="primary"
|
|
|
+ @click="cur.showPicker = true"
|
|
|
+ style="border: none"
|
|
|
+ >选择</van-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <van-popup
|
|
|
+ v-model:show="cur.showPicker"
|
|
|
+ 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="cur.showPicker = false"
|
|
|
+ style="border: none"
|
|
|
+ >关闭</van-button
|
|
|
+ >
|
|
|
+ <van-button
|
|
|
+ plain
|
|
|
+ type="primary"
|
|
|
+ style="border: none"
|
|
|
+ @click="cur.showPicker = false"
|
|
|
+ >确定</van-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <div style="height: calc(100% - 30px); overflow: auto">
|
|
|
+ <van-checkbox-group
|
|
|
+ v-model="productionObj[cur.id]"
|
|
|
+ @change="(val) => handleSelectPeople(val, index)"
|
|
|
+ >
|
|
|
+ <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>
|
|
|
+ </template>
|
|
|
+ </testForm>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -23,6 +82,8 @@ import { ref, reactive, getCurrentInstance, onMounted } from "vue";
|
|
|
import { showSuccessToast, showFailToast } from "vant";
|
|
|
import { useRoute } from "vue-router";
|
|
|
import testForm from "@/components/testForm/index.vue";
|
|
|
+import { getUserInfo } from "@/utils/auth";
|
|
|
+
|
|
|
const proxy = getCurrentInstance().proxy;
|
|
|
const route = useRoute();
|
|
|
const formDom = ref(null);
|
|
@@ -32,10 +93,18 @@ const formData = reactive({
|
|
|
},
|
|
|
});
|
|
|
const rules = {
|
|
|
- productionPlanId: [{ required: true, message: proxy.t('task.selectProductionPlan') }],
|
|
|
- dueDate: [{ required: true, message: proxy.t('task.selectCompletionDeadline') }],
|
|
|
- personLiableId: [{ required: true, message: proxy.t('task.selectPrincipal') }],
|
|
|
- quantity: [{ required: true, message: proxy.t('task.taskQuantityCanNotBeEmpty') }],
|
|
|
+ productionPlanId: [
|
|
|
+ { required: true, message: proxy.t("task.selectProductionPlan") },
|
|
|
+ ],
|
|
|
+ dueDate: [
|
|
|
+ { required: true, message: proxy.t("task.selectCompletionDeadline") },
|
|
|
+ ],
|
|
|
+ personLiableId: [
|
|
|
+ { required: true, message: proxy.t("task.selectPrincipal") },
|
|
|
+ ],
|
|
|
+ quantity: [
|
|
|
+ { required: true, message: proxy.t("task.taskQuantityCanNotBeEmpty") },
|
|
|
+ ],
|
|
|
};
|
|
|
const formOption = reactive({
|
|
|
readonly: false, //用于控制整个表单是否只读
|
|
@@ -48,26 +117,26 @@ const formOption = reactive({
|
|
|
isNeed: false,
|
|
|
prop: "productionTaskDetailList",
|
|
|
plain: true,
|
|
|
- listTitle: proxy.t('common.productDetails'),
|
|
|
+ listTitle: proxy.t("common.productDetails"),
|
|
|
listConfig: [
|
|
|
{
|
|
|
type: "input",
|
|
|
itemType: "text",
|
|
|
- label: proxy.t('receive.productSN'),
|
|
|
+ label: proxy.t("receive.productSN"),
|
|
|
prop: "productSn",
|
|
|
readonly: true,
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
itemType: "text",
|
|
|
- label: proxy.t('task.currentProcess'),
|
|
|
+ label: proxy.t("task.currentProcess"),
|
|
|
prop: "productionProcessesName",
|
|
|
readonly: true,
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
itemType: "text",
|
|
|
- label: proxy.t('task.accumulatedTimeConsumption'),
|
|
|
+ label: proxy.t("task.accumulatedTimeConsumption"),
|
|
|
prop: "cumulativeTime",
|
|
|
readonly: true,
|
|
|
},
|
|
@@ -78,7 +147,7 @@ const formOption = reactive({
|
|
|
const formConfig = reactive([
|
|
|
{
|
|
|
type: "picker",
|
|
|
- label: proxy.t('task.productionPlan'),
|
|
|
+ label: proxy.t("task.productionPlan"),
|
|
|
prop: "productionPlanId",
|
|
|
itemType: "onePicker",
|
|
|
showPicker: false,
|
|
@@ -100,43 +169,44 @@ const formConfig = reactive([
|
|
|
} else {
|
|
|
formConfig[index].showPicker = false;
|
|
|
}
|
|
|
+ getProductionDetails(formData.data.productionPlanId);
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
itemType: "text",
|
|
|
- label: proxy.t('task.productName'),
|
|
|
+ label: proxy.t("task.productName"),
|
|
|
prop: "productName",
|
|
|
readonly: true,
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
itemType: "number",
|
|
|
- label: proxy.t('task.scheduledQuantity'),
|
|
|
+ label: proxy.t("task.scheduledQuantity"),
|
|
|
prop: "waitQuantity",
|
|
|
readonly: true,
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
itemType: "number",
|
|
|
- label: proxy.t('task.taskQuantity'),
|
|
|
+ label: proxy.t("task.taskQuantity"),
|
|
|
prop: "quantity",
|
|
|
},
|
|
|
+ // {
|
|
|
+ // type: "picker",
|
|
|
+ // label: proxy.t("task.principal"),
|
|
|
+ // prop: "personLiableId",
|
|
|
+ // itemType: "onePicker",
|
|
|
+ // showPicker: false,
|
|
|
+ // fieldNames: {
|
|
|
+ // text: "label",
|
|
|
+ // value: "value",
|
|
|
+ // },
|
|
|
+ // data: [],
|
|
|
+ // },
|
|
|
{
|
|
|
type: "picker",
|
|
|
- label: proxy.t('task.principal'),
|
|
|
- prop: "personLiableId",
|
|
|
- itemType: "onePicker",
|
|
|
- showPicker: false,
|
|
|
- fieldNames: {
|
|
|
- text: "label",
|
|
|
- value: "value",
|
|
|
- },
|
|
|
- data: [],
|
|
|
- },
|
|
|
- {
|
|
|
- type: "picker",
|
|
|
- label: proxy.t('task.completionDeadline'),
|
|
|
+ label: proxy.t("task.completionDeadline"),
|
|
|
prop: "dueDate",
|
|
|
itemType: "datePicker",
|
|
|
showPicker: false,
|
|
@@ -144,9 +214,14 @@ const formConfig = reactive([
|
|
|
columnsType: ["year", "month", "day"],
|
|
|
},
|
|
|
]);
|
|
|
+const userList = ref([]);
|
|
|
const getDict = () => {
|
|
|
proxy
|
|
|
- .post("/productionPlan/page", { pageNum: 1, pageSize: 9999 })
|
|
|
+ .post("/productionPlan/page", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 9999,
|
|
|
+ isRemaining: "1",
|
|
|
+ })
|
|
|
.then((res) => {
|
|
|
formConfig[0].data = res.data.rows.map((item) => {
|
|
|
return {
|
|
@@ -157,28 +232,48 @@ const getDict = () => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- proxy.get("/system/user/list?pageNum=1&pageSize=9999").then((res) => {
|
|
|
- formConfig[4].data = res.rows.map((item) => {
|
|
|
- return {
|
|
|
- label: item.userName,
|
|
|
- value: item.userId,
|
|
|
- };
|
|
|
+ proxy
|
|
|
+ .get("/tenantUser/list", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10000,
|
|
|
+ tenantId: getUserInfo().tenantId,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.rows && res.rows.length > 0) {
|
|
|
+ userList.value = res.rows.map((item) => {
|
|
|
+ return {
|
|
|
+ label: item.nickName,
|
|
|
+ value: item.userId,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ // formConfig[4].data = userList.value;
|
|
|
+ }
|
|
|
});
|
|
|
- });
|
|
|
};
|
|
|
|
|
|
const onClickLeft = () => history.back();
|
|
|
const onSubmit = () => {
|
|
|
if (Number(formData.data.quantity) > Number(formData.data.waitQuantity)) {
|
|
|
- return showFailToast(proxy.t('task.taskQuantityCanNotBeGreaterThanTheScheduledQuantity'));
|
|
|
+ return showFailToast(
|
|
|
+ proxy.t("task.taskQuantityCanNotBeGreaterThanTheScheduledQuantity")
|
|
|
+ );
|
|
|
}
|
|
|
if (proxy.compareTime(formData.data.startDate, formData.data.dueDate)) {
|
|
|
- return showFailToast(proxy.t('task.completionDeadlineCanNotBeEarlierThanThePlanStartTime'));
|
|
|
+ return showFailToast(
|
|
|
+ proxy.t("task.completionDeadlineCanNotBeEarlierThanThePlanStartTime")
|
|
|
+ );
|
|
|
+ }
|
|
|
+ for (const key in productionObj.value) {
|
|
|
+ if (productionObj.value[key] && productionObj.value[key].length > 0) {
|
|
|
+ } else {
|
|
|
+ return showFailToast(proxy.t("所有工序都需选择负责人!"));
|
|
|
+ }
|
|
|
}
|
|
|
+ formData.data.taskProcessesUser = JSON.stringify(productionObj.value);
|
|
|
proxy.post("/productionTask/addByJxst", formData.data).then(
|
|
|
(res) => {
|
|
|
setTimeout(() => {
|
|
|
- showSuccessToast(proxy.t('common.addSuccess'));
|
|
|
+ showSuccessToast(proxy.t("common.addSuccess"));
|
|
|
proxy.$router.push("/main/jxskTask");
|
|
|
}, 500);
|
|
|
},
|
|
@@ -206,6 +301,37 @@ onMounted(() => {
|
|
|
formOption.hiddenSubmitBtn = true; //隐藏提交按钮
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+const handleSelectPeople = (val, index) => {
|
|
|
+ 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 + " ";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ productionProcessesList.value[index].currentUser = currentUser;
|
|
|
+};
|
|
|
+
|
|
|
+const productionProcessesList = ref([]);
|
|
|
+const productionObj = ref({});
|
|
|
+const getProductionDetails = (id) => {
|
|
|
+ proxy.post("/productionPlan/detail", { id }).then((res) => {
|
|
|
+ productionProcessesList.value = res.data.productionProcessesList;
|
|
|
+ for (let i = 0; i < productionProcessesList.value.length; i++) {
|
|
|
+ const e = productionProcessesList.value[i];
|
|
|
+ e.showPicker = false;
|
|
|
+ e.currentUser = "";
|
|
|
+ formConfig.push({
|
|
|
+ type: "slot",
|
|
|
+ label: e.name + " 负责人",
|
|
|
+ slotName: e.id,
|
|
|
+ });
|
|
|
+ productionObj.value[e.id] = [];
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
.row {
|