index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <div class="body">
  3. <!-- 剔除 -->
  4. <el-scrollbar class="containerBox">
  5. <div
  6. style="margin-bottom: 10px; display: flex"
  7. :style="{ justifyContent: !formStatus ? 'center' : '' }"
  8. >
  9. <el-button
  10. type="primary"
  11. style="font-size: 16px"
  12. v-if="formStatus"
  13. @click="toAdd"
  14. >新增</el-button
  15. >
  16. <el-button type="primary" v-else @click="toList">返回</el-button>
  17. </div>
  18. <template v-if="formStatus">
  19. <el-table class="table" :data="tableData">
  20. <el-table-column label="物料名称" prop="materialName" />
  21. <el-table-column label="状态" prop="num">
  22. <template #default="scope">
  23. <span v-if="scope.row.state === 0">待处理</span>
  24. <span v-else-if="scope.row.state === 1">审核中</span>
  25. <span v-else-if="scope.row.state === 2">审核驳回</span>
  26. <span v-else-if="scope.row.state === 3">审核完成</span>
  27. </template>
  28. </el-table-column>
  29. <el-table-column label="操作">
  30. <template #default="{ row }">
  31. <el-button
  32. v-if="row.state === 0"
  33. link
  34. type="danger"
  35. @click="del(row.id)"
  36. style="font-size: 20px"
  37. >删除</el-button
  38. >
  39. </template>
  40. </el-table-column>
  41. </el-table>
  42. <Pagination
  43. v-model:limit="limit"
  44. v-model:page="page"
  45. :position="'right'"
  46. :total="total"
  47. @pagination="getPagination"
  48. />
  49. </template>
  50. <template v-else>
  51. <el-scrollbar class="form">
  52. <el-form
  53. ref="ruleFormRef1"
  54. :model="ruleForm1"
  55. :rules="rules1"
  56. label-width="100"
  57. >
  58. <el-form-item label="流转卡号" prop="seqs">
  59. <el-select
  60. v-model="ruleForm1.seqs"
  61. multiple
  62. placeholder="请选择"
  63. value-key="value"
  64. >
  65. <el-option
  66. v-for="item in infoData?.processWorkSeq"
  67. :key="item"
  68. :label="item"
  69. :value="item"
  70. />
  71. </el-select>
  72. </el-form-item>
  73. <el-form-item label="发生地点" prop="address">
  74. <el-input v-model="ruleForm1.address" />
  75. </el-form-item>
  76. <el-form-item label="数量" prop="address">
  77. <el-input v-model="ruleForm1.remark1.num" />
  78. </el-form-item>
  79. <el-form-item label="问题描述" prop="remark1[content]">
  80. <el-input type="textarea" v-model="ruleForm1.remark1.content" />
  81. </el-form-item>
  82. <el-form-item label="审理级别:" prop="remark1[content]">
  83. <el-radio-group v-model="ruleForm1.remark1.lv">
  84. <el-radio value="1">一级</el-radio>
  85. <el-radio value="2">二级</el-radio>
  86. </el-radio-group>
  87. </el-form-item>
  88. <el-form-item label="填表人" prop="reason">
  89. <el-select
  90. v-model="ruleForm1.remark1.user1"
  91. filterable
  92. placeholder="请选择人员"
  93. value-key="id"
  94. >
  95. <el-option
  96. v-for="item in dictStroe.allUsers"
  97. :key="item.id"
  98. :label="item.userName"
  99. :value="item.userName"
  100. />
  101. </el-select>
  102. </el-form-item>
  103. <el-form-item label="发生日期" prop="reason">
  104. <el-date-picker
  105. v-model="ruleForm1.remark1.time"
  106. type="date"
  107. format="YYYY-MM-DD"
  108. value-format="YYYY-MM-DD"
  109. />
  110. </el-form-item>
  111. <el-form-item label="指定检验人" prop="reason">
  112. <el-select
  113. v-model="ruleForm1.remark2.user2"
  114. filterable
  115. placeholder="请选择人员"
  116. value-key="id"
  117. >
  118. <el-option
  119. v-for="item in dictStroe.allUsers"
  120. :key="item.id"
  121. :label="item.userName"
  122. :value="item.userName"
  123. />
  124. </el-select>
  125. </el-form-item>
  126. </el-form>
  127. </el-scrollbar>
  128. <div class="btns">
  129. <el-button type="primary" @click="submit1">提交</el-button>
  130. </div>
  131. </template>
  132. </el-scrollbar>
  133. </div>
  134. </template>
  135. <script setup>
  136. import {
  137. breakReportInfoById,
  138. operationListByIds,
  139. } from "@/api/process/reportBreak";
  140. import {
  141. addRework,
  142. addRework1,
  143. getList,
  144. getList1,
  145. delError,
  146. } from "@/api/rework";
  147. import { useProcessStore } from "@/store/modules/processView";
  148. import { useDictionaryStore } from "@/store/modules/dictionary";
  149. const dictStroe = useDictionaryStore();
  150. const processStore = useProcessStore();
  151. const ruleForm = ref({
  152. seqList: [],
  153. });
  154. const ruleForm1 = ref({
  155. seqs: [],
  156. remark1: {
  157. content: "",
  158. user1: "",
  159. },
  160. remark2: {
  161. user2: "",
  162. },
  163. });
  164. const tableData = ref([]);
  165. const toAdd = () => {
  166. formStatus.value = false;
  167. breakReportInfoById(processStore.scanInfo.id).then((res) => {
  168. infoData.value = res.data;
  169. });
  170. };
  171. const toList = () => {
  172. resetForm();
  173. formStatus.value = true;
  174. };
  175. const resetForm = () => {
  176. page.value = 1;
  177. limit.value = 10;
  178. ruleForm.value = { seqList: [] };
  179. ruleForm1.value = {
  180. seqs: [],
  181. remark1: {
  182. content: "",
  183. user1: "",
  184. },
  185. remark2: {
  186. user2: "",
  187. },
  188. };
  189. };
  190. const getPagination = async () => {
  191. const { data } = await getList({
  192. pageNo: page.value,
  193. pageSize: limit.value,
  194. seqNo: processStore.useSeqNo,
  195. });
  196. tableData.value = data;
  197. };
  198. const del = async (id) => {
  199. const { code } = await delError({
  200. id,
  201. });
  202. if (code == "200") {
  203. ElMessage.success("删除成功");
  204. getPagination1();
  205. }
  206. };
  207. const getPagination1 = async () => {
  208. const { data } = await getList1({
  209. pageNo: page.value,
  210. pageSize: limit.value,
  211. });
  212. tableData.value = data.records;
  213. };
  214. const formStatus = ref(true);
  215. const ruleFormRef1 = ref(null);
  216. const submit1 = async () => {
  217. ruleFormRef1.value.validate((valid) => {
  218. if (valid) {
  219. addTask1();
  220. } else {
  221. ElMessage.error("请检查是否有未填项");
  222. }
  223. });
  224. };
  225. const addTask1 = async () => {
  226. const { code } = await addRework1({
  227. ...ruleForm1.value,
  228. materialModel: processStore.processInfo.materialModel,
  229. materialCode: processStore.scanInfo.materialCode,
  230. materialName: processStore.scanInfo.materialName,
  231. operationId: processStore.scanInfo.operationId,
  232. operationName: processStore.scanInfo.operationName,
  233. pid: processStore.scanInfo.id,
  234. workOrderCode: processStore.odersData.workOrderCode,
  235. orderNo: processStore.scanInfo.orderCode,
  236. stage: processStore.scanInfo.operationName,
  237. type: "eliminate",
  238. seqs: ruleForm1.value.seqs.join(","),
  239. });
  240. if (code == "200") {
  241. resetForm();
  242. formStatus.value = true;
  243. getPagination1();
  244. ElMessage.success("操作成功!");
  245. }
  246. };
  247. const total = ref(0);
  248. const page = ref(1);
  249. const limit = ref(10);
  250. const operationList = ref([]);
  251. const infoData = ref({});
  252. const rules1 = reactive({
  253. location: [
  254. {
  255. required: true,
  256. message: "Please select a location",
  257. trigger: "change",
  258. },
  259. ],
  260. });
  261. onMounted(() => {
  262. getPagination1();
  263. });
  264. </script>
  265. <style lang="scss" scoped>
  266. .table {
  267. height: calc(100vh - 240px);
  268. border-radius: 16px;
  269. }
  270. .body {
  271. width: 100%;
  272. height: calc(100vh - 60px);
  273. .opera {
  274. height: 40px;
  275. display: flex;
  276. justify-content: center;
  277. align-items: center;
  278. background-color: white;
  279. padding-right: 8%;
  280. }
  281. }
  282. .containerBox {
  283. height: calc(100vh - 100px);
  284. padding: 20px;
  285. }
  286. :deep(.el-switch__label) {
  287. span {
  288. font-size: 20px !important;
  289. line-height: 25px !important;
  290. }
  291. }
  292. .form {
  293. width: 50%;
  294. max-width: 600px;
  295. height: calc(100vh - 240px);
  296. background-color: white;
  297. margin: 0 auto;
  298. padding: 0 20px;
  299. padding-top: 20px;
  300. border-radius: 16px;
  301. }
  302. .btns {
  303. height: 40px;
  304. display: flex;
  305. justify-content: center;
  306. align-items: center;
  307. width: 50%;
  308. max-width: 600px;
  309. margin: 0 auto;
  310. }
  311. </style>