|
@@ -8,27 +8,46 @@
|
|
|
<div class="valueBox">
|
|
|
<div class="describeText value">{{ index + 1 }}.记录项:</div>
|
|
|
<div class="inputText">
|
|
|
- <el-input v-model="item.label" style="width: 240px" placeholder="请输入" />
|
|
|
+ <el-input :disabled="item.addStatus == false && item.updateStatus == false
|
|
|
+ " v-model="item.label" style="width: 240px" placeholder="请输入" />
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="valueBox">
|
|
|
<div class="describeText value">内容:</div>
|
|
|
<div class="inputText">
|
|
|
- <el-input v-model="item.inputValue" type="textarea" placeholder="请输入" />
|
|
|
+ <el-input :disabled="item.addStatus == false && item.updateStatus == false
|
|
|
+ " v-model="item.inputValue" type="textarea" placeholder="请输入" maxlength="1000" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="operate">
|
|
|
<div class="iconBox">
|
|
|
- <div class="operateText">增加</div>
|
|
|
- <div class="operateText">删除</div>
|
|
|
- <div class="operateText">编辑</div>
|
|
|
- <div class="operateText">完成</div>
|
|
|
- <div class="operateText">取消</div>
|
|
|
+ <div class="operateText" v-if="item.addStatus == false &&
|
|
|
+ index == listData.length - 1 &&
|
|
|
+ item.updateStatus == false
|
|
|
+ " @click="addFnc">
|
|
|
+ 增加
|
|
|
+ </div>
|
|
|
+ <div v-if="item.addStatus == false && item.updateStatus == false" class="operateText"
|
|
|
+ @click="deleteFnc(item.id, index)">
|
|
|
+ 删除
|
|
|
+ </div>
|
|
|
+ <div v-if="item.addStatus == false && item.updateStatus == false" class="operateText"
|
|
|
+ @click="updateFnc(item)">
|
|
|
+ 编辑
|
|
|
+ </div>
|
|
|
+ <div v-if="item.addStatus == true || item.updateStatus == true" class="operateText"
|
|
|
+ @click="isOkFnc(item, index)">
|
|
|
+ 完成
|
|
|
+ </div>
|
|
|
+ <div v-if="item.addStatus == true || item.updateStatus == true" class="operateText"
|
|
|
+ @click="cancelFnc(index, item)">
|
|
|
+ 取消
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div @click="add" class="operateBox" v-if="listData.length < 1" style="
|
|
|
+ <div @click="addFnc" class="operateBox" v-if="listData.length < 1" style="
|
|
|
height: 80px;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
@@ -43,34 +62,64 @@
|
|
|
</template>
|
|
|
|
|
|
<!-- 展示 -->
|
|
|
- <div class="body" v-if="submitStatus == false">
|
|
|
+ <div class="recordBody" v-if="submitStatus == false">
|
|
|
<div class="left" v-if="listData.length > 0">
|
|
|
<el-scrollbar>
|
|
|
- <div class="infoBox" v-for="item in listData"></div>
|
|
|
+ <div @click="showSelectIndex = index" :class="index == showSelectIndex ? 'infoBox active' : 'infoBox'"
|
|
|
+ v-for="(item, index) in listData">
|
|
|
+ <div>
|
|
|
+ <div class="titleText">记录项名:</div>
|
|
|
+ <div class="describeText">{{ item.label }}</div>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <div class="titleText">记录内容:</div>
|
|
|
+ <div class="describeText textarea">
|
|
|
+ {{ item.inputValue }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</el-scrollbar>
|
|
|
</div>
|
|
|
<div class="right" v-if="listData.length > 0">
|
|
|
<el-scrollbar>
|
|
|
- <div class="describeText"></div>
|
|
|
+ <div class="titleText" style="text-align: center">
|
|
|
+ {{ listData[showSelectIndex].label }}
|
|
|
+ </div>
|
|
|
+ <div class="describeText" style="padding: 0 20px">
|
|
|
+ {{ listData[showSelectIndex].inputValue }}
|
|
|
+ </div>
|
|
|
</el-scrollbar>
|
|
|
</div>
|
|
|
- <Empty v-if="listData.length == 0" />
|
|
|
+ <div style="
|
|
|
+ height: 100%;
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ " v-if="listData.length == 0">
|
|
|
+ <Empty />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="btns">
|
|
|
- <el-button @click="setSubmitStatus" type="primary" plain>{{
|
|
|
- submitStatus ? "提 交" : "编 辑"
|
|
|
+ <el-button @click="btn" type="primary" plain>{{
|
|
|
+ submitStatus ? "返回 " : "编 辑"
|
|
|
}}</el-button>
|
|
|
- <el-button type="primary" v-if="submitStatus == true" @click="submitStatus = false" plain>取 消</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { listAdd, getList } from "@/api/prosteps/jiluxiang";
|
|
|
+import {
|
|
|
+ listAdd,
|
|
|
+ getList,
|
|
|
+ listDelete,
|
|
|
+ listUpdate,
|
|
|
+} from "@/api/prosteps/jiluxiang";
|
|
|
import { useProcessStore } from "@/store";
|
|
|
defineOptions({
|
|
|
name: "Jiluxiang",
|
|
|
});
|
|
|
+const showSelectIndex = ref(0);
|
|
|
const submitStatus = ref(false);
|
|
|
const store = useProcessStore();
|
|
|
const jianDisabled = ref(true);
|
|
@@ -81,35 +130,94 @@ const getListData = async () => {
|
|
|
const { data } = await getList({
|
|
|
pageNo: 1,
|
|
|
pageSize: 9999,
|
|
|
+ processId: Number(store.scanInfo.id),
|
|
|
+ operationRecordItemId: Number(store.odersData.operationId),
|
|
|
});
|
|
|
listData.value = data.records;
|
|
|
+ listData.value.forEach((item) => {
|
|
|
+ item.addStatus = false;
|
|
|
+ item.updateStatus = false;
|
|
|
+ });
|
|
|
};
|
|
|
const item = {
|
|
|
inputValue: "",
|
|
|
label: "",
|
|
|
+ updateInputValue: "",
|
|
|
+ updateLabel: "",
|
|
|
processId: Number(store.scanInfo.id),
|
|
|
operationRecordItemId: Number(store.odersData.operationId),
|
|
|
+ addStatus: true,
|
|
|
+ updateStatus: false,
|
|
|
};
|
|
|
-const add = () => {
|
|
|
- listData.value.push({ ...item, sort: listData.value.length + 1 });
|
|
|
+const btn = () => {
|
|
|
+ if (submitStatus.value == true) {
|
|
|
+ if (
|
|
|
+ listData.value[listData.value.length - 1].addStatus == true ||
|
|
|
+ listData.value[listData.value.length - 1].updateStatus == true
|
|
|
+ ) {
|
|
|
+ ElMessage.warning("请确认各项记录编辑完成!");
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ submitStatus.value = !submitStatus.value;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ submitStatus.value = !submitStatus.value;
|
|
|
+ }
|
|
|
};
|
|
|
-const addAsync = async () => {
|
|
|
- const { data } = await listAdd({
|
|
|
- inputValue: Number(store.scanInfo.id),
|
|
|
- label: Number(store.scanInfo.id),
|
|
|
- processId: Number(store.scanInfo.id),
|
|
|
- sortNum: 0,
|
|
|
- operationRecordItemId: Number(store.odersData.operationId),
|
|
|
+const addFnc = (index) => {
|
|
|
+ listData.value.push({
|
|
|
+ ...item,
|
|
|
+ sort: listData.value == 0 ? 1 : listData.value.length,
|
|
|
});
|
|
|
};
|
|
|
-const setSubmitStatus = () => {
|
|
|
- if (submitStatus.value == false) {
|
|
|
- submitStatus.value = true;
|
|
|
- return;
|
|
|
+const deleteFnc = async (id, index) => {
|
|
|
+ const { data, code } = await listDelete({
|
|
|
+ id,
|
|
|
+ });
|
|
|
+ if (code == "200") {
|
|
|
+ ElMessage.success("操作成功!");
|
|
|
+ listData.value.splice(index, 1);
|
|
|
+ }
|
|
|
+};
|
|
|
+const updateFnc = (item) => {
|
|
|
+ item.updateStatus = true;
|
|
|
+ item.updateInputValue = item.inputValue;
|
|
|
+ item.updateLabel = item.label;
|
|
|
+};
|
|
|
+const isOkFnc = async (item, index) => {
|
|
|
+ if (item.addStatus == true) {
|
|
|
+ const { data, code } = await listAdd(item);
|
|
|
+ if (code == "200") {
|
|
|
+ ElMessage.success("操作成功!");
|
|
|
+ item.addStatus = false;
|
|
|
+ item.id = data.id;
|
|
|
+ }
|
|
|
} else {
|
|
|
- //提交保存
|
|
|
+ const { data, code } = await listUpdate({
|
|
|
+ ...item,
|
|
|
+ inputValue: item.inputValue,
|
|
|
+ label: item.label,
|
|
|
+ processId: Number(store.scanInfo.id),
|
|
|
+ operationRecordItemId: Number(store.odersData.operationId),
|
|
|
+ });
|
|
|
+ if (code == "200") {
|
|
|
+ ElMessage.success("更新成功!");
|
|
|
+ item.updateInputValue = "";
|
|
|
+ item.updateLabel = "";
|
|
|
+ item.updateStatus = false;
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
+const cancelFnc = (index, item) => {
|
|
|
+ if (item.addStatus == true) {
|
|
|
+ listData.value.splice(index, 1);
|
|
|
+ } else {
|
|
|
+ item.inputValue = item.updateInputValue;
|
|
|
+ item.label = item.updateLabel;
|
|
|
+ item.updateStatus = false;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
getListData();
|
|
|
});
|
|
@@ -124,6 +232,10 @@ onMounted(() => {
|
|
|
position: relative;
|
|
|
}
|
|
|
|
|
|
+.active {
|
|
|
+ border: 1px solid #0000ff50;
|
|
|
+}
|
|
|
+
|
|
|
.btns {
|
|
|
width: 100%;
|
|
|
height: 70px;
|
|
@@ -147,23 +259,34 @@ onMounted(() => {
|
|
|
height: calc(100% - 80px);
|
|
|
}
|
|
|
|
|
|
-.body {
|
|
|
+.recordBody {
|
|
|
width: 100%;
|
|
|
height: calc(100% - 80px);
|
|
|
- @include flex;
|
|
|
+ display: flex;
|
|
|
|
|
|
.left {
|
|
|
width: 50%;
|
|
|
+ height: calc(100%);
|
|
|
|
|
|
.infoBox {
|
|
|
display: inline-block;
|
|
|
- width: 130px;
|
|
|
- height: 130px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ width: 280px;
|
|
|
+ height: 180px;
|
|
|
background-color: white;
|
|
|
border-radius: 16px;
|
|
|
margin: 10px;
|
|
|
margin-top: 0px;
|
|
|
box-sizing: border-box;
|
|
|
+ padding: 20px;
|
|
|
+
|
|
|
+ .textarea {
|
|
|
+ display: -webkit-box;
|
|
|
+ -webkit-box-orient: vertical;
|
|
|
+ -webkit-line-clamp: 2;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -171,6 +294,7 @@ onMounted(() => {
|
|
|
width: 50%;
|
|
|
background-color: white;
|
|
|
border-radius: 16px;
|
|
|
+ height: calc(100%);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -215,6 +339,18 @@ onMounted(() => {
|
|
|
.iconBox {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
+
|
|
|
+ .operateText {
|
|
|
+ padding: 0 5px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .operateText:hover {
|
|
|
+ background-color: var(--el-color-primary);
|
|
|
+ color: white;
|
|
|
+ border-radius: 16px;
|
|
|
+ padding: 0 5px;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|