fabric-correctioncopy.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <view>
  3. <view class="container">
  4. <view style="display: flex; padding: 4px; height: 50px">
  5. <view style="width: 90px">喷印日期:</view>
  6. <view @click="showDate = true">{{ SprayPrintDate ? SprayPrintDate : '点此选择时间' }}
  7. </view>
  8. <u-picker mode="time" end-year="2030" v-model="showDate" :params="params" @confirm="confirmEnd">
  9. </u-picker>
  10. </view>
  11. <view style="display: flex; padding: 4px; height: 50px">
  12. <view style="width: 90px">喷印人员:</view>
  13. <view @click="showSelectOne = true">
  14. {{ printingWorkers ? printingWorkers : '点此选择状态' }}
  15. </view>
  16. <u-select v-model="showSelectOne" :default-value="[0]" :list="selectOneList" @cancel="showSelect=false"
  17. @confirm="selectWorkers"></u-select>
  18. </view>
  19. <view style="display: flex; padding: 4px; height: 50px">
  20. <view style="width: 90px">面料:</view>
  21. <view @click="showSelectTwo = true">
  22. {{ fabric ? fabric : '点此选择面料' }}
  23. </view>
  24. <u-select v-model="showSelectTwo" :default-value="[0]" :list="selectTwoList" @cancel="showSelect=false"
  25. @confirm="selectFabric"></u-select>
  26. </view>
  27. <view style="display: flex; padding: 4px; height: 50px">
  28. <view style="width: 90px">供应商:</view>
  29. <view @click="showSelectThree = true">
  30. {{ supplier ? supplier : '点此选择供应商' }}
  31. </view>
  32. <u-select v-model="showSelectThree" :default-value="[0]" :list="selectThreeList"
  33. @cancel="showSelect=false" @confirm="selectSupplier"></u-select>
  34. </view>
  35. <view style="display: flex; padding: 4px; height: 50px">
  36. <view style="width: 90px">修正面积:</view>
  37. <u-input v-model="fixedArea" :type="number" :border="true" />
  38. </view>
  39. <view style="display: flex; padding: 4px; height: 50px">
  40. <view style="width: 90px">修正原因</view>
  41. </view>
  42. <view class="wenti-list">
  43. <view class="list-box" :class="i.active ? 'active' : ''" v-for="(i,index) in whyList" :key="i.type"
  44. @click="wentiSelect(i,index)">
  45. {{i.name}}
  46. </view>
  47. </view>
  48. <view>
  49. <u-input v-model="remark" :type="textarea" placeholder="备注信息" :border="true" :height="70"
  50. :auto-height="true" />
  51. </view>
  52. <my-fixed-button :customClick="true" @click="cfm" text="提交"></my-fixed-button>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. export default {
  58. name: "xx",
  59. data() {
  60. return {
  61. SprayPrintDate: '',
  62. params: {
  63. year: true,
  64. month: true,
  65. day: true
  66. },
  67. showDate: false,
  68. showSelectOne: false,
  69. showSelectTwo: false,
  70. showSelectThree: false,
  71. printingWorkers: '',
  72. printingWorkersId: '',
  73. fabric: '',
  74. fabricId: '',
  75. supplier: '',
  76. supplierId: '',
  77. fixedArea: null,
  78. selectOneList: [],
  79. selectTwoList: [],
  80. selectThreeList: [],
  81. whyList: [{
  82. type: 1,
  83. name: "短少",
  84. active: false
  85. },
  86. {
  87. type: 2,
  88. name: "抽纱",
  89. active: false
  90. },
  91. {
  92. type: 3,
  93. name: "褶皱",
  94. active: false
  95. },
  96. {
  97. type: 4,
  98. name: "脏污",
  99. active: false
  100. },
  101. {
  102. type: 5,
  103. name: "破洞",
  104. active: false
  105. },
  106. {
  107. type: 6,
  108. name: "缩水",
  109. active: false
  110. }
  111. ],
  112. number: 'number',
  113. textarea: 'textarea',
  114. remark: '',
  115. }
  116. },
  117. created() {
  118. this.selectList()
  119. },
  120. methods: {
  121. toDtl(_id) {
  122. const v = this
  123. uni.removeStorage({
  124. key: 'reviewDtl',
  125. success: function(res) {
  126. v.$utils.open(`/pages/warehouse/reviewDtl?id=${_id}`)
  127. },
  128. fail() {
  129. v.$utils.open(`/pages/warehouse/reviewDtl?id=${_id}`)
  130. }
  131. });
  132. },
  133. confirmEnd(e) {
  134. var endDate = ''
  135. if (this.params.year) endDate += e.year
  136. if (this.params.month) endDate += '-' + e.month
  137. if (this.params.day) endDate += '-' + e.day
  138. this.SprayPrintDate = endDate
  139. },
  140. selectList() {
  141. uni.request({
  142. url: 'http://120.79.80.64:8050' + '/cloudApi/supplier/selectList',
  143. method: 'POST',
  144. header: {
  145. 'Content-Type': 'application/json',
  146. },
  147. data: {
  148. pageNum: 1,
  149. pageSize: 9999,
  150. },
  151. success: res => {
  152. this.selectThreeList = res.data.data.map(item => {
  153. return {
  154. ...item,
  155. value: item.id,
  156. label: item.name,
  157. }
  158. })
  159. },
  160. });
  161. uni.request({
  162. url: 'http://120.79.80.64:8050' + '/cloudApi/material/selectList',
  163. method: 'POST',
  164. header: {
  165. 'Content-Type': 'application/json',
  166. },
  167. data: {
  168. pageNum: 1,
  169. pageSize: 9999,
  170. },
  171. success: res => {
  172. this.selectTwoList = res.data.data.map(item => {
  173. return {
  174. ...item,
  175. value: item.id,
  176. label: item.name,
  177. }
  178. })
  179. },
  180. });
  181. this.$post('/stockBack/getBackUser',{}).then(res=>{
  182. this.selectOneList = res.data.A007.concat(res.data.A008,res.data.A009)
  183. console.log(this.selectOneList,123123212)
  184. })
  185. },
  186. selectWorkers(val) {
  187. if (val && val.length > 0) {
  188. this.printingWorkersId = val[0].value
  189. this.printingWorkers = val[0].label
  190. }
  191. },
  192. selectFabric(val) {
  193. if (val && val.length > 0) {
  194. this.fabricId = val[0].value
  195. this.fabric = val[0].label
  196. }
  197. },
  198. selectSupplier(val) {
  199. if (val && val.length > 0) {
  200. this.supplierId = val[0].value
  201. this.supplier = val[0].label
  202. }
  203. },
  204. wentiSelect(item, index) {
  205. this.whyList[index].active = !this.whyList[index].active
  206. },
  207. cfm() {
  208. if (!this.SprayPrintDate) {
  209. this.$msg.showToast('请选择喷印日期')
  210. return
  211. }
  212. if (!this.printingWorkers) {
  213. this.$msg.showToast('请选择喷印人员')
  214. return
  215. }
  216. if (!this.fabric) {
  217. this.$msg.showToast('请选择面料')
  218. return
  219. }
  220. if (!this.supplier) {
  221. this.$msg.showToast('请选择供应商')
  222. return
  223. }
  224. if (!this.fixedArea) {
  225. this.$msg.showToast('请输入修正面积')
  226. return
  227. }
  228. let data = this.whyList.filter(item => item.active)
  229. if (!(data && data.length > 0)) {
  230. this.$msg.showToast('请输入修正原因')
  231. return
  232. }
  233. uni.request({
  234. url: 'http://120.79.80.64:8050' + '/cloudApi/stockBack/correctSave',
  235. method: 'POST',
  236. header: {
  237. 'Content-Type': 'application/json',
  238. },
  239. data: {
  240. correctTime: this.SprayPrintDate + ' 00:00:00',
  241. userId: this.printingWorkersId,
  242. materialId: this.fabricId,
  243. supplierId: this.supplierId,
  244. correctArea: this.fixedArea,
  245. correctReason: data.map(item => {
  246. return item.type
  247. }).join(","),
  248. remarks: this.remark,
  249. },
  250. success: res => {
  251. console.log(res)
  252. if (res.data.code === 200) {
  253. this.$msg.showToast(res.data.msg || '操作成功!')
  254. this.timer = setTimeout(() => {
  255. this.$utils.back()
  256. }, 1000)
  257. } else {
  258. this.$msg.showToast(res.data.msg)
  259. }
  260. },
  261. });
  262. }
  263. },
  264. }
  265. </script>
  266. <style scoped lang="less">
  267. .container {
  268. padding: 20rpx;
  269. height: calc(100vh - var(--status-bar-height) - 44px);
  270. overflow: auto;
  271. padding-bottom: 100rpx;
  272. }
  273. .wenti-list {
  274. overflow: hidden;
  275. .list-box {
  276. width: 28%;
  277. margin: 0 2% 20rpx;
  278. float: left;
  279. height: 60rpx;
  280. line-height: 60rpx;
  281. text-align: center;
  282. border: 1px solid #DDDCDC;
  283. border-radius: 10rpx;
  284. }
  285. .list-box.active {
  286. border: 1px solid #1A3AF0;
  287. background-color: #1A3AF0;
  288. color: #fff;
  289. }
  290. }
  291. </style>