移动端
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.

277 lines
8.7 KiB

  1. <template>
  2. <div class="app-container">
  3. <van-nav-bar left-arrow fixed placeholder @click-left="goBack">
  4. <template #title>
  5. <p style="font-weight: bold;">资金审批申请</p>
  6. </template>
  7. <template #right>
  8. <van-icon name="../../../static/images/icon/icon_flow.png" size="20" @click="goFlow"/>
  9. </template>
  10. </van-nav-bar>
  11. <van-form readonly>
  12. <div class="main_box">
  13. <van-field v-model="form.cashAt" label="申请日期" placeholder="请选择申请日期"
  14. required :rules="[{ required: true }]"
  15. input-align="right" right-icon="arrow-down"
  16. readonly clickable @click="showCashAt = true" />
  17. <van-popup v-model="showCashAt" position="bottom">
  18. <van-datetime-picker
  19. :value="currentDate"
  20. type="date"
  21. title="请选择申请日期"
  22. :min-date="minDate"
  23. :max-date="maxDate"
  24. @confirm="onConfirmCashAt"
  25. @cancel="showCashAt = false"
  26. />
  27. </van-popup>
  28. <van-field v-model="form.cashAmount" label="申请金额(元)" placeholder="请输入申请金额(元)"
  29. required :rules="[{ required: true }]" input-align="right" type="number" />
  30. <van-field v-model="capitalExpenditureType" label="资金支出类别" placeholder="请选择资金支出类别"
  31. required :rules="[{ required: true }]"
  32. input-align="right" right-icon="arrow-down"
  33. readonly clickable @click="showType = true" />
  34. <van-popup v-model="showType" position="bottom">
  35. <van-picker
  36. show-toolbar
  37. :columns="capitalExpenditureTypeOptions"
  38. value-key="dictLabel"
  39. @confirm="onConfirmType"
  40. @cancel="showType = false"
  41. />
  42. </van-popup>
  43. <van-field v-model="form.cashRemarks" label="支款说明" placeholder="请输入支款说明"
  44. required :rules="[{ required: true }]" input-align="right" maxlength="200" />
  45. <van-field v-model="form.cashierNo" label="付款账号" placeholder="请输入付款账号"
  46. input-align="right" maxlength="50" />
  47. <van-field v-model="form.cashierName" label="付款单位" placeholder="请输入付款单位"
  48. input-align="right" maxlength="150" />
  49. <van-field v-model="form.payeeName" label="收款方名称" placeholder="请输入收款方名称"
  50. input-align="right" maxlength="150" />
  51. <van-field v-model="form.payeePhone" label="收款方电话" placeholder="请输入收款方电话"
  52. input-align="right" maxlength="20" />
  53. <van-field v-model="approvalTemplateName" label="审批流程" placeholder="请选择审批流程"
  54. required :rules="[{ required: true }]"
  55. input-align="right" right-icon="arrow-down"
  56. readonly clickable @click="showTemplate = true"
  57. />
  58. <van-popup v-model="showTemplate" position="bottom">
  59. <van-picker
  60. show-toolbar
  61. :columns="templateList"
  62. value-key="name"
  63. @confirm="onConfirmTemplate"
  64. @cancel="showTemplate = false"
  65. />
  66. </van-popup>
  67. </div>
  68. </van-form>
  69. <div class="main_box examine_box" v-if="this.$route.query.type === 'todo'">
  70. <van-row type="flex" justify="space-between" align="center">
  71. <van-col span="5">审批<br/>意见</van-col>
  72. <van-col span="19">
  73. <van-radio-group v-model="pass" direction="horizontal">
  74. <van-radio name="true">同意</van-radio>
  75. <van-radio name="false">驳回</van-radio>
  76. </van-radio-group>
  77. <van-field v-model="comment" type="textarea" placeholder="请输入审批意见" rows="2" />
  78. </van-col>
  79. </van-row>
  80. </div>
  81. <div style="margin: 16px 2%;" v-if="this.$route.query.type === 'todo'">
  82. <van-row>
  83. <van-col span="24" align="center">
  84. <van-button type="info" native-type="submit" @click="submitApproval" class="submitButton">保<i style="margin-right: 1em;"></i>存</van-button>
  85. </van-col>
  86. </van-row>
  87. <div class="clear"></div>
  88. </div>
  89. </div>
  90. </template>
  91. <script>
  92. import {selectApprovalByTemplateId, listTemplate, approval} from "@/api/onlineHome/bankAgriculture/paymentApproval";
  93. import { getCashExpense } from "@/api/onlineHome/bankAgriculture/cashExpense";
  94. export default {
  95. name: "cashExpenseApproval",
  96. data() {
  97. return {
  98. showCashAt: false,
  99. minDate: new Date(1978, 0, 1),
  100. maxDate: new Date(2100, 11, 31),
  101. currentDate: new Date(),
  102. form: {},
  103. capitalExpenditureType: null,
  104. capitalExpenditureTypeOptions:[],
  105. showType: false,
  106. approvalTemplateName: null,
  107. showTemplate:false,
  108. templateList:[],
  109. // 审核意见默认值
  110. pass: "true",
  111. comment: "同意",
  112. };
  113. },
  114. created() {
  115. this.reset();
  116. this.getDicts("capital_expenditure_type").then((res) => {
  117. this.capitalExpenditureTypeOptions = res.data;
  118. });
  119. listTemplate({ type: '10' }).then(response => {
  120. this.templateList = response.rows;
  121. });
  122. this.getDetail();
  123. },
  124. watch: {
  125. pass: function (val) {
  126. this.comment = val === "true" ? "同意" : "驳回";
  127. },
  128. },
  129. methods: {
  130. goBack(){
  131. this.$router.back(-1);
  132. },
  133. onConfirmCashAt(data) {
  134. this.form.cashAt = this.format(data, 'yyyy-MM-dd');
  135. this.showCashAt = false;
  136. },
  137. onConfirmType(value){
  138. this.form.capitalExpenditureType = value.dictValue;
  139. this.capitalExpenditureType = value.dictLabel;
  140. this.showType = false;
  141. },
  142. // 表单重置
  143. reset() {
  144. this.form = {
  145. id: null,
  146. bookId: null,
  147. deptId: null,
  148. bookName: null,
  149. cashAt: null,
  150. cashAmount: null,
  151. cashRemarks: null,
  152. capitalExpenditureType: null,
  153. cashierNo: null,
  154. cashierName: null,
  155. payeeName: null,
  156. payeePhone: null,
  157. approvalTemplateId: null,
  158. auditStatus: null,
  159. auditbatchNo: null,
  160. createBy: null,
  161. createTime: null,
  162. updateBy: null,
  163. updateTime: null
  164. };
  165. },
  166. getDetail(){
  167. getCashExpense(this.$route.query.id).then(response => {
  168. this.form = response.data;
  169. this.capitalExpenditureType = this.selectDictLabel(this.capitalExpenditureTypeOptions, response.data.capitalExpenditureType);
  170. const template = this.templateList.find(item => item.id === response.data.approvalTemplateId);
  171. this.approvalTemplateName = template.name;
  172. });
  173. },
  174. onConfirmTemplate(data) {
  175. selectApprovalByTemplateId(data.id).then(res => {
  176. this.showTemplate = false;
  177. if (res.approvalDetails.length > 0) {
  178. this.approvalTemplateName = data.name
  179. this.form.approvalTemplateId = data.id
  180. } else {
  181. this.approvalTemplateName = null;
  182. this.form.approvalTemplateId = null;
  183. this.$notify({type: 'danger', message: '此流程无节点,无法选择!'});
  184. }
  185. });
  186. },
  187. submitApproval() {
  188. approval({
  189. taskId: this.$route.query.taskId,
  190. auditbatchNo: this.$route.query.auditbatchNo,
  191. pass: this.pass,
  192. remark: this.comment,
  193. deptId: this.form.deptId
  194. }).then((response) => {
  195. if (response.code === 200) {
  196. this.$toast.success("保存成功");
  197. setTimeout(function () {
  198. history.go(-1)
  199. }, 500);
  200. } else {
  201. this.$toast.success("保存失败");
  202. }
  203. });
  204. },
  205. goFlow(){
  206. this.$router.push({path: '/yinnong/cashExpenseProcess', query: { id: this.form.id, templateId: this.form.approvalTemplateId }});
  207. },
  208. }
  209. }
  210. </script>
  211. <style scoped lang="scss">
  212. .app-container {
  213. padding: 2% 0;
  214. }
  215. .main_box {
  216. width: 96%;
  217. margin: 0 auto;
  218. border-radius: 6px;
  219. box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.16);
  220. overflow: hidden;
  221. background-color: #FFF;
  222. }
  223. .submitButton {
  224. width: 80%;
  225. margin: 0 auto;
  226. background-color: #1D6FE9;
  227. }
  228. .examine_box {
  229. background-color: #1D6FE9 !important;
  230. padding: 0.18rem !important;
  231. padding-left: 0 !important;
  232. border-radius: 0.15rem !important;
  233. margin-top: 0.3rem !important;
  234. }
  235. .examine_box .van-col:first-child {
  236. color: #FFF !important;
  237. font-size: 0.45rem !important;
  238. text-align: center !important;
  239. }
  240. .examine_box .van-col:last-child {
  241. background-color: #FFF !important;
  242. border-radius: 0.15rem !important;
  243. overflow: hidden !important;
  244. .van-radio-group--horizontal {
  245. padding: 0.2rem 0;
  246. border-bottom: 1px solid #eee;
  247. }
  248. }
  249. /deep/ .van-radio--horizontal {
  250. margin-left: 20px;
  251. margin-right: 0;
  252. }
  253. .submitButton {
  254. width: 96%;
  255. margin: 0 auto;
  256. }
  257. </style>