工单小程序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.

276 lines
5.5 KiB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 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="w.specs"
  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. for(let i = 0;i < p.workorderProcessList.length;i++){
  129. let step = p.workorderProcessList[i]
  130. for(let j = 0;j < step.workorderItemCheckList.length;j++){
  131. let check = step.workorderItemCheckList[j]
  132. if(check.workorderParamSteptwoList.length == 0){
  133. check.workorderParamSteptwoList.push({
  134. processId : check.id,
  135. templateId : this.id,
  136. })
  137. }
  138. }
  139. }
  140. this.stepList = p.workorderProcessList
  141. }
  142. })
  143. },
  144. //工单信息-修改工序参数-工序卡1(选配)
  145. updateParamStepOne(item){
  146. return new Promise((success, error) => {
  147. let data = JSON.parse(JSON.stringify(item))
  148. delete data.updateBy
  149. delete data.updateTime
  150. delete data.createBy
  151. delete data.createTime
  152. for (let k in data) {
  153. if(!data[k] || data[k] == 'null'){
  154. data[k] = ''
  155. }
  156. }
  157. this.$api('updateParamStepTwo', data, res => {
  158. if(res.code == 200){
  159. success(res)
  160. }else{
  161. error(res)
  162. }
  163. })
  164. })
  165. },
  166. async submit(){
  167. console.log(this.stepList);
  168. let StepOne = JSON.parse(JSON.stringify(this.StepOne))
  169. delete StepOne.updateBy
  170. delete StepOne.updateTime
  171. delete StepOne.createBy
  172. delete StepOne.createTime
  173. // 修改常规参数
  174. this.$api('updateGeneralStepTwo', StepOne, res => {
  175. })
  176. uni.showLoading({
  177. title: '保存中...',
  178. })
  179. // 任务列表
  180. let tasks = []
  181. for(let i = 0;i < this.stepList.length;i++){
  182. let step = this.stepList[i]
  183. for(let j = 0;j < step.workorderItemCheckList.length;j++){
  184. let check = step.workorderItemCheckList[j]
  185. for(let k = 0;k < check.workorderParamSteptwoList.length;k++){
  186. let params = check.workorderParamSteptwoList[k]
  187. // 将请求添加到任务
  188. tasks.push(this.updateParamStepOne(params))
  189. }
  190. }
  191. }
  192. // 等待任务所有完成
  193. await Promise.all(tasks)
  194. uni.showToast({
  195. title: '保存成功',
  196. icon: 'none'
  197. })
  198. setTimeout(uni.navigateBack, 1000, -1)
  199. },
  200. }
  201. }
  202. </script>
  203. <style scoped lang="scss">
  204. .page{
  205. padding-bottom: 200rpx;
  206. .Work-List{
  207. display: flex;
  208. padding: 16rpx 0rpx;
  209. align-items: center;
  210. .label{
  211. width: 200rpx;
  212. flex-shrink: 0;
  213. }
  214. .text{
  215. input{
  216. background-color: #eee;
  217. padding: 10rpx 20rpx;
  218. border-radius: 20rpx;
  219. }
  220. }
  221. }
  222. .info{
  223. padding: 30rpx;
  224. input{
  225. width: 430rpx;
  226. }
  227. }
  228. .list{
  229. padding: 0 30rpx;
  230. .list-box{
  231. padding: 20rpx 0;
  232. padding-left: 40rpx;
  233. .item-input{
  234. padding-left: 40rpx;
  235. .label{
  236. width: 130rpx;
  237. }
  238. }
  239. }
  240. input{
  241. width: 320rpx;
  242. }
  243. }
  244. }
  245. </style>