add.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <div>
  3. <el-button type="primary" size="small" @click="handleCommand">新 建</el-button>
  4. <el-dialog
  5. title="新建借用单"
  6. :visible.sync="drawer"
  7. direction="rtl"
  8. :show-close="false"
  9. append-to-body
  10. width="400px"
  11. @close="refresh">
  12. <div>
  13. <el-row :gutter="15">
  14. <el-form size="small" ref="form" :model="form" :rules="rules" label-width="100px" :status-icon="false">
  15. <el-col :span="24">
  16. <el-form-item label="企业信息" prop="sys_enterpriseid">
  17. <enterprise @rowClick="rowClick"></enterprise>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="24">
  21. <el-form-item label="工具合同">
  22. <el-popover
  23. placement="bottom"
  24. trigger="click"
  25. v-model="visible">
  26. <toolCanUseContract ref="contract" @rowClick="contractClick"></toolCanUseContract>
  27. <el-input readonly v-model="form.contractname" slot="reference" placeholder="选择合同"></el-input>
  28. </el-popover>
  29. </el-form-item>
  30. </el-col>
  31. </el-form>
  32. </el-row>
  33. </div>
  34. <span slot="footer" class="dialog-footer">
  35. <el-button type="primary" size="small" @click="submitForm">创 建</el-button>
  36. <el-button size="small" @click="refresh">取 消</el-button>
  37. </span>
  38. </el-dialog>
  39. </div>
  40. </template>
  41. <script>
  42. import enterprise from '@/template/enterprise/index.vue'
  43. import toolCanUseContract from '@/template/toolBorrowingCanUseContract/index.vue'
  44. export default {
  45. data () {
  46. return {
  47. drawer:false,
  48. visible:false,
  49. visible1:false,
  50. form:{
  51. "sa_orderid": 0,
  52. "sys_enterpriseid": 0, //订货企业id,可不传,默认取当前账号的
  53. "sa_accountclassid": 0, //营销账户类型ID
  54. "sa_brandid": "", //品牌ID
  55. "sa_contractid": null, //合同ID,标准订单不传
  56. "sa_projectid": 0, //工程项目表ID,标准订单不传
  57. "sys_enterprise_financeid": 0, //合作企业财务信息ID(开票信息)
  58. "sa_logiscompid": 0, //物流公司档案ID
  59. "rec_contactsid": 0, //合作企业联系人表ID(收货信息)
  60. "type": "", //订单类型
  61. "typemx": "", //明细分类,可选
  62. "remarks": "", //可选
  63. "tradefield":"",//必选
  64. "pay_enterpriseid": 0, //结算单位
  65. "rebate_used":0,//默认0,是否使用返利金
  66. "billdate":"",//单据日期,默认创建日期
  67. "signbacknum":"",
  68. "promname":""
  69. },
  70. rules: {
  71. sa_brandid: [{
  72. required: true,
  73. message: '请选择选择品牌',
  74. trigger: 'change'
  75. }],
  76. tradefield: [{
  77. required: true,
  78. message: '请选择选择领域',
  79. trigger: 'change'
  80. }],
  81. typemx: [{
  82. required: true,
  83. message: '请选择选子分类',
  84. trigger: 'change'
  85. }],
  86. sys_enterpriseid:[{
  87. required: true,
  88. message: '订货企业不能为空',
  89. trigger: 'blur'
  90. }],
  91. promname:[{
  92. required: true,
  93. message: '活动不能为空',
  94. trigger: 'blur'
  95. }],
  96. },
  97. sa_brandidOptions: [],
  98. tradefieldOptions: [],
  99. typemxlist:[],
  100. childField:[]
  101. }
  102. },
  103. components:{
  104. enterprise,
  105. toolCanUseContract
  106. },
  107. methods:{
  108. handleCommand (command) {
  109. this.drawer = true
  110. this.pageData()
  111. this.specordermx()
  112. this.$nextTick(()=>{
  113. this.$refs['contract'].listData()
  114. })
  115. },
  116. submitForm() {
  117. this.$refs['form'].validate(async valid => {
  118. if (!valid) return
  119. const res = await this.$api.requested({
  120. "id": 20230116092702,
  121. "content":this.form
  122. })
  123. this.tool.showMessage(res,()=>{
  124. if (this.form.sa_contractid) {
  125. this.addContractTool(res.data.sa_orderid)
  126. }
  127. this.drawer = false
  128. this.$store.dispatch('changeDetailDrawer',true)
  129. this.$router.push({path:'/toolBorrowingMagDetail',query:{id:res.data.sa_orderid,rowindex:res.data.rowindex}})
  130. })
  131. })
  132. },
  133. async addContractTool (sa_orderid) {
  134. const res = await this.$api.requested({
  135. "id": 20230116142602,
  136. "content": {
  137. "sa_orderid":sa_orderid,
  138. "sys_enterpriseid": this.form.sys_enterpriseid,
  139. "sa_contractid":this.form.sa_contractid
  140. },
  141. })
  142. },
  143. async specordermx () {
  144. const res = await this.$store.dispatch('optiontypeselect','specordermx')
  145. this.typemxlist = res.data
  146. },
  147. resetForm() {
  148. this.$refs['form'].resetFields()
  149. },
  150. async pageData () {
  151. const res = await this.$api.requested({
  152. "id": 20220924163702,
  153. "content": {
  154. "pageSize": 999,
  155. }
  156. })
  157. this.sa_brandidOptions = res.data
  158. const res1 = await this.$api.requested({
  159. "id": 20221223141802,
  160. "content": {
  161. "pageSize": 999,
  162. }
  163. })
  164. this.tradefieldOptions = res1.data
  165. },
  166. rowClick (row) {
  167. this.form.sys_enterpriseid = row.sys_enterpriseid
  168. this.$refs['contract'].listData(row.sys_enterpriseid)
  169. },
  170. contractClick (row) {
  171. this.form.sa_contractid = row.sa_contractid
  172. this.form.sa_projectid = row.sa_projectid
  173. this.form.contractname = row.title === ''?'未知':row.title
  174. this.visible = false
  175. },
  176. setChildField (item) {
  177. this.childField = item.subvalues
  178. },
  179. refresh () {
  180. this.form = {
  181. "sa_orderid": 0,
  182. "sys_enterpriseid": 0, //订货企业id,可不传,默认取当前账号的
  183. "sa_accountclassid": 0, //营销账户类型ID
  184. "sa_brandid": "", //品牌ID
  185. "sa_contractid": 0, //合同ID,标准订单不传
  186. "sa_projectid": 0, //工程项目表ID,标准订单不传
  187. "sys_enterprise_financeid": 0, //合作企业财务信息ID(开票信息)
  188. "sa_logiscompid": 0, //物流公司档案ID
  189. "rec_contactsid": 0, //合作企业联系人表ID(收货信息)
  190. "type": "", //订单类型
  191. "typemx": "", //明细分类,可选
  192. "remarks": "", //可选
  193. "saler_hrid":0,//销售人员hrid,业务员hrid
  194. "tradefield":"",//必选
  195. "pay_enterpriseid": 0, //结算单位
  196. "rebate_used":0,//默认0,是否使用返利金
  197. "billdate":"",//单据日期,默认创建日期
  198. "signbacknum":""
  199. }
  200. // this.$refs['enterprise'].form.enterprisename = ''
  201. this.drawer = false
  202. }
  203. }
  204. }
  205. </script>
  206. <style>
  207. </style>