upHanger.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="10">
  4. <el-col :span="18">
  5. <el-card class="box-card custom-card">
  6. <el-row :gutter="10">
  7. <el-col :span="24">
  8. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  9. <el-form-item prop="washCode">
  10. <el-input v-model="queryParams.washCode" placeholder="请输入衣物条码" clearable @keyup.enter.native="handleQuery" />
  11. </el-form-item>
  12. <el-form-item prop="orderNo">
  13. <el-input v-model="queryParams.orderNo" placeholder="请输入洗衣单号" clearable @keyup.enter.native="handleQuery" />
  14. </el-form-item>
  15. <el-form-item label="状态" prop="flowStatus">
  16. <el-radio-group v-model="queryParams.flowStatus">
  17. <el-radio-button label="3">未上挂</el-radio-button>
  18. <el-radio-button label="4">已上挂</el-radio-button>
  19. </el-radio-group>
  20. </el-form-item>
  21. <el-form-item>
  22. <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
  23. <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
  24. </el-form-item>
  25. </el-form>
  26. </el-col>
  27. </el-row>
  28. <el-row :gutter="10" class="mb8">
  29. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  30. </el-row>
  31. <el-table v-loading="loading" fit highlight-current-row border stripe :data="clothItemList" style="height: 60%">
  32. <el-table-column label="衣物条码" align="center" prop="washCode" width="120px" />
  33. <el-table-column label="洗衣单号" align="center" prop="orderNo" width="120px" />
  34. <el-table-column label="衣服名称" align="center" prop="clothItemName">
  35. <template slot-scope="scope">
  36. <span> {{ calculateClothName(scope.row) }} </span>
  37. </template>
  38. </el-table-column>
  39. <el-table-column label="颜色" align="center" width="150">
  40. <template slot-scope="scope">
  41. <span v-for="(item, index) in scope.row.orderClothColors">
  42. {{ index == 0 ? item.clothColorName : ',' + item.clothColorName }}
  43. </span>
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="瑕疵" align="center" width="150">
  47. <template slot-scope="scope">
  48. <span v-for="(item, index) in scope.row.orderClothFlaws">
  49. {{ index == 0 ? item.clothFlawName : ',' + item.clothFlawName }}
  50. </span>
  51. <el-tag v-if="!scope.row.orderClothFlaws">暂无</el-tag>
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="特殊处理" align="center" width="150">
  55. <template slot-scope="scope">
  56. <el-tag v-if="scope.row.orderClothCrafts" size="small" v-for="item in scope.row.orderClothCrafts" style="margin-right: 10px; margin-bottom: 2.5px; margin-top: 2.5px">
  57. {{ item.clothCraftName }}
  58. </el-tag>
  59. <el-tag v-if="!scope.row.orderClothCrafts">暂无</el-tag>
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="附件" align="center">
  63. <template slot-scope="scope">
  64. <el-tag size="small" v-for="item in scope.row.orderClothAdjuncts" style="margin-right: 10px; margin-bottom: 2.5px; margin-top: 2.5px">
  65. {{ item.adjunctName }}
  66. </el-tag>
  67. <el-tag v-if="!scope.row.orderClothAdjuncts">暂无</el-tag>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="状态" align="center" width="80px">
  71. <template slot-scope="scope">
  72. <el-tag v-if="scope.row.flowStatus == '3'">未上挂</el-tag>
  73. <el-tag v-if="scope.row.flowStatus == '4'">已上挂</el-tag>
  74. </template>
  75. </el-table-column>
  76. <el-table-column label="挂架号" align="center" prop="hangerName" width="150px" show-overflow-tooltip>
  77. <template slot-scope="scope">
  78. <template v-for="item in hangerList">
  79. {{ scope.row.clothHangerId == item.id ? item.name + '-' + scope.row.clothHangerCode + '#' : '' }}
  80. </template>
  81. <el-tag v-if="!hangerList">暂无</el-tag>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="150">
  85. <template slot-scope="scope">
  86. <el-button type="text" icon="el-icon-share" @click="handleUpdateHanger(scope.row)">分配挂衣号</el-button>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  91. </el-card>
  92. </el-col>
  93. <el-col :span="6">
  94. <el-card class="box-card custom-card">
  95. <el-form :model="queryParams2" ref="queryForm2" size="small" :inline="true" label-width="68px">
  96. <el-form-item label="衣物条码" prop="washCode">
  97. <el-input v-model="queryParams2.washCode" placeholder="请输入衣物条码" clearable />
  98. </el-form-item>
  99. <el-form-item>
  100. <el-button type="primary" @click="getOrderClothItemInfo">查询</el-button>
  101. </el-form-item>
  102. </el-form>
  103. <el-descriptions title="衣物信息" v-if="clothItemInfo" :column="1">
  104. <el-descriptions-item label="衣物条码">{{ clothItemInfo.washCode }}</el-descriptions-item>
  105. <el-descriptions-item label="洗衣单号">{{ clothItemInfo.orderNo }}</el-descriptions-item>
  106. <el-descriptions-item label="衣物名称">{{ clothItemInfo.clothItemName }}</el-descriptions-item>
  107. <el-descriptions-item label="颜色">
  108. <template>
  109. <template v-for="(item, index) in clothItemInfo.orderClothColors">
  110. {{ index == 0 ? item.clothColorName : ',' + item.clothColorName }}
  111. </template>
  112. </template>
  113. </el-descriptions-item>
  114. <el-descriptions-item label="瑕疵">
  115. <template>
  116. <template v-for="(item, index) in clothItemInfo.orderClothFlaws">
  117. {{ index == 0 ? item.clothFlawName : ',' + item.clothFlawName }}
  118. </template>
  119. </template>
  120. </el-descriptions-item>
  121. <el-descriptions-item label="特殊处理">
  122. <template>
  123. <template v-for="(item, index) in clothItemInfo.orderClothCrafts">
  124. {{ index == 0 ? item.clothCraftName : ',' + item.clothCraftName }}
  125. </template>
  126. </template>
  127. </el-descriptions-item>
  128. <el-descriptions-item label="附件" v-if="clothItemInfo.isAdjunct == 'N'">
  129. <template>
  130. <template v-for="(item, index) in clothItemInfo.orderClothAdjuncts">
  131. {{ index == 0 ? item.adjunctName : ',' + item.adjunctName }}
  132. </template>
  133. </template>
  134. </el-descriptions-item>
  135. <!-- <el-descriptions-item label="预计收衣">{{}}</el-descriptions-item>-->
  136. <el-descriptions-item label="衣服状态">
  137. <template>
  138. <span v-if="clothItemInfo.flowStatus == '3'">未上挂</span>
  139. <span v-if="clothItemInfo.flowStatus == '4'">已上挂</span>
  140. </template>
  141. </el-descriptions-item>
  142. <el-descriptions-item label="挂衣号">
  143. <template v-for="item in hangerList">
  144. {{ clothItemInfo.clothHangerId == item.id ? item.name + '-' + clothItemInfo.clothHangerCode + '#' : '' }}
  145. </template>
  146. </el-descriptions-item>
  147. </el-descriptions>
  148. <span v-if="clothItemInfo && clothItemInfo.isAdjunct == 'Y'" style="color: #c03639">附件不支持单独上挂,请跟所属衣服放到一起,以防丢失</span>
  149. <div style="margin-top: 20px">
  150. <el-button type="primary" @click="reFlow(clothItemInfo)" v-if="clothItemInfo && clothItemInfo.isAdjunct == 'N'">重洗</el-button>
  151. <el-button type="primary" @click="handleUpdateHanger(clothItemInfo)" v-if="clothItemInfo && clothItemInfo.isAdjunct == 'N'">分配挂衣号</el-button>
  152. </div>
  153. </el-card>
  154. </el-col>
  155. </el-row>
  156. <!-- 选择上挂位置页面 -->
  157. <el-dialog :title="title" :visible.sync="open" size="70%">
  158. <div style="margin-left: 5%; margin-top: 1%; margin-right: 5%">
  159. <el-row :gutter="20">
  160. <el-descriptions title="衣物信息" v-if="clothItemInfoWithIn" :column="2">
  161. <el-descriptions-item label="衣物条码">{{ clothItemInfoWithIn.washCode }}</el-descriptions-item>
  162. <el-descriptions-item label="洗衣单号">{{ clothItemInfoWithIn.orderNo }}</el-descriptions-item>
  163. <el-descriptions-item label="衣物名称">{{ clothItemInfoWithIn.clothItemName }}</el-descriptions-item>
  164. <el-descriptions-item label="颜色">
  165. <template>
  166. <template v-for="(item, index) in clothItemInfoWithIn.orderClothColors">
  167. {{ index == 0 ? item.clothColorName : ',' + item.clothColorName }}
  168. </template>
  169. </template>
  170. </el-descriptions-item>
  171. <el-descriptions-item label="瑕疵">
  172. <template>
  173. <template v-for="(item, index) in clothItemInfoWithIn.orderClothFlaws">
  174. {{ index == 0 ? item.clothFlawName : ',' + item.clothFlawName }}
  175. </template>
  176. </template>
  177. </el-descriptions-item>
  178. <el-descriptions-item label="特殊处理">
  179. <template>
  180. <template v-for="(item, index) in clothItemInfoWithIn.orderClothCrafts">
  181. {{ index == 0 ? item.clothCraftName : ',' + item.clothCraftName }}
  182. </template>
  183. </template>
  184. </el-descriptions-item>
  185. <el-descriptions-item label="附件">
  186. <template>
  187. <template v-for="(item, index) in clothItemInfoWithIn.orderClothAdjuncts">
  188. {{ index == 0 ? item.adjunctName + ' * ' + item.num : ',' + item.adjunctName + ' * ' + item.num }}
  189. </template>
  190. </template>
  191. </el-descriptions-item>
  192. <!-- <el-descriptions-item label="预计收衣">{{}}</el-descriptions-item>-->
  193. <el-descriptions-item label="衣服状态">
  194. <template>
  195. <span v-if="clothItemInfoWithIn.flowStatus == '3'">未上挂</span>
  196. <span v-if="clothItemInfoWithIn.flowStatus == '4'">已上挂</span>
  197. </template>
  198. </el-descriptions-item>
  199. <el-descriptions-item label="挂衣号">
  200. <template v-for="item in hangerList">
  201. {{ clothItemInfoWithIn.clothHangerId == item.id ? item.name + '-' + clothItemInfoWithIn.clothHangerCode + '#' : '' }}
  202. </template>
  203. </el-descriptions-item>
  204. </el-descriptions>
  205. </el-row>
  206. <el-row :gutter="20" style="margin-top: 20px">
  207. <el-col :span="5">
  208. <div class="head-upHanger-one" :style="{ border: '1px solid #ccc' }">
  209. <el-table :data="hangerList" ref="singleTable" :header-cell-style="{ 'text-align': 'center' }" :cell-style="{ 'text-align': 'center' }" highlight-current-row @current-change="handleNodeClick">
  210. <<el-table-column property="name" label="挂架名称" style="width: 100%; text-align: center" />
  211. </el-table>
  212. </div>
  213. </el-col>
  214. <el-col :span="19">
  215. <div class="head-upHanger-two" :style="{ border: '1px solid #ddd' }">
  216. <el-radio-group v-model="detailId" size="medium">
  217. <el-radio-button v-for="detail in detailList" :key="detail.id" :label="detail.id" border style="margin-top: 10px; margin-left: 10px" :style="{ border: '1px solid #ddd' }">{{ detail.code }}# {{ detail.isHangerCount }} 件 </el-radio-button>
  218. </el-radio-group>
  219. </div>
  220. </el-col>
  221. </el-row>
  222. <el-row>
  223. <el-col :span="3">
  224. <el-button type="primary" style="width: 50%; height: 40px; margin-top: 30px; text-align: center" size="small" @click="submitForm">提交 </el-button>
  225. </el-col>
  226. </el-row>
  227. </div>
  228. </el-dialog>
  229. </div>
  230. </template>
  231. <script>
  232. import { getOrderClothItemListByUpHanger, reFlowCloth } from '@/api/order/clothItem'
  233. import { getHangerList } from '@/api/cloth/hanger'
  234. import { getHangerInfoByHangerCodeAndId, getIsHangerList, upHanger } from '@/api/cloth/hangerDetail'
  235. export default {
  236. name: 'upHanger',
  237. data() {
  238. return {
  239. // 遮罩层
  240. loading: true,
  241. // 选中数组
  242. ids: [],
  243. // 非单个禁用
  244. single: true,
  245. // 非多个禁用
  246. multiple: true,
  247. // 显示搜索条件
  248. showSearch: true,
  249. // 总条数
  250. total: 0,
  251. // 衣服表格数据
  252. clothItemList: [],
  253. // 弹出层标题
  254. title: '',
  255. // 是否显示弹出层
  256. open: false,
  257. // 查询参数
  258. queryParams: {
  259. pageNum: 1,
  260. pageSize: 10,
  261. washCode: null,
  262. orderNo: null,
  263. flowStatus: ''
  264. },
  265. queryParams2: {
  266. pageNum: 1,
  267. pageSize: 10,
  268. washCode: null
  269. },
  270. // 表单参数
  271. form: {},
  272. // 表单校验
  273. rules: {},
  274. // 右侧衣服信息vo
  275. clothItemInfo: null,
  276. // 上挂页面衣服信息vo
  277. clothItemInfoWithIn: null,
  278. hangerList: [],
  279. detailList: [],
  280. detailInfo: null,
  281. detailId: null,
  282. clothItemId: null,
  283. hangerName: null,
  284. currentRow: null
  285. }
  286. },
  287. created() {
  288. this.getHangerList()
  289. this.getList()
  290. },
  291. methods: {
  292. calculateClothName(row) {
  293. var clothName = row.clothItemName
  294. if (row.orderClothTypes) {
  295. row.orderClothTypes.forEach((item) => {
  296. clothName += ' 【' + item.clothTypeName + '】'
  297. })
  298. }
  299. return clothName
  300. },
  301. reFlow(row) {
  302. this.$confirm('是否确认将该衣物重洗?')
  303. .then(() => {
  304. reFlowCloth(row.id).then((response) => {
  305. this.$message.success('操作成功')
  306. this.clothItemInfo = null
  307. this.getList()
  308. })
  309. })
  310. .catch(() => {})
  311. },
  312. // 单击事件
  313. handleNodeClick(data) {
  314. this.hangerInfo = data
  315. this.getHangerDetail()
  316. },
  317. getHangerDetail() {
  318. getIsHangerList(this.hangerInfo.id).then((response) => {
  319. this.detailList = response.data
  320. })
  321. },
  322. getHangerList() {
  323. getHangerList({ pageNum: 1, pageSize: 999 }).then((response) => {
  324. this.hangerList = response.rows
  325. })
  326. },
  327. /** 查询衣服列表 */
  328. getList() {
  329. this.loading = true
  330. getOrderClothItemListByUpHanger(this.queryParams).then((response) => {
  331. this.clothItemList = response.data.records
  332. this.total = response.data.total
  333. this.loading = false
  334. })
  335. },
  336. getOrderClothItemInfo() {
  337. if (this.queryParams2.washCode == null) {
  338. this.$message.error('条码不能为空')
  339. }
  340. getOrderClothItemListByUpHanger(this.queryParams2).then((response) => {
  341. this.clothItemInfo = response.data.records[0]
  342. this.total = response.data.total
  343. this.loading = false
  344. })
  345. },
  346. // 取消按钮
  347. cancel() {
  348. this.open = false
  349. this.reset()
  350. },
  351. // 表单重置
  352. reset() {
  353. this.form = {}
  354. this.resetForm('form')
  355. },
  356. /** 搜索按钮操作 */
  357. handleQuery() {
  358. this.queryParams.pageNum = 1
  359. this.getList()
  360. },
  361. /** 重置按钮操作 */
  362. resetQuery() {
  363. this.resetForm('queryForm')
  364. this.handleQuery()
  365. },
  366. /** 修改按钮操作 */
  367. handleUpdateHanger(row) {
  368. this.clothItemInfoWithIn = row
  369. if (this.hangerList.length == 0) {
  370. this.clothItemId = row.id
  371. this.open = true
  372. this.title = '分配挂衣号'
  373. } else {
  374. // 判断是否已上挂 未上挂
  375. if (this.clothItemInfoWithIn.clothHangerCode == null || this.clothItemInfoWithIn.clothHangerCode == '') {
  376. const hangerVO = this.hangerList[0]
  377. getIsHangerList(hangerVO.id).then((response) => {
  378. this.detailList = response.data
  379. this.clothItemId = row.id
  380. this.detailId = null
  381. this.open = true
  382. this.title = '分配挂衣号'
  383. var _this = this
  384. setTimeout(function () {
  385. console.log(this)
  386. console.log(_this)
  387. _this.$refs.singleTable.setCurrentRow(hangerVO)
  388. }, 300)
  389. })
  390. } else {
  391. // 已上挂
  392. const vo = this.hangerList.find((item) => item.id == this.clothItemInfoWithIn.clothHangerId)
  393. getHangerInfoByHangerCodeAndId(this.clothItemInfoWithIn.clothHangerId, this.clothItemInfoWithIn.clothHangerCode).then((response) => {
  394. this.detailInfo = response.data
  395. this.detailId = this.detailInfo.id
  396. this.clothItemId = row.id
  397. this.open = true
  398. this.title = '分配挂衣号'
  399. var _this = this
  400. setTimeout(function () {
  401. _this.$refs.singleTable.setCurrentRow(vo)
  402. }, 300)
  403. })
  404. }
  405. }
  406. },
  407. /** 提交按钮 */
  408. submitForm() {
  409. if (this.detailId == null) {
  410. this.$message.error('挂衣位置不能为空')
  411. }
  412. const vo = this.detailList.find((item) => item.id == this.detailId)
  413. upHanger(this.clothItemId, vo.hangerId, vo.code).then((response) => {
  414. this.$modal.msgSuccess('上挂成功')
  415. this.open = false
  416. this.getList()
  417. this.clothItemId = null
  418. this.clothItemInfo = null
  419. })
  420. },
  421. checkClose(done) {
  422. this.$confirm('是否关闭表单,关闭后数据将丢失?')
  423. .then(function () {
  424. done()
  425. })
  426. .then(() => {})
  427. .catch(() => {})
  428. },
  429. handleStatusChange(row) {
  430. let text = row.status === '0' ? '启用' : '停用'
  431. this.$confirm('确认要' + text + ' ' + row.name + ' 吗?')
  432. .then(function () {
  433. return updateClothItemStatus(row.id, row.status)
  434. })
  435. .then(() => {
  436. this.$modal.msgSuccess(text + '成功')
  437. })
  438. .catch(function () {
  439. row.status = row.status === '0' ? '1' : '0'
  440. })
  441. }
  442. }
  443. }
  444. </script>
  445. <style>
  446. .head-upHanger-one {
  447. height: 300px;
  448. display: block;
  449. overflow-y: auto;
  450. }
  451. .head-upHanger-two {
  452. height: 300px;
  453. display: block;
  454. overflow-y: scroll;
  455. }
  456. </style>