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

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