-
@@ -383,8 +385,164 @@
}, 500);
});
+ //加载供方和需方下拉框
+ //供方
+ $.ajax({
+ url: apiUrl + '/api/services/app/Supplier/GetAllSupplier', //请求的url地址
+ dataType: "json", //返回格式为json
+ //async: false,//请求是否异步,默认为异步,这也是ajax重要特性
+ data: {}, //参数值
+ type: "GET", //请求方式
+ success: function (req) {
+ //请求成功时处理
+ var src = '';
+ $.each(req.result.data, function (index, item) {
+ src += '';// 下拉菜单里添加元素
+ //$('#id').append(new Option(item.name, item.id));// 下拉菜单里添加元素,加载速度相对较慢
+ });
+ $('#supplier').html(src);
+ form.render("select");//重新渲染 固定写法
+ },
+ error: function () {
+ /*错误信息处理*/
+ layer.msg("获取供方失败,请重试!");
+ return false;
+ },
+ });
+
+ //需方
+ $.ajax({
+ url: apiUrl + '/api/services/app/Supplier/GetAllSupplier', //请求的url地址
+ dataType: "json", //返回格式为json
+ //async: false,//请求是否异步,默认为异步,这也是ajax重要特性
+ data: {}, //参数值
+ type: "GET", //请求方式
+ success: function (req) {
+ //请求成功时处理
+ var src = '';
+ $.each(req.result.data, function (index, item) {
+ src += '';// 下拉菜单里添加元素
+ //$('#id').append(new Option(item.name, item.id));// 下拉菜单里添加元素,加载速度相对较慢
+ });
+ $('#client').html(src);
+ form.render("select");//重新渲染 固定写法
+ },
+ error: function () {
+ /*错误信息处理*/
+ layer.msg("获取需方失败,请重试!");
+ return false;
+ },
+ });
+ //下拉框监听 供方
+ form.on('select(supplier)', function (data) {
+
+ clearsupplierDrop();
+
+ if (data.value != '') {
+ //获取所选供方详细信息
+ $.ajax({
+ url: apiUrl + '/api/services/app/Supplier/Get', //请求的url地址
+ dataType: "json", //返回格式为json
+ //async: false,//请求是否异步,默认为异步,这也是ajax重要特性
+ data: { id: data.value }, //参数值
+ type: "GET", //请求方式
+ success: function (req) {
+ //请求成功时处理
+ var Supplierdata = req.result;
+
+ form.val("addOrder", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
+ "supplier_address": Supplierdata.address,// "name": "value"
+ "supplier_creditcode": Supplierdata.address,// "name": "value"
+ "supplier_bank": Supplierdata.address,// "name": "value"
+ "supplier_bankaccount": Supplierdata.address,// "name": "value"
+ "supplier_telnum": Supplierdata.fixedtelephone,// "name": "value"
+ "supplier_fax": Supplierdata.address,// "name": "value"
+ "supplier_contactperson": Supplierdata.contacts,// "name": "value"
+ "supplier_phonenum": Supplierdata.mobilephone,// "name": "value"
+ "supplier_email": Supplierdata.email,// "name": "value"
+ });
+ },
+ error: function () {
+ /*错误信息处理*/
+ layer.msg("获取所选供方信息失败,请重试!");
+ return false;
+ },
+ });
+
+ }
+ });
+
+
+ //下拉框监听 需方
+ form.on('select(client)', function (data) {
+
+ clearclientrDrop();
+
+ if (data.value != '') {
+ //获取所选供方详细信息
+ $.ajax({
+ url: apiUrl + '/api/services/app/Supplier/Get', //请求的url地址
+ dataType: "json", //返回格式为json
+ //async: false,//请求是否异步,默认为异步,这也是ajax重要特性
+ data: { id: data.value }, //参数值
+ type: "GET", //请求方式
+ success: function (req) {
+ //请求成功时处理
+ var clientdata = req.result;
+
+ form.val("addOrder", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
+ "client_address": clientdata.address,// "name": "value"
+ "client_creditcode": clientdata.address,// "name": "value"
+ "client_bank": clientdata.address,// "name": "value"
+ "client_bankaccount": clientdata.address,// "name": "value"
+ "client_telnum": clientdata.fixedtelephone,// "name": "value"
+ "client_fax": clientdata.address,// "name": "value"
+ "client_contactperson": clientdata.contacts,// "name": "value"
+ "client_phonenum": clientdata.mobilephone,// "name": "value"
+ "client_email": clientdata.email,// "name": "value"
+ });
+ },
+ error: function () {
+ /*错误信息处理*/
+ layer.msg("获取所选需方信息失败,请重试!");
+ return false;
+ },
+ });
+
+ }
+ });
+
+ //清除供方下拉框数据
+ function clearsupplierDrop() {
+ form.val("addOrder", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
+ "supplier_address": '',
+ "supplier_creditcode": '',
+ "supplier_bank": '',
+ "supplier_bankaccount": '',
+ "supplier_telnum": '',
+ "supplier_fax": '',
+ "supplier_contactperson": '',
+ "supplier_phonenum": '',
+ "supplier_email": '',
+ });
+ }
+
+ //清除需方下拉框数据
+ function clearclientrDrop() {
+ form.val("addOrder", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
+ "client_address": '',
+ "client_creditcode": '',
+ "client_bank": '',
+ "client_bankaccount": '',
+ "client_telnum": '',
+ "client_fax": '',
+ "client_contactperson": '',
+ "client_phonenum": '',
+ "client_email": '',
+ });
+ }
/**
* toolbar监听事件