工单小程序2024-11-20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

256 lines
5.0 KiB

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. <template>
  2. <view class="page">
  3. <navbar :title="title" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="info">
  5. <view class="Work-List">
  6. <view class="label">
  7. 部件名
  8. </view>
  9. <view class="text">
  10. <input type="text" v-model="StepOne.component"/>
  11. </view>
  12. </view>
  13. <view class="Work-List">
  14. <view class="label">
  15. 研发确认
  16. </view>
  17. <view class="text">
  18. <input type="text" v-model="StepOne.confirmDevelop"/>
  19. </view>
  20. </view>
  21. <view class="Work-List">
  22. <view class="label">
  23. 品质确认
  24. </view>
  25. <view class="text">
  26. <input type="text" v-model="StepOne.confirmQuality"/>
  27. </view>
  28. </view>
  29. <view class="Work-List">
  30. <view class="label">
  31. 中试确认
  32. </view>
  33. <view class="text">
  34. <input type="text" v-model="StepOne.confirmTrial"/>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="list">
  39. <view class="item-box"
  40. :key="stepIndex"
  41. v-for="(step, stepIndex) in stepList">
  42. <view class="title">
  43. {{ step.name }}
  44. </view>
  45. <view class="list-box"
  46. :key="cIndex"
  47. v-for="(c, cIndex) in step.workorderItemCheckList">
  48. <view class="title">
  49. {{ c.name }}
  50. </view>
  51. <view class="item-input"
  52. :key="wi"
  53. v-for="(w, wi) in c.workorderParamSteptwoList"
  54. >
  55. <view class="Work-List"
  56. :key="xi"
  57. v-for="(x, xi) in 10"
  58. >
  59. <view class="label">
  60. 规格{{ xi + 1 }}
  61. </view>
  62. <view class="text">
  63. <input type="text"
  64. v-model="w['param' + (xi + 1)]"/>
  65. </view>
  66. <view class="text"
  67. v-if=""
  68. style="margin-left: 20rpx;">
  69. {{ w.specs }}
  70. </view>
  71. </view>
  72. <view class="Work-List"
  73. >
  74. <view class="label">
  75. 作业员
  76. </view>
  77. <view class="text">
  78. <input type="text"
  79. style="width: 450rpx;"
  80. v-model="w.operator"/>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. <view class="uni-color-btn"
  88. @click="submit">
  89. 保存
  90. </view>
  91. </view>
  92. </template>
  93. <script>
  94. export default {
  95. data() {
  96. return {
  97. id: 0,
  98. StepOne: {},
  99. stepList : [],
  100. index : 1,
  101. title : '',
  102. }
  103. },
  104. onLoad(arg) {
  105. this.id = arg.id
  106. this.index = arg.index || 1
  107. this.title = arg.name
  108. this.queryStepTwo()
  109. this.queryTemplateById()
  110. },
  111. methods: {
  112. queryStepTwo() {
  113. this.$api('queryStepTwo', {
  114. templateId: this.id
  115. }, res => {
  116. if (res.code == 200) {
  117. this.StepOne = res.result.workorderGeneralSteptwo
  118. }
  119. })
  120. },
  121. // 根据id获取工单详情
  122. queryTemplateById(){
  123. this.$api('queryTemplateById', {
  124. templateId : this.id
  125. }, res =>{
  126. if(res.code == 200){
  127. let p = res.result.workorderStepList[this.index]
  128. this.stepList = p.workorderProcessList
  129. }
  130. })
  131. },
  132. //工单信息-修改工序参数-工序卡1(选配)
  133. updateParamStepOne(item){
  134. return new Promise((success, error) => {
  135. let data = JSON.parse(JSON.stringify(item))
  136. delete data.updateBy
  137. delete data.updateTime
  138. delete data.createBy
  139. delete data.createTime
  140. this.$api('updateParamStepTwo', data, res => {
  141. if(res.code == 200){
  142. success(res)
  143. }else{
  144. error(res)
  145. }
  146. })
  147. })
  148. },
  149. async submit(){
  150. console.log(this.stepList);
  151. let StepOne = JSON.parse(JSON.stringify(this.StepOne))
  152. delete StepOne.updateBy
  153. delete StepOne.updateTime
  154. delete StepOne.createBy
  155. delete StepOne.createTime
  156. // 修改常规参数
  157. this.$api('updateGeneralStepTwo', StepOne, res => {
  158. })
  159. uni.showToast({
  160. title: '保存中...',
  161. icon: 'none'
  162. })
  163. // 任务列表
  164. let tasks = []
  165. for(let i = 0;i < this.stepList.length;i++){
  166. let step = this.stepList[i]
  167. for(let j = 0;j < step.workorderItemCheckList.length;j++){
  168. let check = step.workorderItemCheckList[j]
  169. for(let k = 0;k < check.workorderParamSteptwoList.length;k++){
  170. let params = check.workorderParamSteptwoList[k]
  171. // 将请求添加到任务
  172. tasks.push(this.updateParamStepOne(params))
  173. }
  174. }
  175. }
  176. // 等待任务所有完成
  177. await Promise.all(tasks)
  178. uni.showToast({
  179. title: '保存成功',
  180. icon: 'none'
  181. })
  182. setTimeout(uni.navigateBack, 1000, -1)
  183. },
  184. }
  185. }
  186. </script>
  187. <style scoped lang="scss">
  188. .page{
  189. padding-bottom: 200rpx;
  190. .Work-List{
  191. display: flex;
  192. padding: 16rpx 0rpx;
  193. align-items: center;
  194. .label{
  195. width: 200rpx;
  196. flex-shrink: 0;
  197. }
  198. .text{
  199. input{
  200. background-color: #eee;
  201. padding: 10rpx 20rpx;
  202. border-radius: 20rpx;
  203. }
  204. }
  205. }
  206. .info{
  207. padding: 30rpx;
  208. input{
  209. width: 430rpx;
  210. }
  211. }
  212. .list{
  213. padding: 0 30rpx;
  214. .list-box{
  215. padding: 20rpx 0;
  216. padding-left: 40rpx;
  217. .item-input{
  218. padding-left: 40rpx;
  219. .label{
  220. width: 130rpx;
  221. }
  222. }
  223. }
  224. input{
  225. width: 320rpx;
  226. }
  227. }
  228. }
  229. </style>