examView.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <el-row>
  3. <el-col :span="24">
  4. <el-form
  5. ref="examForm"
  6. :model="examForm"
  7. :rules="examsThis"
  8. label-width="100px"
  9. class="demo-examForm"
  10. >
  11. <el-row :gutter="10">
  12. <el-col :span="18">
  13. <el-form-item label="审核" prop="status">
  14. <el-select
  15. @change="statusChange"
  16. v-model="examForm.status"
  17. style="width: 100%"
  18. placeholder="请选择审核状态"
  19. >
  20. <el-option
  21. v-for="item in options"
  22. :key="item.value"
  23. :label="item.label"
  24. :value="item.value"
  25. >
  26. </el-option>
  27. </el-select>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :span="6" style="text-align: right">
  31. <el-button type="primary" @click="submitForm"
  32. >提交审核结果</el-button
  33. >
  34. </el-col>
  35. <el-col :span="24">
  36. <el-form-item label="审核备注" prop="remark">
  37. <el-input
  38. type="textarea"
  39. :rows="4"
  40. placeholder="请输入审核备注"
  41. maxlength="250"
  42. show-word-limit
  43. v-model="examForm.remark" /></el-form-item
  44. ></el-col>
  45. </el-row>
  46. </el-form>
  47. </el-col>
  48. </el-row>
  49. </template>
  50. <script>
  51. import asyncRequest from "@/apis/service/purchase/orderRecord";
  52. import resToken from "@/mixins/resToken";
  53. export default {
  54. name: "orderRecord",
  55. props: ["id", "newTime", "payNo", "companyNo"],
  56. mixins: [resToken],
  57. data() {
  58. return {
  59. options: [
  60. {
  61. value: "3",
  62. label: "通过",
  63. },
  64. {
  65. value: "2",
  66. label: "驳回",
  67. },
  68. ],
  69. examForm: {
  70. id: this.id,
  71. status: "3",
  72. remark: "",
  73. },
  74. examsThis: this.exams,
  75. exams: {
  76. status: [
  77. {
  78. required: true,
  79. message: "请选择审核状态",
  80. trigger: "change",
  81. },
  82. ],
  83. remark: [
  84. {
  85. required: false,
  86. message: "请输入审核备注",
  87. trigger: "bulr",
  88. },
  89. ],
  90. },
  91. };
  92. },
  93. watch: {
  94. newTime: function (old, val) {
  95. if (old !== val) {
  96. this.initForm();
  97. }
  98. },
  99. },
  100. mounted() {
  101. this.initForm();
  102. },
  103. methods: {
  104. async initForm() {
  105. console.log(this.payNo);
  106. this.loading = true;
  107. this.examsThis = this.exams;
  108. await this.resetForm();
  109. this.statusChange;
  110. this.loading = false;
  111. },
  112. async resetForm() {
  113. // 重置
  114. await this.$nextTick(() => {
  115. if (this.$refs.examForm) {
  116. this.$refs.examForm.resetFields();
  117. this.$refs.examForm.clearValidate();
  118. this.examForm = {
  119. id: this.id,
  120. status: "3",
  121. };
  122. }
  123. });
  124. },
  125. statusChange() {
  126. console.log(this.examForm.status);
  127. if (this.examForm && this.examForm.status == this.options[0].value) {
  128. this.examsThis.remark[0].required = false;
  129. } else {
  130. this.examsThis.remark[0].required = true;
  131. }
  132. },
  133. async submitForm() {
  134. await this.$refs.examForm.validate(async (valid) => {
  135. if (valid) {
  136. this.loading = true;
  137. const obj = JSON.parse(JSON.stringify(this.examForm));
  138. let model = {
  139. sid: obj.id,
  140. payNo: this.payNo,
  141. status: obj.status,
  142. remark: obj.remark,
  143. };
  144. let res = {};
  145. res = await asyncRequest.again(model);
  146. this.loading = false;
  147. if (res && res.code === 0) {
  148. const title = "业务审核成功!";
  149. this.$notify.success({
  150. title,
  151. message: "",
  152. });
  153. this.showModelThis = false;
  154. // 刷新
  155. this.$emit("refreshAll");
  156. } else if (res && res.code >= 100 && res.code <= 104) {
  157. await this.logout();
  158. } else {
  159. this.$message.warning(res.message);
  160. }
  161. } else {
  162. console.log("error submit!!");
  163. return false;
  164. }
  165. });
  166. },
  167. async remoteMethod(query) {
  168. this.selectLoading = true;
  169. if (query !== "") {
  170. this.activeOptions = [];
  171. this.parmValue.contector = query;
  172. const res = await asyncRequest.supplierlist(this.parmValue);
  173. if (res.code === 0 && res.data && res.data.list) {
  174. this.activeOptions = res.data.list;
  175. } else if (res && res.code >= 100 && res.code <= 104) {
  176. await this.logout();
  177. } else {
  178. this.$message.warning(res.message);
  179. }
  180. } else {
  181. this.options = [];
  182. }
  183. this.selectLoading = false;
  184. },
  185. },
  186. };
  187. </script>
  188. <style lang="scss" scoped>
  189. .orderRecord {
  190. .setWidth {
  191. width: 100% !important;
  192. // display: flex;
  193. // display: block !important;
  194. // .el-input__inner {
  195. // display: flex;
  196. // width: 1000px !important;
  197. // display: block !important;
  198. // }
  199. }
  200. .scale {
  201. li {
  202. height: 40px;
  203. line-height: 40px;
  204. &.fuhao {
  205. width: 40px;
  206. height: 40px;
  207. line-height: 40px;
  208. text-align: center;
  209. i {
  210. width: 40px;
  211. height: 40px;
  212. text-align: center;
  213. line-height: 40px;
  214. color: #97a8be;
  215. font-size: 20px;
  216. }
  217. &.dengyu {
  218. i {
  219. // font-size: 26px;
  220. transform: rotate(90deg);
  221. -ms-transform: rotate(90deg); /* IE 9 */
  222. -moz-transform: rotate(90deg); /* Firefox */
  223. -webkit-transform: rotate(90deg); /* Safari 和 Chrome */
  224. -o-transform: rotate(90deg);
  225. }
  226. }
  227. }
  228. .Addend {
  229. i.fuhao-i {
  230. width: 40px;
  231. height: 40px;
  232. text-align: center;
  233. line-height: 40px;
  234. color: #97a8be;
  235. font-size: 20px;
  236. }
  237. }
  238. }
  239. }
  240. }
  241. </style>