form.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <el-drawer title="外协单信息" :with-header="false" v-model="visible" direction="rtl" size="100%">
  3. <div class="form-container column-container">
  4. <div class="form-btns-container">
  5. <span class="title-label">
  6. <el-icon>
  7. <Document />
  8. </el-icon>
  9. <span>盘点批次</span>
  10. </span>
  11. <div class="close-btn" @click="cancel">
  12. <i class="fa fa-times" aria-hidden="true" />
  13. <!-- <span>关闭</span> -->
  14. </div>
  15. </div>
  16. <el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true"
  17. style="margin-right: 0px">
  18. <el-form-item class="section-title" label="盘点批次列表" />
  19. <el-form-item label="批次号:">
  20. <el-input placeholder="请输入批次号" v-model.trim="queryParams.lotCode" @keydown.enter.prevent clearable
  21. style="width: 130px" />
  22. </el-form-item>
  23. <el-form-item label="产品描述:">
  24. <el-input placeholder="请输入产品描述" v-model.trim="queryParams.productDescription" @keydown.enter.prevent clearable
  25. style="width: 130px" />
  26. </el-form-item>
  27. <el-form-item label="生产状态:">
  28. <el-select v-model="queryParams.isProductStatus" clearable placeholder="请选择生产状态" style="width: 145px">
  29. <el-option v-for="dict in inventory_production_status" :key="dict.value" :label="dict.label"
  30. :value="dict.value"></el-option>
  31. </el-select>
  32. </el-form-item>
  33. <el-form-item label="标识:">
  34. <el-select style="width: 160px" multiple v-model="queryParams.flags" collapse-tags collapse-tags-tooltip
  35. clearable placeholder="请选择标识">
  36. <el-option v-for="item in is_identification" :key="item.value" :label="item.label"
  37. :value="item.value"></el-option>
  38. </el-select>
  39. </el-form-item>
  40. <el-form-item class="section-title" label="请选择当前工段:">
  41. <el-select-v2 v-model="queryParams.deptId" :options="deptList" placeholder="请选择工段" style="width: 120px" />
  42. </el-form-item>
  43. <el-form-item label="盘点状态:">
  44. <el-select v-model="queryParams.isTaksStock" clearable placeholder="请选择盘点状态" style="width: 145px">
  45. <el-option v-for="dict in is_taks_stock" :key="dict.value" :label="dict.label"
  46. :value="dict.value"></el-option>
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item style="margin-left: 0">
  50. <el-button type="info" icon="Search" @click="handleQuery">搜索
  51. </el-button>
  52. <el-button type="info" icon="Download" @click="handleExport">导出未盘点批次
  53. </el-button>
  54. <el-button :disabled="queryParams.deptId == null || queryParams.deptId == '0'" type="primary" icon="Check" v-hasPermi="['business:inventoryCheck:notProductionCheck']"
  55. @click="handleTaksLot">未生产批次盘点
  56. </el-button>
  57. <el-button v-if="detailInfo.status != 2" type="primary" icon="List" @click="showOutsourceCheckDialog">外协发出单盘点
  58. </el-button>
  59. </el-form-item>
  60. </el-form>
  61. <div class="el-table-container">
  62. <div class="el-table-inner-container">
  63. <el-table v-loading="loading" :data="dataList" size="small" border height="100%">
  64. <el-table-column label="行号" type="index" align="center" width="48" />
  65. <el-table-column label="批次号" prop="lotCode" align="center" width="120px">
  66. <template #default="scope">
  67. <el-button link type="primary" @click="handleColumnClick(scope.row.lotCode)"><span>{{ scope.row.lotCode
  68. }}</span></el-button>
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="产品描述" align="center" prop="productDescription" />
  72. <el-table-column label="箱号" align="center" prop="carrierName" width="110" />
  73. <el-table-column label="生产状态" prop="isProductStatus" width="90" align="center">
  74. <template #default="scope">
  75. <dict-tag :options="inventory_production_status" :value="scope.row.isProductStatus" />
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="工段" align="center" prop="deptName" width="90" />
  79. <el-table-column label="工序" align="center" prop="processAlias" width="110" />
  80. <el-table-column label="投入数" align="center" prop="prodNum" width="80" />
  81. <el-table-column label="盘点数量" align="center" prop="taksStockNum" width="90">
  82. <template #default="scope">
  83. <el-input-number v-if="scope.row.editStatus" v-model="scope.row.taksStockNum" controls-position="right"
  84. style="width: 100px" :min="0" :precision="0" :max="99999"
  85. @input="(val) => { handleChangeTaksStockNum(val, scope.row, scope.$index) }" />
  86. <div v-else>{{ scope.row.taksStockNum }}</div>
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="外协单号" align="center" prop="outsourceFormNo" width="110" />
  90. <el-table-column label="报工状态" align="center" prop="statusLabel" width="110">
  91. <template #default="scope">
  92. <span v-if="scope.row.statusLabel == 0">未开始</span>
  93. <span v-if="scope.row.statusLabel == 1">进行中</span>
  94. <span v-if="scope.row.statusLabel == 2">结束报工</span>
  95. <span v-if="scope.row.statusLabel == 3">工序已完成</span>
  96. <span v-if="scope.row.statusLabel == 4">待领取</span>
  97. <span v-if="scope.row.statusLabel == 6">已周转</span>
  98. <span v-if="scope.row.statusLabel == 7">已接收</span>
  99. </template>
  100. </el-table-column>
  101. <el-table-column label="标识" width="300" align="center">
  102. <template #default="scope">
  103. <el-tag v-if="scope.row.isWaste == 1" class="spacing" type="danger">{{ "批废" }}</el-tag>
  104. <el-tag v-if="scope.row.isAmend == 1" class="spacing" type="danger">{{ "工艺修改" }}</el-tag>
  105. <el-tag v-if="scope.row.isWasteRecycling == 1" class="spacing" type="primary">{{ "废品回用" }}</el-tag>
  106. <el-tag v-if="scope.row.fromLotId != 0" class="spacing" type="warning">{{ "分批" }}</el-tag>
  107. <el-tag v-if="scope.row.isSuperaddition == 1" class="spacing" type="info">{{ "追增" }}</el-tag>
  108. </template>
  109. </el-table-column>
  110. <el-table-column label="盘点状态" prop="isTaksStock" width="200" align="center">
  111. <template #default="scope">
  112. <el-select v-model="scope.row.isTaksStock" placeholder="请选择盘点状态" style="width: 160px"
  113. v-if="scope.row.editStatus"
  114. @change="(val) => { handleChangeTaksStock(val, scope.row, scope.$index) }">
  115. <el-option v-for="dict in is_taks_stock" :key="dict.value" :label="dict.label"
  116. :value="dict.value"></el-option>
  117. </el-select>
  118. <div v-else>
  119. <dict-tag :options="is_taks_stock" :value="scope.row.isTaksStock" />
  120. </div>
  121. </template>
  122. </el-table-column>
  123. <el-table-column label="操作" width="160" align="center" v-if="detailInfo.status != 2">
  124. <template #default="scope">
  125. <el-button link icon="Check" v-if="scope.row.editStatus" type="success"
  126. @click="handleSave(scope.row)">保存</el-button>
  127. <el-button link icon="Edit" v-else type="warning" @click="handleEdit(scope.row, scope.$index)"
  128. v-hasPermi="['business:inventoryCheck:editDetail']">编辑</el-button>
  129. <el-button link icon="Close" v-if="scope.row.editStatus" type="danger"
  130. @click="handleCancel(scope.row, scope.$index)">取消</el-button>
  131. </template>
  132. </el-table-column>
  133. </el-table>
  134. </div>
  135. </div>
  136. <!-- 分页 -->
  137. <paginationMax v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
  138. v-model:limit="queryParams.pageSize" @pagination="getList" />
  139. </div>
  140. <OutsourceCheckDialog ref="outsourceCheckDialogRef" />
  141. <taksForm ref="taksFormRef" @handleSaveSuccess="getList" />
  142. </el-drawer>
  143. </template>
  144. <script setup>
  145. import {
  146. listTaksStockLot, updateTaksStockLot, updateNoStartLot, exportNoStartLot,getProductionPlanDetail
  147. } from "@/api/business/taksStockLot";
  148. import { getDeptList } from "@/api/business/planDetailSubDetail.js";
  149. import taksForm from "./notTaksForm.vue"
  150. import { ref } from "vue";
  151. import router from "@/router";
  152. import OutsourceCheckDialog from "./OutsourceCheckDialog.vue";
  153. const { proxy } = getCurrentInstance();
  154. /** 字典 */
  155. const { is_identification } = proxy.useDict("is_identification");
  156. const { is_taks_stock } = proxy.useDict("is_taks_stock");
  157. const { inventory_production_status } = proxy.useDict("inventory_production_status");
  158. // 组件
  159. const outsourceCheckDialogRef = ref(null)
  160. /** 表单抽屉 页变量 */
  161. const loading = ref(false);
  162. const visible = ref(false);
  163. const detailInfo = ref({});
  164. const total = ref(0)
  165. const isDispatch = ref(false)
  166. const deptList = ref([])
  167. const dataList = ref([])
  168. /** 查询对象 */
  169. const queryParams = ref({
  170. pageNum: 1,
  171. pageSize: 50,
  172. productDescription: "",
  173. lotCode: "",
  174. deptId: null,
  175. flags: null,
  176. isTaksStock: null
  177. });
  178. /**************************** 方法区 ****************************/
  179. /** 打开抽屉 */
  180. const open = (row) => {
  181. visible.value = true;
  182. console.log(is_identification.value)
  183. is_identification.value = is_identification.value.filter(item => item.value != 0)
  184. reset();
  185. detailInfo.value = proxy.deepClone(row);
  186. getDeptList().then((response) => {
  187. deptList.value = response.data.rows;
  188. isDispatch.value = response.data.others.isDispatch;
  189. if (isDispatch.value) {
  190. deptList.value.unshift({ label: "全部", value: "0" });
  191. }
  192. queryParams.value.deptId = deptList.value[0].value;
  193. queryParams.value.takeStockPeriodId = row.id
  194. getList();
  195. });
  196. }
  197. function getList() {
  198. loading.value = true
  199. listTaksStockLot(queryParams.value).then(res => {
  200. res.rows.forEach(element => {
  201. element.isTaksStock = element.isTaksStock + ""
  202. element.taksStockNum = Number(element.taksStockNum)
  203. });
  204. dataList.value = res.rows;
  205. total.value = res.total;
  206. loading.value = false
  207. })
  208. }
  209. function handleEdit(row, index) {
  210. row.editStatus = true
  211. console.log(row);
  212. if (row.isTaksStock != 1) {
  213. row.taksStockNum = row.prodNum
  214. row.isTaksStock = "1"
  215. }
  216. console.log(row)
  217. }
  218. //一键盘点
  219. // function handleTaksLot() {
  220. // console.log(queryParams.value.deptId)
  221. // updateNoStartLot({ takeStockPeriodId: queryParams.value.takeStockPeriodId, deptId: queryParams.value.deptId }).then(res => {
  222. // if (res.code == 200) {
  223. // proxy.$modal.msgSuccess("盘点成功");
  224. // getList()
  225. // }
  226. // })
  227. // }
  228. function handleTaksLot() {
  229. getProductionPlanDetail(queryParams.value).then(res=>{
  230. if(res.data.length>0){
  231. let detail ={}
  232. detail.deptId = queryParams.value.deptId
  233. detail.deptList = deptList.value
  234. detail.takeStockPeriodId = queryParams.value.takeStockPeriodId
  235. detail.status = detailInfo.value.status
  236. proxy.$refs.taksFormRef.open(detail)
  237. }else{
  238. proxy.$modal.msgError("当前工段无未生产的批次")
  239. }
  240. })
  241. }
  242. function handleSave(row) {
  243. updateTaksStockLot(row).then(res => {
  244. if (res.code == 200) {
  245. proxy.$modal.msgSuccess("保存成功");
  246. getList()
  247. }
  248. })
  249. }
  250. /** 打开批次详情页 */
  251. // function handleColumnClick(lotCode) {
  252. // router.push({ path: "/reviseBath/lotFormParticulars/" + lotCode });
  253. // }
  254. function handleColumnClick(lotCode) {
  255. // 拼接 URL
  256. const url = "/reviseBath/lotFormParticulars/" + lotCode;
  257. // 在新标签页打开 URL
  258. window.open(url, '_blank');
  259. }
  260. function handleChangeTaksStock(value, row, index) {
  261. if (value == 0) {
  262. dataList.value[index].taksStockNum = 0
  263. }
  264. }
  265. function handleChangeTaksStockNum(value, row, index) {
  266. if (value != 0) {
  267. dataList.value[index].isTaksStock = "1"
  268. }
  269. }
  270. function handleCancel(row, index) {
  271. dataList.value[index].editStatus = false
  272. getList()
  273. }
  274. function handleQuery() {
  275. getList();
  276. }
  277. /** 取消按钮 */
  278. const cancel = () => {
  279. visible.value = false;
  280. reset();
  281. };
  282. /** 表单重置 */
  283. const reset = () => {
  284. queryParams.value = {
  285. pageNum: 1,
  286. pageSize: 50,
  287. productDescription: "",
  288. lotCode: "",
  289. deptId: null,
  290. flags: null,
  291. isTaksStock: null
  292. };
  293. dataList.value = [];
  294. };
  295. function handleExport() {
  296. exportNoStartLot({ takeStockPeriodId: queryParams.value.takeStockPeriodId, isTaksStock: 0 })
  297. }
  298. function showOutsourceCheckDialog() {
  299. outsourceCheckDialogRef.value.open(detailInfo.value)
  300. }
  301. /** 暴露给父组件的方法 */
  302. defineExpose({
  303. open,
  304. });
  305. </script>