add.vue 7.1 KB

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