|
@@ -1478,4 +1478,58 @@ $(document).ready(() => {
|
|
|
return enObj
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+ $('#exportExcel').click(function () {
|
|
|
+ const data = [];
|
|
|
+ const setting = {
|
|
|
+ cols: [
|
|
|
+ {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 80, formatter: '@'},
|
|
|
+ {title: '工料编号', colSpan: '1', rowSpan: '2', field: 'gljcode', hAlign: 0, width: 80, formatter: '@'},
|
|
|
+ {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 220, formatter: '@'},
|
|
|
+ {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, type: 'Number'},
|
|
|
+ {title: '规格', colSpan: '1', rowSpan: '2', field: 'specs', hAlign: 0, width: 100, formatter: '@'},
|
|
|
+ {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 90, formatter: '@'},
|
|
|
+ {title: '单位耗量', colSpan: '1', rowSpan: '2', field: 'quantity', hAlign: 2, width: 90, formatter: '@'},
|
|
|
+ ],
|
|
|
+ headRows: 2,
|
|
|
+ headRowHeight: [25, 25],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ headerFont: 'bold 10px 微软雅黑',
|
|
|
+ font: '10px 微软雅黑'
|
|
|
+ };
|
|
|
+ if (!materialChecklistData || materialChecklistData.length === 0) return;
|
|
|
+ for (const ml of materialChecklistData) {
|
|
|
+ data.push({
|
|
|
+ b_code: ml.b_code, name: ml.name, unit: ml.unit,
|
|
|
+ unit_price: ml.unit_price,
|
|
|
+ });
|
|
|
+ const index = _.findIndex(gclGatherData, { b_code: ml.b_code, name: ml.name, unit: ml.unit, unit_price: ml.unit_price });
|
|
|
+ if (index === -1) continue;
|
|
|
+ const gcl = gclGatherData[index];
|
|
|
+ if (gcl && gcl.leafXmjs) {
|
|
|
+ const gcl_ids = gcl.leafXmjs ? _.uniq(_.map(gcl.leafXmjs, 'gcl_id')) : [];
|
|
|
+ const newMaterialList = _.uniqBy(_.filter(gclList, function (m) {
|
|
|
+ return _.indexOf(gcl_ids, m.gcl_id) !== -1;
|
|
|
+ }), 'mb_id');
|
|
|
+ for(const m of newMaterialList) {
|
|
|
+ const bills = _.find(materialBillsData, { id: m.mb_id });
|
|
|
+ if(bills) {
|
|
|
+ m.code = bills.code;
|
|
|
+ m.name = bills.name;
|
|
|
+ m.unit = bills.unit;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (newMaterialList.length > 0) {
|
|
|
+ for (const nm of newMaterialList) {
|
|
|
+ data.push({
|
|
|
+ gljcode: nm.code, name: nm.name, unit: nm.unit,
|
|
|
+ quantity: nm.quantity,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SpreadExcelObj.exportSimpleXlsxSheet(setting, data, $('.sidebar-title').attr('data-original-title') + "-清单材料单位消耗量.xlsx");
|
|
|
+ });
|
|
|
+
|
|
|
});
|